зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1700693 - Fix shader compilation errors on Adreno. r=jrmuizel
Some of the unoptimized shaders fail to compile on Adreno devices, likely due to driver bugs. We have not noticed this until now because the optimized versions compile successfully. The first bug appears to be caused by a macro with an empty argument list. No argument list or a non-empty argument list works fine, but an empty argument list causes an error. The second issue occurs when a sampler is used as an argument to a function. Using a macro instead works around the bug. Differential Revision: https://phabricator.services.mozilla.com/D109773
This commit is contained in:
Родитель
585c3dd0d5
Коммит
594e13f33b
|
@ -210,11 +210,13 @@ void main(void) {
|
|||
|
||||
#ifdef WR_FRAGMENT_SHADER
|
||||
|
||||
float antialias_brush() {
|
||||
#if (defined(WR_FEATURE_ALPHA_PASS) || defined(WR_FEATURE_ANTIALIASING)) && !defined(SWGL_ANTIALIAS)
|
||||
#define antialias_brush() init_transform_fs(v_local_pos)
|
||||
return init_transform_fs(v_local_pos);
|
||||
#else
|
||||
#define antialias_brush() 1.0
|
||||
return 1.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Fragment brush_fs();
|
||||
|
||||
|
|
|
@ -40,17 +40,8 @@
|
|||
// textureSize(samplerExternalOES) in a vertex shader without potentially
|
||||
// sampling from the texture. This tricks the driver in to thinking the texture
|
||||
// may be sampled from, avoiding the crash. See bug 1692848.
|
||||
uniform float u_mali_workaround_dummy;
|
||||
highp ivec2 textureSizeMaliWorkaround(samplerExternalOES sampler, int lod) {
|
||||
// The uniform's default value is 0.0, so we'll never take this branch. If we
|
||||
// used a constant instead of a uniform then the compiler would optimize this
|
||||
// out, and the workaround wouldn't work.
|
||||
if (u_mali_workaround_dummy != 0.0) {
|
||||
return ivec2(texture(sampler, vec2(0.0, 0.0)).rr);
|
||||
}
|
||||
return textureSize(sampler, lod);
|
||||
}
|
||||
#define TEX_SIZE(sampler) textureSizeMaliWorkaround(sampler, 0)
|
||||
uniform bool u_mali_workaround_dummy;
|
||||
#define TEX_SIZE(sampler) (u_mali_workaround_dummy ? ivec2(texture(sampler, vec2(0.0, 0.0)).rr) : textureSize(sampler, 0))
|
||||
#else
|
||||
#define TEX_SIZE(sampler) textureSize(sampler, 0)
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче