[go: nahoru, domu]

[viz] Eliminate BufferFormat(ResourceFormat)

Moves all callers to SinglePlaneSharedImageFormatToBufferFormat(SIF),
and inlines the eliminated function as the implementation of the SIF
function.

Bug: 1378708
Change-Id: Ic149217953c3fc263d89b4cedbb6e262c2e176b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4570624
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150455}
diff --git a/cc/slim/frame_sink_impl.cc b/cc/slim/frame_sink_impl.cc
index dde863fa..2043172 100644
--- a/cc/slim/frame_sink_impl.cc
+++ b/cc/slim/frame_sink_impl.cc
@@ -23,6 +23,7 @@
 #include "components/viz/common/resources/resource_format_utils.h"
 #include "components/viz/common/resources/resource_id.h"
 #include "components/viz/common/resources/shared_image_format.h"
+#include "components/viz/common/resources/shared_image_format_utils.h"
 #include "components/viz/common/resources/transferable_resource.h"
 #include "gpu/command_buffer/client/shared_image_interface.h"
 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
@@ -168,7 +169,8 @@
   gpu::SyncToken sync_token = sii->GenUnverifiedSyncToken();
 
   GLenum texture_target = gpu::GetBufferTextureTarget(
-      gfx::BufferUsage::SCANOUT, BufferFormat(format.resource_format()), caps);
+      gfx::BufferUsage::SCANOUT,
+      viz::SinglePlaneSharedImageFormatToBufferFormat(format), caps);
   uploaded_resource.viz_resource_id = resource_provider_.ImportResource(
       viz::TransferableResource::MakeGpu(
           uploaded_resource.mailbox, texture_target, sync_token,