Fix alignments

This commit is contained in:
Luke Benstead 2023-03-06 13:44:17 +00:00
parent f0a3465486
commit a9f3e3a744
3 changed files with 8 additions and 6 deletions

View File

@ -100,7 +100,7 @@ GL_FORCE_INLINE void _glSubmitHeaderOrVertex(const Vertex* v) {
d += 8; d += 8;
} }
static struct { static struct __attribute__((aligned(32))) {
Vertex* v; Vertex* v;
int visible; int visible;
} triangle[3]; } triangle[3];
@ -182,6 +182,8 @@ GL_FORCE_INLINE void ShiftRotateTriangle() {
#define SPAN_SORT_CFG 0x005F8030 #define SPAN_SORT_CFG 0x005F8030
void SceneListSubmit(void* src, int n) { void SceneListSubmit(void* src, int n) {
Vertex __attribute__((aligned(32))) tmp;
/* Do everything, everywhere, all at once */ /* Do everything, everywhere, all at once */
PVR_SET(SPAN_SORT_CFG, 0x0); PVR_SET(SPAN_SORT_CFG, 0x0);

View File

@ -251,7 +251,7 @@ typedef struct {
* when a realloc could invalidate pointers. This structure holds all the information * when a realloc could invalidate pointers. This structure holds all the information
* we need on the target vertex array to allow passing around to the various stages (e.g. generate/clip etc.) * we need on the target vertex array to allow passing around to the various stages (e.g. generate/clip etc.)
*/ */
typedef struct { typedef struct __attribute__((aligned(32))) {
PolyList* output; PolyList* output;
uint32_t header_offset; // The offset of the header in the output list uint32_t header_offset; // The offset of the header in the output list
uint32_t start_offset; // The offset into the output list uint32_t start_offset; // The offset into the output list

View File

@ -25,10 +25,10 @@ static inline void* memalign(size_t alignment, size_t size) {
#endif #endif
typedef struct { typedef struct {
unsigned int size; uint8_t* __attribute__((aligned(32))) data;
unsigned int capacity; uint32_t size;
unsigned char* data; uint32_t capacity;
unsigned int element_size; uint32_t element_size;
} AlignedVector; } AlignedVector;
#define ALIGNED_VECTOR_CHUNK_SIZE 256u #define ALIGNED_VECTOR_CHUNK_SIZE 256u