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

Re: [BUG REPORT] texelFetch shader crash on MSAA FBO

$
0
0

Found the source of the problem. By using an array of multisample samplers in the shader there is an error when accessing any sampler greater than index 0. Unsure as to the cause of this problem as of yet but by changing the above shader code to the new below fixes the issue.

 

#version 400
precision mediump float;

// :: In Information ::
in vec2 TexCoord0;    // Co-ordinate of screen UV
in vec2 TexCoord1; // Co-ordinate from center of screen

// : Texture Maps :
uniform samplerCube EnvironmentMap;
uniform sampler2DMS Texture0,Texture1,Texture2,Texture3,Texture4;

#define FBO_DIFFUSE_AO Texture0
#define FBO_SPECULAR_GLOSS Texture1
#define FBO_NORMALS Texture2
#define FBO_EMISSIVE Texture3
#define FBO_DEPTH Texture4

// :: Uniforms ::
layout (std140) uniform Static_Data {    // Per Window Initialization    uniform mat4 ProjectionMatrix;    uniform vec2 TexelSize;    uniform float FarCullDistance;    uniform float NearCullDistance;    uniform float CullDistanceRatio;    uniform float Time;    uniform uint Samples;
};

layout (std140) uniform Dynamic_Data { // Per Frame
    uniform mat4 ViewMatrix;    uniform mat4 ViewProjectionMatrix;
};

void main()
{
    vec3 Color;    ivec2 TexCoord2 = ivec2(TexCoord0 / TexelSize);    vec4 color = texelFetch(FBO_DEPTH, TexCoord2, 0);    gl_FragData[0] = color;
}

 

The change from using the TextureSampler array and binding each sampler as individual's resolves the issue.


Viewing all articles
Browse latest Browse all 631

Trending Articles