From 7f9e48dc8f428adbe9d64270aec354b81af4a659 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 9 Jul 2019 10:26:05 -0400 Subject: [PATCH] Workaround bugs in old ANGLE versions. --- webrender/res/brush_blend.glsl | 13 +++++++++---- webrender/res/cs_border_solid.glsl | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/webrender/res/brush_blend.glsl b/webrender/res/brush_blend.glsl index 3d317baf03..c07785b4ad 100644 --- a/webrender/res/brush_blend.glsl +++ b/webrender/res/brush_blend.glsl @@ -204,7 +204,7 @@ vec4 ComponentTransfer(vec4 colora) { case COMPONENT_TRANSFER_IDENTITY: break; case COMPONENT_TRANSFER_TABLE: - case COMPONENT_TRANSFER_DISCRETE: + case COMPONENT_TRANSFER_DISCRETE: { // fetch value from lookup table k = int(floor(colora[i]*255.0)); texel = fetch_from_gpu_cache_1(vTableAddress + offset + k/4); @@ -212,20 +212,23 @@ vec4 ComponentTransfer(vec4 colora) { // offset plus 256/4 blocks offset = offset + 64; break; - case COMPONENT_TRANSFER_LINEAR: + } + case COMPONENT_TRANSFER_LINEAR: { // fetch the two values for use in the linear equation texel = fetch_from_gpu_cache_1(vTableAddress + offset); colora[i] = clamp(texel[0] * colora[i] + texel[1], 0.0, 1.0); // offset plus 1 block offset = offset + 1; break; - case COMPONENT_TRANSFER_GAMMA: + } + case COMPONENT_TRANSFER_GAMMA: { // fetch the three values for use in the gamma equation texel = fetch_from_gpu_cache_1(vTableAddress + offset); colora[i] = clamp(texel[0] * pow(colora[i], texel[1]) + texel[2], 0.0, 1.0); // offset plus 1 block offset = offset + 1; break; + } default: // shouldn't happen break; @@ -264,12 +267,14 @@ Fragment brush_fs() { case 12: color = LinearToSrgb(color); break; - case 13: // Component Transfer + case 13: { + // Component Transfer vec4 colora = alpha != 0.0 ? Cs / alpha : Cs; colora = ComponentTransfer(colora); color = colora.rgb; alpha = colora.a; break; + } case 14: // Flood color = vFloodColor.rgb; alpha = vFloodColor.a; diff --git a/webrender/res/cs_border_solid.glsl b/webrender/res/cs_border_solid.glsl index 10d627e95a..8317ff80ba 100644 --- a/webrender/res/cs_border_solid.glsl +++ b/webrender/res/cs_border_solid.glsl @@ -93,9 +93,10 @@ void main(void) { case SEGMENT_TOP_LEFT: case SEGMENT_TOP_RIGHT: case SEGMENT_BOTTOM_RIGHT: - case SEGMENT_BOTTOM_LEFT: + case SEGMENT_BOTTOM_LEFT: { mix_colors = do_aa ? MIX_AA : MIX_NO_AA; break; + } default: mix_colors = DONT_MIX; break;