From 206aa8d312758f616059f60d6c49908e65c0046c Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Tue, 5 Mar 2024 12:45:20 -0800 Subject: [PATCH] Provide all uniforms to cull shaders --- .../flywheel/backend/compile/IndirectPrograms.java | 1 + .../flywheel/flywheel/internal/indirect/cull.glsl | 5 +---- .../flywheel/internal/indirect/cull_header.glsl | 12 +++--------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java b/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java index 01d862024..8a1aca276 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java +++ b/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java @@ -84,6 +84,7 @@ public class IndirectPrograms extends AtomicReferenceCounted { .withResource(CULL_SHADER_MAIN)) .postLink((key, program) -> { program.setUniformBlockBinding("_FlwFrameUniforms", Uniforms.FRAME_INDEX); + program.setUniformBlockBinding("_FlwFogUniforms", Uniforms.FOG_INDEX); program.setUniformBlockBinding("_FlwOptionsUniforms", Uniforms.OPTIONS_INDEX); program.setUniformBlockBinding("_FlwPlayerUniforms", Uniforms.PLAYER_INDEX); program.setUniformBlockBinding("_FlwLevelUniforms", Uniforms.LEVEL_INDEX); diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl b/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl index a87ad7b13..6b50a358a 100644 --- a/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl +++ b/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl @@ -1,10 +1,7 @@ #include "flywheel:internal/indirect/buffers.glsl" #include "flywheel:internal/indirect/model_descriptor.glsl" #include "flywheel:internal/indirect/object.glsl" -#include "flywheel:internal/uniforms/frame.glsl" -#include "flywheel:internal/uniforms/options.glsl" -#include "flywheel:internal/uniforms/player.glsl" -#include "flywheel:internal/uniforms/level.glsl" +#include "flywheel:internal/uniforms/uniforms.glsl" #include "flywheel:util/matrix.glsl" layout(local_size_x = _FLW_SUBGROUP_SIZE) in; diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_header.glsl b/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_header.glsl index 11258adb9..436db261b 100644 --- a/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_header.glsl +++ b/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_header.glsl @@ -1,9 +1,3 @@ -#include "flywheel:internal/uniforms/frame.glsl" - -// Fog doesn't seem like a valid thing to query during the cull pass. Other uniforms added in the -// future may also be excluded, and we'll have to document each one. -// #include "flywheel:internal/uniforms/fog.glsl" - -#include "flywheel:internal/uniforms/options.glsl" -#include "flywheel:internal/uniforms/player.glsl" -#include "flywheel:internal/uniforms/level.glsl" +// Cull shaders may not need all uniforms, but it is +// more consistent if we just provide all uniforms anyways. +#include "flywheel:internal/uniforms/uniforms.glsl"