Commit ac2b2c65 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

viz: Use texture clamping shader always

https://chromium-review.googlesource.com/c/chromium/src/+/883944
restricted how often we would use shaders that clamped tex coords.
However, this confusingly regressed perf a little bit on Android,
which implies that program switching is expensive.

This patch changes GLRenderer to always texture clamp these quads
which reduces the number of shaders we use.

Bug: 806836,806826
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I2b2e71b362d6a12f17758abe2edddf1759536016
Reviewed-on: https://chromium-review.googlesource.com/972546Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547780}
parent c8d6a20b
...@@ -1949,15 +1949,18 @@ void GLRenderer::DrawContentQuadNoAA(const ContentDrawQuadBase* quad, ...@@ -1949,15 +1949,18 @@ void GLRenderer::DrawContentQuadNoAA(const ContentDrawQuadBase* quad,
!quad->IsRightEdge() || texture_size.width() == tex_coord_rect.right(); !quad->IsRightEdge() || texture_size.width() == tex_coord_rect.right();
bool fills_bottom_edge = bool fills_bottom_edge =
!quad->IsBottomEdge() || texture_size.height() == tex_coord_rect.bottom(); !quad->IsBottomEdge() || texture_size.height() == tex_coord_rect.bottom();
bool has_tex_clamp_rect = bool has_tex_clamp_rect = true;
filter == GL_LINEAR && (!fills_right_edge || !fills_bottom_edge);
gfx::SizeF tex_clamp_size(texture_size); gfx::SizeF tex_clamp_size(texture_size);
// Clamp from the original tex coord rect, instead of the one that has // Clamp from the original tex coord rect, instead of the one that has
// been adjusted by the visible rect. // been adjusted by the visible rect. Nearest neighbor should never be
if (!fills_right_edge) // clamped. However, still specify a tex clamp rect so that we don't
tex_clamp_size.set_width(quad->tex_coord_rect.right() - 0.5f); // thrash shaders.
if (!fills_bottom_edge) if (filter == GL_LINEAR) {
tex_clamp_size.set_height(quad->tex_coord_rect.bottom() - 0.5f); if (!fills_right_edge)
tex_clamp_size.set_width(quad->tex_coord_rect.right() - 0.5f);
if (!fills_bottom_edge)
tex_clamp_size.set_height(quad->tex_coord_rect.bottom() - 0.5f);
}
// Map to normalized texture coordinates. // Map to normalized texture coordinates.
if (sampler != SAMPLER_TYPE_2D_RECT) { if (sampler != SAMPLER_TYPE_2D_RECT) {
......
...@@ -111,3 +111,17 @@ class PixelExpectations(GpuTestExpectations): ...@@ -111,3 +111,17 @@ class PixelExpectations(GpuTestExpectations):
['linux', 'mac', 'win'], bug=744658) ['linux', 'mac', 'win'], bug=744658)
self.Fail('Pixel_CSS3DBlueBox_NoGpuProcess', self.Fail('Pixel_CSS3DBlueBox_NoGpuProcess',
['linux', 'mac', 'win'], bug=744658) ['linux', 'mac', 'win'], bug=744658)
# TODO(enne): temporarily suppress these tests until rebaselined.
self.Fail('Pixel_2DCanvasWebGL', ['android'], bug=972546)
self.Fail('Pixel_Canvas2DRedBox', ['android'], bug=972546)
self.Fail('Pixel_CanvasDisplayLinearRGBAccelerated2D',
['android'], bug=972546)
self.Fail('Pixel_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing',
['android'], bug=972546)
self.Fail('Pixel_WebGLGreenTriangle_AA_Alpha', ['android'], bug=972546)
self.Fail('Pixel_WebGLGreenTriangle_AA_NoAlpha', ['android'], bug=972546)
self.Fail('Pixel_WebGLGreenTriangle_NoAA_Alpha', ['android'], bug=972546)
self.Fail('Pixel_WebGLGreenTriangle_NoAA_NoAlpha', ['android'], bug=972546)
self.Fail('Pixel_WebGLTransparentGreenTriangle_NoAlpha_ImplicitClear',
['android'], bug=972546)
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