Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

How do I pass a "uniform value" / Shader permutations

$
0
0

@kosmonautgames wrote:

What is wrong with this implementation?

I can't seem to find a way to pass uniforms during compile time like i could in xna, did something change?

technique WithValueOne
{
    pass Pass1
    {
        VertexShader = compile vs_5_0 VertexShaderFunction();
        PixelShader = compile ps_5_0 PixelShaderFunction(1);
    }
}

technique WithValueZero
{
    pass Pass1
    {
        VertexShader = compile vs_5_0 VertexShaderFunction();
        PixelShader = compile ps_5_0 PixelShaderFunction(0);
    }
}

and in my Pixelshader

PixelShaderFunction(VertexShaderOutput input, uniform float inputvalue)
{
     ...
     if(inputvalue > 0) 
{ do stuff }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles