D3D12: Fix ASSERT for external image tests

Replaces use of EXPECT_EQ with ASSERT_EQ and allows
ASSERT_EQ to propagate to caller so the test returns
early.

BUG=dawn:625

Change-Id: I6c12aad201f1821fa8c7c1f9a9b735910049cdcf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This commit is contained in:
Bryan Bernhart 2021-03-02 00:56:51 +00:00 committed by Commit Bot service account
parent 8ed0630d35
commit ec3f482422
2 changed files with 11 additions and 3 deletions

View File

@ -439,6 +439,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D12) {
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnSrcTexture, clearColor,
&d3d11Texture, &dxgiKeyedMutex);
ASSERT_NE(dawnSrcTexture.Get(), nullptr);
// Create a texture on the device and copy the source texture to it.
wgpu::Texture dawnCopyDestTexture = device.CreateTexture(&baseDawnDescriptor);
@ -462,6 +463,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11ReadbackInD3D12) {
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, clearColor,
&d3d11Texture, &dxgiKeyedMutex);
ASSERT_NE(dawnTexture.Get(), nullptr);
// Readback the destination texture and ensure it contains the colors we used
// to clear the source texture on the D3D device.
@ -482,6 +484,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D12ReadbackInD3D11) {
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, d3d11ClearColor,
&d3d11Texture, &dxgiKeyedMutex);
ASSERT_NE(dawnTexture.Get(), nullptr);
const wgpu::Color d3d12ClearColor{0.0f, 0.0f, 1.0f, 1.0f};
ClearImage(dawnTexture, d3d12ClearColor);
@ -507,6 +510,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearTwiceInD3D12ReadbackInD3D11) {
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, d3d11ClearColor,
&d3d11Texture, &dxgiKeyedMutex);
ASSERT_NE(dawnTexture.Get(), nullptr);
const wgpu::Color d3d12ClearColor1{0.0f, 0.0f, 1.0f, 1.0f};
ClearImage(dawnTexture, d3d12ClearColor1);
@ -534,6 +538,7 @@ TEST_P(D3D12SharedHandleUsageTests, UninitializedTextureIsCleared) {
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, clearColor,
&d3d11Texture, &dxgiKeyedMutex, false);
ASSERT_NE(dawnTexture.Get(), nullptr);
// Readback the destination texture and ensure it contains the colors we used
// to clear the source texture on the D3D device.

View File

@ -189,13 +189,13 @@ namespace {
// texture is left uninitialized. This is required for D3D11 and D3D12 interop.
ComPtr<IDXGIKeyedMutex> dxgiKeyedMutex;
hr = d3d11Texture.As(&dxgiKeyedMutex);
EXPECT_EQ(hr, S_OK);
ASSERT_EQ(hr, S_OK);
hr = dxgiKeyedMutex->AcquireSync(0, INFINITE);
EXPECT_EQ(hr, S_OK);
ASSERT_EQ(hr, S_OK);
hr = dxgiKeyedMutex->ReleaseSync(1);
EXPECT_EQ(hr, S_OK);
ASSERT_EQ(hr, S_OK);
// Open the DX11 texture in Dawn from the shared handle and return it as a WebGPU
// texture.
@ -266,6 +266,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
wgpu::Texture wgpuTexture;
CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm,
wgpu::TextureUsage::Sampled, /*isCheckerboard*/ false, &wgpuTexture);
ASSERT_NE(wgpuTexture.Get(), nullptr);
wgpu::TextureViewDescriptor viewDesc;
viewDesc.aspect = wgpu::TextureAspect::Plane0Only;
@ -318,6 +319,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
wgpu::Texture wgpuTexture;
CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm,
wgpu::TextureUsage::Sampled, /*isCheckerboard*/ false, &wgpuTexture);
ASSERT_NE(wgpuTexture.Get(), nullptr);
wgpu::TextureViewDescriptor viewDesc;
viewDesc.aspect = wgpu::TextureAspect::Plane1Only;
@ -371,6 +373,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
wgpu::Texture wgpuTexture;
CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm,
wgpu::TextureUsage::Sampled, /*isCheckerboard*/ true, &wgpuTexture);
ASSERT_NE(wgpuTexture.Get(), nullptr);
wgpu::TextureViewDescriptor lumaViewDesc;
lumaViewDesc.aspect = wgpu::TextureAspect::Plane0Only;