Bug 1594128 - Work around Mac GLSL compiler bug. r=kvark

See https://github.com/servo/webrender/wiki/Driver-issues#bug-1594128---glsl-on-macos-is-confused-by-a-function-that-just-returns-a-constant

Differential Revision: https://phabricator.services.mozilla.com/D54691

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2019-11-27 15:14:58 +00:00
Родитель 109faa3808
Коммит 51820a0f00
1 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -115,12 +115,6 @@ void multi_brush_vs(
#define INVALID_SEGMENT_INDEX 0xffff
#ifndef WR_FEATURE_MULTI_BRUSH
int vecs_per_brush(int brush_kind) {
return VECS_PER_SPECIFIC_BRUSH;
}
#endif
void main(void) {
// Load the brush instance from vertex attributes.
Instance instance = decode_instance_attributes();
@ -135,8 +129,18 @@ void main(void) {
segment_rect = ph.local_rect;
segment_data = vec4(0.0);
} else {
// This contraption is needed by the Mac GLSL compiler which falls
// over (generating garbage values) if:
// - we use a variable insead of the ACTUAL_VECS_PER_BRUSH define,
// - this compile time condition is done inside of vecs_per_brush.
#ifdef WR_FEATURE_MULTI_BRUSH
#define ACTUAL_VECS_PER_BRUSH vecs_per_brush(instance.brush_kind)
#else
#define ACTUAL_VECS_PER_BRUSH VECS_PER_SPECIFIC_BRUSH
#endif
int segment_address = ph.specific_prim_address +
vecs_per_brush(instance.brush_kind) +
ACTUAL_VECS_PER_BRUSH +
instance.segment_index * VECS_PER_SEGMENT;
vec4[2] segment_info = fetch_from_gpu_cache_2(segment_address);