GL: fix clear-on-init of depth/stencil textures. Disable the scissor test during clear. Change-Id: Ia6945304c257867ed5cb6a6ae0c2c49998a33ca7 Bug: dawn:1340 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85143 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/dawn/native/opengl/TextureGL.cpp b/src/dawn/native/opengl/TextureGL.cpp index 3687848..1189007 100644 --- a/src/dawn/native/opengl/TextureGL.cpp +++ b/src/dawn/native/opengl/TextureGL.cpp
@@ -258,6 +258,7 @@ GLuint framebuffer = 0; gl.GenFramebuffers(1, &framebuffer); gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer); + gl.Disable(GL_SCISSOR_TEST); GLenum attachment; if (range.aspects == (Aspect::Depth | Aspect::Stencil)) { @@ -328,6 +329,7 @@ } } + gl.Enable(GL_SCISSOR_TEST); gl.DeleteFramebuffers(1, &framebuffer); } else { ASSERT(range.aspects == Aspect::Color);
diff --git a/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp b/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp index 5d8878c..5327406 100644 --- a/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp +++ b/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp
@@ -106,25 +106,17 @@ GetParam().mMipCount > 1 && HasToggleEnabled("disable_r8_rg8_mipmaps")); - // Copies from depth textures not fully supported on the OpenGL backend right now. - DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth32Float && - (IsOpenGL() || IsOpenGLES())); - - // Copies from stencil textures not fully supported on the OpenGL backend right now. + // TODO(crbug.com/dawn/667): Work around the fact that some platforms do not support + // reading from depth/stencil. DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 && GetParam().mAspect == wgpu::TextureAspect::StencilOnly && - (IsOpenGL() || IsOpenGLES())); + HasToggleEnabled("disable_depth_stencil_read")); // TODO(crbug.com/dawn/593): Test depends on glTextureView which is unsupported on GLES. DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 && GetParam().mAspect == wgpu::TextureAspect::DepthOnly && IsOpenGLES()); - // Sampled depth only populates the first texel when running on OpenGL Mesa. - DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 && - GetParam().mAspect == wgpu::TextureAspect::DepthOnly && - IsOpenGL() && IsLinux()); - // GL may support the feature, but reading data back is not implemented. DAWN_TEST_UNSUPPORTED_IF(GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm && (IsOpenGL() || IsOpenGLES()));