Closed tgorkin closed 2 months ago
Can you try removing the #extension lines from the pbr module? It looks like they're being included twice (once in platform defines and once in the PBR module).
CC: @ibgreen
I did following changes:
platform-defines
to :
#extension EXT_name : ...
#ifdef EXT_name
...
#endif
#extension ..
directives from pbr module fragment shader branch: https://github.com/uber/luma.gl/tree/ExtenionDerivates
With above two changes, I see two issues :
npm run test-node
, glft tests are failing due to this GLSL compile error :
ERROR: 'GL_OES_standard_derivatives' : extension is disabled
its because, gl.getExtension('OES_standard_derivatives')
returns false and we don't add corresponding #extension to the shader source. But if I add the #extension directive, all the tests passERROR: 'GL_EXT_draw_buffers' : extension is not supported
This is because of re-ordering, we are enabling extension with #extension GL_EXT_draw_buffers : require
, but now we are enabling it before #ifdef
, I changed it to #extension GL_EXT_draw_buffers : enable
, and don't see any errors and all the tests pass.So the remaining issue here is, why under node, OES_standard_derivatives
reported as un-supported, but still works when those derivates added without checking. Opened an issue for stackgl repo : https://github.com/stackgl/headless-gl/issues/169
I came across this exact issue in the simple-mesh-layer: https://github.com/uber/deck.gl/blob/master/modules/mesh-layers/src/simple-mesh-layer/simple-mesh-layer-fragment.glsl1.js#L4
Not sure if it's useful, but ran into a similar issue when updating from Node 14 to Node 16. Running yarn install
rebuilt gl
and canvas
because its dependency tree changed.
*@luma.gl/core
, @luma.gl/gltools
, @luma.gl/test-utils
at version 8.5.7
.
gl@4.9.2
canvas@2.8.0
Started getting these sorts of errors in our units tests (weren't there before):
luma.gl: GLSL compilation errors in fragment shader triangle-layer-fragment-shader-1
13: # define FEATURE_GLSL_DRAW_BUFFERS
14: # define FEATURE_GLSL_FRAG_DEPTH
15: # define FEATURE_GLSL_TEXTURE_LOD
^^^ ERROR: Invalid call of 'texture' (not a function or subroutine uniform)
16:
^^^ ERROR: Use of undeclared identifier 'color'
17: // DEPRECATED FLAGS, remove in v9
^^^ ERROR: Use of undeclared identifier 'color'
18: # define FRAG_DEPTH
19: # define DERIVATIVES
20: # define DRAW_BUFFERS
^^^ ERROR: Invalid call of 'texture' (not a function or subroutine uniform)
21: # define TEXTURE_LOD
^^^ ERROR: Use of undeclared identifier 'weights'
22:
23: #endif // __VERSION
24:
^^^ ERROR: Use of undeclared identifier 'weights'
25: // DERIVATIVES => dxdF, dxdY and fwidth are available
26: #ifdef GL_OES_standard_derivatives
^^^ ERROR: Use of undeclared identifier 'weight'
28: # define FEATURE_GLSL_DERIVATIVES
29: # define DERIVATIVES
30: #endif
^^^ ERROR: Use of undeclared identifier 'weight'
31:
^^^ ERROR: Use of undeclared identifier 'linearColor'
32: // DRAW_BUFFERS => gl_FragData[] is available
^^^ ERROR: Use of undeclared identifier 'linearColor'
at FragmentShader._compile (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/src/classes/shader.js:100:7)
at FragmentShader.initialize (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/src/classes/shader.js:50:10)
at new Shader (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/src/classes/shader.js:42:10)
at FragmentShader._createSuperInternal (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/dist/es5/classes/shader.js:30:311)
at new FragmentShader (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/src/classes/shader.js:134:26)
at Program.initialize (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/src/classes/program.js:66:32)
at new Program (../../.yarn/cache/@luma.gl-webgl-npm-8.5.7-3307986865-3f503fe9e5.zip/node_modules/@luma.gl/webgl/src/classes/program.js:50:10)
at ProgramManager.get (../../.yarn/cache/@luma.gl-engine-npm-8.5.7-7dbc6eddfa-cbe76abe56.zip/node_modules/@luma.gl/engine/src/lib/program-manager.js:101:34)
Actual Result
Running browser tests (both headless and normal) results in unit test failure on gltf loading test due to a GLSL compilation error:
Logging the composited shader code, it appears that the issue is that #exension directives in the pbr-fragement.glsl.js are being added in after the initial #defines and #extension directives setup in platform-defines.js.
In addition, after some review from @ibgreen, it looks like the #extension definitions in the prologue are possible incorrect, per this stack overflow thread.
Full source of composited shader:
Expected Result
Automated tests run without failure.
Reproduce Steps
I am able to reproduce this by running
yarn test
oryarn test-browser
. This seems to not be occurring for other team members. Possible that my Chromium/puppeteer version is different or driver version?To Do List