mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-12-02 00:52:19 +00:00
[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:
parent
727b490a0c
commit
c7d6e80d69
1 changed files with 3 additions and 5 deletions
|
@ -36,6 +36,8 @@
|
||||||
#include "QF/mathlib.h"
|
#include "QF/mathlib.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
|
||||||
|
#include "QF/math/bitop.h"
|
||||||
|
|
||||||
#include "tools/qfcc/include/algebra.h"
|
#include "tools/qfcc/include/algebra.h"
|
||||||
#include "tools/qfcc/include/attribute.h"
|
#include "tools/qfcc/include/attribute.h"
|
||||||
#include "tools/qfcc/include/diagnostic.h"
|
#include "tools/qfcc/include/diagnostic.h"
|
||||||
|
@ -443,11 +445,7 @@ algebra_subtype (type_t *type, attribute_t *attr)
|
||||||
static int
|
static int
|
||||||
algebra_alignment (const type_t *type, int width)
|
algebra_alignment (const type_t *type, int width)
|
||||||
{
|
{
|
||||||
int alignment = type->alignment;
|
return type->alignment * BITOP_RUP (width);
|
||||||
if (!(width & 1)) {
|
|
||||||
alignment *= width;
|
|
||||||
}
|
|
||||||
return alignment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type_t *
|
type_t *
|
||||||
|
|
Loading…
Reference in a new issue