Quantcast
Channel: AMD Developer Forums: Message List - OpenGL & Vulkan
Viewing all articles
Browse latest Browse all 631

GLSL Fragment Shader problem

$
0
0

Hi,

 

I'm a newbie with GLSL and currently experiencing a crash in a fragment shader on my ATI FirePro V and have no idea why. 

 

If I take out the for loop it seems to work, although I don't think that should matter.  Are there issues with for loops on ATI cards?  Could the vertex shader be the cause of the problem instead?

 

It runs fine on my intel and NVidia cards.  Any help would be much appreciated - here's the complete code for the fragment shader:

 

struct Accumulator

{

    float m_sumOfWeightedValues;

    float m_sumOfWeights;

};

 

void main()

{

    Accumulator acc = Accumulator(0.0f,0.0f);

 

    // For each cell in range

    for(int x=0;x<=1;x++)

    {

        acc.m_sumOfWeights = 0.0f;

        acc.m_sumOfWeightedValues = 0.0f;

    }

 

    if( acc.m_sumOfWeights > 0.0f )

    {

        // Clamp uv to half texel from edge to avoid interpolation / wrapping.

        float padding = 0.5f / textureSize(s_texture_1,0).x;

        float w = clamp(1.0f,padding,1.0f - padding);

        s_frag_color =  texture(s_texture_1,vec2(w,0),0);

    }

}

 

 

 

Any help would be much appreciated.

 

Cheers,

Simon


Viewing all articles
Browse latest Browse all 631

Trending Articles