mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-12 05:18:49 +00:00
It seems alignas() is C11 and raylib is C99, so not fully supported #5312
Added a workaround but it has other probably undesired implications
This commit is contained in:
21
src/external/rlsw.h
vendored
21
src/external/rlsw.h
vendored
@@ -610,11 +610,19 @@ SWAPI void swBindTexture(uint32_t id);
|
||||
#define RLSW_IMPLEMENTATION
|
||||
#if defined(RLSW_IMPLEMENTATION)
|
||||
|
||||
#include <stdalign.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <math.h> // Required for: floorf(), fabsf()
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define ALIGNAS(x) __declspec(align(x))
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define ALIGNAS(x) __attribute__((aligned(x)))
|
||||
#else
|
||||
#include <stdalign.h>
|
||||
#define ALIGNAS(x) alignas(x)
|
||||
#endif
|
||||
|
||||
#if defined(__FMA__) && defined(__AVX2__)
|
||||
#define SW_HAS_FMA_AVX2
|
||||
#include <immintrin.h>
|
||||
@@ -687,8 +695,8 @@ SWAPI void swBindTexture(uint32_t id);
|
||||
#define SW_DEG2RAD (SW_PI/180.0f)
|
||||
#define SW_RAD2DEG (180.0f/SW_PI)
|
||||
|
||||
#define SW_COLOR_PIXEL_SIZE (SW_COLOR_BUFFER_BITS/8)
|
||||
#define SW_DEPTH_PIXEL_SIZE (SW_DEPTH_BUFFER_BITS/8)
|
||||
#define SW_COLOR_PIXEL_SIZE 4 //(SW_COLOR_BUFFER_BITS >> 3)
|
||||
#define SW_DEPTH_PIXEL_SIZE (SW_DEPTH_BUFFER_BITS >> 3)
|
||||
|
||||
#if (SW_COLOR_BUFFER_BITS == 8)
|
||||
#define SW_COLOR_TYPE uint8_t
|
||||
@@ -817,14 +825,15 @@ typedef struct {
|
||||
float ty; // Texel height
|
||||
} sw_texture_t;
|
||||
|
||||
typedef struct {
|
||||
alignas(SW_COLOR_PIXEL_SIZE)
|
||||
// Pixel data type
|
||||
// WARNING: ALIGNAS() macro requires a constant value (not operand)
|
||||
typedef ALIGNAS(SW_COLOR_PIXEL_SIZE) struct {
|
||||
SW_COLOR_TYPE color[SW_COLOR_PACK_COMP];
|
||||
SW_DEPTH_TYPE depth[SW_DEPTH_PACK_COMP];
|
||||
} sw_pixel_t;
|
||||
|
||||
typedef struct {
|
||||
sw_pixel_t* pixels;
|
||||
sw_pixel_t *pixels;
|
||||
int width;
|
||||
int height;
|
||||
int allocSz;
|
||||
|
||||
Reference in New Issue
Block a user