Implement GL_OES_texture_buffer.

This commit is contained in:
John Kessenich 2015-08-16 12:52:19 -06:00
parent 30314590ff
commit 302b46aebc
6 changed files with 233 additions and 7 deletions

View File

@ -181,3 +181,53 @@ void pfoo()
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
uniform samplerBuffer badSamp1; // ERROR, reserved
uniform isamplerBuffer badSamp2; // ERROR, reserved
uniform usamplerBuffer badSamp3; // ERROR, reserved
uniform writeonly imageBuffer badSamp4; // ERROR, reserved
uniform writeonly iimageBuffer badSamp5; // ERROR, reserved
uniform writeonly uimageBuffer badSamp6; // ERROR, reserved
#extension GL_OES_texture_buffer : enable
#extension GL_EXT_texture_buffer : enable
uniform samplerBuffer noPreSamp1; // ERROR, no default precision
uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
precision highp samplerBuffer;
precision highp isamplerBuffer;
precision highp usamplerBuffer;
precision highp imageBuffer;
precision highp iimageBuffer;
precision highp uimageBuffer;
#ifdef GL_OES_texture_buffer
uniform samplerBuffer bufSamp1;
uniform isamplerBuffer bufSamp2;
uniform usamplerBuffer bufSamp3;
#endif
#ifdef GL_EXT_texture_buffer
uniform writeonly imageBuffer bufSamp4;
uniform writeonly iimageBuffer bufSamp5;
uniform writeonly uimageBuffer bufSamp6;
#endif
void bufferT()
{
highp int s1 = textureSize(bufSamp1);
highp int s2 = textureSize(bufSamp2);
highp int s3 = textureSize(bufSamp3);
highp int s4 = imageSize(bufSamp4);
highp int s5 = imageSize(bufSamp5);
highp int s6 = imageSize(bufSamp6);
highp vec4 f1 = texelFetch(bufSamp1, s1);
highp ivec4 f2 = texelFetch(bufSamp2, s2);
highp uvec4 f3 = texelFetch(bufSamp3, s3);
}

View File

@ -40,12 +40,32 @@ GL_EXT_gpu_shader5
GL_OES_gpu_shader5
ERROR: 0:177: 'variable indexing buffer block array' : not supported with this profile: es
ERROR: 0:182: 'textureGatherOffsets(...)' : must be a compile-time constant: offsets argument
ERROR: 36 compilation errors. No code generated.
ERROR: 0:185: 'samplerBuffer' : Reserved word.
ERROR: 0:185: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:186: 'isamplerBuffer' : Reserved word.
ERROR: 0:186: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:187: 'usamplerBuffer' : Reserved word.
ERROR: 0:187: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:188: 'imageBuffer' : Reserved word.
ERROR: 0:188: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:189: 'iimageBuffer' : Reserved word.
ERROR: 0:189: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:190: 'uimageBuffer' : Reserved word.
ERROR: 0:190: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:195: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:196: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:197: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:198: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:199: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:200: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 54 compilation errors. No code generated.
Shader version: 310
Requested GL_EXT_texture_buffer
Requested GL_OES_gpu_shader5
Requested GL_OES_shader_io_blocks
Requested GL_OES_texture_buffer
ERROR: node is still EOpNull!
0:12 Function Definition: main( (global void)
0:12 Function Parameters:
@ -364,6 +384,57 @@ ERROR: node is still EOpNull!
0:182 0.100000
0:182 0.100000
0:182 'offsets' (uniform 4-element array of highp 2-component vector of int)
0:220 Function Definition: bufferT( (global void)
0:220 Function Parameters:
0:222 Sequence
0:222 Sequence
0:222 move second child to first child (temp highp int)
0:222 's1' (temp highp int)
0:222 Function Call: textureSize(sB1; (global highp int)
0:222 'bufSamp1' (uniform highp samplerBuffer)
0:223 Sequence
0:223 move second child to first child (temp highp int)
0:223 's2' (temp highp int)
0:223 Function Call: textureSize(isB1; (global highp int)
0:223 'bufSamp2' (uniform highp isamplerBuffer)
0:224 Sequence
0:224 move second child to first child (temp highp int)
0:224 's3' (temp highp int)
0:224 Function Call: textureSize(usB1; (global highp int)
0:224 'bufSamp3' (uniform highp usamplerBuffer)
0:226 Sequence
0:226 move second child to first child (temp highp int)
0:226 's4' (temp highp int)
0:226 Function Call: imageSize(IB1; (global highp int)
0:226 'bufSamp4' (writeonly uniform highp imageBuffer)
0:227 Sequence
0:227 move second child to first child (temp highp int)
0:227 's5' (temp highp int)
0:227 Function Call: imageSize(iIB1; (global highp int)
0:227 'bufSamp5' (writeonly uniform highp iimageBuffer)
0:228 Sequence
0:228 move second child to first child (temp highp int)
0:228 's6' (temp highp int)
0:228 Function Call: imageSize(uIB1; (global highp int)
0:228 'bufSamp6' (writeonly uniform highp uimageBuffer)
0:230 Sequence
0:230 move second child to first child (temp highp 4-component vector of float)
0:230 'f1' (temp highp 4-component vector of float)
0:230 Function Call: texelFetch(sB1;i1; (global highp 4-component vector of float)
0:230 'bufSamp1' (uniform highp samplerBuffer)
0:230 's1' (temp highp int)
0:231 Sequence
0:231 move second child to first child (temp highp 4-component vector of int)
0:231 'f2' (temp highp 4-component vector of int)
0:231 Function Call: texelFetch(isB1;i1; (global highp 4-component vector of int)
0:231 'bufSamp2' (uniform highp isamplerBuffer)
0:231 's2' (temp highp int)
0:232 Sequence
0:232 move second child to first child (temp highp 4-component vector of uint)
0:232 'f3' (temp highp 4-component vector of uint)
0:232 Function Call: texelFetch(usB1;i1; (global highp 4-component vector of uint)
0:232 'bufSamp3' (uniform highp usamplerBuffer)
0:232 's3' (temp highp int)
0:? Linker Objects
0:? 's' (shared highp 4-component vector of float)
0:? 'v' (buffer highp 4-component vector of float)
@ -413,6 +484,24 @@ ERROR: node is still EOpNull!
0:? 0 (const int)
0:? 0 (const int)
0:? 0 (const int)
0:? 'badSamp1' (uniform mediump samplerBuffer)
0:? 'badSamp2' (uniform mediump isamplerBuffer)
0:? 'badSamp3' (uniform mediump usamplerBuffer)
0:? 'badSamp4' (writeonly uniform mediump imageBuffer)
0:? 'badSamp5' (writeonly uniform mediump iimageBuffer)
0:? 'badSamp6' (writeonly uniform mediump uimageBuffer)
0:? 'noPreSamp1' (uniform mediump samplerBuffer)
0:? 'noPreSamp2' (uniform mediump isamplerBuffer)
0:? 'noPreSamp3' (uniform mediump usamplerBuffer)
0:? 'noPreSamp4' (writeonly uniform mediump imageBuffer)
0:? 'noPreSamp5' (writeonly uniform mediump iimageBuffer)
0:? 'noPreSamp6' (writeonly uniform mediump uimageBuffer)
0:? 'bufSamp1' (uniform highp samplerBuffer)
0:? 'bufSamp2' (uniform highp isamplerBuffer)
0:? 'bufSamp3' (uniform highp usamplerBuffer)
0:? 'bufSamp4' (writeonly uniform highp imageBuffer)
0:? 'bufSamp5' (writeonly uniform highp iimageBuffer)
0:? 'bufSamp6' (writeonly uniform highp uimageBuffer)
0:? 'gl_VertexID' (gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId)
@ -421,8 +510,10 @@ Linked vertex stage:
Shader version: 310
Requested GL_EXT_texture_buffer
Requested GL_OES_gpu_shader5
Requested GL_OES_shader_io_blocks
Requested GL_OES_texture_buffer
ERROR: node is still EOpNull!
0:12 Function Definition: main( (global void)
0:12 Function Parameters:
@ -741,6 +832,57 @@ ERROR: node is still EOpNull!
0:182 0.100000
0:182 0.100000
0:182 'offsets' (uniform 4-element array of highp 2-component vector of int)
0:220 Function Definition: bufferT( (global void)
0:220 Function Parameters:
0:222 Sequence
0:222 Sequence
0:222 move second child to first child (temp highp int)
0:222 's1' (temp highp int)
0:222 Function Call: textureSize(sB1; (global highp int)
0:222 'bufSamp1' (uniform highp samplerBuffer)
0:223 Sequence
0:223 move second child to first child (temp highp int)
0:223 's2' (temp highp int)
0:223 Function Call: textureSize(isB1; (global highp int)
0:223 'bufSamp2' (uniform highp isamplerBuffer)
0:224 Sequence
0:224 move second child to first child (temp highp int)
0:224 's3' (temp highp int)
0:224 Function Call: textureSize(usB1; (global highp int)
0:224 'bufSamp3' (uniform highp usamplerBuffer)
0:226 Sequence
0:226 move second child to first child (temp highp int)
0:226 's4' (temp highp int)
0:226 Function Call: imageSize(IB1; (global highp int)
0:226 'bufSamp4' (writeonly uniform highp imageBuffer)
0:227 Sequence
0:227 move second child to first child (temp highp int)
0:227 's5' (temp highp int)
0:227 Function Call: imageSize(iIB1; (global highp int)
0:227 'bufSamp5' (writeonly uniform highp iimageBuffer)
0:228 Sequence
0:228 move second child to first child (temp highp int)
0:228 's6' (temp highp int)
0:228 Function Call: imageSize(uIB1; (global highp int)
0:228 'bufSamp6' (writeonly uniform highp uimageBuffer)
0:230 Sequence
0:230 move second child to first child (temp highp 4-component vector of float)
0:230 'f1' (temp highp 4-component vector of float)
0:230 Function Call: texelFetch(sB1;i1; (global highp 4-component vector of float)
0:230 'bufSamp1' (uniform highp samplerBuffer)
0:230 's1' (temp highp int)
0:231 Sequence
0:231 move second child to first child (temp highp 4-component vector of int)
0:231 'f2' (temp highp 4-component vector of int)
0:231 Function Call: texelFetch(isB1;i1; (global highp 4-component vector of int)
0:231 'bufSamp2' (uniform highp isamplerBuffer)
0:231 's2' (temp highp int)
0:232 Sequence
0:232 move second child to first child (temp highp 4-component vector of uint)
0:232 'f3' (temp highp 4-component vector of uint)
0:232 Function Call: texelFetch(usB1;i1; (global highp 4-component vector of uint)
0:232 'bufSamp3' (uniform highp usamplerBuffer)
0:232 's3' (temp highp int)
0:? Linker Objects
0:? 's' (shared highp 4-component vector of float)
0:? 'v' (buffer highp 4-component vector of float)
@ -790,6 +932,24 @@ ERROR: node is still EOpNull!
0:? 0 (const int)
0:? 0 (const int)
0:? 0 (const int)
0:? 'badSamp1' (uniform mediump samplerBuffer)
0:? 'badSamp2' (uniform mediump isamplerBuffer)
0:? 'badSamp3' (uniform mediump usamplerBuffer)
0:? 'badSamp4' (writeonly uniform mediump imageBuffer)
0:? 'badSamp5' (writeonly uniform mediump iimageBuffer)
0:? 'badSamp6' (writeonly uniform mediump uimageBuffer)
0:? 'noPreSamp1' (uniform mediump samplerBuffer)
0:? 'noPreSamp2' (uniform mediump isamplerBuffer)
0:? 'noPreSamp3' (uniform mediump usamplerBuffer)
0:? 'noPreSamp4' (writeonly uniform mediump imageBuffer)
0:? 'noPreSamp5' (writeonly uniform mediump iimageBuffer)
0:? 'noPreSamp6' (writeonly uniform mediump uimageBuffer)
0:? 'bufSamp1' (uniform highp samplerBuffer)
0:? 'bufSamp2' (uniform highp isamplerBuffer)
0:? 'bufSamp3' (uniform highp usamplerBuffer)
0:? 'bufSamp4' (writeonly uniform highp imageBuffer)
0:? 'bufSamp5' (writeonly uniform highp iimageBuffer)
0:? 'bufSamp6' (writeonly uniform highp uimageBuffer)
0:? 'gl_VertexID' (gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId)

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "2.3.715"
#define GLSLANG_REVISION "2.3.716"
#define GLSLANG_DATE "16-Aug-2015"

View File

@ -1827,6 +1827,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
//
TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint };
bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140);
bool skipCubeArrayed = (profile == EEsProfile || version < 130);
// enumerate all the types
for (int image = 0; image <= 1; ++image) { // loop over "bool" image vs sampler
@ -1854,9 +1856,9 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
continue;
if (dim == Esd3D && shadow)
continue;
if (dim == EsdCube && arrayed && (profile == EEsProfile || version < 130))
if (dim == EsdCube && arrayed && skipCubeArrayed)
continue;
if (dim == EsdBuffer && (profile == EEsProfile || version < 140))
if (dim == EsdBuffer && skipBuffer)
continue;
if (dim == EsdBuffer && (shadow || arrayed || ms))
continue;

View File

@ -781,9 +781,13 @@ int TScanContext::tokenizeIdentifier()
case IMAGE2DRECT:
case IIMAGE2DRECT:
case UIMAGE2DRECT:
return firstGenerationImage(false);
case IMAGEBUFFER:
case IIMAGEBUFFER:
case UIMAGEBUFFER:
if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
return keyword;
return firstGenerationImage(false);
case IMAGE2D:
@ -834,7 +838,6 @@ int TScanContext::tokenizeIdentifier()
case SAMPLER1DARRAYSHADOW:
case USAMPLER1D:
case USAMPLER1DARRAY:
case SAMPLERBUFFER:
afterType = true;
return es30ReservedFromGLSL(130);
@ -858,9 +861,20 @@ int TScanContext::tokenizeIdentifier()
case ISAMPLER2DRECT:
case USAMPLER2DRECT:
afterType = true;
return es30ReservedFromGLSL(140);
case SAMPLERBUFFER:
afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
return keyword;
return es30ReservedFromGLSL(130);
case ISAMPLERBUFFER:
case USAMPLERBUFFER:
afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
return keyword;
return es30ReservedFromGLSL(140);
case SAMPLER2DMS:

View File

@ -192,7 +192,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_shader_io_blocks] = EBhDisable;
extensionBehavior[E_GL_EXT_tessellation_shader] = EBhDisable;
extensionBehavior[E_GL_EXT_tessellation_point_size] = EBhDisable;
extensionBehavior[E_GL_EXT_texture_buffer] = EBhDisablePartial;
extensionBehavior[E_GL_EXT_texture_buffer] = EBhDisable;
extensionBehavior[E_GL_EXT_texture_cube_map_array] = EBhDisablePartial;
// OES matching AEP
@ -203,7 +203,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[E_GL_OES_shader_io_blocks] = EBhDisable;
extensionBehavior[E_GL_OES_tessellation_shader] = EBhDisable;
extensionBehavior[E_GL_OES_tessellation_point_size] = EBhDisable;
extensionBehavior[E_GL_OES_texture_buffer] = EBhDisablePartial;
extensionBehavior[E_GL_OES_texture_buffer] = EBhDisable;
extensionBehavior[E_GL_OES_texture_cube_map_array] = EBhDisablePartial;
}