Skip to content

Commit

Permalink
D3D11: Enable compat mode in end2end tests
Browse files Browse the repository at this point in the history
Bug: 345280232
Change-Id: I5ada513ef3587ed168ad55e9ea8b3b4c6ee9493f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219215
Reviewed-by: Loko Kung <[email protected]>
Auto-Submit: Quyen Le <[email protected]>
Commit-Queue: Quyen Le <[email protected]>
Reviewed-by: Kai Ninomiya <[email protected]>
  • Loading branch information
kakashidinho authored and Dawn LUCI CQ committed Dec 14, 2024
1 parent 028acef commit ad54e95
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dawn/native/d3d11/TextureD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ ResultOrError<ComPtr<ID3D11ShaderResourceView>> Texture::GetStencilSRV(
return {};
};

// TODO(dawn:1705): Work out a way of GPU-GPU copy, rather than the CPU-GPU round trip.
// TODO(383779503): Work out a way of GPU-GPU copy, rather than the CPU-GPU round trip.
GetDevice()->EmitWarningOnce("Sampling the stencil component is rather slow now.");
DAWN_TRY(Read(commandContext, singleRange, {0, 0, 0}, size, bytesPerRow, rowsPerImage,
callback));
Expand Down
7 changes: 3 additions & 4 deletions src/dawn/tests/DawnTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,10 @@ void DawnTestEnvironment::SelectPreferredAdapterProperties(const native::Instanc
wgpu::AdapterInfo info;
adapter.GetInfo(&info);

// Skip non-OpenGLES compat adapters. Metal/Vulkan/D3D12 support
// Skip non-OpenGLES/D3D11 compat adapters. Metal/Vulkan/D3D12 support
// core WebGPU.
// D3D11 is in an experimental state where it may support core.
// See crbug.com/dawn/1820 for determining d3d11 capabilities.
if (info.compatibilityMode && info.backendType != wgpu::BackendType::OpenGLES) {
if (info.compatibilityMode && info.backendType != wgpu::BackendType::OpenGLES &&
info.backendType != wgpu::BackendType::D3D11) {
continue;
}

Expand Down
12 changes: 12 additions & 0 deletions src/dawn/tests/end2end/DepthBiasTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ TEST_P(DepthBiasTests, PositiveBiasOnFloatWithClamp) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGL());
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());

// Depth bias clamp is not supported in compat mode.
// https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#9-depth-bias-clamp-must-be-zero
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode());

// Draw quad flat on z = 0.25 with 0.25 bias clamped at 0.125.
RunDepthBiasTest(wgpu::TextureFormat::Depth32Float, 0, QuadAngle::Flat,
kPointTwoFiveBiasForPointTwoFiveZOnFloat, 0, 0.125);
Expand Down Expand Up @@ -225,6 +229,10 @@ TEST_P(DepthBiasTests, NegativeBiasOnFloatWithClamp) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGL());
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());

// Depth bias clamp is not supported in compat mode.
// https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#9-depth-bias-clamp-must-be-zero
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode());

// Draw quad flat on z = 0.25 with -0.25 bias clamped at -0.125.
RunDepthBiasTest(wgpu::TextureFormat::Depth32Float, 0, QuadAngle::Flat,
-kPointTwoFiveBiasForPointTwoFiveZOnFloat, 0, -0.125);
Expand Down Expand Up @@ -344,6 +352,10 @@ TEST_P(DepthBiasTests, PositiveBiasOn24bitWithClamp) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGL());
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());

// Depth bias clamp is not supported in compat mode.
// https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#9-depth-bias-clamp-must-be-zero
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode());

// Draw quad flat on z = 0.25 with 0.25 bias clamped at 0.125.
RunDepthBiasTest(wgpu::TextureFormat::Depth24PlusStencil8, 0.4f, QuadAngle::Flat,
0.25f * (1 << 25), 0, 0.1f);
Expand Down
9 changes: 9 additions & 0 deletions src/dawn/tests/end2end/MultisampledRenderingTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,9 @@ TEST_P(DawnLoadResolveTextureTest, TwoOutputsDrawThenLoadColor0) {
// with DawnLoadResolveTexture feature if there are more than one attachment.
DAWN_TEST_UNSUPPORTED_IF(HasResolveMultipleAttachmentInSeparatePassesToggle());

// TODO(383731610): multiple outputs are not working in compat mode.
DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode());

auto multiSampledTexture1 = CreateTextureForRenderAttachment(kColorFormat, 4, 1, 1,
/*transientAttachment=*/false,
/*supportsTextureBinding=*/false);
Expand Down Expand Up @@ -1798,6 +1801,9 @@ TEST_P(DawnLoadResolveTextureTest, TwoOutputsDrawThenLoadColor1) {
// with DawnLoadResolveTexture feature if there are more than one attachment.
DAWN_TEST_UNSUPPORTED_IF(HasResolveMultipleAttachmentInSeparatePassesToggle());

// TODO(383731610): multiple outputs are not working in compat mode.
DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode());

auto multiSampledTexture1 = CreateTextureForRenderAttachment(kColorFormat, 4, 1, 1,
/*transientAttachment=*/false,
/*supportsTextureBinding=*/false);
Expand Down Expand Up @@ -2134,6 +2140,9 @@ TEST_P(DawnLoadResolveTextureTest, TwoOutputsDrawWithDepthTestColor0AndColor1) {

// Test rendering into a layer of a 2D array texture and load op=LoadOp::ExpandResolveTexture.
TEST_P(DawnLoadResolveTextureTest, DrawThenLoad2DArrayTextureLayer) {
// Creating 2D view from 2D array texture is not supported in compat mode.
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode());

auto multiSampledTexture = CreateTextureForRenderAttachment(kColorFormat, 4, 1, 1,
/*transientAttachment=*/false,
/*supportsTextureBinding=*/false);
Expand Down
7 changes: 7 additions & 0 deletions src/dawn/tests/end2end/QueueTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ TEST_P(QueueWriteTextureTests, VaryingBytesPerRowCube) {
// TODO(crbug.com/dawn/42241333): diagnose stencil8 failure on Angle Swiftshader
DAWN_SUPPRESS_TEST_IF(format == wgpu::TextureFormat::Stencil8 && IsANGLESwiftShader());

// TODO(383765096): D3D11 doesn't allow calling Gather() on R8_UINT
DAWN_SUPPRESS_TEST_IF(format == wgpu::TextureFormat::Stencil8 && IsD3D11() &&
IsCompatibilityMode());

constexpr uint32_t kWidth = 257;
constexpr uint32_t kHeight = 257;

Expand Down Expand Up @@ -691,6 +695,9 @@ TEST_P(QueueWriteTextureTests, VaryingArrayBytesPerRow) {
// TODO(crbug.com/dawn/2095): Failing on ANGLE + SwiftShader, needs investigation.
DAWN_SUPPRESS_TEST_IF(IsANGLESwiftShader());

// TODO(383779503): reading stencil texture is too slow on D3D11.
DAWN_SUPPRESS_TEST_IF(IsD3D11() && GetParam().mTextureFormat == wgpu::TextureFormat::Stencil8);

constexpr uint32_t kWidth = 257;
constexpr uint32_t kHeight = 129;
constexpr uint32_t kLayers = 65;
Expand Down
8 changes: 8 additions & 0 deletions src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearNormalizedFormatsOutOfBound) {
// Test clearing multiple color attachments with different big signed and unsigned integers can
// still work correctly.
TEST_P(RenderPassLoadOpTests, LoadOpClearWithBig32BitIntegralValuesOnMultipleColorAttachments) {
// TODO(383733873): ApplyClearBigIntegerColorValueWithDraw workaround doesn't work with multiple
// outputs in compat mode.
DAWN_TEST_UNSUPPORTED_IF(IsD3D11() && IsCompatibilityMode());

constexpr int32_t kMaxInt32RepresentableInFloat = 1 << std::numeric_limits<float>::digits;
constexpr int32_t kMinInt32RepresentableInFloat = -kMaxInt32RepresentableInFloat;

Expand Down Expand Up @@ -685,6 +689,10 @@ TEST_P(RenderPassLoadOpTests, MixedUseOfLoadOpLoadAndLoadOpClearWithBigIntegerVa
// TODO(crbug.com/dawn/2295): diagnose this failure on Pixel 4 OpenGLES
DAWN_SUPPRESS_TEST_IF(IsOpenGLES() && IsAndroid() && IsQualcomm());

// TODO(383733873): ApplyClearBigIntegerColorValueWithDraw workaround doesn't work with multiple
// outputs in compat mode.
DAWN_TEST_UNSUPPORTED_IF(IsD3D11() && IsCompatibilityMode());

constexpr int32_t kMaxUInt32RepresentableInFloat = 1 << std::numeric_limits<float>::digits;

wgpu::TextureDescriptor textureDescriptor = {};
Expand Down
4 changes: 4 additions & 0 deletions src/dawn/tests/end2end/TextureCorruptionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ class TextureCorruptionTests : public DawnTestWithParams<TextureCorruptionTestsP
uint32_t sampleCount = GetParam().mSampleCount;
wgpu::Extent3D textureSize = {width, height, depthOrArrayLayerCount};

// Compat mode's max texture size is 4096.
// https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#10-lower-limits
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode() && (width > 4096 || height > 4096));

// Pre-allocate textures. The incorrect write type may corrupt neighboring textures or
// layers.
std::vector<wgpu::Texture> textures;
Expand Down
4 changes: 4 additions & 0 deletions src/dawn/tests/end2end/VideoViewsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ class VideoViewsTests : public VideoViewsTestsBase {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
DAWN_TEST_UNSUPPORTED_IF(!IsMultiPlanarFormatsSupported());
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
// TODO(382071071): compat mode doesn't allow different texture views to be used in
// a draw call. But the tests need texture views to sample and render to separate planes of
// a multiplanar texture.
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode());

mBackend = VideoViewsTestBackend::Create();
mBackend->OnSetUp(device);
Expand Down
4 changes: 4 additions & 0 deletions src/dawn/tests/white_box/SharedTextureMemoryTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ void SharedTextureMemoryTests::SetUp() {
!SupportsFeatures(GetParam().mBackend->RequiredFeatures(GetAdapter().Get())));
// TODO(crbug.com/342213634): Crashes on ChromeOS volteer devices.
DAWN_SUPPRESS_TEST_IF(IsChromeOS() && IsVulkan() && IsIntel() && IsBackendValidationEnabled());

// Compat cannot create 2D texture view from a 2D array texture.
DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode() && GetParam().mLayerCount > 1);

GetParam().mBackend->SetUp();
}

Expand Down

0 comments on commit ad54e95

Please sign in to comment.