|
|
@ -8,37 +8,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
Overview:
|
|
|
|
Overview:
|
|
|
|
|
|
|
|
|
|
|
|
Shader program 'quad':
|
|
|
|
Shader program 'program':
|
|
|
|
Get shader desc: quad_shader_desc(sg_query_backend());
|
|
|
|
Get shader desc: quad_program_shader_desc(sg_query_backend());
|
|
|
|
Vertex shader: vs
|
|
|
|
Vertex shader: vs
|
|
|
|
Attribute slots:
|
|
|
|
Attribute slots:
|
|
|
|
ATTR_vs_position = 0
|
|
|
|
ATTR_quad_vs_position = 0
|
|
|
|
ATTR_vs_texcoord0 = 1
|
|
|
|
ATTR_quad_vs_texcoord0 = 1
|
|
|
|
Fragment shader: fs
|
|
|
|
Fragment shader: fs
|
|
|
|
|
|
|
|
Uniform block 'fs_params':
|
|
|
|
|
|
|
|
C struct: quad_fs_params_t
|
|
|
|
|
|
|
|
Bind slot: SLOT_quad_fs_params = 0
|
|
|
|
Image 'tex':
|
|
|
|
Image 'tex':
|
|
|
|
Type: SG_IMAGETYPE_2D
|
|
|
|
Type: SG_IMAGETYPE_2D
|
|
|
|
Component Type: SG_SAMPLERTYPE_FLOAT
|
|
|
|
Component Type: SG_SAMPLERTYPE_FLOAT
|
|
|
|
Bind slot: SLOT_tex = 0
|
|
|
|
Bind slot: SLOT_quad_tex = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Shader descriptor structs:
|
|
|
|
Shader descriptor structs:
|
|
|
|
|
|
|
|
|
|
|
|
sg_shader quad = sg_make_shader(quad_shader_desc(sg_query_backend()));
|
|
|
|
sg_shader program = sg_make_shader(quad_program_shader_desc(sg_query_backend()));
|
|
|
|
|
|
|
|
|
|
|
|
Vertex attribute locations for vertex shader 'vs':
|
|
|
|
Vertex attribute locations for vertex shader 'vs':
|
|
|
|
|
|
|
|
|
|
|
|
sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){
|
|
|
|
sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){
|
|
|
|
.layout = {
|
|
|
|
.layout = {
|
|
|
|
.attrs = {
|
|
|
|
.attrs = {
|
|
|
|
[ATTR_vs_position] = { ... },
|
|
|
|
[ATTR_quad_vs_position] = { ... },
|
|
|
|
[ATTR_vs_texcoord0] = { ... },
|
|
|
|
[ATTR_quad_vs_texcoord0] = { ... },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
...});
|
|
|
|
...});
|
|
|
|
|
|
|
|
|
|
|
|
Image bind slots, use as index in sg_bindings.vs_images[] or .fs_images[]
|
|
|
|
Image bind slots, use as index in sg_bindings.vs_images[] or .fs_images[]
|
|
|
|
|
|
|
|
|
|
|
|
SLOT_tex = 0;
|
|
|
|
SLOT_quad_tex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bind slot and C-struct for uniform block 'fs_params':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
quad_fs_params_t fs_params = {
|
|
|
|
|
|
|
|
.tint = ...;
|
|
|
|
|
|
|
|
.upper_left = ...;
|
|
|
|
|
|
|
|
.lower_right = ...;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_quad_fs_params, &SG_RANGE(fs_params));
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdint.h>
|
|
|
@ -52,9 +64,17 @@
|
|
|
|
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
|
|
|
|
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define ATTR_vs_position (0)
|
|
|
|
#define ATTR_quad_vs_position (0)
|
|
|
|
#define ATTR_vs_texcoord0 (1)
|
|
|
|
#define ATTR_quad_vs_texcoord0 (1)
|
|
|
|
#define SLOT_tex (0)
|
|
|
|
#define SLOT_quad_tex (0)
|
|
|
|
|
|
|
|
#define SLOT_quad_fs_params (0)
|
|
|
|
|
|
|
|
#pragma pack(push,1)
|
|
|
|
|
|
|
|
SOKOL_SHDC_ALIGN(16) typedef struct quad_fs_params_t {
|
|
|
|
|
|
|
|
float tint[4];
|
|
|
|
|
|
|
|
float upper_left[2];
|
|
|
|
|
|
|
|
float lower_right[2];
|
|
|
|
|
|
|
|
} quad_fs_params_t;
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
#version 330
|
|
|
|
#version 330
|
|
|
|
|
|
|
|
|
|
|
@ -69,7 +89,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const char vs_source_glsl330[189] = {
|
|
|
|
static const char quad_vs_source_glsl330[189] = {
|
|
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x6c,0x61,
|
|
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x6c,0x61,
|
|
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
|
|
0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,
|
|
|
|
0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,
|
|
|
@ -86,28 +106,37 @@ static const char vs_source_glsl330[189] = {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
#version 330
|
|
|
|
#version 330
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uniform vec4 fs_params[2];
|
|
|
|
uniform sampler2D tex;
|
|
|
|
uniform sampler2D tex;
|
|
|
|
|
|
|
|
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
|
|
|
|
|
|
in vec2 uv;
|
|
|
|
in vec2 uv;
|
|
|
|
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frag_color = texture(tex, uv);
|
|
|
|
frag_color = texture(tex, vec2(mix(fs_params[1].x, fs_params[1].z, uv.x), mix(fs_params[1].y, fs_params[1].w, uv.y))) * fs_params[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const char fs_source_glsl330[146] = {
|
|
|
|
static const char quad_fs_source_glsl330[276] = {
|
|
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
|
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
|
|
|
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
|
|
|
|
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61,
|
|
|
|
0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
|
|
|
0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,
|
|
|
|
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,
|
|
|
|
0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,
|
|
|
|
0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,
|
|
|
|
0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,
|
|
|
|
0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
|
|
|
|
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
|
|
|
|
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
|
|
0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,
|
|
|
|
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,
|
|
|
|
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,
|
|
|
|
0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x7d,0x0a,
|
|
|
|
0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
|
|
|
|
0x0a,0x00,
|
|
|
|
0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,
|
|
|
|
|
|
|
|
0x65,0x78,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x6d,0x69,0x78,0x28,0x66,0x73,0x5f,
|
|
|
|
|
|
|
|
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x2c,0x20,0x66,0x73,0x5f,
|
|
|
|
|
|
|
|
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x7a,0x2c,0x20,0x75,0x76,0x2e,
|
|
|
|
|
|
|
|
0x78,0x29,0x2c,0x20,0x6d,0x69,0x78,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
|
|
|
|
|
|
|
0x73,0x5b,0x31,0x5d,0x2e,0x79,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
|
|
|
|
|
|
|
0x73,0x5b,0x31,0x5d,0x2e,0x77,0x2c,0x20,0x75,0x76,0x2e,0x79,0x29,0x29,0x29,0x20,
|
|
|
|
|
|
|
|
0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x3b,0x0a,
|
|
|
|
|
|
|
|
0x7d,0x0a,0x0a,0x00,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
static float4 gl_Position;
|
|
|
|
static float4 gl_Position;
|
|
|
@ -147,7 +176,7 @@ static const char fs_source_glsl330[146] = {
|
|
|
|
return stage_output;
|
|
|
|
return stage_output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const char vs_source_hlsl5[728] = {
|
|
|
|
static const char quad_vs_source_hlsl5[728] = {
|
|
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,
|
|
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,
|
|
|
|
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
|
|
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
|
|
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
|
|
|
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
|
|
@ -196,11 +225,18 @@ static const char vs_source_hlsl5[728] = {
|
|
|
|
0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
|
|
|
0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
|
|
|
|
cbuffer fs_params : register(b0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
float4 _15_tint : packoffset(c0);
|
|
|
|
|
|
|
|
float2 _15_upper_left : packoffset(c1);
|
|
|
|
|
|
|
|
float2 _15_lower_right : packoffset(c1.z);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Texture2D<float4> tex : register(t0);
|
|
|
|
Texture2D<float4> tex : register(t0);
|
|
|
|
SamplerState _tex_sampler : register(s0);
|
|
|
|
SamplerState _tex_sampler : register(s0);
|
|
|
|
|
|
|
|
|
|
|
|
static float4 frag_color;
|
|
|
|
|
|
|
|
static float2 uv;
|
|
|
|
static float2 uv;
|
|
|
|
|
|
|
|
static float4 frag_color;
|
|
|
|
|
|
|
|
|
|
|
|
struct SPIRV_Cross_Input
|
|
|
|
struct SPIRV_Cross_Input
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -212,11 +248,12 @@ static const char vs_source_hlsl5[728] = {
|
|
|
|
float4 frag_color : SV_Target0;
|
|
|
|
float4 frag_color : SV_Target0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#line 13 "quad.glsl"
|
|
|
|
#line 18 "quad.glsl"
|
|
|
|
void frag_main()
|
|
|
|
void frag_main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#line 13 "quad.glsl"
|
|
|
|
#line 18 "quad.glsl"
|
|
|
|
frag_color = tex.Sample(_tex_sampler, uv);
|
|
|
|
#line 19 "quad.glsl"
|
|
|
|
|
|
|
|
frag_color = tex.Sample(_tex_sampler, float2(lerp(_15_upper_left.x, _15_lower_right.x, uv.x), lerp(_15_upper_left.y, _15_lower_right.y, uv.y))) * _15_tint;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
|
@ -228,43 +265,62 @@ static const char vs_source_hlsl5[728] = {
|
|
|
|
return stage_output;
|
|
|
|
return stage_output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const char fs_source_hlsl5[569] = {
|
|
|
|
static const char quad_fs_source_hlsl5[871] = {
|
|
|
|
0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
|
|
|
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
|
|
|
0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,
|
|
|
|
0x73,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,
|
|
|
|
0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61,
|
|
|
|
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,
|
|
|
|
0x74,0x65,0x20,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,
|
|
|
|
0x35,0x5f,0x74,0x69,0x6e,0x74,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,
|
|
|
|
0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x73,0x30,0x29,0x3b,0x0a,
|
|
|
|
0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
|
|
0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,
|
|
|
|
0x61,0x74,0x32,0x20,0x5f,0x31,0x35,0x5f,0x75,0x70,0x70,0x65,0x72,0x5f,0x6c,0x65,
|
|
|
|
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
|
|
0x66,0x74,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,
|
|
|
|
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x73,0x74,
|
|
|
|
0x63,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
|
|
|
0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,
|
|
|
|
0x5f,0x31,0x35,0x5f,0x6c,0x6f,0x77,0x65,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x20,
|
|
|
|
0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
|
|
0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x31,0x2e,
|
|
|
|
0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,
|
|
|
|
0x7a,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,
|
|
|
|
0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,
|
|
|
|
0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,
|
|
|
|
0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,
|
|
|
|
0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,
|
|
|
|
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,
|
|
|
|
0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61,0x74,0x65,0x20,0x5f,0x74,0x65,0x78,0x5f,
|
|
|
|
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,
|
|
|
|
0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,
|
|
|
|
0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,
|
|
|
|
0x65,0x72,0x28,0x73,0x30,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
|
|
|
|
0x65,0x20,0x31,0x33,0x20,0x22,0x71,0x75,0x61,0x64,0x2e,0x67,0x6c,0x73,0x6c,0x22,
|
|
|
|
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
|
|
0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,
|
|
|
|
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
|
|
|
|
0x29,0x0a,0x7b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x33,0x20,0x22,0x71,0x75,
|
|
|
|
0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,
|
|
|
|
0x61,0x64,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
|
|
|
|
0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,
|
|
|
|
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x53,0x61,
|
|
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,
|
|
|
|
0x6d,0x70,0x6c,0x65,0x28,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
|
|
|
0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,
|
|
|
|
0x72,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,
|
|
|
|
0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
|
|
|
|
0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,
|
|
|
|
0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
|
|
|
0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,
|
|
|
|
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
|
|
|
|
0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,
|
|
|
|
0x72,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,
|
|
|
|
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,
|
|
|
|
0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x38,0x20,0x22,0x71,0x75,
|
|
|
|
0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,
|
|
|
|
0x61,0x64,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,
|
|
|
|
0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,
|
|
|
|
0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x23,0x6c,0x69,0x6e,
|
|
|
|
0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,
|
|
|
|
0x65,0x20,0x31,0x38,0x20,0x22,0x71,0x75,0x61,0x64,0x2e,0x67,0x6c,0x73,0x6c,0x22,
|
|
|
|
0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,
|
|
|
|
0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x39,0x20,0x22,0x71,0x75,0x61,0x64,0x2e,
|
|
|
|
0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,
|
|
|
|
0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
|
|
|
|
0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
|
|
|
|
0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x53,0x61,0x6d,0x70,0x6c,
|
|
|
|
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,
|
|
|
|
0x65,0x28,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,
|
|
|
|
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,
|
|
|
|
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x6c,0x65,0x72,0x70,0x28,0x5f,0x31,0x35,0x5f,
|
|
|
|
0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
|
|
|
0x75,0x70,0x70,0x65,0x72,0x5f,0x6c,0x65,0x66,0x74,0x2e,0x78,0x2c,0x20,0x5f,0x31,
|
|
|
|
|
|
|
|
0x35,0x5f,0x6c,0x6f,0x77,0x65,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x2e,0x78,0x2c,
|
|
|
|
|
|
|
|
0x20,0x75,0x76,0x2e,0x78,0x29,0x2c,0x20,0x6c,0x65,0x72,0x70,0x28,0x5f,0x31,0x35,
|
|
|
|
|
|
|
|
0x5f,0x75,0x70,0x70,0x65,0x72,0x5f,0x6c,0x65,0x66,0x74,0x2e,0x79,0x2c,0x20,0x5f,
|
|
|
|
|
|
|
|
0x31,0x35,0x5f,0x6c,0x6f,0x77,0x65,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x2e,0x79,
|
|
|
|
|
|
|
|
0x2c,0x20,0x75,0x76,0x2e,0x79,0x29,0x29,0x29,0x20,0x2a,0x20,0x5f,0x31,0x35,0x5f,
|
|
|
|
|
|
|
|
0x74,0x69,0x6e,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,
|
|
|
|
|
|
|
|
0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,
|
|
|
|
|
|
|
|
0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,
|
|
|
|
|
|
|
|
0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,
|
|
|
|
|
|
|
|
0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,
|
|
|
|
|
|
|
|
0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
|
|
|
|
|
|
0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
|
|
|
|
|
|
0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,
|
|
|
|
|
|
|
|
0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,
|
|
|
|
|
|
|
|
0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,
|
|
|
|
|
|
|
|
0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,
|
|
|
|
|
|
|
|
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,
|
|
|
|
|
|
|
|
0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,
|
|
|
|
|
|
|
|
0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <metal_stdlib>
|
|
|
@ -296,7 +352,7 @@ static const char fs_source_hlsl5[569] = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const char vs_source_metal_macos[500] = {
|
|
|
|
static const char quad_vs_source_metal_macos[500] = {
|
|
|
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
|
|
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
|
|
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
|
|
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
|
|
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
|
|
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
|
|
@ -336,6 +392,13 @@ static const char vs_source_metal_macos[500] = {
|
|
|
|
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
using namespace metal;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct fs_params
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
float4 tint;
|
|
|
|
|
|
|
|
float2 upper_left;
|
|
|
|
|
|
|
|
float2 lower_right;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct main0_out
|
|
|
|
struct main0_out
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float4 frag_color [[color(0)]];
|
|
|
|
float4 frag_color [[color(0)]];
|
|
|
@ -346,50 +409,68 @@ static const char vs_source_metal_macos[500] = {
|
|
|
|
float2 uv [[user(locn0)]];
|
|
|
|
float2 uv [[user(locn0)]];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#line 13 "quad.glsl"
|
|
|
|
#line 18 "quad.glsl"
|
|
|
|
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]])
|
|
|
|
fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _15 [[buffer(0)]], texture2d<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
main0_out out = {};
|
|
|
|
main0_out out = {};
|
|
|
|
#line 13 "quad.glsl"
|
|
|
|
#line 18 "quad.glsl"
|
|
|
|
out.frag_color = tex.sample(texSmplr, in.uv);
|
|
|
|
#line 19 "quad.glsl"
|
|
|
|
|
|
|
|
out.frag_color = tex.sample(texSmplr, float2(mix(_15.upper_left.x, _15.lower_right.x, in.uv.x), mix(_15.upper_left.y, _15.lower_right.y, in.uv.y))) * _15.tint;
|
|
|
|
return out;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const char fs_source_metal_macos[443] = {
|
|
|
|
static const char quad_fs_source_metal_macos[704] = {
|
|
|
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
|
|
|
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
|
|
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
|
|
|
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
|
|
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
|
|
|
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
|
|
|
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
|
|
|
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
|
|
|
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
|
|
|
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x66,
|
|
|
|
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
|
|
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
|
|
|
0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
|
|
|
0x6c,0x6f,0x61,0x74,0x34,0x20,0x74,0x69,0x6e,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
|
|
0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
|
|
|
|
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x70,0x70,0x65,0x72,0x5f,0x6c,0x65,0x66,
|
|
|
|
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
|
|
|
0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x6c,0x6f,
|
|
|
|
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
|
|
|
0x77,0x65,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,
|
|
|
|
0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,
|
|
|
|
0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,
|
|
|
|
0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x33,
|
|
|
|
0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,
|
|
|
|
0x20,0x22,0x71,0x75,0x61,0x64,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x66,0x72,0x61,
|
|
|
|
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,
|
|
|
|
0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,
|
|
|
|
0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,
|
|
|
|
0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,
|
|
|
|
0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
|
|
|
0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,
|
|
|
|
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,
|
|
|
|
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,
|
|
|
|
0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,
|
|
|
|
0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,
|
|
|
|
0x6c,0x69,0x6e,0x65,0x20,0x31,0x38,0x20,0x22,0x71,0x75,0x61,0x64,0x2e,0x67,0x6c,
|
|
|
|
0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65,0x78,
|
|
|
|
0x73,0x6c,0x22,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,
|
|
|
|
0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,
|
|
|
|
0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,
|
|
|
|
0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,
|
|
|
|
0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,
|
|
|
|
0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,
|
|
|
|
0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,
|
|
|
|
0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x33,0x20,0x22,0x71,0x75,0x61,0x64,0x2e,0x67,
|
|
|
|
0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x35,0x20,0x5b,
|
|
|
|
0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,
|
|
|
|
0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,
|
|
|
|
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,
|
|
|
|
0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,
|
|
|
|
0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69,
|
|
|
|
0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,
|
|
|
|
0x6e,0x2e,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
|
|
|
0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65,0x78,0x53,0x6d,
|
|
|
|
0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
|
|
0x70,0x6c,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,
|
|
|
|
|
|
|
|
0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
|
|
|
|
|
|
|
0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,
|
|
|
|
|
|
|
|
0x69,0x6e,0x65,0x20,0x31,0x38,0x20,0x22,0x71,0x75,0x61,0x64,0x2e,0x67,0x6c,0x73,
|
|
|
|
|
|
|
|
0x6c,0x22,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x39,0x20,0x22,0x71,0x75,0x61,
|
|
|
|
|
|
|
|
0x64,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
|
|
|
|
|
|
|
|
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,
|
|
|
|
|
|
|
|
0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,
|
|
|
|
|
|
|
|
0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x6d,0x69,0x78,0x28,0x5f,0x31,0x35,
|
|
|
|
|
|
|
|
0x2e,0x75,0x70,0x70,0x65,0x72,0x5f,0x6c,0x65,0x66,0x74,0x2e,0x78,0x2c,0x20,0x5f,
|
|
|
|
|
|
|
|
0x31,0x35,0x2e,0x6c,0x6f,0x77,0x65,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x2e,0x78,
|
|
|
|
|
|
|
|
0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x2e,0x78,0x29,0x2c,0x20,0x6d,0x69,0x78,0x28,
|
|
|
|
|
|
|
|
0x5f,0x31,0x35,0x2e,0x75,0x70,0x70,0x65,0x72,0x5f,0x6c,0x65,0x66,0x74,0x2e,0x79,
|
|
|
|
|
|
|
|
0x2c,0x20,0x5f,0x31,0x35,0x2e,0x6c,0x6f,0x77,0x65,0x72,0x5f,0x72,0x69,0x67,0x68,
|
|
|
|
|
|
|
|
0x74,0x2e,0x79,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x2e,0x79,0x29,0x29,0x29,0x20,
|
|
|
|
|
|
|
|
0x2a,0x20,0x5f,0x31,0x35,0x2e,0x74,0x69,0x6e,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
|
|
|
|
|
|
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
#if !defined(SOKOL_GFX_INCLUDED)
|
|
|
|
#if !defined(SOKOL_GFX_INCLUDED)
|
|
|
|
#error "Please include sokol_gfx.h before quad-sapp.glsl.h"
|
|
|
|
#error "Please include sokol_gfx.h before quad-sapp.glsl.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
static inline const sg_shader_desc* quad_shader_desc(sg_backend backend) {
|
|
|
|
static inline const sg_shader_desc* quad_program_shader_desc(sg_backend backend) {
|
|
|
|
if (backend == SG_BACKEND_GLCORE33) {
|
|
|
|
if (backend == SG_BACKEND_GLCORE33) {
|
|
|
|
static sg_shader_desc desc;
|
|
|
|
static sg_shader_desc desc;
|
|
|
|
static bool valid;
|
|
|
|
static bool valid;
|
|
|
@ -397,14 +478,19 @@ static inline const sg_shader_desc* quad_shader_desc(sg_backend backend) {
|
|
|
|
valid = true;
|
|
|
|
valid = true;
|
|
|
|
desc.attrs[0].name = "position";
|
|
|
|
desc.attrs[0].name = "position";
|
|
|
|
desc.attrs[1].name = "texcoord0";
|
|
|
|
desc.attrs[1].name = "texcoord0";
|
|
|
|
desc.vs.source = vs_source_glsl330;
|
|
|
|
desc.vs.source = quad_vs_source_glsl330;
|
|
|
|
desc.vs.entry = "main";
|
|
|
|
desc.vs.entry = "main";
|
|
|
|
desc.fs.source = fs_source_glsl330;
|
|
|
|
desc.fs.source = quad_fs_source_glsl330;
|
|
|
|
desc.fs.entry = "main";
|
|
|
|
desc.fs.entry = "main";
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].size = 32;
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params";
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].uniforms[0].array_count = 2;
|
|
|
|
desc.fs.images[0].name = "tex";
|
|
|
|
desc.fs.images[0].name = "tex";
|
|
|
|
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
|
|
|
|
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
|
|
|
|
desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
|
|
|
|
desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
|
|
|
|
desc.label = "quad_shader";
|
|
|
|
desc.label = "quad_program_shader";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &desc;
|
|
|
|
return &desc;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -417,16 +503,18 @@ static inline const sg_shader_desc* quad_shader_desc(sg_backend backend) {
|
|
|
|
desc.attrs[0].sem_index = 0;
|
|
|
|
desc.attrs[0].sem_index = 0;
|
|
|
|
desc.attrs[1].sem_name = "TEXCOORD";
|
|
|
|
desc.attrs[1].sem_name = "TEXCOORD";
|
|
|
|
desc.attrs[1].sem_index = 1;
|
|
|
|
desc.attrs[1].sem_index = 1;
|
|
|
|
desc.vs.source = vs_source_hlsl5;
|
|
|
|
desc.vs.source = quad_vs_source_hlsl5;
|
|
|
|
desc.vs.d3d11_target = "vs_5_0";
|
|
|
|
desc.vs.d3d11_target = "vs_5_0";
|
|
|
|
desc.vs.entry = "main";
|
|
|
|
desc.vs.entry = "main";
|
|
|
|
desc.fs.source = fs_source_hlsl5;
|
|
|
|
desc.fs.source = quad_fs_source_hlsl5;
|
|
|
|
desc.fs.d3d11_target = "ps_5_0";
|
|
|
|
desc.fs.d3d11_target = "ps_5_0";
|
|
|
|
desc.fs.entry = "main";
|
|
|
|
desc.fs.entry = "main";
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].size = 32;
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
|
|
desc.fs.images[0].name = "tex";
|
|
|
|
desc.fs.images[0].name = "tex";
|
|
|
|
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
|
|
|
|
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
|
|
|
|
desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
|
|
|
|
desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
|
|
|
|
desc.label = "quad_shader";
|
|
|
|
desc.label = "quad_program_shader";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &desc;
|
|
|
|
return &desc;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -435,14 +523,16 @@ static inline const sg_shader_desc* quad_shader_desc(sg_backend backend) {
|
|
|
|
static bool valid;
|
|
|
|
static bool valid;
|
|
|
|
if (!valid) {
|
|
|
|
if (!valid) {
|
|
|
|
valid = true;
|
|
|
|
valid = true;
|
|
|
|
desc.vs.source = vs_source_metal_macos;
|
|
|
|
desc.vs.source = quad_vs_source_metal_macos;
|
|
|
|
desc.vs.entry = "main0";
|
|
|
|
desc.vs.entry = "main0";
|
|
|
|
desc.fs.source = fs_source_metal_macos;
|
|
|
|
desc.fs.source = quad_fs_source_metal_macos;
|
|
|
|
desc.fs.entry = "main0";
|
|
|
|
desc.fs.entry = "main0";
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].size = 32;
|
|
|
|
|
|
|
|
desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
|
|
desc.fs.images[0].name = "tex";
|
|
|
|
desc.fs.images[0].name = "tex";
|
|
|
|
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
|
|
|
|
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
|
|
|
|
desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
|
|
|
|
desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
|
|
|
|
desc.label = "quad_shader";
|
|
|
|
desc.label = "quad_program_shader";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &desc;
|
|
|
|
return &desc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|