From: Josh Simmons Date: Sun, 2 Jun 2024 10:14:59 +0000 (+0200) Subject: shark: Use consts instead of defines in shaders X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=e6b7b083d53a875f8ba32384587b5dd7e89d8e54;p=josh%2Fnarcissus shark: Use consts instead of defines in shaders --- diff --git a/title/shark-shaders/shaders/primitive_2d.h b/title/shark-shaders/shaders/primitive_2d.h index b8a3d0c..46df2fd 100644 --- a/title/shark-shaders/shaders/primitive_2d.h +++ b/title/shark-shaders/shaders/primitive_2d.h @@ -1,11 +1,11 @@ -#define TILE_SIZE 32 - -#define MAX_PRIMS (1 << 18) -#define TILE_BITMAP_L1_WORDS (MAX_PRIMS / 32 / 32) -#define TILE_BITMAP_L0_WORDS (MAX_PRIMS / 32) -#define TILE_STRIDE (TILE_BITMAP_L0_WORDS + TILE_BITMAP_L1_WORDS) -#define TILE_BITMAP_L1_OFFSET 0 -#define TILE_BITMAP_L0_OFFSET TILE_BITMAP_L1_WORDS +const uint TILE_SIZE = 32; + +const uint MAX_PRIMS = 1 << 18; +const uint TILE_BITMAP_L1_WORDS = (MAX_PRIMS / 32 / 32); +const uint TILE_BITMAP_L0_WORDS = (MAX_PRIMS / 32); +const uint TILE_STRIDE = (TILE_BITMAP_L0_WORDS + TILE_BITMAP_L1_WORDS); +const uint TILE_BITMAP_L1_OFFSET = 0; +const uint TILE_BITMAP_L0_OFFSET = TILE_BITMAP_L1_WORDS; struct PrimitiveUniforms { uvec2 screen_resolution; diff --git a/title/shark-shaders/shaders/primitive_2d_bin.comp.glsl b/title/shark-shaders/shaders/primitive_2d_bin.comp.glsl index 6ac6edc..12ddab4 100644 --- a/title/shark-shaders/shaders/primitive_2d_bin.comp.glsl +++ b/title/shark-shaders/shaders/primitive_2d_bin.comp.glsl @@ -10,8 +10,8 @@ #include "primitive_2d.h" -#define SUBGROUP_SIZE 64 -#define NUM_PRIMS_WG (SUBGROUP_SIZE * 32) +const uint SUBGROUP_SIZE = 64; +const uint NUM_PRIMS_WG = (SUBGROUP_SIZE * 32); // TODO: Spec constant support for different subgroup sizes. layout (local_size_x = SUBGROUP_SIZE, local_size_y = 1, local_size_z = 1) in;