[qfcc] Use GPU-style alignment for algebra types

Meaning vec3 is aligned to 4 components instead of 1. 2-component ops
use vec2 in the VM thus requiring alignment to boundaries of 2, but 4
seems better as it conforms with OpenGL and Vulkan (and, I imagine,
DirectX, but I doubt QF will ever use DirectX).
This commit is contained in:
Bill Currie 2023-08-27 15:13:49 +09:00
parent 727b490a0c
commit c7d6e80d69

View file

@ -36,6 +36,8 @@
#include "QF/mathlib.h"
#include "QF/va.h"
#include "QF/math/bitop.h"
#include "tools/qfcc/include/algebra.h"
#include "tools/qfcc/include/attribute.h"
#include "tools/qfcc/include/diagnostic.h"
@ -443,11 +445,7 @@ algebra_subtype (type_t *type, attribute_t *attr)
static int
algebra_alignment (const type_t *type, int width)
{
int alignment = type->alignment;
if (!(width & 1)) {
alignment *= width;
}
return alignment;
return type->alignment * BITOP_RUP (width);
}
type_t *