Commit 3797fc85 by Ian Elliott Committed by Commit Bot

Generate new compiler errors for array-of-arrays

The GLES GLSL 3.1 spec states that it is an error to use array-of-arrays in the following cases: - Vertex shader outputs - Fragment shader inputs - Fragment shader outputs ANGLE currently generates errors in the case of vertex shader inputs. It needs to add the above cases. Reproduce by running "angle_deqp_khr_gles31_tests" with: --gtest_filter=dEQP.KHR_GLES31/core_arrays_of_arrays_InteractionInterfaceArrays2* --use-angle=swiftshader Bug: angleproject:4148 Change-Id: I1147fc7d4755e5b6c07d2ab5d14566d919dec530 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2087647Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent e8883562
......@@ -1067,6 +1067,35 @@ bool TParseContext::checkArrayElementIsNotArray(const TSourceLoc &line,
return true;
}
// Check for array-of-arrays being used as non-allowed shader inputs/outputs.
bool TParseContext::checkArrayOfArraysInOut(const TSourceLoc &line,
const TPublicType &elementType,
const TType &arrayType)
{
if (arrayType.isArrayOfArrays())
{
if (elementType.qualifier == EvqVertexOut)
{
error(line, "vertex shader output cannot be an array of arrays",
TType(elementType).getQualifierString());
return false;
}
if (elementType.qualifier == EvqFragmentIn)
{
error(line, "fragment shader input cannot be an array of arrays",
TType(elementType).getQualifierString());
return false;
}
if (elementType.qualifier == EvqFragmentOut)
{
error(line, "fragment shader output cannot be an array of arrays",
TType(elementType).getQualifierString());
return false;
}
}
return true;
}
// Check if this qualified element type can be formed into an array. This is only called when array
// brackets are associated with an identifier in a declaration, like this:
// float a[2];
......@@ -2575,6 +2604,8 @@ TIntermDeclaration *TParseContext::parseSingleArrayDeclaration(
TType *arrayType = new TType(elementType);
arrayType->makeArrays(arraySizes);
checkArrayOfArraysInOut(indexLocation, elementType, *arrayType);
checkGeometryShaderInputAndSetArraySize(indexLocation, identifier, arrayType);
checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, arrayType);
......
......@@ -136,6 +136,9 @@ class TParseContext : angle::NonCopyable
unsigned int checkIsValidArraySize(const TSourceLoc &line, TIntermTyped *expr);
bool checkIsValidQualifierForArray(const TSourceLoc &line, const TPublicType &elementQualifier);
bool checkArrayElementIsNotArray(const TSourceLoc &line, const TPublicType &elementType);
bool checkArrayOfArraysInOut(const TSourceLoc &line,
const TPublicType &elementType,
const TType &arrayType);
bool checkIsNonVoid(const TSourceLoc &line,
const ImmutableString &identifier,
const TBasicType &type);
......
......@@ -96,9 +96,6 @@
4194 VULKAN PIXEL2ORXL : KHR-GLES31.core.compute_shader.resource-ubo = FAIL
4194 VULKAN PIXEL2ORXL : KHR-GLES31.core.compute_shader.built-in-variables = FAIL
// Arrays-of-arrays as vertex inputs:
4148 : KHR-GLES31.core.arrays_of_arrays.InteractionInterfaceArrays2 = FAIL
////
//// Desktop Vulkan expectations
......
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