Commit e4eb75da by Shahbaz Youssefi Committed by Commit Bot

Vulkan: EXT_gpu_shader5 support: dynamically uniform indexing

Bug: angleproject:3569 Change-Id: I5abb7f2889fa5173457497d4156a3dadbcf77640 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1954613 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent fa467885
...@@ -952,11 +952,11 @@ bool CollectVariablesTraverser::visitBinary(Visit, TIntermBinary *binaryNode) ...@@ -952,11 +952,11 @@ bool CollectVariablesTraverser::visitBinary(Visit, TIntermBinary *binaryNode)
{ {
namedBlock = recordGLInUsed(interfaceType); namedBlock = recordGLInUsed(interfaceType);
ASSERT(namedBlock); ASSERT(namedBlock);
// We need to continue traversing to collect useful variables in the index
// expression of gl_in.
traverseIndexExpression = true;
} }
// We need to continue traversing to collect useful variables in the index expression
// of the interface block array or gl_in in the case of the if above.
traverseIndexExpression = true;
} }
const TInterfaceBlock *interfaceBlock = blockNode->getType().getInterfaceBlock(); const TInterfaceBlock *interfaceBlock = blockNode->getType().getInterfaceBlock();
......
...@@ -3994,6 +3994,11 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, ...@@ -3994,6 +3994,11 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
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
// of opaque types (samplers and atomic counters) as well as UBOs, but not SSBOs and images.
bool allowUniformIndices =
mShaderVersion >= 320 || isExtensionEnabled(TExtension::EXT_gpu_shader5);
// ANGLE should be able to fold any constant expressions resulting in an integer - but to be // ANGLE should be able to fold any constant expressions resulting in an integer - but to be
// safe we don't treat "EvqConst" that's evaluated according to the spec as being sufficient // safe we don't treat "EvqConst" that's evaluated according to the spec as being sufficient
// for constness. Some interpretations of the spec have allowed constant expressions with side // for constness. Some interpretations of the spec have allowed constant expressions with side
...@@ -4008,10 +4013,18 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, ...@@ -4008,10 +4013,18 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
case EvqPerVertexIn: case EvqPerVertexIn:
break; break;
case EvqUniform: case EvqUniform:
if (!allowUniformIndices)
{
error(location,
"array indexes for uniform block arrays must be constant integral "
"expressions",
"[");
}
break;
case EvqBuffer: case EvqBuffer:
error(location, error(location,
"array indexes for uniform block arrays and shader storage block arrays " "array indexes for shader storage block arrays must be constant integral "
"must be constant integral expressions", "expressions",
"["); "[");
break; break;
default: default:
...@@ -4040,13 +4053,15 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, ...@@ -4040,13 +4053,15 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
case 310: case 310:
elementType = baseExpression->getType(); elementType = baseExpression->getType();
elementType.toArrayElementType(); elementType.toArrayElementType();
if (elementType.isSampler()) if (elementType.isSampler() && !allowUniformIndices)
{ {
error(location, error(location,
"array index for samplers must be constant integral expressions", "array index for samplers must be constant integral expressions",
"["); "[");
} }
break; break;
case 320:
break;
default: default:
UNREACHABLE(); UNREACHABLE();
break; break;
......
...@@ -701,15 +701,9 @@ ...@@ -701,15 +701,9 @@
4105 SWIFTSHADER : dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_cube = FAIL 4105 SWIFTSHADER : dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_cube = FAIL
4105 SWIFTSHADER : dEQP-GLES31.functional.stencil_texturing.format.depth32f_stencil8_cube = FAIL 4105 SWIFTSHADER : dEQP-GLES31.functional.stencil_texturing.format.depth32f_stencil8_cube = FAIL
// OpenGL ES 3.2 / 3.2 extensions // OpenGL ES 3.2 / 3.1 extensions
// EXT_gpu_shader5: Note: this extension is not yet fully implemented, so should be disabled in the // EXT_gpu_shader5: Note: this extension is not yet fully implemented, so should be disabled in the
// Vulkan backend for the ES 3.1 conformance run. // Vulkan backend for the ES 3.1 conformance run.
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*vertex* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*fragment* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*uniform.*compute* = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.*uniform_vertex = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.*uniform_fragment = FAIL
3569 VULKAN : dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.*uniform_compute = FAIL
3569 VULKAN : dEQP-GLES31.functional.texture.gather.offset_dynamic.* = FAIL 3569 VULKAN : dEQP-GLES31.functional.texture.gather.offset_dynamic.* = FAIL
3569 VULKAN : dEQP-GLES31.functional.texture.gather.offsets.* = FAIL 3569 VULKAN : dEQP-GLES31.functional.texture.gather.offsets.* = FAIL
...@@ -146,8 +146,4 @@ ...@@ -146,8 +146,4 @@
4108 SWIFTSHADER : KHR-GLES31.core.shader_image_size.*-nonMS-* = SKIP 4108 SWIFTSHADER : KHR-GLES31.core.shader_image_size.*-nonMS-* = SKIP
// OpenGL ES 3.2 / 3.2 extensions // OpenGL ES 3.2 / 3.1 extensions
// EXT_gpu_shader5: Note: this extension is not yet fully implemented, so should be disabled in the
// Vulkan backend for the ES 3.1 conformance run.
3569 VULKAN : KHR-GLES31.core.arrays_of_arrays.ExpressionsDynamicIndexing2 = 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