Commit d9cc30e2 authored by Stephen White's avatar Stephen White Committed by Commit Bot

Fix Dawn 2D Canvas.

Dawn doesn't currently report its maximum texture size, which causes
Canvas to think the max is zero. So canvas backing store allocation
always fails, and we end up with a software canvas.

The easiest thing for now is to avoid the maximum size test for Dawn.

Bug: 1076141

Change-Id: I73df1aeb9af7ad438889f9e0f7792c870d1b9201
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199693
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarJuanmi Huertas <juanmihd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768808}
parent bf271e96
......@@ -180,10 +180,10 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider {
base::WeakPtr<CanvasResourceDispatcher> resource_dispatcher,
bool is_origin_top_left,
bool is_accelerated,
bool is_webgpu,
bool use_webgpu,
uint32_t shared_image_usage_flags)
: CanvasResourceProvider(
is_webgpu ? kWebGPUSharedImage : kSharedImage,
use_webgpu ? kWebGPUSharedImage : kSharedImage,
size,
msaa_sample_count,
filter_quality,
......@@ -1013,8 +1013,13 @@ CanvasResourceProvider::CreateSharedImageProvider(
const auto& capabilities =
context_provider_wrapper->ContextProvider()->GetCapabilities();
if (size.Width() > capabilities.max_texture_size ||
size.Height() > capabilities.max_texture_size) {
bool use_webgpu =
raster_mode == RasterMode::kGPU &&
base::FeatureList::IsEnabled(blink::features::kDawn2dCanvas);
// TODO(senorblanco): once Dawn reports maximum texture size, Dawn Canvas
// should respect it. http://crbug.com/1082760
if (!use_webgpu && (size.Width() > capabilities.max_texture_size ||
size.Height() > capabilities.max_texture_size)) {
return nullptr;
}
......@@ -1034,9 +1039,7 @@ CanvasResourceProvider::CreateSharedImageProvider(
auto provider = std::make_unique<CanvasResourceProviderSharedImage>(
size, msaa_sample_count, filter_quality, color_params,
context_provider_wrapper, nullptr /* resource_dispatcher */,
is_origin_top_left, raster_mode == RasterMode::kGPU,
raster_mode == RasterMode::kGPU &&
base::FeatureList::IsEnabled(blink::features::kDawn2dCanvas),
is_origin_top_left, raster_mode == RasterMode::kGPU, use_webgpu,
shared_image_usage_flags);
if (provider->IsValid())
return provider;
......
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