Advertisement Jump to content
Sign in to follow this  
ProgrammerDX

Pixel Shader 3 weirdness

This topic is 972 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 all,

 

I have this simple post process blur shader:

 

sampler ColorSampler1 : register(s0);

#define SAMPLE_SIZE 15

float2 texelSize;
float offsets[SAMPLE_SIZE];
float weights[SAMPLE_SIZE];

float4 PS_BlurH(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 sum = float4(0.f, 0.f, 0.f, 1.f);
    
    [loop]
    for (int i = 0; i < SAMPLE_SIZE; i++)
        sum += tex2D(ColorSampler1, float2(texCoord.x + (offsets[i] * texelSize.x), texCoord.y)) * weights[i];
    
    clip(sum.a < 0.01f ? -1 : 1);
    
    return sum;
}

float4 PS_BlurV(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 sum = float4(0.f, 0.f, 0.f, 1.f);
    
    [loop]
    for (int i = 0; i < SAMPLE_SIZE; i++)
        sum += tex2D(ColorSampler1, float2(texCoord.x, texCoord.y + (offsets[i] * texelSize.y))) * weights[i];
    
    clip(sum.a < 0.01f ? -1 : 1);
    
    return sum;
}

technique Glow
{
    pass BlurHorizontal
    {
        PixelShader = compile ps_2_0 PS_BlurH();
    }
    
    pass BlurVertical
    {
        PixelShader = compile ps_2_0 PS_BlurV();
    }
}

 

But if I change ps_2_0 to ps_3_0 the shader doesn't work anymore? No errors on compiling...

 

Anyone with a clue?

Share this post


Link to post
Share on other sites
Advertisement

From experience, not as a Microsoft employee, I always seem to recall that VS Shader Model had to match PS Shader Model and that any mismatch between the versions was not guaranteed to work. I believe it worked on either AMD or NVIDIA hardware, not the other's, but I can't remember which way round that was. So I think Mona200 may be on to something.

Share this post


Link to post
Share on other sites

The others are right. It is a requirement to match VS 3.0 shaders with PS 3.0

The only exception is VS_SW 3.0 which can be matched with PS 2.0 (very old Intel cards).

 

If you turn on the Debug Layer you would have spotted this issue. The Debug Runtimes are your friend.

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!