@@ -71,10 +71,7 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
7171 .add (ShaderType .COMPUTE , "voxy:lod/gl46/prep.comp" )
7272 .compile ();
7373
74- private final Shader cullShader = Shader .make ()
75- .add (ShaderType .VERTEX , "voxy:lod/gl46/cull/raster.vert" )
76- .add (ShaderType .FRAGMENT , "voxy:lod/gl46/cull/raster.frag" )
77- .compile ();
74+ private final Shader cullShader ;
7875
7976 private final Shader prefixSumShader = Shader .make ()
8077 //Use subgroup prefix sum if possible otherwise use dodgy... slow prefix sum
@@ -132,6 +129,19 @@ public MDICSectionRenderer(AbstractRenderPipeline pipeline, ModelStore modelStor
132129 translucentFrag = translucentFrag ==null ?frag :translucentFrag ;
133130
134131 this .translucentTerrainShader = tryCompilePatchedOrNormal (builder .define ("TRANSLUCENT" ), translucentFrag , frag );
132+
133+ if (this .pipeline .hasTAA ()) {
134+ this .cullShader = Shader .make ()
135+ .addSource (ShaderType .VERTEX , ShaderLoader .parse ("voxy:lod/gl46/cull/raster.vert" )+"\n \n \n \n " +pipeline .taaFunction ("getTAA" ))
136+ .define ("TAA" )
137+ .add (ShaderType .FRAGMENT , "voxy:lod/gl46/cull/raster.frag" )
138+ .compile ();
139+ } else {
140+ this .cullShader = Shader .make ()
141+ .add (ShaderType .VERTEX , "voxy:lod/gl46/cull/raster.vert" )
142+ .add (ShaderType .FRAGMENT , "voxy:lod/gl46/cull/raster.frag" )
143+ .compile ();
144+ }
135145 }
136146
137147 private void uploadUniformBuffer (MDICViewport viewport ) {
@@ -261,6 +271,7 @@ public void buildDrawCalls(MDICViewport viewport) {
261271 GPUTiming .INSTANCE .marker ("OT" );
262272 {//Test occlusion
263273 this .cullShader .bind ();
274+ if (this .pipeline .hasTAA ()) this .pipeline .bindUniforms ();//Used for shader TAA
264275 if (Capabilities .INSTANCE .repFragTest ) {
265276 glEnable (GL_REPRESENTATIVE_FRAGMENT_TEST_NV );
266277 }
@@ -272,6 +283,7 @@ public void buildDrawCalls(MDICViewport viewport) {
272283 glBindBuffer (GL_DRAW_INDIRECT_BUFFER , viewport .drawCountCallBuffer .id );
273284 glBindBuffer (GL_ELEMENT_ARRAY_BUFFER , SharedIndexBuffer .INSTANCE .id ());
274285 glEnable (GL_DEPTH_TEST );
286+ glDepthFunc (GL_LEQUAL );
275287 glColorMask (false , false , false , false );
276288 glDepthMask (false );
277289 glMemoryBarrier (GL_SHADER_STORAGE_BARRIER_BIT |GL_COMMAND_BARRIER_BIT );
0 commit comments