[webkit-changes] [WebKit/WebKit] 0259a9: [WebGPU] R and B channels are swapped in cube map ...

mwyrzykowski noreply at github.com
Wed Apr 19 16:20:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0259a9cfdd2a3983b0395fca2310bd10285d6b67
      https://github.com/WebKit/WebKit/commit/0259a9cfdd2a3983b0395fca2310bd10285d6b67
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2023-04-19 (Wed, 19 Apr 2023)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/GPUDevice.cpp
    M Source/WebCore/Modules/WebGPU/GPUPresentationContext.cpp
    M Source/WebCore/Modules/WebGPU/GPUQueue.cpp
    M Source/WebCore/Modules/WebGPU/GPUTexture.h

  Log Message:
  -----------
  [WebGPU] R and B channels are swapped in cube map on https://webgpu.github.io/webgpu-samples/samples/cubemap
https://bugs.webkit.org/show_bug.cgi?id=255657
<radar://108264195>

Reviewed by Tadeu Zagallo.

copyExternalImageToTexture was assuming the destination texture was BGRA8, which
is not always the case.

Cache the texture format and use it to determine how to copy an external image
source to a destination texture.

* Source/WebCore/Modules/WebGPU/GPUDevice.cpp:
(WebCore::GPUDevice::createTexture):
Pass the format to GPUTexture::create

* Source/WebCore/Modules/WebGPU/GPUPresentationContext.cpp:
(WebCore::GPUPresentationContext::getCurrentTexture):
Presentation context always uses BGRA8

* Source/WebCore/Modules/WebGPU/GPUQueue.cpp:
(WebCore::toPixelFormat):
Use BGRA or RGBA as appropriate for the destination format.

(WebCore::GPUQueue::copyExternalImageToTexture):
Use BGRA or RGBA as appropriate for the destination format.

* Source/WebCore/Modules/WebGPU/GPUTexture.h:
(WebCore::GPUTexture::create):
(WebCore::GPUTexture::format const):
(WebCore::GPUTexture::GPUTexture):
Cache the texture format.

Canonical link: https://commits.webkit.org/263153@main




More information about the webkit-changes mailing list