Sign in to follow this  
MysteryX

Fail to Set Some Pixel Shader Parameters

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this