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 target_size;
 53  vector_float2 source_size;
 54  vector_float2 atlas_origin;
 55  vector_uchar4 color;
 56  uint8_t compute_winding;
 57} GPUISprite;
 58
 59typedef enum {
 60  GPUIPathAtlasVertexInputIndexVertices = 0,
 61  GPUIPathAtlasVertexInputIndexAtlasSize = 1,
 62} GPUIPathAtlasVertexInputIndex;
 63
 64typedef struct {
 65  vector_float2 xy_position;
 66  vector_float2 st_position;
 67  vector_float2 clip_rect_origin;
 68  vector_float2 clip_rect_size;
 69} GPUIPathVertex;
 70
 71typedef enum {
 72  GPUIImageVertexInputIndexVertices = 0,
 73  GPUIImageVertexInputIndexImages = 1,
 74  GPUIImageVertexInputIndexViewportSize = 2,
 75  GPUIImageVertexInputIndexAtlasSize = 3,
 76} GPUIImageVertexInputIndex;
 77
 78typedef enum {
 79  GPUIImageFragmentInputIndexAtlas = 0,
 80} GPUIImageFragmentInputIndex;
 81
 82typedef struct {
 83  vector_float2 origin;
 84  vector_float2 target_size;
 85  vector_float2 source_size;
 86  vector_float2 atlas_origin;
 87  float border_top;
 88  float border_right;
 89  float border_bottom;
 90  float border_left;
 91  vector_uchar4 border_color;
 92  float corner_radius;
 93  uint8_t grayscale;
 94} GPUIImage;
 95
 96typedef enum {
 97  GPUISurfaceVertexInputIndexVertices = 0,
 98  GPUISurfaceVertexInputIndexSurfaces = 1,
 99  GPUISurfaceVertexInputIndexViewportSize = 2,
100  GPUISurfaceVertexInputIndexAtlasSize = 3,
101} GPUISurfaceVertexInputIndex;
102
103typedef enum {
104  GPUISurfaceFragmentInputIndexYAtlas = 0,
105  GPUISurfaceFragmentInputIndexCbCrAtlas = 1,
106} GPUISurfaceFragmentInputIndex;
107
108typedef struct {
109  vector_float2 origin;
110  vector_float2 target_size;
111  vector_float2 source_size;
112} GPUISurface;
113
114typedef enum {
115  GPUIUnderlineInputIndexVertices = 0,
116  GPUIUnderlineInputIndexUnderlines = 1,
117  GPUIUnderlineInputIndexUniforms = 2,
118} GPUIUnderlineInputIndex;
119
120typedef struct {
121  vector_float2 origin;
122  vector_float2 size;
123  float thickness;
124  vector_uchar4 color;
125  uint8_t squiggly;
126} GPUIUnderline;