Commit e442a038 by Laurie Committed by John Kessenich

GLSL: Fix tessellation control shader bounding box support. (#1730)

Prior to this change, OES_primitive_bounding_box and EXT_primitive_bounding_box were both recognised as extensions, but only the name gl_BoundingBoxOES could be used. However the EXT version uses the name gl_BoundingBoxEXT instead. In addition, since GLES 3.2, the extension has been included in the core standard and the name gl_BoundingBox may be used instead. This change aims to make both extensions and the 3.2 core version all work.
parent bd0f5ad2
...@@ -128,6 +128,21 @@ void goodfoop() ...@@ -128,6 +128,21 @@ void goodfoop()
d = fma(d, d, d); d = fma(d, d, d);
} }
void bbextBad()
{
gl_BoundingBoxEXT; // ERROR without GL_EXT_primitive_bounding_box
gl_BoundingBox; // ERROR, version < 320
}
#extension GL_EXT_primitive_bounding_box : enable
void bbext()
{
gl_BoundingBoxEXT[0] = vec4(0.0);
gl_BoundingBoxEXT[1] = vec4(1.0);
gl_BoundingBoxEXT[2] = vec4(2.0); // ERROR, overflow
}
void bbBad() void bbBad()
{ {
gl_BoundingBoxOES; // ERROR without GL_OES_primitive_bounding_box gl_BoundingBoxOES; // ERROR without GL_OES_primitive_bounding_box
......
...@@ -118,9 +118,20 @@ void goodfoop() ...@@ -118,9 +118,20 @@ void goodfoop()
void bb() void bb()
{ {
gl_BoundingBoxOES[0] = vec4(0.0); gl_BoundingBoxEXT[0] = vec4(0.0); // ERROR without GL_EXT_primitive_bounding_box
gl_BoundingBoxOES[1] = vec4(1.0); gl_BoundingBoxOES[0] = vec4(0.0); // ERROR without GL_OES_primitive_bounding_box
gl_BoundingBoxOES[2] = vec4(2.0); // ERROR, overflow gl_BoundingBox[0] = vec4(1.0);
gl_BoundingBox[1] = vec4(1.0);
gl_BoundingBox[2] = vec4(2.0); // ERROR, overflow
}
#extension GL_EXT_primitive_bounding_box : enable
#extension GL_OES_primitive_bounding_box : enable
void bbext()
{
gl_BoundingBoxEXT[1] = vec4(0.0);
gl_BoundingBoxOES[1] = vec4(0.0);
} }
out patch badpatchBName { // ERROR, array size required out patch badpatchBName { // ERROR, array size required
......
...@@ -5794,7 +5794,14 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV ...@@ -5794,7 +5794,14 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"patch out highp float gl_TessLevelOuter[4];" "patch out highp float gl_TessLevelOuter[4];"
"patch out highp float gl_TessLevelInner[2];" "patch out highp float gl_TessLevelInner[2];"
"patch out highp vec4 gl_BoundingBoxOES[2];" "patch out highp vec4 gl_BoundingBoxOES[2];"
"patch out highp vec4 gl_BoundingBoxEXT[2];"
"\n"); "\n");
if (profile == EEsProfile && version >= 320) {
stageBuiltins[EShLangTessControl].append(
"patch out highp vec4 gl_BoundingBox[2];"
"\n"
);
}
} }
if ((profile != EEsProfile && version >= 140) || if ((profile != EEsProfile && version >= 140) ||
...@@ -8014,10 +8021,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -8014,10 +8021,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
case EShLangTessControl: case EShLangTessControl:
if (profile == EEsProfile && version >= 310) { if (profile == EEsProfile && version >= 310) {
BuiltInVariable("gl_BoundingBoxEXT", EbvBoundingBox, symbolTable);
symbolTable.setVariableExtensions("gl_BoundingBoxEXT", 1,
&E_GL_EXT_primitive_bounding_box);
BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable); BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable);
if (version < 320) symbolTable.setVariableExtensions("gl_BoundingBoxOES", 1,
symbolTable.setVariableExtensions("gl_BoundingBoxOES", Num_AEP_primitive_bounding_box, &E_GL_OES_primitive_bounding_box);
AEP_primitive_bounding_box);
if (version >= 320) {
BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);
}
} }
// Fall through // Fall through
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment