Commit bd924af1 by Jiawei Shao Committed by Commit Bot

ES31: Remove support of GL_OES_geometry_shader in compiler

This patch intends to remove the support of GL_OES_geometry_shader in ANGLE compiler. To make the implementation simpler, currently we decide to only support "GL_EXT_geometry_shader" as the extension string of geometry shader in ANGLE. This patch also updates all the related shaders in angle_unittests into R"()" format. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ife9858abeedfb46b02c5c2fb1cda16fa27198511 Reviewed-on: https://chromium-review.googlesource.com/773451 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent f15f9cec
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented every time the API changes. // It is incremented every time the API changes.
#define ANGLE_SH_VERSION 192 #define ANGLE_SH_VERSION 193
enum ShShaderSpec enum ShShaderSpec
{ {
...@@ -300,7 +300,7 @@ struct ShBuiltInResources ...@@ -300,7 +300,7 @@ struct ShBuiltInResources
int ARM_shader_framebuffer_fetch; int ARM_shader_framebuffer_fetch;
int OVR_multiview; int OVR_multiview;
int EXT_YUV_target; int EXT_YUV_target;
int OES_geometry_shader; int EXT_geometry_shader;
// Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
// with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
...@@ -426,7 +426,7 @@ struct ShBuiltInResources ...@@ -426,7 +426,7 @@ struct ShBuiltInResources
// maximum point size (higher limit from ALIASED_POINT_SIZE_RANGE) // maximum point size (higher limit from ALIASED_POINT_SIZE_RANGE)
float MaxPointSize; float MaxPointSize;
// OES_geometry_shader constants // EXT_geometry_shader constants
int MaxGeometryUniformComponents; int MaxGeometryUniformComponents;
int MaxGeometryUniformBlocks; int MaxGeometryUniformBlocks;
int MaxGeometryInputComponents; int MaxGeometryInputComponents;
......
...@@ -63,7 +63,7 @@ void GenerateResources(ShBuiltInResources *resources) ...@@ -63,7 +63,7 @@ void GenerateResources(ShBuiltInResources *resources)
resources->OES_standard_derivatives = 0; resources->OES_standard_derivatives = 0;
resources->OES_EGL_image_external = 0; resources->OES_EGL_image_external = 0;
resources->OES_geometry_shader = 1; resources->EXT_geometry_shader = 1;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
...@@ -270,11 +270,11 @@ int main(int argc, char *argv[]) ...@@ -270,11 +270,11 @@ int main(int argc, char *argv[])
} }
compiler = computeCompiler; compiler = computeCompiler;
break; break;
case GL_GEOMETRY_SHADER_OES: case GL_GEOMETRY_SHADER_EXT:
if (geometryCompiler == 0) if (geometryCompiler == 0)
{ {
geometryCompiler = geometryCompiler =
sh::ConstructCompiler(GL_GEOMETRY_SHADER_OES, spec, output, &resources); sh::ConstructCompiler(GL_GEOMETRY_SHADER_EXT, spec, output, &resources);
} }
compiler = geometryCompiler; compiler = geometryCompiler;
break; break;
...@@ -402,7 +402,7 @@ sh::GLenum FindShaderType(const char *fileName) ...@@ -402,7 +402,7 @@ sh::GLenum FindShaderType(const char *fileName)
if (strncmp(ext, ".comp", 5) == 0) if (strncmp(ext, ".comp", 5) == 0)
return GL_COMPUTE_SHADER; return GL_COMPUTE_SHADER;
if (strncmp(ext, ".geom", 5) == 0) if (strncmp(ext, ".geom", 5) == 0)
return GL_GEOMETRY_SHADER_OES; return GL_GEOMETRY_SHADER_EXT;
} }
return GL_FRAGMENT_SHADER; return GL_FRAGMENT_SHADER;
......
...@@ -710,7 +710,7 @@ enum TQualifier ...@@ -710,7 +710,7 @@ enum TQualifier
EvqRestrict, EvqRestrict,
EvqVolatile, EvqVolatile,
// GLSL ES 3.1 extension OES_geometry_shader qualifiers // GLSL ES 3.1 extension EXT_geometry_shader qualifiers
EvqGeometryIn, EvqGeometryIn,
EvqGeometryOut, EvqGeometryOut,
EvqPerVertexIn, // gl_in EvqPerVertexIn, // gl_in
...@@ -814,7 +814,7 @@ struct TLayoutQualifier ...@@ -814,7 +814,7 @@ struct TLayoutQualifier
1; 1;
} }
bool isLocalSizeEqual(const sh::WorkGroupSize &localSizeIn) const bool isLocalSizeEqual(const WorkGroupSize &localSizeIn) const
{ {
return localSize.isWorkGroupSizeMatching(localSizeIn); return localSize.isWorkGroupSizeMatching(localSizeIn);
} }
...@@ -825,7 +825,7 @@ struct TLayoutQualifier ...@@ -825,7 +825,7 @@ struct TLayoutQualifier
TLayoutBlockStorage blockStorage; TLayoutBlockStorage blockStorage;
// Compute shader layout qualifiers. // Compute shader layout qualifiers.
sh::WorkGroupSize localSize; WorkGroupSize localSize;
int binding; int binding;
int offset; int offset;
......
...@@ -38,7 +38,7 @@ BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage) ...@@ -38,7 +38,7 @@ BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage)
} }
} }
// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks. // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
BlockType GetBlockType(TQualifier qualifier) BlockType GetBlockType(TQualifier qualifier)
{ {
switch (qualifier) switch (qualifier)
...@@ -517,7 +517,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) ...@@ -517,7 +517,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
recordBuiltInVaryingUsed("gl_PrimitiveIDIn", &mPrimitiveIDInAdded, mInputVaryings); recordBuiltInVaryingUsed("gl_PrimitiveIDIn", &mPrimitiveIDInAdded, mInputVaryings);
break; break;
case EvqPrimitiveID: case EvqPrimitiveID:
if (mShaderType == GL_GEOMETRY_SHADER_OES) if (mShaderType == GL_GEOMETRY_SHADER_EXT)
{ {
recordBuiltInVaryingUsed("gl_PrimitiveID", &mPrimitiveIDAdded, mOutputVaryings); recordBuiltInVaryingUsed("gl_PrimitiveID", &mPrimitiveIDAdded, mOutputVaryings);
} }
...@@ -528,7 +528,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) ...@@ -528,7 +528,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
} }
break; break;
case EvqLayer: case EvqLayer:
if (mShaderType == GL_GEOMETRY_SHADER_OES) if (mShaderType == GL_GEOMETRY_SHADER_EXT)
{ {
recordBuiltInVaryingUsed("gl_Layer", &mLayerAdded, mOutputVaryings); recordBuiltInVaryingUsed("gl_Layer", &mLayerAdded, mOutputVaryings);
} }
...@@ -646,7 +646,7 @@ Varying CollectVariablesTraverser::recordVarying(const TIntermSymbol &variable) ...@@ -646,7 +646,7 @@ Varying CollectVariablesTraverser::recordVarying(const TIntermSymbol &variable)
return varying; return varying;
} }
// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks. // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
void CollectVariablesTraverser::recordInterfaceBlock(const TString &instanceName, void CollectVariablesTraverser::recordInterfaceBlock(const TString &instanceName,
const TType &interfaceBlockType, const TType &interfaceBlockType,
InterfaceBlock *interfaceBlock) const InterfaceBlock *interfaceBlock) const
...@@ -726,7 +726,7 @@ bool CollectVariablesTraverser::visitDeclaration(Visit, TIntermDeclaration *node ...@@ -726,7 +726,7 @@ bool CollectVariablesTraverser::visitDeclaration(Visit, TIntermDeclaration *node
continue; continue;
} }
// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks. // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
if (typedNode.getBasicType() == EbtInterfaceBlock) if (typedNode.getBasicType() == EbtInterfaceBlock)
{ {
InterfaceBlock interfaceBlock; InterfaceBlock interfaceBlock;
...@@ -779,7 +779,7 @@ bool CollectVariablesTraverser::visitDeclaration(Visit, TIntermDeclaration *node ...@@ -779,7 +779,7 @@ bool CollectVariablesTraverser::visitDeclaration(Visit, TIntermDeclaration *node
} }
// TODO(jiawei.shao@intel.com): add search on mInBlocks and mOutBlocks when implementing // TODO(jiawei.shao@intel.com): add search on mInBlocks and mOutBlocks when implementing
// GL_OES_shader_io_blocks. // GL_EXT_shader_io_blocks.
InterfaceBlock *CollectVariablesTraverser::findNamedInterfaceBlock(const TString &blockName) const InterfaceBlock *CollectVariablesTraverser::findNamedInterfaceBlock(const TString &blockName) const
{ {
InterfaceBlock *namedBlock = FindVariable(blockName, mUniformBlocks); InterfaceBlock *namedBlock = FindVariable(blockName, mUniformBlocks);
......
...@@ -157,7 +157,7 @@ int GetMaxUniformVectorsForShaderType(GLenum shaderType, const ShBuiltInResource ...@@ -157,7 +157,7 @@ int GetMaxUniformVectorsForShaderType(GLenum shaderType, const ShBuiltInResource
// TODO (jiawei.shao@intel.com): check if we need finer-grained component counting // TODO (jiawei.shao@intel.com): check if we need finer-grained component counting
case GL_COMPUTE_SHADER: case GL_COMPUTE_SHADER:
return resources.MaxComputeUniformComponents / 4; return resources.MaxComputeUniformComponents / 4;
case GL_GEOMETRY_SHADER_OES: case GL_GEOMETRY_SHADER_EXT:
return resources.MaxGeometryUniformComponents / 4; return resources.MaxGeometryUniformComponents / 4;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -380,7 +380,7 @@ void TCompiler::setASTMetadata(const TParseContext &parseContext) ...@@ -380,7 +380,7 @@ void TCompiler::setASTMetadata(const TParseContext &parseContext)
// Highp might have been auto-enabled based on shader version // Highp might have been auto-enabled based on shader version
fragmentPrecisionHigh = parseContext.getFragmentPrecisionHigh(); fragmentPrecisionHigh = parseContext.getFragmentPrecisionHigh();
if (shaderType == GL_GEOMETRY_SHADER_OES) if (shaderType == GL_GEOMETRY_SHADER_EXT)
{ {
mGeometryShaderInputPrimitiveType = parseContext.getGeometryShaderInputPrimitiveType(); mGeometryShaderInputPrimitiveType = parseContext.getGeometryShaderInputPrimitiveType();
mGeometryShaderOutputPrimitiveType = parseContext.getGeometryShaderOutputPrimitiveType(); mGeometryShaderOutputPrimitiveType = parseContext.getGeometryShaderOutputPrimitiveType();
...@@ -711,7 +711,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources) ...@@ -711,7 +711,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
break; break;
case GL_VERTEX_SHADER: case GL_VERTEX_SHADER:
case GL_COMPUTE_SHADER: case GL_COMPUTE_SHADER:
case GL_GEOMETRY_SHADER_OES: case GL_GEOMETRY_SHADER_EXT:
symbolTable.setDefaultPrecision(EbtInt, EbpHigh); symbolTable.setDefaultPrecision(EbtInt, EbpHigh);
symbolTable.setDefaultPrecision(EbtFloat, EbpHigh); symbolTable.setDefaultPrecision(EbtFloat, EbpHigh);
break; break;
...@@ -778,7 +778,7 @@ void TCompiler::setResourceString() ...@@ -778,7 +778,7 @@ void TCompiler::setResourceString()
<< ":ARM_shader_framebuffer_fetch:" << compileResources.ARM_shader_framebuffer_fetch << ":ARM_shader_framebuffer_fetch:" << compileResources.ARM_shader_framebuffer_fetch
<< ":OVR_multiview:" << compileResources.OVR_multiview << ":OVR_multiview:" << compileResources.OVR_multiview
<< ":EXT_YUV_target:" << compileResources.EXT_YUV_target << ":EXT_YUV_target:" << compileResources.EXT_YUV_target
<< ":OES_geometry_shader:" << compileResources.OES_geometry_shader << ":EXT_geometry_shader:" << compileResources.EXT_geometry_shader
<< ":MaxVertexOutputVectors:" << compileResources.MaxVertexOutputVectors << ":MaxVertexOutputVectors:" << compileResources.MaxVertexOutputVectors
<< ":MaxFragmentInputVectors:" << compileResources.MaxFragmentInputVectors << ":MaxFragmentInputVectors:" << compileResources.MaxFragmentInputVectors
<< ":MinProgramTexelOffset:" << compileResources.MinProgramTexelOffset << ":MinProgramTexelOffset:" << compileResources.MinProgramTexelOffset
...@@ -1092,7 +1092,7 @@ void TCompiler::useAllMembersInUnusedStandardAndSharedBlocks(TIntermBlock *root) ...@@ -1092,7 +1092,7 @@ void TCompiler::useAllMembersInUnusedStandardAndSharedBlocks(TIntermBlock *root)
void TCompiler::initializeOutputVariables(TIntermBlock *root) void TCompiler::initializeOutputVariables(TIntermBlock *root)
{ {
InitVariableList list; InitVariableList list;
if (shaderType == GL_VERTEX_SHADER || shaderType == GL_GEOMETRY_SHADER_OES) if (shaderType == GL_VERTEX_SHADER || shaderType == GL_GEOMETRY_SHADER_EXT)
{ {
for (auto var : outputVaryings) for (auto var : outputVaryings)
{ {
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
OP(NV_shader_framebuffer_fetch) \ OP(NV_shader_framebuffer_fetch) \
OP(OES_EGL_image_external) \ OP(OES_EGL_image_external) \
OP(OES_EGL_image_external_essl3) \ OP(OES_EGL_image_external_essl3) \
OP(OES_geometry_shader) \
OP(OES_standard_derivatives) \ OP(OES_standard_derivatives) \
OP(OVR_multiview) OP(OVR_multiview)
......
...@@ -31,7 +31,6 @@ enum class TExtension ...@@ -31,7 +31,6 @@ enum class TExtension
NV_shader_framebuffer_fetch, NV_shader_framebuffer_fetch,
OES_EGL_image_external, OES_EGL_image_external,
OES_EGL_image_external_essl3, OES_EGL_image_external_essl3,
OES_geometry_shader,
OES_standard_derivatives, OES_standard_derivatives,
OVR_multiview OVR_multiview
}; };
......
...@@ -733,9 +733,9 @@ void InsertBuiltInFunctions(sh::GLenum type, ...@@ -733,9 +733,9 @@ void InsertBuiltInFunctions(sh::GLenum type,
voidType, "groupMemoryBarrier"); voidType, "groupMemoryBarrier");
} }
if (type == GL_GEOMETRY_SHADER_OES) if (type == GL_GEOMETRY_SHADER_EXT)
{ {
TExtension extension = TExtension::OES_geometry_shader; TExtension extension = TExtension::EXT_geometry_shader;
symbolTable.insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension, EOpEmitVertex, symbolTable.insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension, EOpEmitVertex,
voidType, "EmitVertex"); voidType, "EmitVertex");
symbolTable.insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension, symbolTable.insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension,
...@@ -844,9 +844,9 @@ void InsertBuiltInFunctions(sh::GLenum type, ...@@ -844,9 +844,9 @@ void InsertBuiltInFunctions(sh::GLenum type,
symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBufferSize", symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBufferSize",
resources.MaxAtomicCounterBufferSize, EbpMedium); resources.MaxAtomicCounterBufferSize, EbpMedium);
if (resources.OES_geometry_shader) if (resources.EXT_geometry_shader)
{ {
TExtension ext = TExtension::OES_geometry_shader; TExtension ext = TExtension::EXT_geometry_shader;
symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryInputComponents", symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryInputComponents",
resources.MaxGeometryInputComponents, EbpMedium); resources.MaxGeometryInputComponents, EbpMedium);
symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryOutputComponents", symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryOutputComponents",
...@@ -963,9 +963,9 @@ void IdentifyBuiltIns(sh::GLenum type, ...@@ -963,9 +963,9 @@ void IdentifyBuiltIns(sh::GLenum type,
TType(EbtFloat, EbpMedium, EvqLastFragColor, 4)); TType(EbtFloat, EbpMedium, EvqLastFragColor, 4));
} }
if (resources.OES_geometry_shader) if (resources.EXT_geometry_shader)
{ {
TExtension extension = TExtension::OES_geometry_shader; TExtension extension = TExtension::EXT_geometry_shader;
symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_PrimitiveID", symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_PrimitiveID",
TType(EbtInt, EbpHigh, EvqPrimitiveID, 1)); TType(EbtInt, EbpHigh, EvqPrimitiveID, 1));
symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_Layer", symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_Layer",
...@@ -1009,12 +1009,12 @@ void IdentifyBuiltIns(sh::GLenum type, ...@@ -1009,12 +1009,12 @@ void IdentifyBuiltIns(sh::GLenum type,
break; break;
} }
case GL_GEOMETRY_SHADER_OES: case GL_GEOMETRY_SHADER_EXT:
{ {
TExtension extension = TExtension::OES_geometry_shader; TExtension extension = TExtension::EXT_geometry_shader;
// Add built-in interface block gl_PerVertex and the built-in array gl_in. // Add built-in interface block gl_PerVertex and the built-in array gl_in.
// TODO(jiawei.shao@intel.com): implement GL_OES_geometry_point_size. // TODO(jiawei.shao@intel.com): implement GL_EXT_geometry_point_size.
TFieldList *glPerVertexFieldList = new TFieldList(); TFieldList *glPerVertexFieldList = new TFieldList();
TSourceLoc zeroSourceLoc = {0, 0, 0, 0}; TSourceLoc zeroSourceLoc = {0, 0, 0, 0};
TField *glPositionField = new TField(new TType(EbtFloat, EbpHigh, EvqPosition, 4), TField *glPositionField = new TField(new TType(EbtFloat, EbpHigh, EvqPosition, 4),
...@@ -1117,9 +1117,8 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi ...@@ -1117,9 +1117,8 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
{ {
extBehavior[TExtension::EXT_YUV_target] = EBhUndefined; extBehavior[TExtension::EXT_YUV_target] = EBhUndefined;
} }
if (resources.OES_geometry_shader) if (resources.EXT_geometry_shader)
{ {
extBehavior[TExtension::OES_geometry_shader] = EBhUndefined;
extBehavior[TExtension::EXT_geometry_shader] = EBhUndefined; extBehavior[TExtension::EXT_geometry_shader] = EBhUndefined;
} }
} }
......
...@@ -1263,14 +1263,6 @@ template bool TParseContext::checkCanUseOneOfExtensions( ...@@ -1263,14 +1263,6 @@ template bool TParseContext::checkCanUseOneOfExtensions(
bool TParseContext::checkCanUseExtension(const TSourceLoc &line, TExtension extension) bool TParseContext::checkCanUseExtension(const TSourceLoc &line, TExtension extension)
{ {
ASSERT(extension != TExtension::UNDEFINED); ASSERT(extension != TExtension::UNDEFINED);
ASSERT(extension != TExtension::EXT_geometry_shader);
if (extension == TExtension::OES_geometry_shader)
{
// OES_geometry_shader and EXT_geometry_shader are always interchangeable.
constexpr std::array<TExtension, 2u> extensions{
{TExtension::EXT_geometry_shader, TExtension::OES_geometry_shader}};
return checkCanUseOneOfExtensions(line, extensions);
}
return checkCanUseOneOfExtensions(line, std::array<TExtension, 1u>{{extension}}); return checkCanUseOneOfExtensions(line, std::array<TExtension, 1u>{{extension}});
} }
...@@ -3628,7 +3620,7 @@ TIntermTyped *TParseContext::addConstructor(TIntermSequence *arguments, ...@@ -3628,7 +3620,7 @@ TIntermTyped *TParseContext::addConstructor(TIntermSequence *arguments,
// //
// Interface/uniform blocks // Interface/uniform blocks
// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks. // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
// //
TIntermDeclaration *TParseContext::addInterfaceBlock( TIntermDeclaration *TParseContext::addInterfaceBlock(
const TTypeQualifierBuilder &typeQualifierBuilder, const TTypeQualifierBuilder &typeQualifierBuilder,
...@@ -3955,7 +3947,7 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, ...@@ -3955,7 +3947,7 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
if (baseExpression->getQualifier() == EvqPerVertexIn) if (baseExpression->getQualifier() == EvqPerVertexIn)
{ {
ASSERT(mShaderType == GL_GEOMETRY_SHADER_OES); ASSERT(mShaderType == GL_GEOMETRY_SHADER_EXT);
if (mGeometryShaderInputPrimitiveType == EptUndefined) if (mGeometryShaderInputPrimitiveType == EptUndefined)
{ {
error(location, "missing input primitive declaration before indexing gl_in.", "["); error(location, "missing input primitive declaration before indexing gl_in.", "[");
...@@ -3973,7 +3965,7 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, ...@@ -3973,7 +3965,7 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
{ {
if (baseExpression->isInterfaceBlock()) if (baseExpression->isInterfaceBlock())
{ {
// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks. // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
switch (baseExpression->getQualifier()) switch (baseExpression->getQualifier())
{ {
case EvqPerVertexIn: case EvqPerVertexIn:
...@@ -4345,44 +4337,44 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierTyp ...@@ -4345,44 +4337,44 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierTyp
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.imageInternalFormat = EiifR32UI; qualifier.imageInternalFormat = EiifR32UI;
} }
else if (qualifierType == "points" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "points" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptPoints; qualifier.primitiveType = EptPoints;
} }
else if (qualifierType == "lines" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "lines" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptLines; qualifier.primitiveType = EptLines;
} }
else if (qualifierType == "lines_adjacency" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "lines_adjacency" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptLinesAdjacency; qualifier.primitiveType = EptLinesAdjacency;
} }
else if (qualifierType == "triangles" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "triangles" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptTriangles; qualifier.primitiveType = EptTriangles;
} }
else if (qualifierType == "triangles_adjacency" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "triangles_adjacency" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptTrianglesAdjacency; qualifier.primitiveType = EptTrianglesAdjacency;
} }
else if (qualifierType == "line_strip" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "line_strip" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptLineStrip; qualifier.primitiveType = EptLineStrip;
} }
else if (qualifierType == "triangle_strip" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "triangle_strip" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310); checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
qualifier.primitiveType = EptTriangleStrip; qualifier.primitiveType = EptTriangleStrip;
...@@ -4540,13 +4532,13 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierTyp ...@@ -4540,13 +4532,13 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierTyp
parseNumViews(intValue, intValueLine, intValueString, &qualifier.numViews); parseNumViews(intValue, intValueLine, intValueString, &qualifier.numViews);
} }
} }
else if (qualifierType == "invocations" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "invocations" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
parseInvocations(intValue, intValueLine, intValueString, &qualifier.invocations); parseInvocations(intValue, intValueLine, intValueString, &qualifier.invocations);
} }
else if (qualifierType == "max_vertices" && mShaderType == GL_GEOMETRY_SHADER_OES && else if (qualifierType == "max_vertices" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader)) checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
{ {
parseMaxVertices(intValue, intValueLine, intValueString, &qualifier.maxVertices); parseMaxVertices(intValue, intValueLine, intValueString, &qualifier.maxVertices);
} }
...@@ -4611,7 +4603,7 @@ TStorageQualifierWrapper *TParseContext::parseInQualifier(const TSourceLoc &loc) ...@@ -4611,7 +4603,7 @@ TStorageQualifierWrapper *TParseContext::parseInQualifier(const TSourceLoc &loc)
{ {
return new TStorageQualifierWrapper(EvqComputeIn, loc); return new TStorageQualifierWrapper(EvqComputeIn, loc);
} }
case GL_GEOMETRY_SHADER_OES: case GL_GEOMETRY_SHADER_EXT:
{ {
return new TStorageQualifierWrapper(EvqGeometryIn, loc); return new TStorageQualifierWrapper(EvqGeometryIn, loc);
} }
...@@ -4652,7 +4644,7 @@ TStorageQualifierWrapper *TParseContext::parseOutQualifier(const TSourceLoc &loc ...@@ -4652,7 +4644,7 @@ TStorageQualifierWrapper *TParseContext::parseOutQualifier(const TSourceLoc &loc
error(loc, "storage qualifier isn't supported in compute shaders", "out"); error(loc, "storage qualifier isn't supported in compute shaders", "out");
return new TStorageQualifierWrapper(EvqLast, loc); return new TStorageQualifierWrapper(EvqLast, loc);
} }
case GL_GEOMETRY_SHADER_OES: case GL_GEOMETRY_SHADER_EXT:
{ {
return new TStorageQualifierWrapper(EvqGeometryOut, loc); return new TStorageQualifierWrapper(EvqGeometryOut, loc);
} }
...@@ -5816,7 +5808,7 @@ TIntermTyped *TParseContext::addMethod(TFunction *fnCall, ...@@ -5816,7 +5808,7 @@ TIntermTyped *TParseContext::addMethod(TFunction *fnCall,
else if (typedThis->getQualifier() == EvqPerVertexIn && else if (typedThis->getQualifier() == EvqPerVertexIn &&
mGeometryShaderInputPrimitiveType == EptUndefined) mGeometryShaderInputPrimitiveType == EptUndefined)
{ {
ASSERT(mShaderType == GL_GEOMETRY_SHADER_OES); ASSERT(mShaderType == GL_GEOMETRY_SHADER_EXT);
error(loc, "missing input primitive declaration before calling length on gl_in", "length"); error(loc, "missing input primitive declaration before calling length on gl_in", "length");
} }
else else
......
...@@ -203,7 +203,7 @@ void InitBuiltInResources(ShBuiltInResources *resources) ...@@ -203,7 +203,7 @@ void InitBuiltInResources(ShBuiltInResources *resources)
resources->ARM_shader_framebuffer_fetch = 0; resources->ARM_shader_framebuffer_fetch = 0;
resources->OVR_multiview = 0; resources->OVR_multiview = 0;
resources->EXT_YUV_target = 0; resources->EXT_YUV_target = 0;
resources->OES_geometry_shader = 0; resources->EXT_geometry_shader = 0;
resources->NV_draw_buffers = 0; resources->NV_draw_buffers = 0;
......
...@@ -92,7 +92,7 @@ void TranslatorESSL::translate(TIntermBlock *root, ...@@ -92,7 +92,7 @@ void TranslatorESSL::translate(TIntermBlock *root,
<< ", local_size_z=" << localSize[2] << ") in;\n"; << ", local_size_z=" << localSize[2] << ") in;\n";
} }
if (getShaderType() == GL_GEOMETRY_SHADER_OES) if (getShaderType() == GL_GEOMETRY_SHADER_EXT)
{ {
WriteGeometryShaderLayoutQualifiers( WriteGeometryShaderLayoutQualifiers(
sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(), sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(),
...@@ -148,13 +148,13 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions) ...@@ -148,13 +148,13 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions)
sink << "#extension GL_NV_viewport_array2 : require\n"; sink << "#extension GL_NV_viewport_array2 : require\n";
} }
} }
else if (iter->first == TExtension::OES_geometry_shader) else if (iter->first == TExtension::EXT_geometry_shader)
{ {
sink << "#ifdef GL_OES_geometry_shader\n" sink << "#ifdef GL_EXT_geometry_shader\n"
<< "#extension GL_OES_geometry_shader : " << GetBehaviorString(iter->second)
<< "\n"
<< "#elif defined GL_EXT_geometry_shader\n"
<< "#extension GL_EXT_geometry_shader : " << GetBehaviorString(iter->second) << "#extension GL_EXT_geometry_shader : " << GetBehaviorString(iter->second)
<< "\n"
<< "#elif defined GL_OES_geometry_shader\n"
<< "#extension GL_OES_geometry_shader : " << GetBehaviorString(iter->second)
<< "\n"; << "\n";
if (iter->second == EBhRequire) if (iter->second == EBhRequire)
{ {
......
...@@ -202,7 +202,7 @@ void TranslatorGLSL::translate(TIntermBlock *root, ...@@ -202,7 +202,7 @@ void TranslatorGLSL::translate(TIntermBlock *root,
<< ", local_size_z=" << localSize[2] << ") in;\n"; << ", local_size_z=" << localSize[2] << ") in;\n";
} }
if (getShaderType() == GL_GEOMETRY_SHADER_OES) if (getShaderType() == GL_GEOMETRY_SHADER_EXT)
{ {
WriteGeometryShaderLayoutQualifiers( WriteGeometryShaderLayoutQualifiers(
sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(), sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(),
...@@ -271,7 +271,7 @@ void TranslatorGLSL::writeExtensionBehavior(TIntermNode *root, ShCompileOptions ...@@ -271,7 +271,7 @@ void TranslatorGLSL::writeExtensionBehavior(TIntermNode *root, ShCompileOptions
<< "\n"; << "\n";
} }
if (iter.first == TExtension::OES_geometry_shader) if (iter.first == TExtension::EXT_geometry_shader)
{ {
sink << "#extension GL_ARB_geometry_shader4 : " << GetBehaviorString(iter.second) sink << "#extension GL_ARB_geometry_shader4 : " << GetBehaviorString(iter.second)
<< "\n"; << "\n";
......
...@@ -41,7 +41,7 @@ int GetLocationCount(const TIntermSymbol *varying, bool ignoreVaryingArraySize) ...@@ -41,7 +41,7 @@ int GetLocationCount(const TIntermSymbol *varying, bool ignoreVaryingArraySize)
} }
return totalLocation; return totalLocation;
} }
// [GL_OES_shader_io_blocks SPEC Chapter 4.4.1] // [GL_EXT_shader_io_blocks SPEC Chapter 4.4.1]
// Geometry shader inputs, tessellation control shader inputs and outputs, and tessellation // Geometry shader inputs, tessellation control shader inputs and outputs, and tessellation
// evaluation inputs all have an additional level of arrayness relative to other shader inputs // evaluation inputs all have an additional level of arrayness relative to other shader inputs
// and outputs. This outer array level is removed from the type before considering how many // and outputs. This outer array level is removed from the type before considering how many
...@@ -49,7 +49,7 @@ int GetLocationCount(const TIntermSymbol *varying, bool ignoreVaryingArraySize) ...@@ -49,7 +49,7 @@ int GetLocationCount(const TIntermSymbol *varying, bool ignoreVaryingArraySize)
else if (ignoreVaryingArraySize) else if (ignoreVaryingArraySize)
{ {
// Array-of-arrays cannot be inputs or outputs of a geometry shader. // Array-of-arrays cannot be inputs or outputs of a geometry shader.
// (GL_OES_geometry_shader SPEC issues(5)) // (GL_EXT_geometry_shader SPEC issues(5))
ASSERT(!varyingType.isArrayOfArrays()); ASSERT(!varyingType.isArrayOfArrays());
return varyingType.getSecondarySize(); return varyingType.getSecondarySize();
} }
...@@ -157,7 +157,7 @@ void ValidateVaryingLocationsTraverser::validate(TDiagnostics *diagnostics) ...@@ -157,7 +157,7 @@ void ValidateVaryingLocationsTraverser::validate(TDiagnostics *diagnostics)
ASSERT(diagnostics); ASSERT(diagnostics);
ValidateShaderInterface(diagnostics, mInputVaryingsWithLocation, ValidateShaderInterface(diagnostics, mInputVaryingsWithLocation,
mShaderType == GL_GEOMETRY_SHADER_OES); mShaderType == GL_GEOMETRY_SHADER_EXT);
ValidateShaderInterface(diagnostics, mOutputVaryingsWithLocation, false); ValidateShaderInterface(diagnostics, mOutputVaryingsWithLocation, false);
} }
......
...@@ -527,7 +527,7 @@ bool IsVarying(TQualifier qualifier) ...@@ -527,7 +527,7 @@ bool IsVarying(TQualifier qualifier)
bool IsGeometryShaderInput(GLenum shaderType, TQualifier qualifier) bool IsGeometryShaderInput(GLenum shaderType, TQualifier qualifier)
{ {
return (qualifier == EvqGeometryIn) || return (qualifier == EvqGeometryIn) ||
((shaderType == GL_GEOMETRY_SHADER_OES) && IsInterpolationIn(qualifier)); ((shaderType == GL_GEOMETRY_SHADER_EXT) && IsInterpolationIn(qualifier));
} }
InterpolationType GetInterpolationType(TQualifier qualifier) InterpolationType GetInterpolationType(TQualifier qualifier)
......
...@@ -132,8 +132,7 @@ Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state) ...@@ -132,8 +132,7 @@ Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state)
} }
// Geometry Shader constants // Geometry Shader constants
// TODO(jiawei.shao@intel.com): use EXT_geometry_shader everywhere in compiler. mResources.EXT_geometry_shader = extensions.geometryShader;
mResources.OES_geometry_shader = extensions.geometryShader;
mResources.MaxGeometryUniformComponents = caps.maxGeometryUniformComponents; mResources.MaxGeometryUniformComponents = caps.maxGeometryUniformComponents;
mResources.MaxGeometryUniformBlocks = caps.maxGeometryUniformBlocks; mResources.MaxGeometryUniformBlocks = caps.maxGeometryUniformBlocks;
mResources.MaxGeometryInputComponents = caps.maxGeometryInputComponents; mResources.MaxGeometryInputComponents = caps.maxGeometryInputComponents;
......
...@@ -155,10 +155,10 @@ class CollectVariablesTestES31 : public CollectVariablesTest ...@@ -155,10 +155,10 @@ class CollectVariablesTestES31 : public CollectVariablesTest
} }
}; };
class CollectVariablesOESGeometryShaderTest : public CollectVariablesTestES31 class CollectVariablesEXTGeometryShaderTest : public CollectVariablesTestES31
{ {
public: public:
CollectVariablesOESGeometryShaderTest(sh::GLenum shaderType) CollectVariablesEXTGeometryShaderTest(sh::GLenum shaderType)
: CollectVariablesTestES31(shaderType) : CollectVariablesTestES31(shaderType)
{ {
} }
...@@ -168,16 +168,16 @@ class CollectVariablesOESGeometryShaderTest : public CollectVariablesTestES31 ...@@ -168,16 +168,16 @@ class CollectVariablesOESGeometryShaderTest : public CollectVariablesTestES31
{ {
ShBuiltInResources resources; ShBuiltInResources resources;
InitBuiltInResources(&resources); InitBuiltInResources(&resources);
resources.OES_geometry_shader = 1; resources.EXT_geometry_shader = 1;
initTranslator(resources); initTranslator(resources);
} }
}; };
class CollectGeometryVariablesTest : public CollectVariablesOESGeometryShaderTest class CollectGeometryVariablesTest : public CollectVariablesEXTGeometryShaderTest
{ {
public: public:
CollectGeometryVariablesTest() : CollectVariablesOESGeometryShaderTest(GL_GEOMETRY_SHADER_OES) CollectGeometryVariablesTest() : CollectVariablesEXTGeometryShaderTest(GL_GEOMETRY_SHADER_EXT)
{ {
} }
...@@ -188,7 +188,7 @@ class CollectGeometryVariablesTest : public CollectVariablesOESGeometryShaderTes ...@@ -188,7 +188,7 @@ class CollectGeometryVariablesTest : public CollectVariablesOESGeometryShaderTes
{ {
std::ostringstream sstream; std::ostringstream sstream;
sstream << "#version 310 es\n" sstream << "#version 310 es\n"
<< "#extension GL_OES_geometry_shader : require\n" << "#extension GL_EXT_geometry_shader : require\n"
<< "layout (" << inputPrimitive << ") in;\n" << "layout (" << inputPrimitive << ") in;\n"
<< "layout (points, max_vertices = 2) out;\n" << "layout (points, max_vertices = 2) out;\n"
<< inputVarying << functionBody; << inputVarying << functionBody;
...@@ -197,11 +197,11 @@ class CollectGeometryVariablesTest : public CollectVariablesOESGeometryShaderTes ...@@ -197,11 +197,11 @@ class CollectGeometryVariablesTest : public CollectVariablesOESGeometryShaderTes
} }
}; };
class CollectFragmentVariablesOESGeometryShaderTest : public CollectVariablesOESGeometryShaderTest class CollectFragmentVariablesEXTGeometryShaderTest : public CollectVariablesEXTGeometryShaderTest
{ {
public: public:
CollectFragmentVariablesOESGeometryShaderTest() CollectFragmentVariablesEXTGeometryShaderTest()
: CollectVariablesOESGeometryShaderTest(GL_FRAGMENT_SHADER) : CollectVariablesEXTGeometryShaderTest(GL_FRAGMENT_SHADER)
{ {
} }
...@@ -938,7 +938,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInFields) ...@@ -938,7 +938,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInFields)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
...@@ -1009,7 +1009,7 @@ TEST_F(CollectGeometryVariablesTest, CollectPrimitiveIDIn) ...@@ -1009,7 +1009,7 @@ TEST_F(CollectGeometryVariablesTest, CollectPrimitiveIDIn)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1041,7 +1041,7 @@ TEST_F(CollectGeometryVariablesTest, CollectInvocationID) ...@@ -1041,7 +1041,7 @@ TEST_F(CollectGeometryVariablesTest, CollectInvocationID)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points, invocations = 2) in; layout (points, invocations = 2) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1073,7 +1073,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInIndexedByExpression) ...@@ -1073,7 +1073,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInIndexedByExpression)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (triangles, invocations = 2) in; layout (triangles, invocations = 2) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1102,14 +1102,14 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInIndexedByExpression) ...@@ -1102,14 +1102,14 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInIndexedByExpression)
TEST_F(CollectGeometryVariablesTest, CollectPosition) TEST_F(CollectGeometryVariablesTest, CollectPosition)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_Position = vec4(0.1, 0.2, 0.3, 1);\n" gl_Position = vec4(0.1, 0.2, 0.3, 1);
"}\n"; })";
compile(shaderString); compile(shaderString);
...@@ -1133,14 +1133,14 @@ TEST_F(CollectGeometryVariablesTest, CollectPosition) ...@@ -1133,14 +1133,14 @@ TEST_F(CollectGeometryVariablesTest, CollectPosition)
TEST_F(CollectGeometryVariablesTest, CollectPrimitiveID) TEST_F(CollectGeometryVariablesTest, CollectPrimitiveID)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_PrimitiveID = 100;\n" gl_PrimitiveID = 100;
"}\n"; })";
compile(shaderString); compile(shaderString);
...@@ -1164,14 +1164,14 @@ TEST_F(CollectGeometryVariablesTest, CollectPrimitiveID) ...@@ -1164,14 +1164,14 @@ TEST_F(CollectGeometryVariablesTest, CollectPrimitiveID)
TEST_F(CollectGeometryVariablesTest, CollectLayer) TEST_F(CollectGeometryVariablesTest, CollectLayer)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_Layer = 2;\n" gl_Layer = 2;
"}\n"; })";
compile(shaderString); compile(shaderString);
...@@ -1192,11 +1192,11 @@ TEST_F(CollectGeometryVariablesTest, CollectLayer) ...@@ -1192,11 +1192,11 @@ TEST_F(CollectGeometryVariablesTest, CollectLayer)
} }
// Test collecting gl_PrimitiveID in a fragment shader. // Test collecting gl_PrimitiveID in a fragment shader.
TEST_F(CollectFragmentVariablesOESGeometryShaderTest, CollectPrimitiveID) TEST_F(CollectFragmentVariablesEXTGeometryShaderTest, CollectPrimitiveID)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
out int my_out; out int my_out;
...@@ -1223,11 +1223,11 @@ TEST_F(CollectFragmentVariablesOESGeometryShaderTest, CollectPrimitiveID) ...@@ -1223,11 +1223,11 @@ TEST_F(CollectFragmentVariablesOESGeometryShaderTest, CollectPrimitiveID)
} }
// Test collecting gl_Layer in a fragment shader. // Test collecting gl_Layer in a fragment shader.
TEST_F(CollectFragmentVariablesOESGeometryShaderTest, CollectLayer) TEST_F(CollectFragmentVariablesEXTGeometryShaderTest, CollectLayer)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
out int my_out; out int my_out;
...@@ -1257,12 +1257,12 @@ TEST_F(CollectFragmentVariablesOESGeometryShaderTest, CollectLayer) ...@@ -1257,12 +1257,12 @@ TEST_F(CollectFragmentVariablesOESGeometryShaderTest, CollectLayer)
TEST_F(CollectVertexVariablesES31Test, CollectOutputWithLocation) TEST_F(CollectVertexVariablesES31Test, CollectOutputWithLocation)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"out vec4 v_output1;\n" out vec4 v_output1;
"layout (location = 1) out vec4 v_output2;\n" layout (location = 1) out vec4 v_output2;
"void main()\n" void main()
"{\n" {
"}\n"; })";
compile(shaderString); compile(shaderString);
...@@ -1282,15 +1282,15 @@ TEST_F(CollectVertexVariablesES31Test, CollectOutputWithLocation) ...@@ -1282,15 +1282,15 @@ TEST_F(CollectVertexVariablesES31Test, CollectOutputWithLocation)
TEST_F(CollectFragmentVariablesES31Test, CollectInputWithLocation) TEST_F(CollectFragmentVariablesES31Test, CollectInputWithLocation)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"precision mediump float;\n" precision mediump float;
"in vec4 f_input1;\n" in vec4 f_input1;
"layout (location = 1) in vec4 f_input2;\n" layout (location = 1) in vec4 f_input2;
"layout (location = 0) out vec4 o_color;\n" layout (location = 0) out vec4 o_color;
"void main()\n" void main()
"{\n" {
" o_color = f_input2;\n" o_color = f_input2;
"}\n"; })";
compile(shaderString); compile(shaderString);
...@@ -1311,7 +1311,7 @@ TEST_F(CollectGeometryVariablesTest, CollectInputs) ...@@ -1311,7 +1311,7 @@ TEST_F(CollectGeometryVariablesTest, CollectInputs)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
in vec4 texcoord1[]; in vec4 texcoord1[];
...@@ -1384,7 +1384,7 @@ TEST_F(CollectGeometryVariablesTest, CollectInputsWithInterpolationQualifiers) ...@@ -1384,7 +1384,7 @@ TEST_F(CollectGeometryVariablesTest, CollectInputsWithInterpolationQualifiers)
{ {
const std::string &kHeader = const std::string &kHeader =
"#version 310 es\n" "#version 310 es\n"
"#extension GL_OES_geometry_shader : require\n"; "#extension GL_EXT_geometry_shader : require\n";
const std::string &kLayout = const std::string &kLayout =
"layout (points) in;\n" "layout (points) in;\n"
"layout (points, max_vertices = 2) out;\n"; "layout (points, max_vertices = 2) out;\n";
...@@ -1422,7 +1422,7 @@ TEST_F(CollectGeometryVariablesTest, CollectOutputsWithInterpolationQualifiers) ...@@ -1422,7 +1422,7 @@ TEST_F(CollectGeometryVariablesTest, CollectOutputsWithInterpolationQualifiers)
{ {
const std::string &kHeader = const std::string &kHeader =
"#version 310 es\n" "#version 310 es\n"
"#extension GL_OES_geometry_shader : require\n" "#extension GL_EXT_geometry_shader : require\n"
"layout (points) in;\n" "layout (points) in;\n"
"layout (points, max_vertices = 2) out;\n"; "layout (points, max_vertices = 2) out;\n";
...@@ -1459,15 +1459,15 @@ TEST_F(CollectGeometryVariablesTest, CollectOutputsWithInterpolationQualifiers) ...@@ -1459,15 +1459,15 @@ TEST_F(CollectGeometryVariablesTest, CollectOutputsWithInterpolationQualifiers)
TEST_F(CollectGeometryVariablesTest, CollectOutputsWithInvariant) TEST_F(CollectGeometryVariablesTest, CollectOutputsWithInvariant)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"invariant out vec4 texcoord;\n" invariant out vec4 texcoord;
"void main()\n" void main()
"{\n" {
" texcoord = vec4(1.0, 0.0, 0.0, 1.0);\n" texcoord = vec4(1.0, 0.0, 0.0, 1.0);
"}\n"; })";
compile(shaderString); compile(shaderString);
......
...@@ -25,10 +25,10 @@ class GeometryShaderTest : public ShaderCompileTreeTest ...@@ -25,10 +25,10 @@ class GeometryShaderTest : public ShaderCompileTreeTest
protected: protected:
void initResources(ShBuiltInResources *resources) override void initResources(ShBuiltInResources *resources) override
{ {
resources->OES_geometry_shader = 1; resources->EXT_geometry_shader = 1;
} }
::GLenum getShaderType() const override { return GL_GEOMETRY_SHADER_OES; } ::GLenum getShaderType() const override { return GL_GEOMETRY_SHADER_EXT; }
ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; } ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; }
...@@ -92,11 +92,9 @@ class GeometryShaderTest : public ShaderCompileTreeTest ...@@ -92,11 +92,9 @@ class GeometryShaderTest : public ShaderCompileTreeTest
} }
const std::string kVersion = "#version 310 es\n"; const std::string kVersion = "#version 310 es\n";
const std::array<std::string, 2> kExtensionStrings = {
{"#extension GL_OES_geometry_shader", "#extension GL_EXT_geometry_shader"}};
const std::string kHeader = const std::string kHeader =
"#version 310 es\n" "#version 310 es\n"
"#extension GL_OES_geometry_shader : require\n"; "#extension GL_EXT_geometry_shader : require\n";
const std::string kInputLayout = "layout (points) in;\n"; const std::string kInputLayout = "layout (points) in;\n";
const std::string kOutputLayout = "layout (points, max_vertices = 1) out;\n"; const std::string kOutputLayout = "layout (points, max_vertices = 1) out;\n";
...@@ -112,32 +110,15 @@ class GeometryShaderTest : public ShaderCompileTreeTest ...@@ -112,32 +110,15 @@ class GeometryShaderTest : public ShaderCompileTreeTest
"void main()\n" "void main()\n"
"{\n" "{\n"
"}\n"; "}\n";
const std::string kShaderBody =
R"(layout(triangles, invocations = 2) in;
layout(triangle_strip, max_vertices = 3) out;
in vec4 i_color[];
out vec4 o_color;
void main()
{
for (int i = 0; i < i_color.length(); i++)
{
gl_Position = gl_in[i].gl_Position;
o_color = i_color[i];
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = gl_InvocationID;
EmitVertex();
}
EndPrimitive();
})";
}; };
class GeometryShaderOutputCodeTest : public MatchOutputCodeTest class GeometryShaderOutputCodeTest : public MatchOutputCodeTest
{ {
public: public:
GeometryShaderOutputCodeTest() GeometryShaderOutputCodeTest()
: MatchOutputCodeTest(GL_GEOMETRY_SHADER_OES, SH_OBJECT_CODE, SH_ESSL_OUTPUT) : MatchOutputCodeTest(GL_GEOMETRY_SHADER_EXT, SH_OBJECT_CODE, SH_ESSL_OUTPUT)
{ {
getResources()->OES_geometry_shader = 1; getResources()->EXT_geometry_shader = 1;
} }
}; };
...@@ -145,12 +126,12 @@ class GeometryShaderOutputCodeTest : public MatchOutputCodeTest ...@@ -145,12 +126,12 @@ class GeometryShaderOutputCodeTest : public MatchOutputCodeTest
TEST_F(GeometryShaderTest, Version300) TEST_F(GeometryShaderTest, Version300)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 300 es\n" R"(#version 300 es
"layout(points) in;\n" layout(points) in;
"layout(points, max_vertices = 1) out;\n" layout(points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -159,16 +140,16 @@ TEST_F(GeometryShaderTest, Version300) ...@@ -159,16 +140,16 @@ TEST_F(GeometryShaderTest, Version300)
} }
// Geometry Shaders are not supported in GLSL ES shaders version 310 without extension // Geometry Shaders are not supported in GLSL ES shaders version 310 without extension
// OES_geometry_shader enabled. // EXT_geometry_shader enabled.
TEST_F(GeometryShaderTest, Version310WithoutExtension) TEST_F(GeometryShaderTest, Version310WithoutExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"layout(points) in;\n" layout(points) in;
"layout(points, max_vertices = 1) out;\n" layout(points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -176,17 +157,17 @@ TEST_F(GeometryShaderTest, Version310WithoutExtension) ...@@ -176,17 +157,17 @@ TEST_F(GeometryShaderTest, Version310WithoutExtension)
} }
} }
// Geometry Shaders are supported in GLSL ES shaders version 310 with OES_geometry_shader enabled. // Geometry Shaders are supported in GLSL ES shaders version 310 with EXT_geometry_shader enabled.
TEST_F(GeometryShaderTest, Version310WithOESExtension) TEST_F(GeometryShaderTest, Version310WithOESExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout(points) in;\n" layout(points) in;
"layout(points, max_vertices = 1) out;\n" layout(points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -199,12 +180,12 @@ TEST_F(GeometryShaderTest, Version310WithOESExtension) ...@@ -199,12 +180,12 @@ TEST_F(GeometryShaderTest, Version310WithOESExtension)
TEST_F(GeometryShaderTest, NoInputPrimitives) TEST_F(GeometryShaderTest, NoInputPrimitives)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout(points, max_vertices = 1) out;\n" layout(points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -266,13 +247,13 @@ TEST_F(GeometryShaderTest, RedeclareInputPrimitives) ...@@ -266,13 +247,13 @@ TEST_F(GeometryShaderTest, RedeclareInputPrimitives)
TEST_F(GeometryShaderTest, DeclareDifferentInputPrimitivesInOneLayout) TEST_F(GeometryShaderTest, DeclareDifferentInputPrimitivesInOneLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, triangles) in;\n" layout (points, triangles) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -284,13 +265,13 @@ TEST_F(GeometryShaderTest, DeclareDifferentInputPrimitivesInOneLayout) ...@@ -284,13 +265,13 @@ TEST_F(GeometryShaderTest, DeclareDifferentInputPrimitivesInOneLayout)
TEST_F(GeometryShaderTest, InvocationsLessThanOne) TEST_F(GeometryShaderTest, InvocationsLessThanOne)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 0) in;\n" layout (points, invocations = 0) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -303,13 +284,13 @@ TEST_F(GeometryShaderTest, InvocationsLessThanOne) ...@@ -303,13 +284,13 @@ TEST_F(GeometryShaderTest, InvocationsLessThanOne)
TEST_F(GeometryShaderTest, InvocationsEqualsOne) TEST_F(GeometryShaderTest, InvocationsEqualsOne)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 1) in;\n" layout (points, invocations = 1) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -321,14 +302,14 @@ TEST_F(GeometryShaderTest, InvocationsEqualsOne) ...@@ -321,14 +302,14 @@ TEST_F(GeometryShaderTest, InvocationsEqualsOne)
TEST_F(GeometryShaderTest, InvocationsEqualsOneInSeparatedLayout) TEST_F(GeometryShaderTest, InvocationsEqualsOneInSeparatedLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (invocations = 1) in;\n" layout (invocations = 1) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -341,13 +322,13 @@ TEST_F(GeometryShaderTest, InvocationsEqualsOneInSeparatedLayout) ...@@ -341,13 +322,13 @@ TEST_F(GeometryShaderTest, InvocationsEqualsOneInSeparatedLayout)
TEST_F(GeometryShaderTest, TooLargeInvocations) TEST_F(GeometryShaderTest, TooLargeInvocations)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 9989899) in;\n" layout (points, invocations = 9989899) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -359,13 +340,13 @@ TEST_F(GeometryShaderTest, TooLargeInvocations) ...@@ -359,13 +340,13 @@ TEST_F(GeometryShaderTest, TooLargeInvocations)
TEST_F(GeometryShaderTest, InvocationsDeclaredWithInputPrimitives) TEST_F(GeometryShaderTest, InvocationsDeclaredWithInputPrimitives)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 3) in;\n" layout (points, invocations = 3) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -377,13 +358,13 @@ TEST_F(GeometryShaderTest, InvocationsDeclaredWithInputPrimitives) ...@@ -377,13 +358,13 @@ TEST_F(GeometryShaderTest, InvocationsDeclaredWithInputPrimitives)
TEST_F(GeometryShaderTest, InvocationsBeforeInputPrimitives) TEST_F(GeometryShaderTest, InvocationsBeforeInputPrimitives)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (invocations = 3, points) in;\n" layout (invocations = 3, points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -395,14 +376,14 @@ TEST_F(GeometryShaderTest, InvocationsBeforeInputPrimitives) ...@@ -395,14 +376,14 @@ TEST_F(GeometryShaderTest, InvocationsBeforeInputPrimitives)
TEST_F(GeometryShaderTest, InvocationsInIndividualLayout) TEST_F(GeometryShaderTest, InvocationsInIndividualLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (invocations = 3) in;\n" layout (invocations = 3) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -414,14 +395,14 @@ TEST_F(GeometryShaderTest, InvocationsInIndividualLayout) ...@@ -414,14 +395,14 @@ TEST_F(GeometryShaderTest, InvocationsInIndividualLayout)
TEST_F(GeometryShaderTest, DuplicatedInvocations) TEST_F(GeometryShaderTest, DuplicatedInvocations)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 3) in;\n" layout (points, invocations = 3) in;
"layout (invocations = 3) in;\n" layout (invocations = 3) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -434,14 +415,14 @@ TEST_F(GeometryShaderTest, DuplicatedInvocations) ...@@ -434,14 +415,14 @@ TEST_F(GeometryShaderTest, DuplicatedInvocations)
TEST_F(GeometryShaderTest, RedeclareDifferentInvocations) TEST_F(GeometryShaderTest, RedeclareDifferentInvocations)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 3) in;\n" layout (points, invocations = 3) in;
"layout (invocations = 5) in;\n" layout (invocations = 5) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -454,14 +435,14 @@ TEST_F(GeometryShaderTest, RedeclareDifferentInvocations) ...@@ -454,14 +435,14 @@ TEST_F(GeometryShaderTest, RedeclareDifferentInvocations)
TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsAfterInvocationEqualsOne) TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsAfterInvocationEqualsOne)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 1) in;\n" layout (points, invocations = 1) in;
"layout (invocations = 5) in;\n" layout (invocations = 5) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -473,13 +454,13 @@ TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsAfterInvocationEqualsOne ...@@ -473,13 +454,13 @@ TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsAfterInvocationEqualsOne
TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsInOneLayout) TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsInOneLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 3, invocations = 5) in;\n" layout (points, invocations = 3, invocations = 5) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -491,13 +472,13 @@ TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsInOneLayout) ...@@ -491,13 +472,13 @@ TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsInOneLayout)
TEST_F(GeometryShaderTest, DeclareInvocationsInOutLayout) TEST_F(GeometryShaderTest, DeclareInvocationsInOutLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, invocations = 3, max_vertices = 1) out;\n" layout (points, invocations = 3, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -509,14 +490,14 @@ TEST_F(GeometryShaderTest, DeclareInvocationsInOutLayout) ...@@ -509,14 +490,14 @@ TEST_F(GeometryShaderTest, DeclareInvocationsInOutLayout)
TEST_F(GeometryShaderTest, DeclareInvocationsInLayoutNoQualifier) TEST_F(GeometryShaderTest, DeclareInvocationsInLayoutNoQualifier)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (invocations = 3);\n" layout (invocations = 3);
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -528,13 +509,13 @@ TEST_F(GeometryShaderTest, DeclareInvocationsInLayoutNoQualifier) ...@@ -528,13 +509,13 @@ TEST_F(GeometryShaderTest, DeclareInvocationsInLayoutNoQualifier)
TEST_F(GeometryShaderTest, DeclareOutputPrimitiveBeforeInputPrimitiveDeclare) TEST_F(GeometryShaderTest, DeclareOutputPrimitiveBeforeInputPrimitiveDeclare)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"layout (points) in;\n" layout (points) in;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -546,13 +527,13 @@ TEST_F(GeometryShaderTest, DeclareOutputPrimitiveBeforeInputPrimitiveDeclare) ...@@ -546,13 +527,13 @@ TEST_F(GeometryShaderTest, DeclareOutputPrimitiveBeforeInputPrimitiveDeclare)
TEST_F(GeometryShaderTest, DeclareMaxVerticesBeforeOutputPrimitive) TEST_F(GeometryShaderTest, DeclareMaxVerticesBeforeOutputPrimitive)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (max_vertices = 1, points) out;\n" layout (max_vertices = 1, points) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -565,13 +546,13 @@ TEST_F(GeometryShaderTest, DeclareMaxVerticesBeforeOutputPrimitive) ...@@ -565,13 +546,13 @@ TEST_F(GeometryShaderTest, DeclareMaxVerticesBeforeOutputPrimitive)
TEST_F(GeometryShaderTest, NoOutputPrimitives) TEST_F(GeometryShaderTest, NoOutputPrimitives)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (max_vertices = 1) out;\n" layout (max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -634,13 +615,13 @@ TEST_F(GeometryShaderTest, RedeclareOutputPrimitives) ...@@ -634,13 +615,13 @@ TEST_F(GeometryShaderTest, RedeclareOutputPrimitives)
TEST_F(GeometryShaderTest, RedeclareDifferentOutputPrimitivesInOneLayout) TEST_F(GeometryShaderTest, RedeclareDifferentOutputPrimitivesInOneLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 3, line_strip) out;\n" layout (points, max_vertices = 3, line_strip) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -653,12 +634,12 @@ TEST_F(GeometryShaderTest, RedeclareDifferentOutputPrimitivesInOneLayout) ...@@ -653,12 +634,12 @@ TEST_F(GeometryShaderTest, RedeclareDifferentOutputPrimitivesInOneLayout)
TEST_F(GeometryShaderTest, NoOutLayouts) TEST_F(GeometryShaderTest, NoOutLayouts)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -671,13 +652,13 @@ TEST_F(GeometryShaderTest, NoOutLayouts) ...@@ -671,13 +652,13 @@ TEST_F(GeometryShaderTest, NoOutLayouts)
TEST_F(GeometryShaderTest, NoMaxVertices) TEST_F(GeometryShaderTest, NoMaxVertices)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points) out;\n" layout (points) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -689,13 +670,13 @@ TEST_F(GeometryShaderTest, NoMaxVertices) ...@@ -689,13 +670,13 @@ TEST_F(GeometryShaderTest, NoMaxVertices)
TEST_F(GeometryShaderTest, NegativeMaxVertices) TEST_F(GeometryShaderTest, NegativeMaxVertices)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = -1) out;\n" layout (points, max_vertices = -1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -707,13 +688,13 @@ TEST_F(GeometryShaderTest, NegativeMaxVertices) ...@@ -707,13 +688,13 @@ TEST_F(GeometryShaderTest, NegativeMaxVertices)
TEST_F(GeometryShaderTest, ZeroMaxVertices) TEST_F(GeometryShaderTest, ZeroMaxVertices)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 0) out;\n" layout (points, max_vertices = 0) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -726,13 +707,13 @@ TEST_F(GeometryShaderTest, ZeroMaxVertices) ...@@ -726,13 +707,13 @@ TEST_F(GeometryShaderTest, ZeroMaxVertices)
TEST_F(GeometryShaderTest, TooLargeMaxVertices) TEST_F(GeometryShaderTest, TooLargeMaxVertices)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 257) out;\n" layout (points, max_vertices = 257) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -744,14 +725,14 @@ TEST_F(GeometryShaderTest, TooLargeMaxVertices) ...@@ -744,14 +725,14 @@ TEST_F(GeometryShaderTest, TooLargeMaxVertices)
TEST_F(GeometryShaderTest, MaxVerticesInIndividualLayout) TEST_F(GeometryShaderTest, MaxVerticesInIndividualLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points) out;\n" layout (points) out;
"layout (max_vertices = 1) out;\n" layout (max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -763,14 +744,14 @@ TEST_F(GeometryShaderTest, MaxVerticesInIndividualLayout) ...@@ -763,14 +744,14 @@ TEST_F(GeometryShaderTest, MaxVerticesInIndividualLayout)
TEST_F(GeometryShaderTest, DuplicatedMaxVertices) TEST_F(GeometryShaderTest, DuplicatedMaxVertices)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"layout (max_vertices = 1) out;\n" layout (max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -782,14 +763,14 @@ TEST_F(GeometryShaderTest, DuplicatedMaxVertices) ...@@ -782,14 +763,14 @@ TEST_F(GeometryShaderTest, DuplicatedMaxVertices)
TEST_F(GeometryShaderTest, RedeclareDifferentMaxVertices) TEST_F(GeometryShaderTest, RedeclareDifferentMaxVertices)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"layout (max_vertices = 2) out;\n" layout (max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -801,13 +782,13 @@ TEST_F(GeometryShaderTest, RedeclareDifferentMaxVertices) ...@@ -801,13 +782,13 @@ TEST_F(GeometryShaderTest, RedeclareDifferentMaxVertices)
TEST_F(GeometryShaderTest, RedeclareDifferentMaxVerticesInOneLayout) TEST_F(GeometryShaderTest, RedeclareDifferentMaxVerticesInOneLayout)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2, max_vertices = 1) out;\n" layout (points, max_vertices = 2, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -819,42 +800,42 @@ TEST_F(GeometryShaderTest, RedeclareDifferentMaxVerticesInOneLayout) ...@@ -819,42 +800,42 @@ TEST_F(GeometryShaderTest, RedeclareDifferentMaxVerticesInOneLayout)
TEST_F(GeometryShaderTest, InvalidLocation) TEST_F(GeometryShaderTest, InvalidLocation)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, location = 1) in;\n" layout (points, location = 1) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString2 = const std::string &shaderString2 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (invocations = 2, location = 1) in;\n" layout (invocations = 2, location = 1) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString3 = const std::string &shaderString3 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, location = 3, max_vertices = 2) out;\n" layout (points, location = 3, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString4 = const std::string &shaderString4 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points) out;\n" layout (points) out;
"layout (max_vertices = 2, location = 3) out;\n" layout (max_vertices = 2, location = 3) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) || if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) ||
compile(shaderString4)) compile(shaderString4))
...@@ -867,41 +848,41 @@ TEST_F(GeometryShaderTest, InvalidLocation) ...@@ -867,41 +848,41 @@ TEST_F(GeometryShaderTest, InvalidLocation)
TEST_F(GeometryShaderTest, InvalidLayoutQualifiers) TEST_F(GeometryShaderTest, InvalidLayoutQualifiers)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, abc) in;\n" layout (points, abc) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString2 = const std::string &shaderString2 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, abc, max_vertices = 2) out;\n" layout (points, abc, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString3 = const std::string &shaderString3 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, xyz = 2) in;\n" layout (points, xyz = 2) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString4 = const std::string &shaderString4 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points) out;\n" layout (points) out;
"layout (max_vertices = 2, xyz = 3) out;\n" layout (max_vertices = 2, xyz = 3) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) || if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) ||
compile(shaderString4)) compile(shaderString4))
...@@ -914,15 +895,15 @@ TEST_F(GeometryShaderTest, InvalidLayoutQualifiers) ...@@ -914,15 +895,15 @@ TEST_F(GeometryShaderTest, InvalidLayoutQualifiers)
TEST_F(GeometryShaderTest, IndexGLInByConstantInteger) TEST_F(GeometryShaderTest, IndexGLInByConstantInteger)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" vec4 position;\n" vec4 position;
" position = gl_in[0].gl_Position;\n" position = gl_in[0].gl_Position;
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -934,18 +915,18 @@ TEST_F(GeometryShaderTest, IndexGLInByConstantInteger) ...@@ -934,18 +915,18 @@ TEST_F(GeometryShaderTest, IndexGLInByConstantInteger)
TEST_F(GeometryShaderTest, IndexGLInByVariable) TEST_F(GeometryShaderTest, IndexGLInByVariable)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (lines) in;\n" layout (lines) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" vec4 position;\n" vec4 position;
" for (int i = 0; i < 2; i++)\n" for (int i = 0; i < 2; i++)
" {\n" {
" position = gl_in[i].gl_Position;\n" position = gl_in[i].gl_Position;
" }\n" }
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -958,13 +939,13 @@ TEST_F(GeometryShaderTest, IndexGLInByVariable) ...@@ -958,13 +939,13 @@ TEST_F(GeometryShaderTest, IndexGLInByVariable)
TEST_F(GeometryShaderTest, IndexGLInWithoutInputPrimitive) TEST_F(GeometryShaderTest, IndexGLInWithoutInputPrimitive)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" vec4 position = gl_in[0].gl_Position;\n" vec4 position = gl_in[0].gl_Position;
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -976,13 +957,13 @@ TEST_F(GeometryShaderTest, IndexGLInWithoutInputPrimitive) ...@@ -976,13 +957,13 @@ TEST_F(GeometryShaderTest, IndexGLInWithoutInputPrimitive)
TEST_F(GeometryShaderTest, UseGLInLengthWithoutInputPrimitive) TEST_F(GeometryShaderTest, UseGLInLengthWithoutInputPrimitive)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" int length = gl_in.length();\n" int length = gl_in.length();
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -995,7 +976,7 @@ TEST_F(GeometryShaderTest, UseGLInLengthWithInputPrimitive) ...@@ -995,7 +976,7 @@ TEST_F(GeometryShaderTest, UseGLInLengthWithInputPrimitive)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1014,14 +995,14 @@ TEST_F(GeometryShaderTest, UseGLInLengthWithInputPrimitive) ...@@ -1014,14 +995,14 @@ TEST_F(GeometryShaderTest, UseGLInLengthWithInputPrimitive)
TEST_F(GeometryShaderTest, AssignValueToGLIn) TEST_F(GeometryShaderTest, AssignValueToGLIn)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_in[0].gl_Position = vec4(0, 0, 0, 1);\n" gl_in[0].gl_Position = vec4(0, 0, 0, 1);
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog; FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
...@@ -1032,18 +1013,18 @@ TEST_F(GeometryShaderTest, AssignValueToGLIn) ...@@ -1032,18 +1013,18 @@ TEST_F(GeometryShaderTest, AssignValueToGLIn)
TEST_F(GeometryShaderTest, BuiltInVariables) TEST_F(GeometryShaderTest, BuiltInVariables)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 2) in;\n" layout (points, invocations = 2) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_Position = gl_in[gl_InvocationID].gl_Position;\n" gl_Position = gl_in[gl_InvocationID].gl_Position;
" int invocation = gl_InvocationID;\n" int invocation = gl_InvocationID;
" gl_Layer = invocation;\n" gl_Layer = invocation;
" int primitiveIn = gl_PrimitiveIDIn;\n" int primitiveIn = gl_PrimitiveIDIn;
" gl_PrimitiveID = primitiveIn;\n" gl_PrimitiveID = primitiveIn;
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog; FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
...@@ -1054,14 +1035,14 @@ TEST_F(GeometryShaderTest, BuiltInVariables) ...@@ -1054,14 +1035,14 @@ TEST_F(GeometryShaderTest, BuiltInVariables)
TEST_F(GeometryShaderTest, AssignValueToGLPrimitiveIn) TEST_F(GeometryShaderTest, AssignValueToGLPrimitiveIn)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 2) in;\n" layout (points, invocations = 2) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_PrimitiveIDIn = 1;\n" gl_PrimitiveIDIn = 1;
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog; FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
...@@ -1072,14 +1053,14 @@ TEST_F(GeometryShaderTest, AssignValueToGLPrimitiveIn) ...@@ -1072,14 +1053,14 @@ TEST_F(GeometryShaderTest, AssignValueToGLPrimitiveIn)
TEST_F(GeometryShaderTest, AssignValueToGLInvocations) TEST_F(GeometryShaderTest, AssignValueToGLInvocations)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, invocations = 2) in;\n" layout (points, invocations = 2) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_InvocationID = 1;\n" gl_InvocationID = 1;
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog; FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
...@@ -1090,16 +1071,16 @@ TEST_F(GeometryShaderTest, AssignValueToGLInvocations) ...@@ -1090,16 +1071,16 @@ TEST_F(GeometryShaderTest, AssignValueToGLInvocations)
TEST_F(GeometryShaderTest, GeometryShaderBuiltInFunctions) TEST_F(GeometryShaderTest, GeometryShaderBuiltInFunctions)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
" gl_Position = gl_in[0].gl_Position;\n" gl_Position = gl_in[0].gl_Position;
" EmitVertex();\n" EmitVertex();
" EndPrimitive();\n" EndPrimitive();
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -1107,23 +1088,23 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInFunctions) ...@@ -1107,23 +1088,23 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInFunctions)
} }
} }
// Verify that using EmitVertex() or EndPrimitive() without GL_OES_geometry_shader declared causes a // Verify that using EmitVertex() or EndPrimitive() without GL_EXT_geometry_shader declared causes a
// compile error. // compile error.
TEST_F(GeometryShaderTest, GeometryShaderBuiltInFunctionsWithoutExtension) TEST_F(GeometryShaderTest, GeometryShaderBuiltInFunctionsWithoutExtension)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
"#version 310 es\n" R"(#version 310 es
"void main()\n" void main()
"{\n" {
" EmitVertex();\n" EmitVertex();
"}\n"; })";
const std::string &shaderString2 = const std::string &shaderString2 =
"#version 310 es\n" R"(#version 310 es
"void main()\n" void main()
"{\n" {
" EndPrimitive();\n" EndPrimitive();
"}\n"; })";
if (compile(shaderString1) || compile(shaderString2)) if (compile(shaderString1) || compile(shaderString2))
{ {
...@@ -1136,7 +1117,7 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstants) ...@@ -1136,7 +1117,7 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstants)
{ {
const std::string &kShaderHeader = const std::string &kShaderHeader =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1167,7 +1148,7 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstants) ...@@ -1167,7 +1148,7 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstants)
} }
} }
// Verify that using any Geometry Shader built-in constant values without GL_OES_geometry_shader // Verify that using any Geometry Shader built-in constant values without GL_EXT_geometry_shader
// declared causes a compile error. // declared causes a compile error.
TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstantsWithoutExtension) TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstantsWithoutExtension)
{ {
...@@ -1204,14 +1185,14 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstantsWithoutExtension) ...@@ -1204,14 +1185,14 @@ TEST_F(GeometryShaderTest, GeometryShaderBuiltInConstantsWithoutExtension)
TEST_F(GeometryShaderTest, NonArrayInput) TEST_F(GeometryShaderTest, NonArrayInput)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"in vec4 texcoord;\n" in vec4 texcoord;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -1224,29 +1205,29 @@ TEST_F(GeometryShaderTest, NonArrayInput) ...@@ -1224,29 +1205,29 @@ TEST_F(GeometryShaderTest, NonArrayInput)
TEST_F(GeometryShaderTest, DeclareUnsizedInputBeforeInputPrimitive) TEST_F(GeometryShaderTest, DeclareUnsizedInputBeforeInputPrimitive)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"in vec4 texcoord[];\n" in vec4 texcoord[];
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
" vec4 coord = texcoord[0];\n" vec4 coord = texcoord[0];
" int length = texcoord.length();\n" int length = texcoord.length();
"}\n"; })";
const std::string &shaderString2 = const std::string &shaderString2 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"in vec4 texcoord1[1];\n" in vec4 texcoord1[1];
"in vec4 texcoord2[];\n" in vec4 texcoord2[];
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"void main()\n" void main()
"{\n" {
" vec4 coord = texcoord2[0];\n" vec4 coord = texcoord2[0];
" int length = texcoord2.length();\n" int length = texcoord2.length();
"}\n"; })";
if (compile(shaderString1) || compile(shaderString2)) if (compile(shaderString1) || compile(shaderString2))
{ {
...@@ -1259,23 +1240,23 @@ TEST_F(GeometryShaderTest, DeclareUnsizedInputBeforeInputPrimitive) ...@@ -1259,23 +1240,23 @@ TEST_F(GeometryShaderTest, DeclareUnsizedInputBeforeInputPrimitive)
TEST_F(GeometryShaderTest, DeclareUnsizedInputWithoutInputPrimitive) TEST_F(GeometryShaderTest, DeclareUnsizedInputWithoutInputPrimitive)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"in vec4 texcoord[];\n" in vec4 texcoord[];
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString2 = const std::string &shaderString2 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"in vec4 texcoord1[1];\n" in vec4 texcoord1[1];
"in vec4 texcoord2[];\n" in vec4 texcoord2[];
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString1) || compile(shaderString2)) if (compile(shaderString1) || compile(shaderString2))
{ {
...@@ -1289,7 +1270,7 @@ TEST_F(GeometryShaderTest, IndexingUnsizedInputDeclaredAfterInputPrimitive) ...@@ -1289,7 +1270,7 @@ TEST_F(GeometryShaderTest, IndexingUnsizedInputDeclaredAfterInputPrimitive)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 1) out; layout (points, max_vertices = 1) out;
in vec4 texcoord[], texcoord2[]; in vec4 texcoord[], texcoord2[];
...@@ -1312,7 +1293,7 @@ TEST_F(GeometryShaderTest, CallingLengthOnUnsizedInputDeclaredAfterInputPrimitiv ...@@ -1312,7 +1293,7 @@ TEST_F(GeometryShaderTest, CallingLengthOnUnsizedInputDeclaredAfterInputPrimitiv
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 1) out; layout (points, max_vertices = 1) out;
in vec4 texcoord[]; in vec4 texcoord[];
...@@ -1332,15 +1313,15 @@ TEST_F(GeometryShaderTest, CallingLengthOnUnsizedInputDeclaredAfterInputPrimitiv ...@@ -1332,15 +1313,15 @@ TEST_F(GeometryShaderTest, CallingLengthOnUnsizedInputDeclaredAfterInputPrimitiv
TEST_F(GeometryShaderTest, AssignValueToInput) TEST_F(GeometryShaderTest, AssignValueToInput)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"in vec4 texcoord[];\n" in vec4 texcoord[];
"void main()\n" void main()
"{\n" {
" texcoord[0] = vec4(1.0, 0.0, 0.0, 1.0);\n" texcoord[0] = vec4(1.0, 0.0, 0.0, 1.0);
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -1353,7 +1334,7 @@ TEST_F(GeometryShaderTest, InputWithLocations) ...@@ -1353,7 +1334,7 @@ TEST_F(GeometryShaderTest, InputWithLocations)
{ {
const std::string &shaderString = const std::string &shaderString =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (triangles) in; layout (triangles) in;
layout (points, max_vertices = 1) out; layout (points, max_vertices = 1) out;
layout (location = 0) in vec4 texcoord1[]; layout (location = 0) in vec4 texcoord1[];
...@@ -1427,14 +1408,14 @@ TEST_F(GeometryShaderTest, InputWithSizeAfterInputPrimitive) ...@@ -1427,14 +1408,14 @@ TEST_F(GeometryShaderTest, InputWithSizeAfterInputPrimitive)
TEST_F(GeometryShaderTest, NonArrayOutputs) TEST_F(GeometryShaderTest, NonArrayOutputs)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"out vec4 color;\n" out vec4 color;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -1446,17 +1427,17 @@ TEST_F(GeometryShaderTest, NonArrayOutputs) ...@@ -1446,17 +1427,17 @@ TEST_F(GeometryShaderTest, NonArrayOutputs)
TEST_F(GeometryShaderTest, OutputsWithLocation) TEST_F(GeometryShaderTest, OutputsWithLocation)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (triangles) in;\n" layout (triangles) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"layout (location = 0) out vec4 color1;\n" layout (location = 0) out vec4 color1;
"layout (location = 1) out vec4 color2;\n" layout (location = 1) out vec4 color2;
"void main()\n" void main()
"{\n" {
" color1 = vec4(0.0, 1.0, 0.0, 1.0);\n" color1 = vec4(0.0, 1.0, 0.0, 1.0);
" color2 = vec4(1.0, 0.0, 0.0, 1.0);\n" color2 = vec4(1.0, 0.0, 0.0, 1.0);
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -1468,16 +1449,16 @@ TEST_F(GeometryShaderTest, OutputsWithLocation) ...@@ -1468,16 +1449,16 @@ TEST_F(GeometryShaderTest, OutputsWithLocation)
TEST_F(GeometryShaderTest, SizedArrayOutputs) TEST_F(GeometryShaderTest, SizedArrayOutputs)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (triangles) in;\n" layout (triangles) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"out vec4 color[2];\n" out vec4 color[2];
"void main()\n" void main()
"{\n" {
" color[0] = vec4(0.0, 1.0, 0.0, 1.0);\n" color[0] = vec4(0.0, 1.0, 0.0, 1.0);
" color[1] = vec4(1.0, 0.0, 0.0, 1.0);\n" color[1] = vec4(1.0, 0.0, 0.0, 1.0);
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -1489,14 +1470,14 @@ TEST_F(GeometryShaderTest, SizedArrayOutputs) ...@@ -1489,14 +1470,14 @@ TEST_F(GeometryShaderTest, SizedArrayOutputs)
TEST_F(GeometryShaderTest, UnsizedArrayOutputs) TEST_F(GeometryShaderTest, UnsizedArrayOutputs)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (triangles) in;\n" layout (triangles) in;
"layout (points, max_vertices = 1) out;\n" layout (points, max_vertices = 1) out;
"out vec4 color[];\n" out vec4 color[];
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -1540,15 +1521,15 @@ TEST_F(GeometryShaderTest, OutputWithInterpolationQualifiers) ...@@ -1540,15 +1521,15 @@ TEST_F(GeometryShaderTest, OutputWithInterpolationQualifiers)
TEST_F(GeometryShaderTest, InvariantOutput) TEST_F(GeometryShaderTest, InvariantOutput)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"invariant out vec4 gs_output;\n" invariant out vec4 gs_output;
"void main()\n" void main()
"{\n" {
" gl_Position = gl_in[0].gl_Position;\n" gl_Position = gl_in[0].gl_Position;
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -1561,7 +1542,7 @@ TEST_F(GeometryShaderOutputCodeTest, ValidateGLInMembersInOutputShaderString) ...@@ -1561,7 +1542,7 @@ TEST_F(GeometryShaderOutputCodeTest, ValidateGLInMembersInOutputShaderString)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (lines) in; layout (lines) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1578,7 +1559,7 @@ TEST_F(GeometryShaderOutputCodeTest, ValidateGLInMembersInOutputShaderString) ...@@ -1578,7 +1559,7 @@ TEST_F(GeometryShaderOutputCodeTest, ValidateGLInMembersInOutputShaderString)
const std::string &shaderString2 = const std::string &shaderString2 =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
layout (points) in; layout (points) in;
layout (points, max_vertices = 2) out; layout (points, max_vertices = 2) out;
void main() void main()
...@@ -1590,57 +1571,3 @@ TEST_F(GeometryShaderOutputCodeTest, ValidateGLInMembersInOutputShaderString) ...@@ -1590,57 +1571,3 @@ TEST_F(GeometryShaderOutputCodeTest, ValidateGLInMembersInOutputShaderString)
compile(shaderString2); compile(shaderString2);
EXPECT_TRUE(foundInESSLCode("].gl_Position")); EXPECT_TRUE(foundInESSLCode("].gl_Position"));
} }
// Verify that Geometry Shaders are supported in GLSL ES version 310 with EXT_geometry_shader
// enabled.
TEST_F(GeometryShaderTest, Version310WithEXTExtension)
{
std::ostringstream stream;
const std::string &kEXTExtensionString = kExtensionStrings[1];
ASSERT_TRUE(kEXTExtensionString == "#extension GL_EXT_geometry_shader");
stream << kVersion << kEXTExtensionString << " : require\n" << kShaderBody;
if (!compile(stream.str()))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Verify that Geometry Shaders are supported in GLSL ES version 310 with mixed using
// "EXT_geometry_shader" and "OES_geometry_shader" extension strings.
TEST_F(GeometryShaderTest, MixedUseOESAndEXTExtension)
{
const std::array<std::string, 3> kExtensionBehaviors = {{"require", "disable", "warn"}};
ASSERT_TRUE(kExtensionStrings.size() == 2u);
for (const std::string &extensionBehavior1 : kExtensionBehaviors)
{
for (const std::string &extensionBehavior2 : kExtensionBehaviors)
{
for (size_t i = 0; i < 2u; ++i)
{
std::ostringstream stream;
stream << kVersion << kExtensionStrings[i] << " : " << extensionBehavior1 << "\n"
<< kExtensionStrings[1 - i] << " : " << extensionBehavior2 << "\n"
<< kShaderBody;
bool shouldCompile =
extensionBehavior1 != "disable" || extensionBehavior2 != "disable";
if (shouldCompile != compile(stream.str()))
{
if (shouldCompile)
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
else
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
}
}
}
}
\ No newline at end of file
...@@ -101,21 +101,21 @@ class GeometryShaderValidationTest : public ShaderCompileTreeTest ...@@ -101,21 +101,21 @@ class GeometryShaderValidationTest : public ShaderCompileTreeTest
protected: protected:
void initResources(ShBuiltInResources *resources) override void initResources(ShBuiltInResources *resources) override
{ {
resources->OES_geometry_shader = 1; resources->EXT_geometry_shader = 1;
} }
::GLenum getShaderType() const override { return GL_GEOMETRY_SHADER_OES; } ::GLenum getShaderType() const override { return GL_GEOMETRY_SHADER_EXT; }
ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; } ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; }
}; };
class FragmentShaderOESGeometryShaderValidationTest : public FragmentShaderValidationTest class FragmentShaderEXTGeometryShaderValidationTest : public FragmentShaderValidationTest
{ {
public: public:
FragmentShaderOESGeometryShaderValidationTest() {} FragmentShaderEXTGeometryShaderValidationTest() {}
protected: protected:
void initResources(ShBuiltInResources *resources) override void initResources(ShBuiltInResources *resources) override
{ {
resources->OES_geometry_shader = 1; resources->EXT_geometry_shader = 1;
} }
}; };
...@@ -2274,42 +2274,42 @@ TEST_F(FragmentShaderValidationTest, InvalidUseOfLocalSizeX) ...@@ -2274,42 +2274,42 @@ TEST_F(FragmentShaderValidationTest, InvalidUseOfLocalSizeX)
TEST_F(GeometryShaderValidationTest, InvalidUseOfLocalSizeX) TEST_F(GeometryShaderValidationTest, InvalidUseOfLocalSizeX)
{ {
const std::string &shaderString1 = const std::string &shaderString1 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points, local_size_x = 15) in;\n" layout (points, local_size_x = 15) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString2 = const std::string &shaderString2 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (invocations = 2, local_size_x = 15) in;\n" layout (invocations = 2, local_size_x = 15) in;
"layout (points, max_vertices = 2) out;\n" layout (points, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString3 = const std::string &shaderString3 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points, local_size_x = 15, max_vertices = 2) out;\n" layout (points, local_size_x = 15, max_vertices = 2) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
const std::string &shaderString4 = const std::string &shaderString4 =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"layout (points) in;\n" layout (points) in;
"layout (points) out;\n" layout (points) out;
"layout (max_vertices = 2, local_size_x = 15) out;\n" layout (max_vertices = 2, local_size_x = 15) out;
"void main()\n" void main()
"{\n" {
"}\n"; })";
if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) || if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) ||
compile(shaderString4)) compile(shaderString4))
{ {
...@@ -4438,20 +4438,20 @@ TEST_F(VertexShaderValidationTest, ViewportIndexInESSL310) ...@@ -4438,20 +4438,20 @@ TEST_F(VertexShaderValidationTest, ViewportIndexInESSL310)
} }
} }
// Test that gl_PrimitiveID is valid in fragment shader with 'GL_OES_geometry_shader' declared. // Test that gl_PrimitiveID is valid in fragment shader with 'GL_EXT_geometry_shader' declared.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, PrimitiveIDWithExtension) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, PrimitiveIDWithExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"precision mediump float;\n" precision mediump float;
"layout(location = 0) out mediump vec4 fragColor;\n" layout(location = 0) out mediump vec4 fragColor;
"void main(void)\n" void main(void)
"{\n" {
" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);\n" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);
" float value = data[gl_PrimitiveID % 4];\n" float value = data[gl_PrimitiveID % 4];
" fragColor = vec4(value, 0, 0, 1);\n" fragColor = vec4(value, 0, 0, 1);
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -4459,19 +4459,19 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, PrimitiveIDWithExtension) ...@@ -4459,19 +4459,19 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, PrimitiveIDWithExtension)
} }
} }
// Test that gl_PrimitiveID is invalid in fragment shader without 'GL_OES_geometry_shader' declared. // Test that gl_PrimitiveID is invalid in fragment shader without 'GL_EXT_geometry_shader' declared.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, PrimitiveIDWithoutExtension) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, PrimitiveIDWithoutExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"precision mediump float;\n" precision mediump float;
"layout(location = 0) out mediump vec4 fragColor;\n" layout(location = 0) out mediump vec4 fragColor;
"void main(void)\n" void main(void)
"{\n" {
" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);\n" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);
" float value = data[gl_PrimitiveID % 4];\n" float value = data[gl_PrimitiveID % 4];
" fragColor = vec4(value, 0, 0, 1);\n" fragColor = vec4(value, 0, 0, 1);
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -4480,18 +4480,18 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, PrimitiveIDWithoutExtensio ...@@ -4480,18 +4480,18 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, PrimitiveIDWithoutExtensio
} }
// Test that gl_PrimitiveID cannot be l-value in fragment shader. // Test that gl_PrimitiveID cannot be l-value in fragment shader.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, AssignValueToPrimitiveID) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, AssignValueToPrimitiveID)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"precision mediump float;\n" precision mediump float;
"layout(location = 0) out mediump vec4 fragColor;\n" layout(location = 0) out mediump vec4 fragColor;
"void main(void)\n" void main(void)
"{\n" {
" gl_PrimitiveID = 1;\n" gl_PrimitiveID = 1;
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n" fragColor = vec4(1.0, 0.0, 0.0, 1.0);
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -4499,20 +4499,20 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, AssignValueToPrimitiveID) ...@@ -4499,20 +4499,20 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, AssignValueToPrimitiveID)
} }
} }
// Test that gl_Layer is valid in fragment shader with 'GL_OES_geometry_shader' declared. // Test that gl_Layer is valid in fragment shader with 'GL_EXT_geometry_shader' declared.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, LayerWithExtension) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, LayerWithExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"precision mediump float;\n" precision mediump float;
"layout(location = 0) out mediump vec4 fragColor;\n" layout(location = 0) out mediump vec4 fragColor;
"void main(void)\n" void main(void)
"{\n" {
" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);\n" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);
" float value = data[gl_Layer % 4];\n" float value = data[gl_Layer % 4];
" fragColor = vec4(value, 0, 0, 1);\n" fragColor = vec4(value, 0, 0, 1);
"}\n"; })";
if (!compile(shaderString)) if (!compile(shaderString))
{ {
...@@ -4520,19 +4520,19 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, LayerWithExtension) ...@@ -4520,19 +4520,19 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, LayerWithExtension)
} }
} }
// Test that gl_Layer is invalid in fragment shader without 'GL_OES_geometry_shader' declared. // Test that gl_Layer is invalid in fragment shader without 'GL_EXT_geometry_shader' declared.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, LayerWithoutExtension) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, LayerWithoutExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"precision mediump float;\n" precision mediump float;
"layout(location = 0) out mediump vec4 fragColor;\n" layout(location = 0) out mediump vec4 fragColor;
"void main(void)\n" void main(void)
"{\n" {
" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);\n" vec4 data = vec4(0.1, 0.2, 0.3, 0.4);
" float value = data[gl_Layer % 4];\n" float value = data[gl_Layer % 4];
" fragColor = vec4(value, 0, 0, 1);\n" fragColor = vec4(value, 0, 0, 1);
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -4541,18 +4541,18 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, LayerWithoutExtension) ...@@ -4541,18 +4541,18 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, LayerWithoutExtension)
} }
// Test that gl_Layer cannot be l-value in fragment shader. // Test that gl_Layer cannot be l-value in fragment shader.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, AssignValueToLayer) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, AssignValueToLayer)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"#extension GL_OES_geometry_shader : require\n" #extension GL_EXT_geometry_shader : require
"precision mediump float;\n" precision mediump float;
"layout(location = 0) out mediump vec4 fragColor;\n" layout(location = 0) out mediump vec4 fragColor;
"void main(void)\n" void main(void)
"{\n" {
" gl_Layer = 1;\n" gl_Layer = 1;
" fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n" fragColor = vec4(1.0, 0.0, 0.0, 1.0);
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -4560,13 +4560,13 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, AssignValueToLayer) ...@@ -4560,13 +4560,13 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, AssignValueToLayer)
} }
} }
// Test that all built-in constants defined in GL_OES_geometry_shader can be used in fragment shader // Test that all built-in constants defined in GL_EXT_geometry_shader can be used in fragment shader
// with 'GL_OES_geometry_shader' declared. // with 'GL_EXT_geometry_shader' declared.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, GeometryShaderBuiltInConstants) TEST_F(FragmentShaderEXTGeometryShaderValidationTest, GeometryShaderBuiltInConstants)
{ {
const std::string &kShaderHeader = const std::string &kShaderHeader =
R"(#version 310 es R"(#version 310 es
#extension GL_OES_geometry_shader : require #extension GL_EXT_geometry_shader : require
precision mediump float; precision mediump float;
layout(location = 0) out mediump vec4 fragColor; layout(location = 0) out mediump vec4 fragColor;
void main(void) void main(void)
...@@ -4597,9 +4597,9 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, GeometryShaderBuiltInConst ...@@ -4597,9 +4597,9 @@ TEST_F(FragmentShaderOESGeometryShaderValidationTest, GeometryShaderBuiltInConst
} }
} }
// Test that any built-in constants defined in GL_OES_geometry_shader cannot be used in fragment // Test that any built-in constants defined in GL_EXT_geometry_shader cannot be used in fragment
// shader without 'GL_OES_geometry_shader' declared. // shader without 'GL_EXT_geometry_shader' declared.
TEST_F(FragmentShaderOESGeometryShaderValidationTest, TEST_F(FragmentShaderEXTGeometryShaderValidationTest,
GeometryShaderBuiltInConstantsWithoutExtension) GeometryShaderBuiltInConstantsWithoutExtension)
{ {
const std::string &kShaderHeader = const std::string &kShaderHeader =
...@@ -4655,20 +4655,20 @@ TEST_F(VertexShaderValidationTest, InterfaceBlockUsingConstQualifier) ...@@ -4655,20 +4655,20 @@ TEST_F(VertexShaderValidationTest, InterfaceBlockUsingConstQualifier)
} }
} }
// Test that using shader io blocks without declaration of GL_OES_shader_io_block is not allowed. // Test that using shader io blocks without declaration of GL_EXT_shader_io_block is not allowed.
TEST_F(VertexShaderValidationTest, IOBlockWithoutExtension) TEST_F(VertexShaderValidationTest, IOBlockWithoutExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"out block\n" out block
"{\n" {
" vec2 value;\n" vec2 value;
"} VSOutput[2];\n" } VSOutput[2];
"void main()\n" void main()
"{\n" {
" int i = 0;\n" int i = 0;
" vec2 value1 = VSOutput[i].value;\n" vec2 value1 = VSOutput[i].value;
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
...@@ -4676,22 +4676,22 @@ TEST_F(VertexShaderValidationTest, IOBlockWithoutExtension) ...@@ -4676,22 +4676,22 @@ TEST_F(VertexShaderValidationTest, IOBlockWithoutExtension)
} }
} }
// Test that using shader io blocks without declaration of GL_OES_shader_io_block is not allowed. // Test that using shader io blocks without declaration of GL_EXT_shader_io_block is not allowed.
TEST_F(FragmentShaderValidationTest, IOBlockWithoutExtension) TEST_F(FragmentShaderValidationTest, IOBlockWithoutExtension)
{ {
const std::string &shaderString = const std::string &shaderString =
"#version 310 es\n" R"(#version 310 es
"precision mediump float;\n" precision mediump float;
"in block\n" in block
"{\n" {
" vec4 i_color;\n" vec4 i_color;
"} FSInput[2];\n" } FSInput[2];
"out vec4 o_color;\n" out vec4 o_color;
"void main()\n" void main()
"{\n" {
" int i = 0;\n" int i = 0;
" o_color = FSInput[i].i_color;" o_color = FSInput[i].i_color;
"}\n"; })";
if (compile(shaderString)) if (compile(shaderString))
{ {
......
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