Skip testing of stencil textures where non-readable.

Readback of stencil is not supported on vanilla ES, so we introduce a toggle to disable it. NVidia GLES drivers support NV_stencil_read and NV_depth_stencil_read extensions, so we use those where available.

It turns out ANGLE supports NV_stencil_read but not NV_depth_stencil_read (for reading from the packed depth/stencil buffers which Dawn uses), so that's the extension we check for.

Bug: dawn:667 dawn:634
Change-Id: I136674d3d47fecee2b8b390d5d219bab07e3bb64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41141
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 2021-02-10 02:10:08 +00:00 committed by Commit Bot service account
parent b6b0090b50
commit 39b478df0c
4 changed files with 26 additions and 14 deletions

View File

@ -129,6 +129,11 @@ namespace dawn_native {
{"disable_snorm_read",
"Disables reading from Snorm textures which is unsupported on some platforms.",
"https://crbug.com/dawn/667"}},
{Toggle::DisableDepthStencilRead,
{"disable_depth_stencil_read",
"Disables reading from depth/stencil textures which is unsupported on some "
"platforms.",
"https://crbug.com/dawn/667"}},
{Toggle::UseD3D12SmallShaderVisibleHeapForTesting,
{"use_d3d12_small_shader_visible_heap",
"Enable use of a small D3D12 shader visible heap, instead of using a large one by "

View File

@ -41,6 +41,7 @@ namespace dawn_native {
DisableBaseInstance,
DisableIndexedDrawBuffers,
DisableSnormRead,
DisableDepthStencilRead,
UseD3D12SmallShaderVisibleHeapForTesting,
UseDXC,
DisableRobustness,

View File

@ -71,6 +71,9 @@ namespace dawn_native { namespace opengl {
bool supportsSnormRead =
gl.IsAtLeastGL(4, 4) || gl.IsGLExtensionSupported("GL_EXT_render_snorm");
bool supportsDepthStencilRead =
gl.IsAtLeastGL(3, 0) || gl.IsGLExtensionSupported("GL_NV_read_depth_stencil");
// TODO(crbug.com/dawn/343): We can support the extension variants, but need to load the EXT
// procs without the extension suffix.
// We'll also need emulation of shader builtins gl_BaseVertex and gl_BaseInstance.
@ -90,6 +93,7 @@ namespace dawn_native { namespace opengl {
SetToggle(Toggle::DisableBaseInstance, !supportsBaseInstance);
SetToggle(Toggle::DisableIndexedDrawBuffers, !supportsIndexedDrawBuffers);
SetToggle(Toggle::DisableSnormRead, !supportsSnormRead);
SetToggle(Toggle::DisableDepthStencilRead, !supportsDepthStencilRead);
SetToggle(Toggle::FlushBeforeClientWaitSync, gl.GetVersion().IsES());
}

View File

@ -330,8 +330,9 @@ TEST_P(DepthStencilCopyTests, FromDepthAspect) {
// Test copying the stencil-only aspect into a buffer.
TEST_P(DepthStencilCopyTests, FromStencilAspect) {
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around the fact that some platforms are unable to read
// stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;
@ -358,8 +359,8 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipStencilAspect) {
// It passes on AMD Radeon Pro and Intel HD Graphics 630.
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around some platforms' inability to read back stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
wgpu::Texture depthStencilTexture = CreateDepthStencilTexture(
9, 9, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 2);
@ -403,8 +404,8 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
// T2TBothAspectsThenCopyNonRenderableStencil does not use RenderAttachment and works correctly.
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around some platforms' inability to read back stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;
@ -427,8 +428,8 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
// Test that part of a non-renderable stencil aspect can be copied. Notably,
// this test has different behavior on some platforms than T2TBothAspectsThenCopyStencil.
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableStencil) {
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around some platforms' inability to read back stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;
@ -456,8 +457,8 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableNonZeroMipStenc
// T2TBothAspectsThenCopyNonRenderableStencil works correctly.
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around some platforms' inability to read back stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, 9, 9, wgpu::TextureUsage::CopySrc, 1);
@ -508,8 +509,8 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonZeroMipDepth) {
// Test copying both aspects in a T2T copy, then copying stencil, then copying depth
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencilThenDepth) {
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around some platforms' inability to read back stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;
@ -547,8 +548,9 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepthThenStencil) {
// T2TBothAspectsThenCopyStencilThenDepth which checks stencil first also passes.
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
// TODO(crbug.com/dawn/634): Diagnose and fix ANGLE failure.
DAWN_SKIP_TEST_IF(IsANGLE());
// TODO(crbug.com/dawn/667): Work around the fact that some platforms are unable to read
// stencil.
DAWN_SKIP_TEST_IF(HasToggleEnabled("disable_depth_stencil_read"));
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;