From de406ef0dbbb6b7ff953e1b9a0dcdf5daee25d9b Mon Sep 17 00:00:00 2001 From: Mike Bond Date: Wed, 25 Sep 2024 13:03:48 -0700 Subject: [PATCH] Remove unneeded prepass code --- .../src/Rendering/geometryBufferRenderer.ts | 30 ++++++------------- .../dev/core/src/Shaders/geometry.fragment.fx | 26 +++++----------- .../core/src/ShadersWGSL/geometry.fragment.fx | 26 +++++----------- 3 files changed, 25 insertions(+), 57 deletions(-) diff --git a/packages/dev/core/src/Rendering/geometryBufferRenderer.ts b/packages/dev/core/src/Rendering/geometryBufferRenderer.ts index 499e1e2593e..f7c9c50da7a 100644 --- a/packages/dev/core/src/Rendering/geometryBufferRenderer.ts +++ b/packages/dev/core/src/Rendering/geometryBufferRenderer.ts @@ -673,29 +673,17 @@ export class GeometryBufferRenderer { } } - // PrePass - if (this._linkedWithPrePass) { - defines.push("#define PREPASS"); - if (this._depthIndex !== -1) { - defines.push("#define DEPTH_INDEX " + this._depthIndex); - defines.push("#define PREPASS_DEPTH"); - } - if (this._normalIndex !== -1) { - defines.push("#define NORMAL_INDEX " + this._normalIndex); - defines.push("#define PREPASS_NORMAL"); - } - } else { - if (this._enableDepth) { - defines.push("#define DEPTH"); - defines.push("#define DEPTH_INDEX " + this._depthIndex); - } - if (this._enableNormal) { - defines.push("#define NORMAL"); - defines.push("#define NORMAL_INDEX " + this._normalIndex); - } + // Buffers + if (this._enableDepth) { + defines.push("#define DEPTH"); + defines.push("#define DEPTH_INDEX " + this._depthIndex); + } + + if (this._enableNormal) { + defines.push("#define NORMAL"); + defines.push("#define NORMAL_INDEX " + this._normalIndex); } - // Buffers if (this._enablePosition) { defines.push("#define POSITION"); defines.push("#define POSITION_INDEX " + this._positionIndex); diff --git a/packages/dev/core/src/Shaders/geometry.fragment.fx b/packages/dev/core/src/Shaders/geometry.fragment.fx index b59ab478ed0..f28adb36310 100644 --- a/packages/dev/core/src/Shaders/geometry.fragment.fx +++ b/packages/dev/core/src/Shaders/geometry.fragment.fx @@ -92,24 +92,14 @@ void main() { normalOutput = normalOutput * 0.5 + 0.5; #endif - #ifdef PREPASS - #ifdef PREPASS_DEPTH - gl_FragData[DEPTH_INDEX] = vec4(vViewPos.z / vViewPos.w, 0.0, 0.0, 1.0); - #endif - - #if defined(PREPASS_NORMAL) || defined(PREPASS_WORLD_NORMAL) - gl_FragData[NORMAL_INDEX] = vec4(normalOutput, 1.0); - #endif - #else - #ifdef DEPTH - gl_FragData[DEPTH_INDEX] = vec4(vViewPos.z / vViewPos.w, 0.0, 0.0, 1.0); - #endif - #ifdef NORMAL - gl_FragData[NORMAL_INDEX] = vec4(normalOutput, 1.0); - #endif - #ifdef SCREENSPACE_DEPTH - gl_FragData[SCREENSPACE_DEPTH_INDEX] = vec4(gl_FragCoord.z, 0.0, 0.0, 1.0); - #endif + #ifdef DEPTH + gl_FragData[DEPTH_INDEX] = vec4(vViewPos.z / vViewPos.w, 0.0, 0.0, 1.0); + #endif + #ifdef NORMAL + gl_FragData[NORMAL_INDEX] = vec4(normalOutput, 1.0); + #endif + #ifdef SCREENSPACE_DEPTH + gl_FragData[SCREENSPACE_DEPTH_INDEX] = vec4(gl_FragCoord.z, 0.0, 0.0, 1.0); #endif #ifdef POSITION diff --git a/packages/dev/core/src/ShadersWGSL/geometry.fragment.fx b/packages/dev/core/src/ShadersWGSL/geometry.fragment.fx index da08698d768..f25fb980a53 100644 --- a/packages/dev/core/src/ShadersWGSL/geometry.fragment.fx +++ b/packages/dev/core/src/ShadersWGSL/geometry.fragment.fx @@ -91,24 +91,14 @@ fn main(input: FragmentInputs) -> FragmentOutputs { #endif var fragData: array, SCENE_MRT_COUNT>; - #ifdef PREPASS - #ifdef PREPASS_DEPTH - fragData[DEPTH_INDEX] = vec4f(input.vViewPos.z / input.vViewPos.w, 0.0, 0.0, 1.0); - #endif - - #if defined(PREPASS_NORMAL) || defined(PREPASS_WORLD_NORMAL) - fragData[NORMAL_INDEX] = vec4f(normalOutput, 1.0); - #endif - #else - #ifdef DEPTH - fragData[DEPTH_INDEX] = vec4f(input.vViewPos.z / input.vViewPos.w, 0.0, 0.0, 1.0); - #endif - #ifdef NORMAL - fragData[NORMAL_INDEX] = vec4f(normalOutput, 1.0); - #endif - #ifdef SCREENSPACE_DEPTH - fragData[SCREENSPACE_DEPTH_INDEX] = vec4f(fragmentInputs.position.z, 0.0, 0.0, 1.0); - #endif + #ifdef DEPTH + fragData[DEPTH_INDEX] = vec4f(input.vViewPos.z / input.vViewPos.w, 0.0, 0.0, 1.0); + #endif + #ifdef NORMAL + fragData[NORMAL_INDEX] = vec4f(normalOutput, 1.0); + #endif + #ifdef SCREENSPACE_DEPTH + fragData[SCREENSPACE_DEPTH_INDEX] = vec4f(fragmentInputs.position.z, 0.0, 0.0, 1.0); #endif #ifdef POSITION