Jump to content
  • Advertisement
Sign in to follow this  
MysteryX

Fail to Set Some Pixel Shader Parameters

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

I'm using this to set HLSL Pixel Shader parameters
ID3DXConstantTable::SetVector(m_pDevice, name, vector);

This is the shader I'm trying to configure
https://github.com/zachsaw/MPDN_Extensions/blob/master/Extensions/RenderScripts/SuperRes/SuperResEx.hlsl

I successfully use the function to set "size1" and "args0", but it fails for "p0" and "p1". Why is that? Is there something different between p0 and args0? If I simply replace p0 with args0 with the same code, then it doesn't crash.

Share this post


Link to post
Share on other sites
Advertisement

f I simply replace p0 with args0 with the same code, then it doesn't crash.

Where/how does it crash if you don't do that?

Share this post


Link to post
Share on other sites

Where/how does it crash if you don't do that?

SetVector fails.

#define width  (p0[0])
#define height (p0[1])
Could it be these lines? What if you replace them with .x/.y?


Why would these be an issue when this works?

float4 size1 : register(c2);
#define originalSize size1
#define ddxddy (originalSize.zw)

Btw is there a way to set c2 instead of size1 ?

Share this post


Link to post
Share on other sites

Where/how does it crash if you don't do that?

SetVector fails.
It crashes when you call SetVector? That's kinda important. What's the crash message? What's the arguments to the function? Why is it crashing? Are you using bad pointers on that line?

Share this post


Link to post
Share on other sites

Why would these be an issue when this works?

He suggested you change it into “what works”.
But since those macros are not used in the file, there is no reason that would be the problem.

I agree that you need to investigate the call to SetVector(), the sizes of your globals (in the shader), and their register locations (since you manually placed them).

Change all of them to float4, add space between your register locations, and examine the SetVector() call.


L. Spiro

Share this post


Link to post
Share on other sites
After doing various tests, I found out that it fails to set parameters that are not being used in the script. They are being removed at compile-time as an optimization.

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!