Commit 88d63f66 authored by Rafael Cintron's avatar Rafael Cintron Committed by Commit Bot

Label WebGPU swap buffers for improved PIX debugging

In PIX's D3D12-only mode, there is no way to determine frame
boundaries for WebGPU since Dawn does not manage DXGI swap chains.
Without assistance, PIX will wait forever for a present that never
happens.

If we know we're dealing with a swapbuffer texture, inform Dawn,
which informs PIX we've "presented" the texture so it can determine
frame boundaries and use the texture's contents for the UI.

Bug: dawn:364
Change-Id: I6b157a04df02be697dad6b5bc9d76c33969f9fda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2124875Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#755015}
parent 45d966fb
......@@ -37,6 +37,8 @@ enum SharedImageUsage : uint32_t {
SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE = 1 << 9,
// Image will be used for video decode acceleration on Chrome OS.
SHARED_IMAGE_USAGE_VIDEO_DECODE = 1 << 10,
// Image will be used as a WebGPU swapbuffer
SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE = 1 << 11,
};
} // namespace gpu
......
......@@ -5,6 +5,7 @@
#include "gpu/command_buffer/service/shared_image_representation_d3d.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/shared_image_backing_d3d.h"
namespace gpu {
......@@ -93,6 +94,9 @@ WGPUTexture SharedImageRepresentationDawnD3D::BeginAccess(
descriptor.isCleared = IsCleared();
descriptor.sharedHandle = shared_handle;
descriptor.acquireMutexKey = shared_mutex_acquire_key;
descriptor.isSwapChainTexture =
(d3d_image_backing->usage() &
SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE);
texture_ = dawn_native::d3d12::WrapSharedHandle(device_, &descriptor);
if (texture_) {
......
......@@ -95,7 +95,9 @@ WGPUTexture WebGPUSwapBufferProvider::GetNewTexture(const IntSize& size) {
// TODO(cwallez@chromium.org): have some recycling mechanism.
gpu::Mailbox mailbox = sii->CreateSharedImage(
format_, static_cast<gfx::Size>(size), gfx::ColorSpace::CreateSRGB(),
gpu::SHARED_IMAGE_USAGE_WEBGPU | gpu::SHARED_IMAGE_USAGE_DISPLAY);
gpu::SHARED_IMAGE_USAGE_WEBGPU |
gpu::SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE |
gpu::SHARED_IMAGE_USAGE_DISPLAY);
gpu::SyncToken creation_token = sii->GenUnverifiedSyncToken();
current_swap_buffer_ = base::AdoptRef(new SwapBuffer(
......
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