reorder fields in glsl vertex struct to be less wasteful

This commit is contained in:
martinfouilleul 2023-02-06 17:01:32 +01:00
parent 5754fc1ad2
commit 91780b12c7
4 changed files with 7 additions and 9 deletions

View File

@ -50,10 +50,8 @@ mg_gles_surface* mg_gles_canvas_get_surface(mg_gles_canvas_backend* canvas)
typedef struct debug_vertex
{
vec2 pos;
u8 align0[8];
vec4 cubic;
vec2 uv;
u8 align1[8];
vec4 cubic;
vec4 color;
vec4 clip;
int zIndex;
@ -73,9 +71,9 @@ enum {
LAYOUT_INT_ALIGN = 4,
LAYOUT_POS_OFFSET = 0,
LAYOUT_CUBIC_OFFSET = LayoutNext(POS, VEC2, VEC4),
LAYOUT_UV_OFFSET = LayoutNext(CUBIC, VEC4, VEC2),
LAYOUT_COLOR_OFFSET = LayoutNext(UV, VEC2, VEC4),
LAYOUT_UV_OFFSET = LayoutNext(POS, VEC2, VEC2),
LAYOUT_CUBIC_OFFSET = LayoutNext(UV, VEC2, VEC4),
LAYOUT_COLOR_OFFSET = LayoutNext(CUBIC, VEC4, VEC4),
LAYOUT_CLIP_OFFSET = LayoutNext(COLOR, VEC4, VEC4),
LAYOUT_ZINDEX_OFFSET = LayoutNext(CLIP, VEC4, INT),

View File

@ -8,8 +8,8 @@ layout(std430) buffer;
struct vertex {
vec2 pos;
vec4 cubic;
vec2 uv;
vec4 cubic;
vec4 color;
vec4 clip;
int zIndex;

View File

@ -6,8 +6,8 @@ layout(std430) buffer;
struct vertex {
vec2 pos;
vec4 cubic;
vec2 uv;
vec4 cubic;
vec4 color;
vec4 clip;
int zIndex;

View File

@ -6,8 +6,8 @@ layout(std430) buffer;
struct vertex {
vec2 pos;
vec4 cubic;
vec2 uv;
vec4 cubic;
vec4 color;
vec4 clip;
int zIndex;