Commit a7ae3090 authored by Michael Ludwig's avatar Michael Ludwig Committed by Commit Bot

SkiaRenderer: Support solid color quads when bypassing RenderPasses

This updates the CanPassBeDrawnDirectly logic to allow for
SolidColorDrawQuads, although it still has the requirement
that the quad is opaque with src-over blending.

Bug: 1013735
Change-Id: I433e00561c72f0e8069e7ae1ecf7ab066eb518b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860936
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709241}
parent 0f8d7b3c
......@@ -957,9 +957,8 @@ void SkiaRenderer::DrawQuadInternal(const DrawQuad* quad,
DrawRenderPassQuad(RenderPassDrawQuad::MaterialCast(quad), params);
break;
case DrawQuad::Material::kSolidColor:
// TODO(michaelludwig) - Support solid color quads bypassing a renderpass
DCHECK(rpdq_params == nullptr);
DrawSolidColorQuad(SolidColorDrawQuad::MaterialCast(quad), params);
DrawSolidColorQuad(SolidColorDrawQuad::MaterialCast(quad), rpdq_params,
params);
break;
case DrawQuad::Material::kStreamVideoContent:
// TODO(michaelludwig) - Support video quads bypassing a renderpass
......@@ -1276,7 +1275,7 @@ SkiaRenderer::DrawQuadParams SkiaRenderer::CalculateDrawQuadParams(
const DrawQuad* SkiaRenderer::CanPassBeDrawnDirectly(const RenderPass* pass) {
// TODO(michaelludwig) - For now, this only supports opaque, src-over
// TileDrawQuads with invertable transforms.
// TileDrawQuads and SolidColor quads with invertable transforms.
// It will be updated to select more quad material types as their
// corresponding DrawXQuad() functions are updated to accept DrawRPDQParams
// as well.
......@@ -1291,7 +1290,8 @@ const DrawQuad* SkiaRenderer::CanPassBeDrawnDirectly(const RenderPass* pass) {
const DrawQuad* quad = *pass->quad_list.BackToFrontBegin();
// TODO(michaelludwig) - The set of supported material types can be expanded
// by passing the DrawRPDQParams to the other DrawXQuad() functions.
if (quad->material != DrawQuad::Material::kTiledContent)
if (quad->material != DrawQuad::Material::kTiledContent &&
quad->material != DrawQuad::Material::kSolidColor)
return nullptr;
// In order to concatenate the bypass'ed quads transform with RP itself, it
......@@ -1690,8 +1690,9 @@ void SkiaRenderer::DrawPictureQuad(const PictureDrawQuad* quad,
}
void SkiaRenderer::DrawSolidColorQuad(const SolidColorDrawQuad* quad,
const DrawRPDQParams* rpdq_params,
DrawQuadParams* params) {
DrawColoredQuad(quad->color, nullptr, params);
DrawColoredQuad(quad->color, rpdq_params, params);
}
void SkiaRenderer::DrawStreamVideoQuad(const StreamVideoDrawQuad* quad,
......
......@@ -174,16 +174,20 @@ class VIZ_SERVICE_EXPORT SkiaRenderer : public DirectRenderer {
SkPaint* paint,
DrawQuadParams* params);
// DebugBorder, Picture, RPDQ, and SolidColor quads cannot be batched. They
// either are not textures (debug, picture, solid color), or it's very likely
// the texture will have advanced paint effects (rpdq)
// RPDQ, DebugBorder and picture quads cannot be batched. They
// either are not textures (debug, picture), or it's very likely
// the texture will have advanced paint effects (rpdq). Additionally, they do
// not support being drawn directly for a pass-through RenderPass.
void DrawRenderPassQuad(const RenderPassDrawQuad* quad,
DrawQuadParams* params);
void DrawDebugBorderQuad(const DebugBorderDrawQuad* quad,
DrawQuadParams* params);
void DrawPictureQuad(const PictureDrawQuad* quad, DrawQuadParams* params);
// Solid-color quads are not batchable, but can be drawn directly in place of
// a RenderPass (hence it takes the optional DrawRPDQParams).
void DrawSolidColorQuad(const SolidColorDrawQuad* quad,
const DrawRPDQParams* rpdq_params,
DrawQuadParams* params);
void DrawStreamVideoQuad(const StreamVideoDrawQuad* quad,
......
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