Shader inputs and outputs

Started by
3 comments, last by Rompa 14 years ago
I'm trying to get a filter working but my vertex shader isn't passing values through to my pixel shader. Currently I have these shaders

void bayerFilter_VS(float4 position : POSITION,
                    float2 tex      : TEXCOORD0,
                    out float4 Position : POSITION,  // vertex position 
                    out float4 center   : TEXCOORD0,
                    out float4 xCoord   : TEXCOORD1,
                    out float4 yCoord   : TEXCOORD2)
{   
    sourceSize = float4(1920.0, 1080.0, 1.0/1920.0, 1.0/1080.0);
    
    
    center.xy   = tex;
    center.zw   = float2(0.5, 0.5);// tex * sourceSize.xy + float2(0.0, 0.0);
    
    float2 invSize = sourceSize.zw; // .zw = fractional distance between pixels on source tecture
    xCoord = center.x + float4(-2.0 * invSize.x, -invSize.x, invSize.x, 2.0 * invSize.x);
    yCoord = center.y + float4(-2.0 * invSize.y, -invSize.y, invSize.y, 2.0 * invSize.y);
    
    // verticies are pre-transformed
    Position = position;
}

void bayerFilter_PS(    float4 center  : TEXCOORD0, 
                        float4 xCoord  : TEXCOORD1,
                        float4 yCoord  : TEXCOORD2,
                    out float4 outColour : COLOR)
{  
    outColour = float4(center.z, center.w, 0.0, 1.0);
}
    
the pixel shader is currently stripped down to nothing just to see if the vales are making it through. As you can see the vertex shader puts (0.5, 0.5) into the .zw components of center which is bound to the TEXCOORD0 semantic. I'm outputting the .zw components in the pixel shader and would expect this to render a dull reddish green texture at the end, but it comes out bright green which indicates that the .zw component is not getting passed through correctly. Can anyone tell me why this is? Cheers
---When I'm in command, every mission's a suicide mission!
Advertisement
I'm using D3DFVF_XYZRHW for ther verticies which I've just seen in another thread means the vertex shader is ignored.

I changed my shader so the pass didn't include the Vertex shader and got the same green result, is this the reason then?
---When I'm in command, every mission's a suicide mission!
My guess is that the texture coordinate interpolators does not support 4 components.
Quote:Original post by stalef
My guess is that the texture coordinate interpolators does not support 4 components.


No, they do.

I would suggest that you simply check out the draw call or debug the shader in PIX. That should tell you exactly what's going on.

Do you have a write mask set which is excluding red?
Do you have an opaque blend mode set?
What is your render target format? Floating point or unsigned integer colours?

This topic is closed to new replies.

Advertisement