From c13b7637c563255d5cec58daf38be25e9533efd0 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 19 Jan 2024 11:52:09 -0800 Subject: [PATCH] Scull - Add header to define uniforms/other api variables for the cull shader. --- .../jozufozu/flywheel/backend/compile/IndirectPrograms.java | 2 ++ .../flywheel/flywheel/internal/indirect/cull_header.glsl | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_header.glsl 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 efe310bcc..347418515 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java +++ b/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java @@ -22,6 +22,7 @@ import com.jozufozu.flywheel.backend.glsl.SourceComponent; import net.minecraft.resources.ResourceLocation; public class IndirectPrograms extends AbstractPrograms { + private static final ResourceLocation CULL_SHADER_HEADER = Flywheel.rl("internal/indirect/cull_header.glsl"); private static final ResourceLocation CULL_SHADER_MAIN = Flywheel.rl("internal/indirect/cull.glsl"); private static final ResourceLocation APPLY_SHADER_MAIN = Flywheel.rl("internal/indirect/apply.glsl"); private static final ResourceLocation SCATTER_SHADER_MAIN = Flywheel.rl("internal/indirect/scatter.glsl"); @@ -74,6 +75,7 @@ public class IndirectPrograms extends AbstractPrograms { return CULL.program() .link(CULL.shader(GlslVersion.V460, ShaderType.COMPUTE) .define("_FLW_SUBGROUP_SIZE", GlCompat.SUBGROUP_SIZE) + .withResource(CULL_SHADER_HEADER) .withComponent(IndirectComponent::create) .withResource(InstanceType::cullShader) .withResource(CULL_SHADER_MAIN)) 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 new file mode 100644 index 000000000..64124d01a --- /dev/null +++ b/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_header.glsl @@ -0,0 +1,5 @@ +#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"