This commit is contained in:
alessandro bason 2026-03-04 16:50:09 +01:00
parent 7f37187c92
commit 507d635433
7 changed files with 488 additions and 292 deletions

View file

@ -1,37 +1,50 @@
@ctype mat4 mat4
@ctype mat4 HMM_Mat4
@ctype vec3 HMM_Vec3
@vs vs
layout(binding=0) uniform vs_params {
mat4 mvp;
vec3 cam_pos;
};
in vec4 position;
in vec3 norm;
in vec2 uv;
in vec2 tex_uv;
in vec2 lightmap_uv;
out vec3 fs_norm;
out vec2 fs_uv;
out vec2 fs_tex_uv;
out vec2 fs_lightmap_uv;
out float depth;
void main() {
gl_Position = mvp * position;
// for now m == identity
vec4 view_pos = mvp * position;
depth = -view_pos.z;
gl_Position = view_pos;
fs_norm = norm;
fs_uv = uv;
fs_tex_uv = tex_uv;
fs_lightmap_uv = lightmap_uv;
}
@end
@fs fs
layout(binding=0) uniform texture2D tex;
layout(binding=0) uniform sampler smp;
layout(binding=1) uniform texture2D lightmap;
layout(binding=1) uniform sampler lightmap_smp;
in vec3 fs_norm;
in vec2 fs_uv;
in vec2 fs_tex_uv;
in vec2 fs_lightmap_uv;
in float depth;
out vec4 frag_color;
void main() {
frag_color = texture(sampler2D(tex, smp), fs_uv);
// frag_color = vec4(fs_norm * 0.5 + 0.5, 1.0);
// vec2 uv = fs_uv * 0.5 + 0.5;
// frag_color = vec4(uv, 0.0, 1.0);
vec4 tex_color = texture(sampler2D(tex, smp), fs_tex_uv);
vec4 lightmap_color = texture(sampler2D(lightmap, lightmap_smp), fs_lightmap_uv);
frag_color = tex_color * lightmap_color;
}
@end

BIN
data/scene.glb Normal file

Binary file not shown.

BIN
data/testino.glb Normal file

Binary file not shown.

View file

@ -38,7 +38,7 @@ camera_t cam_init(void) {
void cam_update(camera_t *cam, float dt) {
float strafe = (float)((int)is_key_down(SAPP_KEYCODE_D) - (int)is_key_down(SAPP_KEYCODE_A));
float forward = (float)((int)is_key_down(SAPP_KEYCODE_W) - (int)is_key_down(SAPP_KEYCODE_S));
float movup = (float)((int)is_key_down(SAPP_KEYCODE_Q) - (int)is_key_down(SAPP_KEYCODE_E));
float movup = (float)((int)is_key_down(SAPP_KEYCODE_E) - (int)is_key_down(SAPP_KEYCODE_Q));
float move_speed = cam->mov_speed * dt;
float look_speed = cam->look_speed * dt;

View file

@ -16,19 +16,20 @@
Attributes:
ATTR_obj_position => 0
ATTR_obj_norm => 1
ATTR_obj_uv => 2
ATTR_obj_tex_uv => 2
ATTR_obj_lightmap_uv => 3
Bindings:
Uniform block 'vs_params':
C struct: vs_params_t
Bind slot: UB_vs_params => 0
Texture 'tex':
Texture 'lightmap':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: VIEW_tex => 0
Sampler 'smp':
Bind slot: VIEW_lightmap => 1
Sampler 'lightmap_smp':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_smp => 0
Bind slot: SMP_lightmap_smp => 1
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before obj.h"
@ -42,135 +43,184 @@
#endif
#define ATTR_obj_position (0)
#define ATTR_obj_norm (1)
#define ATTR_obj_uv (2)
#define ATTR_obj_tex_uv (2)
#define ATTR_obj_lightmap_uv (3)
#define UB_vs_params (0)
#define VIEW_tex (0)
#define SMP_smp (0)
#define VIEW_lightmap (1)
#define SMP_lightmap_smp (1)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
mat4 mvp;
HMM_Mat4 mvp;
HMM_Vec3 cam_pos;
uint8_t _pad_76[4];
} vs_params_t;
#pragma pack(pop)
/*
cbuffer vs_params : register(b0)
{
row_major float4x4 _19_mvp : packoffset(c0);
row_major float4x4 _14_mvp : packoffset(c0);
float3 _14_cam_pos : packoffset(c4);
};
static float4 gl_Position;
static float4 position;
static float depth;
static float3 fs_norm;
static float3 norm;
static float2 fs_uv;
static float2 uv;
static float2 fs_tex_uv;
static float2 tex_uv;
static float2 fs_lightmap_uv;
static float2 lightmap_uv;
struct SPIRV_Cross_Input
{
float4 position : TEXCOORD0;
float3 norm : TEXCOORD1;
float2 uv : TEXCOORD2;
float2 tex_uv : TEXCOORD2;
float2 lightmap_uv : TEXCOORD3;
};
struct SPIRV_Cross_Output
{
float3 fs_norm : TEXCOORD0;
float2 fs_uv : TEXCOORD1;
float2 fs_tex_uv : TEXCOORD1;
float2 fs_lightmap_uv : TEXCOORD2;
float depth : TEXCOORD3;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(position, _19_mvp);
float4 _23 = mul(position, _14_mvp);
depth = -_23.z;
gl_Position = _23;
fs_norm = norm;
fs_uv = uv;
fs_tex_uv = tex_uv;
fs_lightmap_uv = lightmap_uv;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
position = stage_input.position;
norm = stage_input.norm;
uv = stage_input.uv;
tex_uv = stage_input.tex_uv;
lightmap_uv = stage_input.lightmap_uv;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.depth = depth;
stage_output.fs_norm = fs_norm;
stage_output.fs_uv = fs_uv;
stage_output.fs_tex_uv = fs_tex_uv;
stage_output.fs_lightmap_uv = fs_lightmap_uv;
return stage_output;
}
*/
static const uint8_t vs_source_hlsl5[917] = {
static const uint8_t vs_source_hlsl5[1380] = {
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x31,0x34,0x5f,0x6d,0x76,
0x70,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,
0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,
0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,
0x6d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,
0x20,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,
0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x73,
0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,
0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,
0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,
0x32,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,
0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x73,
0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,
0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,
0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,
0x76,0x65,0x72,0x74,0x5f,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,0x75,0x6c,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x5f,0x31,
0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6e,
0x6f,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x73,0x5f,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,
0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,
0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x69,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,
0x75,0x74,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x6e,0x6f,0x72,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,
0x70,0x75,0x74,0x2e,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,
0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,
0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,
0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,
0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,
0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,
0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3d,0x20,
0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,
0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x75,0x76,0x20,
0x3d,0x20,0x66,0x73,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,
0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,
0x3b,0x0a,0x7d,0x0a,0x00,
0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,
0x31,0x34,0x5f,0x63,0x61,0x6d,0x5f,0x70,0x6f,0x73,0x20,0x3a,0x20,0x70,0x61,0x63,
0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x34,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,
0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x20,0x64,0x65,0x70,0x74,0x68,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x6e,0x6f,
0x72,0x6d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x32,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x5f,0x75,
0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,
0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x6c,
0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x0a,0x73,0x74,0x72,
0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,
0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,
0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
0x20,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,
0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,
0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,
0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3a,0x20,
0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,
0x70,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x65,0x70,0x74,
0x68,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,
0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,0x6d,0x75,0x6c,
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x5f,0x31,0x34,0x5f,0x6d,
0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x64,0x65,0x70,0x74,0x68,0x20,0x3d,
0x20,0x2d,0x5f,0x32,0x33,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x32,0x33,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,
0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,
0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x20,0x3d,
0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x7d,0x0a,
0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,
0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,
0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,
0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,
0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x6e,0x6f,0x72,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
0x69,0x6e,0x70,0x75,0x74,0x2e,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
0x6e,0x70,0x75,0x74,0x2e,0x74,0x65,0x78,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,
0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x6c,0x69,0x67,0x68,0x74,
0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,
0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,
0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,
0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,
0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x64,0x65,0x70,0x74,0x68,
0x20,0x3d,0x20,0x64,0x65,0x70,0x74,0x68,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,
0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x6e,0x6f,
0x72,0x6d,0x20,0x3d,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,
0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3d,0x20,0x66,0x73,0x5f,0x74,0x65,
0x78,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,
0x61,0x70,0x5f,0x75,0x76,0x20,0x3d,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,
0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,
0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,
0x0a,0x7d,0x0a,0x00,
};
/*
Texture2D<float4> tex : register(t0);
SamplerState smp : register(s0);
Texture2D<float4> lightmap : register(t1);
SamplerState lightmap_smp : register(s1);
static float2 fs_tex_uv;
static float2 fs_lightmap_uv;
static float4 frag_color;
static float2 fs_uv;
static float3 fs_norm;
static float depth;
struct SPIRV_Cross_Input
{
float3 fs_norm : TEXCOORD0;
float2 fs_uv : TEXCOORD1;
float2 fs_tex_uv : TEXCOORD1;
float2 fs_lightmap_uv : TEXCOORD2;
float depth : TEXCOORD3;
};
struct SPIRV_Cross_Output
@ -180,59 +230,77 @@ static const uint8_t vs_source_hlsl5[917] = {
void frag_main()
{
frag_color = tex.Sample(smp, fs_uv);
frag_color = lightmap.Sample(lightmap_smp, fs_lightmap_uv);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
fs_uv = stage_input.fs_uv;
fs_tex_uv = stage_input.fs_tex_uv;
fs_lightmap_uv = stage_input.fs_lightmap_uv;
fs_norm = stage_input.fs_norm;
depth = stage_input.depth;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.frag_color = frag_color;
return stage_output;
}
*/
static const uint8_t fs_source_hlsl5[614] = {
static const uint8_t fs_source_hlsl5[865] = {
0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,
0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,
0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61,
0x74,0x65,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,
0x72,0x28,0x73,0x30,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
0x66,0x73,0x5f,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x0a,0x73,
0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3a,0x20,0x54,
0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,
0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,
0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,
0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,
0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,
0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,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,0x74,0x65,0x78,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,
0x6d,0x70,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,
0x3e,0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,
0x69,0x73,0x74,0x65,0x72,0x28,0x74,0x31,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,
0x65,0x72,0x53,0x74,0x61,0x74,0x65,0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,
0x5f,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,
0x73,0x31,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x3b,0x0a,0x73,
0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x73,0x74,
0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x65,0x70,0x74,0x68,
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,
0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,
0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,
0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x6c,0x69,
0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,
0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x20,0x64,0x65,0x70,0x74,0x68,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,
0x44,0x33,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,
0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,
0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x75,
0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
0x66,0x73,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,
0x72,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,
0x2e,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,
0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,
0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,
0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,
0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,
0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,
0x74,0x3b,0x0a,0x7d,0x0a,0x00,
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,
0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,
0x20,0x66,0x72,0x61,0x67,0x5f,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,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x66,0x73,
0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x29,0x3b,0x0a,0x7d,
0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,
0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,
0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,
0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,
0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,
0x70,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,
0x75,0x74,0x2e,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,
0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3d,
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,
0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x64,0x65,0x70,0x74,0x68,0x20,
0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x64,0x65,
0x70,0x74,0x68,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,
0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,
0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,
0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,
0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
0x00,
};
/*
#version 460
@ -240,174 +308,220 @@ static const uint8_t fs_source_hlsl5[614] = {
layout(set = 0, binding = 0, std140) uniform vs_params
{
mat4 mvp;
} _19;
vec3 cam_pos;
} _14;
layout(location = 0) in vec4 position;
layout(location = 3) out float depth;
layout(location = 0) out vec3 fs_norm;
layout(location = 1) in vec3 norm;
layout(location = 1) out vec2 fs_uv;
layout(location = 2) in vec2 uv;
layout(location = 1) out vec2 fs_tex_uv;
layout(location = 2) in vec2 tex_uv;
layout(location = 2) out vec2 fs_lightmap_uv;
layout(location = 3) in vec2 lightmap_uv;
void main()
{
gl_Position = _19.mvp * position;
vec4 _23 = _14.mvp * position;
depth = -_23.z;
gl_Position = _23;
fs_norm = norm;
fs_uv = uv;
fs_tex_uv = tex_uv;
fs_lightmap_uv = lightmap_uv;
}
*/
static const uint8_t vs_bytecode_spirv_vk[1348] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x29,0x00,0x00,0x00,
static const uint8_t vs_bytecode_spirv_vk[1780] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x36,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00,
0x01,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30,
0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x0f,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x00,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x1f,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x27,0x00,0x00,0x00,
0x03,0x00,0x03,0x00,0x02,0x00,0x00,0x00,0xcc,0x01,0x00,0x00,0x05,0x00,0x04,0x00,
0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,
0x0b,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78,
0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0f,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x19,0x00,0x00,0x00,
0x24,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,
0x31,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x03,0x00,0x03,0x00,
0x02,0x00,0x00,0x00,0xcc,0x01,0x00,0x00,0x05,0x00,0x04,0x00,0x04,0x00,0x00,0x00,
0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x03,0x00,0x09,0x00,0x00,0x00,
0x5f,0x32,0x33,0x00,0x05,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x00,0x00,0x00,0x06,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x6d,0x76,0x70,0x00,0x06,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x63,0x61,0x6d,0x5f,0x70,0x6f,0x73,0x00,0x05,0x00,0x03,0x00,
0x0e,0x00,0x00,0x00,0x5f,0x31,0x34,0x00,0x05,0x00,0x05,0x00,0x15,0x00,0x00,0x00,
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x04,0x00,
0x19,0x00,0x00,0x00,0x64,0x65,0x70,0x74,0x68,0x00,0x00,0x00,0x05,0x00,0x06,0x00,
0x22,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78,
0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00,
0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,
0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0b,0x00,0x00,0x00,
0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,
0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x22,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61,
0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x22,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00,
0x05,0x00,0x03,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,
0x11,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x00,0x00,0x00,
0x06,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0x76,0x70,0x00,
0x05,0x00,0x03,0x00,0x13,0x00,0x00,0x00,0x5f,0x31,0x39,0x00,0x05,0x00,0x05,0x00,
0x18,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00,
0x05,0x00,0x04,0x00,0x1f,0x00,0x00,0x00,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x00,
0x05,0x00,0x04,0x00,0x21,0x00,0x00,0x00,0x6e,0x6f,0x72,0x6d,0x00,0x00,0x00,0x00,
0x05,0x00,0x04,0x00,0x25,0x00,0x00,0x00,0x66,0x73,0x5f,0x75,0x76,0x00,0x00,0x00,
0x05,0x00,0x03,0x00,0x27,0x00,0x00,0x00,0x75,0x76,0x00,0x00,0x47,0x00,0x03,0x00,
0x0b,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0b,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,
0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x48,0x00,0x05,0x00,0x0b,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x11,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x48,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x13,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x13,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x18,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x1f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x21,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x25,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x27,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x02,0x00,
0x02,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x16,0x00,0x03,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,
0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x15,0x00,0x04,0x00,
0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x08,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,
0x0a,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x1e,0x00,0x06,0x00,
0x0b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,
0x0a,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x0b,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x18,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x1e,0x00,0x03,0x00,0x11,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x1b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x17,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x17,0x00,0x04,0x00,0x23,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x24,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x23,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x24,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x26,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x23,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x26,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x36,0x00,0x05,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x05,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x15,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x91,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
0x19,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x1b,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,
0x0d,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x1c,0x00,0x00,0x00,
0x1a,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x21,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x1f,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x23,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x27,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,
0x05,0x00,0x03,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x04,0x00,
0x29,0x00,0x00,0x00,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x00,0x05,0x00,0x04,0x00,
0x2b,0x00,0x00,0x00,0x6e,0x6f,0x72,0x6d,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,
0x2f,0x00,0x00,0x00,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x00,0x00,0x00,
0x05,0x00,0x04,0x00,0x31,0x00,0x00,0x00,0x74,0x65,0x78,0x5f,0x75,0x76,0x00,0x00,
0x05,0x00,0x06,0x00,0x33,0x00,0x00,0x00,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,
0x6d,0x61,0x70,0x5f,0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00,0x34,0x00,0x00,0x00,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x00,0x47,0x00,0x03,0x00,
0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x48,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x48,0x00,0x05,0x00,
0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x23,0x00,0x00,0x00,
0x40,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x22,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x48,0x00,0x05,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x22,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00,
0x22,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x2b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x2f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x31,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x33,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x34,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x13,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x03,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x17,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x18,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x17,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x1e,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x15,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x2b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x18,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x18,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x15,0x00,0x04,0x00,0x1a,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x2b,0x00,0x04,0x00,0x1a,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x2b,0x00,0x04,0x00,0x1a,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x1c,0x00,0x04,0x00,0x21,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x1e,0x00,0x06,0x00,0x22,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x21,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x23,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x23,0x00,0x00,0x00,
0x24,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x26,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x28,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x28,0x00,0x00,0x00,
0x29,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,
0x2b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x2d,0x00,0x00,0x00,
0x06,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x2e,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x2e,0x00,0x00,0x00,
0x2f,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x30,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x30,0x00,0x00,0x00,
0x31,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x2e,0x00,0x00,0x00,
0x33,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x30,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,0x02,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,
0x05,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x0e,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,
0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,
0x16,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x91,0x00,0x05,0x00,0x07,0x00,0x00,0x00,
0x17,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x09,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x1c,0x00,0x00,0x00,
0x1d,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x06,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x7f,0x00,0x04,0x00,
0x06,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x19,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,
0x25,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x26,0x00,0x00,0x00,
0x27,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x27,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,
0x2c,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x29,0x00,0x00,0x00,
0x2c,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x2d,0x00,0x00,0x00,0x32,0x00,0x00,0x00,
0x31,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x2f,0x00,0x00,0x00,0x32,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x2d,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x34,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x33,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,
0x38,0x00,0x01,0x00,
};
/*
#version 460
layout(set = 1, binding = 0) uniform texture2D tex;
layout(set = 1, binding = 32) uniform sampler smp;
layout(set = 1, binding = 1) uniform texture2D lightmap;
layout(set = 1, binding = 33) uniform sampler lightmap_smp;
layout(location = 1) in vec2 fs_tex_uv;
layout(location = 2) in vec2 fs_lightmap_uv;
layout(location = 0) out vec4 frag_color;
layout(location = 1) in vec2 fs_uv;
layout(location = 0) in vec3 fs_norm;
layout(location = 3) in float depth;
void main()
{
frag_color = texture(sampler2D(tex, smp), fs_uv);
frag_color = texture(sampler2D(lightmap, lightmap_smp), fs_lightmap_uv);
}
*/
static const uint8_t fs_bytecode_spirv_vk[764] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x1c,0x00,0x00,0x00,
static const uint8_t fs_bytecode_spirv_vk[916] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x1f,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00,
0x01,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30,
0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x0f,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x0f,0x00,0x0c,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x16,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x10,0x00,0x03,0x00,0x04,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x02,0x00,0x00,0x00,0xcc,0x01,0x00,0x00,
0x05,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,
0x05,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x74,0x65,0x78,0x00,
0x05,0x00,0x03,0x00,0x10,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x05,0x00,0x04,0x00,
0x16,0x00,0x00,0x00,0x66,0x73,0x5f,0x75,0x76,0x00,0x00,0x00,0x05,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x00,0x47,0x00,0x04,0x00,
0x09,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x0c,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x0c,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x10,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x10,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x16,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x02,0x00,
0x02,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x16,0x00,0x03,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,
0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x08,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x19,0x00,0x09,0x00,
0x0a,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1a,0x00,0x02,0x00,0x0e,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x12,0x00,0x00,0x00,
0x0a,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x14,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x1a,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x19,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x1a,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x05,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x56,0x00,0x05,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0x16,0x00,0x00,0x00,0x57,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x13,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x09,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
0x16,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x10,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x00,
0x02,0x00,0x00,0x00,0xcc,0x01,0x00,0x00,0x05,0x00,0x04,0x00,0x04,0x00,0x00,0x00,
0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x09,0x00,0x00,0x00,
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x05,0x00,
0x0c,0x00,0x00,0x00,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x00,0x00,0x00,0x00,
0x05,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,
0x5f,0x73,0x6d,0x70,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,0x16,0x00,0x00,0x00,
0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x00,0x00,
0x05,0x00,0x05,0x00,0x19,0x00,0x00,0x00,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,
0x76,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x66,0x73,0x5f,0x6e,
0x6f,0x72,0x6d,0x00,0x05,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x64,0x65,0x70,0x74,
0x68,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
0x21,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x21,0x00,0x03,0x00,
0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x06,0x00,0x00,0x00,
0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x19,0x00,0x09,0x00,0x0a,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,
0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x00,0x02,0x00,0x0e,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1b,0x00,0x03,0x00,0x12,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x17,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x15,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x15,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,
0x1a,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x1d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x1d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,
0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0xf8,0x00,0x02,0x00,0x05,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,
0x0d,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x56,0x00,0x05,0x00,0x12,0x00,0x00,0x00,
0x13,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x57,0x00,0x05,0x00,
0x07,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,
0x38,0x00,0x01,0x00,
};
static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_D3D11) {
@ -430,21 +544,24 @@ static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
desc.attrs[2].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[2].hlsl_sem_name = "TEXCOORD";
desc.attrs[2].hlsl_sem_index = 2;
desc.attrs[3].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[3].hlsl_sem_name = "TEXCOORD";
desc.attrs[3].hlsl_sem_index = 3;
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].size = 80;
desc.uniform_blocks[0].hlsl_register_b_n = 0;
desc.views[0].texture.stage = SG_SHADERSTAGE_FRAGMENT;
desc.views[0].texture.image_type = SG_IMAGETYPE_2D;
desc.views[0].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.views[0].texture.multisampled = false;
desc.views[0].texture.hlsl_register_t_n = 0;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[0].hlsl_register_s_n = 0;
desc.views[1].texture.stage = SG_SHADERSTAGE_FRAGMENT;
desc.views[1].texture.image_type = SG_IMAGETYPE_2D;
desc.views[1].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.views[1].texture.multisampled = false;
desc.views[1].texture.hlsl_register_t_n = 1;
desc.samplers[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[1].hlsl_register_s_n = 1;
desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.texture_sampler_pairs[0].view_slot = 0;
desc.texture_sampler_pairs[0].sampler_slot = 0;
desc.texture_sampler_pairs[0].view_slot = 1;
desc.texture_sampler_pairs[0].sampler_slot = 1;
desc.label = "obj_shader";
}
return &desc;
@ -455,29 +572,30 @@ static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
if (!valid) {
valid = true;
desc.vertex_func.bytecode.ptr = vs_bytecode_spirv_vk;
desc.vertex_func.bytecode.size = 1348;
desc.vertex_func.bytecode.size = 1780;
desc.vertex_func.entry = "main";
desc.fragment_func.bytecode.ptr = fs_bytecode_spirv_vk;
desc.fragment_func.bytecode.size = 764;
desc.fragment_func.bytecode.size = 916;
desc.fragment_func.entry = "main";
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[1].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[2].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[3].base_type = SG_SHADERATTRBASETYPE_FLOAT;
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].size = 80;
desc.uniform_blocks[0].spirv_set0_binding_n = 0;
desc.views[0].texture.stage = SG_SHADERSTAGE_FRAGMENT;
desc.views[0].texture.image_type = SG_IMAGETYPE_2D;
desc.views[0].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.views[0].texture.multisampled = false;
desc.views[0].texture.spirv_set1_binding_n = 0;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[0].spirv_set1_binding_n = 32;
desc.views[1].texture.stage = SG_SHADERSTAGE_FRAGMENT;
desc.views[1].texture.image_type = SG_IMAGETYPE_2D;
desc.views[1].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.views[1].texture.multisampled = false;
desc.views[1].texture.spirv_set1_binding_n = 1;
desc.samplers[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[1].spirv_set1_binding_n = 33;
desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.texture_sampler_pairs[0].view_slot = 0;
desc.texture_sampler_pairs[0].sampler_slot = 0;
desc.texture_sampler_pairs[0].view_slot = 1;
desc.texture_sampler_pairs[0].sampler_slot = 1;
desc.label = "obj_shader";
}
return &desc;

View file

@ -12,6 +12,7 @@
#include "libs/sokol_gfx.h"
#include "libs/sokol_time.h"
#include "libs/sokol_glue.h"
#include "libs/handmademath.h"
#include "vecmath.h"
@ -31,6 +32,8 @@ scene_t scene = {0};
camera_t camera = {0};
u64 time_last = 0;
vs_params_t vs_params = {0};
////////////////////////////////
void sokol_log_cb(
@ -62,6 +65,7 @@ void app_init(void) {
sg_setup(&(sg_desc){
.environment = sglue_environment(),
.logger.func = sokol_log_cb,
.d3d11.shader_debugging = true,
});
stm_setup();
@ -71,7 +75,8 @@ void app_init(void) {
frame_arena = arena_make(ARENA_VIRTUAL, GB(1));
scene = obj_load_gltf(frame_arena, strv("data/metro.glb"));
// scene = obj_load_gltf(frame_arena, strv("data/metro.glb"));
scene = obj_load_gltf(frame_arena, strv("data/scene.glb"));
camera = cam_init();
sg_shader shd = sg_make_shader(obj_shader_desc(sg_query_backend()));
@ -89,6 +94,7 @@ void app_init(void) {
[0].format = SG_VERTEXFORMAT_FLOAT3,
[1].format = SG_VERTEXFORMAT_FLOAT3,
[2].format = SG_VERTEXFORMAT_FLOAT2,
[3].format = SG_VERTEXFORMAT_FLOAT2,
},
},
});
@ -117,13 +123,16 @@ void app_frame(void) {
HMM_Mat4 model = HMM_Translate(HMM_V3(0, 0, -10));
// HMM_Mat4 vp = HMM_Mul(HMM_Mul(proj, view), model);
HMM_Mat4 vp = HMM_Mul(proj, view);
// HMM_Mat4 vp = HMM_Mul(proj, view);
vs_params.mvp = HMM_Mul(proj, view);
vs_params.cam_pos = camera.pos;
arena_rewind(&frame_arena, 0);
sg_begin_pass(&(sg_pass){ .action = pass_action, .swapchain = sglue_swapchain() });
sg_apply_pipeline(pip);
sg_apply_uniforms(0, SG_RANGE_REF(vp));
sg_apply_uniforms(0, SG_RANGE_REF(vs_params));
for (int i = 0; i < scene.object_count; ++i) {
sg_apply_bindings(&scene.objects[i].bindings);
sg_draw(0, scene.objects[i].draw_count, 1);

View file

@ -12,6 +12,7 @@ struct vertex_t {
vec3 pos;
vec3 norm;
vec2 tex;
vec2 lightmap;
};
typedef struct material_t material_t;
@ -282,11 +283,32 @@ struct scene_t {
int object_count;
};
#define CACHE_SIZE (64)
#define MAX_CACHE_NAME_LEN (64)
typedef struct cache_item_t cache_item_t;
struct cache_item_t {
char name[MAX_CACHE_NAME_LEN];
sg_image image;
};
cache_item_t tex_cache[CACHE_SIZE] = {0};
int tex_cache_size = 0;
sg_image obj__load_texture(arena_t scratch, cgltf_texture *texture) {
if (!texture || !texture->image) {
return (sg_image){0};
}
cgltf_image *image = texture->image;
const char *name = image->name;
for (int i = 0; i < tex_cache_size; ++i) {
if (strcmp(tex_cache[i].name, name) == 0) {
return tex_cache[i].image;
}
}
u8 *bytes = NULL;
usize size = 0;
if (image->uri) {
@ -322,6 +344,13 @@ sg_image obj__load_texture(arena_t scratch, cgltf_texture *texture) {
stbi_image_free(pixels);
cache_item_t *item = &tex_cache[tex_cache_size++];
colla_assert(tex_cache_size < CACHE_SIZE, "texture cache full");
item->image = out;
usize len = strlen(name);
memmove(item->name, name, MIN(len, MAX_CACHE_NAME_LEN));
return out;
}
@ -360,11 +389,16 @@ scene_t obj_load_gltf(arena_t scratch, strview_t filename) {
colla_assert(data->meshes_count == 1);
sg_sampler sampler = sg_make_sampler(&(sg_sampler_desc){
sg_sampler tex_sampler = sg_make_sampler(&(sg_sampler_desc){
.min_filter = SG_FILTER_NEAREST,
.mag_filter = SG_FILTER_NEAREST,
});
sg_sampler lightmap_sampler = sg_make_sampler(&(sg_sampler_desc){
.min_filter = SG_FILTER_LINEAR,
.mag_filter = SG_FILTER_LINEAR,
});
u32 missing_texture[] = {
0xFFFF00FF, 0x00000000,
0x00000000, 0xFFFF00FF,
@ -399,6 +433,7 @@ scene_t obj_load_gltf(arena_t scratch, strview_t filename) {
cgltf_material *mat = prim->material;
// diffuse texture
cgltf_texture_view texture_view = mat->pbr_metallic_roughness.base_color_texture;
sg_image image = obj__load_texture(scratch, texture_view.texture);
if (image.id == 0) {
@ -407,8 +442,20 @@ scene_t obj_load_gltf(arena_t scratch, strview_t filename) {
sg_view view = sg_make_view(&(sg_view_desc){
.texture.image = image,
});
obj->bindings.views[0] = view;
obj->bindings.samplers[0] = sampler;
obj->bindings.samplers[0] = tex_sampler;
// lightmap
sg_image lightmap = missing_img;
if (mat->emissive_texture.texture) {
lightmap = obj__load_texture(scratch, mat->emissive_texture.texture);
}
sg_view lm_view = sg_make_view(&(sg_view_desc){
.texture.image = lightmap,
});
obj->bindings.views[1] = lm_view;
obj->bindings.samplers[1] = lightmap_sampler;
for (usize a = 0; a < prim->attributes_count; ++a) {
cgltf_attribute *attr = &prim->attributes[a];
@ -429,10 +476,19 @@ scene_t obj_load_gltf(arena_t scratch, strview_t filename) {
}
break;
case cgltf_attribute_type_texcoord:
{
if (attr->index == 0) {
for (usize k = 0; k < acc->count; ++k) {
cgltf_accessor_read_float(acc, k, verts[k].tex.data, 2);
}
}
else {
for (usize k = 0; k < acc->count; ++k) {
cgltf_accessor_read_float(acc, k, verts[k].lightmap.data, 2);
}
}
break;
}
default: break;
}