Commit 951f1e4f authored by Natasha Lee's avatar Natasha Lee Committed by Commit Bot

Set the isCleared member of ExternalImageDescriptors for Shared Images

Dawn should respect the SharedImage texture clear status.

Also uses new wrapping API that takes in the ExternalImageDescriptors

Bug: chromium:1036080
Change-Id: Ibe5f8f9e837e6fd9d5af19ff8a9d83823420b9af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2085160
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747063}
parent 187d1368
......@@ -67,7 +67,7 @@ WGPUTexture ExternalVkImageDawnRepresentation::BeginAccess(
dawn_native::vulkan::ExternalImageDescriptorOpaqueFD descriptor = {};
descriptor.cTextureDescriptor = &texture_descriptor;
descriptor.isCleared = true;
descriptor.isCleared = IsCleared();
descriptor.allocationSize = allocation_size_;
descriptor.memoryTypeIndex = memory_type_index_;
descriptor.memoryFD = memory_fd_;
......
......@@ -281,18 +281,23 @@ class SharedImageRepresentationDawnIOSurface
}
WGPUTexture BeginAccess(WGPUTextureUsage usage) final {
WGPUTextureDescriptor desc;
desc.nextInChain = nullptr;
desc.format = wgpu_format_;
desc.usage = usage;
desc.dimension = WGPUTextureDimension_2D;
desc.size = {size().width(), size().height(), 1};
desc.arrayLayerCount = 1;
desc.mipLevelCount = 1;
desc.sampleCount = 1;
texture_ =
dawn_native::metal::WrapIOSurface(device_, &desc, io_surface_.get(), 0);
WGPUTextureDescriptor texture_descriptor;
texture_descriptor.nextInChain = nullptr;
texture_descriptor.format = wgpu_format_;
texture_descriptor.usage = usage;
texture_descriptor.dimension = WGPUTextureDimension_2D;
texture_descriptor.size = {size().width(), size().height(), 1};
texture_descriptor.arrayLayerCount = 1;
texture_descriptor.mipLevelCount = 1;
texture_descriptor.sampleCount = 1;
dawn_native::metal::ExternalImageDescriptorIOSurface descriptor;
descriptor.cTextureDescriptor = &texture_descriptor;
descriptor.isCleared = IsCleared();
descriptor.ioSurface = io_surface_.get();
descriptor.plane = 0;
texture_ = dawn_native::metal::WrapIOSurface(device_, &descriptor);
if (texture_) {
// Keep a reference to the texture so that it stays valid (its content
......
......@@ -78,18 +78,23 @@ WGPUTexture SharedImageRepresentationDawnD3D::BeginAccess(
return nullptr;
}
WGPUTextureDescriptor desc;
desc.nextInChain = nullptr;
desc.format = wgpu_format;
desc.usage = usage;
desc.dimension = WGPUTextureDimension_2D;
desc.size = {size().width(), size().height(), 1};
desc.arrayLayerCount = 1;
desc.mipLevelCount = 1;
desc.sampleCount = 1;
texture_ = dawn_native::d3d12::WrapSharedHandle(device_, &desc, shared_handle,
shared_mutex_acquire_key);
WGPUTextureDescriptor texture_descriptor;
texture_descriptor.nextInChain = nullptr;
texture_descriptor.format = wgpu_format;
texture_descriptor.usage = usage;
texture_descriptor.dimension = WGPUTextureDimension_2D;
texture_descriptor.size = {size().width(), size().height(), 1};
texture_descriptor.arrayLayerCount = 1;
texture_descriptor.mipLevelCount = 1;
texture_descriptor.sampleCount = 1;
dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle descriptor;
descriptor.cTextureDescriptor = &texture_descriptor;
descriptor.isCleared = IsCleared();
descriptor.sharedHandle = shared_handle;
descriptor.acquireMutexKey = shared_mutex_acquire_key;
texture_ = dawn_native::d3d12::WrapSharedHandle(device_, &descriptor);
if (texture_) {
// Keep a reference to the texture so that it stays valid (its content
// might be destroyed).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment