This commit is contained in:
alessandro bason 2026-03-05 16:45:29 +01:00
parent 507d635433
commit 1c13514a4d
45 changed files with 2615 additions and 2014 deletions

67
data/batcher.glsl Normal file
View file

@ -0,0 +1,67 @@
@ctype vec2 vec2
@ctype vec4 vec4
@vs vs
layout(binding=0) uniform render_data {
vec2 one_over_window_size;
float zoom;
};
in vec4 quad;
in vec4 tex_quad;
in vec4 colour;
out vec2 uv;
out vec4 fs_colour;
const int indices[6] = {
0, 1, 2, 2, 3, 0,
};
const vec3 positions[4] = {
vec3(0, 0, 0),
vec3(0, 1, 0),
vec3(1, 1, 0),
vec3(1, 0, 0),
};
const vec2 uvs[4] = {
vec2(0.0f, 0.0f),
vec2(0.0f, 1.0f),
vec2(1.0f, 1.0f),
vec2(1.0f, 0.0f),
};
void main() {
int vtx = indices[gl_VertexIndex];
vec3 pos = positions[vtx];
uv = uvs[vtx];
pos.xy = ((pos.xy * quad.zw) + quad.xy) * zoom;
pos.xy = (pos.xy * one_over_window_size) * 2.0 - 1.0;
pos.y = -pos.y;
uv *= tex_quad.zw;
uv += tex_quad.xy;
gl_Position = vec4(pos, 1);
fs_colour = colour;
}
@end
@fs fs
layout(binding=0) uniform texture2D tex;
layout(binding=0) uniform sampler smp;
in vec2 uv;
in vec4 fs_colour;
out vec4 frag_colour;
void main() {
vec4 c = texture(sampler2D(tex, smp), uv) * fs_colour;
if (c.a < 1) discard;
frag_colour = c;
}
@end
@program batcher vs fs

Binary file not shown.

BIN
data/font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

View file

@ -1,5 +1,5 @@
@ctype mat4 HMM_Mat4 @ctype mat4 mat4
@ctype vec3 HMM_Vec3 @ctype vec3 vec3
@vs vs @vs vs
layout(binding=0) uniform vs_params { layout(binding=0) uniform vs_params {

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,011 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

View file

@ -1,22 +0,0 @@
@vs vs
in vec4 position;
in vec4 color0;
out vec4 color;
void main() {
gl_Position = position;
color = color0;
}
@end
@fs fs
in vec4 color;
out vec4 frag_color;
void main() {
frag_color = color;
}
@end
@program triangle vs fs

8
gen.nu
View file

@ -5,7 +5,13 @@ mkdir src/gen
ls data/*.glsl ls data/*.glsl
| get name | get name
| each { |s| | each { |s|
let outname = $s | path parse | $'src/gen/($in.stem).h' let name = $s | path parse | get stem
let outname = $'src/gen/($name).h'
bin/sokol-shdc -i $s -o $outname -l hlsl5:spirv_vk -f sokol bin/sokol-shdc -i $s -o $outname -l hlsl5:spirv_vk -f sokol
open $outname
| str replace -ar '(vs_[a-z])' $'($name)_$1'
| str replace -ar '(fs_[a-z])' $'($name)_$1'
| save -f $outname
$outname
} }

View file

@ -1,28 +1,14 @@
#include "colla/colla.h" #include "colla/colla.h"
#include "camera.h"
#include "libs/handmademath.h"
#include "libs/sokol_gfx.h" #include "libs/sokol_gfx.h"
#include "utils.h" #include "utils.h"
#define WORLD_UP HMM_V3(0, 1, 0) #define WORLD_UP v3(0, 1, 0)
#define NEAR_Z (0.1f) #define NEAR_Z (0.1f)
#define FAR_Z (1000.f) #define FAR_Z (1000.f)
typedef struct camera_t camera_t;
struct camera_t {
HMM_Vec3 pos;
HMM_Vec3 fwd;
HMM_Vec3 up;
float yaw, pitch;
HMM_Mat4 lookat;
float speed, mov_speed, look_speed;
float fov;
};
camera_t cam_init(void) { camera_t cam_init(void) {
camera_t cam = { camera_t cam = {
.fwd = { 0, 0, -1 }, .fwd = { 0, 0, -1 },
@ -30,7 +16,7 @@ camera_t cam_init(void) {
.pos = { 0, 0, 0 }, .pos = { 0, 0, 0 },
.look_speed = 0.3f, .look_speed = 0.3f,
.mov_speed = 15.f, .mov_speed = 15.f,
.fov = HMM_DegToRad * 60.f, .fov = hmm_degtorad * 60.f,
}; };
return cam; return cam;
} }
@ -43,35 +29,35 @@ void cam_update(camera_t *cam, float dt) {
float move_speed = cam->mov_speed * dt; float move_speed = cam->mov_speed * dt;
float look_speed = cam->look_speed * dt; float look_speed = cam->look_speed * dt;
HMM_Vec2 delta = mouse_delta(); vec2 delta = mouse_delta();
cam->yaw += delta.X * look_speed; cam->yaw += delta.x * look_speed;
cam->pitch -= delta.Y * look_speed; cam->pitch -= delta.y * look_speed;
float max_angle = HMM_DegToRad * 89.f; float max_angle = hmm_degtorad * 89.f;
cam->pitch = HMM_Clamp(-max_angle, cam->pitch, max_angle); cam->pitch = clamp(-max_angle, cam->pitch, max_angle);
float yc = cosf(cam->yaw); float yc = cosf(cam->yaw);
float ys = sinf(cam->yaw); float ys = sinf(cam->yaw);
float pc = cosf(cam->pitch); float pc = cosf(cam->pitch);
float ps = sinf(cam->pitch); float ps = sinf(cam->pitch);
cam->fwd = HMM_Norm(HMM_V3( cam->fwd = norm(v3(
pc * ys, pc * ys,
ps, ps,
-pc * yc -pc * yc
)); ));
HMM_Vec3 right = HMM_Norm(HMM_Cross(cam->fwd, WORLD_UP)); vec3 right = norm(cross(cam->fwd, WORLD_UP));
cam->up = HMM_Cross(right, cam->fwd); cam->up = cross(right, cam->fwd);
cam->pos = HMM_Add( cam->pos = hmm_add(
cam->pos, cam->pos,
HMM_Mul( hmm_mul(
HMM_Add( hmm_add(
HMM_Add( hmm_add(
HMM_Mul(cam->fwd, forward), hmm_mul(cam->fwd, forward),
HMM_Mul(right, strafe) hmm_mul(right, strafe)
), ),
HMM_Mul(cam->up, movup) hmm_mul(cam->up, movup)
), ),
move_speed move_speed
) )
@ -79,15 +65,15 @@ void cam_update(camera_t *cam, float dt) {
} }
HMM_Mat4 cam_view(camera_t *cam) { mat4 cam_view(camera_t *cam) {
HMM_Mat4 view = HMM_LookAt_RH(cam->pos, HMM_Add(cam->pos, cam->fwd), cam->up); mat4 view = HMM_LookAt_RH(cam->pos, hmm_add(cam->pos, cam->fwd), cam->up);
return view; return view;
} }
HMM_Mat4 cam_proj(camera_t *cam) { mat4 cam_proj(camera_t *cam) {
float aspect = sapp_widthf() / sapp_heightf(); float aspect = sapp_widthf() / sapp_heightf();
HMM_Mat4 proj = HMM_Perspective_RH_ZO(cam->fov, aspect, NEAR_Z, FAR_Z); mat4 proj = HMM_Perspective_RH_ZO(cam->fov, aspect, NEAR_Z, FAR_Z);
return proj; return proj;
} }

22
src/camera.h Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include "libs/handmademath.h"
typedef struct camera_t camera_t;
struct camera_t {
vec3 pos;
vec3 fwd;
vec3 up;
float yaw, pitch;
mat4 lookat;
float speed, mov_speed, look_speed;
float fov;
};
camera_t cam_init(void);
void cam_update(camera_t *cam, float dt);
mat4 cam_view(camera_t *cam);
mat4 cam_proj(camera_t *cam);

@ -1 +1 @@
Subproject commit c7291ead23083a3a38fc8831ce22418fb8b4c211 Subproject commit e0dc93f61d1983687941293fdc1fccf90a766c0d

53
src/game.c Normal file
View file

@ -0,0 +1,53 @@
#include "game.h"
#include <string.h>
#define FRAME_X(_, name) extern void name##_frame(arena_t scratch, entity_t *entities, float dt);
ENTITY_KIND(FRAME_X)
#undef FRAME_X
entity_update_fn game_frame_fn[ENTITY__COUNT] = {
NULL,
#define FN_X(_, name) name##_frame,
ENTITY_KIND(FN_X)
#undef FN_X
};
game_t game = {0};
void game_init() {
game.arena = arena_make(ARENA_VIRTUAL, GB(1));
game.frame_arena = arena_scratch(&game.arena, MB(5));
}
void game_cleanup(void) {
}
void game_frame(float dt) {
arena_rewind(&game.frame_arena, 0);
#define FRAME_X(enumval, name) \
name##_frame(game.frame_arena, game.active_by_type[ENTITY_##enumval], dt);
ENTITY_KIND(FRAME_X);
#undef FRAME_X
}
entity_t *game_new_entity(entity_kind_e kind) {
entity_t *e = game.freelist;
list_pop(game.freelist);
if (!e) {
e = alloc(&game.arena, entity_t, .flags = ALLOC_NOZERO);
}
memset(e, 0, sizeof(entity_t));
e->kind = kind;
dlist_push(game.active_by_type[kind], e);
return e;
}
void game_entity_destroy(entity_t *e) {
dlist_pop(game.active_by_type[e->kind], e);
dlist_push(game.freelist, e);
}

47
src/game.h Normal file
View file

@ -0,0 +1,47 @@
#pragma once
#include "colla/colla.h"
#include "camera.h"
#define ENTITY_KIND(X) \
X(PLAYER, player) \
typedef enum {
ENTITY_NONE,
#define ENUM_X(name, ...) ENTITY_##name,
ENTITY_KIND(ENUM_X)
#undef ENUM_X
ENTITY__COUNT,
} entity_kind_e;
typedef struct entity_t entity_t;
typedef void (*entity_update_fn)(arena_t scratch, entity_t *entites, float dt);
struct entity_t {
entity_kind_e kind;
entity_t *next;
entity_t *prev;
camera_t camera;
vec3 position;
};
typedef struct game_t game_t;
struct game_t {
arena_t arena;
arena_t frame_arena;
entity_t *freelist;
entity_t *active_by_type[ENTITY__COUNT];
};
extern game_t game;
void game_init(void);
void game_cleanup(void);
void game_frame(float dt);
entity_t *game_new_entity(entity_kind_e kind);
void game_entity_destroy(entity_t *e);

736
src/gen/batcher.h Normal file
View file

@ -0,0 +1,736 @@
#pragma once
/*
#version:1# (machine generated, don't edit!)
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i data\batcher.glsl -o src/gen/batcher.h -l hlsl5:spirv_vk -f sokol
Overview:
=========
Shader program: 'batcher':
Get shader desc: batcher_shader_desc(sg_query_backend());
Vertex Shader: vs
Fragment Shader: fs
Attributes:
ATTR_batcher_quad => 0
ATTR_batcher_tex_quad => 1
ATTR_batcher_colour => 2
Bindings:
Uniform block 'render_data':
C struct: render_data_t
Bind slot: UB_render_data => 0
Texture 'tex':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: VIEW_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 batcher.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_batcher_quad (0)
#define ATTR_batcher_tex_quad (1)
#define ATTR_batcher_colour (2)
#define UB_render_data (0)
#define VIEW_tex (0)
#define SMP_smp (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct render_data_t {
vec2 one_over_window_size;
float zoom;
uint8_t _pad_12[4];
} render_data_t;
#pragma pack(pop)
/*
static float3 _135;
static const int _16[6] = { 0, 1, 2, 2, 3, 0 };
static const float3 _36[4] = { 0.0f.xxx, float3(0.0f, 1.0f, 0.0f), float3(1.0f, 1.0f, 0.0f), float3(1.0f, 0.0f, 0.0f) };
static const float2 _50[4] = { 0.0f.xx, float2(0.0f, 1.0f), 1.0f.xx, float2(1.0f, 0.0f) };
cbuffer render_data : register(b0)
{
float2 _70_one_over_window_size : packoffset(c0);
float _70_zoom : packoffset(c0.z);
};
static float4 gl_Position;
static int gl_VertexIndex;
static float2 uv;
static float4 quad;
static float4 tex_quad;
static float4 batcher_fs_colour;
static float4 colour;
struct SPIRV_Cross_Input
{
float4 quad : TEXCOORD0;
float4 tex_quad : TEXCOORD1;
float4 colour : TEXCOORD2;
uint gl_VertexIndex : SV_VertexID;
};
struct SPIRV_Cross_Output
{
float2 uv : TEXCOORD0;
float4 batcher_fs_colour : TEXCOORD1;
float4 gl_Position : SV_Position;
};
void vert_main()
{
uv = _50[_16[gl_VertexIndex]];
float2 _74 = ((_36[_16[gl_VertexIndex]].xy * quad.zw) + quad.xy) * _70_zoom;
float3 _124;
_124.x = _74.x;
_124.y = _74.y;
float2 _91 = ((_124.xy * _70_one_over_window_size) * 2.0f) - 1.0f.xx;
uv *= tex_quad.zw;
uv += tex_quad.xy;
gl_Position = float4(_91.x, -_91.y, _36[_16[gl_VertexIndex]].z, 1.0f);
batcher_fs_colour = colour;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_VertexIndex = int(stage_input.gl_VertexIndex);
quad = stage_input.quad;
tex_quad = stage_input.tex_quad;
colour = stage_input.colour;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.uv = uv;
stage_output.batcher_fs_colour = batcher_fs_colour;
return stage_output;
}
*/
static const uint8_t batcher_vs_source_hlsl5[1691] = {
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,
0x33,0x35,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e,0x73,
0x74,0x20,0x69,0x6e,0x74,0x20,0x5f,0x31,0x36,0x5b,0x36,0x5d,0x20,0x3d,0x20,0x7b,
0x20,0x30,0x2c,0x20,0x31,0x2c,0x20,0x32,0x2c,0x20,0x32,0x2c,0x20,0x33,0x2c,0x20,
0x30,0x20,0x7d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e,0x73,
0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x33,0x36,0x5b,0x34,0x5d,0x20,
0x3d,0x20,0x7b,0x20,0x30,0x2e,0x30,0x66,0x2e,0x78,0x78,0x78,0x2c,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,
0x20,0x30,0x2e,0x30,0x66,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x31,
0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,
0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30,
0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x20,0x7d,0x3b,0x0a,0x73,0x74,
0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x32,0x20,0x5f,0x35,0x30,0x5b,0x34,0x5d,0x20,0x3d,0x20,0x7b,0x20,0x30,0x2e,0x30,
0x66,0x2e,0x78,0x78,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,
0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78,
0x78,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,
0x30,0x2e,0x30,0x66,0x29,0x20,0x7d,0x3b,0x0a,0x0a,0x63,0x62,0x75,0x66,0x66,0x65,
0x72,0x20,0x72,0x65,0x6e,0x64,0x65,0x72,0x5f,0x64,0x61,0x74,0x61,0x20,0x3a,0x20,
0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x37,0x30,0x5f,0x6f,0x6e,
0x65,0x5f,0x6f,0x76,0x65,0x72,0x5f,0x77,0x69,0x6e,0x64,0x6f,0x77,0x5f,0x73,0x69,
0x7a,0x65,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,
0x63,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
0x37,0x30,0x5f,0x7a,0x6f,0x6f,0x6d,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,
0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x2e,0x7a,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,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,
0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x71,0x75,0x61,0x64,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x74,0x65,0x78,0x5f,0x71,
0x75,0x61,0x64,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x34,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x3b,0x0a,0x73,0x74,
0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,
0x75,0x72,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,0x71,0x75,0x61,0x64,0x20,
0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x74,0x65,0x78,0x5f,0x71,0x75,0x61,0x64,
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,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x20,
0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,
0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,0x53,0x56,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,
0x49,0x44,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,0x32,0x20,0x75,
0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,
0x6f,0x75,0x72,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,0x75,0x76,0x20,0x3d,0x20,0x5f,0x35,0x30,0x5b,0x5f,0x31,0x36,0x5b,0x67,
0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x5d,0x5d,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x37,0x34,0x20,
0x3d,0x20,0x28,0x28,0x5f,0x33,0x36,0x5b,0x5f,0x31,0x36,0x5b,0x67,0x6c,0x5f,0x56,
0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x5d,0x5d,0x2e,0x78,0x79,0x20,
0x2a,0x20,0x71,0x75,0x61,0x64,0x2e,0x7a,0x77,0x29,0x20,0x2b,0x20,0x71,0x75,0x61,
0x64,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x5f,0x37,0x30,0x5f,0x7a,0x6f,0x6f,0x6d,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x32,
0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x34,0x2e,0x78,0x20,0x3d,0x20,
0x5f,0x37,0x34,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x34,0x2e,
0x79,0x20,0x3d,0x20,0x5f,0x37,0x34,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x39,0x31,0x20,0x3d,0x20,0x28,0x28,0x5f,0x31,
0x32,0x34,0x2e,0x78,0x79,0x20,0x2a,0x20,0x5f,0x37,0x30,0x5f,0x6f,0x6e,0x65,0x5f,
0x6f,0x76,0x65,0x72,0x5f,0x77,0x69,0x6e,0x64,0x6f,0x77,0x5f,0x73,0x69,0x7a,0x65,
0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,
0x2e,0x78,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x2a,0x3d,0x20,0x74,
0x65,0x78,0x5f,0x71,0x75,0x61,0x64,0x2e,0x7a,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x76,0x20,0x2b,0x3d,0x20,0x74,0x65,0x78,0x5f,0x71,0x75,0x61,0x64,0x2e,0x78,
0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x39,0x31,0x2e,
0x78,0x2c,0x20,0x2d,0x5f,0x39,0x31,0x2e,0x79,0x2c,0x20,0x5f,0x33,0x36,0x5b,0x5f,
0x31,0x36,0x5b,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,
0x78,0x5d,0x5d,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x20,0x3d,0x20,0x63,0x6f,
0x6c,0x6f,0x75,0x72,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,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,
0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,0x65,
0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,
0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x71,0x75,0x61,0x64,
0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x71,
0x75,0x61,0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x74,0x65,0x78,0x5f,0x71,0x75,0x61,
0x64,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
0x74,0x65,0x78,0x5f,0x71,0x75,0x61,0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,
0x6c,0x6f,0x75,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,
0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,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,0x75,0x76,
0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,
0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,
0x72,0x20,0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,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,
};
/*
Texture2D<float4> tex : register(t0);
SamplerState smp : register(s0);
static float2 uv;
static float4 batcher_fs_colour;
static float4 frag_colour;
struct SPIRV_Cross_Input
{
float2 uv : TEXCOORD0;
float4 batcher_fs_colour : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 frag_colour : SV_Target0;
};
void frag_main()
{
float4 _24 = tex.Sample(smp, uv);
float4 _28 = _24 * batcher_fs_colour;
if (_28.w < 1.0f)
{
discard;
}
frag_colour = _28;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
uv = stage_input.uv;
batcher_fs_colour = stage_input.batcher_fs_colour;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.frag_colour = frag_colour;
return stage_output;
}
*/
static const uint8_t batcher_fs_source_hlsl5[719] = {
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,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,
0x72,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,0x75,0x72,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,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,
0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,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,0x75,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,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,
0x34,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,
0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x5f,0x32,0x34,0x20,0x2a,0x20,
0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,
0x66,0x20,0x28,0x5f,0x32,0x38,0x2e,0x77,0x20,0x3c,0x20,0x31,0x2e,0x30,0x66,0x29,
0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x64,
0x69,0x73,0x63,0x61,0x72,0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,
0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x20,0x3d,0x20,
0x5f,0x32,0x38,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,
0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,
0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,
0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,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,0x75,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x75,
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
const int _16[6] = int[](0, 1, 2, 2, 3, 0);
const vec3 _36[4] = vec3[](vec3(0.0), vec3(0.0, 1.0, 0.0), vec3(1.0, 1.0, 0.0), vec3(1.0, 0.0, 0.0));
const vec2 _50[4] = vec2[](vec2(0.0), vec2(0.0, 1.0), vec2(1.0), vec2(1.0, 0.0));
vec3 _135;
layout(set = 0, binding = 0, std140) uniform render_data
{
vec2 one_over_window_size;
float zoom;
} _70;
layout(location = 0) out vec2 uv;
layout(location = 0) in vec4 quad;
layout(location = 1) in vec4 tex_quad;
layout(location = 1) out vec4 batcher_fs_colour;
layout(location = 2) in vec4 colour;
void main()
{
uv = _50[_16[gl_VertexIndex]];
vec2 _74 = ((_36[_16[gl_VertexIndex]].xy * quad.zw) + quad.xy) * _70.zoom;
vec3 _124;
_124.x = _74.x;
_124.y = _74.y;
vec2 _91 = ((_124.xy * _70.one_over_window_size) * 2.0) - vec2(1.0);
uv *= tex_quad.zw;
uv += tex_quad.xy;
gl_Position = vec4(_91.x, -_91.y, _36[_16[gl_VertexIndex]].z, 1.0);
batcher_fs_colour = colour;
}
*/
static const uint8_t batcher_vs_bytecode_spirv_vk[3440] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x81,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,0x0e,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x3d,0x00,0x00,0x00,
0x46,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x6b,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,
0x7d,0x00,0x00,0x00,0x80,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,0x75,0x76,0x00,0x00,
0x05,0x00,0x06,0x00,0x1d,0x00,0x00,0x00,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,
0x78,0x49,0x6e,0x64,0x65,0x78,0x00,0x00,0x05,0x00,0x05,0x00,0x20,0x00,0x00,0x00,
0x69,0x6e,0x64,0x65,0x78,0x61,0x62,0x6c,0x65,0x00,0x00,0x00,0x05,0x00,0x05,0x00,
0x25,0x00,0x00,0x00,0x69,0x6e,0x64,0x65,0x78,0x61,0x62,0x6c,0x65,0x00,0x00,0x00,
0x05,0x00,0x03,0x00,0x29,0x00,0x00,0x00,0x5f,0x37,0x34,0x00,0x05,0x00,0x05,0x00,
0x32,0x00,0x00,0x00,0x69,0x6e,0x64,0x65,0x78,0x61,0x62,0x6c,0x65,0x00,0x00,0x00,
0x05,0x00,0x05,0x00,0x36,0x00,0x00,0x00,0x69,0x6e,0x64,0x65,0x78,0x61,0x62,0x6c,
0x65,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x3d,0x00,0x00,0x00,0x71,0x75,0x61,0x64,
0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x44,0x00,0x00,0x00,0x72,0x65,0x6e,0x64,
0x65,0x72,0x5f,0x64,0x61,0x74,0x61,0x00,0x06,0x00,0x09,0x00,0x44,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x6f,0x6e,0x65,0x5f,0x6f,0x76,0x65,0x72,0x5f,0x77,0x69,0x6e,
0x64,0x6f,0x77,0x5f,0x73,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x05,0x00,
0x44,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x7a,0x6f,0x6f,0x6d,0x00,0x00,0x00,0x00,
0x05,0x00,0x03,0x00,0x46,0x00,0x00,0x00,0x5f,0x37,0x30,0x00,0x05,0x00,0x04,0x00,
0x4b,0x00,0x00,0x00,0x5f,0x31,0x32,0x34,0x00,0x00,0x00,0x00,0x05,0x00,0x03,0x00,
0x55,0x00,0x00,0x00,0x5f,0x39,0x31,0x00,0x05,0x00,0x05,0x00,0x5f,0x00,0x00,0x00,
0x74,0x65,0x78,0x5f,0x71,0x75,0x61,0x64,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,
0x69,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78,
0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00,
0x69,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,0x69,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,0x69,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,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,
0x72,0x00,0x00,0x00,0x69,0x6e,0x64,0x65,0x78,0x61,0x62,0x6c,0x65,0x00,0x00,0x00,
0x05,0x00,0x05,0x00,0x76,0x00,0x00,0x00,0x69,0x6e,0x64,0x65,0x78,0x61,0x62,0x6c,
0x65,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x7c,0x00,0x00,0x00,0x66,0x73,0x5f,0x63,
0x6f,0x6c,0x6f,0x75,0x72,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x7d,0x00,0x00,0x00,
0x63,0x6f,0x6c,0x6f,0x75,0x72,0x00,0x00,0x05,0x00,0x04,0x00,0x80,0x00,0x00,0x00,
0x5f,0x31,0x33,0x35,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x09,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,
0x0b,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x20,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x47,0x00,0x03,0x00,0x32,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x47,0x00,0x03,0x00,
0x36,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x3d,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x44,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x44,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x46,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x46,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,
0x5f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x03,0x00,
0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x69,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,
0x69,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x48,0x00,0x05,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x69,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x72,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x76,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x7c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x47,0x00,0x04,0x00,0x7d,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,0x02,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,
0x15,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x2b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x1c,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
0x2b,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x2c,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x0d,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
0x00,0x00,0x80,0x3f,0x2c,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x0d,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x2c,0x00,0x05,0x00,0x07,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x2c,0x00,0x05,0x00,
0x07,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x2c,0x00,0x07,0x00,0x0c,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x15,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x0a,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,
0x16,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x2c,0x00,0x09,0x00,
0x16,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x19,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x1f,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x21,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x24,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,
0x20,0x00,0x04,0x00,0x26,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x17,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x1c,0x00,0x04,0x00,0x2b,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
0x2c,0x00,0x06,0x00,0x2a,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x0d,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x2c,0x00,0x06,0x00,0x2a,0x00,0x00,0x00,
0x2d,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x2c,0x00,0x06,0x00,0x2a,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x2c,0x00,0x06,0x00,0x2a,0x00,0x00,0x00,
0x2f,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
0x2c,0x00,0x07,0x00,0x2b,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,
0x2d,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x35,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x37,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x17,0x00,0x04,0x00,
0x3b,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x3c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x3c,0x00,0x00,0x00,0x3d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1e,0x00,0x04,0x00,
0x44,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x45,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x45,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x47,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x0a,0x00,0x00,0x00,0x4c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x4d,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x0a,0x00,0x00,0x00,0x51,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x58,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x06,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x3b,0x00,0x04,0x00,
0x3c,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,
0x68,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x51,0x00,0x00,0x00,0x1e,0x00,0x06,0x00,
0x69,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x68,0x00,0x00,0x00,
0x68,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x6a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x69,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x6a,0x00,0x00,0x00,0x6b,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x75,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x7a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x3b,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x7a,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x3c,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x7f,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x2a,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x7f,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x06,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,0x05,0x00,0x1f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x1b,0x00,0x00,0x00,0x3b,0x00,0x05,0x00,0x24,0x00,0x00,0x00,0x25,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x26,0x00,0x00,0x00,
0x29,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x3b,0x00,0x05,0x00,0x1f,0x00,0x00,0x00,
0x32,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x3b,0x00,0x05,0x00,
0x35,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x37,0x00,0x00,0x00,0x4b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x3b,0x00,0x04,0x00,0x26,0x00,0x00,0x00,0x55,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x3b,0x00,0x05,0x00,0x1f,0x00,0x00,0x00,0x72,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x1b,0x00,0x00,0x00,0x3b,0x00,0x05,0x00,0x35,0x00,0x00,0x00,0x76,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x14,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x21,0x00,0x00,0x00,
0x22,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
0x26,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x23,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x27,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x14,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
0x21,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x31,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x33,0x00,0x00,0x00,
0x41,0x00,0x05,0x00,0x37,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x36,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,0x39,0x00,0x00,0x00,
0x38,0x00,0x00,0x00,0x4f,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,
0x39,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x3b,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x3d,0x00,0x00,0x00,
0x4f,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,
0x3e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x85,0x00,0x05,0x00,
0x07,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x3b,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x3d,0x00,0x00,0x00,
0x4f,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x42,0x00,0x00,0x00,0x41,0x00,0x00,0x00,
0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x81,0x00,0x05,0x00,
0x07,0x00,0x00,0x00,0x43,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x42,0x00,0x00,0x00,
0x41,0x00,0x05,0x00,0x47,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x46,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x49,0x00,0x00,0x00,
0x48,0x00,0x00,0x00,0x8e,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x4a,0x00,0x00,0x00,
0x43,0x00,0x00,0x00,0x49,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x29,0x00,0x00,0x00,
0x4a,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x4d,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,
0x29,0x00,0x00,0x00,0x4c,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x06,0x00,0x00,0x00,
0x4f,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x4d,0x00,0x00,0x00,
0x50,0x00,0x00,0x00,0x4b,0x00,0x00,0x00,0x4c,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x50,0x00,0x00,0x00,0x4f,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x4d,0x00,0x00,0x00,
0x52,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x51,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x06,0x00,0x00,0x00,0x53,0x00,0x00,0x00,0x52,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
0x4d,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x4b,0x00,0x00,0x00,0x51,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x54,0x00,0x00,0x00,0x53,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x2a,0x00,0x00,0x00,0x56,0x00,0x00,0x00,0x4b,0x00,0x00,0x00,0x4f,0x00,0x07,0x00,
0x07,0x00,0x00,0x00,0x57,0x00,0x00,0x00,0x56,0x00,0x00,0x00,0x56,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x58,0x00,0x00,0x00,
0x59,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x07,0x00,0x00,0x00,0x5a,0x00,0x00,0x00,0x59,0x00,0x00,0x00,0x85,0x00,0x05,0x00,
0x07,0x00,0x00,0x00,0x5b,0x00,0x00,0x00,0x57,0x00,0x00,0x00,0x5a,0x00,0x00,0x00,
0x8e,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x5d,0x00,0x00,0x00,0x5b,0x00,0x00,0x00,
0x5c,0x00,0x00,0x00,0x83,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x5e,0x00,0x00,0x00,
0x5d,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x55,0x00,0x00,0x00,
0x5e,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x3b,0x00,0x00,0x00,0x60,0x00,0x00,0x00,
0x5f,0x00,0x00,0x00,0x4f,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x61,0x00,0x00,0x00,
0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
0x85,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x63,0x00,0x00,0x00,0x62,0x00,0x00,0x00,
0x61,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x63,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x3b,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,
0x4f,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x64,0x00,0x00,0x00,
0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x07,0x00,0x00,0x00,0x66,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x81,0x00,0x05,0x00,
0x07,0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x66,0x00,0x00,0x00,0x65,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
0x4d,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x55,0x00,0x00,0x00,0x4c,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,
0x41,0x00,0x05,0x00,0x4d,0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0x55,0x00,0x00,0x00,
0x51,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x6f,0x00,0x00,0x00,
0x6e,0x00,0x00,0x00,0x7f,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
0x6f,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x71,0x00,0x00,0x00,
0x1d,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x21,0x00,0x00,0x00,0x73,0x00,0x00,0x00,
0x72,0x00,0x00,0x00,0x71,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x14,0x00,0x00,0x00,
0x74,0x00,0x00,0x00,0x73,0x00,0x00,0x00,0x41,0x00,0x06,0x00,0x4d,0x00,0x00,0x00,
0x77,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x75,0x00,0x00,0x00,
0x3d,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x77,0x00,0x00,0x00,
0x50,0x00,0x07,0x00,0x3b,0x00,0x00,0x00,0x79,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,
0x70,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
0x7a,0x00,0x00,0x00,0x7b,0x00,0x00,0x00,0x6b,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0x3e,0x00,0x03,0x00,0x7b,0x00,0x00,0x00,0x79,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x3b,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x7c,0x00,0x00,0x00,0x7e,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(location = 0) in vec2 uv;
layout(location = 1) in vec4 batcher_fs_colour;
layout(location = 0) out vec4 frag_colour;
void main()
{
vec4 _24 = texture(sampler2D(tex, smp), uv);
vec4 _28 = _24 * batcher_fs_colour;
if (_28.w < 1.0)
{
discard;
}
frag_colour = _28;
}
*/
static const uint8_t batcher_fs_bytecode_spirv_vk[1088] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x2d,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,
0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
0x1c,0x00,0x00,0x00,0x2b,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,0x03,0x00,0x09,0x00,0x00,0x00,0x5f,0x32,0x34,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,0x03,0x00,0x16,0x00,0x00,0x00,0x75,0x76,0x00,0x00,
0x05,0x00,0x03,0x00,0x19,0x00,0x00,0x00,0x5f,0x32,0x38,0x00,0x05,0x00,0x05,0x00,
0x1c,0x00,0x00,0x00,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x00,0x00,0x00,
0x05,0x00,0x05,0x00,0x2b,0x00,0x00,0x00,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
0x6f,0x75,0x72,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,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x2b,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,0x07,0x00,0x00,0x00,
0x07,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,0x20,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x00,0x04,0x00,
0x1f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x1f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x21,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,
0x06,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,0x14,0x00,0x02,0x00,
0x25,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,
0x03,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,
0x3b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x07,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,0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,
0x09,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,
0x1c,0x00,0x00,0x00,0x85,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x1a,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x19,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x21,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x19,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x06,0x00,0x00,0x00,
0x23,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0xb8,0x00,0x05,0x00,0x25,0x00,0x00,0x00,
0x26,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0xf7,0x00,0x03,0x00,
0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfa,0x00,0x04,0x00,0x26,0x00,0x00,0x00,
0x27,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x27,0x00,0x00,0x00,
0xfc,0x00,0x01,0x00,0xf8,0x00,0x02,0x00,0x28,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
0x07,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x2b,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
};
static inline const sg_shader_desc* batcher_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_D3D11) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)batcher_vs_source_hlsl5;
desc.vertex_func.d3d11_target = "vs_5_0";
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)batcher_fs_source_hlsl5;
desc.fragment_func.d3d11_target = "ps_5_0";
desc.fragment_func.entry = "main";
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[0].hlsl_sem_name = "TEXCOORD";
desc.attrs[0].hlsl_sem_index = 0;
desc.attrs[1].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[1].hlsl_sem_name = "TEXCOORD";
desc.attrs[1].hlsl_sem_index = 1;
desc.attrs[2].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[2].hlsl_sem_name = "TEXCOORD";
desc.attrs[2].hlsl_sem_index = 2;
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 16;
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.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.label = "batcher_shader";
}
return &desc;
}
if (backend == SG_BACKEND_VULKAN) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.bytecode.ptr = batcher_vs_bytecode_spirv_vk;
desc.vertex_func.bytecode.size = 3440;
desc.vertex_func.entry = "main";
desc.fragment_func.bytecode.ptr = batcher_fs_bytecode_spirv_vk;
desc.fragment_func.bytecode.size = 1088;
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.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 16;
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.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.label = "batcher_shader";
}
return &desc;
}
return 0;
}

View file

@ -19,14 +19,22 @@
ATTR_obj_tex_uv => 2 ATTR_obj_tex_uv => 2
ATTR_obj_lightmap_uv => 3 ATTR_obj_lightmap_uv => 3
Bindings: Bindings:
Uniform block 'vs_params': Uniform block 'obj_vs_params':
C struct: vs_params_t C struct: obj_vs_params_t
Bind slot: UB_vs_params => 0 Bind slot: UB_obj_vs_params => 0
Texture 'tex':
Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false
Bind slot: VIEW_tex => 0
Texture 'lightmap': Texture 'lightmap':
Image type: SG_IMAGETYPE_2D Image type: SG_IMAGETYPE_2D
Sample type: SG_IMAGESAMPLETYPE_FLOAT Sample type: SG_IMAGESAMPLETYPE_FLOAT
Multisampled: false Multisampled: false
Bind slot: VIEW_lightmap => 1 Bind slot: VIEW_lightmap => 1
Sampler 'smp':
Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_smp => 0
Sampler 'lightmap_smp': Sampler 'lightmap_smp':
Type: SG_SAMPLERTYPE_FILTERING Type: SG_SAMPLERTYPE_FILTERING
Bind slot: SMP_lightmap_smp => 1 Bind slot: SMP_lightmap_smp => 1
@ -45,18 +53,20 @@
#define ATTR_obj_norm (1) #define ATTR_obj_norm (1)
#define ATTR_obj_tex_uv (2) #define ATTR_obj_tex_uv (2)
#define ATTR_obj_lightmap_uv (3) #define ATTR_obj_lightmap_uv (3)
#define UB_vs_params (0) #define UB_obj_vs_params (0)
#define VIEW_tex (0)
#define VIEW_lightmap (1) #define VIEW_lightmap (1)
#define SMP_smp (0)
#define SMP_lightmap_smp (1) #define SMP_lightmap_smp (1)
#pragma pack(push,1) #pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t { SOKOL_SHDC_ALIGN(16) typedef struct obj_vs_params_t {
HMM_Mat4 mvp; mat4 mvp;
HMM_Vec3 cam_pos; vec3 cam_pos;
uint8_t _pad_76[4]; uint8_t _pad_76[4];
} vs_params_t; } obj_vs_params_t;
#pragma pack(pop) #pragma pack(pop)
/* /*
cbuffer vs_params : register(b0) cbuffer obj_vs_params : register(b0)
{ {
row_major float4x4 _14_mvp : packoffset(c0); row_major float4x4 _14_mvp : packoffset(c0);
float3 _14_cam_pos : packoffset(c4); float3 _14_cam_pos : packoffset(c4);
@ -66,11 +76,11 @@ SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
static float4 gl_Position; static float4 gl_Position;
static float4 position; static float4 position;
static float depth; static float depth;
static float3 fs_norm; static float3 obj_fs_norm;
static float3 norm; static float3 norm;
static float2 fs_tex_uv; static float2 obj_fs_tex_uv;
static float2 tex_uv; static float2 tex_uv;
static float2 fs_lightmap_uv; static float2 obj_fs_lightmap_uv;
static float2 lightmap_uv; static float2 lightmap_uv;
struct SPIRV_Cross_Input struct SPIRV_Cross_Input
@ -83,9 +93,9 @@ SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
struct SPIRV_Cross_Output struct SPIRV_Cross_Output
{ {
float3 fs_norm : TEXCOORD0; float3 obj_fs_norm : TEXCOORD0;
float2 fs_tex_uv : TEXCOORD1; float2 obj_fs_tex_uv : TEXCOORD1;
float2 fs_lightmap_uv : TEXCOORD2; float2 obj_fs_lightmap_uv : TEXCOORD2;
float depth : TEXCOORD3; float depth : TEXCOORD3;
float4 gl_Position : SV_Position; float4 gl_Position : SV_Position;
}; };
@ -95,9 +105,9 @@ SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
float4 _23 = mul(position, _14_mvp); float4 _23 = mul(position, _14_mvp);
depth = -_23.z; depth = -_23.z;
gl_Position = _23; gl_Position = _23;
fs_norm = norm; obj_fs_norm = norm;
fs_tex_uv = tex_uv; obj_fs_tex_uv = tex_uv;
fs_lightmap_uv = lightmap_uv; obj_fs_lightmap_uv = lightmap_uv;
} }
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
@ -110,13 +120,13 @@ SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
SPIRV_Cross_Output stage_output; SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position; stage_output.gl_Position = gl_Position;
stage_output.depth = depth; stage_output.depth = depth;
stage_output.fs_norm = fs_norm; stage_output.obj_fs_norm = obj_fs_norm;
stage_output.fs_tex_uv = fs_tex_uv; stage_output.obj_fs_tex_uv = obj_fs_tex_uv;
stage_output.fs_lightmap_uv = fs_lightmap_uv; stage_output.obj_fs_lightmap_uv = obj_fs_lightmap_uv;
return stage_output; return stage_output;
} }
*/ */
static const uint8_t vs_source_hlsl5[1380] = { static const uint8_t obj_vs_source_hlsl5[1380] = {
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 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, 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, 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,
@ -206,20 +216,22 @@ static const uint8_t vs_source_hlsl5[1380] = {
0x0a,0x7d,0x0a,0x00, 0x0a,0x7d,0x0a,0x00,
}; };
/* /*
Texture2D<float4> tex : register(t0);
SamplerState smp : register(s0);
Texture2D<float4> lightmap : register(t1); Texture2D<float4> lightmap : register(t1);
SamplerState lightmap_smp : register(s1); SamplerState lightmap_smp : register(s1);
static float2 fs_tex_uv; static float2 obj_fs_tex_uv;
static float2 fs_lightmap_uv; static float2 obj_fs_lightmap_uv;
static float4 frag_color; static float4 frag_color;
static float3 fs_norm; static float3 obj_fs_norm;
static float depth; static float depth;
struct SPIRV_Cross_Input struct SPIRV_Cross_Input
{ {
float3 fs_norm : TEXCOORD0; float3 obj_fs_norm : TEXCOORD0;
float2 fs_tex_uv : TEXCOORD1; float2 obj_fs_tex_uv : TEXCOORD1;
float2 fs_lightmap_uv : TEXCOORD2; float2 obj_fs_lightmap_uv : TEXCOORD2;
float depth : TEXCOORD3; float depth : TEXCOORD3;
}; };
@ -230,14 +242,14 @@ static const uint8_t vs_source_hlsl5[1380] = {
void frag_main() void frag_main()
{ {
frag_color = lightmap.Sample(lightmap_smp, fs_lightmap_uv); frag_color = tex.Sample(smp, obj_fs_tex_uv) * lightmap.Sample(lightmap_smp, obj_fs_lightmap_uv);
} }
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{ {
fs_tex_uv = stage_input.fs_tex_uv; obj_fs_tex_uv = stage_input.obj_fs_tex_uv;
fs_lightmap_uv = stage_input.fs_lightmap_uv; obj_fs_lightmap_uv = stage_input.obj_fs_lightmap_uv;
fs_norm = stage_input.fs_norm; obj_fs_norm = stage_input.obj_fs_norm;
depth = stage_input.depth; depth = stage_input.depth;
frag_main(); frag_main();
SPIRV_Cross_Output stage_output; SPIRV_Cross_Output stage_output;
@ -245,67 +257,73 @@ static const uint8_t vs_source_hlsl5[1380] = {
return stage_output; return stage_output;
} }
*/ */
static const uint8_t fs_source_hlsl5[865] = { static const uint8_t obj_fs_source_hlsl5[965] = {
0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34, 0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,
0x3e,0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x20,0x3a,0x20,0x72,0x65,0x67, 0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,
0x69,0x73,0x74,0x65,0x72,0x28,0x74,0x31,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c, 0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61,
0x65,0x72,0x53,0x74,0x61,0x74,0x65,0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70, 0x74,0x65,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,
0x5f,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28, 0x72,0x28,0x73,0x30,0x29,0x3b,0x0a,0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,
0x73,0x31,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, 0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x3e,0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,
0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x3b,0x0a,0x73, 0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x74,0x31,0x29,
0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f, 0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61,0x74,0x65,0x20,0x6c,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61, 0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f, 0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x73,0x31,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c, 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x74,0x65,
0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x73,0x74, 0x78,0x5f,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x65,0x70,0x74,0x68, 0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, 0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20, 0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d, 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x73,0x5f,0x6e,
0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20, 0x6f,0x72,0x6d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f, 0x74,0x20,0x64,0x65,0x70,0x74,0x68,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,
0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a, 0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x73,0x5f,0x6c,0x69, 0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,
0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, 0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,
0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, 0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
0x20,0x64,0x65,0x70,0x74,0x68,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52, 0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,
0x44,0x33,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53, 0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75, 0x32,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66, 0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54, 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x65,0x70,0x74,0x68,0x20,0x3a,0x20,
0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, 0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,
0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, 0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, 0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28, 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x66,0x73, 0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,
0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x29,0x3b,0x0a,0x7d, 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,
0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f, 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x53,0x61,0x6d,0x70,0x6c,
0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67, 0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,
0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 0x29,0x20,0x2a,0x20,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x2e,0x53,0x61,0x6d,
0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, 0x70,0x6c,0x65,0x28,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x73,0x6d,0x70,
0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76, 0x2c,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61, 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
0x70,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, 0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,
0x75,0x74,0x2e,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,0x75, 0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,
0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x20,0x3d, 0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f, 0x20,0x20,0x20,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,
0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x64,0x65,0x70,0x74,0x68,0x20, 0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x74,0x65,
0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x64,0x65, 0x78,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6c,0x69,0x67,
0x70,0x74,0x68,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61, 0x68,0x74,0x6d,0x61,0x70,0x5f,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,
0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,
0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61, 0x61,0x70,0x5f,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,
0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, 0x72,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,
0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67, 0x2e,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x64,0x65,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, 0x70,0x74,0x68,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,
0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, 0x74,0x2e,0x64,0x65,0x70,0x74,0x68,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a, 0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,
0x00, 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 #version 460
layout(set = 0, binding = 0, std140) uniform vs_params layout(set = 0, binding = 0, std140) uniform obj_vs_params
{ {
mat4 mvp; mat4 mvp;
vec3 cam_pos; vec3 cam_pos;
@ -313,11 +331,11 @@ static const uint8_t fs_source_hlsl5[865] = {
layout(location = 0) in vec4 position; layout(location = 0) in vec4 position;
layout(location = 3) out float depth; layout(location = 3) out float depth;
layout(location = 0) out vec3 fs_norm; layout(location = 0) out vec3 obj_fs_norm;
layout(location = 1) in vec3 norm; layout(location = 1) in vec3 norm;
layout(location = 1) out vec2 fs_tex_uv; layout(location = 1) out vec2 obj_fs_tex_uv;
layout(location = 2) in vec2 tex_uv; layout(location = 2) in vec2 tex_uv;
layout(location = 2) out vec2 fs_lightmap_uv; layout(location = 2) out vec2 obj_fs_lightmap_uv;
layout(location = 3) in vec2 lightmap_uv; layout(location = 3) in vec2 lightmap_uv;
void main() void main()
@ -325,13 +343,13 @@ static const uint8_t fs_source_hlsl5[865] = {
vec4 _23 = _14.mvp * position; vec4 _23 = _14.mvp * position;
depth = -_23.z; depth = -_23.z;
gl_Position = _23; gl_Position = _23;
fs_norm = norm; obj_fs_norm = norm;
fs_tex_uv = tex_uv; obj_fs_tex_uv = tex_uv;
fs_lightmap_uv = lightmap_uv; obj_fs_lightmap_uv = lightmap_uv;
} }
*/ */
static const uint8_t vs_bytecode_spirv_vk[1780] = { static const uint8_t obj_vs_bytecode_spirv_vk[1780] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x36,0x00,0x00,0x00, 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, 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, 0x01,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30,
@ -448,49 +466,57 @@ static const uint8_t vs_bytecode_spirv_vk[1780] = {
/* /*
#version 460 #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 = 1) uniform texture2D lightmap;
layout(set = 1, binding = 33) uniform sampler lightmap_smp; layout(set = 1, binding = 33) uniform sampler lightmap_smp;
layout(location = 1) in vec2 fs_tex_uv; layout(location = 1) in vec2 obj_fs_tex_uv;
layout(location = 2) in vec2 fs_lightmap_uv; layout(location = 2) in vec2 obj_fs_lightmap_uv;
layout(location = 0) out vec4 frag_color; layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec3 fs_norm; layout(location = 0) in vec3 obj_fs_norm;
layout(location = 3) in float depth; layout(location = 3) in float depth;
void main() void main()
{ {
frag_color = texture(sampler2D(lightmap, lightmap_smp), fs_lightmap_uv); frag_color = texture(sampler2D(tex, smp), obj_fs_tex_uv) * texture(sampler2D(lightmap, lightmap_smp), obj_fs_lightmap_uv);
} }
*/ */
static const uint8_t fs_bytecode_spirv_vk[916] = { static const uint8_t obj_fs_bytecode_spirv_vk[1152] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x1f,0x00,0x00,0x00, 0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x27,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,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, 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, 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x0f,0x00,0x0c,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, 0x0f,0x00,0x0e,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, 0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x16,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, 0x16,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x10,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x00, 0x24,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x10,0x00,0x03,0x00,0x04,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0xcc,0x01,0x00,0x00,0x05,0x00,0x04,0x00,0x04,0x00,0x00,0x00, 0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x02,0x00,0x00,0x00,0xcc,0x01,0x00,0x00,
0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x09,0x00,0x00,0x00, 0x05,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x05,0x00, 0x05,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
0x0c,0x00,0x00,0x00,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x00,0x00,0x00,0x00, 0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x74,0x65,0x78,0x00,
0x05,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70, 0x05,0x00,0x03,0x00,0x10,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x05,0x00,0x05,0x00,
0x5f,0x73,0x6d,0x70,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,0x16,0x00,0x00,0x00, 0x16,0x00,0x00,0x00,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75,0x76,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,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,
0x05,0x00,0x05,0x00,0x19,0x00,0x00,0x00,0x66,0x73,0x5f,0x74,0x65,0x78,0x5f,0x75, 0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,0x1b,0x00,0x00,0x00,0x6c,0x69,0x67,0x68,
0x76,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x66,0x73,0x5f,0x6e, 0x74,0x6d,0x61,0x70,0x5f,0x73,0x6d,0x70,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,
0x6f,0x72,0x6d,0x00,0x05,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x64,0x65,0x70,0x74, 0x1e,0x00,0x00,0x00,0x66,0x73,0x5f,0x6c,0x69,0x67,0x68,0x74,0x6d,0x61,0x70,0x5f,
0x75,0x76,0x00,0x00,0x05,0x00,0x04,0x00,0x24,0x00,0x00,0x00,0x66,0x73,0x5f,0x6e,
0x6f,0x72,0x6d,0x00,0x05,0x00,0x04,0x00,0x26,0x00,0x00,0x00,0x64,0x65,0x70,0x74,
0x68,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, 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, 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, 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, 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, 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,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,0x19,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1b,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
0x21,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1b,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x24,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x26,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,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, 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, 0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
@ -507,12 +533,14 @@ static const uint8_t fs_bytecode_spirv_vk[916] = {
0x14,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,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,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,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, 0x0b,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x1a,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00, 0x0f,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, 0x15,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,
0x1b,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00, 0x22,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x1d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, 0x23,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x1d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00, 0x23,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00,
0x25,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,
0x25,0x00,0x00,0x00,0x26,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, 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, 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, 0x0d,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,
@ -520,8 +548,15 @@ static const uint8_t fs_bytecode_spirv_vk[916] = {
0x13,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3d,0x00,0x04,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, 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, 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, 0x3d,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x19,0x00,0x00,0x00,
0x38,0x00,0x01,0x00, 0x3d,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,
0x56,0x00,0x05,0x00,0x12,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,
0x1c,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x57,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x1d,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x85,0x00,0x05,0x00,0x07,0x00,0x00,0x00,
0x21,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
0x09,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
}; };
static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) { static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_D3D11) { if (backend == SG_BACKEND_D3D11) {
@ -529,10 +564,10 @@ static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
static bool valid; static bool valid;
if (!valid) { if (!valid) {
valid = true; valid = true;
desc.vertex_func.source = (const char*)vs_source_hlsl5; desc.vertex_func.source = (const char*)obj_vs_source_hlsl5;
desc.vertex_func.d3d11_target = "vs_5_0"; desc.vertex_func.d3d11_target = "vs_5_0";
desc.vertex_func.entry = "main"; desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_source_hlsl5; desc.fragment_func.source = (const char*)obj_fs_source_hlsl5;
desc.fragment_func.d3d11_target = "ps_5_0"; desc.fragment_func.d3d11_target = "ps_5_0";
desc.fragment_func.entry = "main"; desc.fragment_func.entry = "main";
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT; desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
@ -551,17 +586,28 @@ static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 80; desc.uniform_blocks[0].size = 80;
desc.uniform_blocks[0].hlsl_register_b_n = 0; 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.views[1].texture.stage = SG_SHADERSTAGE_FRAGMENT; desc.views[1].texture.stage = SG_SHADERSTAGE_FRAGMENT;
desc.views[1].texture.image_type = SG_IMAGETYPE_2D; desc.views[1].texture.image_type = SG_IMAGETYPE_2D;
desc.views[1].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT; desc.views[1].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.views[1].texture.multisampled = false; desc.views[1].texture.multisampled = false;
desc.views[1].texture.hlsl_register_t_n = 1; desc.views[1].texture.hlsl_register_t_n = 1;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[0].hlsl_register_s_n = 0;
desc.samplers[1].stage = SG_SHADERSTAGE_FRAGMENT; desc.samplers[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; desc.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[1].hlsl_register_s_n = 1; desc.samplers[1].hlsl_register_s_n = 1;
desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT; desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.texture_sampler_pairs[0].view_slot = 1; desc.texture_sampler_pairs[0].view_slot = 0;
desc.texture_sampler_pairs[0].sampler_slot = 1; desc.texture_sampler_pairs[0].sampler_slot = 0;
desc.texture_sampler_pairs[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.texture_sampler_pairs[1].view_slot = 1;
desc.texture_sampler_pairs[1].sampler_slot = 1;
desc.label = "obj_shader"; desc.label = "obj_shader";
} }
return &desc; return &desc;
@ -571,11 +617,11 @@ static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
static bool valid; static bool valid;
if (!valid) { if (!valid) {
valid = true; valid = true;
desc.vertex_func.bytecode.ptr = vs_bytecode_spirv_vk; desc.vertex_func.bytecode.ptr = obj_vs_bytecode_spirv_vk;
desc.vertex_func.bytecode.size = 1780; desc.vertex_func.bytecode.size = 1780;
desc.vertex_func.entry = "main"; desc.vertex_func.entry = "main";
desc.fragment_func.bytecode.ptr = fs_bytecode_spirv_vk; desc.fragment_func.bytecode.ptr = obj_fs_bytecode_spirv_vk;
desc.fragment_func.bytecode.size = 916; desc.fragment_func.bytecode.size = 1152;
desc.fragment_func.entry = "main"; desc.fragment_func.entry = "main";
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT; desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[1].base_type = SG_SHADERATTRBASETYPE_FLOAT; desc.attrs[1].base_type = SG_SHADERATTRBASETYPE_FLOAT;
@ -585,17 +631,28 @@ static inline const sg_shader_desc* obj_shader_desc(sg_backend backend) {
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 80; desc.uniform_blocks[0].size = 80;
desc.uniform_blocks[0].spirv_set0_binding_n = 0; 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.views[1].texture.stage = SG_SHADERSTAGE_FRAGMENT; desc.views[1].texture.stage = SG_SHADERSTAGE_FRAGMENT;
desc.views[1].texture.image_type = SG_IMAGETYPE_2D; desc.views[1].texture.image_type = SG_IMAGETYPE_2D;
desc.views[1].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT; desc.views[1].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
desc.views[1].texture.multisampled = false; desc.views[1].texture.multisampled = false;
desc.views[1].texture.spirv_set1_binding_n = 1; desc.views[1].texture.spirv_set1_binding_n = 1;
desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[0].spirv_set1_binding_n = 32;
desc.samplers[1].stage = SG_SHADERSTAGE_FRAGMENT; desc.samplers[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; desc.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING;
desc.samplers[1].spirv_set1_binding_n = 33; desc.samplers[1].spirv_set1_binding_n = 33;
desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT; desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
desc.texture_sampler_pairs[0].view_slot = 1; desc.texture_sampler_pairs[0].view_slot = 0;
desc.texture_sampler_pairs[0].sampler_slot = 1; desc.texture_sampler_pairs[0].sampler_slot = 0;
desc.texture_sampler_pairs[1].stage = SG_SHADERSTAGE_FRAGMENT;
desc.texture_sampler_pairs[1].view_slot = 1;
desc.texture_sampler_pairs[1].sampler_slot = 1;
desc.label = "obj_shader"; desc.label = "obj_shader";
} }
return &desc; return &desc;

View file

@ -1,316 +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 data\triangle.glsl -o src/gen/triangle.h -l hlsl5:spirv_vk -f sokol
Overview:
=========
Shader program: 'triangle':
Get shader desc: triangle_shader_desc(sg_query_backend());
Vertex Shader: vs
Fragment Shader: fs
Attributes:
ATTR_triangle_position => 0
ATTR_triangle_color0 => 1
Bindings:
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before 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)
/*
static float4 gl_Position;
static float4 position;
static float4 color;
static float4 color0;
struct SPIRV_Cross_Input
{
float4 position : TEXCOORD0;
float4 color0 : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 color : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = position;
color = color0;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
position = stage_input.position;
color0 = stage_input.color0;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.color = color;
return stage_output;
}
*/
static const uint8_t vs_source_hlsl5[645] = {
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,0x34,
0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,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,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,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,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,
0x43,0x4f,0x4f,0x52,0x44,0x30,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,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,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,0x63,0x6f,0x6c,0x6f,0x72,0x30,
0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,
0x6f,0x6c,0x6f,0x72,0x30,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,0x63,0x6f,0x6c,0x6f,0x72,0x20,
0x3d,0x20,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,
};
/*
static float4 frag_color;
static float4 color;
struct SPIRV_Cross_Input
{
float4 color : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 frag_color : SV_Target0;
};
void frag_main()
{
frag_color = color;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
color = stage_input.color;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.frag_color = frag_color;
return stage_output;
}
*/
static const uint8_t fs_source_hlsl5[435] = {
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,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,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,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,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,0x63,0x6f,0x6c,0x6f,0x72,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,0x63,0x6f,0x6c,0x6f,
0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
0x63,0x6f,0x6c,0x6f,0x72,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
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_bytecode_spirv_vk[840] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x18,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,0x09,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x00,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x15,0x00,0x00,0x00,
0x16,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,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,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,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,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x00,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,
0x72,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,
0x72,0x30,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,0x04,0x00,0x11,0x00,0x00,0x00,0x1e,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,0x16,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,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,0x20,0x00,0x04,0x00,0x10,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x13,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x13,0x00,0x00,0x00,
0x15,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,
0x16,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,0x07,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x0d,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x14,0x00,0x00,0x00,
0x12,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0x16,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
};
/*
#version 460
layout(location = 0) out vec4 frag_color;
layout(location = 0) in vec4 color;
void main()
{
frag_color = color;
}
*/
static const uint8_t fs_bytecode_spirv_vk[376] = {
0x03,0x02,0x23,0x07,0x00,0x04,0x01,0x00,0x0b,0x00,0x08,0x00,0x0d,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,0x07,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x0b,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,0x04,0x00,0x0b,0x00,0x00,0x00,
0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x09,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0b,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,0x20,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,
0x0b,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,0x07,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,
0x0b,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,
0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
};
static inline const sg_shader_desc* triangle_shader_desc(sg_backend backend) {
if (backend == SG_BACKEND_D3D11) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.source = (const char*)vs_source_hlsl5;
desc.vertex_func.d3d11_target = "vs_5_0";
desc.vertex_func.entry = "main";
desc.fragment_func.source = (const char*)fs_source_hlsl5;
desc.fragment_func.d3d11_target = "ps_5_0";
desc.fragment_func.entry = "main";
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[0].hlsl_sem_name = "TEXCOORD";
desc.attrs[0].hlsl_sem_index = 0;
desc.attrs[1].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[1].hlsl_sem_name = "TEXCOORD";
desc.attrs[1].hlsl_sem_index = 1;
desc.label = "triangle_shader";
}
return &desc;
}
if (backend == SG_BACKEND_VULKAN) {
static sg_shader_desc desc;
static bool valid;
if (!valid) {
valid = true;
desc.vertex_func.bytecode.ptr = vs_bytecode_spirv_vk;
desc.vertex_func.bytecode.size = 840;
desc.vertex_func.entry = "main";
desc.fragment_func.bytecode.ptr = fs_bytecode_spirv_vk;
desc.fragment_func.bytecode.size = 376;
desc.fragment_func.entry = "main";
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.attrs[1].base_type = SG_SHADERATTRBASETYPE_FLOAT;
desc.label = "triangle_shader";
}
return &desc;
}
return 0;
}

268
src/gfx.c Normal file
View file

@ -0,0 +1,268 @@
#include "gfx.h"
#include "libs/sokol_app.h"
#include "libs/stb_image.h"
#include "gen/batcher.h"
#include "utils.h"
#include "utils.h"
// batcher stuff ////////////////////////////////////
typedef struct gfx_batch_render_data_t gfx_batch_render_data_t;
struct gfx_batch_render_data_t {
vec2 one_over_window_size;
// float2 one_over_texture_size;
float zoom;
float padding;
};
struct gfx_batcher_t {
sg_buffer render_buffer;
sg_buffer instance_buffer;
sg_pipeline pipeline;
sg_image empty_texture;
sg_sampler sampler;
sg_image texture;
gfx_batch_render_data_t render_data;
gfx_batch_t *batch_data;
uint instance_count;
uint max_instances;
float zoom;
sg_image font;
int font_width;
int font_height;
};
gfx_batcher_t batcher = {0};
bool gfx_init_batcher(arena_t *arena, uint max_instances) {
batcher.zoom = 1.f;
batcher.max_instances = max_instances;
batcher.batch_data = alloc(arena, gfx_batch_t, max_instances);
batcher.render_data = (gfx_batch_render_data_t){
.one_over_window_size = {
1.f / sapp_widthf(),
1.f / sapp_heightf(),
},
.zoom = batcher.zoom
};
batcher.render_buffer = sg_make_buffer(&(sg_buffer_desc){
.usage = {
.storage_buffer = true,
.dynamic_update = true,
},
.size = sizeof(batcher.render_data),
.label = "batcher",
});
sg_update_buffer(batcher.render_buffer, SG_RANGE_REF(batcher.render_data));
batcher.instance_buffer = sg_make_buffer(&(sg_buffer_desc){
.usage = {
.vertex_buffer = true,
.stream_update = true,
},
.size = sizeof(gfx_batch_t) * batcher.max_instances,
});
sg_shader shd = sg_make_shader(batcher_shader_desc(sg_query_backend()));
batcher.pipeline = sg_make_pipeline(&(sg_pipeline_desc){
.shader = shd,
.layout = {
.buffers[0].step_func = SG_VERTEXSTEP_PER_INSTANCE,
.attrs = {
[ATTR_batcher_quad].format = SG_VERTEXFORMAT_FLOAT4,
[ATTR_batcher_tex_quad].format = SG_VERTEXFORMAT_FLOAT4,
[ATTR_batcher_colour].format = SG_VERTEXFORMAT_FLOAT4,
},
},
});
u32 empty_image[] = {
0xffffffff,
};
batcher.empty_texture = sg_make_image(&(sg_image_desc){
.data = SG_RANGE(empty_image),
.width = 1,
.height = 1,
.usage = {
.immutable = true,
},
.pixel_format = SG_PIXELFORMAT_RGBA8,
.label = "empty batcher texture",
});
batcher.sampler = sg_make_sampler(&(sg_sampler_desc){0});
int fw, fh;
u8 *data = stbi_load("data/font.png", &fw, &fh, NULL, 4);
batcher.font = sg_make_image(&(sg_image_desc){
.data = { data, fw * fh * 4 },
.width = fw,
.height = fh,
.usage = {
.immutable = true,
},
.pixel_format = SG_PIXELFORMAT_RGBA8,
.label = "xterm font"
});
batcher.font_width = fw;
batcher.font_height = fh;
stbi_image_free(data);
return true;
}
void gfx_batcher_cleanup(void) {
sg_dealloc_buffer(batcher.render_buffer);
sg_dealloc_buffer(batcher.instance_buffer);
sg_dealloc_pipeline(batcher.pipeline);
sg_dealloc_image(batcher.empty_texture);
}
void gfx_batcher_present(void) {
gfx_batcher_flush();
}
void gfx_batcher_flush(void) {
if (batcher.instance_count == 0) {
return;
}
if (win_has_resized() || batcher.render_data.zoom != batcher.zoom) {
batcher.render_data = (gfx_batch_render_data_t) {
.one_over_window_size = {
1.f / sapp_widthf(),
1.f / sapp_heightf(),
},
.zoom = batcher.zoom,
};
sg_update_buffer(batcher.render_buffer, SG_RANGE_REF(batcher.render_data));
}
if (batcher.texture.id == 0) {
batcher.texture = batcher.empty_texture;
}
buffer_t instance_data = (buffer_t){
(u8*)batcher.batch_data,
sizeof(gfx_batch_t) * batcher.instance_count,
};
sg_update_buffer(batcher.instance_buffer, &(sg_range){
.ptr = batcher.batch_data,
.size = sizeof(gfx_batch_t) * batcher.instance_count,
});
sg_view img_view = sg_make_view(&(sg_view_desc){
.texture.image = batcher.texture,
});
sg_apply_pipeline(batcher.pipeline);
sg_apply_uniforms(UB_render_data, SG_RANGE_REF(batcher.render_data));
sg_apply_bindings(&(sg_bindings){
.vertex_buffers[0] = batcher.instance_buffer,
.samplers[SMP_smp] = batcher.sampler,
.views[VIEW_tex] = img_view,
});
sg_draw(0, 6, batcher.instance_count);
sg_destroy_view(img_view);
batcher.instance_count = 0;
}
void gfx_batcher_set_texture(sg_image texture) {
if (texture.id != batcher.texture.id) {
gfx_batcher_flush();
}
batcher.texture = texture;
}
void gfx_batcher_push(gfx_batch_t *data) {
if (batcher.instance_count >= batcher.max_instances) {
gfx_batcher_flush();
}
memmove(&batcher.batch_data[batcher.instance_count++], data, sizeof(gfx_batch_t));
}
void gfx_batcher_push_arr(gfx_batch_t *arr, uint count) {
if (count == 0) {
return;
}
uint copy_off = 0;
while (count > 0) {
if (batcher.instance_count >= batcher.max_instances) {
gfx_batcher_flush();
}
uint remaining_in_batch = batcher.max_instances - batcher.instance_count;
uint to_copy = MIN(remaining_in_batch, count);
memmove(&batcher.batch_data[batcher.instance_count], &arr[copy_off], sizeof(gfx_batch_t) * to_copy);
count -= to_copy;
copy_off += to_copy;
batcher.instance_count += to_copy;
}
}
typedef struct gfx_print_desc_t gfx_print_desc_t;
struct gfx_print_desc_t {
strview_t str;
vec2 pos;
vec4 col;
};
void gfx_batcher_puts(gfx_print_desc_t *desc) {
float atlas_1ow = 1.f / (float)batcher.font_width;
float atlas_1oh = 1.f / (float)batcher.font_height;
float char_width = 6.f;
float char_height = 13.f;
float char_scaled_width = char_width * atlas_1ow;
float char_scaled_height = char_height * atlas_1oh;
gfx_batcher_set_texture(batcher.font);
vec2 pos = desc->pos;
strview_t s = desc->str;
for (usize i = 0; i < s.len; ++i, pos.x += char_width) {
char c = s.buf[i];
int index = c - ' ';
if (index == 0) {
continue;
}
int cx = index % 16;
int cy = index / 16;
vec4 tex_quad = v4(
(float)cx * char_scaled_width,
(float)cy * char_scaled_height,
char_scaled_width,
char_scaled_height
);
gfx_batcher_push(&(gfx_batch_t){
.tex_quad = tex_quad,
.colour = desc->col,
.quad = v4(pos.x, pos.y, char_width, char_height),
});
}
}

37
src/gfx.h Normal file
View file

@ -0,0 +1,37 @@
#pragma once
#include "colla/colla.h"
#include "libs/handmademath.h"
#include "libs/sokol_gfx.h"
#define GFX_WHITE (float4){ 1, 1, 1, 1 }
#define GFX_BLACK (vec4){ 0, 0, 0, 1 }
#define GFX_RED (vec4){ 1, 0, 0, 1 }
#define GFX_GREEN (vec4){ 0, 1, 0, 1 }
#define GFX_BLUE (vec4){ 0, 0, 1, 1 }
// batcher stuff ////////////////////////////////////
typedef struct gfx_batch_t gfx_batch_t;
struct gfx_batch_t {
vec4 quad;
vec4 tex_quad;
vec4 colour;
};
typedef struct gfx_batcher_t gfx_batcher_t;
extern gfx_batcher_t batcher;
bool gfx_init_batcher(arena_t *arena, uint max_instances);
void gfx_batcher_cleanup(void);
void gfx_batcher_present(void);
void gfx_batcher_flush(void);
void gfx_batcher_set_zoom(float zoom);
void gfx_batcher_set_texture(sg_image texture);
void gfx_batcher_push(gfx_batch_t *data);
void gfx_batcher_push_arr(gfx_batch_t *arr, uint count);
/////////////////////////////////////////////////////

File diff suppressed because it is too large Load diff

View file

@ -14,25 +14,26 @@
#include "libs/sokol_glue.h" #include "libs/sokol_glue.h"
#include "libs/handmademath.h" #include "libs/handmademath.h"
#include "vecmath.h"
#include "gen/obj.h" #include "gen/obj.h"
#include "utils.c" #include "utils.c"
#include "gfx.c"
#include "obj.c" #include "obj.c"
#include "camera.c" #include "camera.c"
#include "game.c"
#include "player.c"
//////////////////////////////// ////////////////////////////////
arena_t frame_arena = {0};
sg_pipeline pip = {0}; sg_pipeline pip = {0};
// sg_bindings binds = {0}; // sg_bindings binds = {0};
sg_pass_action pass_action = {0}; sg_pass_action pass_action = {0};
scene_t scene = {0}; scene_t scene = {0};
camera_t camera = {0}; // camera_t camera = {0};
u64 time_last = 0; u64 time_last = 0;
// gfx_batcher_t *batch = NULL;
vs_params_t vs_params = {0}; obj_vs_params_t vs_params = {0};
//////////////////////////////// ////////////////////////////////
@ -71,13 +72,15 @@ void app_init(void) {
colla_init(COLLA_OS); colla_init(COLLA_OS);
sapp_lock_mouse(true); game_init();
frame_arena = arena_make(ARENA_VIRTUAL, GB(1)); gfx_init_batcher(&game.arena, 128);
// scene = obj_load_gltf(frame_arena, strv("data/metro.glb")); player_init();
scene = obj_load_gltf(frame_arena, strv("data/scene.glb"));
camera = cam_init(); arena_t scratch = game.arena;
scene = obj_load_gltf(scratch, strv("data/scene.glb"));
sg_shader shd = sg_make_shader(obj_shader_desc(sg_query_backend())); sg_shader shd = sg_make_shader(obj_shader_desc(sg_query_backend()));
@ -107,6 +110,8 @@ void app_init(void) {
}; };
time_last = stm_now(); time_last = stm_now();
sapp_lock_mouse(true);
} }
void app_frame(void) { void app_frame(void) {
@ -114,29 +119,47 @@ void app_frame(void) {
float dt = (float)stm_sec(dt_ticks); float dt = (float)stm_sec(dt_ticks);
utils_update(); utils_update();
cam_update(&camera, dt); game_frame(dt);
entity_t *player = &game.active_by_type[ENTITY_PLAYER][0];
camera_t *cam = &player->camera;
float aspect_ratio = sapp_widthf() / sapp_heightf(); float aspect_ratio = sapp_widthf() / sapp_heightf();
HMM_Mat4 view = cam_view(&camera); mat4 view = cam_view(cam);
HMM_Mat4 proj = cam_proj(&camera); mat4 proj = cam_proj(cam);
HMM_Mat4 model = HMM_Translate(HMM_V3(0, 0, -10)); mat4 model = HMM_Translate(v3(0, 0, -10));
// HMM_Mat4 vp = HMM_Mul(HMM_Mul(proj, view), model); vs_params.mvp = hmm_mul(proj, view);
// HMM_Mat4 vp = HMM_Mul(proj, view); vs_params.cam_pos = cam->pos;
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_begin_pass(&(sg_pass){ .action = pass_action, .swapchain = sglue_swapchain() });
{
sg_apply_pipeline(pip); sg_apply_pipeline(pip);
sg_apply_uniforms(0, SG_RANGE_REF(vs_params)); sg_apply_uniforms(0, SG_RANGE_REF(vs_params));
for (int i = 0; i < scene.object_count; ++i) { for (int i = 0; i < scene.object_count; ++i) {
sg_apply_bindings(&scene.objects[i].bindings); sg_apply_bindings(&scene.objects[i].bindings);
sg_draw(0, scene.objects[i].draw_count, 1); sg_draw(0, scene.objects[i].draw_count, 1);
} }
}
{
// SHIT ASS CODE PLEASE DON'T LOOK
static float dt_avg = 0.f;
static u32 dt_count = 0;
dt_avg += dt;
dt_count++;
float delta_avg = dt_avg / (float)dt_count;
str_t fps = str_fmt(&game.frame_arena, "dt: %.5f // fps: %.2f", delta_avg, 1.f / delta_avg);
gfx_batcher_puts(&(gfx_print_desc_t){
.str = strv(fps),
.col = v4(0.93, 0.6, 0.26, 1),
});
gfx_batcher_present();
}
sg_end_pass(); sg_end_pass();
sg_commit(); sg_commit();
} }
@ -151,9 +174,14 @@ void app_event(const sapp_event *e) {
} }
set_key_state(e->key_code, e->type == SAPP_EVENTTYPE_KEY_DOWN); set_key_state(e->key_code, e->type == SAPP_EVENTTYPE_KEY_DOWN);
break; break;
case SAPP_EVENTTYPE_MOUSE_MOVE: case SAPP_EVENTTYPE_MOUSE_MOVE:
set_mouse_pos_and_delta(e->mouse_x, e->mouse_y, e->mouse_dx, e->mouse_dy); set_mouse_pos_and_delta(e->mouse_x, e->mouse_y, e->mouse_dx, e->mouse_dy);
break; break;
case SAPP_EVENTTYPE_RESIZED:
set_win_resized();
break;
} }
} }

234
src/obj.c
View file

@ -5,7 +5,7 @@
#define CGLTF_IMPLEMENTATION #define CGLTF_IMPLEMENTATION
#include "libs/cgltf.h" #include "libs/cgltf.h"
#include "vecmath.h" #include "libs/handmademath.h"
typedef struct vertex_t vertex_t; typedef struct vertex_t vertex_t;
struct vertex_t { struct vertex_t {
@ -15,236 +15,12 @@ struct vertex_t {
vec2 lightmap; vec2 lightmap;
}; };
typedef struct material_t material_t;
struct material_t {
// texture
vec3 ambient_color;
vec3 diff_color;
/*
* (*) -> unused
* Ka: ambient color
* Kd: diffuse color
* Ks*: specular color
* Ns*: specular exponent
* d*: dissolve (opacity)
* Ni*: optical density (???)
* Ke*: emissive color
* illum*: illumination mode:
0. Color on and Ambient off
1. Color on and Ambient on
2. Highlight on
3. Reflection on and Ray trace on
4. Transparency: Glass on, Reflection: Ray trace on
5. Reflection: Fresnel on and Ray trace on
6. Transparency: Refraction on, Reflection: Fresnel off and Ray trace on
7. Transparency: Refraction on, Reflection: Fresnel on and Ray trace on
8. Reflection on and Ray trace off
9. Transparency: Glass on, Reflection: Ray trace off
10. Casts shadows onto invisible surfaces
* */
};
typedef struct obj_t obj_t; typedef struct obj_t obj_t;
struct obj_t { struct obj_t {
sg_bindings bindings; sg_bindings bindings;
u16 draw_count; u16 draw_count;
}; };
darr_define(f2_list_t, vec2);
darr_define(f3_list_t, vec3);
darr_define(i3_list_t, int3);
#define list_get(l, i) do { } while (0)
typedef struct {
f3_list_t *verts;
f3_list_t *norms;
f2_list_t *uvs;
i3_list_t *faces;
u32 vcount;
u32 ncount;
u32 tcount;
u32 fcount;
} obj_ctx_t;
#define READ_F2(arr, c) do { \
vec2 v = {0}; \
istr_skip_whitespace(in); istr_get_float(in, &v.x); \
istr_skip_whitespace(in); istr_get_float(in, &v.y); \
darr_push(arena, arr, v); \
++(c); \
} while (0)
#define READ_F3(arr, c) do { \
vec3 v = {0}; \
istr_skip_whitespace(in); istr_get_float(in, &v.x); \
istr_skip_whitespace(in); istr_get_float(in, &v.y); \
istr_skip_whitespace(in); istr_get_float(in, &v.z); \
darr_push(arena, arr, v); \
++(c); \
} while (0)
#define READ_I3(arr, c) do { \
int3 v = {0}; \
istr_skip_whitespace(in); istr_get_i32(in, &v.x); \
istr_skip_whitespace(in); istr_get_i32(in, &v.y); \
istr_skip_whitespace(in); istr_get_i32(in, &v.z); \
darr_push(arena, arr, v); \
++(c); \
} while (0)
void obj__parse_line(arena_t *arena, instream_t *in, obj_ctx_t *ctx) {
if (istr_peek(in) == '#') {
return;
}
switch (istr_peek(in)) {
// vertex stuff
case 'v':
istr_skip(in, 1);
switch (istr_get(in)) {
// vertex
case ' ':
READ_F3(ctx->verts, ctx->vcount);
break;
// normal
case 'n':
READ_F3(ctx->norms, ctx->ncount);
break;
// texture
case 't':
READ_F2(ctx->uvs, ctx->tcount);
break;
}
return;
// faces
case 'f':
READ_I3(ctx->faces, ctx->fcount);
return;
// smooth shading
case 's':
// not implemented
return;
// group
case 'g':
// not implemented
return;
// object
case 'o':
// not implemented
return;
case '#':
return;
}
strview_t word = istr_get_word(in);
if (strv_equals(word, strv("mtllib"))) {
// load mtl file
}
else if (strv_equals(word, strv("usemtl"))) {
// use material
}
}
obj_t obj_load(arena_t scratch, strview_t filename) {
obj_t out = {0};
str_t text = os_file_read_all_str(&scratch, filename);
instream_t in = istr_init(strv(text));
obj_ctx_t ctx = {0};
while (!istr_is_finished(&in)) {
instream_t line = istr_init(istr_get_line(&in));
obj__parse_line(&scratch, &line, &ctx);
}
debug("%u %u %u", ctx.vcount, ctx.ncount, ctx.tcount);
colla_assert(ctx.vcount == ctx.ncount && ctx.vcount == ctx.tcount);
// copy over vertex data
vertex_t *vertices = alloc(&scratch, vertex_t, ctx.vcount);
{
u32 i = 0;
for_each (v, ctx.verts) {
for (int k = 0; k < v->count; ++k) {
vertices[i++].pos = v->items[k];
}
}
}
{
u32 i = 0;
for_each (v, ctx.uvs) {
for (int k = 0; k < v->count; ++k) {
vertices[i++].tex = v->items[k];
}
}
}
{
u32 i = 0;
for_each (v, ctx.norms) {
for (int k = 0; k < v->count; ++k) {
vertices[i++].norm = v->items[k];
}
}
}
// copy over indices data
u32 icount = ctx.fcount * 3;
u16 *indices = alloc(&scratch, u16, icount);
{
u32 i = 0;
for_each (v, ctx.faces) {
for (int k = 0; k < v->count; ++k) {
indices[i++] = v->items[k].x - 1;
indices[i++] = v->items[k].y - 1;
indices[i++] = v->items[k].z - 1;
}
}
}
sg_buffer vertex_buffer = sg_make_buffer(&(sg_buffer_desc){
.data = {
.ptr = vertices,
.size = sizeof(vertex_t) * ctx.vcount,
},
.usage = {
.vertex_buffer = true,
.immutable = true,
},
});
sg_buffer index_buffer = sg_make_buffer(&(sg_buffer_desc){
.data = {
.ptr = indices,
.size = sizeof(u16) * ctx.fcount * 3,
},
.usage = {
.index_buffer = true,
.immutable = true,
},
});
return (obj_t){
.bindings = {
.vertex_buffers[0] = vertex_buffer,
.index_buffer = index_buffer,
// .views[0] = {0},
},
.draw_count = icount,
};
}
cgltf_result obj__cgltf_file_read_cb( cgltf_result obj__cgltf_file_read_cb(
const cgltf_memory_options *m, const cgltf_memory_options *m,
const cgltf_file_options *opt, const cgltf_file_options *opt,
@ -466,25 +242,25 @@ scene_t obj_load_gltf(arena_t scratch, strview_t filename) {
case cgltf_attribute_type_position: case cgltf_attribute_type_position:
{ {
for (usize k = 0; k < acc->count; ++k) { for (usize k = 0; k < acc->count; ++k) {
cgltf_accessor_read_float(acc, k, verts[k].pos.data, 3); cgltf_accessor_read_float(acc, k, verts[k].pos.elements, 3);
} }
break; break;
} }
case cgltf_attribute_type_normal: case cgltf_attribute_type_normal:
for (usize k = 0; k < acc->count; ++k) { for (usize k = 0; k < acc->count; ++k) {
cgltf_accessor_read_float(acc, k, verts[k].norm.data, 3); cgltf_accessor_read_float(acc, k, verts[k].norm.elements, 3);
} }
break; break;
case cgltf_attribute_type_texcoord: case cgltf_attribute_type_texcoord:
{ {
if (attr->index == 0) { if (attr->index == 0) {
for (usize k = 0; k < acc->count; ++k) { for (usize k = 0; k < acc->count; ++k) {
cgltf_accessor_read_float(acc, k, verts[k].tex.data, 2); cgltf_accessor_read_float(acc, k, verts[k].tex.elements, 2);
} }
} }
else { else {
for (usize k = 0; k < acc->count; ++k) { for (usize k = 0; k < acc->count; ++k) {
cgltf_accessor_read_float(acc, k, verts[k].lightmap.data, 2); cgltf_accessor_read_float(acc, k, verts[k].lightmap.elements, 2);
} }
} }
break; break;

24
src/player.c Normal file
View file

@ -0,0 +1,24 @@
#include "game.h"
#include "utils.h"
entity_t *player_init(void) {
entity_t *e = game_new_entity(ENTITY_PLAYER);
e->camera = cam_init();
e->camera.mov_speed = 3;
return e;
}
void player__update(entity_t *e, float dt) {
e->camera.mov_speed = is_key_down(SAPP_KEYCODE_LEFT_SHIFT) ? 5 : 3;
cam_update(&e->camera, dt);
e->camera.pos.y = 1.6;
}
void player_frame(arena_t frame_arena, entity_t *players, float dt) {
for_each (e, players) {
player__update(e, dt);
}
}

View file

@ -8,9 +8,10 @@
struct { struct {
bool keys[KEY_COUNT]; bool keys[KEY_COUNT];
bool prev_keys[KEY_COUNT]; bool prev_keys[KEY_COUNT];
HMM_Vec2 mouse_pos; vec2 mouse_pos;
HMM_Vec2 mouse_delta; vec2 mouse_delta;
int delta_frames_passed; int delta_frames_passed;
bool resized;
} utils_state = {0}; } utils_state = {0};
bool is_key_down(sapp_keycode k) { bool is_key_down(sapp_keycode k) {
@ -29,20 +30,29 @@ void set_key_state(sapp_keycode k, bool is_down) {
void utils_update(void) { void utils_update(void) {
memmove(utils_state.prev_keys, utils_state.keys, sizeof(utils_state.keys)); memmove(utils_state.prev_keys, utils_state.keys, sizeof(utils_state.keys));
if (utils_state.delta_frames_passed++ > 0) { if (utils_state.delta_frames_passed++ > 0) {
utils_state.mouse_delta = HMM_V2(0, 0); utils_state.mouse_delta = v2(0, 0);
} }
utils_state.resized = false;
} }
HMM_Vec2 mouse_pos(void) { vec2 mouse_pos(void) {
return utils_state.mouse_pos; return utils_state.mouse_pos;
} }
HMM_Vec2 mouse_delta(void) { vec2 mouse_delta(void) {
return utils_state.mouse_delta; return utils_state.mouse_delta;
} }
bool win_has_resized(void) {
return utils_state.resized;
}
void set_mouse_pos_and_delta(float x, float y, float dx, float dy) { void set_mouse_pos_and_delta(float x, float y, float dx, float dy) {
utils_state.mouse_pos = HMM_V2(x, y); utils_state.mouse_pos = v2(x, y);
utils_state.mouse_delta = HMM_V2(dx, dy); utils_state.mouse_delta = v2(dx, dy);
utils_state.delta_frames_passed = 0; utils_state.delta_frames_passed = 0;
} }
void set_win_resized(void) {
utils_state.resized = true;
}

View file

@ -8,7 +8,10 @@ bool is_key_pressed(sapp_keycode k);
void set_key_state(sapp_keycode k, bool is_down); void set_key_state(sapp_keycode k, bool is_down);
HMM_Vec2 mouse_pos(void); vec2 mouse_pos(void);
HMM_Vec2 mouse_delta(void); vec2 mouse_delta(void);
bool win_has_resized(void);
void set_mouse_pos_and_delta(float x, float y, float dx, float dy); void set_mouse_pos_and_delta(float x, float y, float dx, float dy);
void set_win_resized(void);

View file

@ -1,181 +0,0 @@
#pragma once
#include "colla/colla.h"
#include <math.h>
#include "libs/handmademath.h"
typedef union int2 {
int data[2];
struct { int x, y; };
} int2;
typedef union int3 {
int data[3];
struct { int x, y, z; };
} int3;
typedef union float2 {
HMM_Vec2 hm;
float data[2];
struct { float x, y; };
} vec2;
typedef union float3 {
HMM_Vec3 hm;
float data[3];
struct { float x, y, z; };
} vec3;
typedef union float4 {
HMM_Vec4 hm;
float data[4];
struct { float x, y, z, w; };
struct { float r, g, b, a; };
} vec4;
typedef union mat4 {
HMM_Mat4 hm;
float data[16];
struct {
float m00, m01, m02, m03;
float m10, m11, m12, m13;
float m20, m21, m22, m23;
float m30, m31, m32, m33;
};
} mat4;
#define clamp(val, vmin, vmax) \
_Generic((val), \
float: fclamp, \
float2: f2clamp, \
float3: f3clamp, \
float4: f4clamp \
)(val, vmin, vmax)
#define saturate(val) \
_Generic((val), \
float: fsaturate, \
float2: f2saturate, \
float3: f3saturate, \
float4: f4saturate \
)(val)
#define add(a, b) \
_Generic((a), \
float2: f2add, \
float3: f3add, \
float4: f4add \
)(a, b)
#define adds(v, s) \
_Generic((v), \
float2: f2adds, \
float3: f3adds, \
float4: f4adds \
)(v, s)
#define cross HMM_Cross
#define norm HMM_Norm
#define mul HMM_Mul
#define add HMM_Add
#define m4_lookat HMM_LookAt_LH
#define v3 HMM_V3
#define m4_proj HMM_Perspective_LH_ZO
#if 0
force_inline float fclamp(float val, float vmin, float vmax) {
return MIN(MAX(val, vmin), vmax);
}
force_inline float2 f2clamp(float2 val, float2 vmin, float2 vmax) {
return (float2) {
fclamp(val.x, vmin.x, vmax.x),
fclamp(val.y, vmin.y, vmax.y),
};
}
force_inline float3 f3clamp(float3 val, float3 vmin, float3 vmax) {
return (float3) {
fclamp(val.x, vmin.x, vmax.x),
fclamp(val.y, vmin.y, vmax.y),
fclamp(val.z, vmin.z, vmax.z),
};
}
force_inline float4 f4clamp(float4 val, float4 vmin, float4 vmax) {
return (float4) {
fclamp(val.x, vmin.x, vmax.x),
fclamp(val.y, vmin.y, vmax.y),
fclamp(val.z, vmin.z, vmax.z),
fclamp(val.w, vmin.w, vmax.w),
};
}
force_inline float2 f2add(float2 a, float2 b) {
return (float2) { a.x + b.x, a.y + b.y };
}
force_inline float3 f3add(float3 a, float3 b) {
return (float3) { a.x + b.x, a.y + b.y, a.z + b.z };
}
force_inline float4 f4add(float4 a, float4 b) {
return (float4) { a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w };
}
force_inline float2 f2adds(float2 v, float s) {
return (float2) { v.x + s, v.y + s };
}
force_inline float3 f3adds(float3 v, float s) {
return (float3) { v.x + s, v.y + s, v.z + s };
}
force_inline float4 f4adds(float4 v, float s) {
return (float4) { v.x + s, v.y + s, v.z + s, v.w + s };
}
force_inline float fsaturate(float v) {
return fclamp(v, 0, 1);
}
force_inline float2 f2saturate(float2 v) {
return f2clamp(v, (float2){0}, (float2){1,1});
}
force_inline float3 f3saturate(float3 v) {
return f3clamp(v, (float3){0}, (float3){1,1,1});
}
force_inline float4 f4saturate(float4 v) {
return f4clamp(v, (float4){0}, (float4){1,1,1,1});
}
force_inline float f3mag2(float3 v) {
return v.x * v.x + v.y * v.y + v.z * v.z;
}
force_inline float f3mag(float3 v) {
return sqrtf(f3mag2(v));
}
force_inline float3 f3muls(float3 v, float s) {
return (float3) {
.x = v.x * s,
.y = v.y * s,
.z = v.z * s,
};
}
force_inline float3 f3divs(float3 v, float s) {
s = 1.f / s;
return f3muls(v, s);
}
force_inline float3 f3norm(float3 v) {
float mag = f3mag(v);
if (mag == 0) return v;
return f3divs(v, mag);
}
#endif