Fixed all the examples using recent sokol updates.

This commit is contained in:
dlannan 2025-01-29 20:18:20 +10:30
parent 1950204d54
commit 28015dff3d
17 changed files with 97 additions and 2363 deletions

View File

@ -5,21 +5,18 @@
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc -i ./projects/examples/samples/cube-sapp.glsl -o F:\dev\luajit\Thunc\sokol-luajit\bin\shaderbin\shader_gen.h -l glsl410 -f sokol
sokol-shdc -i ./projects/examples/samples/triangle-sapp.glsl -o F:\dev\luajit\Thunc\sokol-luajit\bin\shaderbin\shader_gen.h -l glsl410 -f sokol
Overview:
=========
Shader program: 'cube':
Get shader desc: cube_shader_desc(sg_query_backend());
Shader program: 'triangle':
Get shader desc: triangle_shader_desc(sg_query_backend());
Vertex Shader: vs
Fragment Shader: fs
Attributes:
ATTR_cube_position => 0
ATTR_cube_color0 => 1
ATTR_triangle_position => 0
ATTR_triangle_color0 => 1
Bindings:
Uniform block 'vs_params':
C struct: vs_params_t
Bind slot: UB_vs_params => 0
*/
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader_gen.h"
@ -31,48 +28,36 @@
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
#endif
#endif
#define ATTR_cube_position (0)
#define ATTR_cube_color0 (1)
#define UB_vs_params (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
hmm_mat4 mvp;
} vs_params_t;
#pragma pack(pop)
#define ATTR_triangle_position (0)
#define ATTR_triangle_color0 (1)
/*
#version 410
uniform vec4 vs_params[4];
layout(location = 0) in vec4 position;
layout(location = 0) out vec4 color;
layout(location = 1) in vec4 color0;
void main()
{
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position;
gl_Position = position;
color = color0;
}
*/
static const uint8_t vs_source_glsl410[284] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,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,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,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,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,
0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
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
@ -97,7 +82,7 @@ static const uint8_t fs_source_glsl410[135] = {
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* cube_shader_desc(sg_backend backend) {
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;
@ -109,13 +94,7 @@ static inline const sg_shader_desc* cube_shader_desc(sg_backend backend) {
desc.fragment_func.entry = "main";
desc.attrs[0].glsl_name = "position";
desc.attrs[1].glsl_name = "color0";
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.uniform_blocks[0].size = 64;
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
desc.label = "cube_shader";
desc.label = "triangle_shader";
}
return &desc;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
sg = require("sokol_gfx")
sg = require("sokol_imgui") -- Includes gfx!!
local im = sg -- Will NOT be using imgui in applications. Sample only. Dont recommend.
local slib = require("sokol_libs") -- Warn - always after gfx!!

View File

@ -1,15 +1,9 @@
package.path = package.path..";../?.lua"
local dirtools = require("tools.vfs.dirtools")
local base_path = dirtools.get_app_path("sokol%-luajit")
package.cpath = package.cpath..";"..base_path.."bin/win64/?.dll"
package.path = package.path..";"..base_path.."ffi/sokol/?.lua"
package.path = package.path..";"..base_path.."?.lua"
package.path = package.path..";"..base_path.."lua/?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
sg = require("sokol_gfx")
sg = require("sokol_nuklear")
local nk = sg
local slib = require("sokol_libs") -- Warn - always after gfx!!
@ -88,7 +82,7 @@ end
local function setup_font(ctx)
fonts = {}
local font_path = "samples/font/"
local font_path = "projects/examples/samples/font/"
local image = nil

View File

@ -1,14 +1,9 @@
package.path = package.path..";../?.lua"
local dirtools = require("tools.vfs.dirtools")
local base_path = dirtools.get_app_path("sokol%-luajit")
package.cpath = package.cpath..";"..base_path.."bin/win64/?.dll"
package.path = package.path..";"..base_path.."ffi/sokol/?.lua"
package.path = package.path..";"..base_path.."?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
sg = require("sokol_gfx")
sg = require("sokol_nuklear")
local nk = sg
local slib = require("sokol_libs") -- Warn - always after gfx!!
@ -73,7 +68,7 @@ local function init(void)
snk[0].logger.func = slib.slog_func
nk.snk_setup(snk)
local base_path = "samples/"
local base_path = "projects/examples/samples/"
pix["baboon"] = icon_load(base_path.."images/baboon.png")
pix["copy"] = icon_load(base_path.."icon/copy.png")
pix["del"] = icon_load(base_path.."icon/delete.png")

View File

@ -1,8 +1,9 @@
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
sg = require("sokol_gfx")
sg = require("sokol_nuklear")
local nk = sg
local slib = require("sokol_libs") -- Warn - always after gfx!!

View File

@ -5,7 +5,7 @@
// shared code for all shaders
@block uniforms
uniform vs_params {
layout(binding=0) uniform vs_params {
mat4 mvp;
};
@end
@ -53,8 +53,8 @@ void main() {
@end
@fs fs_default
uniform texture2D tex;
uniform sampler smp;
layout(binding=0) uniform texture2D tex;
layout(binding=0) uniform sampler smp;
in vec4 nrm;
in vec2 uv;
@ -69,4 +69,3 @@ void main() {
@end
@program default vs_default fs_default

View File

@ -1,10 +1,9 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
local sg = require("sokol_gfx")
sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
local sshape = require("sokol_shape")
@ -14,12 +13,12 @@ local hutils = require("hmm_utils")
local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
-- Need to use default because this is whats used for first unnamed program
local default = shc.compile("./samples/offscreen-sapp.glsl", "default")
local offscreen = shc.compile("./samples/offscreen-sapp.glsl", "offscreen")
local default = shc.compile("./projects/examples/samples/offscreen-sapp.glsl", "default")
local offscreen = shc.compile("./projects/examples/samples/offscreen-sapp.glsl", "offscreen")
-- --------------------------------------------------------------------------------------
@ -184,8 +183,8 @@ local function init()
-- // resource bindings to render a textured shape, using the offscreen render target as texture
display_bind[0].vertex_buffers[0] = vbuf
display_bind[0].index_buffer = ibuf
display_bind[0].fs.images[0] = color_img
display_bind[0].fs.samplers[0] = smp
display_bind[0].images[0] = color_img
display_bind[0].samplers[0] = smp
state[0].display.bind = display_bind
end
@ -224,7 +223,7 @@ local function frame()
sg.sg_begin_pass(state[0].offscreen.pass)
sg.sg_apply_pipeline(state[0].offscreen.pip)
sg.sg_apply_bindings(state[0].offscreen.bind)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, vs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, vs_range)
sg.sg_draw(state[0].donut.base_element, state[0].donut.num_elements, 1)
sg.sg_end_pass()
@ -245,7 +244,7 @@ local function frame()
sg.sg_apply_pipeline(state[0].display.pip)
sg.sg_apply_bindings(state[0].display.bind)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, def_vs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, def_vs_range)
sg.sg_draw(state[0].sphere.base_element, state[0].sphere.num_elements, 1)
sg.sg_end_pass()

View File

@ -1,10 +1,9 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
local sg = require("sokol_gfx")
sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
local hmm = require("hmm")
local hutils = require("hmm_utils")
@ -28,7 +27,7 @@ local rmt_ctx = nil
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./samples/cube-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/cube-sapp.glsl")
-- --------------------------------------------------------------------------------------
@ -172,7 +171,7 @@ local function frame()
vs_params[0].mvp = mvp
sg_range[0].ptr = vs_params
sg_range[0].size = ffi.sizeof(vs_params[0])
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, sg_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, sg_range)
sg.sg_draw(0, 36, 1)
sg.sg_end_pass()

View File

@ -6,7 +6,7 @@
//--- vertex shader
@vs vs
uniform vs_params {
layout(binding=0) uniform vs_params {
float aspect;
float time;
};

View File

@ -1,10 +1,9 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("sokol_app")
local sg = require("sokol_gfx")
sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
local hmm = require("hmm")
local hutils = require("hmm_utils")
@ -14,7 +13,7 @@ local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", true )
local shader = shc.compile("./samples/sdf-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/sdf-sapp.glsl")
-- --------------------------------------------------------------------------------------
@ -90,7 +89,7 @@ local function frame()
vs_params_range[0].ptr = state[0].vs_params
vs_params_range[0].size = ffi.sizeof(state[0].vs_params[0])
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, vs_params_range);
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, vs_params_range);
sg.sg_draw(0, 3, 1)
sg.sg_end_pass()

View File

@ -43,7 +43,7 @@ float sample_shadow_pcf(texture2D tex, sampler smp, vec3 uv_depth, vec2 sm_size)
//=== shadow pass
@vs vs_shadow
uniform vs_shadow_params {
layout(binding=0) uniform vs_shadow_params {
mat4 mvp;
};
@ -73,7 +73,7 @@ void main() {
//=== display pass
@vs vs_display
uniform vs_display_params {
layout(binding=0) uniform vs_display_params {
mat4 mvp;
mat4 model;
mat4 light_mvp;
@ -102,13 +102,13 @@ void main() {
@fs fs_display
@include_block util
uniform fs_display_params {
layout(binding=1) uniform fs_display_params {
vec3 light_dir;
vec3 eye_pos;
};
uniform texture2D shadow_map;
uniform sampler shadow_sampler;
layout(binding=0) uniform texture2D shadow_map;
layout(binding=0) uniform sampler shadow_sampler;
in vec3 color;
in vec4 light_proj_pos;
@ -167,8 +167,8 @@ void main() {
@fs fs_dbg
@include_block util
uniform texture2D dbg_tex;
uniform sampler dbg_smp;
layout(binding=0) uniform texture2D dbg_tex;
layout(binding=0) uniform sampler dbg_smp;
in vec2 uv;
out vec4 frag_color;

View File

@ -3,7 +3,7 @@ local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
--_G.SOKOL_DLL = "sokol_debug_dll"
local sapp = require("ffi.sokol.sokol_app")
local sg = require("ffi.sokol.sokol_gfx")
sg = require("ffi.sokol.sokol_gfx")
local slib = require("ffi.sokol.sokol_libs") -- Warn - always after gfx!!
local hmm = require("ffi.sokol.hmm")
@ -18,9 +18,9 @@ local ffi = require("ffi")
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
-- Need to use default because this is whats used for first unnamed program
local shadow_shader = shc.compile("./samples/shadows-sapp.glsl", "shadow")
local display_shader = shc.compile("./samples/shadows-sapp.glsl", "display")
local dbg_shader = shc.compile("./samples/shadows-sapp.glsl", "dbg")
local shadow_shader = shc.compile("./projects/examples/samples/shadows-sapp.glsl", "shadow")
local display_shader = shc.compile("./projects/examples/samples/shadows-sapp.glsl", "display")
local dbg_shader = shc.compile("./projects/examples/samples/shadows-sapp.glsl", "dbg")
-- --------------------------------------------------------------------------------------
@ -200,8 +200,8 @@ local function init()
display_bind = ffi.new("sg_bindings[1]")
display_bind[0].vertex_buffers[0] = vbuf
display_bind[0].index_buffer = ibuf
display_bind[0].fs.images[0] = state[0].shadow_map
display_bind[0].fs.samplers[0] = state[0].shadow_sampler
display_bind[0].images[0] = state[0].shadow_map
display_bind[0].samplers[0] = state[0].shadow_sampler
state[0].display.bind = display_bind
local dbg_vertices = ffi.new("float[8]", { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0 })
@ -228,8 +228,8 @@ local function init()
dbg_bind = ffi.new("sg_bindings[1]")
dbg_bind[0].vertex_buffers[0] = dbg_vbuf
dbg_bind[0].fs.images[0] = state[0].shadow_map
dbg_bind[0].fs.samplers[0] = dbg_sampler
dbg_bind[0].images[0] = state[0].shadow_map
dbg_bind[0].samplers[0] = dbg_sampler
state[0].dbg.bind = dbg_bind
end
@ -307,7 +307,7 @@ local function frame()
sg.sg_apply_pipeline(state[0].shadow.pip)
sg.sg_apply_bindings(state[0].shadow.bind)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, def_vs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, def_vs_range)
sg.sg_draw(0, 36, 1)
sg.sg_end_pass()
@ -327,11 +327,11 @@ local function frame()
sg.sg_apply_pipeline(state[0].display.pip)
sg.sg_apply_bindings(state[0].display.bind)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_FS, 0, disp_fs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, plane_vs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_FS, disp_fs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, plane_vs_range)
sg.sg_draw(36, 6, 1)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, cube_vs_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, cube_vs_range)
sg.sg_draw(0, 36, 1)
sg.sg_apply_pipeline(state[0].dbg.pip)

View File

@ -1,7 +1,7 @@
@ctype mat4 hmm_mat4
@vs vs
uniform vs_params {
layout(binding=0) uniform vs_params {
mat4 mvp;
float draw_mode;
};

View File

@ -1,9 +1,8 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
local sapp = require("sokol_app")
local sg = require("sokol_gfx")
sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
local sshape = require("sokol_shape")
@ -14,7 +13,7 @@ local ffi = require("ffi")
-- --------------------------------------------------------------------------------------
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./samples/shapes-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/shapes-sapp.glsl")
-- --------------------------------------------------------------------------------------
@ -201,7 +200,7 @@ local function frame()
sg_range[0].ptr = vs_params
sg_range[0].size = ffi.sizeof(vs_params)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, 0, sg_range)
sg.sg_apply_uniforms(sg.SG_SHADERSTAGE_VS, sg_range)
sg.sg_draw(state[0].shapes[i].draw.base_element, state[0].shapes[i].draw.num_elements, 1)
end
sg.sg_end_pass();

View File

@ -1,10 +1,9 @@
package.cpath = package.cpath..";../bin/win64/?.dll"
package.path = package.path..";../ffi/sokol/?.lua"
package.path = package.path..";../?.lua"
package.path = package.path..";../../?.lua"
local dirtools = require("tools.vfs.dirtools").init("sokol%-luajit")
local sapp = require("sokol_app")
local sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
local sapp = require("sokol_app")
sg = require("sokol_gfx")
local slib = require("sokol_libs") -- Warn - always after gfx!!
local ffi = require("ffi")
@ -62,7 +61,7 @@ typedef struct state {
-- --------------------------------------------------------------------------------------
-- The nice way to take a glsl shader and load, compile and return a shader description
local shc = require("tools.shader_compiler.shc_compile").init( "sokol%-luajit", false )
local shader = shc.compile("./samples/triangle-sapp.glsl")
local shader = shc.compile("./projects/examples/samples/triangle-sapp.glsl")
-- --------------------------------------------------------------------------------------