]> git.nega.tv - josh/narcissus/commitdiff
shark-shaders: Add special-case for single element tiles
authorJoshua Simmons <josh@nega.tv>
Sun, 19 Oct 2025 14:10:09 +0000 (16:10 +0200)
committerJoshua Simmons <josh@nega.tv>
Sun, 19 Oct 2025 14:10:26 +0000 (16:10 +0200)
title/shark-shaders/shaders/draw_2d.slang

index e62a01fb45f0a0d5c4dd69f72531d763ff412493..67509de1458b9ec2ea20e42ff3f8f6db29902610 100644 (file)
@@ -526,7 +526,8 @@ void rasterize(uniform RasterizeConstants constants, uint3 thread_id: SV_Dispatc
 
 #if DEBUG_SHOW_TILES == 1
 
-    let color = plasma_quintic(float(hi - lo) / 16.0);
+    let count = hi - lo;
+    let color = count > 1 ? plasma_quintic(float(count) / 16.0) : float3(0.0);
     ui_layer.Store(position, float4(color, 1.0));
 
 #elif DEBUG_SHOW_TILES == 2
@@ -535,7 +536,7 @@ void rasterize(uniform RasterizeConstants constants, uint3 thread_id: SV_Dispatc
     for (uint i = lo; i < hi; i++) {
         count += countbits(constants.fine_buffer[i]);
     }
-    let color = count == 1 ? float3(1.0, 0.0, 0.0) : plasma_quintic(float(count) / 300.0);
+    let color = count == 1 ? float3(0.0) : plasma_quintic(float(count) / 300.0);
     ui_layer.Store(position, float4(color, 1.0));
 
 #else