shader constants

Started by
0 comments, last by reillyhead 20 years, 11 months ago
hi, 2 things: when a shader is set via SetShader , are all the constant registers cleared, or reloaded to the previous state (or something else)? if i remember correctly any constants specified with the def operation in the shader will overwrite other values. Also, has anyone come up with a nice system for automatically loading shader constants for an arbitrary shader? cheers Marc
Advertisement
My advice is start using effect files. Imagine instead of having separate shader and state managers, it’s all rolled into one. Under one hood you can support vertex shaders, pixel shaders, high level shaders, the fixed function pipeline - and the render states that are often tied to these. If your engine is set up right, you''ll be able to support any or all of these - changing and adding rendering methods with out recompiling .

One nicety is effect parameter pools, where parameters (which can be used as shader constants) are shared between effects. I use one ''global'' pool for simplicities sake in my engine.

ATI/Nvidia also covered some of this at the last GDC (you can find the proceedings at both of their websites). They tie it together with HLSL but you need not use HLSL to reap the benefits of using effect files. Also read the latest article about driving directx at msdn.com.

Sorry for not directly answering your questions, but having dealt with your same issues before, I thought I''d point the way.

Chapel

This topic is closed to new replies.

Advertisement