diff --git a/include/dawn/native/D3D12Backend.h b/include/dawn/native/D3D12Backend.h index 8db8dfc5c3..f8f22715cc 100644 --- a/include/dawn/native/D3D12Backend.h +++ b/include/dawn/native/D3D12Backend.h @@ -27,12 +27,6 @@ struct ID3D12Resource; namespace dawn::native::d3d12 { -// TODO(dawn:1724): remove below once chrome is updated -using d3d::ExternalImageDescriptorDXGISharedHandle; -using d3d::ExternalImageDXGI; -using d3d::ExternalImageDXGIBeginAccessDescriptor; -using d3d::ExternalImageDXGIFenceDescriptor; - class Device; DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr GetD3D12Device(WGPUDevice device); diff --git a/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.cpp b/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.cpp index ff32399600..34aae56ff3 100644 --- a/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.cpp +++ b/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.cpp @@ -42,7 +42,7 @@ void ExternalImageDXGIImpl::DestroyInternal() { } WGPUTexture ExternalImageDXGIImpl::BeginAccess( - const ExternalImageDXGIBeginAccessDescriptor* descriptor) { + const d3d::ExternalImageDXGIBeginAccessDescriptor* descriptor) { ASSERT(descriptor != nullptr); auto deviceLock(GetScopedDeviceLock()); @@ -78,7 +78,7 @@ WGPUTexture ExternalImageDXGIImpl::BeginAccess( } std::vector> waitFences; - for (const ExternalImageDXGIFenceDescriptor& fenceDescriptor : descriptor->waitFences) { + for (const d3d::ExternalImageDXGIFenceDescriptor& fenceDescriptor : descriptor->waitFences) { ASSERT(fenceDescriptor.fenceHandle != nullptr); // TODO(sunnyps): Use a fence cache instead of re-importing fences on each BeginAccess. Ref fence; @@ -100,7 +100,7 @@ WGPUTexture ExternalImageDXGIImpl::BeginAccess( } void ExternalImageDXGIImpl::EndAccess(WGPUTexture texture, - ExternalImageDXGIFenceDescriptor* signalFence) { + d3d::ExternalImageDXGIFenceDescriptor* signalFence) { auto deviceLock(GetScopedDeviceLock()); if (!IsInList()) { diff --git a/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.h b/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.h index 2cc3f39d0e..14edcdb4ec 100644 --- a/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.h +++ b/src/dawn/native/d3d12/ExternalImageDXGIImplD3D12.h @@ -54,9 +54,10 @@ class ExternalImageDXGIImpl : public d3d::ExternalImageDXGIImpl { bool IsValid() const; - WGPUTexture BeginAccess(const ExternalImageDXGIBeginAccessDescriptor* descriptor) override; + WGPUTexture BeginAccess(const d3d::ExternalImageDXGIBeginAccessDescriptor* descriptor) override; - void EndAccess(WGPUTexture texture, ExternalImageDXGIFenceDescriptor* signalFence) override; + void EndAccess(WGPUTexture texture, + d3d::ExternalImageDXGIFenceDescriptor* signalFence) override; // This method should only be called by internal code. Don't call this from D3D12Backend side, // or without locking. diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp index c1caf0868d..a3ff85c3d5 100644 --- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp +++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp @@ -39,7 +39,7 @@ PhysicalDevice::~PhysicalDevice() { } bool PhysicalDevice::SupportsExternalImages() const { - // Via dawn::native::d3d12::ExternalImageDXGI::Create + // Via dawn::native::d3d::ExternalImageDXGI::Create return true; } diff --git a/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp index ec651c0543..8bde2bd083 100644 --- a/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp +++ b/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp @@ -94,7 +94,7 @@ class D3D12ResourceTestBase : public DawnTest { } protected: - std::unique_ptr CreateExternalImage( + std::unique_ptr CreateExternalImage( WGPUDevice targetDevice, ID3D11Texture2D* d3d11Texture, const wgpu::TextureDescriptor* dawnDesc) const { @@ -107,13 +107,13 @@ class D3D12ResourceTestBase : public DawnTest { &textureSharedHandle), S_OK); - dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; + dawn::native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc; externalImageDesc.cTextureDescriptor = reinterpret_cast(dawnDesc); externalImageDesc.sharedHandle = textureSharedHandle; - std::unique_ptr externalImage = - dawn::native::d3d12::ExternalImageDXGI::Create(targetDevice, &externalImageDesc); + std::unique_ptr externalImage = + dawn::native::d3d::ExternalImageDXGI::Create(targetDevice, &externalImageDesc); // Now that we've created all of our resources, we can close the handle // since we no longer need it. @@ -127,12 +127,12 @@ class D3D12ResourceTestBase : public DawnTest { const D3D11_TEXTURE2D_DESC* baseD3dDescriptor, wgpu::Texture* dawnTexture, ID3D11Texture2D** d3d11TextureOut, - std::unique_ptr* externalImageOut) const { + std::unique_ptr* externalImageOut) const { ComPtr d3d11Texture; HRESULT hr = mD3d11Device->CreateTexture2D(baseD3dDescriptor, nullptr, &d3d11Texture); ASSERT_EQ(hr, S_OK); - std::unique_ptr externalImage = + std::unique_ptr externalImage = CreateExternalImage(device.Get(), d3d11Texture.Get(), dawnDesc); // Cannot access a non-existent external image (ex. validation error). @@ -140,7 +140,7 @@ class D3D12ResourceTestBase : public DawnTest { return; } - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.usage = static_cast(dawnDesc->usage); *dawnTexture = wgpu::Texture::Acquire(externalImage->BeginAccess(&externalAccessDesc)); @@ -173,13 +173,13 @@ TEST_P(D3D12SharedHandleValidation, Success) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); ASSERT_NE(texture.Get(), nullptr); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); } @@ -195,13 +195,13 @@ TEST_P(D3D12SharedHandleValidation, SuccessWithInternalUsageDescriptor) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); ASSERT_NE(texture.Get(), nullptr); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); } @@ -216,7 +216,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidTextureDescriptor) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -230,7 +230,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidMipLevelCount) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -244,7 +244,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidDepth) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -258,7 +258,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidSampleCount) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -272,7 +272,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidWidth) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -286,7 +286,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidHeight) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -300,7 +300,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidFormat) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -314,7 +314,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidNumD3DMipLevels) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -328,7 +328,7 @@ TEST_P(D3D12SharedHandleValidation, InvalidD3DArraySize) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage)); @@ -440,17 +440,17 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { HANDLE fenceSharedHandle, uint64_t fenceWaitValue, wgpu::Texture* dawnTextureOut, - std::unique_ptr* externalImageOut, + std::unique_ptr* externalImageOut, bool isInitialized) const { - dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {}; + dawn::native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {}; externalImageDesc.sharedHandle = sharedHandle; externalImageDesc.cTextureDescriptor = reinterpret_cast(&dawnDescriptor); - std::unique_ptr externalImage = - dawn::native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); + std::unique_ptr externalImage = + dawn::native::d3d::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.isInitialized = isInitialized; externalAccessDesc.usage = static_cast(dawnDescriptor.usage); if (fenceSharedHandle != nullptr) { @@ -467,7 +467,7 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { const wgpu::Color& clearColor, wgpu::Texture* dawnTextureOut, ID3D11Texture2D** d3d11TextureOut, - std::unique_ptr* externalImageOut, + std::unique_ptr* externalImageOut, bool isInitialized = true) const { ComPtr d3d11Texture; ComPtr d3d11Fence; @@ -490,10 +490,9 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { } } - void ExpectPixelRGBA8EQ( - ID3D11Texture2D* d3d11Texture, - const wgpu::Color& color, - const dawn::native::d3d12::ExternalImageDXGIFenceDescriptor* waitFence) { + void ExpectPixelRGBA8EQ(ID3D11Texture2D* d3d11Texture, + const wgpu::Color& color, + const dawn::native::d3d::ExternalImageDXGIFenceDescriptor* waitFence) { D3D11_TEXTURE2D_DESC texture2DDesc; d3d11Texture->GetDesc(&texture2DDesc); @@ -570,7 +569,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D12) { const wgpu::Color clearColor{1.0f, 1.0f, 0.0f, 1.0f}; wgpu::Texture dawnSrcTexture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnSrcTexture, &d3d11Texture, &externalImage); ASSERT_NE(dawnSrcTexture.Get(), nullptr); @@ -579,7 +578,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D12) { wgpu::Texture dawnCopyDestTexture = device.CreateTexture(&baseDawnDescriptor); SimpleCopyTextureToTexture(dawnSrcTexture, dawnCopyDestTexture); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(dawnSrcTexture.Get(), &signalFence); dawnSrcTexture.Destroy(); @@ -598,7 +597,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11ReadbackInD3D12) { const wgpu::Color clearColor{1.0f, 1.0f, 0.0f, 1.0f}; wgpu::Texture dawnTexture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnTexture, &d3d11Texture, &externalImage); ASSERT_NE(dawnTexture.Get(), nullptr); @@ -609,7 +608,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11ReadbackInD3D12) { clearColor.a * 255), dawnTexture, 0, 0); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(dawnTexture.Get(), &signalFence); dawnTexture.Destroy(); } @@ -627,7 +626,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D12ReadbackInD3D11) { const wgpu::Color d3d11ClearColor{1.0f, 1.0f, 0.0f, 1.0f}; wgpu::Texture dawnTexture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, d3d11ClearColor, &dawnTexture, &d3d11Texture, &externalImage, /*isInitialized=*/true); ASSERT_NE(dawnTexture.Get(), nullptr); @@ -635,7 +634,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D12ReadbackInD3D11) { const wgpu::Color d3d12ClearColor{0.0f, 0.0f, 1.0f, 1.0f}; ClearImage(dawnTexture, d3d12ClearColor, device); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(dawnTexture.Get(), &signalFence); dawnTexture.Destroy(); @@ -659,7 +658,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearTwiceInD3D12ReadbackInD3D11) { const wgpu::Color d3d11ClearColor{1.0f, 1.0f, 0.0f, 1.0f}; wgpu::Texture dawnTexture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, d3d11ClearColor, &dawnTexture, &d3d11Texture, &externalImage, /*isInitialized=*/true); ASSERT_NE(dawnTexture.Get(), nullptr); @@ -670,7 +669,7 @@ TEST_P(D3D12SharedHandleUsageTests, ClearTwiceInD3D12ReadbackInD3D11) { const wgpu::Color d3d12ClearColor2{0.0f, 1.0f, 1.0f, 1.0f}; ClearImage(dawnTexture, d3d12ClearColor2, device); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(dawnTexture.Get(), &signalFence); dawnTexture.Destroy(); @@ -689,7 +688,7 @@ TEST_P(D3D12SharedHandleUsageTests, UninitializedTextureIsCleared) { const wgpu::Color clearColor{1.0f, 0.0f, 0.0f, 1.0f}; wgpu::Texture dawnTexture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnTexture, &d3d11Texture, &externalImage, /*isInitialized=*/false); ASSERT_NE(dawnTexture.Get(), nullptr); @@ -698,7 +697,7 @@ TEST_P(D3D12SharedHandleUsageTests, UninitializedTextureIsCleared) { // to clear the source texture on the D3D device. EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), dawnTexture, 0, 0); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(dawnTexture.Get(), &signalFence); dawnTexture.Destroy(); } @@ -712,7 +711,7 @@ TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImage) { // Create the first Dawn texture then clear it to red. wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); { @@ -725,12 +724,12 @@ TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImage) { // Once finished with the first texture, destroy it so we may re-acquire the external image // again. - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); // Create another Dawn texture then clear it with another color. - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast(baseDawnDescriptor.usage); externalAccessDesc.waitFences.push_back(signalFence); @@ -771,7 +770,7 @@ TEST_P(D3D12SharedHandleUsageTests, ConcurrentExternalImageReadAccess) { // Create Dawn texture with write access, then clear it to red. wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); @@ -780,35 +779,35 @@ TEST_P(D3D12SharedHandleUsageTests, ConcurrentExternalImageReadAccess) { ASSERT_NE(texture.Get(), nullptr); ClearImage(texture.Get(), solidRed, device); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); - std::unique_ptr externalImage2 = + std::unique_ptr externalImage2 = CreateExternalImage(device2.Get(), d3d11Texture.Get(), &baseDawnDescriptor); EXPECT_NE(externalImage2, nullptr); - std::unique_ptr externalImage3 = + std::unique_ptr externalImage3 = CreateExternalImage(device3.Get(), d3d11Texture.Get(), &baseDawnDescriptor); EXPECT_NE(externalImage3, nullptr); - std::unique_ptr externalImage4 = + std::unique_ptr externalImage4 = CreateExternalImage(device4.Get(), d3d11Texture.Get(), &baseDawnDescriptor); EXPECT_NE(externalImage4, nullptr); - std::unique_ptr externalImage5 = + std::unique_ptr externalImage5 = CreateExternalImage(device5.Get(), d3d11Texture.Get(), &baseDawnDescriptor); EXPECT_NE(externalImage5, nullptr); // Create two Dawn textures for concurrent read on second device. - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = WGPUTextureUsage_CopySrc; externalAccessDesc.waitFences = {signalFence}; // Concurrent read access on device 2 and 3. - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence2; - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence3; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence2; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence3; { wgpu::Texture texture2 = wgpu::Texture::Acquire(externalImage2->BeginAccess(&externalAccessDesc)); @@ -834,7 +833,7 @@ TEST_P(D3D12SharedHandleUsageTests, ConcurrentExternalImageReadAccess) { externalAccessDesc.waitFences = {signalFence2, signalFence3}; // Exclusive read-write access on device 4. - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence4; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence4; { wgpu::Texture texture4 = wgpu::Texture::Acquire(externalImage4->BeginAccess(&externalAccessDesc)); @@ -855,7 +854,7 @@ TEST_P(D3D12SharedHandleUsageTests, ConcurrentExternalImageReadAccess) { externalAccessDesc.waitFences = {signalFence4}; // Import texture on device 5, but do nothing with it. - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence5; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence5; { wgpu::Texture texture5 = wgpu::Texture::Acquire(externalImage5->BeginAccess(&externalAccessDesc)); @@ -911,16 +910,16 @@ TEST_P(D3D12SharedHandleUsageTests, ExternalImageUsage) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); ASSERT_NE(texture.Get(), nullptr); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = WGPUTextureUsage_StorageBinding; externalAccessDesc.waitFences.push_back(signalFence); @@ -940,7 +939,7 @@ TEST_P(D3D12SharedHandleUsageTests, InvalidateExternalImageOnDestroyDevice) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; // Create the Dawn texture then clear it to red. WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, @@ -949,14 +948,14 @@ TEST_P(D3D12SharedHandleUsageTests, InvalidateExternalImageOnDestroyDevice) { ASSERT_NE(texture.Get(), nullptr); ClearImage(texture.Get(), solidRed, device); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); // Do not readback pixels since that requires device to be alive during DawnTest::TearDown(). DestroyDevice(); - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast(baseDawnDescriptor.usage); @@ -969,7 +968,7 @@ TEST_P(D3D12SharedHandleUsageTests, DisallowExternalImageAfterDestroyDevice) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; DestroyDevice(); @@ -987,7 +986,7 @@ TEST_P(D3D12SharedHandleUsageTests, CallWriteBufferBeforeDestroyingExternalImage wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); @@ -997,7 +996,7 @@ TEST_P(D3D12SharedHandleUsageTests, CallWriteBufferBeforeDestroyingExternalImage wgpu::Buffer buffer = utils::CreateBufferFromData( device, wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst, {kExpected}); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); texture.Destroy(); externalImage = nullptr; @@ -1012,7 +1011,7 @@ TEST_P(D3D12SharedHandleUsageTests, SRGBReinterpretation) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; // The texture will be reinterpreted as sRGB. wgpu::TextureViewDescriptor viewDesc = {}; @@ -1068,13 +1067,13 @@ class D3D12SharedHandleMultithreadTests : public D3D12SharedHandleUsageTests { TEST_P(D3D12SharedHandleMultithreadTests, DestroyDeviceBeforeImageNoDeadLock) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); ASSERT_NE(texture.Get(), nullptr); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); EXPECT_TRUE(externalImage->IsValid()); @@ -1088,7 +1087,7 @@ TEST_P(D3D12SharedHandleMultithreadTests, DestroyDeviceBeforeImageNoDeadLock) { TEST_P(D3D12SharedHandleMultithreadTests, DestroyDeviceAndUseImageInParallel) { wgpu::Texture texture; ComPtr d3d11Texture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); @@ -1096,7 +1095,7 @@ TEST_P(D3D12SharedHandleMultithreadTests, DestroyDeviceAndUseImageInParallel) { EXPECT_TRUE(externalImage->IsValid()); std::thread thread1([&] { - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor signalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence; externalImage->EndAccess(texture.Get(), &signalFence); }); @@ -1130,11 +1129,11 @@ TEST_P(D3D12SharedHandleMultithreadTests, ClearInD3D12ReadbackInD3D11_TwoThreads CreateSharedD3D11Texture(baseD3dDescriptor, &d3d11Texture, &d3d11Fence, &sharedHandle, &fenceSharedHandle); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor d3d12SignalFence; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor d3d12SignalFence; std::thread d3d12Thread([=, &d3d12SignalFence] { wgpu::Texture dawnTexture; - std::unique_ptr externalImage; + std::unique_ptr externalImage; WaitAndWrapD3D11Texture(baseDawnDescriptor, sharedHandle, fenceSharedHandle, /*fenceWaitValue=*/kD3D11FenceSignalValue, &dawnTexture, &externalImage, /*isInitialized=*/true); diff --git a/src/dawn/tests/end2end/VideoViewsTests_win.cpp b/src/dawn/tests/end2end/VideoViewsTests_win.cpp index c0409f5b5f..c5e983c84c 100644 --- a/src/dawn/tests/end2end/VideoViewsTests_win.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests_win.cpp @@ -169,22 +169,22 @@ class VideoViewsTestBackendWin : public VideoViewsTestBackend { ASSERT(hr == S_OK); // Open the DX11 texture in Dawn from the shared handle and return it as a WebGPU texture. - dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; + dawn::native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc; externalImageDesc.cTextureDescriptor = reinterpret_cast(&textureDesc); externalImageDesc.sharedHandle = sharedHandle; - std::unique_ptr externalImage = - dawn::native::d3d12::ExternalImageDXGI::Create(mWGPUDevice, &externalImageDesc); + std::unique_ptr externalImage = + dawn::native::d3d::ExternalImageDXGI::Create(mWGPUDevice, &externalImageDesc); // Handle is no longer needed once resources are created. ::CloseHandle(sharedHandle); - dawn::native::d3d12::ExternalImageDXGIFenceDescriptor fenceDesc; + dawn::native::d3d::ExternalImageDXGIFenceDescriptor fenceDesc; fenceDesc.fenceHandle = fenceSharedHandle; fenceDesc.fenceValue = 1; - dawn::native::d3d12::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; + dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast(textureDesc.usage); externalAccessDesc.waitFences = {};