From 132c6aa2e8c2908821d3a18437906640ccbbf779 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Sat, 12 Jul 2025 18:48:25 +1000 Subject: [PATCH] thing --- .../java/me/cortex/voxy/client/core/gl/GlTexture.java | 2 +- src/main/resources/assets/voxy/shaders/hiz/blit.fsh | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java b/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java index 04075744..ccf3391e 100644 --- a/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java +++ b/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java @@ -101,7 +101,7 @@ public class GlTexture extends TrackedObject { private long getEstimatedSize() { this.assertAllocated(); long elemSize = switch (this.format) { - case GL_RGBA8, GL_DEPTH24_STENCIL8 -> 4; + case GL_RGBA8, GL_DEPTH24_STENCIL8, GL_R32F -> 4; case GL_DEPTH_COMPONENT24 -> 4;//TODO: check this is right???? case GL_DEPTH_COMPONENT32F -> 4; case GL_DEPTH_COMPONENT32 -> 4; diff --git a/src/main/resources/assets/voxy/shaders/hiz/blit.fsh b/src/main/resources/assets/voxy/shaders/hiz/blit.fsh index 80b346b4..9b255a3a 100644 --- a/src/main/resources/assets/voxy/shaders/hiz/blit.fsh +++ b/src/main/resources/assets/voxy/shaders/hiz/blit.fsh @@ -3,6 +3,9 @@ layout(location = 0) in vec2 uv; layout(binding = 0) uniform sampler2D depthTex; +#ifdef OUTPUT_COLOUR +layout(location=0) out vec4 colour; +#endif void main() { vec4 depths = textureGather(depthTex, uv, 0); // Get depth values from all surrounding texels. @@ -10,6 +13,11 @@ void main() { if (any(cv)) {//Patch holes (its very dodgy but should work :tm:, should clamp it to the first 3 levels) depths = mix(vec4(0.0f), depths, cv); } + float res = max(max(depths.x, depths.y), max(depths.z, depths.w)); - gl_FragDepth = max(max(depths.x, depths.y), max(depths.z, depths.w)); // Write conservative depth. + #ifdef OUTPUT_COLOUR + colour = vec4(res); + #else + gl_FragDepth = res; // Write conservative depth. + #endif }