Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGLRenderer: Remove gl_FragDepthEXT. #27853

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -3,7 +3,7 @@ export default /* glsl */`

// Doing a strict comparison with == 1.0 can cause noise artifacts
// on some platforms. See issue #17623.
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;

#endif
`;
1 change: 0 additions & 1 deletion src/renderers/webgl/WebGLProgram.js
Expand Up @@ -881,7 +881,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
'#define varying in',
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
'#define gl_FragDepthEXT gl_FragDepth',
'#define texture2D texture',
'#define textureCube texture',
'#define texture2DProj textureProj',
Expand Down
5 changes: 2 additions & 3 deletions src/renderers/webxr/WebXRDepthSensing.js
Expand Up @@ -21,11 +21,11 @@ void main() {

if ( coord.x >= 1.0 ) {

gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

} else {

gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

}

Expand Down Expand Up @@ -73,7 +73,6 @@ class WebXRDepthSensing {

const viewport = cameraXR.cameras[ 0 ].viewport;
const material = new ShaderMaterial( {
extensions: { fragDepth: true },
vertexShader: _occlusion_vertex,
fragmentShader: _occlusion_fragment,
uniforms: {
Expand Down