Jump to content
  • Advertisement
Sign in to follow this  
wswqwps

How to share parameters between shaders

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

Hi, I want to share some parameters between my pixel shaders but do not want to use effect. How can I do this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You mean you want to pass data to the shader using just a few variable that you will continually re-use. Or you want to pass data from one shader to another? Or are you trying to make things easier to read in your code without having a bunch of different named variables?

Share this post


Link to post
Share on other sites
Quote:
Original post by david w
You mean you want to pass data to the shader using just a few variable that you will continually re-use. Or you want to pass data from one shader to another? Or are you trying to make things easier to read in your code without having a bunch of different named variables?


The shader is like this:

//------------
//Shader.fx
//------------
int var_1 = 1;

float4 PS_main_1( ... )
{
some_calc( var_1 );
}

float4 PS_main_2( ... )
{
another_calc( var_1 );
}


I know the variable var_1 will be treated as two vars just have the same name and each pixel shader will have its own copy. Now I want to share var_1 between the two pixel shaders, for example, I can set the var_1 to 1 when used in PS_main_1 and then change it to 2 and use in PS_main_2. Thanks.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!