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

GLSL textureOffset using sampler2DArrayShadow compilation error

$
0
0

Greetings -

 

Debugging an issue here with one of the shaders which works fine on other hardware, but fails to compile on my Radeon 7950. Using Catalyst 14.1 Beta driver here (since I wanted to try out Mantle on BF4 ) on this machine, haven't tried other AMD GPUs yet, on different drivers. but this might be a known issue.

 

The shader fetches texels from a sampler2DArrayShadow, averages them via PCF and that works fine using texture(...)

 

[Snippet]

uniform sampler2DArrayShadow    m_shadowSampler[kMaxShadowSamplers];

... // Compute other stuff, set index by comparing with cascade bounds

vec4 shadowPos = m_entityparameters.m_biasedShadowMvp[lightIndex*kMaxShadowCascades+index] * vec4(shaderInput.m_position, 1.f);

... // Add layer to vec4, bias z etc.

float sum = texture(m_shadowSampler[lightIndex], shadowPos);  

 

Now using a gaussian kernel to smooth the borders, the shader does this:

 

  // Gaussian 3x3 kernel

    float sum = texture(m_shadowSampler[lightIndex], shadowPos) * 0.25f;   

    vec4 samples;

    samples.x = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2(-1,-1));

    samples.y = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2(-1,+1));

    samples.z = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2(+1,-1));

    samples.w = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2(+1,+1));

    sum += dot(vec4(0.0625f), samples);   

    samples.x = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2(-1, 0));

    samples.y = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2( 0,-1));

    samples.z = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2( 0,+1));

    samples.w = textureOffset(m_shadowSampler[lightIndex], shadowPos, ivec2(+1, 0));

    sum += dot(vec4(0.125f), samples);

 

Compiles fine on Nvidia hardware for example, but shader compiler on 14.1 reports:

 

Source:Shader Compiler  Type:Error      ID:2000

Severity:High   Message:glCompileShader failed to compile a GLSL shader with the

following shader info log: 'Fragment shader failed to compile with the followin

g errors:

ERROR: 1:110: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:111: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:112: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:113: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:116: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:117: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:118: error(#202) No matching overloaded function found: textureOffset

ERROR: 1:119: error(#202) No matching overloaded function found: textureOffset

ERROR: error(#273) 8 compilation errors.  No code generated

 

The specs says:

textureOffset - OpenGL 4 Shading Language Reference Pages

float textureOffset(sampler2DArrayShadow sampler,
vec4 P,
vec2 offset);

 

Noticed the vec2 instead of ivec2 that I'm using, not sure if this is a typo in the spec. Nonetheless, I've tried using vec2 with the same effect.

 

Any clues?

 

Thanks


Viewing all articles
Browse latest Browse all 631

Trending Articles