2023-08-21 00:18:37 +00:00
|
|
|
precision highp float;
|
|
|
|
|
|
|
|
#if defined(GSK_GLES) && __VERSION__ < 310
|
|
|
|
layout(std140)
|
|
|
|
#else
|
|
|
|
layout(std140, binding = 0)
|
|
|
|
#endif
|
|
|
|
uniform PushConstants
|
|
|
|
{
|
|
|
|
mat4 mvp;
|
2023-10-05 01:17:51 +00:00
|
|
|
mat3x4 clip;
|
2023-08-21 00:18:37 +00:00
|
|
|
vec2 scale;
|
|
|
|
} push;
|
|
|
|
|
2023-10-05 01:17:51 +00:00
|
|
|
#define GSK_GLOBAL_MVP push.mvp
|
|
|
|
#define GSK_GLOBAL_CLIP push.clip
|
|
|
|
#define GSK_GLOBAL_CLIP_RECT push.clip[0]
|
|
|
|
#define GSK_GLOBAL_SCALE push.scale
|
|
|
|
|
2023-08-30 19:57:41 +00:00
|
|
|
#if defined(GSK_GLES) && __VERSION__ < 310
|
|
|
|
layout(std140)
|
|
|
|
#else
|
|
|
|
layout(std140, binding = 1)
|
|
|
|
#endif
|
|
|
|
uniform Floats
|
|
|
|
{
|
|
|
|
vec4 really_just_floats[1024];
|
|
|
|
} floats;
|
|
|
|
|
|
|
|
uniform sampler2D textures[16];
|
|
|
|
|
2023-08-21 00:18:37 +00:00
|
|
|
#define GSK_VERTEX_INDEX gl_VertexID
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef GSK_VERTEX_SHADER
|
|
|
|
#define IN(_loc) in
|
|
|
|
#define PASS(_loc) out
|
|
|
|
#define PASS_FLAT(_loc) flat out
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef GSK_FRAGMENT_SHADER
|
|
|
|
#define PASS(_loc) in
|
|
|
|
#define PASS_FLAT(_loc) flat in
|
|
|
|
|
2023-08-30 19:57:41 +00:00
|
|
|
float
|
|
|
|
gsk_get_float (int id)
|
|
|
|
{
|
|
|
|
return floats.really_just_floats[id >> 2][id & 3];
|
|
|
|
}
|
|
|
|
|
|
|
|
float
|
|
|
|
gsk_get_float (uint id)
|
|
|
|
{
|
|
|
|
return gsk_get_float (int (id));
|
|
|
|
}
|
|
|
|
|
|
|
|
#define gsk_get_int(id) (floatBitsToInt(gsk_get_float(id)))
|
|
|
|
#define gsk_get_uint(id) (floatBitsToUint(gsk_get_float(id)))
|
2023-08-21 00:18:37 +00:00
|
|
|
|
|
|
|
#ifdef GSK_GLES
|
2023-09-17 02:45:13 +00:00
|
|
|
vec4
|
|
|
|
gsk_texture (uint id,
|
|
|
|
vec2 pos)
|
2023-08-21 00:18:37 +00:00
|
|
|
{
|
2023-09-17 02:45:13 +00:00
|
|
|
switch(id)
|
|
|
|
{
|
|
|
|
case 0u:
|
|
|
|
return texture (textures[0], pos);
|
|
|
|
case 1u:
|
|
|
|
return texture (textures[1], pos);
|
|
|
|
case 2u:
|
|
|
|
return texture (textures[2], pos);
|
|
|
|
case 3u:
|
|
|
|
return texture (textures[3], pos);
|
|
|
|
case 4u:
|
|
|
|
return texture (textures[4], pos);
|
|
|
|
case 5u:
|
|
|
|
return texture (textures[5], pos);
|
|
|
|
case 6u:
|
|
|
|
return texture (textures[6], pos);
|
|
|
|
case 7u:
|
|
|
|
return texture (textures[7], pos);
|
|
|
|
case 8u:
|
|
|
|
return texture (textures[8], pos);
|
|
|
|
case 9u:
|
|
|
|
return texture (textures[9], pos);
|
|
|
|
case 10u:
|
|
|
|
return texture (textures[10], pos);
|
|
|
|
case 11u:
|
|
|
|
return texture (textures[11], pos);
|
|
|
|
case 12u:
|
|
|
|
return texture (textures[12], pos);
|
|
|
|
case 13u:
|
|
|
|
return texture (textures[13], pos);
|
|
|
|
case 14u:
|
|
|
|
return texture (textures[14], pos);
|
|
|
|
case 15u:
|
|
|
|
return texture (textures[15], pos);
|
|
|
|
default:
|
|
|
|
return vec4 (1.0, 0.0, 0.8, 1.0);
|
|
|
|
}
|
2023-08-21 00:18:37 +00:00
|
|
|
}
|
2023-09-17 02:45:13 +00:00
|
|
|
|
|
|
|
#else /* !GSK_GLES */
|
|
|
|
|
|
|
|
#define gsk_texture(id, pos) texture (textures[id], pos)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2023-08-21 00:18:37 +00:00
|
|
|
layout(location = 0) out vec4 out_color;
|
|
|
|
void
|
|
|
|
gsk_set_output_color (vec4 color)
|
|
|
|
{
|
|
|
|
out_color = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|