Commit 570970f9 by Mohan Maiya Committed by Commit Bot

Vulkan: Handle compilation error involving gl_InvocationID

We need to generate a compiler error only when the vertex index of an output variable as an l-value, in a tessellation control shader, is not the indentifier gl_InvocationID. Bug: angleproject:5557 Tests: dEQP-GLES31.functional.tessellation.shader_input_output.barrier Change-Id: Ica075b8d85916caa228f057b203ae81b27f65e2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2758915Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 81432c24
...@@ -1986,6 +1986,21 @@ void TParseContext::checkNoncoherentIsNotSpecified(const TSourceLoc &location, b ...@@ -1986,6 +1986,21 @@ void TParseContext::checkNoncoherentIsNotSpecified(const TSourceLoc &location, b
} }
} }
void TParseContext::checkTCSOutVarIndexIsValid(TIntermBinary *binaryExpression,
const TSourceLoc &location)
{
ASSERT(binaryExpression->getOp() == EOpIndexIndirect ||
binaryExpression->getOp() == EOpIndexDirect);
const TIntermSymbol *intermSymbol = binaryExpression->getRight()->getAsSymbolNode();
if ((intermSymbol == nullptr) || (intermSymbol->getName() != "gl_InvocationID"))
{
error(location,
"tessellation-control per-vertex output l-value must be indexed with "
"gl_InvocationID",
"[");
}
}
void TParseContext::functionCallRValueLValueErrorCheck(const TFunction *fnCandidate, void TParseContext::functionCallRValueLValueErrorCheck(const TFunction *fnCandidate,
TIntermAggregate *fnCall) TIntermAggregate *fnCall)
{ {
...@@ -4601,20 +4616,6 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, ...@@ -4601,20 +4616,6 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
} }
} }
if (mShaderType == GL_TESS_CONTROL_SHADER &&
IsTessellationControlShaderOutput(mShaderType, baseExpression->getQualifier()))
{
const TIntermSymbol *intermSymbol = indexExpression->getAsSymbolNode();
if (!intermSymbol || intermSymbol->getName() != "gl_InvocationID")
{
error(location,
"tessellation-control per-vertex output l-value must be indexed with "
"gl_InvocationID",
"[");
return CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst));
}
}
TIntermConstantUnion *indexConstantUnion = indexExpression->getAsConstantUnion(); TIntermConstantUnion *indexConstantUnion = indexExpression->getAsConstantUnion();
// ES3.2 or ES3.1's EXT_gpu_shader5 allow dynamically uniform expressions to be used as indices // ES3.2 or ES3.1's EXT_gpu_shader5 allow dynamically uniform expressions to be used as indices
...@@ -6259,6 +6260,14 @@ TIntermTyped *TParseContext::addAssign(TOperator op, ...@@ -6259,6 +6260,14 @@ TIntermTyped *TParseContext::addAssign(TOperator op,
TIntermBinary *node = nullptr; TIntermBinary *node = nullptr;
if (binaryOpCommonCheck(op, left, right, loc)) if (binaryOpCommonCheck(op, left, right, loc))
{ {
TIntermBinary *lValue = left->getAsBinaryNode();
if ((lValue != nullptr) &&
(lValue->getOp() == EOpIndexIndirect || lValue->getOp() == EOpIndexDirect) &&
IsTessellationControlShaderOutput(mShaderType, lValue->getLeft()->getQualifier()))
{
checkTCSOutVarIndexIsValid(lValue, loc);
}
if (op == EOpMulAssign) if (op == EOpMulAssign)
{ {
op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType()); op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType());
......
...@@ -191,6 +191,7 @@ class TParseContext : angle::NonCopyable ...@@ -191,6 +191,7 @@ class TParseContext : angle::NonCopyable
const TPublicType &type, const TPublicType &type,
const TSourceLoc &qualifierLocation); const TSourceLoc &qualifierLocation);
void checkLocalVariableConstStorageQualifier(const TQualifierWrapperBase &qualifier); void checkLocalVariableConstStorageQualifier(const TQualifierWrapperBase &qualifier);
void checkTCSOutVarIndexIsValid(TIntermBinary *binaryExpression, const TSourceLoc &location);
const TPragma &pragma() const { return mDirectiveHandler.pragma(); } const TPragma &pragma() const { return mDirectiveHandler.pragma(); }
const TExtensionBehavior &extensionBehavior() const const TExtensionBehavior &extensionBehavior() const
{ {
......
...@@ -186,7 +186,6 @@ ...@@ -186,7 +186,6 @@
5452 VULKAN : dEQP-GLES31.functional.geometry_shading.layered.layer_provoking_vertex_* = FAIL 5452 VULKAN : dEQP-GLES31.functional.geometry_shading.layered.layer_provoking_vertex_* = FAIL
// Tessellation shader support: // Tessellation shader support:
5557 VULKAN : dEQP-GLES31.functional.tessellation.shader_input_output.barrier = FAIL
5557 VULKAN : dEQP-GLES31.functional.tessellation.shader_input_output.gl_position_tcs_to_tes = FAIL 5557 VULKAN : dEQP-GLES31.functional.tessellation.shader_input_output.gl_position_tcs_to_tes = FAIL
//// ////
......
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