From 93930d6f9a0f36be4e5a53e7e8ded7a7a24d2bd2 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 12 Jun 2015 22:09:25 +0000 Subject: [PATCH] glslang ES reference: Don't allow std430 on uniform blocks (bug 14095). git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31484 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- Test/300.vert | 2 ++ Test/310.frag | 2 +- Test/310.vert | 3 +++ Test/baseResults/300.vert.out | 8 ++++++-- Test/baseResults/310.frag.out | 4 ++-- Test/baseResults/310.vert.out | 7 ++++++- glslang/MachineIndependent/ParseHelper.cpp | 2 ++ 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Test/300.vert b/Test/300.vert index 5abf4508..6270c1d5 100644 --- a/Test/300.vert +++ b/Test/300.vert @@ -169,6 +169,8 @@ layout(std140) Binst; // ERROR layout(std140) Bblock; // ERROR layout(std140) Bfoo; // ERROR +layout(std430) uniform B430 { int a; } B430i; // ERROR + struct SNA { int a[]; // ERROR }; diff --git a/Test/310.frag b/Test/310.frag index c1ccaaad..4c468ff7 100644 --- a/Test/310.frag +++ b/Test/310.frag @@ -82,7 +82,7 @@ layout(location = 40) out vec4 bigout1; // ERROR, too big layout(location = 40) out vec4 bigout2; // ERROR, overlap layout(location = -2) out vec4 neg; // ERROR, negative -layout(std430) uniform b430 { +layout(std430) buffer b430 { int i; } b430i; diff --git a/Test/310.vert b/Test/310.vert index 326a4ccf..8e08fa4f 100644 --- a/Test/310.vert +++ b/Test/310.vert @@ -81,3 +81,6 @@ struct SA { float f[4]; }; out SA outSA; // ERROR struct SS { float f; S s; }; out SS outSS; // ERROR + +layout(std430) uniform U430 { int a; } U430i; // ERROR +layout(std430) buffer B430 { int a; } B430i; diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out index a34dc0be..b75c4895 100644 --- a/Test/baseResults/300.vert.out +++ b/Test/baseResults/300.vert.out @@ -38,8 +38,10 @@ ERROR: 0:149: 'float' : cannot apply precision statement to this type; use 'floa ERROR: 0:168: 'Binst' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable ERROR: 0:169: 'Bblock' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable ERROR: 0:170: 'Bfoo' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable -ERROR: 0:173: '' : array size required -ERROR: 40 compilation errors. No code generated. +ERROR: 0:172: 'std430' : not supported for this version or the enabled extensions +ERROR: 0:172: 'std430 on a uniform block' : not supported with this profile: es +ERROR: 0:175: '' : array size required +ERROR: 42 compilation errors. No code generated. Shader version: 300 @@ -293,6 +295,7 @@ ERROR: node is still EOpNull! 0:? 'ssss' (smooth out structure{global highp float f}) 0:? 'Binst' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform highp int a}) 0:? 'Bfoo' (global highp int) +0:? 'B430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform highp int a}) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) @@ -551,6 +554,7 @@ ERROR: node is still EOpNull! 0:? 'ssss' (smooth out structure{global highp float f}) 0:? 'Binst' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform highp int a}) 0:? 'Bfoo' (global highp int) +0:? 'B430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform highp int a}) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index b9ec0d39..91ff0679 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -283,7 +283,7 @@ ERROR: node is still EOpNull! 0:? 'bigout1' (layout(location=40 ) out mediump 4-component vector of float) 0:? 'bigout2' (layout(location=40 ) out mediump 4-component vector of float) 0:? 'neg' (out mediump 4-component vector of float) -0:? 'b430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform mediump int i}) +0:? 'b430i' (layout(column_major std430 ) buffer block{layout(column_major std430 offset=0 ) buffer mediump int i}) 0:? 'bshari' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump int i}) 0:? 'smoothIn' (smooth in mediump 4-component vector of float) 0:? 'flatIn' (flat in mediump int) @@ -545,7 +545,7 @@ ERROR: node is still EOpNull! 0:? 'bigout1' (layout(location=40 ) out mediump 4-component vector of float) 0:? 'bigout2' (layout(location=40 ) out mediump 4-component vector of float) 0:? 'neg' (out mediump 4-component vector of float) -0:? 'b430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform mediump int i}) +0:? 'b430i' (layout(column_major std430 ) buffer block{layout(column_major std430 offset=0 ) buffer mediump int i}) 0:? 'bshari' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump int i}) 0:? 'smoothIn' (smooth in mediump 4-component vector of float) 0:? 'flatIn' (flat in mediump int) diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index 8d9575b9..2b5f995f 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -14,7 +14,8 @@ ERROR: 0:78: 'vertex-shader array-of-struct output' : not supported with this pr ERROR: 0:79: 'vertex-shader array-of-struct output' : not supported with this profile: es ERROR: 0:81: 'vertex-shader struct output containing an array' : not supported with this profile: es ERROR: 0:83: 'vertex-shader struct output containing structure' : not supported with this profile: es -ERROR: 14 compilation errors. No code generated. +ERROR: 0:85: 'std430 on a uniform block' : not supported with this profile: es +ERROR: 15 compilation errors. No code generated. Shader version: 310 @@ -185,6 +186,8 @@ ERROR: node is still EOpNull! 0:? 'outsa' (smooth out 4-element array of structure{global highp float f}) 0:? 'outSA' (smooth out structure{global 4-element array of highp float f}) 0:? 'outSS' (smooth out structure{global highp float f, global structure{global highp float f} s}) +0:? 'U430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform highp int a}) +0:? 'B430i' (layout(column_major std430 ) buffer block{layout(column_major std430 offset=0 ) buffer highp int a}) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) @@ -360,6 +363,8 @@ ERROR: node is still EOpNull! 0:? 'outsa' (smooth out 4-element array of structure{global highp float f}) 0:? 'outSA' (smooth out structure{global 4-element array of highp float f}) 0:? 'outSS' (smooth out structure{global highp float f, global structure{global highp float f} s}) +0:? 'U430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform highp int a}) +0:? 'B430i' (layout(column_major std430 ) buffer block{layout(column_major std430 offset=0 ) buffer highp int a}) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 44239aa0..cfe64ef4 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4493,6 +4493,8 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr case EvqUniform: profileRequires(loc, EEsProfile, 300, nullptr, "uniform block"); profileRequires(loc, ENoProfile, 140, nullptr, "uniform block"); + if (currentBlockQualifier.layoutPacking == ElpStd430) + requireProfile(loc, ~EEsProfile, "std430 on a uniform block"); break; case EvqBuffer: requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block");