Jump to content
  • Advertisement
Sign in to follow this  
ClementLuminy

Getting HLSL parameter default value pb ...

This topic is 4172 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

Hello ! I need to get the default parameter value of a global HLSL parameter. Here is my parameter declaration inside my HSLS file: ... const int Light_SupportedOrthographicLightCount = 1; ... and inside my application, i use the follwoing code: ... D3DXCONSTANT_DESC parameter_desc; UINT parameter_count; parameter_count = 1; GetVertexShaderConstantTable()->GetConstantDesc( parameterhandle, ¶meter_desc, ¶meter_count ); int value; value = *((INT*)parameter_desc.DefaultValue); ... I'm sure that i acces the good parameter, because, inside the resulting parameter descriptor, every fields are valid ( parameter name and so on ... ) The only thing that is not valid is the "DefaultValue" field, when i derefence it, i do not get the expected default value ( 1 ) but a value like 0x40800000 .... Does anybody know what is wrong here ??? Thanks a lot !! CLement

Share this post


Link to post
Share on other sites
Advertisement
0x40800000 looks a bit like a pointer to me (for the PC). Do you get a crash if you use *(UINT**)parameter_desc.DefaultValue ? I've never played with this stuff, but perhaps its returning an array of default values (of which a scalar has one element)?

Share this post


Link to post
Share on other sites
It also looks very similar to a floating point number. If the constant was mapped to a c register then it would be a floating point value, and not the integer value you assume. I have seen the HLSL compiler do just that too.

Share this post


Link to post
Share on other sites
int i = 0x3f800000;
float f = *(float*)&i; // f == 1.0f (use reinterpret_cast if you like)


Maybe what you're seeing is the int representation of a float value ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!