Refactor viz format to wgpu format code
Currently, we have duplicate implementations of viz::ResourceFormat to WGPUTextureFormat conversion. This CL exposes a new ToWGPUFormat function in resource_format_utils and removes duplicate code. Note: ToWGPUFormat calls ToDawnFormat under the hood and casts from dawn::TextureFormat to WGPUTextureFormat. Looking at the definitions [1][2], it seems like they are generated from the same place, so this cast is safe? [1] https://cs.chromium.org/chromium/src/out/Debug/gen/third_party/dawn/src/include/dawn/webgpu.h?type=cs&q=WGPUTextureFormat&sq=package:chromium&g=0&l=252 [2] https://cs.chromium.org/chromium/src/out/Debug/gen/third_party/dawn/src/include/dawn/webgpu_cpp.h?type=cs&q=BGRA8Unorm+f:dawn&sq=package:chromium&g=0&l=176 Change-Id: I6159240c40c084a6d9fd3c8f7b4ff66ab03063f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1950750Reviewed-by:Eric Karl <ericrk@chromium.org> Reviewed-by:
Kenneth Russell <kbr@chromium.org> Reviewed-by:
Corentin Wallez <cwallez@chromium.org> Commit-Queue: Brian Ho <hob@chromium.org> Cr-Commit-Position: refs/heads/master@{#722620}
Showing
Please register or sign in to comment