SetVertexShaderConstantB (or I)

Started by
1 comment, last by neeker 10 years, 7 months ago

Hi,

I've been rewriting my engine so that it doesn't use D3DX and I've gotten almost everything done ... except I can't get SetVertexShaderConstantB/I to work. SetVertexShaderConstantF works just fine (and I'm considering just using that, but I'm bullheaded).

So, in my vertex shader I'll have something like:


bool bIsSelected : register(c4);

And in my rendering path, after I have called SetVertexShader, I will do something like:


         uint u = 1;
         hr = gp_DXInterface->SetVertexShaderConstantB(4, (const BOOL*)&u, 1);

Yet, bIsSelected will always be false. I don't see any errors or warnings. Has anyone else got these functions to work?

EDIT: For what it's worth, calling SetVertexShaderConstantF works to set bIsSelected.

Advertisement

That function sets the constant boolean registers, which are named b0-b7. You've mapped "bIsSelected" to a constant float register (c0-c255), so to set the value you must use SetVertexShaderConstantF. Try mapping your constant to b0.

As for SetVertexShaderConstantI, that function works with constant integer registers.

Very good. Thank you MJP!

This topic is closed to new replies.

Advertisement