Sign in to follow this  

ARB assembly issues, SM3.0

This topic is 3631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Question to all the GL and ARB gurus out there-- I'm working on a mod project for Doom 3 and am trying to implement interval mapping as an extension of good ol' Fabio Policarpo's tech demo. I'd like to be able to use some dynamic branching for interval search refinement. I enabled the nv_fragment_program2 option in the fragment program and everything works fine. I try and use the IF and LOOP instructions and everything goes to hell,(no pun intended) all surfaces become black. A quick look in the console reveals that my shader failed compilation, had errors, something to that effect. Two questions, the first being "Why is this not working when the syntax is verifiably correct and the hardware (nVidia GeForce 7900GTX) supports it?" and the second being "Is there a vendor neutral extension I can use that supports branching like this?" If there isn't a neutral variety, is there an ATi extension that does branching? I don't mind having to replace my code; I just want this to run on SM3.0 hardware from both IHVs. Forgive my lack of experience, I'm primarily a DirectX guy and bear a deep hatred for assembly language for exactly this kind of reason.

Share this post


Link to post
Share on other sites
I ran into a similar problem a few days ago. It seems like the ARB assembly doesn't permit dynamic branching at all, no matter the hardware capabilities.

I'm using CG for my shaders, which has plenty of NVidia-specific profiles (that do allow dynamic branches), but the ARB profiles (arbfp1 and arbvp1) didn't support it. I didn't really find a way around this in my case at least.

As for your case, are Doom3 shaders written in ARB assembly? I'd have thought some of their shaders (or at least other mods) used dynamic branching, so isn't there some existing code you can look at?

Share this post


Link to post
Share on other sites
Sadly, Carmack didn't have access to GLSL when Doom 3 was made. No dice, I would love to have a high-level language to work with as it makes things soooo much easier. In short, yes, they are ARBfp and vp1.0. Odd, considering I'm following the directions directly from the nVidia specification, and I believe this is what they say to do.

Bugger. Policarpo used a big system of hacks, for lack of a better way to describe them, to get the conditionals in the original relief mapping. Basically consisted of some CMPs and multiplication of said values with the view vector. Unfortunately I require specific tests and multiple branches of execution in order to be able to do interval mapping. There might be a way to adjust the bounds, I'd have to think for a while to devise a way, but until that point I'm stuck.

Share this post


Link to post
Share on other sites
The only way to use dynamic branching in GL assembly is "OPTION NV_fragment_program2". Yes, it doesn't work on non-NV hardware. ARB asm supports only static branching.
Saddenly, neither ARB nor khronos doesn't going to update asm specifications. There is no portable way to use new hardware features without GLSL.

Share this post


Link to post
Share on other sites
Quote:
Original post by keltar
The only way to use dynamic branching in GL assembly is "OPTION NV_fragment_program2". Yes, it doesn't work on non-NV hardware. ARB asm supports only static branching.
Saddenly, neither ARB nor khronos are going to update asm specifications. There is no portable way to use new hardware features without GLSL.


Any idea on why the IF/ENDIF and LOOP/ENDLOOP instructions fail, then? I can post the source if you'd like.

Share this post


Link to post
Share on other sites
Yeah, i'm tested it, it seems like doom3 looks for 'END' substring (something like strstr(program_code, "END")), and when it finds END, ENDIF or ENDLOOP it truncates program at this point. Then program compilation fails on unclosed IF or LOOP.

For now, i have no ideas how to use this instructions in doom3.

Share this post


Link to post
Share on other sites

This topic is 3631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this