Sign in to follow this  

Address register performance

Recommended Posts

Hello! I'm currently working on a lighting/shadowing shader system. I've opted for runtime linking of HLSL fragments (my target is SM 3.0) and I've run across an issue with shader constants. As each shader might be processing several different lights (1-8 usually) there would be quite heavy constant changing traffic. Therefore I thought of this scheme: I would assign a range of constants (c128-c255 for example) for lights constants and each visible light would have fixed constants block (e.g. light1 would occupy c128-c131, light2 c132-c135 and so on) that would be filled with some caching (most lights are static). In the rendering pass I would only set a constant with offsets into the light constants range and the shader would get the lights parameters with the help of the a0 address register. My question is, whether this would be faster and more efficient than the brute force approach of refilling all the constants per Draw* call. Thanks for your responses

Share this post

Link to post
Share on other sites

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