mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Also use ExternalImageDescriptor in D3D12 and Metal Backends
Bug: chromium:1036080 Change-Id: I358b0441c168ca075b09ab028c2f6d9df2a44d59 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16240 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
committed by
Commit Bot service account
parent
cb90835dd9
commit
6f92b9160b
@@ -102,9 +102,13 @@ namespace {
|
||||
&sharedHandle);
|
||||
ASSERT_EQ(hr, S_OK);
|
||||
|
||||
WGPUTexture texture = dawn_native::d3d12::WrapSharedHandle(
|
||||
device.Get(), reinterpret_cast<const WGPUTextureDescriptor*>(dawnDescriptor),
|
||||
sharedHandle, 0);
|
||||
dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle externDesc;
|
||||
externDesc.cTextureDescriptor =
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(dawnDescriptor);
|
||||
externDesc.sharedHandle = sharedHandle;
|
||||
externDesc.acquireMutexKey = 0;
|
||||
WGPUTexture texture = dawn_native::d3d12::WrapSharedHandle(device.Get(), &externDesc);
|
||||
|
||||
// Now that we've created all of our resources, we can close the handle
|
||||
// since we no longer need it.
|
||||
::CloseHandle(sharedHandle);
|
||||
@@ -329,9 +333,12 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase {
|
||||
hr = dxgiKeyedMutex->ReleaseSync(1);
|
||||
ASSERT_EQ(hr, S_OK);
|
||||
|
||||
WGPUTexture dawnTexture = dawn_native::d3d12::WrapSharedHandle(
|
||||
device.Get(), reinterpret_cast<const WGPUTextureDescriptor*>(dawnDescriptor),
|
||||
sharedHandle, 1);
|
||||
dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle externDesc;
|
||||
externDesc.cTextureDescriptor =
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(dawnDescriptor);
|
||||
externDesc.sharedHandle = sharedHandle;
|
||||
externDesc.acquireMutexKey = 1;
|
||||
WGPUTexture dawnTexture = dawn_native::d3d12::WrapSharedHandle(device.Get(), &externDesc);
|
||||
|
||||
*dawnTextureOut = wgpu::Texture::Acquire(dawnTexture);
|
||||
*d3d11TextureOut = d3d11Texture.Detach();
|
||||
|
||||
@@ -96,9 +96,12 @@ namespace {
|
||||
wgpu::Texture WrapIOSurface(const wgpu::TextureDescriptor* descriptor,
|
||||
IOSurfaceRef ioSurface,
|
||||
uint32_t plane) {
|
||||
WGPUTexture texture = dawn_native::metal::WrapIOSurface(
|
||||
device.Get(), reinterpret_cast<const WGPUTextureDescriptor*>(descriptor), ioSurface,
|
||||
plane);
|
||||
dawn_native::metal::ExternalImageDescriptorIOSurface externDesc;
|
||||
externDesc.cTextureDescriptor =
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(descriptor);
|
||||
externDesc.ioSurface = ioSurface;
|
||||
externDesc.plane = plane;
|
||||
WGPUTexture texture = dawn_native::metal::WrapIOSurface(device.Get(), &externDesc);
|
||||
return wgpu::Texture::Acquire(texture);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user