depending on which version of d3d you are using you can do the following:
for d3d9
Code:
float timer: register(c0);
notice that in this case the timer variable will occupy the entire c0 register.
you can pack your variable into a vector or a structure to be more efficient, like this:
Code:
float4 PackedVariables: register(c0);
or
Code:
struct MyStruct {
float t;
float t2;
float2 t3;
};
MyStruct v: register(c1);
for d3d10 and higher you can specify the register offset
so you can use overlapping registers like this:
Code:
float timer: register(c0[0]);
float some_other_var: register(c0[1]);
then you can use SetPixelShaderConstantF function:
Code:
SetPixelShaderConstantF(0, @Data, 1);//for c0 register; in this case Data should be a float vector4 type.
Bookmarks