ES31: Fixed the SSBO instance array error
In ESSL 3.10 spec, there are below descriptions:
1. Any uniform or shader storage block declared without a binding qualifier
is initially assigned to block binding point zero.
2. If the binding qualifier is used with a uniform block or shader storage
block instanced as an array, the first element of the array takes the
specified block binding and each subsequent element takes the next
consecutive binding point.
So explicitly specifying the binding to zero is different with not declaring
a binding qualifier for a block instance array.
For example:
1) layout(shared, binding = 0) buffer blockName {
uint data;
} instanceName[3];
2) layout(shared) buffer blockName {
uint data;
} instanceName[3];
In 1), the binding point of each element instance is 0, 1, 2.
In 2), the binding point of each element instance is 0, 0, 0.
BUG=angleproject:1951
TEST=dEQP-GLES31.functional.ssbo.layout.*
Change-Id: If770d6e1fd8e13d2cdc762bab289772076258e4c
Reviewed-on: https://chromium-review.googlesource.com/816340
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 9f0fb68..8746ff9 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -1221,7 +1221,7 @@
break;
}
- if (interfaceBlock->blockBinding() > 0)
+ if (interfaceBlock->blockBinding() >= 0)
{
out << ", ";
out << "binding = " << interfaceBlock->blockBinding();