Quote: Constant Controls •Direct-mapped to specific registers –Consistency with legacy paths –Don’t have to deal with HLSL constant table const float4g_EnvmapTint: register( c0 ); const float3g_EnvmapContrast: register( c2 ); const float3g_EnvmapSaturation: register( c3 ); const float4g_FresnelReflectionReg: register( c4 ); const floatg_OverbrightFactor: register( c6 ); const float4g_SelfIllumTint: register( c7 );How do you set hlsl constant without using a constant table ? I see how for texture sampler and texture, but not for constant : integer, matrix etc. Thanx EDIT: http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf.
hlsl constant
I read in the pdf about hl2 shading :
Quote:
How do you set hlsl constant without using a constant table ? I see how for texture sampler and texture, but not for constant : integer, matrix etc.
If you use the effects framework (ID3DXEffect), it is very easy. There are a number of functions you can use to do it, such as:
SetValue() (this is the general one that can set any type)
SetMatrix()
SetInt()
SetBool()
SetFloat()
SetVector()
All of these also have array versions that let you set an array of constants.
I think the effects framework uses constant tables internally whether you like it or not. It's when you're dealing with the raw pixel/vertex shaders that you can ignore it (specify NULL instead of a pointer for an ID3DXConstantTable during compilation).
If you use the shaders directly, you can then use SetPixelShaderConstantB(), SetPixelShaderConstantF() and SetPixelShaderConstantI() to get at the register contents directly.
hth
Jack
If you use the shaders directly, you can then use SetPixelShaderConstantB(), SetPixelShaderConstantF() and SetPixelShaderConstantI() to get at the register contents directly.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement