shaders.h

 1#include <simd/simd.h>
 2
 3typedef struct {
 4    vector_float2 viewport_size;
 5} GPUIUniforms;
 6
 7typedef enum {
 8    GPUIQuadInputIndexVertices = 0,
 9    GPUIQuadInputIndexQuads = 1,
10    GPUIQuadInputIndexUniforms = 2,
11} GPUIQuadInputIndex;
12
13typedef struct {
14    vector_float2 origin;
15    vector_float2 size;
16    vector_uchar4 background_color;
17    float border_top;
18    float border_right;
19    float border_bottom;
20    float border_left;
21    vector_uchar4 border_color;
22    float corner_radius;
23} GPUIQuad;
24
25typedef enum {
26    GPUIShadowInputIndexVertices = 0,
27    GPUIShadowInputIndexShadows = 1,
28    GPUIShadowInputIndexUniforms = 2,
29} GPUIShadowInputIndex;
30
31typedef struct {
32    vector_float2 origin;
33    vector_float2 size;
34    float corner_radius;
35    float sigma;
36    vector_uchar4 color;
37} GPUIShadow;
38
39typedef enum {
40    GPUISpriteVertexInputIndexVertices = 0,
41    GPUISpriteVertexInputIndexSprites = 1,
42    GPUISpriteVertexInputIndexViewportSize = 2,
43    GPUISpriteVertexInputIndexAtlasSize = 3,
44} GPUISpriteVertexInputIndex;
45
46typedef enum {
47    GPUISpriteFragmentInputIndexAtlas = 0,
48} GPUISpriteFragmentInputIndex;
49
50typedef struct {
51    vector_float2 origin;
52    vector_float2 size;
53    vector_float2 atlas_origin;
54    vector_uchar4 color;
55    uint8_t compute_winding;
56} GPUISprite;
57
58typedef enum {
59    GPUIPathAtlasVertexInputIndexVertices = 0,
60    GPUIPathAtlasVertexInputIndexAtlasSize = 1,
61} GPUIPathAtlasVertexInputIndex;
62
63typedef struct {
64    vector_float2 xy_position;
65    vector_float2 st_position;
66    vector_float2 clip_rect_origin;
67    vector_float2 clip_rect_size;
68} GPUIPathVertex;