* Fix for "Internal error wrong operand type built in unary operator function. Type: in sampler2DMS" if multisample is not being used (old ATI driver bug)
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8326 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
parent
fd3c84ccce
commit
d38b469de6
@ -1,62 +1,62 @@ |
||||
#extension GL_ARB_texture_multisample : enable |
||||
|
||||
uniform int m_NumSamples; |
||||
uniform int m_NumSamplesDepth; |
||||
|
||||
#ifdef RESOLVE_MS |
||||
#define COLORTEXTURE sampler2DMS |
||||
#else |
||||
#define COLORTEXTURE sampler2D |
||||
#endif |
||||
|
||||
#ifdef RESOLVE_DEPTH_MS |
||||
#define DEPTHTEXTURE sampler2DMS |
||||
#else |
||||
#define DEPTHTEXTURE sampler2D |
||||
#endif |
||||
|
||||
// NOTE: Only define multisample functions if multisample is being used! |
||||
#ifdef GL_ARB_texture_multisample |
||||
vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){ |
||||
ivec2 iTexC = ivec2(texC * textureSize(tex)); |
||||
vec4 color = vec4(0.0); |
||||
for (int i = 0; i < numSamples; i++){ |
||||
color += texelFetch(tex, iTexC, i); |
||||
} |
||||
return color / numSamples; |
||||
} |
||||
|
||||
vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sample){ |
||||
ivec2 iTexC = ivec2(texC * textureSize(tex)); |
||||
return texelFetch(tex, iTexC, sample); |
||||
} |
||||
|
||||
vec4 getColor(in sampler2DMS tex, in vec2 texC){ |
||||
return textureFetch(tex, texC, m_NumSamples); |
||||
} |
||||
|
||||
vec4 getColorSingle(in sampler2DMS tex, in vec2 texC){ |
||||
ivec2 iTexC = ivec2(texC * textureSize(tex)); |
||||
return texelFetch(tex, iTexC, 0); |
||||
} |
||||
|
||||
vec4 getDepth(in sampler2DMS tex,in vec2 texC){ |
||||
return textureFetch(tex,texC,m_NumSamplesDepth); |
||||
} |
||||
#endif |
||||
|
||||
vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sample){ |
||||
return texture2D(tex,texC); |
||||
} |
||||
|
||||
vec4 getColor(in sampler2D tex, in vec2 texC){ |
||||
return texture2D(tex,texC); |
||||
} |
||||
|
||||
vec4 getColorSingle(in sampler2D tex, in vec2 texC){ |
||||
return texture2D(tex, texC); |
||||
} |
||||
|
||||
vec4 getDepth(in sampler2D tex,in vec2 texC){ |
||||
return texture2D(tex,texC); |
||||
#extension GL_ARB_texture_multisample : enable |
||||
|
||||
uniform int m_NumSamples; |
||||
uniform int m_NumSamplesDepth; |
||||
|
||||
#ifdef RESOLVE_MS |
||||
#define COLORTEXTURE sampler2DMS |
||||
#else |
||||
#define COLORTEXTURE sampler2D |
||||
#endif |
||||
|
||||
#ifdef RESOLVE_DEPTH_MS |
||||
#define DEPTHTEXTURE sampler2DMS |
||||
#else |
||||
#define DEPTHTEXTURE sampler2D |
||||
#endif |
||||
|
||||
// NOTE: Only define multisample functions if multisample is available and is being used! |
||||
#if defined(GL_ARB_texture_multisample) && (defined(RESOLVE_MS) || defined(RESOLVE_DEPTH_MS)) |
||||
vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){ |
||||
ivec2 iTexC = ivec2(texC * textureSize(tex)); |
||||
vec4 color = vec4(0.0); |
||||
for (int i = 0; i < numSamples; i++){ |
||||
color += texelFetch(tex, iTexC, i); |
||||
} |
||||
return color / numSamples; |
||||
} |
||||
|
||||
vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sample){ |
||||
ivec2 iTexC = ivec2(texC * textureSize(tex)); |
||||
return texelFetch(tex, iTexC, sample); |
||||
} |
||||
|
||||
vec4 getColor(in sampler2DMS tex, in vec2 texC){ |
||||
return textureFetch(tex, texC, m_NumSamples); |
||||
} |
||||
|
||||
vec4 getColorSingle(in sampler2DMS tex, in vec2 texC){ |
||||
ivec2 iTexC = ivec2(texC * textureSize(tex)); |
||||
return texelFetch(tex, iTexC, 0); |
||||
} |
||||
|
||||
vec4 getDepth(in sampler2DMS tex,in vec2 texC){ |
||||
return textureFetch(tex,texC,m_NumSamplesDepth); |
||||
} |
||||
#endif |
||||
|
||||
vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sample){ |
||||
return texture2D(tex,texC); |
||||
} |
||||
|
||||
vec4 getColor(in sampler2D tex, in vec2 texC){ |
||||
return texture2D(tex,texC); |
||||
} |
||||
|
||||
vec4 getColorSingle(in sampler2D tex, in vec2 texC){ |
||||
return texture2D(tex, texC); |
||||
} |
||||
|
||||
vec4 getDepth(in sampler2D tex,in vec2 texC){ |
||||
return texture2D(tex,texC); |
||||
} |
Loading…
Reference in new issue