Fix 3D Storage Buffer support on GLES backend
The issue was `isLayered`, passed to glBindImageTexture, needs
to be true. true = see the entire "layer" which for a 3d texture
means the entire 3d cube of the current mip level where as
false = see just single 2d slice. I think just swapping the
order if the ifs here so that if the view's layerCount == the
texture's arrayLayers then use true, else use false will fix
the issue.
Bug: dawn:2372
Change-Id: I71138bb40aa75f2e9ad3f46403b1d79258a89ba9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/173841
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Gregg Tavares <gman@chromium.org>
diff --git a/src/dawn/native/opengl/CommandBufferGL.cpp b/src/dawn/native/opengl/CommandBufferGL.cpp
index 98c9bc6..5797278b 100644
--- a/src/dawn/native/opengl/CommandBufferGL.cpp
+++ b/src/dawn/native/opengl/CommandBufferGL.cpp
@@ -387,10 +387,10 @@
// OpenGL ES only supports either binding a layer or the entire
// texture in glBindImageTexture().
GLboolean isLayered;
- if (view->GetLayerCount() == 1) {
- isLayered = GL_FALSE;
- } else if (texture->GetArrayLayers() == view->GetLayerCount()) {
+ if (texture->GetArrayLayers() == view->GetLayerCount()) {
isLayered = GL_TRUE;
+ } else if (view->GetLayerCount() == 1) {
+ isLayered = GL_FALSE;
} else {
DAWN_UNREACHABLE();
}