Skip to content

Commit

Permalink
Use correct origin when creating WebGL DrawingBuffer
Browse files Browse the repository at this point in the history
Previously shared images did not track the origin of the underlying
image but OOPR Canvas does require this functionality. This CL just
updates an origin placeholder to use the correct origin when creating
shared images for DrawingBuffer.

Bug: 1031055
Change-Id: I01c2e66d3639ced777bc5603dab32bb1fdf8e7f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2718889
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Nathan Zabriskie <nazabris@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#859051}
  • Loading branch information
NathanZabriskie authored and Chromium LUCI CQ committed Mar 2, 2021
1 parent d705b74 commit b59f321
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1150,9 +1150,12 @@ bool DrawingBuffer::ResizeDefaultFramebuffer(const IntSize& size) {
premultiplied_alpha_false_mailbox_.SetZero();
premultiplied_alpha_false_texture_ = 0;
}
GrSurfaceOrigin origin = opengl_flip_y_extension_
? kTopLeft_GrSurfaceOrigin
: kBottomLeft_GrSurfaceOrigin;
premultiplied_alpha_false_mailbox_ = sii->CreateSharedImage(
back_color_buffer_->format, static_cast<gfx::Size>(size),
storage_color_space_, kTopLeft_GrSurfaceOrigin, kUnpremul_SkAlphaType,
storage_color_space_, origin, kUnpremul_SkAlphaType,
gpu::SHARED_IMAGE_USAGE_GLES2 |
gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT |
gpu::SHARED_IMAGE_USAGE_RASTER,
Expand Down Expand Up @@ -1655,6 +1658,9 @@ scoped_refptr<DrawingBuffer::ColorBuffer> DrawingBuffer::CreateColorBuffer(
uint32_t usage = gpu::SHARED_IMAGE_USAGE_GLES2 |
gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT |
gpu::SHARED_IMAGE_USAGE_DISPLAY;
GrSurfaceOrigin origin = opengl_flip_y_extension_
? kTopLeft_GrSurfaceOrigin
: kBottomLeft_GrSurfaceOrigin;

viz::ResourceFormat format;
if (allocate_alpha_channel_) {
Expand All @@ -1667,8 +1673,7 @@ scoped_refptr<DrawingBuffer::ColorBuffer> DrawingBuffer::CreateColorBuffer(
if (UsingSwapChain()) {
gpu::SharedImageInterface::SwapChainMailboxes mailboxes =
sii->CreateSwapChain(format, static_cast<gfx::Size>(size),
storage_color_space_, kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType,
storage_color_space_, origin, kPremul_SkAlphaType,
usage | gpu::SHARED_IMAGE_USAGE_SCANOUT);
back_buffer_mailbox = mailboxes.back_buffer;
front_buffer_mailbox = mailboxes.front_buffer;
Expand Down Expand Up @@ -1698,7 +1703,7 @@ scoped_refptr<DrawingBuffer::ColorBuffer> DrawingBuffer::CreateColorBuffer(
if (gpu_memory_buffer) {
back_buffer_mailbox = sii->CreateSharedImage(
gpu_memory_buffer.get(), gpu_memory_buffer_manager,
storage_color_space_, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
storage_color_space_, origin, kPremul_SkAlphaType,
usage | gpu::SHARED_IMAGE_USAGE_SCANOUT);
}
}
Expand All @@ -1715,8 +1720,8 @@ scoped_refptr<DrawingBuffer::ColorBuffer> DrawingBuffer::CreateColorBuffer(
alpha_type = kUnpremul_SkAlphaType;

back_buffer_mailbox = sii->CreateSharedImage(
format, static_cast<gfx::Size>(size), storage_color_space_,
kTopLeft_GrSurfaceOrigin, alpha_type, usage, gpu::kNullSurfaceHandle);
format, static_cast<gfx::Size>(size), storage_color_space_, origin,
alpha_type, usage, gpu::kNullSurfaceHandle);
}
}

Expand Down

0 comments on commit b59f321

Please sign in to comment.