Fixes samples. Improved engine code.

This commit is contained in:
dlannan 2026-07-31 00:29:09 +09:30
parent 238fda2426
commit 54a510a6ee
29 changed files with 3043 additions and 311 deletions

View File

@ -1,269 +0,0 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/offscreen-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'default':
Get shader desc: default_shader_desc(sg_query_backend());
Vertex Shader: vs_default
Fragment Shader: fs_default
Attributes:
ATTR_default_position => 0
ATTR_default_normal => 1
ATTR_default_texcoord0 => 2
Shader program: 'offscreen':
Get shader desc: offscreen_shader_desc(sg_query_backend());
Vertex Shader: vs_offscreen
Fragment Shader: fs_offscreen
Attributes:
ATTR_offscreen_position => 0
ATTR_offscreen_normal => 1
Bindings:
Uniform block 'vs_params':
C struct: vs_params_t
Bind slot: UB_vs_params => 0
Image 'tex':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_tex => 0
Sampler 'smp':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_smp => 0
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen.h"
#endif
#if !defined(SOKOL_SHDC_ALIGN)
#if defined(_MSC_VER)
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
#else
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_default_position (0)
#define ATTR_default_normal (1)
#define ATTR_default_texcoord0 (2)
#define ATTR_offscreen_position (0)
#define ATTR_offscreen_normal (1)
#define UB_vs_params (0)
#define IMG_tex (0)
#define SMP_smp (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
hmm_mat4 mvp;
} vs_params_t;
#pragma pack(pop)
/*
#version 410
uniform vec4 vs_params[4];
layout(location = 0) in vec4 position;
layout(location = 0) out vec4 nrm;
layout(location = 1) in vec4 normal;
void main()
{
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position;
nrm = normal;
}
*/
static const uint8_t vs_offscreen_source_glsl410[280] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72,
0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,
0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,
0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,
0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec4 nrm;
void main()
{
frag_color = vec4((nrm.xyz * 0.5) + vec3(0.5), 1.0);
}
*/
static const uint8_t fs_offscreen_source_glsl410[166] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,
0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,
0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,
0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,
0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 vs_params[4];
layout(location = 0) in vec4 position;
layout(location = 1) out vec2 uv;
layout(location = 2) in vec2 texcoord0;
layout(location = 0) out vec4 nrm;
layout(location = 1) in vec4 normal;
void main()
{
mat4 _22 = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]);
gl_Position = _22 * position;
uv = texcoord0;
nrm = _22 * normal;
}
*/
static const uint8_t vs_default_source_glsl410[400] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,
0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,
0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,
0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x32,0x32,0x20,0x3d,0x20,
0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,
0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x5f,0x32,0x32,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,
0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x5f,0x32,
0x32,0x20,0x2a,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform sampler2D tex_smp;
layout(location = 1) in vec2 uv;
layout(location = 0) in vec4 nrm;
layout(location = 0) out vec4 frag_color;
void main()
{
frag_color = vec4(texture(tex_smp, uv * vec2(20.0, 10.0)).xyz * fma(clamp(dot(nrm.xyz, vec3(0.57735025882720947265625, 0.57735025882720947265625, -0.57735025882720947265625)), 0.0, 1.0), 2.0, 0.25), 1.0);
}
*/
static const uint8_t fs_default_source_glsl410[379] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,
0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,
0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x74,
0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x20,
0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x32,0x30,0x2e,0x30,0x2c,0x20,0x31,0x30,0x2e,
0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66,0x6d,0x61,0x28,0x63,0x6c,
0x61,0x6d,0x70,0x28,0x64,0x6f,0x74,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x2c,
0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,
0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c,
0x20,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,
0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,
0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,
0x32,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,
0x2e,0x30,0x29,0x2c,0x20,0x32,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x32,0x35,0x29,0x2c,
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
static inline const sg_shader_desc* default_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_default_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_default_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "position";
desc.attrs[1].glsl_name = "normal";
desc.attrs[2].glsl_name = "texcoord0";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 64;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "tex_smp";
desc.label = "default_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* offscreen_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_offscreen_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_offscreen_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "position";
desc.attrs[1].glsl_name = "normal";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 64;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
desc.label = "offscreen_shader";
}
return &desc;
}
return 0;
}

View File

@ -0,0 +1,624 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/shadows-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen_dbg.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'dbg':
Get shader desc: dbg_shader_desc(sg_query_backend());
Vertex Shader: vs_dbg
Fragment Shader: fs_dbg
Attributes:
ATTR_dbg_pos => 0
Shader program: 'display':
Get shader desc: display_shader_desc(sg_query_backend());
Vertex Shader: vs_display
Fragment Shader: fs_display
Attributes:
ATTR_display_pos => 0
ATTR_display_norm => 1
Shader program: 'shadow':
Get shader desc: shadow_shader_desc(sg_query_backend());
Vertex Shader: vs_shadow
Fragment Shader: fs_shadow
Attributes:
ATTR_shadow_pos => 0
Bindings:
Uniform block 'vs_display_params':
C struct: vs_display_params_t
Bind slot: UB_vs_display_params => 0
Uniform block 'fs_display_params':
C struct: fs_display_params_t
Bind slot: UB_fs_display_params => 1
Uniform block 'vs_shadow_params':
C struct: vs_shadow_params_t
Bind slot: UB_vs_shadow_params => 0
Image 'dbg_tex':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_dbg_tex => 0
Image 'shadow_map':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_shadow_map => 0
Sampler 'dbg_smp':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_dbg_smp => 0
Sampler 'shadow_sampler':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_shadow_sampler => 0
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen_dbg.h"
#endif
#if !defined(SOKOL_SHDC_ALIGN)
#if defined(_MSC_VER)
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
#else
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_dbg_pos (0)
#define ATTR_display_pos (0)
#define ATTR_display_norm (1)
#define ATTR_shadow_pos (0)
#define UB_vs_display_params (0)
#define UB_fs_display_params (1)
#define UB_vs_shadow_params (0)
#define IMG_dbg_tex (0)
#define IMG_shadow_map (0)
#define SMP_dbg_smp (0)
#define SMP_shadow_sampler (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_display_params_t {
hmm_mat4 mvp;
hmm_mat4 model;
hmm_mat4 light_mvp;
hmm_vec3 diff_color;
uint8_t _pad_204[4];
} vs_display_params_t;
#pragma pack(pop)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct fs_display_params_t {
hmm_vec3 light_dir;
uint8_t _pad_12[4];
hmm_vec3 eye_pos;
uint8_t _pad_28[4];
} fs_display_params_t;
#pragma pack(pop)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_shadow_params_t {
hmm_mat4 mvp;
} vs_shadow_params_t;
#pragma pack(pop)
/*
#version 410
uniform vec4 vs_shadow_params[4];
layout(location = 0) in vec4 pos;
layout(location = 0) out vec2 proj_zw;
void main()
{
gl_Position = mat4(vs_shadow_params[0], vs_shadow_params[1], vs_shadow_params[2], vs_shadow_params[3]) * pos;
proj_zw = gl_Position.zw;
}
*/
static const uint8_t vs_shadow_source_glsl410[284] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,
0x6c,0x61,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,0x34,0x20,0x70,0x6f,0x73,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,
0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,
0x73,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x73,0x68,0x61,0x64,
0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,
0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,
0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x72,
0x6f,0x6a,0x5f,0x7a,0x77,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x2e,0x7a,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) in vec2 proj_zw;
layout(location = 0) out vec4 frag_color;
vec4 encode_depth(float v)
{
vec4 _23 = fract(vec4(1.0, 255.0, 65025.0, 16581375.0) * v);
return fma(-_23.yzww, vec4(0.0039215688593685626983642578125, 0.0039215688593685626983642578125, 0.0039215688593685626983642578125, 0.0), _23);
}
void main()
{
float param = proj_zw.x / proj_zw.y;
frag_color = encode_depth(param);
}
*/
static const uint8_t fs_shadow_source_glsl410[437] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x72,0x6f,0x6a,0x5f,
0x7a,0x77,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,
0x65,0x63,0x34,0x20,0x65,0x6e,0x63,0x6f,0x64,0x65,0x5f,0x64,0x65,0x70,0x74,0x68,
0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,0x66,0x72,0x61,0x63,0x74,
0x28,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x32,0x35,0x35,0x2e,0x30,
0x2c,0x20,0x36,0x35,0x30,0x32,0x35,0x2e,0x30,0x2c,0x20,0x31,0x36,0x35,0x38,0x31,
0x33,0x37,0x35,0x2e,0x30,0x29,0x20,0x2a,0x20,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6d,0x61,0x28,0x2d,0x5f,0x32,0x33,
0x2e,0x79,0x7a,0x77,0x77,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x30,
0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,
0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,
0x2e,0x30,0x30,0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,
0x35,0x36,0x32,0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,
0x2c,0x20,0x30,0x2e,0x30,0x30,0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,
0x33,0x36,0x38,0x35,0x36,0x32,0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,
0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x5f,0x32,0x33,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,
0x6d,0x20,0x3d,0x20,0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x2e,0x78,0x20,0x2f,0x20,
0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x65,0x6e,0x63,0x6f,
0x64,0x65,0x5f,0x64,0x65,0x70,0x74,0x68,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 vs_display_params[13];
layout(location = 0) in vec4 pos;
layout(location = 1) out vec4 light_proj_pos;
layout(location = 2) out vec4 world_pos;
layout(location = 3) out vec3 world_norm;
layout(location = 1) in vec3 norm;
layout(location = 0) out vec3 color;
void main()
{
gl_Position = mat4(vs_display_params[0], vs_display_params[1], vs_display_params[2], vs_display_params[3]) * pos;
light_proj_pos = mat4(vs_display_params[8], vs_display_params[9], vs_display_params[10], vs_display_params[11]) * pos;
mat4 _39 = mat4(vs_display_params[4], vs_display_params[5], vs_display_params[6], vs_display_params[7]);
world_pos = _39 * pos;
world_norm = normalize((_39 * vec4(norm, 0.0)).xyz);
color = vs_display_params[12].xyz;
}
*/
static const uint8_t vs_display_source_glsl410[777] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x33,0x5d,
0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x70,
0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
0x34,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,
0x77,0x6f,0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,
0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,
0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x33,0x20,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,
0x20,0x76,0x65,0x63,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,
0x74,0x34,0x28,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,
0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,
0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x64,
0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,
0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x39,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,
0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x30,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x31,0x31,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x33,0x39,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,
0x28,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,
0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,
0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,
0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x77,0x6f,
0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x39,0x20,0x2a,0x20,
0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,
0x6f,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x28,0x5f,0x33,0x39,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x6e,0x6f,0x72,0x6d,
0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,
0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x2e,
0x78,0x79,0x7a,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 fs_display_params[2];
uniform sampler2D shadow_map_shadow_sampler;
layout(location = 3) in vec3 world_norm;
layout(location = 1) in vec4 light_proj_pos;
layout(location = 2) in vec4 world_pos;
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec3 color;
float decodeDepth(vec4 rgba)
{
return dot(rgba, vec4(1.0, 0.0039215688593685626983642578125, 1.5378700481960549950599670410156e-05, 6.0308629201699659461155533790588e-08));
}
float sample_shadow(vec2 uv, float compare, sampler2D SPIRV_Cross_Combinedtexsmp)
{
vec4 param = texture(SPIRV_Cross_Combinedtexsmp, vec2(uv.x, uv.y));
return step(compare, decodeDepth(param));
}
float sample_shadow_pcf(vec3 uv_depth, vec2 sm_size, sampler2D SPIRV_Cross_Combinedtexsmp)
{
float result = 0.0;
for (int x = -2; x <= 2; x++)
{
for (int y = -2; y <= 2; y++)
{
vec2 param = uv_depth.xy + (vec2(float(x), float(y)) / sm_size);
float param_1 = uv_depth.z;
result += sample_shadow(param, param_1, SPIRV_Cross_Combinedtexsmp);
}
}
return result * 0.039999999105930328369140625;
}
vec4 gamma(vec4 c)
{
return vec4(pow(c.xyz, vec3(0.4545454680919647216796875)), c.w);
}
void main()
{
vec3 _161 = normalize(fs_display_params[0].xyz);
vec3 _166 = normalize(world_norm);
float _170 = dot(_166, _161);
if (_170 > 0.0)
{
vec3 _184 = light_proj_pos.xyz / vec3(light_proj_pos.w);
vec3 param = vec3((_184.xy + vec2(1.0)) * 0.5, _184.z);
vec2 param_1 = vec2(textureSize(shadow_map_shadow_sampler, 0));
float _202 = sample_shadow_pcf(param, param_1, shadow_map_shadow_sampler);
frag_color = vec4(vec3((pow(max(dot(reflect(-_161, _166), normalize(fs_display_params[1].xyz - world_pos.xyz)), 0.0), 2.2000000476837158203125) * _170) * _202) + (color * (max(_170 * _202, 0.0) + 0.25)), 1.0);
}
else
{
frag_color = vec4(color * 0.25, 1.0);
}
vec4 param_2 = frag_color;
frag_color = gamma(param_2);
}
*/
static const uint8_t fs_display_source_glsl410[2060] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
0x32,0x44,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x6d,0x61,0x70,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x6c,
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x77,0x6f,0x72,0x6c,
0x64,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,
0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,
0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x34,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,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,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,
0x74,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,0x76,0x65,
0x63,0x34,0x20,0x72,0x67,0x62,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x64,0x6f,0x74,0x28,0x72,0x67,0x62,0x61,0x2c,0x20,
0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x30,0x33,0x39,
0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,0x36,0x39,
0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x35,
0x33,0x37,0x38,0x37,0x30,0x30,0x34,0x38,0x31,0x39,0x36,0x30,0x35,0x34,0x39,0x39,
0x35,0x30,0x35,0x39,0x39,0x36,0x37,0x30,0x34,0x31,0x30,0x31,0x35,0x36,0x65,0x2d,
0x30,0x35,0x2c,0x20,0x36,0x2e,0x30,0x33,0x30,0x38,0x36,0x32,0x39,0x32,0x30,0x31,
0x36,0x39,0x39,0x36,0x35,0x39,0x34,0x36,0x31,0x31,0x35,0x35,0x35,0x33,0x33,0x37,
0x39,0x30,0x35,0x38,0x38,0x65,0x2d,0x30,0x38,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,
0x64,0x6f,0x77,0x28,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x2c,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x20,0x63,0x6f,0x6d,0x70,0x61,0x72,0x65,0x2c,0x20,0x73,0x61,0x6d,0x70,
0x6c,0x65,0x72,0x32,0x44,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,0x74,0x65,0x78,0x73,0x6d,0x70,
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,
0x61,0x6d,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x53,0x50,0x49,
0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,
0x64,0x74,0x65,0x78,0x73,0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x75,0x76,
0x2e,0x78,0x2c,0x20,0x75,0x76,0x2e,0x79,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x65,0x70,0x28,0x63,0x6f,0x6d,0x70,
0x61,0x72,0x65,0x2c,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,
0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,
0x61,0x74,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,
0x5f,0x70,0x63,0x66,0x28,0x76,0x65,0x63,0x33,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,
0x74,0x68,0x2c,0x20,0x76,0x65,0x63,0x32,0x20,0x73,0x6d,0x5f,0x73,0x69,0x7a,0x65,
0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,
0x74,0x65,0x78,0x73,0x6d,0x70,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x20,0x3d,0x20,0x30,0x2e,0x30,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x78,
0x20,0x3d,0x20,0x2d,0x32,0x3b,0x20,0x78,0x20,0x3c,0x3d,0x20,0x32,0x3b,0x20,0x78,
0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x79,0x20,0x3d,0x20,0x2d,
0x32,0x3b,0x20,0x79,0x20,0x3c,0x3d,0x20,0x32,0x3b,0x20,0x79,0x2b,0x2b,0x29,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,
0x20,0x3d,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,0x74,0x68,0x2e,0x78,0x79,0x20,0x2b,
0x20,0x28,0x76,0x65,0x63,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x78,0x29,0x2c,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x79,0x29,0x29,0x20,0x2f,0x20,0x73,0x6d,0x5f,
0x73,0x69,0x7a,0x65,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,
0x20,0x3d,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,0x74,0x68,0x2e,0x7a,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x73,0x75,0x6c,
0x74,0x20,0x2b,0x3d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,
0x6f,0x77,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x31,0x2c,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,
0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,0x74,0x65,0x78,0x73,0x6d,0x70,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x72,0x65,0x73,0x75,0x6c,
0x74,0x20,0x2a,0x20,0x30,0x2e,0x30,0x33,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x31,
0x30,0x35,0x39,0x33,0x30,0x33,0x32,0x38,0x33,0x36,0x39,0x31,0x34,0x30,0x36,0x32,
0x35,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x34,0x20,0x67,0x61,0x6d,0x6d,0x61,
0x28,0x76,0x65,0x63,0x34,0x20,0x63,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x77,0x28,0x63,
0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x34,0x35,0x34,
0x35,0x34,0x35,0x34,0x36,0x38,0x30,0x39,0x31,0x39,0x36,0x34,0x37,0x32,0x31,0x36,
0x37,0x39,0x36,0x38,0x37,0x35,0x29,0x29,0x2c,0x20,0x63,0x2e,0x77,0x29,0x3b,0x0a,
0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x36,0x31,0x20,0x3d,
0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x66,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,
0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,
0x31,0x36,0x36,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,0x6f,0x72,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x37,0x30,0x20,0x3d,0x20,0x64,0x6f,
0x74,0x28,0x5f,0x31,0x36,0x36,0x2c,0x20,0x5f,0x31,0x36,0x31,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x30,0x20,0x3e,0x20,0x30,0x2e,
0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x38,0x34,0x20,0x3d,0x20,0x6c,0x69,0x67,
0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x20,
0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,
0x6a,0x5f,0x70,0x6f,0x73,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x76,
0x65,0x63,0x33,0x28,0x28,0x5f,0x31,0x38,0x34,0x2e,0x78,0x79,0x20,0x2b,0x20,0x76,
0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x2c,
0x20,0x5f,0x31,0x38,0x34,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,
0x20,0x76,0x65,0x63,0x32,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x69,0x7a,
0x65,0x28,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x6d,0x61,0x70,0x5f,0x73,0x68,0x61,
0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x30,0x29,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
0x5f,0x32,0x30,0x32,0x20,0x3d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x70,0x63,0x66,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,
0x6d,0x61,0x70,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,
0x65,0x72,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,
0x65,0x63,0x33,0x28,0x28,0x70,0x6f,0x77,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,
0x28,0x72,0x65,0x66,0x6c,0x65,0x63,0x74,0x28,0x2d,0x5f,0x31,0x36,0x31,0x2c,0x20,
0x5f,0x31,0x36,0x36,0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x28,0x66,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x77,0x6f,0x72,0x6c,
0x64,0x5f,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,
0x29,0x2c,0x20,0x32,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x36,0x38,
0x33,0x37,0x31,0x35,0x38,0x32,0x30,0x33,0x31,0x32,0x35,0x29,0x20,0x2a,0x20,0x5f,
0x31,0x37,0x30,0x29,0x20,0x2a,0x20,0x5f,0x32,0x30,0x32,0x29,0x20,0x2b,0x20,0x28,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x5f,0x31,0x37,
0x30,0x20,0x2a,0x20,0x5f,0x32,0x30,0x32,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,
0x20,0x30,0x2e,0x32,0x35,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x2a,0x20,0x30,0x2e,0x32,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x67,0x61,0x6d,0x6d,0x61,0x28,0x70,0x61,
0x72,0x61,0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) in vec2 pos;
layout(location = 0) out vec2 uv;
void main()
{
gl_Position = vec4((pos * 2.0) - vec2(1.0), 0.5, 1.0);
uv = pos;
gl_Position.y = -gl_Position.y;
}
*/
static const uint8_t vs_dbg_source_glsl410[210] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x3b,0x0a,
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20,0x32,
0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,
0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x76,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
/*
#version 410
uniform sampler2D dbg_tex_dbg_smp;
layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 frag_color;
float decodeDepth(vec4 rgba)
{
return dot(rgba, vec4(1.0, 0.0039215688593685626983642578125, 1.5378700481960549950599670410156e-05, 6.0308629201699659461155533790588e-08));
}
void main()
{
vec4 param = texture(dbg_tex_dbg_smp, uv);
float _40 = decodeDepth(param);
frag_color = vec4(_40, _40, _40, 1.0);
}
*/
static const uint8_t fs_dbg_source_glsl410[450] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
0x64,0x62,0x67,0x5f,0x74,0x65,0x78,0x5f,0x64,0x62,0x67,0x5f,0x73,0x6d,0x70,0x3b,
0x0a,0x0a,0x6c,0x61,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,0x75,
0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,
0x76,0x65,0x63,0x34,0x20,0x72,0x67,0x62,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x64,0x6f,0x74,0x28,0x72,0x67,0x62,0x61,
0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x30,
0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,
0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,
0x2e,0x35,0x33,0x37,0x38,0x37,0x30,0x30,0x34,0x38,0x31,0x39,0x36,0x30,0x35,0x34,
0x39,0x39,0x35,0x30,0x35,0x39,0x39,0x36,0x37,0x30,0x34,0x31,0x30,0x31,0x35,0x36,
0x65,0x2d,0x30,0x35,0x2c,0x20,0x36,0x2e,0x30,0x33,0x30,0x38,0x36,0x32,0x39,0x32,
0x30,0x31,0x36,0x39,0x39,0x36,0x35,0x39,0x34,0x36,0x31,0x31,0x35,0x35,0x35,0x33,
0x33,0x37,0x39,0x30,0x35,0x38,0x38,0x65,0x2d,0x30,0x38,0x29,0x29,0x3b,0x0a,0x7d,
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x62,0x67,0x5f,0x74,0x65,0x78,
0x5f,0x64,0x62,0x67,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x30,0x20,0x3d,0x20,0x64,
0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,0x70,0x61,0x72,0x61,0x6d,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x34,0x30,0x2c,0x20,0x5f,0x34,
0x30,0x2c,0x20,0x5f,0x34,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
static inline const sg_shader_desc* dbg_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_dbg_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_dbg_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "dbg_tex_dbg_smp";
desc.label = "dbg_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* display_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_display_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_display_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.attrs[1].glsl_name = "norm";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 208;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 13;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_display_params";
desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[1].size = 32;
desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2;
desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_display_params";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "shadow_map_shadow_sampler";
desc.label = "display_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* shadow_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_shadow_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_shadow_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 64;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_shadow_params";
desc.label = "shadow_shader";
}
return &desc;
}
return 0;
}

View File

@ -0,0 +1,624 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/shadows-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen_display.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'dbg':
Get shader desc: dbg_shader_desc(sg_query_backend());
Vertex Shader: vs_dbg
Fragment Shader: fs_dbg
Attributes:
ATTR_dbg_pos => 0
Shader program: 'display':
Get shader desc: display_shader_desc(sg_query_backend());
Vertex Shader: vs_display
Fragment Shader: fs_display
Attributes:
ATTR_display_pos => 0
ATTR_display_norm => 1
Shader program: 'shadow':
Get shader desc: shadow_shader_desc(sg_query_backend());
Vertex Shader: vs_shadow
Fragment Shader: fs_shadow
Attributes:
ATTR_shadow_pos => 0
Bindings:
Uniform block 'vs_display_params':
C struct: vs_display_params_t
Bind slot: UB_vs_display_params => 0
Uniform block 'fs_display_params':
C struct: fs_display_params_t
Bind slot: UB_fs_display_params => 1
Uniform block 'vs_shadow_params':
C struct: vs_shadow_params_t
Bind slot: UB_vs_shadow_params => 0
Image 'dbg_tex':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_dbg_tex => 0
Image 'shadow_map':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_shadow_map => 0
Sampler 'dbg_smp':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_dbg_smp => 0
Sampler 'shadow_sampler':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_shadow_sampler => 0
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen_display.h"
#endif
#if !defined(SOKOL_SHDC_ALIGN)
#if defined(_MSC_VER)
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
#else
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_dbg_pos (0)
#define ATTR_display_pos (0)
#define ATTR_display_norm (1)
#define ATTR_shadow_pos (0)
#define UB_vs_display_params (0)
#define UB_fs_display_params (1)
#define UB_vs_shadow_params (0)
#define IMG_dbg_tex (0)
#define IMG_shadow_map (0)
#define SMP_dbg_smp (0)
#define SMP_shadow_sampler (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_display_params_t {
hmm_mat4 mvp;
hmm_mat4 model;
hmm_mat4 light_mvp;
hmm_vec3 diff_color;
uint8_t _pad_204[4];
} vs_display_params_t;
#pragma pack(pop)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct fs_display_params_t {
hmm_vec3 light_dir;
uint8_t _pad_12[4];
hmm_vec3 eye_pos;
uint8_t _pad_28[4];
} fs_display_params_t;
#pragma pack(pop)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_shadow_params_t {
hmm_mat4 mvp;
} vs_shadow_params_t;
#pragma pack(pop)
/*
#version 410
uniform vec4 vs_shadow_params[4];
layout(location = 0) in vec4 pos;
layout(location = 0) out vec2 proj_zw;
void main()
{
gl_Position = mat4(vs_shadow_params[0], vs_shadow_params[1], vs_shadow_params[2], vs_shadow_params[3]) * pos;
proj_zw = gl_Position.zw;
}
*/
static const uint8_t vs_shadow_source_glsl410[284] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,
0x6c,0x61,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,0x34,0x20,0x70,0x6f,0x73,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,
0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,
0x73,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x73,0x68,0x61,0x64,
0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,
0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,
0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x72,
0x6f,0x6a,0x5f,0x7a,0x77,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x2e,0x7a,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) in vec2 proj_zw;
layout(location = 0) out vec4 frag_color;
vec4 encode_depth(float v)
{
vec4 _23 = fract(vec4(1.0, 255.0, 65025.0, 16581375.0) * v);
return fma(-_23.yzww, vec4(0.0039215688593685626983642578125, 0.0039215688593685626983642578125, 0.0039215688593685626983642578125, 0.0), _23);
}
void main()
{
float param = proj_zw.x / proj_zw.y;
frag_color = encode_depth(param);
}
*/
static const uint8_t fs_shadow_source_glsl410[437] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x72,0x6f,0x6a,0x5f,
0x7a,0x77,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,
0x65,0x63,0x34,0x20,0x65,0x6e,0x63,0x6f,0x64,0x65,0x5f,0x64,0x65,0x70,0x74,0x68,
0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,0x66,0x72,0x61,0x63,0x74,
0x28,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x32,0x35,0x35,0x2e,0x30,
0x2c,0x20,0x36,0x35,0x30,0x32,0x35,0x2e,0x30,0x2c,0x20,0x31,0x36,0x35,0x38,0x31,
0x33,0x37,0x35,0x2e,0x30,0x29,0x20,0x2a,0x20,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6d,0x61,0x28,0x2d,0x5f,0x32,0x33,
0x2e,0x79,0x7a,0x77,0x77,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x30,
0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,
0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,
0x2e,0x30,0x30,0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,
0x35,0x36,0x32,0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,
0x2c,0x20,0x30,0x2e,0x30,0x30,0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,
0x33,0x36,0x38,0x35,0x36,0x32,0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,
0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x5f,0x32,0x33,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,
0x6d,0x20,0x3d,0x20,0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x2e,0x78,0x20,0x2f,0x20,
0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x65,0x6e,0x63,0x6f,
0x64,0x65,0x5f,0x64,0x65,0x70,0x74,0x68,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 vs_display_params[13];
layout(location = 0) in vec4 pos;
layout(location = 1) out vec4 light_proj_pos;
layout(location = 2) out vec4 world_pos;
layout(location = 3) out vec3 world_norm;
layout(location = 1) in vec3 norm;
layout(location = 0) out vec3 color;
void main()
{
gl_Position = mat4(vs_display_params[0], vs_display_params[1], vs_display_params[2], vs_display_params[3]) * pos;
light_proj_pos = mat4(vs_display_params[8], vs_display_params[9], vs_display_params[10], vs_display_params[11]) * pos;
mat4 _39 = mat4(vs_display_params[4], vs_display_params[5], vs_display_params[6], vs_display_params[7]);
world_pos = _39 * pos;
world_norm = normalize((_39 * vec4(norm, 0.0)).xyz);
color = vs_display_params[12].xyz;
}
*/
static const uint8_t vs_display_source_glsl410[777] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x33,0x5d,
0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x70,
0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
0x34,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,
0x77,0x6f,0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,
0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,
0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x33,0x20,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,
0x20,0x76,0x65,0x63,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,
0x74,0x34,0x28,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,
0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,
0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x64,
0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,
0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x39,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,
0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x30,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x31,0x31,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x33,0x39,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,
0x28,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,
0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,
0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,
0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x77,0x6f,
0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x39,0x20,0x2a,0x20,
0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,
0x6f,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x28,0x5f,0x33,0x39,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x6e,0x6f,0x72,0x6d,
0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,
0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x2e,
0x78,0x79,0x7a,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 fs_display_params[2];
uniform sampler2D shadow_map_shadow_sampler;
layout(location = 3) in vec3 world_norm;
layout(location = 1) in vec4 light_proj_pos;
layout(location = 2) in vec4 world_pos;
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec3 color;
float decodeDepth(vec4 rgba)
{
return dot(rgba, vec4(1.0, 0.0039215688593685626983642578125, 1.5378700481960549950599670410156e-05, 6.0308629201699659461155533790588e-08));
}
float sample_shadow(vec2 uv, float compare, sampler2D SPIRV_Cross_Combinedtexsmp)
{
vec4 param = texture(SPIRV_Cross_Combinedtexsmp, vec2(uv.x, uv.y));
return step(compare, decodeDepth(param));
}
float sample_shadow_pcf(vec3 uv_depth, vec2 sm_size, sampler2D SPIRV_Cross_Combinedtexsmp)
{
float result = 0.0;
for (int x = -2; x <= 2; x++)
{
for (int y = -2; y <= 2; y++)
{
vec2 param = uv_depth.xy + (vec2(float(x), float(y)) / sm_size);
float param_1 = uv_depth.z;
result += sample_shadow(param, param_1, SPIRV_Cross_Combinedtexsmp);
}
}
return result * 0.039999999105930328369140625;
}
vec4 gamma(vec4 c)
{
return vec4(pow(c.xyz, vec3(0.4545454680919647216796875)), c.w);
}
void main()
{
vec3 _161 = normalize(fs_display_params[0].xyz);
vec3 _166 = normalize(world_norm);
float _170 = dot(_166, _161);
if (_170 > 0.0)
{
vec3 _184 = light_proj_pos.xyz / vec3(light_proj_pos.w);
vec3 param = vec3((_184.xy + vec2(1.0)) * 0.5, _184.z);
vec2 param_1 = vec2(textureSize(shadow_map_shadow_sampler, 0));
float _202 = sample_shadow_pcf(param, param_1, shadow_map_shadow_sampler);
frag_color = vec4(vec3((pow(max(dot(reflect(-_161, _166), normalize(fs_display_params[1].xyz - world_pos.xyz)), 0.0), 2.2000000476837158203125) * _170) * _202) + (color * (max(_170 * _202, 0.0) + 0.25)), 1.0);
}
else
{
frag_color = vec4(color * 0.25, 1.0);
}
vec4 param_2 = frag_color;
frag_color = gamma(param_2);
}
*/
static const uint8_t fs_display_source_glsl410[2060] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
0x32,0x44,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x6d,0x61,0x70,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x6c,
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x77,0x6f,0x72,0x6c,
0x64,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,
0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,
0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x34,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,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,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,
0x74,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,0x76,0x65,
0x63,0x34,0x20,0x72,0x67,0x62,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x64,0x6f,0x74,0x28,0x72,0x67,0x62,0x61,0x2c,0x20,
0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x30,0x33,0x39,
0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,0x36,0x39,
0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x35,
0x33,0x37,0x38,0x37,0x30,0x30,0x34,0x38,0x31,0x39,0x36,0x30,0x35,0x34,0x39,0x39,
0x35,0x30,0x35,0x39,0x39,0x36,0x37,0x30,0x34,0x31,0x30,0x31,0x35,0x36,0x65,0x2d,
0x30,0x35,0x2c,0x20,0x36,0x2e,0x30,0x33,0x30,0x38,0x36,0x32,0x39,0x32,0x30,0x31,
0x36,0x39,0x39,0x36,0x35,0x39,0x34,0x36,0x31,0x31,0x35,0x35,0x35,0x33,0x33,0x37,
0x39,0x30,0x35,0x38,0x38,0x65,0x2d,0x30,0x38,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,
0x64,0x6f,0x77,0x28,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x2c,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x20,0x63,0x6f,0x6d,0x70,0x61,0x72,0x65,0x2c,0x20,0x73,0x61,0x6d,0x70,
0x6c,0x65,0x72,0x32,0x44,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,0x74,0x65,0x78,0x73,0x6d,0x70,
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,
0x61,0x6d,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x53,0x50,0x49,
0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,
0x64,0x74,0x65,0x78,0x73,0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x75,0x76,
0x2e,0x78,0x2c,0x20,0x75,0x76,0x2e,0x79,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x65,0x70,0x28,0x63,0x6f,0x6d,0x70,
0x61,0x72,0x65,0x2c,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,
0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,
0x61,0x74,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,
0x5f,0x70,0x63,0x66,0x28,0x76,0x65,0x63,0x33,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,
0x74,0x68,0x2c,0x20,0x76,0x65,0x63,0x32,0x20,0x73,0x6d,0x5f,0x73,0x69,0x7a,0x65,
0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,
0x74,0x65,0x78,0x73,0x6d,0x70,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x20,0x3d,0x20,0x30,0x2e,0x30,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x78,
0x20,0x3d,0x20,0x2d,0x32,0x3b,0x20,0x78,0x20,0x3c,0x3d,0x20,0x32,0x3b,0x20,0x78,
0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x79,0x20,0x3d,0x20,0x2d,
0x32,0x3b,0x20,0x79,0x20,0x3c,0x3d,0x20,0x32,0x3b,0x20,0x79,0x2b,0x2b,0x29,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,
0x20,0x3d,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,0x74,0x68,0x2e,0x78,0x79,0x20,0x2b,
0x20,0x28,0x76,0x65,0x63,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x78,0x29,0x2c,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x79,0x29,0x29,0x20,0x2f,0x20,0x73,0x6d,0x5f,
0x73,0x69,0x7a,0x65,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,
0x20,0x3d,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,0x74,0x68,0x2e,0x7a,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x73,0x75,0x6c,
0x74,0x20,0x2b,0x3d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,
0x6f,0x77,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x31,0x2c,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,
0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,0x74,0x65,0x78,0x73,0x6d,0x70,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x72,0x65,0x73,0x75,0x6c,
0x74,0x20,0x2a,0x20,0x30,0x2e,0x30,0x33,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x31,
0x30,0x35,0x39,0x33,0x30,0x33,0x32,0x38,0x33,0x36,0x39,0x31,0x34,0x30,0x36,0x32,
0x35,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x34,0x20,0x67,0x61,0x6d,0x6d,0x61,
0x28,0x76,0x65,0x63,0x34,0x20,0x63,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x77,0x28,0x63,
0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x34,0x35,0x34,
0x35,0x34,0x35,0x34,0x36,0x38,0x30,0x39,0x31,0x39,0x36,0x34,0x37,0x32,0x31,0x36,
0x37,0x39,0x36,0x38,0x37,0x35,0x29,0x29,0x2c,0x20,0x63,0x2e,0x77,0x29,0x3b,0x0a,
0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x36,0x31,0x20,0x3d,
0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x66,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,
0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,
0x31,0x36,0x36,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,0x6f,0x72,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x37,0x30,0x20,0x3d,0x20,0x64,0x6f,
0x74,0x28,0x5f,0x31,0x36,0x36,0x2c,0x20,0x5f,0x31,0x36,0x31,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x30,0x20,0x3e,0x20,0x30,0x2e,
0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x38,0x34,0x20,0x3d,0x20,0x6c,0x69,0x67,
0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x20,
0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,
0x6a,0x5f,0x70,0x6f,0x73,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x76,
0x65,0x63,0x33,0x28,0x28,0x5f,0x31,0x38,0x34,0x2e,0x78,0x79,0x20,0x2b,0x20,0x76,
0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x2c,
0x20,0x5f,0x31,0x38,0x34,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,
0x20,0x76,0x65,0x63,0x32,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x69,0x7a,
0x65,0x28,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x6d,0x61,0x70,0x5f,0x73,0x68,0x61,
0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x30,0x29,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
0x5f,0x32,0x30,0x32,0x20,0x3d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x70,0x63,0x66,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,
0x6d,0x61,0x70,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,
0x65,0x72,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,
0x65,0x63,0x33,0x28,0x28,0x70,0x6f,0x77,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,
0x28,0x72,0x65,0x66,0x6c,0x65,0x63,0x74,0x28,0x2d,0x5f,0x31,0x36,0x31,0x2c,0x20,
0x5f,0x31,0x36,0x36,0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x28,0x66,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x77,0x6f,0x72,0x6c,
0x64,0x5f,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,
0x29,0x2c,0x20,0x32,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x36,0x38,
0x33,0x37,0x31,0x35,0x38,0x32,0x30,0x33,0x31,0x32,0x35,0x29,0x20,0x2a,0x20,0x5f,
0x31,0x37,0x30,0x29,0x20,0x2a,0x20,0x5f,0x32,0x30,0x32,0x29,0x20,0x2b,0x20,0x28,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x5f,0x31,0x37,
0x30,0x20,0x2a,0x20,0x5f,0x32,0x30,0x32,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,
0x20,0x30,0x2e,0x32,0x35,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x2a,0x20,0x30,0x2e,0x32,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x67,0x61,0x6d,0x6d,0x61,0x28,0x70,0x61,
0x72,0x61,0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) in vec2 pos;
layout(location = 0) out vec2 uv;
void main()
{
gl_Position = vec4((pos * 2.0) - vec2(1.0), 0.5, 1.0);
uv = pos;
gl_Position.y = -gl_Position.y;
}
*/
static const uint8_t vs_dbg_source_glsl410[210] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x3b,0x0a,
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20,0x32,
0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,
0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x76,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
/*
#version 410
uniform sampler2D dbg_tex_dbg_smp;
layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 frag_color;
float decodeDepth(vec4 rgba)
{
return dot(rgba, vec4(1.0, 0.0039215688593685626983642578125, 1.5378700481960549950599670410156e-05, 6.0308629201699659461155533790588e-08));
}
void main()
{
vec4 param = texture(dbg_tex_dbg_smp, uv);
float _40 = decodeDepth(param);
frag_color = vec4(_40, _40, _40, 1.0);
}
*/
static const uint8_t fs_dbg_source_glsl410[450] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
0x64,0x62,0x67,0x5f,0x74,0x65,0x78,0x5f,0x64,0x62,0x67,0x5f,0x73,0x6d,0x70,0x3b,
0x0a,0x0a,0x6c,0x61,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,0x75,
0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,
0x76,0x65,0x63,0x34,0x20,0x72,0x67,0x62,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x64,0x6f,0x74,0x28,0x72,0x67,0x62,0x61,
0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x30,
0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,
0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,
0x2e,0x35,0x33,0x37,0x38,0x37,0x30,0x30,0x34,0x38,0x31,0x39,0x36,0x30,0x35,0x34,
0x39,0x39,0x35,0x30,0x35,0x39,0x39,0x36,0x37,0x30,0x34,0x31,0x30,0x31,0x35,0x36,
0x65,0x2d,0x30,0x35,0x2c,0x20,0x36,0x2e,0x30,0x33,0x30,0x38,0x36,0x32,0x39,0x32,
0x30,0x31,0x36,0x39,0x39,0x36,0x35,0x39,0x34,0x36,0x31,0x31,0x35,0x35,0x35,0x33,
0x33,0x37,0x39,0x30,0x35,0x38,0x38,0x65,0x2d,0x30,0x38,0x29,0x29,0x3b,0x0a,0x7d,
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x62,0x67,0x5f,0x74,0x65,0x78,
0x5f,0x64,0x62,0x67,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x30,0x20,0x3d,0x20,0x64,
0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,0x70,0x61,0x72,0x61,0x6d,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x34,0x30,0x2c,0x20,0x5f,0x34,
0x30,0x2c,0x20,0x5f,0x34,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
static inline const sg_shader_desc* dbg_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_dbg_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_dbg_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "dbg_tex_dbg_smp";
desc.label = "dbg_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* display_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_display_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_display_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.attrs[1].glsl_name = "norm";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 208;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 13;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_display_params";
desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[1].size = 32;
desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2;
desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_display_params";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "shadow_map_shadow_sampler";
desc.label = "display_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* shadow_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_shadow_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_shadow_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 64;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_shadow_params";
desc.label = "shadow_shader";
}
return &desc;
}
return 0;
}

View File

@ -0,0 +1,624 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/shadows-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen_shadow.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'dbg':
Get shader desc: dbg_shader_desc(sg_query_backend());
Vertex Shader: vs_dbg
Fragment Shader: fs_dbg
Attributes:
ATTR_dbg_pos => 0
Shader program: 'display':
Get shader desc: display_shader_desc(sg_query_backend());
Vertex Shader: vs_display
Fragment Shader: fs_display
Attributes:
ATTR_display_pos => 0
ATTR_display_norm => 1
Shader program: 'shadow':
Get shader desc: shadow_shader_desc(sg_query_backend());
Vertex Shader: vs_shadow
Fragment Shader: fs_shadow
Attributes:
ATTR_shadow_pos => 0
Bindings:
Uniform block 'vs_display_params':
C struct: vs_display_params_t
Bind slot: UB_vs_display_params => 0
Uniform block 'fs_display_params':
C struct: fs_display_params_t
Bind slot: UB_fs_display_params => 1
Uniform block 'vs_shadow_params':
C struct: vs_shadow_params_t
Bind slot: UB_vs_shadow_params => 0
Image 'dbg_tex':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_dbg_tex => 0
Image 'shadow_map':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: IMG_shadow_map => 0
Sampler 'dbg_smp':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_dbg_smp => 0
Sampler 'shadow_sampler':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_shadow_sampler => 0
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen_shadow.h"
#endif
#if !defined(SOKOL_SHDC_ALIGN)
#if defined(_MSC_VER)
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
#else
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_dbg_pos (0)
#define ATTR_display_pos (0)
#define ATTR_display_norm (1)
#define ATTR_shadow_pos (0)
#define UB_vs_display_params (0)
#define UB_fs_display_params (1)
#define UB_vs_shadow_params (0)
#define IMG_dbg_tex (0)
#define IMG_shadow_map (0)
#define SMP_dbg_smp (0)
#define SMP_shadow_sampler (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_display_params_t {
hmm_mat4 mvp;
hmm_mat4 model;
hmm_mat4 light_mvp;
hmm_vec3 diff_color;
uint8_t _pad_204[4];
} vs_display_params_t;
#pragma pack(pop)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct fs_display_params_t {
hmm_vec3 light_dir;
uint8_t _pad_12[4];
hmm_vec3 eye_pos;
uint8_t _pad_28[4];
} fs_display_params_t;
#pragma pack(pop)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_shadow_params_t {
hmm_mat4 mvp;
} vs_shadow_params_t;
#pragma pack(pop)
/*
#version 410
uniform vec4 vs_shadow_params[4];
layout(location = 0) in vec4 pos;
layout(location = 0) out vec2 proj_zw;
void main()
{
gl_Position = mat4(vs_shadow_params[0], vs_shadow_params[1], vs_shadow_params[2], vs_shadow_params[3]) * pos;
proj_zw = gl_Position.zw;
}
*/
static const uint8_t vs_shadow_source_glsl410[284] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,
0x6c,0x61,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,0x34,0x20,0x70,0x6f,0x73,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,
0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,
0x73,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x73,0x68,0x61,0x64,
0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,
0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,
0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x72,
0x6f,0x6a,0x5f,0x7a,0x77,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x2e,0x7a,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) in vec2 proj_zw;
layout(location = 0) out vec4 frag_color;
vec4 encode_depth(float v)
{
vec4 _23 = fract(vec4(1.0, 255.0, 65025.0, 16581375.0) * v);
return fma(-_23.yzww, vec4(0.0039215688593685626983642578125, 0.0039215688593685626983642578125, 0.0039215688593685626983642578125, 0.0), _23);
}
void main()
{
float param = proj_zw.x / proj_zw.y;
frag_color = encode_depth(param);
}
*/
static const uint8_t fs_shadow_source_glsl410[437] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x72,0x6f,0x6a,0x5f,
0x7a,0x77,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,
0x65,0x63,0x34,0x20,0x65,0x6e,0x63,0x6f,0x64,0x65,0x5f,0x64,0x65,0x70,0x74,0x68,
0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,0x66,0x72,0x61,0x63,0x74,
0x28,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x32,0x35,0x35,0x2e,0x30,
0x2c,0x20,0x36,0x35,0x30,0x32,0x35,0x2e,0x30,0x2c,0x20,0x31,0x36,0x35,0x38,0x31,
0x33,0x37,0x35,0x2e,0x30,0x29,0x20,0x2a,0x20,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6d,0x61,0x28,0x2d,0x5f,0x32,0x33,
0x2e,0x79,0x7a,0x77,0x77,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x30,
0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,
0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,
0x2e,0x30,0x30,0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,
0x35,0x36,0x32,0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,
0x2c,0x20,0x30,0x2e,0x30,0x30,0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,
0x33,0x36,0x38,0x35,0x36,0x32,0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,
0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x5f,0x32,0x33,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,
0x6d,0x20,0x3d,0x20,0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x2e,0x78,0x20,0x2f,0x20,
0x70,0x72,0x6f,0x6a,0x5f,0x7a,0x77,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x65,0x6e,0x63,0x6f,
0x64,0x65,0x5f,0x64,0x65,0x70,0x74,0x68,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 vs_display_params[13];
layout(location = 0) in vec4 pos;
layout(location = 1) out vec4 light_proj_pos;
layout(location = 2) out vec4 world_pos;
layout(location = 3) out vec3 world_norm;
layout(location = 1) in vec3 norm;
layout(location = 0) out vec3 color;
void main()
{
gl_Position = mat4(vs_display_params[0], vs_display_params[1], vs_display_params[2], vs_display_params[3]) * pos;
light_proj_pos = mat4(vs_display_params[8], vs_display_params[9], vs_display_params[10], vs_display_params[11]) * pos;
mat4 _39 = mat4(vs_display_params[4], vs_display_params[5], vs_display_params[6], vs_display_params[7]);
world_pos = _39 * pos;
world_norm = normalize((_39 * vec4(norm, 0.0)).xyz);
color = vs_display_params[12].xyz;
}
*/
static const uint8_t vs_display_source_glsl410[777] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x33,0x5d,
0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x70,
0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
0x34,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,
0x77,0x6f,0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,
0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,
0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x33,0x20,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,
0x20,0x76,0x65,0x63,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,
0x74,0x34,0x28,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,
0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,
0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x64,
0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,
0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x39,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,
0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x30,0x5d,0x2c,0x20,0x76,
0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x31,0x31,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x33,0x39,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,
0x28,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,
0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,
0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,
0x5d,0x2c,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x77,0x6f,
0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x39,0x20,0x2a,0x20,
0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,
0x6f,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x28,0x5f,0x33,0x39,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x6e,0x6f,0x72,0x6d,
0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,0x5f,0x64,0x69,0x73,
0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x2e,
0x78,0x79,0x7a,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
uniform vec4 fs_display_params[2];
uniform sampler2D shadow_map_shadow_sampler;
layout(location = 3) in vec3 world_norm;
layout(location = 1) in vec4 light_proj_pos;
layout(location = 2) in vec4 world_pos;
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec3 color;
float decodeDepth(vec4 rgba)
{
return dot(rgba, vec4(1.0, 0.0039215688593685626983642578125, 1.5378700481960549950599670410156e-05, 6.0308629201699659461155533790588e-08));
}
float sample_shadow(vec2 uv, float compare, sampler2D SPIRV_Cross_Combinedtexsmp)
{
vec4 param = texture(SPIRV_Cross_Combinedtexsmp, vec2(uv.x, uv.y));
return step(compare, decodeDepth(param));
}
float sample_shadow_pcf(vec3 uv_depth, vec2 sm_size, sampler2D SPIRV_Cross_Combinedtexsmp)
{
float result = 0.0;
for (int x = -2; x <= 2; x++)
{
for (int y = -2; y <= 2; y++)
{
vec2 param = uv_depth.xy + (vec2(float(x), float(y)) / sm_size);
float param_1 = uv_depth.z;
result += sample_shadow(param, param_1, SPIRV_Cross_Combinedtexsmp);
}
}
return result * 0.039999999105930328369140625;
}
vec4 gamma(vec4 c)
{
return vec4(pow(c.xyz, vec3(0.4545454680919647216796875)), c.w);
}
void main()
{
vec3 _161 = normalize(fs_display_params[0].xyz);
vec3 _166 = normalize(world_norm);
float _170 = dot(_166, _161);
if (_170 > 0.0)
{
vec3 _184 = light_proj_pos.xyz / vec3(light_proj_pos.w);
vec3 param = vec3((_184.xy + vec2(1.0)) * 0.5, _184.z);
vec2 param_1 = vec2(textureSize(shadow_map_shadow_sampler, 0));
float _202 = sample_shadow_pcf(param, param_1, shadow_map_shadow_sampler);
frag_color = vec4(vec3((pow(max(dot(reflect(-_161, _166), normalize(fs_display_params[1].xyz - world_pos.xyz)), 0.0), 2.2000000476837158203125) * _170) * _202) + (color * (max(_170 * _202, 0.0) + 0.25)), 1.0);
}
else
{
frag_color = vec4(color * 0.25, 1.0);
}
vec4 param_2 = frag_color;
frag_color = gamma(param_2);
}
*/
static const uint8_t fs_display_source_glsl410[2060] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
0x32,0x44,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x6d,0x61,0x70,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x6c,
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x77,0x6f,0x72,0x6c,
0x64,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,
0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,
0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x34,0x20,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,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,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,
0x74,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,0x76,0x65,
0x63,0x34,0x20,0x72,0x67,0x62,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x64,0x6f,0x74,0x28,0x72,0x67,0x62,0x61,0x2c,0x20,
0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x30,0x33,0x39,
0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,0x36,0x39,
0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x35,
0x33,0x37,0x38,0x37,0x30,0x30,0x34,0x38,0x31,0x39,0x36,0x30,0x35,0x34,0x39,0x39,
0x35,0x30,0x35,0x39,0x39,0x36,0x37,0x30,0x34,0x31,0x30,0x31,0x35,0x36,0x65,0x2d,
0x30,0x35,0x2c,0x20,0x36,0x2e,0x30,0x33,0x30,0x38,0x36,0x32,0x39,0x32,0x30,0x31,
0x36,0x39,0x39,0x36,0x35,0x39,0x34,0x36,0x31,0x31,0x35,0x35,0x35,0x33,0x33,0x37,
0x39,0x30,0x35,0x38,0x38,0x65,0x2d,0x30,0x38,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,
0x64,0x6f,0x77,0x28,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x2c,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x20,0x63,0x6f,0x6d,0x70,0x61,0x72,0x65,0x2c,0x20,0x73,0x61,0x6d,0x70,
0x6c,0x65,0x72,0x32,0x44,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,0x74,0x65,0x78,0x73,0x6d,0x70,
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,
0x61,0x6d,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x53,0x50,0x49,
0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,
0x64,0x74,0x65,0x78,0x73,0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x75,0x76,
0x2e,0x78,0x2c,0x20,0x75,0x76,0x2e,0x79,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x65,0x70,0x28,0x63,0x6f,0x6d,0x70,
0x61,0x72,0x65,0x2c,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,
0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,
0x61,0x74,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,
0x5f,0x70,0x63,0x66,0x28,0x76,0x65,0x63,0x33,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,
0x74,0x68,0x2c,0x20,0x76,0x65,0x63,0x32,0x20,0x73,0x6d,0x5f,0x73,0x69,0x7a,0x65,
0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,
0x74,0x65,0x78,0x73,0x6d,0x70,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x20,0x3d,0x20,0x30,0x2e,0x30,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x78,
0x20,0x3d,0x20,0x2d,0x32,0x3b,0x20,0x78,0x20,0x3c,0x3d,0x20,0x32,0x3b,0x20,0x78,
0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x79,0x20,0x3d,0x20,0x2d,
0x32,0x3b,0x20,0x79,0x20,0x3c,0x3d,0x20,0x32,0x3b,0x20,0x79,0x2b,0x2b,0x29,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,
0x20,0x3d,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,0x74,0x68,0x2e,0x78,0x79,0x20,0x2b,
0x20,0x28,0x76,0x65,0x63,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x78,0x29,0x2c,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x79,0x29,0x29,0x20,0x2f,0x20,0x73,0x6d,0x5f,
0x73,0x69,0x7a,0x65,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,
0x20,0x3d,0x20,0x75,0x76,0x5f,0x64,0x65,0x70,0x74,0x68,0x2e,0x7a,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x73,0x75,0x6c,
0x74,0x20,0x2b,0x3d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,
0x6f,0x77,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x31,0x2c,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x43,
0x6f,0x6d,0x62,0x69,0x6e,0x65,0x64,0x74,0x65,0x78,0x73,0x6d,0x70,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x72,0x65,0x73,0x75,0x6c,
0x74,0x20,0x2a,0x20,0x30,0x2e,0x30,0x33,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x31,
0x30,0x35,0x39,0x33,0x30,0x33,0x32,0x38,0x33,0x36,0x39,0x31,0x34,0x30,0x36,0x32,
0x35,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x63,0x34,0x20,0x67,0x61,0x6d,0x6d,0x61,
0x28,0x76,0x65,0x63,0x34,0x20,0x63,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x77,0x28,0x63,
0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x34,0x35,0x34,
0x35,0x34,0x35,0x34,0x36,0x38,0x30,0x39,0x31,0x39,0x36,0x34,0x37,0x32,0x31,0x36,
0x37,0x39,0x36,0x38,0x37,0x35,0x29,0x29,0x2c,0x20,0x63,0x2e,0x77,0x29,0x3b,0x0a,
0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x36,0x31,0x20,0x3d,
0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x66,0x73,0x5f,0x64,0x69,
0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,
0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,
0x31,0x36,0x36,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x77,0x6f,0x72,0x6c,0x64,0x5f,0x6e,0x6f,0x72,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x37,0x30,0x20,0x3d,0x20,0x64,0x6f,
0x74,0x28,0x5f,0x31,0x36,0x36,0x2c,0x20,0x5f,0x31,0x36,0x31,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x30,0x20,0x3e,0x20,0x30,0x2e,
0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x38,0x34,0x20,0x3d,0x20,0x6c,0x69,0x67,
0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x20,
0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,
0x6a,0x5f,0x70,0x6f,0x73,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x76,
0x65,0x63,0x33,0x28,0x28,0x5f,0x31,0x38,0x34,0x2e,0x78,0x79,0x20,0x2b,0x20,0x76,
0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x2c,
0x20,0x5f,0x31,0x38,0x34,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,
0x20,0x76,0x65,0x63,0x32,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x69,0x7a,
0x65,0x28,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x6d,0x61,0x70,0x5f,0x73,0x68,0x61,
0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x30,0x29,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
0x5f,0x32,0x30,0x32,0x20,0x3d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x5f,0x73,0x68,
0x61,0x64,0x6f,0x77,0x5f,0x70,0x63,0x66,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,
0x6d,0x61,0x70,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x73,0x61,0x6d,0x70,0x6c,
0x65,0x72,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,
0x65,0x63,0x33,0x28,0x28,0x70,0x6f,0x77,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,
0x28,0x72,0x65,0x66,0x6c,0x65,0x63,0x74,0x28,0x2d,0x5f,0x31,0x36,0x31,0x2c,0x20,
0x5f,0x31,0x36,0x36,0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x28,0x66,0x73,0x5f,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x77,0x6f,0x72,0x6c,
0x64,0x5f,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,
0x29,0x2c,0x20,0x32,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x36,0x38,
0x33,0x37,0x31,0x35,0x38,0x32,0x30,0x33,0x31,0x32,0x35,0x29,0x20,0x2a,0x20,0x5f,
0x31,0x37,0x30,0x29,0x20,0x2a,0x20,0x5f,0x32,0x30,0x32,0x29,0x20,0x2b,0x20,0x28,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x5f,0x31,0x37,
0x30,0x20,0x2a,0x20,0x5f,0x32,0x30,0x32,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,
0x20,0x30,0x2e,0x32,0x35,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x2a,0x20,0x30,0x2e,0x32,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x67,0x61,0x6d,0x6d,0x61,0x28,0x70,0x61,
0x72,0x61,0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) in vec2 pos;
layout(location = 0) out vec2 uv;
void main()
{
gl_Position = vec4((pos * 2.0) - vec2(1.0), 0.5, 1.0);
uv = pos;
gl_Position.y = -gl_Position.y;
}
*/
static const uint8_t vs_dbg_source_glsl410[210] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x3b,0x0a,
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20,0x32,
0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,
0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x76,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
/*
#version 410
uniform sampler2D dbg_tex_dbg_smp;
layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 frag_color;
float decodeDepth(vec4 rgba)
{
return dot(rgba, vec4(1.0, 0.0039215688593685626983642578125, 1.5378700481960549950599670410156e-05, 6.0308629201699659461155533790588e-08));
}
void main()
{
vec4 param = texture(dbg_tex_dbg_smp, uv);
float _40 = decodeDepth(param);
frag_color = vec4(_40, _40, _40, 1.0);
}
*/
static const uint8_t fs_dbg_source_glsl410[450] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
0x64,0x62,0x67,0x5f,0x74,0x65,0x78,0x5f,0x64,0x62,0x67,0x5f,0x73,0x6d,0x70,0x3b,
0x0a,0x0a,0x6c,0x61,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,0x75,
0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x64,0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,
0x76,0x65,0x63,0x34,0x20,0x72,0x67,0x62,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x64,0x6f,0x74,0x28,0x72,0x67,0x62,0x61,
0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x30,
0x33,0x39,0x32,0x31,0x35,0x36,0x38,0x38,0x35,0x39,0x33,0x36,0x38,0x35,0x36,0x32,
0x36,0x39,0x38,0x33,0x36,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,
0x2e,0x35,0x33,0x37,0x38,0x37,0x30,0x30,0x34,0x38,0x31,0x39,0x36,0x30,0x35,0x34,
0x39,0x39,0x35,0x30,0x35,0x39,0x39,0x36,0x37,0x30,0x34,0x31,0x30,0x31,0x35,0x36,
0x65,0x2d,0x30,0x35,0x2c,0x20,0x36,0x2e,0x30,0x33,0x30,0x38,0x36,0x32,0x39,0x32,
0x30,0x31,0x36,0x39,0x39,0x36,0x35,0x39,0x34,0x36,0x31,0x31,0x35,0x35,0x35,0x33,
0x33,0x37,0x39,0x30,0x35,0x38,0x38,0x65,0x2d,0x30,0x38,0x29,0x29,0x3b,0x0a,0x7d,
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x62,0x67,0x5f,0x74,0x65,0x78,
0x5f,0x64,0x62,0x67,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x30,0x20,0x3d,0x20,0x64,
0x65,0x63,0x6f,0x64,0x65,0x44,0x65,0x70,0x74,0x68,0x28,0x70,0x61,0x72,0x61,0x6d,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x34,0x30,0x2c,0x20,0x5f,0x34,
0x30,0x2c,0x20,0x5f,0x34,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
static inline const sg_shader_desc* dbg_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_dbg_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_dbg_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "dbg_tex_dbg_smp";
desc.label = "dbg_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* display_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_display_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_display_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.attrs[1].glsl_name = "norm";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 208;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 13;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_display_params";
desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[1].size = 32;
desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2;
desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_display_params";
desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.images[0].image_type = SG_IMAGETYPE_2D;
desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.images[0].multisampled = false;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.image_sampler_pairs[0].image_slot = 0;
desc.image_sampler_pairs[0].sampler_slot = 0;
desc.image_sampler_pairs[0].glsl_name = "shadow_map_shadow_sampler";
desc.label = "display_shader";
}
return &desc;
}
return 0;
}
static inline const sg_shader_desc* shadow_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_shadow_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_shadow_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "pos";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 64;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_shadow_params";
desc.label = "shadow_shader";
}
return &desc;
}
return 0;
}

View File

@ -0,0 +1,168 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/shapes-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen_shapes.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'shapes':
Get shader desc: shapes_shader_desc(sg_query_backend());
Vertex Shader: vs_shapes
Fragment Shader: fs_shapes
Attributes:
ATTR_shapes_position => 0
ATTR_shapes_normal => 1
ATTR_shapes_texcoord => 2
ATTR_shapes_color0 => 3
Bindings:
Uniform block 'vs_params':
C struct: vs_params_t
Bind slot: UB_vs_params => 0
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen_shapes.h"
#endif
#if !defined(SOKOL_SHDC_ALIGN)
#if defined(_MSC_VER)
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
#else
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_shapes_position (0)
#define ATTR_shapes_normal (1)
#define ATTR_shapes_texcoord (2)
#define ATTR_shapes_color0 (3)
#define UB_vs_params (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
hmm_mat4 mvp;
float draw_mode;
uint8_t _pad_68[12];
} vs_params_t;
#pragma pack(pop)
/*
#version 410
uniform vec4 vs_params[5];
layout(location = 0) in vec4 position;
layout(location = 0) out vec4 color;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 texcoord;
layout(location = 3) in vec4 color0;
void main()
{
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position;
if (vs_params[4].x == 0.0)
{
color = vec4((normal + vec3(1.0)) * 0.5, 1.0);
}
else
{
if (vs_params[4].x == 1.0)
{
color = vec4(texcoord, 0.0, 1.0);
}
else
{
color = color0;
}
}
}
*/
static const uint8_t vs_shapes_source_glsl410[621] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,
0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,
0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,
0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,
0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,
0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,
0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x34,0x5d,0x2e,0x78,0x20,0x3d,0x3d,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,
0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x6e,0x6f,0x72,0x6d,0x61,
0x6c,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,
0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x78,0x20,0x3d,0x3d,0x20,0x31,
0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,
0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2c,
0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,
0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00,
};
/*
#version 410
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec4 color;
void main()
{
frag_color = color;
}
*/
static const uint8_t fs_shapes_source_glsl410[135] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
static inline const sg_shader_desc* shapes_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_shapes_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_shapes_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "position";
desc.attrs[1].glsl_name = "normal";
desc.attrs[2].glsl_name = "texcoord";
desc.attrs[3].glsl_name = "color0";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 80;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 5;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
desc.label = "shapes_shader";
}
return &desc;
}
return 0;
}

View File

@ -0,0 +1,102 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/triangle-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen_triangle.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'triangle':
Get shader desc: triangle_shader_desc(sg_query_backend());
Vertex Shader: vs_triangle
Fragment Shader: fs_triangle
Attributes:
ATTR_triangle_position => 0
ATTR_triangle_color0 => 1
Bindings:
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen_triangle.h"
#endif
#if !defined(SOKOL_SHDC_ALIGN)
#if defined(_MSC_VER)
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
#else
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_triangle_position (0)
#define ATTR_triangle_color0 (1)
/*
#version 410
layout(location = 0) in vec4 position;
layout(location = 0) out vec4 color;
layout(location = 1) in vec4 color0;
void main()
{
gl_Position = position;
color = color0;
}
*/
static const uint8_t vs_triangle_source_glsl410[194] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
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,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,
0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,
0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
};
/*
#version 410
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec4 color;
void main()
{
frag_color = color;
}
*/
static const uint8_t fs_triangle_source_glsl410[135] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,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,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
};
static inline const sg_shader_desc* triangle_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_GLCORE) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_triangle_source_glsl410;
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_triangle_source_glsl410;
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "position";
desc.attrs[1].glsl_name = "color0";
desc.label = "triangle_shader";
}
return &desc;
}
return 0;
}

306
engine/platform.lua Normal file
View File

@ -0,0 +1,306 @@
local ffi = require("ffi")
win = {}
-- --------------------------------------------------------------------------------------
-- Windows stuff
if ffi.os == "Windows" then
local shell32 = ffi.load("shell32")
-- TODO: Need equivalents for OSX and Linux - probably should go in a systems utils.
ffi.cdef[[
typedef char CHAR;
typedef uint8_t BYTE;
typedef uint32_t UINT;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef void* HINSTANCE;
typedef void* LPARAM;
typedef const char* LPCSTR;
typedef char* LPSTR;
typedef const void * HWND;
typedef void* LPVOID;
typedef int BOOL;
typedef struct RECT {
int x, y, w, h;
} RECT;
typedef struct _ITEMIDLIST {
BYTE mkid[1];
} ITEMIDLIST, *LPITEMIDLIST;
typedef int (__stdcall *BFFCALLBACK)(HWND, UINT, LPARAM, LPARAM);
typedef struct {
HWND hwndOwner;
LPCSTR pidlRoot;
LPSTR pszDisplayName;
LPCSTR lpszTitle;
UINT ulFlags;
BFFCALLBACK lpfn;
LPARAM lParam;
int iImage;
} BROWSEINFOA;
typedef struct tagOPENFILENAMEA {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCSTR lpstrFilter;
LPSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPSTR lpstrFile;
DWORD nMaxFile;
LPSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCSTR lpstrInitialDir;
LPCSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCSTR lpstrDefExt;
LPARAM lCustData;
void* lpfnHook;
LPCSTR lpTemplateName;
void* pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
} OPENFILENAMEA;
bool GetOpenFileNameA(OPENFILENAMEA *ofn);
LPITEMIDLIST SHBrowseForFolderA(BROWSEINFOA *bi);
BOOL SHGetPathFromIDListA(LPITEMIDLIST pidl, LPSTR pszPath);
void Sleep(uint32_t ms);
// Get the size of screen to the variable desktop
HWND GetDesktopWindow();
int GetWindowRect(HWND hwnd, RECT *hrect);
int ShowWindow(HWND hWnd, int nCmdShow);
int SetWindowPos( HWND hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint32_t uFlags);
]]
local HWND_TOP = 0x00
local SWP_NOSIZE = 0x01
local SW_SHOWMINIMIZED = 0x02
local SW_MAXIMIZE = 0x03
local comdlg32 = ffi.load("comdlg32")
local shell32 = ffi.load("shell32")
win.ShowWindow = function(hwnd, cmd)
if(cmd == 0) then
ffi.C.ShowWindow(hwnd, SW_SHOWMINIMIZED)
else
ffi.C.ShowWindow(hwnd, SW_MAXIMIZE)
end
end
win.Sleep = ffi.C.Sleep
win.SetWindowPos = function(hwnd, x, y, w, h)
ffi.C.SetWindowPos(hwnd, HWND_TOP, x, y, w, h, 0)
end
win.DetectDisplay = function()
local desktop = ffi.new("RECT[1]")
-- Get a handle to the desktop window
local hDesktop = ffi.C.GetDesktopWindow()
ffi.C.GetWindowRect(hDesktop, desktop)
return desktop[0].w, desktop[0].h
end
win.FileSelect = function()
-- buffer for returned file path
local pathBuf = ffi.new("char[260]") -- MAX_PATH
local ofn = ffi.new("OPENFILENAMEA")
ofn.lStructSize = ffi.sizeof(ofn)
ofn.hwndOwner = nil
ofn.lpstrFilter = "All Files\0*.*\0\0" -- Double null terminated
ofn.lpstrFile = pathBuf
ofn.nMaxFile = 260
ofn.Flags = 0x00080000 + 0x00001000 -- OFN_EXPLORER + OFN_FILEMUSTEXIST
local result = comdlg32.GetOpenFileNameA(ofn)
if result then
pprint("Selected file:", ffi.string(pathBuf))
return ffi.string(pathBuf)
else
pprint("No file selected (or dialog canceled).")
return nil
end
end
win.FolderSelect = function()
local pathBuf = ffi.new("char[260]") -- MAX_PATH
local displayBuf = ffi.new("char[260]")
local bi = ffi.new("BROWSEINFOA")
bi.hwndOwner = nil
bi.pidlRoot = nil -- start at Desktop
bi.pszDisplayName = displayBuf
bi.lpszTitle = "Select a folder:"
bi.ulFlags = 0x0001 + 0x00000040 + 0x00000100
local pidl = shell32.SHBrowseForFolderA(bi)
if pidl ~= nil then
if shell32.SHGetPathFromIDListA(pidl, pathBuf) ~= 0 then
pprint("Selected folder:", ffi.string(pathBuf))
return ffi.string(pathBuf)
else
pprint("Folder picked, but path could not be retrieved.")
return nil
end
else
pprint("User canceled.")
return nil
end
end
end
-- --------------------------------------------------------------------------------------
-- Linux stuff
if ffi.os == "Linux" then
ffi.cdef[[
typedef unsigned long Colormap;
typedef struct _Screen {
int width; /* width of the screen in pixels */
int height; /* height of the screen in pixels */
int mwidth; /* width of the screen in millimeters */
int mheight; /* height of the screen in millimeters */
int root; /* the root window of the screen */
int root_depth; /* the depth of the root window */
void *root_visual; /* the root window visual */
Colormap default_colormap; /* the default colormap */
int white_pixel; /* white pixel value */
int black_pixel; /* black pixel value */
int my_num; /* screen number */
bool is_installed; /* indicates whether the screen is installed */
void *saver; /* screen saver properties (if any) */
} Screen;
typedef unsigned long Atom;
typedef unsigned long Window;
typedef struct _XDisplay Display;
typedef struct _XEvent {
union {
struct {
unsigned long window;
int type;
int format;
Atom message_type;
long data[5];
} xclient;
};
} XEvent;
void usleep(unsigned int usec);
Display* XOpenDisplay(const char* display_name);
Window XRootWindow(Display* display, int screen_number);
int XGetWindowProperty(Display* display, Window w, Atom property, long long_offset,
long long_length, int delete, Atom req_type, Atom* actual_type,
int* actual_format, unsigned long* nitems,
unsigned long* bytes_after, unsigned char** prop);
int XSendEvent(Display* display, Window w, int propagate, long event_mask, XEvent* event);
Atom XInternAtom(Display* display, const char* name, int only_if_exists);
int XCloseDisplay(Display* display);
Screen *DefaultScreenOfDisplay(Display *display);
// Constants
#define AnyPropertyType 0
]]
-- Load the X11 library
local X11 = ffi.load("X11")
win.Sleep = function(ms) ffi.C.usleep(ms * 1000) end
-- Function to maximize a window
local function maximizeWindow(win)
-- Open the display
local display = X11.XOpenDisplay(nil)
if display == nil then
error("Unable to open X display")
end
-- Create the event structure
local ev = ffi.new("XEvent[1]")
-- Set up the event for the window maximize
ev[0].xclient.window = win
ev[0].xclient.type = 33 -- ClientMessage event type
ev[0].xclient.format = 32
ev[0].xclient.message_type = X11.XInternAtom(display, "_NET_WM_STATE", 0)
ev[0].xclient.data[0] = 1 -- Set to 1 to indicate we want to add the state
ev[0].xclient.data[1] = X11.XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORIZ", 0)
ev[0].xclient.data[2] = X11.XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", 0)
ev[0].xclient.data[3] = 1 -- 1 means "active" or "add" to the state
-- Send the event to the root window
X11.XSendEvent(display, 0, false, 0x00000008, ev) -- SubstructureNotifyMask
X11.XCloseDisplay(display)
end
-- --------------------------------------------------------------------------------------
-- TODO: ShowWindow not working properly on Linux yet
win.ShowWindow = function(hwnd, state)
-- Open the display
local display = X11.XOpenDisplay(hwnd)
if display == nil then
error("Unable to open X display")
end
-- auto display = XOpenDisplay(NULL);
-- Get the root window (or get the window ID through other methods if needed)
local root_window = X11.XRootWindow(display, 0)
-- Example usage: Get the active window and maximize it
local NET_ACTIVE_WINDOW = X11.XInternAtom(display, "_NET_ACTIVE_WINDOW", 0)
local prop = ffi.new("unsigned char*[1]")
local actual_type = ffi.new("Atom[1]")
local actual_format = ffi.new("int[1]")
local nitems = ffi.new("unsigned long[1]")
local bytes_after = ffi.new("unsigned long[1]")
-- Fetch the active window ID
local result = X11.XGetWindowProperty(display, root_window, NET_ACTIVE_WINDOW, 0, 1024, 0, 0,
actual_type, actual_format, nitems, bytes_after, prop)
if result == 0 then -- Success
-- Dereference the window ID
local window_id = ffi.cast("Window", ffi.cast("intptr_t", ffi.cast("void*", prop[0])))
-- Call the maximizeWindow function
maximizeWindow(window_id)
pprint("Window maximized successfully!")
else
pprint("Failed to fetch active window.")
end
pprint("Window resized successfully.")
end
win.DetectDisplay = function()
local display = X11.XOpenDisplay(hwnd)
if display == nil then
error("Unable to open X display")
end
local s = X11.DefaultScreenOfDisplay(display)
return s.width, s.height
end
end

View File

@ -3,7 +3,7 @@ local stb = require("stb")
local nk = sg
local utils = require("lua.utils")
-- require("engine.nuklear")
require("src.nuklear")
local ffi = require("ffi")
@ -34,6 +34,7 @@ renderer = {
ctx = nil,
all_fonts = {},
cursor = { name = "arrow", rect = { position = {x=0,y=0}, size ={x=1,y=1} } },
dt = 1.0 / 60.0,
}
renderer.font = {
@ -83,9 +84,9 @@ end
-- --------------------------------------------------------------------------------------
local function fix_tab_glyph(glyph, space)
local function fix_tab_glyph(glyph, space_size)
glyph[0].xadvance = space * 4
glyph[0].xadvance = space_size
glyph[0].w, glyph[0].h = 0, 0
glyph[0].x0, glyph[0].y0, glyph[0].x1, glyph[0].y1 = 0, 0, 0, 0
glyph[0].u0, glyph[0].v0, glyph[0].u1, glyph[0].v1 = 0, 0, 0, 0
@ -96,13 +97,12 @@ end
local rune_ranges = ffi.new("nk_rune[9]", {
0x0009, 0x000A, -- tab
0x0020, 0x00FF, -- basic Latin + Latin-1
0x2500, 0x2BFF, -- box-drawing, arrows
0xE000, 0xF8FF, -- private use / Nerd Font symbols
0
})
local fa_rune_ranges = ffi.new("nk_rune[9]", {
0xE000, 0xF8FF, -- private use / Nerd Font symbols
0xE000, 0xF8FF, -- only font awesome glyph ranges
0
})
@ -176,7 +176,7 @@ local function load_font(font_path, font_size)
local glyph = find_glyph(font.font, 9)
local space = get_glyph_xadvance(font.font.handle.userdata, 32)
if(glyph) then fix_tab_glyph(glyph, space) end
if(glyph) then fix_tab_glyph(glyph, space * 4) end
-- atlas[0].config.range = rune_ranges -- nk.nk_font_default_glyph_ranges()
end
@ -189,7 +189,7 @@ local function load_font(font_path, font_size)
image = nk.nk_font_atlas_bake(atlas, master_img_width, master_img_height, nk.NK_FONT_ATLAS_RGBA32)
local glyph = find_glyph(new_font, 9)
local space = get_glyph_xadvance(new_font.handle.userdata, 32)
if(glyph) then fix_tab_glyph(glyph, space) end
if(glyph) then fix_tab_glyph(glyph, space * 4) end
local nk_img = font_atlas_img(image, true)
@ -202,7 +202,14 @@ local function load_font(font_path, font_size)
local tab_size = get_glyph_xadvance(new_font.handle.userdata, 9)
-- print(master_img_width[0], master_img_height[0], tab_size)
local new_font_tbl = { tab_width = tab_size, font = new_font, path = font_path, size = font_size, cfg = nil }
local new_font_tbl = {
tab_width = tab_size,
tab_glyph = glyph,
font = new_font,
path = font_path,
size = font_size,
cfg = nil
}
tinsert(fonts, new_font_tbl)
return new_font_tbl
@ -221,14 +228,14 @@ renderer.font.load = function(path, size)
if(new_font == nil) then return nil end
new_font.set_tab_width = function(self, width)
if(width == self.tab_width) then return end
adjust_glyph( self.font.handle.userdata, 9, width )
fix_tab_glyph( self.tab_glyph, width )
self.tab_width = width
end
new_font.get_tab_width = function(self, width)
return self.tab_width
end
new_font.get_width = function(self, text)
if(text==nil) then print(debug.traceback()) end
if(text==nil) then pprint(debug.traceback()) end
local text = checkstring(text)
return self.font.handle.width(self.font.handle.userdata, self.font.handle.height, text, #text)
end
@ -248,6 +255,7 @@ end
-- --------------------------------------------------------------------------------------
renderer.show_debug = function(enable)
-- rencache.rencache_show_debug(enable)
end
-- --------------------------------------------------------------------------------------
@ -259,30 +267,44 @@ end
-- --------------------------------------------------------------------------------------
-- Not really needed
renderer.begin_frame = function()
-- rencache.rencache_begin_frame()
end
-- --------------------------------------------------------------------------------------
-- Hrm.. needed?
renderer.end_frame = function()
-- rencache.rencache_end_frame()
end
-- --------------------------------------------------------------------------------------
renderer.set_clip_rect = function(x, y, w, h)
nuklear_renderer.set_clip_rect(x, y, w, h)
-- rencache.rencache_set_clip_rect(x, y, w, h)
end
-- --------------------------------------------------------------------------------------
renderer.draw_rect = function(x, y, w, h, color)
nuklear_renderer.draw_rect(x, y, w, h, color)
-- rencache.rencache_draw_rect(x, y, w, h, color)
end
-- --------------------------------------------------------------------------------------
renderer.draw_text = function(font, text, x, y, color)
return nuklear_renderer.draw_text(font, text, x, y, color)
-- return rencache.rencache_draw_text(font, text, x, y, color)
end
-- --------------------------------------------------------------------------------------
renderer.enable_cursor = function(enable)
if(enable == true) then
nk.nk_style_show_cursor(renderer.ctx)
else
nk.nk_style_hide_cursor(renderer.ctx)
end
end
-- --------------------------------------------------------------------------------------
@ -298,6 +320,7 @@ end
renderer.load_image = function(filename, no_ui)
local img, img_info = nuklear_renderer.load_image(filename, no_ui)
return img, img_info
-- return rencache.rencache_draw_text(font, text, x, y, color)
end
-- --------------------------------------------------------------------------------------
@ -305,18 +328,29 @@ end
renderer.load_image_buffer = function(name, buf, bufsize, no_ui)
local img, img_info = nuklear_renderer.load_image_buffer(name, buf, bufsize, no_ui)
return img, img_info
-- return rencache.rencache_draw_text(font, text, x, y, color)
end
renderer.make_nk_handle = function( sg_img_desc )
local new_img = sg.sg_make_image(sg_img_desc)
local img_desc = ffi.new("snk_image_desc_t[1]")
img_desc[0].image = new_img
local snk_img = nk.snk_make_image(img_desc)
local nk_hnd = nk.snk_nkhandle(snk_img)
return nk.nk_image_handle(nk_hnd)
end
-- --------------------------------------------------------------------------------------
renderer.draw_image = function(image, x, y, w, h)
return nuklear_renderer.draw_image(image, x, y, w, h)
-- return rencache.rencache_draw_text(font, text, x, y, color)
end
-- --------------------------------------------------------------------------------------
renderer.load_model = function(filename)
return threed_renderer.load_model(filename)
renderer.load_model = function(filename, params)
return threed_renderer.load_model(filename, params)
-- return rencache.rencache_draw_text(font, text, x, y, color)
end
-- --------------------------------------------------------------------------------------
@ -328,6 +362,13 @@ end
-- --------------------------------------------------------------------------------------
renderer.hide_model = function(model)
return threed_renderer.hide_model(model)
end
-- --------------------------------------------------------------------------------------
renderer.set_cursor = function()
nuklear_renderer.set_cursor()
end

223
engine/system.lua Normal file
View File

@ -0,0 +1,223 @@
local dirtools = require("tools.vfs.dirtools").init("worldbuilder")
-- --------------------------------------------------------------------------------------
local sapp = require("sokol_app")
local stb = require("stb")
local nk = sg
local platform = require("src.platform")
local ffi = require("ffi")
local tinsert = table.insert
local tremove = table.remove
-- --------------------------------------------------------------------------------------
local function fuzzy_match(needle, haystack, file_mode)
-- Convert to lowercase for case‑insensitive match
local n = needle:lower()
local h = haystack:lower()
local nlen = #n
local hlen = #h
if nlen == 0 then
return 1 -- empty needle matches with highest score
end
local score = 0
local j = 1
for i = 1, nlen do
local c = n:sub(i,i)
local found = h:find(c, j, true)
if not found then
return 0 -- no match
end
-- reward a match early in the haystack
if found == j then
score = score + 1
end
j = found + 1
end
-- normalize score: divide by the haystack length (or some heuristic)
local norm = score / hlen
return norm
end
-- --------------------------------------------------------------------------------------
system = {
event_queue = {}, -- Back buffer events are always collected in.
has_focus = true,
iconified = false,
keychanges = {}, -- A buffer of most recent key pressed
mousechanges = {}, -- A buffer of most recent mouse button presses
}
-- --------------------------------------------------------------------------------------
system.push_event = function( ev )
-- print(ev.type, ev.a, ev.b, ev.c, ev.d)
tinsert(system.event_queue, ev)
end
-- --------------------------------------------------------------------------------------
system.events_clear = function()
for i = #system.event_queue, 1, -1 do
if system.event_queue[i].processed == true then
tremove(system.event_queue, i)
end
end
end
-- --------------------------------------------------------------------------------------
-- This is a double buffered event queue in case events come in while processing
system.events_buffer = function()
local tmp = {}
for i, ev in ipairs(system.event_queue) do
tinsert(tmp, ev)
ev.processed = true
end
system.events_clear()
return tmp
end
-- --------------------------------------------------------------------------------------
-- blocking: wait for event, simplified with coroutine or a condition var
system.wait_event = function(timeout)
local ticker_end = os.clock() + timeout
while #system.event_queue == 0 and os.clock() < ticker_end do
end
end
-- --------------------------------------------------------------------------------------
system.set_cursor = function(cursor_name, rect)
renderer.cursor = { name = cursor_name, rect = rect }
end
-- --------------------------------------------------------------------------------------
system.set_window_title = function(title)
sapp.sapp_set_window_title(title)
end
-- --------------------------------------------------------------------------------------
-- Set fullscreen, minimized and maximized etc
system.set_window_mode = function(mode, width, height)
-- sapp_is_fullscreen()
-- sapp_toggle_fullscreen()
end
-- --------------------------------------------------------------------------------------
system.window_has_focus = function()
return system.has_focus
end
-- --------------------------------------------------------------------------------------
system.show_confirm_dialog= function(title, message)
return false
end
-- --------------------------------------------------------------------------------------
system.chdir = function(path)
-- dirtools.change_dir(path)
end
-- --------------------------------------------------------------------------------------
system.list_dir = function(path)
-- print("list_dir", path)
return dirtools.get_dir_names(path)
end
-- --------------------------------------------------------------------------------------
system.absolute_path = function(path)
-- print("absolute_path")
local abspath = dirtools.get_absolute_path(path)
return abspath
end
-- --------------------------------------------------------------------------------------
system.get_file_info = function(path)
return dirtools.get_fileinfo(path)
-- return { modified=0, size=0, type="file" }
end
-- --------------------------------------------------------------------------------------
-- Opens native file selection dialog
system.file_select = function(start_path)
local filename = win.FileSelect()
return filename
end
-- --------------------------------------------------------------------------------------
-- Opens native file selection dialog
system.folder_select = function(start_path)
return win.FolderSelect()
end
-- --------------------------------------------------------------------------------------
system.get_clipboard = function()
return ffi.string(sapp.sapp_get_clipboard_string())
end
-- --------------------------------------------------------------------------------------
system.set_clipboard = function(text)
sapp.sapp_set_clipboard_string(ffi.string(text))
end
-- --------------------------------------------------------------------------------------
system.get_time = function()
return os.clock()
end
-- --------------------------------------------------------------------------------------
system.sleep = function(seconds)
win.Sleep(seconds * 1000)
end
-- --------------------------------------------------------------------------------------
system.exec = function(cmd)
-- cmd = string.format("cmd /c \"%s 2>&1\"", cmd)
-- print(cmd)
local fh = io.popen(cmd, "r")
local results = ""
if(fh) then
results = fh:read("*a")
fh:close()
end
return results
end
-- --------------------------------------------------------------------------------------
system.fuzzy_match = function(str, pattern)
return fuzzy_match( pattern, str, false)
end
-- --------------------------------------------------------------------------------------
-- /* gets the total number of dropped files (after an SAPP_EVENTTYPE_FILES_DROPPED event) */
-- SOKOL_APP_API_DECL int sapp_get_num_dropped_files(void);
-- /* gets the dropped file paths */
-- SOKOL_APP_API_DECL const char* sapp_get_dropped_file_path(int index);

246
engine/threed.lua Normal file
View File

@ -0,0 +1,246 @@
local sapp = require("sokol_app")
local nk = sg
local stb = require("stb")
local hmm = require("hmm")
local hutils = require("hmm_utils")
local ffi = require("ffi")
local utils = require("lua.utils")
local cameramgr = require("lua.engine.camera_manager")
local geomutils = require("lua.loaders.geometry-utils")
local tinsert = table.insert
local tremove = table.remove
-- --------------------------------------------------------------------------------------
-- TODO: Make better handler for this.
local MAX_STATES = 1024
local CAM_DISTANCE = 6.0
-- --------------------------------------------------------------------------------------
-- This is a global - prob not a great idea, but there should only ever be one per process!
threed_renderer = {
render_queue = {},
model_load_queue = {},
-- A mapped list of model files by the file name
-- These indicate whether a model is loaded, if it has an id and if it
-- has had its data initialised
model_files = {},
default_cam = cameramgr.add("default", 60.0, 1, 0.01, CAM_DISTANCE * 2),
}
-- --------------------------------------------------------------------------------------
local shc = require("tools.shader_compiler.shc_compile").init( "worldbuilder", false )
local shader = nil
-- --------------------------------------------------------------------------------------
threed_renderer.make_cube = function()
shader = shader or shc.compile("lua/engine/shaders/cube_simple.glsl")
-- Make a fake model to use for testing
local state = ffi.new("internal_state[1]")
local binding = ffi.new("sg_bindings[1]", {})
local vertices = ffi.new("float[168]", {
-1.0, -1.0, -1.0, 1.0, 0.0, 0.0, 1.0,
1.0, -1.0, -1.0, 1.0, 0.0, 0.0, 1.0,
1.0, 1.0, -1.0, 1.0, 0.0, 0.0, 1.0,
-1.0, 1.0, -1.0, 1.0, 0.0, 0.0, 1.0,
-1.0, -1.0, 1.0, 0.0, 1.0, 0.0, 1.0,
1.0, -1.0, 1.0, 0.0, 1.0, 0.0, 1.0,
1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0,
-1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0,
-1.0, -1.0, -1.0, 0.0, 0.0, 1.0, 1.0,
-1.0, 1.0, -1.0, 0.0, 0.0, 1.0, 1.0,
-1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0,
-1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 1.0,
1.0, -1.0, -1.0, 1.0, 0.5, 0.0, 1.0,
1.0, 1.0, -1.0, 1.0, 0.5, 0.0, 1.0,
1.0, 1.0, 1.0, 1.0, 0.5, 0.0, 1.0,
1.0, -1.0, 1.0, 1.0, 0.5, 0.0, 1.0,
-1.0, -1.0, -1.0, 0.0, 0.5, 1.0, 1.0,
-1.0, -1.0, 1.0, 0.0, 0.5, 1.0, 1.0,
1.0, -1.0, 1.0, 0.0, 0.5, 1.0, 1.0,
1.0, -1.0, -1.0, 0.0, 0.5, 1.0, 1.0,
-1.0, 1.0, -1.0, 1.0, 0.0, 0.5, 1.0,
-1.0, 1.0, 1.0, 1.0, 0.0, 0.5, 1.0,
1.0, 1.0, 1.0, 1.0, 0.0, 0.5, 1.0,
1.0, 1.0, -1.0, 1.0, 0.0, 0.5, 1.0
})
local buffer_desc = ffi.new("sg_buffer_desc[1]")
buffer_desc[0].data.ptr = vertices
buffer_desc[0].data.size = ffi.sizeof(vertices)
buffer_desc[0].label = "cube-vertices"
local vbuf = sg.sg_make_buffer(buffer_desc)
local indices = ffi.new("uint16_t[36]", {
0, 1, 2, 0, 2, 3,
6, 5, 4, 7, 6, 4,
8, 9, 10, 8, 10, 11,
14, 13, 12, 15, 14, 12,
16, 17, 18, 16, 18, 19,
22, 21, 20, 23, 22, 20
})
local ibuffer_desc = ffi.new("sg_buffer_desc[1]", {})
ibuffer_desc[0].type = sg.SG_BUFFERTYPE_INDEXBUFFER
ibuffer_desc[0].data.ptr = indices
ibuffer_desc[0].data.size = ffi.sizeof(indices)
ibuffer_desc[0].label = "cube-indices"
local ibuf = sg.sg_make_buffer(ibuffer_desc)
local shd = sg.sg_make_shader(shader)
local pipe_desc = ffi.new("sg_pipeline_desc[1]", {})
pipe_desc[0].layout.buffers[0].stride = 28
pipe_desc[0].layout.attrs[0].format = sg.SG_VERTEXFORMAT_FLOAT3
pipe_desc[0].layout.attrs[1].format = sg.SG_VERTEXFORMAT_FLOAT4
pipe_desc[0].shader = shd
pipe_desc[0].index_type = sg.SG_INDEXTYPE_UINT16
pipe_desc[0].cull_mode = sg.SG_CULLMODE_BACK
pipe_desc[0].depth.write_enabled = true
pipe_desc[0].depth.compare = sg.SG_COMPAREFUNC_LESS_EQUAL
pipe_desc[0].label = "cube-pipeline"
state[0].pip = sg.sg_make_pipeline(pipe_desc)
binding[0].vertex_buffers[0] = vbuf
binding[0].index_buffer = ibuf
state[0].bind = binding
return { state = state, binding = binding }
end
-- --------------------------------------------------------------------------------------
local function render_model( dt, model_rect )
local aabb = model_rect.model.data.mesh.aabb
local maxx = aabb.max.x - aabb.min.x
local maxy = aabb.max.y - aabb.min.y
local maxz = aabb.max.z - aabb.min.z
local maxsize = math.sqrt( maxx * maxx + maxy * maxy + maxz * maxz)
local sc = CAM_DISTANCE * 0.85 / maxsize * model_rect.model.scale
local offset = hmm.HMM_V3(aabb.min.x + maxx * 0.5, aabb.min.y + maxy * 0.5, aabb.min.z + maxz * 0.5)
offset.x, offset.y, offset.z = offset.x * sc, offset.y * sc, offset.x * sc
local w, h = model_rect.w, model_rect.h
-- Dont render if there is no width or height?
if(w <= 0 or h <= 0) then return end
cameramgr.set_nearfar( model_rect.cam, 0.01, CAM_DISTANCE * 2 * model_rect.model.scale )
cameramgr.set_aspect( model_rect.cam, w/h )
cameramgr.lookat( model_rect.cam, hmm.HMM_V3(0.0, (offset.y + 1.5), -CAM_DISTANCE), hmm.HMM_V3(0.0, offset.y, 0.0), hmm.HMM_V3(0.0, -1.0, 0.0))
local view_proj = cameramgr.get_view_proj(model_rect.cam)
local view = cameramgr.get_view(model_rect.cam)
local model_all_geom = model_rect.model.data.mesh.all_geom
model_rect.model.data.mesh.camera = model_rect.cam
cameramgr.update_viewport( model_rect.cam, hmm.HMM_V4(0, 0, 1024, 1024))
cameramgr.update_scissor( model_rect.cam, hmm.HMM_V4(0, 0, 1024, 1024))
local thiscam = cameramgr.get_id( model_rect.cam )
for i, geom_id in ipairs(model_all_geom) do
local geom = geomutils.all_objs[geom_id]
geom.rx = 0.0
geom.ry = geom.ry + dt * 3.0
-- geom.fs_params[0].alpha_cutoff = 0.9
-- geom.fs_params[0].alpha_mode = 2
geom.dstate[0].state = 0x01
local pos = hmm.HMM_V3(0, 0, 0)
local angles = hmm.HMM_V3(geom.rx, geom.ry, 0.0)
local model = geomutils.model_matrix( geom.transform, pos, angles, sc)
geom.vs_params[0].mvp = hmm.HMM_MulM4(view_proj, model)
end
end
-- --------------------------------------------------------------------------------------
-- Hides all the vertex buffers associated with this model
threed_renderer.hide_model = function(model)
if (model.loaded == true) then
local model_all_geom = model.data.mesh.all_geom
for i, geom_id in ipairs(model_all_geom) do
local geom = geomutils.all_objs[geom_id]
geom.dstate[0].state = 0x0
end
end
end
-- --------------------------------------------------------------------------------------
-- This doesnt directly load a model in case it happens during an incorrent phase of rendering
threed_renderer.load_model = function(filename, params)
-- Check first if it hasnt been loaded already!
local is_loaded = threed_renderer.model_load_queue[filename]
if(is_loaded) then
return is_loaded
end
local new_model = { loaded = nil, filename = filename, params = params }
threed_renderer.model_load_queue[filename] = new_model
return new_model
end
-- --------------------------------------------------------------------------------------
-- Draw the model based on an xy rect position (not 3d space).
-- This queues model rects for drawing in the correct phase of the frame.
threed_renderer.draw_model = function(model, x, y, w, h)
if (model.loaded == true) then
tinsert(threed_renderer.render_queue, { cam=model.data.camera, model=model, x=x, y=y, w=w, h=h })
end
end
-- --------------------------------------------------------------------------------------
-- Iterate the queued rects and render models into them
-- Rects should _not_ be here if they are hidden (ie in a hidden tab)
threed_renderer.load_models = function()
if(utils.tcount(threed_renderer.model_load_queue) == 0) then return end
-- print("queued models", count)
for k,model_load in pairs(threed_renderer.model_load_queue) do
if(model_load.loaded == nil and model_load.params.do_load) then
model_load.data = model_load.params.do_load( model_load )
if(model_load.data) then
-- model_load.data = threed_renderer.make_cube()
model_load.loaded = true
else
-- Remove model that cant be loaded.
threed_renderer.model_load_queue[k] = nil
end
end
end
end
-- --------------------------------------------------------------------------------------
-- Iterate the queued rects and render models into them
-- Rects should _not_ be here if they are hidden (ie in a hidden tab)
threed_renderer.render_rects = function( dt )
local count = #threed_renderer.render_queue
-- print("queued models", count)
for i=1, count do
local model_rect = threed_renderer.render_queue[i]
render_model(dt, model_rect)
end
end
-- --------------------------------------------------------------------------------------

View File

@ -1 +0,0 @@
{"audio":{"master_volume":{"vmin":0,"vmax":1,"vstep":0.02,"vinc":0.1,"ffi":null,"value":1,"ptype":"float","index":1},"effects_volume":{"vmin":0,"vmax":1,"vstep":0.02,"vinc":0.1,"ffi":null,"value":1,"ptype":"float","index":2},"music_volume":{"vmin":0,"vmax":1,"vstep":0.02,"vinc":0.1,"ffi":null,"value":1,"ptype":"float","index":3}},"options":{"build_relative":{"ffi":null,"value":false,"ptype":"check","index":2},"build_bytecode":{"ffi":null,"value":true,"ptype":"check","index":3},"build_type":{"plist":["Release","Debug","Release Remotery","Debug Remotery"],"ffi":null,"value":1,"ptype":"combo","index":1}},"assets":{"shaders":[],"images":[],"lua":[],"data":[]},"sokol":{"sokol_ffi":{"ffi":null,"key":"sokol_ffi","slen":256,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-luajit\\ffi","ptype":"path","index":3},"sokol_lua":{"ffi":null,"key":"sokol_lua","slen":256,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-luajit\\lua","ptype":"path","index":4},"sokol_examples":{"ffi":null,"key":"sokol_examples","slen":256,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-luajit\\examples","ptype":"path","index":5},"sokol_path":{"ffi":null,"key":"sokol_path","slen":256,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-luajit","ptype":"path","index":1},"sokol_bin":{"ffi":null,"key":"sokol_bin","slen":256,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-luajit\\bin","ptype":"path","index":2}},"graphics":{"fullscreen":{"ffi":null,"key":"fullscreen","value":false,"ptype":"check","index":6},"antialias":{"ffi":null,"key":"antialias","slen":16,"len_ffi":null,"value":"fxaa","ptype":"string","index":5},"display_height":{"value":768,"key":"display_height","vmin":480,"vmax":8192,"vstep":32,"vinc":0.1,"ffi":null,"ptype":"int","index":3},"display_fps":{"value":60,"key":"display_fps","vmin":25,"vmax":200,"vstep":5,"vinc":0.1,"ffi":null,"ptype":"int","index":4},"display_res":{"plist":["Auto-detect","4096×2160","3840×2160","3440×1440","2560×1600","2560x1440","1920x1080","1680x1050","1600x900","1440x900","1376x768","Custom"],"ffi":null,"key":"display_res","value":1,"ptype":"combo","index":1},"display_width":{"value":1024,"key":"display_width","vmin":640,"vmax":8192,"vstep":32,"vinc":0.1,"ffi":null,"ptype":"int","index":2}},"platform":{"os":{"plist":["Windows","Linux","OSX","BSD","POSIX","Other"],"ffi":null,"value":1,"ptype":"combo","index":3},"arch":{"plist":["x86","x64","arm","arm64","arm64be","ppc","mips","mipsel","mips64","mips64el","mips64r6","mips64r6el"],"ffi":null,"value":2,"ptype":"combo","index":2},"target":{"plist":["Win64","MacOS","Linux","IOS64"],"ffi":null,"value":1,"ptype":"combo","index":1},"performance":{"plist":["None","Level 1","Level 2","Level 3"],"ffi":null,"value":1,"ptype":"combo","index":4}},"rbuilder":{"version":{"value":"00.01.snow","slen":32,"index":2},"appname":{"value":"rbuild","slen":7,"index":1}},"remote":{"remote_build":{"value":"https://mybuildserver.com/sokol_build","slen":256,"index":1},"remote_data":{"value":"https://myremotedata.com/data","slen":256,"index":2}},"project":{"project_start":{"ptype":"file","ffi":null,"pfilter":"*.lua","slen":128,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-luajit\\projects\\examples\\samples\\cube_sapp.lua","key":"project_start","index":3},"project_name":{"ffi":null,"key":"project_name","slen":64,"len_ffi":null,"value":"cube_sapp","ptype":"string","index":1},"build_path":{"ffi":null,"key":"build_path","slen":256,"len_ffi":null,"value":"D:\\dev\\luajit\\sokol-builds","ptype":"path","index":2}}}

View File

@ -13,6 +13,8 @@ local hutils = require("hmm_utils")
local ffi = require("ffi")
require("engine.platform")
-- --------------------------------------------------------------------------------------
ffi.cdef[[
@ -34,6 +36,7 @@ local function init(void)
sg_desc[0].environment = slib.sglue_environment()
sg_desc[0].logger.func = slib.slog_func
sg.sg_setup( sg_desc )
win.Sleep(10)
-- // use sokol-imgui with all default-options (we're not doing
-- // multi-sampled rendering or using non-default pixel formats)

View File

@ -15,6 +15,7 @@ local clay = require("clay")
local cutils = require("clay_utils")
local utils = require("utils")
require("engine.platform")
-- --------------------------------------------------------------------------------------
@ -50,6 +51,7 @@ local function init()
desc[0].logger.func = slib.slog_func
desc[0].disable_validation = false
sg.sg_setup( desc )
win.Sleep(10)
print("Sokol Is Valid: "..tostring(sg.sg_isvalid()))
-- Initialize Sokol GP, adjust the size of command buffers for your own use.

View File

@ -1,6 +1,6 @@
@ctype mat4 hmm_mat4
@vs vs
@vs vs_cube
layout(binding = 0, std140) uniform vs_params {
mat4 mvp;
};
@ -16,7 +16,7 @@ void main() {
}
@end
@fs fs
@fs fs_cube
in vec4 color;
out vec4 frag_color;
@ -25,4 +25,4 @@ void main() {
}
@end
@program cube vs fs
@program cube vs_cube fs_cube

View File

@ -10,6 +10,7 @@ local hmm = require("hmm")
local hutils = require("hmm_utils")
local utils = require("utils")
require("engine.platform")
local ffi = require("ffi")
@ -27,7 +28,7 @@ typedef struct state {
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", true )
local shader = shc.compile("./projects/examples/samples/cube-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/cube-sapp.glsl", "cube")
-- --------------------------------------------------------------------------------------
@ -49,6 +50,7 @@ local function init()
desc[0].logger.func = slib.slog_func
desc[0].disable_validation = false
sg.sg_setup( desc )
win.Sleep(10)
print("Sokol Is Valid: "..tostring(sg.sg_isvalid()))
local vertices = ffi.new("float[168]", {

View File

@ -16,6 +16,7 @@ local stb = require("stb")
local ffi = require("ffi")
local utils = require("utils")
require("engine.platform")
-- --------------------------------------------------------------------------------------
@ -30,6 +31,7 @@ local function init(void)
sg_desc[0].environment = slib.sglue_environment()
sg_desc[0].logger.func = slib.slog_func
sg.sg_setup( sg_desc )
win.Sleep(10)
-- // use sokol-nuklear with all default-options (we're not doing
-- // multi-sampled rendering or using non-default pixel formats)

View File

@ -12,6 +12,7 @@ local hmm = require("hmm")
local hutils = require("hmm_utils")
local stb = require("stb")
require("engine.platform")
local ffi = require("ffi")
@ -60,6 +61,7 @@ local function init(void)
sg_desc[0].environment = slib.sglue_environment()
sg_desc[0].logger.func = slib.slog_func
sg.sg_setup( sg_desc )
win.Sleep(10)
-- // use sokol-nuklear with all default-options (we're not doing
-- // multi-sampled rendering or using non-default pixel formats)

View File

@ -11,6 +11,8 @@ local slib = require("sokol_libs") -- Warn - always after gfx!!
local hmm = require("hmm")
local hutils = require("hmm_utils")
require("engine.platform")
local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
@ -21,6 +23,7 @@ local function init(void)
sg_desc[0].environment = slib.sglue_environment()
sg_desc[0].logger.func = slib.slog_func
sg.sg_setup( sg_desc )
win.Sleep(10)
-- // use sokol-nuklear with all default-options (we're not doing
-- // multi-sampled rendering or using non-default pixel formats)

View File

@ -13,6 +13,7 @@ local hmm = require("hmm")
local hutils = require("hmm_utils")
local stb = require("stb")
require("engine.platform")
local ffi = require("ffi")
@ -103,6 +104,7 @@ local function init()
sg_desc[0].environment = slib.sglue_environment()
sg_desc[0].logger.func = slib.slog_func
sg.sg_setup( sg_desc )
win.Sleep(10)
-- // use sokol-nuklear with all default-options (we're not doing
-- // multi-sampled rendering or using non-default pixel formats)

View File

@ -12,6 +12,8 @@ local hutils = require("hmm_utils")
local ffi = require("ffi")
require("engine.platform")
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
@ -61,6 +63,7 @@ local function init()
sg_desc[0].logger.func = slib.slog_func
sg.sg_setup( sg_desc )
win.Sleep(10)
local offscreen_shader = sg.sg_make_shader(offscreen)
local default_shader = sg.sg_make_shader(default)

View File

@ -9,6 +9,8 @@ local hmm = require("hmm")
local hutils = require("hmm_utils")
local rmt = require("remotery")
require("engine.platform")
local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
@ -27,7 +29,7 @@ local rmt_ctx = nil
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./projects/examples/samples/cube-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/cube-sapp.glsl", "cube")
-- --------------------------------------------------------------------------------------
@ -51,6 +53,7 @@ local function init()
desc[0].logger.func = slib.slog_func
desc[0].disable_validation = false
sg.sg_setup( desc )
win.Sleep(10)
print("Sokol Is Valid: "..tostring(sg.sg_isvalid()))
local vertices = ffi.new("float[168]", {
@ -160,6 +163,7 @@ local function frame()
pass[0].swapchain = slib.sglue_swapchain()
rmt._rmt_EndCPUSample()
rmt._rmt_BeginCPUSample(sample2_str, rmt.RMTSF_Aggregate, sample2_hash)
sg.sg_begin_pass(pass)
@ -178,7 +182,7 @@ local function frame()
sg.sg_commit()
rmt._rmt_EndCPUSample()
rmt._rmt_EndCPUSample()
rmt._rmt_MarkFrame()
-- Display frame stats in console.
-- hutils.show_stats()
@ -187,8 +191,8 @@ end
-- --------------------------------------------------------------------------------------
local function cleanup()
sg.sg_shutdown()
rmt.DestroyGlobalInstance(rmt_ctx)
sg.sg_shutdown()
end
-- --------------------------------------------------------------------------------------

View File

@ -12,6 +12,7 @@ local hmm = require("hmm")
local hutils = require("hmm_utils")
local utils = require("utils")
require("engine.platform")
local ffi = require("ffi")
@ -24,6 +25,7 @@ local function init()
desc[0].logger.func = slib.slog_func
desc[0].disable_validation = false
sg.sg_setup( desc )
win.Sleep(10)
print("Sokol Is Valid: "..tostring(sg.sg_isvalid()))
-- Initialize Sokol GP, adjust the size of command buffers for your own use.

View File

@ -5,7 +5,7 @@
//------------------------------------------------------------------------------
//--- vertex shader
@vs vs
@vs vs_sdf
layout(binding=0) uniform vs_params {
float aspect;
float time;
@ -42,7 +42,7 @@ void main() {
@end
//--- fragment shader
@fs fs
@fs fs_sdf
in vec2 pos;
in vec3 eye;
in vec3 up;
@ -181,4 +181,4 @@ void main() {
}
@end
@program sdf vs fs
@program sdf vs_sdf fs_sdf

View File

@ -8,12 +8,14 @@ local slib = require("sokol_libs") -- Warn - always after gfx!!
local hmm = require("hmm")
local hutils = require("hmm_utils")
require("engine.platform")
local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", true )
local shader = shc.compile("./projects/examples/samples/sdf-sapp.glsl")
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./projects/examples/samples/sdf-sapp.glsl", "sdf")
-- --------------------------------------------------------------------------------------
@ -43,6 +45,7 @@ local function init()
desc[0].environment = slib.sglue_environment()
desc[0].logger.func = slib.slog_func
sg.sg_setup( desc )
win.Sleep(10)
print("Sokol Is Valid: "..tostring(sg.sg_isvalid()))
local fsq_verts = ffi.new("float[6]", { -1.0, -3.0, 3.0, 1.0, -1.0, 1.0 })

View File

@ -1,6 +1,6 @@
@ctype mat4 hmm_mat4
@vs vs
@vs vs_shapes
layout(binding=0) uniform vs_params {
mat4 mvp;
float draw_mode;
@ -27,7 +27,7 @@ void main() {
}
@end
@fs fs
@fs fs_shapes
in vec4 color;
out vec4 frag_color;
@ -36,4 +36,4 @@ void main() {
}
@end
@program shapes vs fs
@program shapes vs_shapes fs_shapes

View File

@ -8,12 +8,14 @@ local slib = require("sokol_libs") -- Warn - always after gfx!!
local sshape = require("sokol_shape")
local hmm = require("hmm")
require("engine.platform")
local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./projects/examples/samples/shapes-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/shapes-sapp.glsl", "shapes")
-- --------------------------------------------------------------------------------------
@ -61,6 +63,7 @@ local function init()
sg_desc[0].logger.func = slib.slog_func
sg_desc[0].disable_validation = false
sg.sg_setup( sg_desc )
win.Sleep(10)
local pass_action = ffi.new("sg_pass_action[1]", {})
pass_action[0].colors[0].load_action = sg.SG_LOADACTION_CLEAR

View File

@ -1,4 +1,4 @@
@vs vs
@vs vs_triangle
in vec4 position;
in vec4 color0;
@ -10,7 +10,7 @@ void main() {
}
@end
@fs fs
@fs fs_triangle
in vec4 color;
out vec4 frag_color;
@ -19,4 +19,4 @@ void main() {
}
@end
@program triangle vs fs
@program triangle vs_triangle fs_triangle

View File

@ -5,6 +5,8 @@ local sapp = require("sokol_app")
sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
require("engine.platform")
local ffi = require("ffi")
ffi.cdef[[
@ -61,7 +63,7 @@ typedef struct state {
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./projects/examples/samples/triangle-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/triangle-sapp.glsl", "triangle")
-- --------------------------------------------------------------------------------------
@ -78,6 +80,7 @@ local function init()
desc[0].logger.func = slib.slog_func
sg.sg_setup( desc )
win.Sleep(10)
local vertices = ffi.new("float[21]")
vertices[0] = 0.0; vertices[1] = 0.5; vertices[2] = 0.5;

View File

@ -24,9 +24,9 @@ sh_compiler.init = function(base_path, debug_shader, tools_path)
end
if(ffi.os == "Windows") then
sh_compiler.target_tmp = base_dir.."bin\\shaderbin\\shader_gen.h"
sh_compiler.target_tmp = base_dir.."bin\\shaderbin\\shader_gen_"
else
sh_compiler.target_tmp = base_dir.."bin/shaderbin/shader_gen.h"
sh_compiler.target_tmp = base_dir.."bin/shaderbin/shader_gen_"
end
sh_compiler.target_lang = "glsl410"
sh_compiler.target_output = "sokol"
@ -139,7 +139,9 @@ end
sh_compiler.compile = function( glslfile, program_name )
local command = exec..' -i '..glslfile.." -o "..sh_compiler.target_tmp
local target_tmp = sh_compiler.target_tmp..program_name..".h"
local command = exec..' -i '..glslfile.." -o "..target_tmp
command = command.." -l "..sh_compiler.target_lang.." -f "..sh_compiler.target_output
-- print(command)
local runner = io.popen(command, "r")
@ -149,20 +151,28 @@ sh_compiler.compile = function( glslfile, program_name )
runner:close()
print("[sh_compiler.lua] Shader: "..glslfile.." compiled correctly.")
else
print("Invalid command: "..command)
print("[sh_compiler.lua] Invalid command: "..command)
return nil
end
-- Load in the generated file
local lua_shader = ""
local tmpfile = io.open(sh_compiler.target_tmp, "r")
local tmpfile = io.open(target_tmp, "r")
if(tmpfile) then
local shader_src = tmpfile:read("*a")
tmpfile:close()
lua_shader = sh_compiler.process_shader(glslfile, shader_src, program_name)
return lua_shader
if(shader_src) then
local res, err = sh_compiler.process_shader(glslfile, shader_src, program_name)
if(err) then
print("[sh_compiler.lua] Shader Compiler error: ", err)
return nil
end
return res
end
print("[sh_compiler.lua] Cannot process: "..target_tmp)
return nil
else
print("Cannot load tmpfile: "..sh_compiler.target_tmp)
print("[sh_compiler.lua] Cannot load tmpfile: "..target_tmp)
return nil
end
end