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>
This commit is contained in:
Stephen White 2022-03-30 10:26:44 +00:00 committed by Dawn LUCI CQ
parent cd2a3ffcc0
commit 9be06c8d23
2 changed files with 5 additions and 11 deletions

View File

@ -258,6 +258,7 @@ namespace dawn::native::opengl {
GLuint framebuffer = 0; GLuint framebuffer = 0;
gl.GenFramebuffers(1, &framebuffer); gl.GenFramebuffers(1, &framebuffer);
gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer); gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);
gl.Disable(GL_SCISSOR_TEST);
GLenum attachment; GLenum attachment;
if (range.aspects == (Aspect::Depth | Aspect::Stencil)) { if (range.aspects == (Aspect::Depth | Aspect::Stencil)) {
@ -328,6 +329,7 @@ namespace dawn::native::opengl {
} }
} }
gl.Enable(GL_SCISSOR_TEST);
gl.DeleteFramebuffers(1, &framebuffer); gl.DeleteFramebuffers(1, &framebuffer);
} else { } else {
ASSERT(range.aspects == Aspect::Color); ASSERT(range.aspects == Aspect::Color);

View File

@ -106,25 +106,17 @@ namespace {
GetParam().mMipCount > 1 && GetParam().mMipCount > 1 &&
HasToggleEnabled("disable_r8_rg8_mipmaps")); HasToggleEnabled("disable_r8_rg8_mipmaps"));
// Copies from depth 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
DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth32Float && // reading from depth/stencil.
(IsOpenGL() || IsOpenGLES()));
// Copies from stencil textures not fully supported on the OpenGL backend right now.
DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 && DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 &&
GetParam().mAspect == wgpu::TextureAspect::StencilOnly && 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. // TODO(crbug.com/dawn/593): Test depends on glTextureView which is unsupported on GLES.
DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 && DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 &&
GetParam().mAspect == wgpu::TextureAspect::DepthOnly && GetParam().mAspect == wgpu::TextureAspect::DepthOnly &&
IsOpenGLES()); 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. // GL may support the feature, but reading data back is not implemented.
DAWN_TEST_UNSUPPORTED_IF(GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm && DAWN_TEST_UNSUPPORTED_IF(GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm &&
(IsOpenGL() || IsOpenGLES())); (IsOpenGL() || IsOpenGLES()));