Jump to content
  • Advertisement
Sign in to follow this  
xerzi

Using certain techniques from Pixel Shader

This topic is 2587 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 know there is a way to specify a "technique" in a pixel shader, where you than can have multiple passes. How would I go about picking a certain technique in C++ directx9 for that pixel shader? I'm not sure in general how it works, I'm thinking you can pick it out by name?

Share this post


Link to post
Share on other sites
Advertisement
It's part of the effects framework...you can only use techniques and passes if you compile your file as an effect, and then load it as an ID3DXEffect. Then you can use SetTechnique to set the current technique by handle or by name.

Share this post


Link to post
Share on other sites
Alright thanks. While I'm at it I'm having some trouble understanding how constants work.


//vertex shader

float4x4 bones[32];

float4 color;

float4 mainVS(float3 pos : Position ) : Position {
return pos;
}



How would I setVertexShaderConstantf the bones and color? What registers would they be at?



matrix4x4 bones[12];

device->setVertexShaderConstantF( 0, bones, 4 * 12 );

float color[4];

device->setVertexShaderConstantF( 128, color, 1);

Share this post


Link to post
Share on other sites
You can either explicitly assign registers, or let the compiler auto-assign them. Assigning registers is done like this:

float4 color : register(c0);


If you let the compiler auto-assign them, you can find out the register for a constant using ID3DXConstantTable.

Share this post


Link to post
Share on other sites
So if I do something like this:


float4x4 bones[32] : register(c0);
float4 color : register(c128);


registers 0 to 127 will be for the bones, than 128 will be color?

Share this post


Link to post
Share on other sites

So if I do something like this:


float4x4 bones[32] : register(c0);
float4 color : register(c128);


registers 0 to 127 will be for the bones, than 128 will be color?


Yes, that's right.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!