From e6b7b083d53a875f8ba32384587b5dd7e89d8e54 Mon Sep 17 00:00:00 2001 From: Josh Simmons Date: Sun, 2 Jun 2024 12:14:59 +0200 Subject: [PATCH] shark: Use consts instead of defines in shaders --- title/shark-shaders/shaders/primitive_2d.h | 16 ++++++++-------- .../shaders/primitive_2d_bin.comp.glsl | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) 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; -- 2.49.0