diff options
| author | onelin <oscar@nelin.dk> | 2025-11-29 23:41:01 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-12-18 21:14:17 +0000 |
| commit | 4039166875da65715e8c49d334638dc9dd1d5f7b (patch) | |
| tree | a2a8e93c8e53bfd0cf52e3c4b76882585decc36e /src/include | |
| parent | 4ff11620fff7d6b62e6ad57421c3ec1878aa8080 (diff) | |
Fix retrieving texture dimensions instead of format
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/daw/rendering.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/include/daw/rendering.h b/src/include/daw/rendering.h index a26310e..d9ad6c1 100644 --- a/src/include/daw/rendering.h +++ b/src/include/daw/rendering.h @@ -208,14 +208,14 @@ typedef enum { // Buffer parameter: Frame buffer // Buffer parameter: Texture buffer -#define BUFFERPARAMETER_TEXTURE_GET_DIMENSION(bufferparam) (BUFFERPARAMETER_GET_PARAMETER(bufferparam) & 7) +#define BUFFERPARAMETER_TEXTURE_GET_DIMENSION(bufferparam) (BUFFERPARAMETER_GET_PARAMETER(bufferparam) & ((1 << 3) - 1)) #define BUFFERPARAMETER_TEXTURE_1D 1 #define BUFFERPARAMETER_TEXTURE_2D 2 #define BUFFERPARAMETER_TEXTURE_3D 3 #define BUFFERPARAMETER_TEXTURE_4D 4 // TODO: Change `2` once we add support for more formats -#define BUFFERPARAMETER_TEXTURE_GET_FORMAT(bufferparam) (BUFFERPARAMETER_GET_PARAMETER(bufferparam) >> 3 & 2) +#define BUFFERPARAMETER_TEXTURE_GET_FORMAT(bufferparam) (BUFFERPARAMETER_GET_PARAMETER(bufferparam) & (((1 << 2) - 1) << 3)) #define BUFFERPARAMETER_TEXTURE_FMT_RGBA8 (1 << 4) #define BUFFERPARAMETER_TEXTURE_FMT_SRGB8 (2 << 4) #define BUFFERPARAMETER_TEXTURE_FMT_SRGBA8 (3 << 4) @@ -234,12 +234,13 @@ typedef enum { #define BUFFERPARAMETER_GET_TYPE(bufferparam) \ (BufferType)(bufferparam & BUFFERPARAMETER_MASK_TYPE) #define BUFFERPARAMETER_GET_PARAMETER(bufferparam) \ - ((bufferparam & BUFFERPARAMETER_MASK_TYPE) >> 4) + ((bufferparam & BUFFERPARAMETER_MASK_PARAMETER) >> 4) +// SET operations clear the masked bits that you're setting #define BUFFERPARAMETER_SET_TYPE(bufferparam, type) \ (BufferType)((bufferparam & ~BUFFERPARAMETER_MASK_TYPE) | type) #define BUFFERPARAMETER_SET_PARAMETER(bufferparam, param) \ - ((bufferparam & ~BUFFERPARAMETER_MASK_PARAMETER) | (param << 4)) + ((bufferparam & ~BUFFERPARAMETER_MASK_PARAMETER) | ((param) << 4)) typedef struct { i32 num_attached_buffers; |
