fix(shadertools): Add 'invariant' to fp64 varyings, partially fix issue on Apple GPUs (#1882)

This commit is contained in:
Don McCurdy 2023-12-15 14:46:42 -05:00 committed by GitHub
parent adb6c17aae
commit a46cf83803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,11 +11,16 @@ import {fp64, fp64arithmetic} from '@luma.gl/shadertools';
import {equals, config} from '@math.gl/core';
const {fp64ify} = fp64;
// Use 'invariant' specifier to work around some issues on Apple GPUs. The
// specifier may or may not have an effect, depending on the browser and the
// ANGLE backend, but it's an improvement when it's supported.
// See: https://github.com/visgl/luma.gl/issues/1764
function getBinaryShader(operation: string): string {
const shader = `\
attribute vec2 a;
attribute vec2 b;
varying vec2 result;
invariant varying vec2 result;
void main(void) {
result = ${operation}(a, b);
}
@ -27,7 +32,7 @@ function getUnaryShader(operation: string): string {
return `\
attribute vec2 a;
attribute vec2 b;
varying vec2 result;
invariant varying vec2 result;
void main(void) {
result = ${operation}(a);
}