All working on Linux now.

This commit is contained in:
dlannan 2024-10-27 18:41:43 +10:30
parent b8ec0ec5c1
commit 18cf8f2f6e
27 changed files with 162 additions and 281 deletions

Binary file not shown.

BIN
bin/linux/libhmm_dll.so Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/linux/libremotery_dll.so Executable file

Binary file not shown.

Binary file not shown.

BIN
bin/linux/libsokol_dll.so Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/linux/libstb_dll.so Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/linux/luajit Normal file → Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

17
examples/run_sample.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Running Linux..."
export LD_LIBRARY_PATH=../bin/linux/
../bin/linux/luajit ./samples/$1.lua
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "Running MaxOS..."
../bin/macos/luajit ./samples/$1.lua
elif [[ "$OSTYPE" == "win32" ]]; then
echo "Running Windows..."
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../bin/linux
../bin/win64/luajit ./samples/$1.lua
else
echo "OS Type not found."
fi

View File

@ -1,6 +1,7 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
local dirtools = require("tools.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
@ -24,7 +25,7 @@ typedef struct state {
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shc_compile").init( "sokol%-luajit", false )
local shc = require("tools.shc_compile").init( "sokol%-luajit", true )
local shader = shc.compile("./samples/cube-sapp.glsl")
-- --------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -4,13 +4,14 @@ local sokol_filename = _G.SOKOL_DLL or "sokol_dll"
local libs = ffi_sokol_app or {
OSX = { x64 = sokol_filename..".so" },
Windows = { x64 = sokol_filename..".dll" },
Linux = { x64 = sokol_filename..".so", arm = sokol_filename..".so" },
Linux = { x64 = "lib"..sokol_filename..".so", arm = "lib"..sokol_filename..".so" },
BSD = { x64 = sokol_filename..".so" },
POSIX = { x64 = sokol_filename..".so" },
Other = { x64 = sokol_filename..".so" },
}
local lib = ffi_sokol_app or libs[ ffi.os ][ ffi.arch ]
print(lib)
local sokol_app = ffi.load( lib )
ffi.cdef[[

View File

@ -2,6 +2,27 @@ local ffi = require("ffi")
local dirtools = {}
---------------------------------------------------------------------------------------
dirtools.add_default_paths = function(path)
local folders = {
["Linux"] = "linux",
["Windows"] = "win64",
["MacOSX"] = "macos",
}
local extensions = {
["Linux"] = "so",
["Windows"] = "dll",
["MacOSX"] = "so",
}
package.cpath = package.cpath..";"..path.."bin/"..folders[ffi.os].."/?."..extensions[ffi.os]
package.path = package.path..";"..path.."/ffi/sokol/?.lua"
package.path = package.path..";"..path.."/?.lua"
end
---------------------------------------------------------------------------------------
dirtools.get_app_path = function( expected_root_folder )
local base_dir = "."
@ -9,7 +30,7 @@ dirtools.get_app_path = function( expected_root_folder )
local cmdh = io.popen("cd", "r")
if(cmdh) then base_dir = cmdh:read("*a"); cmdh:close() end
else
local cmdh = io.popen("cwd", "r")
local cmdh = io.popen("pwd", "r")
if(cmdh) then base_dir = cmdh:read("*a"); cmdh:close() end
end
@ -24,8 +45,20 @@ dirtools.get_app_path = function( expected_root_folder )
else
base_dir = last_folder.."/"
end
print("Base Directory: "..base_dir)
-- print("Base Directory: "..base_dir)
return base_dir
end
return dirtools
---------------------------------------------------------------------------------------
-- By default the paths are added
dirtools.init = function( base_path )
local path = dirtools.get_app_path(base_path)
dirtools.add_default_paths(path)
end
---------------------------------------------------------------------------------------
return dirtools
---------------------------------------------------------------------------------------

0
tools/shader_compiler/linux/sokol-shdc Normal file → Executable file
View File

0
tools/shader_compiler/osx/sokol-shdc Normal file → Executable file
View File

0
tools/shader_compiler/osx_arm64/sokol-shdc Normal file → Executable file
View File

View File

@ -32,9 +32,9 @@ sh_compiler.init = function(base_path, debug_shader, tools_path)
sh_compiler.debug = debug_shader or false
exec_opts = {
["Linx"] = tools_dir.."tools/shader_compiler/linux/sokol-shdc.exe",
["Linux"] = tools_dir.."tools/shader_compiler/linux/sokol-shdc",
["Windows"] = tools_dir.."tools\\shader_compiler\\win32\\sokol-shdc.exe",
["MacOSX"] = tools_dir.."tools/shader_compiler/win32/sokol-shdc.exe",
["MacOSX"] = tools_dir.."tools/shader_compiler/win32/sokol-shdc",
}
exec = exec_opts[ffi.os]
return sh_compiler