Fail to Set Some Pixel Shader Parameters

Started by
5 comments, last by MysteryX 8 years, 6 months ago
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.
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?

#define width  (p0[0])
#define height (p0[1])

Could it be these lines? What if you replace them with .x/.y?

.:vinterberg:.

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 ?

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?

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

This topic is closed to new replies.

Advertisement