From c230cee31cfa057cc018be70e02fc6427f737f52 Mon Sep 17 00:00:00 2001 From: Nico Gallinal Date: Mon, 7 Apr 2025 11:53:39 -0300 Subject: [PATCH 1/6] first pass --- .gitignore | 1 + .zigversion | 2 +- 3rdparty/cimgui/build.zig | 2 +- 3rdparty/cimgui/build.zig.zon | 12 +- 3rdparty/system-sdk/build.zig.zon | 2 +- 3rdparty/zaudio/build.zig | 4 +- 3rdparty/zmesh/build.zig | 7 +- 3rdparty/zmesh/src/zcgltf.zig | 2 +- assets/shaders/basic-lighting.glsl | 10 +- assets/shaders/default-mesh.glsl | 8 +- assets/shaders/default.glsl | 8 +- assets/shaders/emissive.glsl | 10 +- assets/shaders/skinned-basic-lighting.glsl | 10 +- assets/shaders/skinned.glsl | 10 +- build.zig | 41 +- build.zig.zon | 28 +- src/examples/forest.zig | 2 +- src/examples/imgui.zig | 2 +- src/framework/debug.zig | 4 +- .../graphics/shaders/basic-lighting.glsl.zig | 1252 ++++++++-------- .../graphics/shaders/default-mesh.glsl.zig | 708 ++++----- .../graphics/shaders/default.glsl.zig | 670 +++++---- .../graphics/shaders/emissive.glsl.zig | 882 +++++------ .../shaders/skinned-basic-lighting.glsl.zig | 1316 +++++++++-------- .../graphics/shaders/skinned.glsl.zig | 950 ++++++------ src/framework/graphics/skinned-mesh.zig | 7 +- .../platform/backends/sokol/graphics.zig | 59 +- src/framework/platform/graphics.zig | 10 +- src/framework/scripting/lua.zig | 18 +- src/framework/scripting/manager.zig | 36 +- src/framework/spatial/orientedboundingbox.zig | 46 +- src/framework/spatial/rays.zig | 8 +- src/framework/utils/quakemap.zig | 2 +- tools/run-shdc.sh | 3 + 34 files changed, 3227 insertions(+), 2905 deletions(-) create mode 100755 tools/run-shdc.sh diff --git a/.gitignore b/.gitignore index 303944fc..009aaa1c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ zig-cache .zig-cache zig-out .DS_Store +tools/sokol-shdc \ No newline at end of file diff --git a/.zigversion b/.zigversion index 54d1a4f2..a803cc22 100644 --- a/.zigversion +++ b/.zigversion @@ -1 +1 @@ -0.13.0 +0.14.0 diff --git a/3rdparty/cimgui/build.zig b/3rdparty/cimgui/build.zig index 76574c8c..c7c8f39d 100644 --- a/3rdparty/cimgui/build.zig +++ b/3rdparty/cimgui/build.zig @@ -48,7 +48,7 @@ pub fn build(b: *std.Build) void { const cimgui_h = dep_cimgui.path("cimgui.h"); const translateC = b.addTranslateC(.{ .root_source_file = cimgui_h, - .target = b.host, + .target = b.graph.host, .optimize = optimize, }); translateC.defineCMacroRaw("CIMGUI_DEFINE_ENUMS_AND_STRUCTS=\"\""); diff --git a/3rdparty/cimgui/build.zig.zon b/3rdparty/cimgui/build.zig.zon index 0e6b930e..aa9450d5 100644 --- a/3rdparty/cimgui/build.zig.zon +++ b/3rdparty/cimgui/build.zig.zon @@ -4,13 +4,13 @@ .dependencies = .{ .cimgui = .{ - .url = "git+https://github.com/cimgui/cimgui.git#1.90.7", - .hash = "1220d925a8374fbc3a21a5b46025fb867672d85b4099d2151bed607618e08b0cd71c", - }, - .imgui = .{ - .url = "git+https://github.com/ocornut/imgui.git#v1.90.7", - .hash = "122072b125179c7cbdbbee8fa81d22a1050a950ad61cfeefee8dc0dca5423b5d05b9", + .url = "git+https://github.com/floooh/dcimgui.git#3969c14f7c7abda0e4b59d2616b17b7fb9eb0827", + .hash = "cimgui-0.1.0-44ClkTt5hgBU8BelH8W_G8mso3ys_hrqNUWwJvaxXDs5", }, + // .imgui = .{ + // .url = "git+https://github.com/ocornut/imgui.git#v1.90.7", + // .hash = "122072b125179c7cbdbbee8fa81d22a1050a950ad61cfeefee8dc0dca5423b5d05b9", + // }, }, .paths = .{ "", diff --git a/3rdparty/system-sdk/build.zig.zon b/3rdparty/system-sdk/build.zig.zon index 0cc5dc22..72983beb 100644 --- a/3rdparty/system-sdk/build.zig.zon +++ b/3rdparty/system-sdk/build.zig.zon @@ -1,5 +1,5 @@ .{ - .name = "system-sdk", + .name = .system_sdk, .version = "0.1.0", .paths = .{ "build.zig", diff --git a/3rdparty/zaudio/build.zig b/3rdparty/zaudio/build.zig index 76f484cb..d4b49a83 100644 --- a/3rdparty/zaudio/build.zig +++ b/3rdparty/zaudio/build.zig @@ -37,7 +37,7 @@ pub fn build(b: *std.Build) void { miniaudio.addCSourceFile(.{ .file = b.path("src/zaudio.c"), - .flags = &.{if (target.result.isWasm()) "-std=gnu99" else "-std=c99"}, // DELVE FRAMEWORK EDIT: Need gnu99 for web audio + .flags = &.{if (target.result.cpu.arch.isWasm()) "-std=gnu99" else "-std=c99"}, // DELVE FRAMEWORK EDIT: Need gnu99 for web audio }); miniaudio.addCSourceFile(.{ .file = b.path("libs/miniaudio/miniaudio.c"), @@ -48,7 +48,7 @@ pub fn build(b: *std.Build) void { "-DMA_NO_JACK", "-DMA_NO_DSOUND", "-DMA_NO_WINMM", - if (target.result.isWasm()) "-std=gnu99" else "-std=c99", // DELVE FRAMEWORK EDIT: Need gnu99 for web audio + if (target.result.cpu.arch.isWasm()) "-std=gnu99" else "-std=c99", // DELVE FRAMEWORK EDIT: Need gnu99 for web audio "-fno-sanitize=undefined", if (target.result.os.tag == .macos) "-DMA_NO_RUNTIME_LINKING" else "", }, diff --git a/3rdparty/zmesh/build.zig b/3rdparty/zmesh/build.zig index d6d8c481..e4444c8e 100644 --- a/3rdparty/zmesh/build.zig +++ b/3rdparty/zmesh/build.zig @@ -32,6 +32,7 @@ pub fn build(b: *std.Build) void { }); const zmesh_lib = if (options.shared) blk: { + // TODO addLibrary const lib = b.addSharedLibrary(.{ .name = "zmesh", .target = target, @@ -39,9 +40,9 @@ pub fn build(b: *std.Build) void { }); if (target.result.os.tag == .windows) { - lib.defineCMacro("CGLTF_API", "__declspec(dllexport)"); - lib.defineCMacro("MESHOPTIMIZER_API", "__declspec(dllexport)"); - lib.defineCMacro("ZMESH_API", "__declspec(dllexport)"); + lib.root_module.addCMacro("CGLTF_API", "__declspec(dllexport)"); + lib.root_module.addCMacro("MESHOPTIMIZER_API", "__declspec(dllexport)"); + lib.root_module.addCMacro("ZMESH_API", "__declspec(dllexport)"); } break :blk lib; diff --git a/3rdparty/zmesh/src/zcgltf.zig b/3rdparty/zmesh/src/zcgltf.zig index d4ddc009..40eb24b9 100644 --- a/3rdparty/zmesh/src/zcgltf.zig +++ b/3rdparty/zmesh/src/zcgltf.zig @@ -211,7 +211,7 @@ pub const BufferView = extern struct { size: usize, stride: usize, // 0 == automatically determined by accessor view_type: BufferViewType, - data: ?*anyopaque, // overrides buffer.data if present, filled by extensions + override_data: ?*anyopaque, // overrides buffer.data if present, filled by extensions has_meshopt_compression: Bool32, meshopt_compression: MeshoptCompression, extras: Extras, diff --git a/assets/shaders/basic-lighting.glsl b/assets/shaders/basic-lighting.glsl index 0c35e9f5..9a789cb2 100644 --- a/assets/shaders/basic-lighting.glsl +++ b/assets/shaders/basic-lighting.glsl @@ -8,7 +8,7 @@ #pragma sokol @ctype mat4 m.Mat4 #pragma sokol @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 u_projViewMatrix; mat4 u_modelMatrix; vec4 u_color; @@ -40,11 +40,11 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -uniform texture2D tex; -uniform texture2D tex_emissive; -uniform sampler smp; +layout(binding=1) uniform texture2D tex; +layout(binding=2) uniform texture2D tex_emissive; +layout(binding=1) uniform sampler smp; -uniform fs_params { +layout(binding=1) uniform fs_params { vec4 u_cameraPos; vec4 u_color_override; float u_alpha_cutoff; diff --git a/assets/shaders/default-mesh.glsl b/assets/shaders/default-mesh.glsl index 644c1eb7..2ce2248b 100644 --- a/assets/shaders/default-mesh.glsl +++ b/assets/shaders/default-mesh.glsl @@ -8,7 +8,7 @@ #pragma sokol @ctype mat4 m.Mat4 #pragma sokol @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 u_projViewMatrix; mat4 u_modelMatrix; vec4 u_color; @@ -32,9 +32,9 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -uniform texture2D tex; -uniform sampler smp; -uniform fs_params { +layout(binding=1) uniform texture2D tex; +layout(binding=1) uniform sampler smp; +layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; }; diff --git a/assets/shaders/default.glsl b/assets/shaders/default.glsl index 18565c80..eea9e78a 100644 --- a/assets/shaders/default.glsl +++ b/assets/shaders/default.glsl @@ -8,7 +8,7 @@ #pragma sokol @ctype mat4 m.Mat4 #pragma sokol @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 u_projViewMatrix; mat4 u_modelMatrix; vec4 u_color; @@ -30,9 +30,9 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -uniform texture2D tex; -uniform sampler smp; -uniform fs_params { +layout(binding=1) uniform texture2D tex; +layout(binding=1) uniform sampler smp; +layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; }; diff --git a/assets/shaders/emissive.glsl b/assets/shaders/emissive.glsl index 9701eba4..a3ac80b8 100644 --- a/assets/shaders/emissive.glsl +++ b/assets/shaders/emissive.glsl @@ -8,7 +8,7 @@ #pragma sokol @ctype mat4 m.Mat4 #pragma sokol @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 u_projViewMatrix; mat4 u_modelMatrix; vec4 u_color; @@ -38,10 +38,10 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -uniform texture2D tex; -uniform texture2D tex_emissive; -uniform sampler smp; -uniform fs_params { +layout(binding=1) uniform texture2D tex; +layout(binding=2) uniform texture2D tex_emissive; +layout(binding=1) uniform sampler smp; +layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; }; diff --git a/assets/shaders/skinned-basic-lighting.glsl b/assets/shaders/skinned-basic-lighting.glsl index 6569da8b..1481df3f 100644 --- a/assets/shaders/skinned-basic-lighting.glsl +++ b/assets/shaders/skinned-basic-lighting.glsl @@ -8,7 +8,7 @@ #pragma sokol @ctype mat4 m.Mat4 #pragma sokol @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 u_projViewMatrix; mat4 u_modelMatrix; vec4 u_color; @@ -52,10 +52,10 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -uniform texture2D tex; -uniform texture2D tex_emissive; -uniform sampler smp; -uniform fs_params { +layout(binding=1) uniform texture2D tex; +layout(binding=2) uniform texture2D tex_emissive; +layout(binding=1) uniform sampler smp; +layout(binding=1) uniform fs_params { vec4 u_cameraPos; vec4 u_color_override; float u_alpha_cutoff; diff --git a/assets/shaders/skinned.glsl b/assets/shaders/skinned.glsl index 91d8e4f7..aea12039 100644 --- a/assets/shaders/skinned.glsl +++ b/assets/shaders/skinned.glsl @@ -8,7 +8,7 @@ #pragma sokol @ctype mat4 m.Mat4 #pragma sokol @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 u_projViewMatrix; mat4 u_modelMatrix; vec4 u_color; @@ -59,10 +59,10 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -uniform texture2D tex; -uniform texture2D tex_emissive; -uniform sampler smp; -uniform fs_params { +layout(binding=1) uniform texture2D tex; +layout(binding=2) uniform texture2D tex_emissive; +layout(binding=1) uniform sampler smp; +layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; }; diff --git a/build.zig b/build.zig index 6e1264c8..7e529d70 100644 --- a/build.zig +++ b/build.zig @@ -1,7 +1,7 @@ const std = @import("std"); const Build = std.Build; const builtin = @import("builtin"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const sokol = @import("sokol"); const system_sdk = @import("system-sdk"); const fs = std.fs; @@ -29,11 +29,11 @@ pub fn build(b: *std.Build) !void { .with_sokol_imgui = true, }); - const dep_ziglua = b.dependency("ziglua", .{ + const dep_zlua = b.dependency("zlua", .{ .target = target, .optimize = optimize, .lang = .lua54, - .can_use_jmp = !target.result.isWasm(), + // .can_use_jmp = !target.result.cpu.arch.isWasm(), }); const dep_zmesh = b.dependency("zmesh", .{ @@ -67,26 +67,25 @@ pub fn build(b: *std.Build) !void { }); // inject the cimgui header search path into the sokol C library compile step - const cimgui_root = dep_cimgui.namedWriteFiles("cimgui").getDirectory(); - dep_sokol.artifact("sokol_clib").addIncludePath(cimgui_root); + dep_sokol.artifact("sokol_clib").addIncludePath(dep_cimgui.path("src")); dep_stb_truetype.artifact("stb_truetype").addIncludePath(b.path("3rdparty/stb_truetype/libs")); - const sokol_item = .{ .module = dep_sokol.module("sokol"), .name = "sokol" }; - const ziglua_item = .{ .module = dep_ziglua.module("ziglua"), .name = "ziglua" }; - const zmesh_item = .{ .module = dep_zmesh.module("root"), .name = "zmesh" }; - const zstbi_item = .{ .module = dep_zstbi.module("root"), .name = "zstbi" }; - const zaudio_item = .{ .module = dep_zaudio.module("root"), .name = "zaudio" }; - const cimgui_item = .{ .module = dep_cimgui.module("cimgui"), .name = "cimgui" }; - const stb_truetype_item = .{ .module = dep_stb_truetype.module("root"), .name = "stb_truetype" }; - const ymlz_item = .{ .module = dep_yamlz.module("root"), .name = "ymlz" }; + const sokol_item: ModuleImport = .{ .module = dep_sokol.module("sokol"), .name = "sokol" }; + const zlua_item: ModuleImport = .{ .module = dep_zlua.module("zlua"), .name = "zlua" }; + const zmesh_item: ModuleImport = .{ .module = dep_zmesh.module("root"), .name = "zmesh" }; + const zstbi_item: ModuleImport = .{ .module = dep_zstbi.module("root"), .name = "zstbi" }; + const zaudio_item: ModuleImport = .{ .module = dep_zaudio.module("root"), .name = "zaudio" }; + const cimgui_item: ModuleImport = .{ .module = dep_cimgui.module("cimgui"), .name = "cimgui" }; + const stb_truetype_item: ModuleImport = .{ .module = dep_stb_truetype.module("root"), .name = "stb_truetype" }; + const ymlz_item: ModuleImport = .{ .module = dep_yamlz.module("root"), .name = "ymlz" }; const delve_module_imports = [_]ModuleImport{ sokol_item, zmesh_item, zstbi_item, zaudio_item, - ziglua_item, + zlua_item, cimgui_item, stb_truetype_item, ymlz_item, @@ -96,7 +95,7 @@ pub fn build(b: *std.Build) !void { dep_zmesh.artifact("zmesh"), dep_zstbi.artifact("zstbi"), dep_zaudio.artifact("miniaudio"), - dep_ziglua.artifact("lua"), + dep_zlua.artifact("lua"), dep_cimgui.artifact("cimgui_clib"), dep_stb_truetype.artifact("stb_truetype"), }; @@ -121,7 +120,7 @@ pub fn build(b: *std.Build) !void { } for (build_collection.link_libraries) |lib| { - if (target.result.isWasm()) { + if (target.result.cpu.arch.isWasm()) { // ensure these libs all depend on the emcc C lib lib.step.dependOn(&dep_sokol.artifact("sokol_clib").step); } @@ -130,7 +129,7 @@ pub fn build(b: *std.Build) !void { } // For web builds, add the Emscripten system headers so C libraries can find the stdlib headers - if (target.result.isWasm()) { + if (target.result.cpu.arch.isWasm()) { const emsdk_include_path = getEmsdkSystemIncludePath(dep_sokol); delve_mod.addSystemIncludePath(emsdk_include_path); @@ -205,7 +204,7 @@ fn buildExample(b: *std.Build, example: []const u8, delve_module: *Build.Module, var app: *Build.Step.Compile = undefined; // special case handling for native vs web build - if (target.result.isWasm()) { + if (target.result.cpu.arch.isWasm()) { app = b.addStaticLibrary(.{ .target = target, .optimize = optimize, @@ -224,7 +223,7 @@ fn buildExample(b: *std.Build, example: []const u8, delve_module: *Build.Module, app.root_module.addImport("delve", delve_module); app.linkLibrary(delve_lib); - if (target.result.isWasm()) { + if (target.result.cpu.arch.isWasm()) { const dep_sokol = b.dependency("sokol", .{ .target = target, .optimize = optimize, @@ -256,7 +255,7 @@ fn buildExample(b: *std.Build, example: []const u8, delve_module: *Build.Module, } pub fn emscriptenLinkStep(b: *Build, app: *Build.Step.Compile, dep_sokol: *Build.Dependency) !*Build.Step.InstallDir { - app.defineCMacro("__EMSCRIPTEN__", "1"); + app.root_module.addCMacro("__EMSCRIPTEN__", "1"); const emsdk = dep_sokol.builder.dependency("emsdk", .{}); @@ -273,7 +272,7 @@ pub fn emscriptenLinkStep(b: *Build, app: *Build.Step.Compile, dep_sokol: *Build .release_use_closure = false, // causing errors with miniaudio? might need to add a custom exerns file for closure .use_emmalloc = true, .use_filesystem = true, - .shell_file_path = dep_sokol.path("src/sokol/web/shell.html").getPath(b), + .shell_file_path = dep_sokol.path("src/sokol/web/shell.html"), .extra_args = &.{ "-sUSE_OFFSET_CONVERTER=1", "-sTOTAL_STACK=16MB", diff --git a/build.zig.zon b/build.zig.zon index b5c1b470..391bbec6 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,7 @@ .{ - .name = "delve", + .name = .delve, .version = "0.0.2", + .fingerprint = 0xa3185842c6ab2a18, .paths = .{ "src", "3rdparty", @@ -10,18 +11,18 @@ "ROADMAP.md", }, .dependencies = .{ - .ziglua = .{ - .url = "git+https://github.com/interrupt/ziglua#3d7532ec73202bddfbeba1933d43fe427ca6d80d", - .hash = "12207a933b3cca4e301c711acbdb045a50c1d90f9525ab6544e409427b9672a6821f", - }, - // needed because Lua is a lazy dependency inside of ziglua - .lua54 = .{ - .url = "https://www.lua.org/ftp/lua-5.4.6.tar.gz", - .hash = "1220f93ada1fa077ab096bf88a5b159ad421dbf6a478edec78ddb186d0c21d3476d9", - }, + .zlua = .{ + .url = "git+https://github.com/natecraddock/ziglua#891945ef9c2bffcd06050c4836d414428ed7d95a", + .hash = "zlua-0.1.0-hGRpC2rgBACFhBjc9s9dGN37ZaTu7rNVZZqduwitv4O7", + }, + // // needed because Lua is a lazy dependency inside of ziglua + // .lua54 = .{ + // .url = "https://www.lua.org/ftp/lua-5.4.6.tar.gz", + // .hash = "1220f93ada1fa077ab096bf88a5b159ad421dbf6a478edec78ddb186d0c21d3476d9", + // }, .sokol = .{ - .url = "git+https://github.com/floooh/sokol-zig.git#d3e21f76498213d6d58179065756f5f2ed9b90cf", - .hash = "122052a192829b377c637ce242ee8c9121e03d8cd10c889758dc6fb176368de7d67b", + .url = "git+https://github.com/floooh/sokol-zig.git#d8c1205a4dd9ad28da411f998102ce520cdef6bc", + .hash = "sokol-0.1.0-pb1HK5mGLABB7_Vt66xb8nbn8sJN_ULvd4v0wg8WypJ_", }, .ymlz = .{ .url = "git+https://github.com/pwbh/ymlz#bd3ce82da20844117f3da76d0cd40453936b1b66", @@ -37,7 +38,8 @@ .path = "3rdparty/zaudio", }, .cimgui = .{ - .path = "3rdparty/cimgui", + .url = "git+https://github.com/floooh/dcimgui.git#a174810b90366b56038789be55dfe803b5a255df", + .hash = "cimgui-0.1.0-44ClkS2AhgDokTzMqSuIJjYs2v802ZjjWWN1vKuMHCqq", }, .system_sdk = .{ .path = "3rdparty/system-sdk", diff --git a/src/examples/forest.zig b/src/examples/forest.zig index 0163afe2..437f9974 100644 --- a/src/examples/forest.zig +++ b/src/examples/forest.zig @@ -2,7 +2,7 @@ const std = @import("std"); const delve = @import("delve"); const app = delve.app; -const RndGen = std.rand.DefaultPrng; +const RndGen = std.Random.DefaultPrng; const batcher = delve.graphics.batcher; const debug = delve.debug; diff --git a/src/examples/imgui.zig b/src/examples/imgui.zig index 2ad59f57..143235cc 100644 --- a/src/examples/imgui.zig +++ b/src/examples/imgui.zig @@ -51,7 +51,7 @@ pub fn on_tick(delta: f32) void { delve.platform.app.startImguiFrame(); - imgui.igSetNextWindowPos(.{ .x = 40, .y = 60 }, imgui.ImGuiCond_Once, .{ .x = 0, .y = 0 }); + imgui.igSetNextWindowPos(.{ .x = 40, .y = 60 }, imgui.ImGuiCond_Once); imgui.igSetNextWindowSize(.{ .x = 400, .y = 100 }, imgui.ImGuiCond_Once); _ = imgui.igBegin("Hello Dear ImGui!", 0, imgui.ImGuiWindowFlags_None); _ = imgui.igColorEdit3("Background", &bg_color[0], imgui.ImGuiColorEditFlags_None); diff --git a/src/framework/debug.zig b/src/framework/debug.zig index 6bde8a81..a520fbcc 100644 --- a/src/framework/debug.zig +++ b/src/framework/debug.zig @@ -45,7 +45,7 @@ var stack_fallback_allocator: std.heap.StackFallbackAllocator(256) = undefined; var allocator: std.mem.Allocator = undefined; // List types -const StringLinkedList = std.TailQueue([:0]const u8); +const StringLinkedList = std.DoublyLinkedList([:0]const u8); const char_array = std.ArrayList(u8); // Lists for log history and command history @@ -627,7 +627,7 @@ pub fn showErrorScreen(error_header: [:0]const u8) void { } // Only use until the first newline - var error_desc_splits = std.mem.split(u8, error_desc, "\n"); + var error_desc_splits = std.mem.splitSequence(u8, error_desc, "\n"); const first_split = error_desc_splits.first(); // todo: show an error screen! until then, just print the error and exit diff --git a/src/framework/graphics/shaders/basic-lighting.glsl.zig b/src/framework/graphics/shaders/basic-lighting.glsl.zig index 201c0c21..d4e28c0f 100644 --- a/src/framework/graphics/shaders/basic-lighting.glsl.zig +++ b/src/framework/graphics/shaders/basic-lighting.glsl.zig @@ -13,50 +13,45 @@ const m = @import("../../math.zig"); // ========= // Shader program: 'emissive': // Get shader desc: shd.emissiveShaderDesc(sg.queryBackend()); -// Vertex shader: vs -// Attributes: -// ATTR_vs_pos => 0 -// ATTR_vs_color0 => 1 -// ATTR_vs_texcoord0 => 2 -// ATTR_vs_normals => 3 -// ATTR_vs_tangents => 4 -// Uniform block 'vs_params': -// Zig struct: VsParams -// Bind slot: SLOT_vs_params => 0 -// Fragment shader: fs -// Uniform block 'fs_params': -// Zig struct: FsParams -// Bind slot: SLOT_fs_params => 0 -// Image 'tex': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex => 0 -// Image 'tex_emissive': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex_emissive => 1 -// Sampler 'smp': -// Type: .FILTERING -// Bind slot: SLOT_smp => 0 -// Image Sampler Pair 'tex_smp': -// Image: tex -// Sampler: smp -// Image Sampler Pair 'tex_emissive_smp': -// Image: tex_emissive -// Sampler: smp -// -pub const ATTR_vs_pos = 0; -pub const ATTR_vs_color0 = 1; -pub const ATTR_vs_texcoord0 = 2; -pub const ATTR_vs_normals = 3; -pub const ATTR_vs_tangents = 4; -pub const SLOT_vs_params = 0; -pub const SLOT_fs_params = 0; -pub const SLOT_tex = 0; -pub const SLOT_tex_emissive = 1; -pub const SLOT_smp = 0; +// Vertex Shader: vs +// Fragment Shader: fs +// Attributes: +// ATTR_emissive_pos => 0 +// ATTR_emissive_color0 => 1 +// ATTR_emissive_texcoord0 => 2 +// ATTR_emissive_normals => 3 +// ATTR_emissive_tangents => 4 +// Bindings: +// Uniform block 'vs_params': +// Zig struct: VsParams +// Bind slot: UB_vs_params => 0 +// Uniform block 'fs_params': +// Zig struct: FsParams +// Bind slot: UB_fs_params => 1 +// Image 'tex': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex => 1 +// Image 'tex_emissive': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex_emissive => 2 +// Sampler 'smp': +// Type: .FILTERING +// Bind slot: SMP_smp => 1 +// +pub const ATTR_emissive_pos = 0; +pub const ATTR_emissive_color0 = 1; +pub const ATTR_emissive_texcoord0 = 2; +pub const ATTR_emissive_normals = 3; +pub const ATTR_emissive_tangents = 4; +pub const UB_vs_params = 0; +pub const UB_fs_params = 1; +pub const IMG_tex = 1; +pub const IMG_tex_emissive = 2; +pub const SMP_smp = 1; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -159,8 +154,8 @@ const vs_source_glsl430 = [782]u8 { // #version 430 // // uniform vec4 fs_params[41]; -// layout(binding = 0) uniform sampler2D tex_smp; -// layout(binding = 1) uniform sampler2D tex_emissive_smp; +// layout(binding = 16) uniform sampler2D tex_smp; +// layout(binding = 17) uniform sampler2D tex_emissive_smp; // // layout(location = 1) in vec2 uv; // layout(location = 0) in vec4 color; @@ -241,168 +236,168 @@ const vs_source_glsl430 = [782]u8 { // } // // -const fs_source_glsl430 = [2565]u8 { +const fs_source_glsl430 = [2567]u8 { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x34,0x31,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, - 0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x29,0x20,0x75,0x6e,0x69, - 0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74, - 0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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, - 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,0x34,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, - 0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61, - 0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, - 0x6f,0x6e,0x20,0x3d,0x20,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,0x33, - 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e, - 0x74,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x71,0x72,0x28,0x66,0x6c, - 0x6f,0x61,0x74,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74, - 0x75,0x72,0x6e,0x20,0x78,0x20,0x2a,0x20,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c, - 0x6f,0x61,0x74,0x20,0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69, - 0x67,0x68,0x74,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x64,0x69,0x73,0x74,0x61, - 0x6e,0x63,0x65,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x72,0x61,0x64,0x69,0x75, - 0x73,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6d,0x61,0x78,0x5f,0x69,0x6e,0x74, - 0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x66,0x61, - 0x6c,0x6c,0x6f,0x66,0x66,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x5f,0x33,0x30,0x20,0x3d,0x20,0x5f,0x64,0x69,0x73,0x74,0x61,0x6e, - 0x63,0x65,0x20,0x2f,0x20,0x72,0x61,0x64,0x69,0x75,0x73,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x30,0x20,0x3e,0x3d,0x20,0x31,0x2e,0x30,0x29, - 0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72, - 0x65,0x74,0x75,0x72,0x6e,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x20,0x3d,0x20,0x5f,0x33,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20, - 0x2d,0x20,0x73,0x71,0x72,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6d,0x61,0x78,0x5f,0x69,0x6e, - 0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x20,0x2a,0x20,0x73,0x71,0x72,0x28,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x31,0x29,0x29,0x20,0x2f,0x20,0x66,0x6d,0x61,0x28,0x66,0x61, - 0x6c,0x6c,0x6f,0x66,0x66,0x2c,0x20,0x5f,0x33,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x61,0x6c,0x63,0x46, - 0x6f,0x67,0x46,0x61,0x63,0x74,0x6f,0x72,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64, - 0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x74,0x6f,0x5f,0x65,0x79,0x65,0x29,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x63,0x6c,0x61, - 0x6d,0x70,0x28,0x28,0x28,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x74,0x6f, - 0x5f,0x65,0x79,0x65,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x33,0x39,0x5d,0x2e,0x78,0x29,0x20,0x2f,0x20,0x28,0x66,0x73,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x79,0x20,0x2d,0x20,0x66,0x73,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x78,0x29,0x29,0x20,0x2a, - 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x77, - 0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x31,0x33,0x20,0x3d,0x20,0x74,0x65, - 0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75, - 0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x31,0x33,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x31,0x33,0x2e,0x77, - 0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d, - 0x2e,0x78,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,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x20, - 0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x69,0x6e,0x74,0x28,0x66,0x73,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x3b,0x20,0x69,0x2b, - 0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x69,0x6e,0x74,0x20,0x5f,0x31,0x34,0x35,0x20,0x3d,0x20,0x69,0x20,0x2a,0x20, - 0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, - 0x5f,0x31,0x36,0x38,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x5f,0x31,0x34,0x35,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x37,0x5d,0x2e,0x78, - 0x79,0x7a,0x20,0x2d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79, - 0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28, - 0x5f,0x31,0x36,0x38,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x66, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x5f,0x31,0x34,0x35,0x20,0x2a,0x20, - 0x31,0x20,0x2b,0x20,0x37,0x5d,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20, - 0x3d,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x31, - 0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, - 0x20,0x5f,0x31,0x39,0x38,0x20,0x3d,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, - 0x5f,0x32,0x30,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38,0x2e,0x78,0x79,0x7a,0x20, - 0x2b,0x20,0x28,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x28,0x5f, - 0x31,0x34,0x35,0x20,0x2b,0x20,0x31,0x29,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x37, - 0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28, - 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x31,0x36,0x38,0x29,0x2c, - 0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20, - 0x2a,0x20,0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69,0x67,0x68, - 0x74,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65, - 0x63,0x34,0x20,0x5f,0x33,0x32,0x39,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x32,0x39,0x2e,0x78,0x20,0x3d, - 0x20,0x5f,0x32,0x30,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x5f,0x33,0x32,0x39,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x79, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x32,0x39,0x2e,0x7a, - 0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f, - 0x33,0x32,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76, - 0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x6c,0x69,0x74,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f, - 0x32,0x34,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2b, - 0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78, - 0x79,0x7a,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28,0x76,0x65, - 0x63,0x34,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e, - 0x78,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e, - 0x79,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e, - 0x7a,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x6e,0x6f, - 0x72,0x6d,0x61,0x6c,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30, - 0x29,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d, - 0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f, - 0x33,0x33,0x35,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x5f,0x33,0x33,0x35,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e,0x78,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x35,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32, - 0x34,0x31,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x35,0x2e,0x7a, - 0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c, - 0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x33,0x33,0x35,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x30,0x20,0x3d, - 0x20,0x63,0x20,0x2a,0x20,0x5f,0x33,0x33,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76, - 0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x5f, - 0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, - 0x63,0x33,0x20,0x5f,0x32,0x37,0x35,0x20,0x3d,0x20,0x28,0x5f,0x32,0x35,0x30,0x2e, - 0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x6d,0x69,0x6e, - 0x28,0x28,0x5f,0x32,0x35,0x37,0x2e,0x78,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e, - 0x79,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30, - 0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x34,0x34,0x20,0x3d,0x20, - 0x5f,0x32,0x35,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x34,0x2e,0x78, - 0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, - 0x33,0x34,0x34,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x79,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x34,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x37, - 0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32, - 0x39,0x36,0x20,0x3d,0x20,0x28,0x5f,0x33,0x34,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a, - 0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x35,0x30,0x20,0x3d,0x20, - 0x5f,0x33,0x34,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x30,0x2e,0x78, - 0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, - 0x33,0x35,0x30,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x79,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x30,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x39, - 0x36,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f,0x33,0x35, - 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x20,0x2d,0x20,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x6d,0x69, - 0x78,0x28,0x63,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33, - 0x28,0x63,0x61,0x6c,0x63,0x46,0x6f,0x67,0x46,0x61,0x63,0x74,0x6f,0x72,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, - 0x0a,0x7d,0x0a,0x0a,0x00, + 0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x37,0x29,0x20,0x75, + 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44, + 0x20,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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,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,0x34,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,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x6e,0x6f,0x72, + 0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61, + 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,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,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x61,0x6e,0x67, + 0x65,0x6e,0x74,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x71,0x72,0x28, + 0x66,0x6c,0x6f,0x61,0x74,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72, + 0x65,0x74,0x75,0x72,0x6e,0x20,0x78,0x20,0x2a,0x20,0x78,0x3b,0x0a,0x7d,0x0a,0x0a, + 0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f, + 0x6c,0x69,0x67,0x68,0x74,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x64,0x69,0x73, + 0x74,0x61,0x6e,0x63,0x65,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x72,0x61,0x64, + 0x69,0x75,0x73,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6d,0x61,0x78,0x5f,0x69, + 0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x66,0x61,0x6c,0x6c,0x6f,0x66,0x66,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x30,0x20,0x3d,0x20,0x5f,0x64,0x69,0x73,0x74, + 0x61,0x6e,0x63,0x65,0x20,0x2f,0x20,0x72,0x61,0x64,0x69,0x75,0x73,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x30,0x20,0x3e,0x3d,0x20,0x31,0x2e, + 0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x20,0x3d,0x20,0x5f,0x33,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x2e, + 0x30,0x20,0x2d,0x20,0x73,0x71,0x72,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6d,0x61,0x78,0x5f, + 0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x20,0x2a,0x20,0x73,0x71,0x72,0x28, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x29,0x20,0x2f,0x20,0x66,0x6d,0x61,0x28, + 0x66,0x61,0x6c,0x6c,0x6f,0x66,0x66,0x2c,0x20,0x5f,0x33,0x30,0x2c,0x20,0x31,0x2e, + 0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x61,0x6c, + 0x63,0x46,0x6f,0x67,0x46,0x61,0x63,0x74,0x6f,0x72,0x28,0x66,0x6c,0x6f,0x61,0x74, + 0x20,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x74,0x6f,0x5f,0x65,0x79,0x65, + 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x63, + 0x6c,0x61,0x6d,0x70,0x28,0x28,0x28,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f, + 0x74,0x6f,0x5f,0x65,0x79,0x65,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x78,0x29,0x20,0x2f,0x20,0x28,0x66,0x73,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x79,0x20,0x2d,0x20,0x66, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x78,0x29,0x29, + 0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x30,0x5d, + 0x2e,0x77,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x31,0x33,0x20,0x3d,0x20, + 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c, + 0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x31,0x33,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x33,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x31,0x33, + 0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x32,0x5d,0x2e,0x78,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,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20, + 0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x69,0x6e,0x74,0x28,0x66, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x3b,0x20, + 0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x31,0x34,0x35,0x20,0x3d,0x20,0x69,0x20, + 0x2a,0x20,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x33,0x20,0x5f,0x31,0x36,0x38,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x5b,0x5f,0x31,0x34,0x35,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x37,0x5d, + 0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e, + 0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74, + 0x68,0x28,0x5f,0x31,0x36,0x38,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d, + 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x5f,0x31,0x34,0x35,0x20, + 0x2a,0x20,0x31,0x20,0x2b,0x20,0x37,0x5d,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x32,0x20,0x3d,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d, + 0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65, + 0x63,0x34,0x20,0x5f,0x31,0x39,0x38,0x20,0x3d,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x33,0x20,0x5f,0x32,0x30,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38,0x2e,0x78,0x79, + 0x7a,0x20,0x2b,0x20,0x28,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x28,0x5f,0x31,0x34,0x35,0x20,0x2b,0x20,0x31,0x29,0x20,0x2a,0x20,0x31,0x20,0x2b, + 0x20,0x37,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x64,0x6f, + 0x74,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x31,0x36,0x38, + 0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29, + 0x29,0x20,0x2a,0x20,0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69, + 0x67,0x68,0x74,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x32,0x39,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x32,0x39,0x2e,0x78, + 0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x5f,0x33,0x32,0x39,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x30,0x30, + 0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x32,0x39, + 0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, + 0x20,0x5f,0x33,0x32,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x6c,0x69,0x74, + 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33, + 0x20,0x5f,0x32,0x34,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x2e,0x78,0x79,0x7a, + 0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d, + 0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28, + 0x76,0x65,0x63,0x34,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34, + 0x5d,0x2e,0x78,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34, + 0x5d,0x2e,0x79,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34, + 0x5d,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x34,0x28, + 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2c,0x20,0x30, + 0x2e,0x30,0x29,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, + 0x20,0x5f,0x33,0x33,0x35,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x5f,0x33,0x33,0x35,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e, + 0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x35,0x2e,0x79,0x20,0x3d,0x20, + 0x5f,0x32,0x34,0x31,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x35, + 0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x33,0x33, + 0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x30, + 0x20,0x3d,0x20,0x63,0x20,0x2a,0x20,0x5f,0x33,0x33,0x35,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76, + 0x65,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x37,0x35,0x20,0x3d,0x20,0x28,0x5f,0x32,0x35, + 0x30,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x6d, + 0x69,0x6e,0x28,0x28,0x5f,0x32,0x35,0x37,0x2e,0x78,0x20,0x2b,0x20,0x5f,0x32,0x35, + 0x37,0x2e,0x79,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x7a,0x2c,0x20,0x31, + 0x2e,0x30,0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x78,0x79,0x7a, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x34,0x34,0x20, + 0x3d,0x20,0x5f,0x32,0x35,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x34, + 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x5f,0x33,0x34,0x34,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x79, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x34,0x2e,0x7a,0x20,0x3d,0x20,0x5f, + 0x32,0x37,0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, + 0x5f,0x32,0x39,0x36,0x20,0x3d,0x20,0x28,0x5f,0x33,0x34,0x34,0x2e,0x78,0x79,0x7a, + 0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72, + 0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a, + 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x35,0x30,0x20, + 0x3d,0x20,0x5f,0x33,0x34,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x30, + 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x5f,0x33,0x35,0x30,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x79, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x30,0x2e,0x7a,0x20,0x3d,0x20,0x5f, + 0x32,0x39,0x36,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f, + 0x33,0x35,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x20,0x2d,0x20,0x70, + 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28, + 0x6d,0x69,0x78,0x28,0x63,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61, + 0x72,0x61,0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65, + 0x63,0x33,0x28,0x63,0x61,0x6c,0x63,0x46,0x6f,0x67,0x46,0x61,0x63,0x74,0x6f,0x72, + 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30, + 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; // // #version 300 es @@ -2869,11 +2864,11 @@ const vs_source_wgsl = [1975]u8 { // u_fog_color : vec4f, // } // -// @group(0) @binding(4) var x_63 : fs_params; +// @group(0) @binding(8) var x_63 : fs_params; // -// @group(1) @binding(48) var tex : texture_2d; +// @group(1) @binding(64) var tex : texture_2d; // -// @group(1) @binding(64) var smp : sampler; +// @group(1) @binding(80) var smp : sampler; // // var uv : vec2f; // @@ -2883,7 +2878,7 @@ const vs_source_wgsl = [1975]u8 { // // var normal : vec3f; // -// @group(1) @binding(49) var tex_emissive : texture_2d; +// @group(1) @binding(65) var tex_emissive : texture_2d; // // var frag_color : vec4f; // @@ -3140,14 +3135,14 @@ const fs_source_wgsl = [7647]u8 { 0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36,0x34,0x30,0x29,0x20,0x2a, 0x2f,0x0a,0x20,0x20,0x75,0x5f,0x66,0x6f,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f, - 0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34, + 0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x38, 0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78, 0x5f,0x36,0x33,0x20,0x3a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b, 0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e, - 0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78, + 0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78, 0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33, 0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x38,0x30,0x29,0x20,0x76,0x61,0x72,0x20, 0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a, 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20, 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, @@ -3157,7 +3152,7 @@ const fs_source_wgsl = [7647]u8 { 0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3a,0x20,0x76, 0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29, - 0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x39,0x29,0x20,0x76,0x61, + 0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x35,0x29,0x20,0x76,0x61, 0x72,0x20,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x20,0x3a, 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e, 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, @@ -3589,224 +3584,298 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.label = "emissive_shader"; switch (backend) { .GLCORE => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.vs.source = &vs_source_glsl430; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl430; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 41; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.vs.source = &vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 41; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.attrs[2].sem_name = "TEXCOORD"; - desc.attrs[2].sem_index = 2; - desc.attrs[3].sem_name = "TEXCOORD"; - desc.attrs[3].sem_index = 3; - desc.attrs[4].sem_name = "TEXCOORD"; - desc.attrs[4].sem_index = 4; - desc.vs.source = &vs_source_hlsl4; - desc.vs.d3d11_target = "vs_4_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_hlsl4; - desc.fs.d3d11_target = "ps_4_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_hlsl4; + desc.vertex_func.d3d11_target = "vs_4_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_hlsl4; + desc.fragment_func.d3d11_target = "ps_4_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].hlsl_sem_name = "TEXCOORD"; + desc.attrs[3].hlsl_sem_index = 3; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].hlsl_sem_name = "TEXCOORD"; + desc.attrs[4].hlsl_sem_index = 4; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].hlsl_register_t_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].hlsl_register_t_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].hlsl_register_s_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_MACOS => { - desc.vs.source = &vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_IOS => { - desc.vs.source = &vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_ios; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_ios; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_SIMULATOR => { - desc.vs.source = &vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_sim; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_sim; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .WGPU => { - desc.vs.source = &vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_wgsl; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_wgsl; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].wgsl_group0_binding_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].wgsl_group1_binding_n = 64; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].wgsl_group1_binding_n = 65; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].wgsl_group1_binding_n = 80; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, else => {}, } @@ -3830,215 +3899,194 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } return null; } -pub fn emissiveImageSlot(stage: sg.ShaderStage, img_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, img_name, "tex")) { - return 0; - } - if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 1; - } +pub fn emissiveImageSlot(img_name: []const u8) ?usize { + if (std.mem.eql(u8, img_name, "tex")) { + return 1; + } + if (std.mem.eql(u8, img_name, "tex_emissive")) { + return 2; } return null; } -pub fn emissiveSamplerSlot(stage: sg.ShaderStage, smp_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, smp_name, "smp")) { - return 0; - } +pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { + if (std.mem.eql(u8, smp_name, "smp")) { + return 1; } return null; } -pub fn emissiveUniformblockSlot(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return 0; - } +pub fn emissiveUniformblockSlot(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return 0; } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return 0; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return 1; } return null; } -pub fn emissiveUniformblockSize(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return @sizeOf(VsParams); - } +pub fn emissiveUniformblockSize(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return @sizeOf(VsParams); } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return @sizeOf(FsParams); - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return @sizeOf(FsParams); } return null; } -pub fn emissiveUniformOffset(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_color")) { - return 128; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - return 144; - } +pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_color")) { + return 128; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + return 144; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_cameraPos")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_color_override")) { - return 16; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - return 32; - } - if (std.mem.eql(u8, u_name, "u_ambient_light")) { - return 48; - } - if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_dir_light_color")) { - return 80; - } - if (std.mem.eql(u8, u_name, "u_num_point_lights")) { - return 96; - } - if (std.mem.eql(u8, u_name, "u_point_light_data")) { - return 112; - } - if (std.mem.eql(u8, u_name, "u_fog_data")) { - return 624; - } - if (std.mem.eql(u8, u_name, "u_fog_color")) { - return 640; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_cameraPos")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_color_override")) { + return 16; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + return 32; + } + if (std.mem.eql(u8, u_name, "u_ambient_light")) { + return 48; + } + if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_dir_light_color")) { + return 80; + } + if (std.mem.eql(u8, u_name, "u_num_point_lights")) { + return 96; + } + if (std.mem.eql(u8, u_name, "u_point_light_data")) { + return 112; + } + if (std.mem.eql(u8, u_name, "u_fog_data")) { + return 624; + } + if (std.mem.eql(u8, u_name, "u_fog_color")) { + return 640; } } return null; } -pub fn emissiveUniformDesc(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?sg.ShaderUniformDesc { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_projViewMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_modelMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_tex_pan"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_projViewMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_modelMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_tex_pan"; + return desc; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_cameraPos")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_cameraPos"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color_override"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_alpha_cutoff"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_ambient_light")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_ambient_light"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_dir_light_dir"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_dir_light_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_dir_light_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_num_point_lights")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_num_point_lights"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_point_light_data")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_point_light_data"; - desc.type = .FLOAT4; - desc.array_count = 32; - return desc; - } - if (std.mem.eql(u8, u_name, "u_fog_data")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_fog_data"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_fog_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_fog_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_cameraPos")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_cameraPos"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color_override")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color_override"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_alpha_cutoff"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_ambient_light")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_ambient_light"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_dir_light_dir"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_dir_light_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_dir_light_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_num_point_lights")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_num_point_lights"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_point_light_data")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 32; + desc.glsl_name = "u_point_light_data"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_fog_data")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_fog_data"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_fog_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_fog_color"; + return desc; } } return null; } -pub fn emissiveStoragebufferSlot(stage: sg.ShaderStage, sbuf_name: []const u8) ?usize { - _ = stage; +pub fn emissiveStoragebufferSlot(sbuf_name: []const u8) ?usize { _ = sbuf_name; return null; } diff --git a/src/framework/graphics/shaders/default-mesh.glsl.zig b/src/framework/graphics/shaders/default-mesh.glsl.zig index c1147405..ed25360a 100644 --- a/src/framework/graphics/shaders/default-mesh.glsl.zig +++ b/src/framework/graphics/shaders/default-mesh.glsl.zig @@ -13,41 +13,39 @@ const m = @import("../../math.zig"); // ========= // Shader program: 'default': // Get shader desc: shd.defaultShaderDesc(sg.queryBackend()); -// Vertex shader: vs -// Attributes: -// ATTR_vs_pos => 0 -// ATTR_vs_color0 => 1 -// ATTR_vs_texcoord0 => 2 -// ATTR_vs_normals => 3 -// ATTR_vs_tangents => 4 -// Uniform block 'vs_params': -// Zig struct: VsParams -// Bind slot: SLOT_vs_params => 0 -// Fragment shader: fs -// Uniform block 'fs_params': -// Zig struct: FsParams -// Bind slot: SLOT_fs_params => 0 -// Image 'tex': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex => 0 -// Sampler 'smp': -// Type: .FILTERING -// Bind slot: SLOT_smp => 0 -// Image Sampler Pair 'tex_smp': -// Image: tex -// Sampler: smp -// -pub const ATTR_vs_pos = 0; -pub const ATTR_vs_color0 = 1; -pub const ATTR_vs_texcoord0 = 2; -pub const ATTR_vs_normals = 3; -pub const ATTR_vs_tangents = 4; -pub const SLOT_vs_params = 0; -pub const SLOT_fs_params = 0; -pub const SLOT_tex = 0; -pub const SLOT_smp = 0; +// Vertex Shader: vs +// Fragment Shader: fs +// Attributes: +// ATTR_default_pos => 0 +// ATTR_default_color0 => 1 +// ATTR_default_texcoord0 => 2 +// ATTR_default_normals => 3 +// ATTR_default_tangents => 4 +// Bindings: +// Uniform block 'vs_params': +// Zig struct: VsParams +// Bind slot: UB_vs_params => 0 +// Uniform block 'fs_params': +// Zig struct: FsParams +// Bind slot: UB_fs_params => 1 +// Image 'tex': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex => 1 +// Sampler 'smp': +// Type: .FILTERING +// Bind slot: SMP_smp => 1 +// +pub const ATTR_default_pos = 0; +pub const ATTR_default_color0 = 1; +pub const ATTR_default_texcoord0 = 2; +pub const ATTR_default_normals = 3; +pub const ATTR_default_tangents = 4; +pub const UB_vs_params = 0; +pub const UB_fs_params = 1; +pub const IMG_tex = 1; +pub const SMP_smp = 1; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -120,7 +118,7 @@ const vs_source_glsl430 = [544]u8 { // #version 430 // // uniform vec4 fs_params[2]; -// layout(binding = 0) uniform sampler2D tex_smp; +// layout(binding = 16) uniform sampler2D tex_smp; // // layout(location = 1) in vec2 uv; // layout(location = 0) in vec4 color; @@ -145,43 +143,43 @@ const vs_source_glsl430 = [544]u8 { // } // // -const fs_source_glsl430 = [563]u8 { +const fs_source_glsl430 = [564]u8 { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x29,0x20,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,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,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,0x76,0x65,0x63,0x34,0x20, - 0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65, - 0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d, - 0x20,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32, - 0x38,0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x31,0x5d,0x2e,0x78,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,0x76,0x65,0x63,0x34,0x20,0x5f,0x35,0x34, - 0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f, - 0x36,0x35,0x20,0x3d,0x20,0x28,0x5f,0x35,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20, - 0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x38,0x30,0x20,0x3d,0x20,0x5f,0x35, - 0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x78,0x20,0x3d,0x20,0x5f, - 0x36,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x79,0x20, - 0x3d,0x20,0x5f,0x36,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30, - 0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x36,0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x63,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,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,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,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,0x76,0x65,0x63,0x34, + 0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74, + 0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20, + 0x3d,0x20,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f, + 0x32,0x38,0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, + 0x73,0x5b,0x31,0x5d,0x2e,0x78,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,0x76,0x65,0x63,0x34,0x20,0x5f,0x35, + 0x34,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, + 0x5f,0x36,0x35,0x20,0x3d,0x20,0x28,0x5f,0x35,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a, + 0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, + 0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x38,0x30,0x20,0x3d,0x20,0x5f, + 0x35,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x78,0x20,0x3d,0x20, + 0x5f,0x36,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x79, + 0x20,0x3d,0x20,0x5f,0x36,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38, + 0x30,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x36,0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x63,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; // // #version 300 es @@ -1313,15 +1311,15 @@ const vs_source_wgsl = [1445]u8 { // u_alpha_cutoff : f32, // } // -// @group(1) @binding(48) var tex : texture_2d; +// @group(1) @binding(64) var tex : texture_2d; // -// @group(1) @binding(64) var smp : sampler; +// @group(1) @binding(80) var smp : sampler; // // var uv : vec2f; // // var color : vec4f; // -// @group(0) @binding(4) var x_36 : fs_params; +// @group(0) @binding(8) var x_36 : fs_params; // // var frag_color : vec4f; // @@ -1377,17 +1375,17 @@ const fs_source_wgsl = [1354]u8 { 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20, 0x20,0x75,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x63,0x75,0x74,0x6f,0x66,0x66,0x20, 0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70, - 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29, + 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29, 0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75, 0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72, 0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28, - 0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, + 0x38,0x30,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, 0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76, 0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40, 0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e, - 0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, + 0x67,0x28,0x38,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, 0x3e,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, 0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, 0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76, @@ -1458,173 +1456,242 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.label = "default_shader"; switch (backend) { .GLCORE => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.vs.source = &vs_source_glsl430; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl430; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .GLES3 => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.vs.source = &vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .D3D11 => { - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.attrs[2].sem_name = "TEXCOORD"; - desc.attrs[2].sem_index = 2; - desc.attrs[3].sem_name = "TEXCOORD"; - desc.attrs[3].sem_index = 3; - desc.attrs[4].sem_name = "TEXCOORD"; - desc.attrs[4].sem_index = 4; - desc.vs.source = &vs_source_hlsl4; - desc.vs.d3d11_target = "vs_4_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_hlsl4; - desc.fs.d3d11_target = "ps_4_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_hlsl4; + desc.vertex_func.d3d11_target = "vs_4_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_hlsl4; + desc.fragment_func.d3d11_target = "ps_4_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].hlsl_sem_name = "TEXCOORD"; + desc.attrs[3].hlsl_sem_index = 3; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].hlsl_sem_name = "TEXCOORD"; + desc.attrs[4].hlsl_sem_index = 4; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].hlsl_register_t_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].hlsl_register_s_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .METAL_MACOS => { - desc.vs.source = &vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .METAL_IOS => { - desc.vs.source = &vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_metal_ios; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_ios; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .METAL_SIMULATOR => { - desc.vs.source = &vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_metal_sim; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_sim; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .WGPU => { - desc.vs.source = &vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_wgsl; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_wgsl; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].wgsl_group0_binding_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].wgsl_group1_binding_n = 64; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].wgsl_group1_binding_n = 80; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, else => {}, } @@ -1648,132 +1715,111 @@ pub fn defaultAttrSlot(attr_name: []const u8) ?usize { } return null; } -pub fn defaultImageSlot(stage: sg.ShaderStage, img_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, img_name, "tex")) { - return 0; - } +pub fn defaultImageSlot(img_name: []const u8) ?usize { + if (std.mem.eql(u8, img_name, "tex")) { + return 1; } return null; } -pub fn defaultSamplerSlot(stage: sg.ShaderStage, smp_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, smp_name, "smp")) { - return 0; - } +pub fn defaultSamplerSlot(smp_name: []const u8) ?usize { + if (std.mem.eql(u8, smp_name, "smp")) { + return 1; } return null; } -pub fn defaultUniformblockSlot(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return 0; - } +pub fn defaultUniformblockSlot(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return 0; } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return 0; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return 1; } return null; } -pub fn defaultUniformblockSize(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return @sizeOf(VsParams); - } +pub fn defaultUniformblockSize(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return @sizeOf(VsParams); } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return @sizeOf(FsParams); - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return @sizeOf(FsParams); } return null; } -pub fn defaultUniformOffset(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_color")) { - return 128; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - return 144; - } +pub fn defaultUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_color")) { + return 128; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + return 144; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - return 16; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + return 16; } } return null; } -pub fn defaultUniformDesc(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?sg.ShaderUniformDesc { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_projViewMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_modelMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_tex_pan"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } +pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_projViewMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_modelMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_tex_pan"; + return desc; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color_override"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_alpha_cutoff"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color_override"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_alpha_cutoff"; + return desc; } } return null; } -pub fn defaultStoragebufferSlot(stage: sg.ShaderStage, sbuf_name: []const u8) ?usize { - _ = stage; +pub fn defaultStoragebufferSlot(sbuf_name: []const u8) ?usize { _ = sbuf_name; return null; } diff --git a/src/framework/graphics/shaders/default.glsl.zig b/src/framework/graphics/shaders/default.glsl.zig index 9034b3b5..07815342 100644 --- a/src/framework/graphics/shaders/default.glsl.zig +++ b/src/framework/graphics/shaders/default.glsl.zig @@ -13,37 +13,35 @@ const m = @import("../../math.zig"); // ========= // Shader program: 'default': // Get shader desc: shd.defaultShaderDesc(sg.queryBackend()); -// Vertex shader: vs -// Attributes: -// ATTR_vs_pos => 0 -// ATTR_vs_color0 => 1 -// ATTR_vs_texcoord0 => 2 -// Uniform block 'vs_params': -// Zig struct: VsParams -// Bind slot: SLOT_vs_params => 0 -// Fragment shader: fs -// Uniform block 'fs_params': -// Zig struct: FsParams -// Bind slot: SLOT_fs_params => 0 -// Image 'tex': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex => 0 -// Sampler 'smp': -// Type: .FILTERING -// Bind slot: SLOT_smp => 0 -// Image Sampler Pair 'tex_smp': -// Image: tex -// Sampler: smp -// -pub const ATTR_vs_pos = 0; -pub const ATTR_vs_color0 = 1; -pub const ATTR_vs_texcoord0 = 2; -pub const SLOT_vs_params = 0; -pub const SLOT_fs_params = 0; -pub const SLOT_tex = 0; -pub const SLOT_smp = 0; +// Vertex Shader: vs +// Fragment Shader: fs +// Attributes: +// ATTR_default_pos => 0 +// ATTR_default_color0 => 1 +// ATTR_default_texcoord0 => 2 +// Bindings: +// Uniform block 'vs_params': +// Zig struct: VsParams +// Bind slot: UB_vs_params => 0 +// Uniform block 'fs_params': +// Zig struct: FsParams +// Bind slot: UB_fs_params => 1 +// Image 'tex': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex => 1 +// Sampler 'smp': +// Type: .FILTERING +// Bind slot: SMP_smp => 1 +// +pub const ATTR_default_pos = 0; +pub const ATTR_default_color0 = 1; +pub const ATTR_default_texcoord0 = 2; +pub const UB_vs_params = 0; +pub const UB_fs_params = 1; +pub const IMG_tex = 1; +pub const SMP_smp = 1; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -109,7 +107,7 @@ const vs_source_glsl430 = [467]u8 { // #version 430 // // uniform vec4 fs_params[2]; -// layout(binding = 0) uniform sampler2D tex_smp; +// layout(binding = 16) uniform sampler2D tex_smp; // // layout(location = 1) in vec2 uv; // layout(location = 0) in vec4 color; @@ -134,43 +132,43 @@ const vs_source_glsl430 = [467]u8 { // } // // -const fs_source_glsl430 = [563]u8 { +const fs_source_glsl430 = [564]u8 { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x29,0x20,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,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,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,0x76,0x65,0x63,0x34,0x20, - 0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65, - 0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d, - 0x20,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32, - 0x38,0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x31,0x5d,0x2e,0x78,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,0x76,0x65,0x63,0x34,0x20,0x5f,0x35,0x34, - 0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f, - 0x36,0x35,0x20,0x3d,0x20,0x28,0x5f,0x35,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20, - 0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x38,0x30,0x20,0x3d,0x20,0x5f,0x35, - 0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x78,0x20,0x3d,0x20,0x5f, - 0x36,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x79,0x20, - 0x3d,0x20,0x5f,0x36,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30, - 0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x36,0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x63,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,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,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,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,0x76,0x65,0x63,0x34, + 0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74, + 0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20, + 0x3d,0x20,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f, + 0x32,0x38,0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, + 0x73,0x5b,0x31,0x5d,0x2e,0x78,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,0x76,0x65,0x63,0x34,0x20,0x5f,0x35, + 0x34,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, + 0x5f,0x36,0x35,0x20,0x3d,0x20,0x28,0x5f,0x35,0x34,0x2e,0x78,0x79,0x7a,0x20,0x2a, + 0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, + 0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x38,0x30,0x20,0x3d,0x20,0x5f, + 0x35,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x78,0x20,0x3d,0x20, + 0x5f,0x36,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38,0x30,0x2e,0x79, + 0x20,0x3d,0x20,0x5f,0x36,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x38, + 0x30,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x36,0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x63,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x38,0x30,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; // // #version 300 es @@ -1260,15 +1258,15 @@ const vs_source_wgsl = [1253]u8 { // u_alpha_cutoff : f32, // } // -// @group(1) @binding(48) var tex : texture_2d; +// @group(1) @binding(64) var tex : texture_2d; // -// @group(1) @binding(64) var smp : sampler; +// @group(1) @binding(80) var smp : sampler; // // var uv : vec2f; // // var color : vec4f; // -// @group(0) @binding(4) var x_36 : fs_params; +// @group(0) @binding(8) var x_36 : fs_params; // // var frag_color : vec4f; // @@ -1324,17 +1322,17 @@ const fs_source_wgsl = [1354]u8 { 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20, 0x20,0x75,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x63,0x75,0x74,0x6f,0x66,0x66,0x20, 0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70, - 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29, + 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29, 0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75, 0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72, 0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28, - 0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, + 0x38,0x30,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, 0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76, 0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40, 0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e, - 0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, + 0x67,0x28,0x38,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, 0x3e,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, 0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, 0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76, @@ -1405,165 +1403,220 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.label = "default_shader"; switch (backend) { .GLCORE => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.vs.source = &vs_source_glsl430; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl430; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .GLES3 => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.vs.source = &vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .D3D11 => { - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.attrs[2].sem_name = "TEXCOORD"; - desc.attrs[2].sem_index = 2; - desc.vs.source = &vs_source_hlsl4; - desc.vs.d3d11_target = "vs_4_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_hlsl4; - desc.fs.d3d11_target = "ps_4_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_hlsl4; + desc.vertex_func.d3d11_target = "vs_4_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_hlsl4; + desc.fragment_func.d3d11_target = "ps_4_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].hlsl_register_t_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].hlsl_register_s_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .METAL_MACOS => { - desc.vs.source = &vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .METAL_IOS => { - desc.vs.source = &vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_metal_ios; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_ios; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .METAL_SIMULATOR => { - desc.vs.source = &vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_metal_sim; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_sim; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, .WGPU => { - desc.vs.source = &vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.vertex_func.source = &vs_source_wgsl; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_wgsl; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].wgsl_group0_binding_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].wgsl_group1_binding_n = 64; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].wgsl_group1_binding_n = 80; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; }, else => {}, } @@ -1581,132 +1634,111 @@ pub fn defaultAttrSlot(attr_name: []const u8) ?usize { } return null; } -pub fn defaultImageSlot(stage: sg.ShaderStage, img_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, img_name, "tex")) { - return 0; - } +pub fn defaultImageSlot(img_name: []const u8) ?usize { + if (std.mem.eql(u8, img_name, "tex")) { + return 1; } return null; } -pub fn defaultSamplerSlot(stage: sg.ShaderStage, smp_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, smp_name, "smp")) { - return 0; - } +pub fn defaultSamplerSlot(smp_name: []const u8) ?usize { + if (std.mem.eql(u8, smp_name, "smp")) { + return 1; } return null; } -pub fn defaultUniformblockSlot(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return 0; - } +pub fn defaultUniformblockSlot(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return 0; } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return 0; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return 1; } return null; } -pub fn defaultUniformblockSize(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return @sizeOf(VsParams); - } +pub fn defaultUniformblockSize(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return @sizeOf(VsParams); } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return @sizeOf(FsParams); - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return @sizeOf(FsParams); } return null; } -pub fn defaultUniformOffset(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_color")) { - return 128; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - return 144; - } +pub fn defaultUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_color")) { + return 128; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + return 144; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - return 16; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + return 16; } } return null; } -pub fn defaultUniformDesc(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?sg.ShaderUniformDesc { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_projViewMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_modelMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_tex_pan"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } +pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_projViewMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_modelMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_tex_pan"; + return desc; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color_override"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_alpha_cutoff"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color_override"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_alpha_cutoff"; + return desc; } } return null; } -pub fn defaultStoragebufferSlot(stage: sg.ShaderStage, sbuf_name: []const u8) ?usize { - _ = stage; +pub fn defaultStoragebufferSlot(sbuf_name: []const u8) ?usize { _ = sbuf_name; return null; } diff --git a/src/framework/graphics/shaders/emissive.glsl.zig b/src/framework/graphics/shaders/emissive.glsl.zig index bbf393f9..31c0fc9f 100644 --- a/src/framework/graphics/shaders/emissive.glsl.zig +++ b/src/framework/graphics/shaders/emissive.glsl.zig @@ -13,50 +13,45 @@ const m = @import("../../math.zig"); // ========= // Shader program: 'emissive': // Get shader desc: shd.emissiveShaderDesc(sg.queryBackend()); -// Vertex shader: vs -// Attributes: -// ATTR_vs_pos => 0 -// ATTR_vs_color0 => 1 -// ATTR_vs_texcoord0 => 2 -// ATTR_vs_normals => 3 -// ATTR_vs_tangents => 4 -// Uniform block 'vs_params': -// Zig struct: VsParams -// Bind slot: SLOT_vs_params => 0 -// Fragment shader: fs -// Uniform block 'fs_params': -// Zig struct: FsParams -// Bind slot: SLOT_fs_params => 0 -// Image 'tex': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex => 0 -// Image 'tex_emissive': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex_emissive => 1 -// Sampler 'smp': -// Type: .FILTERING -// Bind slot: SLOT_smp => 0 -// Image Sampler Pair 'tex_smp': -// Image: tex -// Sampler: smp -// Image Sampler Pair 'tex_emissive_smp': -// Image: tex_emissive -// Sampler: smp -// -pub const ATTR_vs_pos = 0; -pub const ATTR_vs_color0 = 1; -pub const ATTR_vs_texcoord0 = 2; -pub const ATTR_vs_normals = 3; -pub const ATTR_vs_tangents = 4; -pub const SLOT_vs_params = 0; -pub const SLOT_fs_params = 0; -pub const SLOT_tex = 0; -pub const SLOT_tex_emissive = 1; -pub const SLOT_smp = 0; +// Vertex Shader: vs +// Fragment Shader: fs +// Attributes: +// ATTR_emissive_pos => 0 +// ATTR_emissive_color0 => 1 +// ATTR_emissive_texcoord0 => 2 +// ATTR_emissive_normals => 3 +// ATTR_emissive_tangents => 4 +// Bindings: +// Uniform block 'vs_params': +// Zig struct: VsParams +// Bind slot: UB_vs_params => 0 +// Uniform block 'fs_params': +// Zig struct: FsParams +// Bind slot: UB_fs_params => 1 +// Image 'tex': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex => 1 +// Image 'tex_emissive': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex_emissive => 2 +// Sampler 'smp': +// Type: .FILTERING +// Bind slot: SMP_smp => 1 +// +pub const ATTR_emissive_pos = 0; +pub const ATTR_emissive_color0 = 1; +pub const ATTR_emissive_texcoord0 = 2; +pub const ATTR_emissive_normals = 3; +pub const ATTR_emissive_tangents = 4; +pub const UB_vs_params = 0; +pub const UB_fs_params = 1; +pub const IMG_tex = 1; +pub const IMG_tex_emissive = 2; +pub const SMP_smp = 1; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -140,8 +135,8 @@ const vs_source_glsl430 = [667]u8 { // #version 430 // // uniform vec4 fs_params[2]; -// layout(binding = 0) uniform sampler2D tex_smp; -// layout(binding = 1) uniform sampler2D tex_emissive_smp; +// layout(binding = 16) uniform sampler2D tex_smp; +// layout(binding = 17) uniform sampler2D tex_emissive_smp; // // layout(location = 1) in vec2 uv; // layout(location = 0) in vec4 color; @@ -174,64 +169,64 @@ const vs_source_glsl430 = [667]u8 { // } // // -const fs_source_glsl430 = [909]u8 { +const fs_source_glsl430 = [911]u8 { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62, - 0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x29,0x20,0x75,0x6e,0x69,0x66, - 0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65, - 0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x37,0x29,0x20,0x75,0x6e, + 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, + 0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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,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,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,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,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x6e,0x6f,0x72, - 0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61, - 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63, - 0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e,0x74,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, - 0x63,0x34,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20, - 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20, - 0x63,0x20,0x3d,0x20,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20, - 0x28,0x5f,0x32,0x38,0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,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,0x76,0x65,0x63,0x34,0x20, - 0x5f,0x35,0x33,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65, - 0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x5f,0x73,0x6d,0x70,0x2c,0x20, - 0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x36, - 0x39,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, - 0x5f,0x37,0x36,0x20,0x3d,0x20,0x28,0x5f,0x36,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2a, - 0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x6d,0x69,0x6e,0x28,0x28,0x5f,0x35,0x33, - 0x2e,0x78,0x20,0x2b,0x20,0x5f,0x35,0x33,0x2e,0x79,0x29,0x20,0x2b,0x20,0x5f,0x35, - 0x33,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x35, - 0x33,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20, - 0x5f,0x31,0x31,0x37,0x20,0x3d,0x20,0x5f,0x36,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x5f,0x31,0x31,0x37,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x78,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x37,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x37,0x36, - 0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x37,0x2e,0x7a,0x20,0x3d, - 0x20,0x5f,0x37,0x36,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33, - 0x20,0x5f,0x39,0x39,0x20,0x3d,0x20,0x28,0x5f,0x31,0x31,0x37,0x2e,0x78,0x79,0x7a, - 0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a, - 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x32,0x33,0x20, - 0x3d,0x20,0x5f,0x31,0x31,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x33, - 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x5f,0x31,0x32,0x33,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x79,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x33,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x39,0x39, - 0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x32,0x33, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x5f,0x31,0x32,0x33,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x6e, + 0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, + 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76, + 0x65,0x63,0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e,0x74,0x3b,0x0a,0x0a,0x76,0x6f, + 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, + 0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20, + 0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x34,0x20,0x63,0x20,0x3d,0x20,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69, + 0x66,0x20,0x28,0x5f,0x32,0x38,0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,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,0x76,0x65,0x63, + 0x34,0x20,0x5f,0x35,0x33,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x5f,0x73,0x6d,0x70, + 0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20, + 0x5f,0x36,0x39,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x33,0x20,0x5f,0x37,0x36,0x20,0x3d,0x20,0x28,0x5f,0x36,0x39,0x2e,0x78,0x79,0x7a, + 0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x6d,0x69,0x6e,0x28,0x28,0x5f, + 0x35,0x33,0x2e,0x78,0x20,0x2b,0x20,0x5f,0x35,0x33,0x2e,0x79,0x29,0x20,0x2b,0x20, + 0x5f,0x35,0x33,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x29,0x20,0x2b,0x20, + 0x5f,0x35,0x33,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x34,0x20,0x5f,0x31,0x31,0x37,0x20,0x3d,0x20,0x5f,0x36,0x39,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x5f,0x31,0x31,0x37,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x78, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x37,0x2e,0x79,0x20,0x3d,0x20,0x5f, + 0x37,0x36,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x37,0x2e,0x7a, + 0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, + 0x63,0x33,0x20,0x5f,0x39,0x39,0x20,0x3d,0x20,0x28,0x5f,0x31,0x31,0x37,0x2e,0x78, + 0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a, + 0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e, + 0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x32, + 0x33,0x20,0x3d,0x20,0x5f,0x31,0x31,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31, + 0x32,0x33,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x78,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x5f,0x31,0x32,0x33,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x79, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x33,0x2e,0x7a,0x20,0x3d,0x20,0x5f, + 0x39,0x39,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31, + 0x32,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x3d,0x20,0x5f,0x31,0x32,0x33,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; // // #version 300 es @@ -1617,17 +1612,17 @@ const vs_source_wgsl = [1690]u8 { // u_alpha_cutoff : f32, // } // -// @group(1) @binding(48) var tex : texture_2d; +// @group(1) @binding(64) var tex : texture_2d; // -// @group(1) @binding(64) var smp : sampler; +// @group(1) @binding(80) var smp : sampler; // // var uv : vec2f; // // var color : vec4f; // -// @group(0) @binding(4) var x_36 : fs_params; +// @group(0) @binding(8) var x_36 : fs_params; // -// @group(1) @binding(49) var tex_emissive : texture_2d; +// @group(1) @binding(65) var tex_emissive : texture_2d; // // var frag_color : vec4f; // @@ -1705,20 +1700,20 @@ const fs_source_wgsl = [2077]u8 { 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20, 0x20,0x75,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x63,0x75,0x74,0x6f,0x66,0x66,0x20, 0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70, - 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29, + 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29, 0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75, 0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72, 0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28, - 0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, + 0x38,0x30,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, 0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76, 0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40, 0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e, - 0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, + 0x67,0x28,0x38,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, 0x3e,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, 0x6d,0x73,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x39,0x29,0x20,0x76,0x61,0x72,0x20, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x35,0x29,0x20,0x76,0x61,0x72,0x20, 0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x20,0x3a,0x20,0x74, 0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a, 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72, @@ -1831,224 +1826,298 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.label = "emissive_shader"; switch (backend) { .GLCORE => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.vs.source = &vs_source_glsl430; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl430; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.vs.source = &vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 10; - desc.fs.source = &fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 10; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.attrs[2].sem_name = "TEXCOORD"; - desc.attrs[2].sem_index = 2; - desc.attrs[3].sem_name = "TEXCOORD"; - desc.attrs[3].sem_index = 3; - desc.attrs[4].sem_name = "TEXCOORD"; - desc.attrs[4].sem_index = 4; - desc.vs.source = &vs_source_hlsl4; - desc.vs.d3d11_target = "vs_4_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_hlsl4; - desc.fs.d3d11_target = "ps_4_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_hlsl4; + desc.vertex_func.d3d11_target = "vs_4_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_hlsl4; + desc.fragment_func.d3d11_target = "ps_4_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].hlsl_sem_name = "TEXCOORD"; + desc.attrs[3].hlsl_sem_index = 3; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].hlsl_sem_name = "TEXCOORD"; + desc.attrs[4].hlsl_sem_index = 4; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].hlsl_register_t_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].hlsl_register_t_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].hlsl_register_s_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_MACOS => { - desc.vs.source = &vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_IOS => { - desc.vs.source = &vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_ios; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_ios; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_SIMULATOR => { - desc.vs.source = &vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_sim; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_sim; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .WGPU => { - desc.vs.source = &vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 160; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_wgsl; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_wgsl; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 160; + desc.uniform_blocks[0].wgsl_group0_binding_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].wgsl_group1_binding_n = 64; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].wgsl_group1_binding_n = 65; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].wgsl_group1_binding_n = 80; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, else => {}, } @@ -2072,135 +2141,114 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } return null; } -pub fn emissiveImageSlot(stage: sg.ShaderStage, img_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, img_name, "tex")) { - return 0; - } - if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 1; - } +pub fn emissiveImageSlot(img_name: []const u8) ?usize { + if (std.mem.eql(u8, img_name, "tex")) { + return 1; + } + if (std.mem.eql(u8, img_name, "tex_emissive")) { + return 2; } return null; } -pub fn emissiveSamplerSlot(stage: sg.ShaderStage, smp_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, smp_name, "smp")) { - return 0; - } +pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { + if (std.mem.eql(u8, smp_name, "smp")) { + return 1; } return null; } -pub fn emissiveUniformblockSlot(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return 0; - } +pub fn emissiveUniformblockSlot(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return 0; } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return 0; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return 1; } return null; } -pub fn emissiveUniformblockSize(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return @sizeOf(VsParams); - } +pub fn emissiveUniformblockSize(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return @sizeOf(VsParams); } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return @sizeOf(FsParams); - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return @sizeOf(FsParams); } return null; } -pub fn emissiveUniformOffset(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_color")) { - return 128; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - return 144; - } +pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_color")) { + return 128; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + return 144; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - return 16; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + return 16; } } return null; } -pub fn emissiveUniformDesc(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?sg.ShaderUniformDesc { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_projViewMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_modelMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_tex_pan"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_projViewMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_modelMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_tex_pan"; + return desc; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color_override"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_alpha_cutoff"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color_override"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_alpha_cutoff"; + return desc; } } return null; } -pub fn emissiveStoragebufferSlot(stage: sg.ShaderStage, sbuf_name: []const u8) ?usize { - _ = stage; +pub fn emissiveStoragebufferSlot(sbuf_name: []const u8) ?usize { _ = sbuf_name; return null; } diff --git a/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig b/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig index 2df51c91..71204edf 100644 --- a/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig +++ b/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig @@ -13,54 +13,49 @@ const m = @import("../../math.zig"); // ========= // Shader program: 'emissive': // Get shader desc: shd.emissiveShaderDesc(sg.queryBackend()); -// Vertex shader: vs -// Attributes: -// ATTR_vs_pos => 0 -// ATTR_vs_color0 => 1 -// ATTR_vs_texcoord0 => 2 -// ATTR_vs_normals => 3 -// ATTR_vs_tangents => 4 -// ATTR_vs_joints => 5 -// ATTR_vs_weights => 6 -// Uniform block 'vs_params': -// Zig struct: VsParams -// Bind slot: SLOT_vs_params => 0 -// Fragment shader: fs -// Uniform block 'fs_params': -// Zig struct: FsParams -// Bind slot: SLOT_fs_params => 0 -// Image 'tex': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex => 0 -// Image 'tex_emissive': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex_emissive => 1 -// Sampler 'smp': -// Type: .FILTERING -// Bind slot: SLOT_smp => 0 -// Image Sampler Pair 'tex_smp': -// Image: tex -// Sampler: smp -// Image Sampler Pair 'tex_emissive_smp': -// Image: tex_emissive -// Sampler: smp -// -pub const ATTR_vs_pos = 0; -pub const ATTR_vs_color0 = 1; -pub const ATTR_vs_texcoord0 = 2; -pub const ATTR_vs_normals = 3; -pub const ATTR_vs_tangents = 4; -pub const ATTR_vs_joints = 5; -pub const ATTR_vs_weights = 6; -pub const SLOT_vs_params = 0; -pub const SLOT_fs_params = 0; -pub const SLOT_tex = 0; -pub const SLOT_tex_emissive = 1; -pub const SLOT_smp = 0; +// Vertex Shader: vs +// Fragment Shader: fs +// Attributes: +// ATTR_emissive_pos => 0 +// ATTR_emissive_color0 => 1 +// ATTR_emissive_texcoord0 => 2 +// ATTR_emissive_normals => 3 +// ATTR_emissive_tangents => 4 +// ATTR_emissive_joints => 5 +// ATTR_emissive_weights => 6 +// Bindings: +// Uniform block 'vs_params': +// Zig struct: VsParams +// Bind slot: UB_vs_params => 0 +// Uniform block 'fs_params': +// Zig struct: FsParams +// Bind slot: UB_fs_params => 1 +// Image 'tex': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex => 1 +// Image 'tex_emissive': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex_emissive => 2 +// Sampler 'smp': +// Type: .FILTERING +// Bind slot: SMP_smp => 1 +// +pub const ATTR_emissive_pos = 0; +pub const ATTR_emissive_color0 = 1; +pub const ATTR_emissive_texcoord0 = 2; +pub const ATTR_emissive_normals = 3; +pub const ATTR_emissive_tangents = 4; +pub const ATTR_emissive_joints = 5; +pub const ATTR_emissive_weights = 6; +pub const UB_vs_params = 0; +pub const UB_fs_params = 1; +pub const IMG_tex = 1; +pub const IMG_tex_emissive = 2; +pub const SMP_smp = 1; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -236,8 +231,8 @@ const vs_source_glsl430 = [1801]u8 { // #version 430 // // uniform vec4 fs_params[41]; -// layout(binding = 0) uniform sampler2D tex_smp; -// layout(binding = 1) uniform sampler2D tex_emissive_smp; +// layout(binding = 16) uniform sampler2D tex_smp; +// layout(binding = 17) uniform sampler2D tex_emissive_smp; // // layout(location = 1) in vec2 uv; // layout(location = 5) in vec4 baseDiffuse; @@ -319,171 +314,171 @@ const vs_source_glsl430 = [1801]u8 { // } // // -const fs_source_glsl430 = [2613]u8 { +const fs_source_glsl430 = [2615]u8 { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x34,0x31,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, - 0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x29,0x20,0x75,0x6e,0x69, - 0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74, - 0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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,0x35,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20, - 0x62,0x61,0x73,0x65,0x44,0x69,0x66,0x66,0x75,0x73,0x65,0x3b,0x0a,0x6c,0x61,0x79, - 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x34, - 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,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33, - 0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, - 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e,0x74,0x3b,0x0a,0x0a,0x66,0x6c, - 0x6f,0x61,0x74,0x20,0x73,0x71,0x72,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x78,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x78,0x20, - 0x2a,0x20,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x74, - 0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69,0x67,0x68,0x74,0x28,0x66,0x6c, - 0x6f,0x61,0x74,0x20,0x5f,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x2c,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x72,0x61,0x64,0x69,0x75,0x73,0x2c,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x6d,0x61,0x78,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79, - 0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x66,0x61,0x6c,0x6c,0x6f,0x66,0x66,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x30, - 0x20,0x3d,0x20,0x5f,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x20,0x2f,0x20,0x72, - 0x61,0x64,0x69,0x75,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f, - 0x33,0x30,0x20,0x3e,0x3d,0x20,0x31,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, - 0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x33,0x30, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x73,0x71,0x72,0x28, - 0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, - 0x72,0x6e,0x20,0x28,0x6d,0x61,0x78,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74, - 0x79,0x20,0x2a,0x20,0x73,0x71,0x72,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29, - 0x29,0x20,0x2f,0x20,0x66,0x6d,0x61,0x28,0x66,0x61,0x6c,0x6c,0x6f,0x66,0x66,0x2c, - 0x20,0x5f,0x33,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x63,0x61,0x6c,0x63,0x46,0x6f,0x67,0x46,0x61,0x63,0x74, - 0x6f,0x72,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69,0x73,0x74,0x61,0x6e,0x63, - 0x65,0x5f,0x74,0x6f,0x5f,0x65,0x79,0x65,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, - 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x63,0x6c,0x61,0x6d,0x70,0x28,0x28,0x28,0x64, - 0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x74,0x6f,0x5f,0x65,0x79,0x65,0x20,0x2d, - 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x78, - 0x29,0x20,0x2f,0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33, - 0x39,0x5d,0x2e,0x79,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x33,0x39,0x5d,0x2e,0x78,0x29,0x29,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x77,0x2c,0x20,0x30,0x2e,0x30,0x2c, - 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, - 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, - 0x20,0x5f,0x31,0x31,0x33,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, - 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x62, - 0x61,0x73,0x65,0x44,0x69,0x66,0x66,0x75,0x73,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x31,0x33,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x31,0x33,0x2e,0x77, - 0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d, - 0x2e,0x78,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,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x20, - 0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x69,0x6e,0x74,0x28,0x66,0x73,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x3b,0x20,0x69,0x2b, - 0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x69,0x6e,0x74,0x20,0x5f,0x31,0x34,0x35,0x20,0x3d,0x20,0x69,0x20,0x2a,0x20, - 0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, - 0x5f,0x31,0x36,0x38,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x5f,0x31,0x34,0x35,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x37,0x5d,0x2e,0x78, - 0x79,0x7a,0x20,0x2d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79, - 0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28, - 0x5f,0x31,0x36,0x38,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x66, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x5f,0x31,0x34,0x35,0x20,0x2a,0x20, - 0x31,0x20,0x2b,0x20,0x37,0x5d,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20, - 0x3d,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x31, - 0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, - 0x20,0x5f,0x31,0x39,0x38,0x20,0x3d,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, - 0x5f,0x32,0x30,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38,0x2e,0x78,0x79,0x7a,0x20, - 0x2b,0x20,0x28,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x28,0x5f, - 0x31,0x34,0x35,0x20,0x2b,0x20,0x31,0x29,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x37, - 0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28, - 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x31,0x36,0x38,0x29,0x2c, - 0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x20, - 0x2a,0x20,0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69,0x67,0x68, - 0x74,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65, - 0x63,0x34,0x20,0x5f,0x33,0x33,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x30,0x2e,0x78,0x20,0x3d, - 0x20,0x5f,0x32,0x30,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x5f,0x33,0x33,0x30,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x79, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x30,0x2e,0x7a, - 0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f, - 0x33,0x33,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76, - 0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x6c,0x69,0x74,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f, - 0x32,0x34,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2b, - 0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78, - 0x79,0x7a,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28,0x76,0x65, - 0x63,0x34,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e, - 0x78,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e, - 0x79,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e, - 0x7a,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x6e,0x6f, - 0x72,0x6d,0x61,0x6c,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30, - 0x29,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d, - 0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f, - 0x33,0x33,0x36,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x5f,0x33,0x33,0x36,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e,0x78,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x36,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32, - 0x34,0x31,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x36,0x2e,0x7a, - 0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c, - 0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x33,0x33,0x36,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x30,0x20,0x3d, - 0x20,0x63,0x20,0x2a,0x20,0x5f,0x33,0x33,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76, - 0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x5f, - 0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, - 0x63,0x33,0x20,0x5f,0x32,0x37,0x35,0x20,0x3d,0x20,0x28,0x5f,0x32,0x35,0x30,0x2e, - 0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x6d,0x69,0x6e, - 0x28,0x28,0x5f,0x32,0x35,0x37,0x2e,0x78,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e, - 0x79,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30, - 0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x34,0x35,0x20,0x3d,0x20, - 0x5f,0x32,0x35,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x35,0x2e,0x78, - 0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, - 0x33,0x34,0x35,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x79,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x35,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x37, - 0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32, - 0x39,0x36,0x20,0x3d,0x20,0x28,0x5f,0x33,0x34,0x35,0x2e,0x78,0x79,0x7a,0x20,0x2a, - 0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x35,0x31,0x20,0x3d,0x20, - 0x5f,0x33,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x31,0x2e,0x78, - 0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, - 0x33,0x35,0x31,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x79,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x31,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x39, - 0x36,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f,0x33,0x35, - 0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x20,0x2d,0x20,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x6d,0x69, - 0x78,0x28,0x63,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33, - 0x28,0x63,0x61,0x6c,0x63,0x46,0x6f,0x67,0x46,0x61,0x63,0x74,0x6f,0x72,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, - 0x0a,0x7d,0x0a,0x0a,0x00, + 0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x37,0x29,0x20,0x75, + 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44, + 0x20,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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,0x35,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63, + 0x34,0x20,0x62,0x61,0x73,0x65,0x44,0x69,0x66,0x66,0x75,0x73,0x65,0x3b,0x0a,0x6c, + 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x34,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,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, + 0x63,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, + 0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e, + 0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e,0x74,0x3b,0x0a,0x0a, + 0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x71,0x72,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, + 0x78,0x20,0x2a,0x20,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69,0x67,0x68,0x74,0x28, + 0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x2c, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x72,0x61,0x64,0x69,0x75,0x73,0x2c,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x20,0x6d,0x61,0x78,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73,0x69, + 0x74,0x79,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x66,0x61,0x6c,0x6c,0x6f,0x66, + 0x66,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f, + 0x33,0x30,0x20,0x3d,0x20,0x5f,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x20,0x2f, + 0x20,0x72,0x61,0x64,0x69,0x75,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20, + 0x28,0x5f,0x33,0x30,0x20,0x3e,0x3d,0x20,0x31,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20, + 0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72, + 0x6e,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f, + 0x33,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x73,0x71, + 0x72,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65, + 0x74,0x75,0x72,0x6e,0x20,0x28,0x6d,0x61,0x78,0x5f,0x69,0x6e,0x74,0x65,0x6e,0x73, + 0x69,0x74,0x79,0x20,0x2a,0x20,0x73,0x71,0x72,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x31,0x29,0x29,0x20,0x2f,0x20,0x66,0x6d,0x61,0x28,0x66,0x61,0x6c,0x6c,0x6f,0x66, + 0x66,0x2c,0x20,0x5f,0x33,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x61,0x6c,0x63,0x46,0x6f,0x67,0x46,0x61, + 0x63,0x74,0x6f,0x72,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69,0x73,0x74,0x61, + 0x6e,0x63,0x65,0x5f,0x74,0x6f,0x5f,0x65,0x79,0x65,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x63,0x6c,0x61,0x6d,0x70,0x28,0x28, + 0x28,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x74,0x6f,0x5f,0x65,0x79,0x65, + 0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x39,0x5d, + 0x2e,0x78,0x29,0x20,0x2f,0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, + 0x5b,0x33,0x39,0x5d,0x2e,0x79,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x5b,0x33,0x39,0x5d,0x2e,0x78,0x29,0x29,0x20,0x2a,0x20,0x66,0x73,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x77,0x2c,0x20,0x30,0x2e, + 0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64, + 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, + 0x63,0x34,0x20,0x5f,0x31,0x31,0x33,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72, + 0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a, + 0x20,0x62,0x61,0x73,0x65,0x44,0x69,0x66,0x66,0x75,0x73,0x65,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x31,0x33,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x33,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x31,0x33, + 0x2e,0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x32,0x5d,0x2e,0x78,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,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20, + 0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x69,0x6e,0x74,0x28,0x66, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x3b,0x20, + 0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x31,0x34,0x35,0x20,0x3d,0x20,0x69,0x20, + 0x2a,0x20,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x33,0x20,0x5f,0x31,0x36,0x38,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x5b,0x5f,0x31,0x34,0x35,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x37,0x5d, + 0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e, + 0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74, + 0x68,0x28,0x5f,0x31,0x36,0x38,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d, + 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x5f,0x31,0x34,0x35,0x20, + 0x2a,0x20,0x31,0x20,0x2b,0x20,0x37,0x5d,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x32,0x20,0x3d,0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d, + 0x20,0x31,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65, + 0x63,0x34,0x20,0x5f,0x31,0x39,0x38,0x20,0x3d,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x33,0x20,0x5f,0x32,0x30,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38,0x2e,0x78,0x79, + 0x7a,0x20,0x2b,0x20,0x28,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x28,0x5f,0x31,0x34,0x35,0x20,0x2b,0x20,0x31,0x29,0x20,0x2a,0x20,0x31,0x20,0x2b, + 0x20,0x37,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x6d,0x61,0x78,0x28,0x64,0x6f, + 0x74,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x31,0x36,0x38, + 0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29, + 0x29,0x20,0x2a,0x20,0x61,0x74,0x74,0x65,0x6e,0x75,0x61,0x74,0x65,0x5f,0x6c,0x69, + 0x67,0x68,0x74,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x33,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x38, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x30,0x2e,0x78, + 0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x5f,0x33,0x33,0x30,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x30,0x30, + 0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x30, + 0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x30,0x30,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, + 0x20,0x5f,0x33,0x33,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20,0x6c,0x69,0x74, + 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33, + 0x20,0x5f,0x32,0x34,0x31,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x2e,0x78,0x79,0x7a, + 0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d, + 0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28, + 0x76,0x65,0x63,0x34,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34, + 0x5d,0x2e,0x78,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34, + 0x5d,0x2e,0x79,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34, + 0x5d,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x34,0x28, + 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2c,0x20,0x30, + 0x2e,0x30,0x29,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, + 0x20,0x5f,0x33,0x33,0x36,0x20,0x3d,0x20,0x5f,0x32,0x33,0x39,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x5f,0x33,0x33,0x36,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e, + 0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x36,0x2e,0x79,0x20,0x3d,0x20, + 0x5f,0x32,0x34,0x31,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x36, + 0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x32,0x34,0x31,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x6c,0x69,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x33,0x33, + 0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x30, + 0x20,0x3d,0x20,0x63,0x20,0x2a,0x20,0x5f,0x33,0x33,0x36,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76, + 0x65,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x37,0x35,0x20,0x3d,0x20,0x28,0x5f,0x32,0x35, + 0x30,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x6d, + 0x69,0x6e,0x28,0x28,0x5f,0x32,0x35,0x37,0x2e,0x78,0x20,0x2b,0x20,0x5f,0x32,0x35, + 0x37,0x2e,0x79,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x7a,0x2c,0x20,0x31, + 0x2e,0x30,0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x32,0x35,0x37,0x2e,0x78,0x79,0x7a, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x34,0x35,0x20, + 0x3d,0x20,0x5f,0x32,0x35,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x35, + 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x5f,0x33,0x34,0x35,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x37,0x35,0x2e,0x79, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x34,0x35,0x2e,0x7a,0x20,0x3d,0x20,0x5f, + 0x32,0x37,0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20, + 0x5f,0x32,0x39,0x36,0x20,0x3d,0x20,0x28,0x5f,0x33,0x34,0x35,0x2e,0x78,0x79,0x7a, + 0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72, + 0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a, + 0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e,0x77,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x35,0x31,0x20, + 0x3d,0x20,0x5f,0x33,0x34,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x31, + 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x5f,0x33,0x35,0x31,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x32,0x39,0x36,0x2e,0x79, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x35,0x31,0x2e,0x7a,0x20,0x3d,0x20,0x5f, + 0x32,0x39,0x36,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f, + 0x33,0x35,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x20,0x2d,0x20,0x70, + 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28, + 0x6d,0x69,0x78,0x28,0x63,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x66,0x73,0x5f,0x70,0x61, + 0x72,0x61,0x6d,0x73,0x5b,0x34,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65, + 0x63,0x33,0x28,0x63,0x61,0x6c,0x63,0x46,0x6f,0x67,0x46,0x61,0x63,0x74,0x6f,0x72, + 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30, + 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; // // #version 300 es @@ -3382,11 +3377,11 @@ const vs_source_wgsl = [3459]u8 { // u_fog_color : vec4f, // } // -// @group(0) @binding(4) var x_63 : fs_params; +// @group(0) @binding(8) var x_63 : fs_params; // -// @group(1) @binding(48) var tex : texture_2d; +// @group(1) @binding(64) var tex : texture_2d; // -// @group(1) @binding(64) var smp : sampler; +// @group(1) @binding(80) var smp : sampler; // // var uv : vec2f; // @@ -3396,7 +3391,7 @@ const vs_source_wgsl = [3459]u8 { // // var normal : vec3f; // -// @group(1) @binding(49) var tex_emissive : texture_2d; +// @group(1) @binding(65) var tex_emissive : texture_2d; // // var frag_color : vec4f; // @@ -3656,14 +3651,14 @@ const fs_source_wgsl = [7763]u8 { 0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36,0x34,0x30,0x29,0x20,0x2a, 0x2f,0x0a,0x20,0x20,0x75,0x5f,0x66,0x6f,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f, - 0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34, + 0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x38, 0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78, 0x5f,0x36,0x33,0x20,0x3a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b, 0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e, - 0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78, + 0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78, 0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33, 0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x38,0x30,0x29,0x20,0x76,0x61,0x72,0x20, 0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a, 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20, 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, @@ -3674,7 +3669,7 @@ const fs_source_wgsl = [7763]u8 { 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x6f,0x72,0x6d, 0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72, 0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28, - 0x34,0x39,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73, + 0x36,0x35,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73, 0x73,0x69,0x76,0x65,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32, 0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, @@ -4113,232 +4108,320 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.label = "emissive_shader"; switch (backend) { .GLCORE => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.attrs[5].name = "joints"; - desc.attrs[6].name = "weights"; - desc.vs.source = &vs_source_glsl430; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 266; - desc.fs.source = &fs_source_glsl430; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 41; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[5].glsl_name = "joints"; + desc.attrs[6].base_type = .FLOAT; + desc.attrs[6].glsl_name = "weights"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 266; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.attrs[5].name = "joints"; - desc.attrs[6].name = "weights"; - desc.vs.source = &vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 266; - desc.fs.source = &fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 41; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[5].glsl_name = "joints"; + desc.attrs[6].base_type = .FLOAT; + desc.attrs[6].glsl_name = "weights"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 266; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.attrs[2].sem_name = "TEXCOORD"; - desc.attrs[2].sem_index = 2; - desc.attrs[3].sem_name = "TEXCOORD"; - desc.attrs[3].sem_index = 3; - desc.attrs[4].sem_name = "TEXCOORD"; - desc.attrs[4].sem_index = 4; - desc.attrs[5].sem_name = "TEXCOORD"; - desc.attrs[5].sem_index = 5; - desc.attrs[6].sem_name = "TEXCOORD"; - desc.attrs[6].sem_index = 6; - desc.vs.source = &vs_source_hlsl4; - desc.vs.d3d11_target = "vs_4_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_hlsl4; - desc.fs.d3d11_target = "ps_4_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_hlsl4; + desc.vertex_func.d3d11_target = "vs_4_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_hlsl4; + desc.fragment_func.d3d11_target = "ps_4_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].hlsl_sem_name = "TEXCOORD"; + desc.attrs[3].hlsl_sem_index = 3; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].hlsl_sem_name = "TEXCOORD"; + desc.attrs[4].hlsl_sem_index = 4; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[5].hlsl_sem_name = "TEXCOORD"; + desc.attrs[5].hlsl_sem_index = 5; + desc.attrs[6].base_type = .FLOAT; + desc.attrs[6].hlsl_sem_name = "TEXCOORD"; + desc.attrs[6].hlsl_sem_index = 6; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].hlsl_register_t_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].hlsl_register_t_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].hlsl_register_s_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_MACOS => { - desc.vs.source = &vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_IOS => { - desc.vs.source = &vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_ios; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_ios; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_SIMULATOR => { - desc.vs.source = &vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_sim; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_sim; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .WGPU => { - desc.vs.source = &vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 656; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_wgsl; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_wgsl; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].wgsl_group0_binding_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 656; + desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].wgsl_group1_binding_n = 64; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].wgsl_group1_binding_n = 65; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].wgsl_group1_binding_n = 80; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, else => {}, } @@ -4368,225 +4451,204 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } return null; } -pub fn emissiveImageSlot(stage: sg.ShaderStage, img_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, img_name, "tex")) { - return 0; - } - if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 1; - } +pub fn emissiveImageSlot(img_name: []const u8) ?usize { + if (std.mem.eql(u8, img_name, "tex")) { + return 1; + } + if (std.mem.eql(u8, img_name, "tex_emissive")) { + return 2; } return null; } -pub fn emissiveSamplerSlot(stage: sg.ShaderStage, smp_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, smp_name, "smp")) { - return 0; - } +pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { + if (std.mem.eql(u8, smp_name, "smp")) { + return 1; } return null; } -pub fn emissiveUniformblockSlot(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return 0; - } +pub fn emissiveUniformblockSlot(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return 0; } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return 0; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return 1; } return null; } -pub fn emissiveUniformblockSize(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return @sizeOf(VsParams); - } +pub fn emissiveUniformblockSize(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return @sizeOf(VsParams); } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return @sizeOf(FsParams); - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return @sizeOf(FsParams); } return null; } -pub fn emissiveUniformOffset(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_color")) { - return 128; - } - if (std.mem.eql(u8, u_name, "u_joints")) { - return 144; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - return 4240; - } +pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_color")) { + return 128; + } + if (std.mem.eql(u8, u_name, "u_joints")) { + return 144; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + return 4240; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_cameraPos")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_color_override")) { - return 16; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - return 32; - } - if (std.mem.eql(u8, u_name, "u_ambient_light")) { - return 48; - } - if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_dir_light_color")) { - return 80; - } - if (std.mem.eql(u8, u_name, "u_num_point_lights")) { - return 96; - } - if (std.mem.eql(u8, u_name, "u_point_light_data")) { - return 112; - } - if (std.mem.eql(u8, u_name, "u_fog_data")) { - return 624; - } - if (std.mem.eql(u8, u_name, "u_fog_color")) { - return 640; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_cameraPos")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_color_override")) { + return 16; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + return 32; + } + if (std.mem.eql(u8, u_name, "u_ambient_light")) { + return 48; + } + if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_dir_light_color")) { + return 80; + } + if (std.mem.eql(u8, u_name, "u_num_point_lights")) { + return 96; + } + if (std.mem.eql(u8, u_name, "u_point_light_data")) { + return 112; + } + if (std.mem.eql(u8, u_name, "u_fog_data")) { + return 624; + } + if (std.mem.eql(u8, u_name, "u_fog_color")) { + return 640; } } return null; } -pub fn emissiveUniformDesc(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?sg.ShaderUniformDesc { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_projViewMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_modelMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_joints")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_joints"; - desc.type = .MAT4; - desc.array_count = 64; - return desc; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_tex_pan"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_projViewMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_modelMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_joints")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 64; + desc.glsl_name = "u_joints"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_tex_pan"; + return desc; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_cameraPos")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_cameraPos"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color_override"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_alpha_cutoff"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_ambient_light")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_ambient_light"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_dir_light_dir"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_dir_light_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_dir_light_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_num_point_lights")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_num_point_lights"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_point_light_data")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_point_light_data"; - desc.type = .FLOAT4; - desc.array_count = 32; - return desc; - } - if (std.mem.eql(u8, u_name, "u_fog_data")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_fog_data"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_fog_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_fog_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_cameraPos")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_cameraPos"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color_override")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color_override"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_alpha_cutoff"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_ambient_light")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_ambient_light"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_dir_light_dir"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_dir_light_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_dir_light_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_num_point_lights")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_num_point_lights"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_point_light_data")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 32; + desc.glsl_name = "u_point_light_data"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_fog_data")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_fog_data"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_fog_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_fog_color"; + return desc; } } return null; } -pub fn emissiveStoragebufferSlot(stage: sg.ShaderStage, sbuf_name: []const u8) ?usize { - _ = stage; +pub fn emissiveStoragebufferSlot(sbuf_name: []const u8) ?usize { _ = sbuf_name; return null; } diff --git a/src/framework/graphics/shaders/skinned.glsl.zig b/src/framework/graphics/shaders/skinned.glsl.zig index d2503521..af8c4081 100644 --- a/src/framework/graphics/shaders/skinned.glsl.zig +++ b/src/framework/graphics/shaders/skinned.glsl.zig @@ -13,54 +13,49 @@ const m = @import("../../math.zig"); // ========= // Shader program: 'emissive': // Get shader desc: shd.emissiveShaderDesc(sg.queryBackend()); -// Vertex shader: vs -// Attributes: -// ATTR_vs_pos => 0 -// ATTR_vs_color0 => 1 -// ATTR_vs_texcoord0 => 2 -// ATTR_vs_normals => 3 -// ATTR_vs_tangents => 4 -// ATTR_vs_joints => 5 -// ATTR_vs_weights => 6 -// Uniform block 'vs_params': -// Zig struct: VsParams -// Bind slot: SLOT_vs_params => 0 -// Fragment shader: fs -// Uniform block 'fs_params': -// Zig struct: FsParams -// Bind slot: SLOT_fs_params => 0 -// Image 'tex': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex => 0 -// Image 'tex_emissive': -// Image type: ._2D -// Sample type: .FLOAT -// Multisampled: false -// Bind slot: SLOT_tex_emissive => 1 -// Sampler 'smp': -// Type: .FILTERING -// Bind slot: SLOT_smp => 0 -// Image Sampler Pair 'tex_smp': -// Image: tex -// Sampler: smp -// Image Sampler Pair 'tex_emissive_smp': -// Image: tex_emissive -// Sampler: smp -// -pub const ATTR_vs_pos = 0; -pub const ATTR_vs_color0 = 1; -pub const ATTR_vs_texcoord0 = 2; -pub const ATTR_vs_normals = 3; -pub const ATTR_vs_tangents = 4; -pub const ATTR_vs_joints = 5; -pub const ATTR_vs_weights = 6; -pub const SLOT_vs_params = 0; -pub const SLOT_fs_params = 0; -pub const SLOT_tex = 0; -pub const SLOT_tex_emissive = 1; -pub const SLOT_smp = 0; +// Vertex Shader: vs +// Fragment Shader: fs +// Attributes: +// ATTR_emissive_pos => 0 +// ATTR_emissive_color0 => 1 +// ATTR_emissive_texcoord0 => 2 +// ATTR_emissive_normals => 3 +// ATTR_emissive_tangents => 4 +// ATTR_emissive_joints => 5 +// ATTR_emissive_weights => 6 +// Bindings: +// Uniform block 'vs_params': +// Zig struct: VsParams +// Bind slot: UB_vs_params => 0 +// Uniform block 'fs_params': +// Zig struct: FsParams +// Bind slot: UB_fs_params => 1 +// Image 'tex': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex => 1 +// Image 'tex_emissive': +// Image type: ._2D +// Sample type: .FLOAT +// Multisampled: false +// Bind slot: IMG_tex_emissive => 2 +// Sampler 'smp': +// Type: .FILTERING +// Bind slot: SMP_smp => 1 +// +pub const ATTR_emissive_pos = 0; +pub const ATTR_emissive_color0 = 1; +pub const ATTR_emissive_texcoord0 = 2; +pub const ATTR_emissive_normals = 3; +pub const ATTR_emissive_tangents = 4; +pub const ATTR_emissive_joints = 5; +pub const ATTR_emissive_weights = 6; +pub const UB_vs_params = 0; +pub const UB_fs_params = 1; +pub const IMG_tex = 1; +pub const IMG_tex_emissive = 2; +pub const SMP_smp = 1; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -221,8 +216,8 @@ const vs_source_glsl430 = [1715]u8 { // #version 430 // // uniform vec4 fs_params[2]; -// layout(binding = 0) uniform sampler2D tex_smp; -// layout(binding = 1) uniform sampler2D tex_emissive_smp; +// layout(binding = 16) uniform sampler2D tex_smp; +// layout(binding = 17) uniform sampler2D tex_emissive_smp; // // layout(location = 1) in vec2 uv; // layout(location = 0) in vec4 color; @@ -257,69 +252,69 @@ const vs_source_glsl430 = [1715]u8 { // } // // -const fs_source_glsl430 = [982]u8 { +const fs_source_glsl430 = [984]u8 { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62, - 0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x29,0x20,0x75,0x6e,0x69,0x66, - 0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65, - 0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,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,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x37,0x29,0x20,0x75,0x6e, + 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, + 0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,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,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,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,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,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x6e,0x6f,0x72, - 0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61, - 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63, - 0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e,0x74,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, - 0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x34,0x29,0x20, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6a,0x6f,0x69,0x6e,0x74,0x3b,0x0a,0x6c, - 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, - 0x20,0x35,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x77,0x65,0x69,0x67, - 0x68,0x74,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x38,0x20, - 0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d, - 0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d,0x20,0x5f,0x32,0x38, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32,0x38,0x2e,0x77,0x20, - 0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2e, - 0x78,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,0x76,0x65,0x63,0x34,0x20,0x5f,0x35,0x33,0x20,0x3d,0x20,0x74, - 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73, - 0x69,0x76,0x65,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x36,0x39,0x20,0x3d,0x20,0x63,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x37,0x36,0x20,0x3d,0x20,0x28, - 0x5f,0x36,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30,0x20,0x2d, - 0x20,0x6d,0x69,0x6e,0x28,0x28,0x5f,0x35,0x33,0x2e,0x78,0x20,0x2b,0x20,0x5f,0x35, - 0x33,0x2e,0x79,0x29,0x20,0x2b,0x20,0x5f,0x35,0x33,0x2e,0x7a,0x2c,0x20,0x31,0x2e, - 0x30,0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x35,0x33,0x2e,0x78,0x79,0x7a,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x31,0x39,0x20,0x3d,0x20, - 0x5f,0x36,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x39,0x2e,0x78,0x20, - 0x3d,0x20,0x5f,0x37,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x31, - 0x39,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x5f,0x31,0x31,0x39,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x7a,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x39,0x39,0x20,0x3d,0x20, - 0x28,0x5f,0x31,0x31,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30, - 0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e, - 0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76, - 0x65,0x63,0x34,0x20,0x5f,0x31,0x32,0x35,0x20,0x3d,0x20,0x5f,0x31,0x31,0x39,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x35,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x39, - 0x39,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x35,0x2e,0x79,0x20, - 0x3d,0x20,0x5f,0x39,0x39,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32, - 0x35,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x32,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x31,0x32,0x35, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x6e, + 0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, + 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76, + 0x65,0x63,0x34,0x20,0x74,0x61,0x6e,0x67,0x65,0x6e,0x74,0x3b,0x0a,0x6c,0x61,0x79, + 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x34, + 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6a,0x6f,0x69,0x6e,0x74,0x3b, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x35,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x77,0x65, + 0x69,0x67,0x68,0x74,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32, + 0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f, + 0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x20,0x3d,0x20,0x5f, + 0x32,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32,0x38,0x2e, + 0x77,0x20,0x3c,0x3d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31, + 0x5d,0x2e,0x78,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,0x76,0x65,0x63,0x34,0x20,0x5f,0x35,0x33,0x20,0x3d, + 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x65,0x6d,0x69, + 0x73,0x73,0x69,0x76,0x65,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x36,0x39,0x20,0x3d,0x20,0x63, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x37,0x36,0x20,0x3d, + 0x20,0x28,0x5f,0x36,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31,0x2e,0x30, + 0x20,0x2d,0x20,0x6d,0x69,0x6e,0x28,0x28,0x5f,0x35,0x33,0x2e,0x78,0x20,0x2b,0x20, + 0x5f,0x35,0x33,0x2e,0x79,0x29,0x20,0x2b,0x20,0x5f,0x35,0x33,0x2e,0x7a,0x2c,0x20, + 0x31,0x2e,0x30,0x29,0x29,0x29,0x20,0x2b,0x20,0x5f,0x35,0x33,0x2e,0x78,0x79,0x7a, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x31,0x39,0x20, + 0x3d,0x20,0x5f,0x36,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x31,0x39,0x2e, + 0x78,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, + 0x31,0x31,0x39,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e,0x79,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x5f,0x31,0x31,0x39,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x37,0x36,0x2e, + 0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x39,0x39,0x20, + 0x3d,0x20,0x28,0x5f,0x31,0x31,0x39,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x31, + 0x2e,0x30,0x20,0x2d,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30, + 0x5d,0x2e,0x77,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x66,0x73,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x32,0x35,0x20,0x3d,0x20,0x5f,0x31,0x31, + 0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x35,0x2e,0x78,0x20,0x3d,0x20, + 0x5f,0x39,0x39,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x31,0x32,0x35,0x2e, + 0x79,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, + 0x31,0x32,0x35,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x39,0x39,0x2e,0x7a,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x5f,0x31,0x32,0x35,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x5f,0x31, + 0x32,0x35,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; // // #version 300 es @@ -2174,17 +2169,17 @@ const vs_source_wgsl = [3281]u8 { // u_alpha_cutoff : f32, // } // -// @group(1) @binding(48) var tex : texture_2d; +// @group(1) @binding(64) var tex : texture_2d; // -// @group(1) @binding(64) var smp : sampler; +// @group(1) @binding(80) var smp : sampler; // // var uv : vec2f; // // var color : vec4f; // -// @group(0) @binding(4) var x_36 : fs_params; +// @group(0) @binding(8) var x_36 : fs_params; // -// @group(1) @binding(49) var tex_emissive : texture_2d; +// @group(1) @binding(65) var tex_emissive : texture_2d; // // var frag_color : vec4f; // @@ -2268,20 +2263,20 @@ const fs_source_wgsl = [2253]u8 { 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20, 0x20,0x75,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x63,0x75,0x74,0x6f,0x66,0x66,0x20, 0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70, - 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29, + 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29, 0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75, 0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72, 0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28, - 0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, + 0x38,0x30,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61, 0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76, 0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40, 0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e, - 0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, + 0x67,0x28,0x38,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, 0x3e,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, 0x6d,0x73,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40, - 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x39,0x29,0x20,0x76,0x61,0x72,0x20, + 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x35,0x29,0x20,0x76,0x61,0x72,0x20, 0x74,0x65,0x78,0x5f,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x20,0x3a,0x20,0x74, 0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a, 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72, @@ -2405,232 +2400,320 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.label = "emissive_shader"; switch (backend) { .GLCORE => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.attrs[5].name = "joints"; - desc.attrs[6].name = "weights"; - desc.vs.source = &vs_source_glsl430; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 266; - desc.fs.source = &fs_source_glsl430; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[5].glsl_name = "joints"; + desc.attrs[6].base_type = .FLOAT; + desc.attrs[6].glsl_name = "weights"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 266; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { - desc.attrs[0].name = "pos"; - desc.attrs[1].name = "color0"; - desc.attrs[2].name = "texcoord0"; - desc.attrs[3].name = "normals"; - desc.attrs[4].name = "tangents"; - desc.attrs[5].name = "joints"; - desc.attrs[6].name = "weights"; - desc.vs.source = &vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 266; - desc.fs.source = &fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 2; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; + desc.vertex_func.source = &vs_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].glsl_name = "pos"; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].glsl_name = "color0"; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].glsl_name = "texcoord0"; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].glsl_name = "normals"; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].glsl_name = "tangents"; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[5].glsl_name = "joints"; + desc.attrs[6].base_type = .FLOAT; + desc.attrs[6].glsl_name = "weights"; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 266; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; + desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; + desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].glsl_name = "tex_smp"; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.attrs[2].sem_name = "TEXCOORD"; - desc.attrs[2].sem_index = 2; - desc.attrs[3].sem_name = "TEXCOORD"; - desc.attrs[3].sem_index = 3; - desc.attrs[4].sem_name = "TEXCOORD"; - desc.attrs[4].sem_index = 4; - desc.attrs[5].sem_name = "TEXCOORD"; - desc.attrs[5].sem_index = 5; - desc.attrs[6].sem_name = "TEXCOORD"; - desc.attrs[6].sem_index = 6; - desc.vs.source = &vs_source_hlsl4; - desc.vs.d3d11_target = "vs_4_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_hlsl4; - desc.fs.d3d11_target = "ps_4_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_hlsl4; + desc.vertex_func.d3d11_target = "vs_4_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_hlsl4; + desc.fragment_func.d3d11_target = "ps_4_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[3].hlsl_sem_name = "TEXCOORD"; + desc.attrs[3].hlsl_sem_index = 3; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[4].hlsl_sem_name = "TEXCOORD"; + desc.attrs[4].hlsl_sem_index = 4; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[5].hlsl_sem_name = "TEXCOORD"; + desc.attrs[5].hlsl_sem_index = 5; + desc.attrs[6].base_type = .FLOAT; + desc.attrs[6].hlsl_sem_name = "TEXCOORD"; + desc.attrs[6].hlsl_sem_index = 6; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].hlsl_register_t_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].hlsl_register_t_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].hlsl_register_s_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_MACOS => { - desc.vs.source = &vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_IOS => { - desc.vs.source = &vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_ios; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_ios; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .METAL_SIMULATOR => { - desc.vs.source = &vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_metal_sim; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = &fs_source_metal_sim; + desc.fragment_func.entry = "main0"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].msl_texture_n = 0; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].msl_texture_n = 1; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].msl_sampler_n = 0; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, .WGPU => { - desc.vs.source = &vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 4256; - desc.vs.uniform_blocks[0].layout = .STD140; - desc.fs.source = &fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 32; - desc.fs.uniform_blocks[0].layout = .STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = ._2D; - desc.fs.images[0].sample_type = .FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = ._2D; - desc.fs.images[1].sample_type = .FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = .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[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; + desc.vertex_func.source = &vs_source_wgsl; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = &fs_source_wgsl; + desc.fragment_func.entry = "main"; + desc.attrs[0].base_type = .FLOAT; + desc.attrs[1].base_type = .FLOAT; + desc.attrs[2].base_type = .FLOAT; + desc.attrs[3].base_type = .FLOAT; + desc.attrs[4].base_type = .FLOAT; + desc.attrs[5].base_type = .FLOAT; + desc.attrs[6].base_type = .FLOAT; + desc.uniform_blocks[0].stage = .VERTEX; + desc.uniform_blocks[0].layout = .STD140; + desc.uniform_blocks[0].size = 4256; + desc.uniform_blocks[0].wgsl_group0_binding_n = 0; + desc.uniform_blocks[1].stage = .FRAGMENT; + desc.uniform_blocks[1].layout = .STD140; + desc.uniform_blocks[1].size = 32; + desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[1].stage = .FRAGMENT; + desc.images[1].multisampled = false; + desc.images[1].image_type = ._2D; + desc.images[1].sample_type = .FLOAT; + desc.images[1].wgsl_group1_binding_n = 64; + desc.images[2].stage = .FRAGMENT; + desc.images[2].multisampled = false; + desc.images[2].image_type = ._2D; + desc.images[2].sample_type = .FLOAT; + desc.images[2].wgsl_group1_binding_n = 65; + desc.samplers[1].stage = .FRAGMENT; + desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[1].wgsl_group1_binding_n = 80; + desc.image_sampler_pairs[0].stage = .FRAGMENT; + desc.image_sampler_pairs[0].image_slot = 1; + desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[1].stage = .FRAGMENT; + desc.image_sampler_pairs[1].image_slot = 2; + desc.image_sampler_pairs[1].sampler_slot = 1; }, else => {}, } @@ -2660,145 +2743,124 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } return null; } -pub fn emissiveImageSlot(stage: sg.ShaderStage, img_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, img_name, "tex")) { - return 0; - } - if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 1; - } +pub fn emissiveImageSlot(img_name: []const u8) ?usize { + if (std.mem.eql(u8, img_name, "tex")) { + return 1; + } + if (std.mem.eql(u8, img_name, "tex_emissive")) { + return 2; } return null; } -pub fn emissiveSamplerSlot(stage: sg.ShaderStage, smp_name: []const u8) ?usize { - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, smp_name, "smp")) { - return 0; - } +pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { + if (std.mem.eql(u8, smp_name, "smp")) { + return 1; } return null; } -pub fn emissiveUniformblockSlot(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return 0; - } +pub fn emissiveUniformblockSlot(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return 0; } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return 0; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return 1; } return null; } -pub fn emissiveUniformblockSize(stage: sg.ShaderStage, ub_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - return @sizeOf(VsParams); - } +pub fn emissiveUniformblockSize(ub_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + return @sizeOf(VsParams); } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - return @sizeOf(FsParams); - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + return @sizeOf(FsParams); } return null; } -pub fn emissiveUniformOffset(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?usize { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - return 64; - } - if (std.mem.eql(u8, u_name, "u_color")) { - return 128; - } - if (std.mem.eql(u8, u_name, "u_joints")) { - return 144; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - return 4240; - } +pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + return 64; + } + if (std.mem.eql(u8, u_name, "u_color")) { + return 128; + } + if (std.mem.eql(u8, u_name, "u_joints")) { + return 144; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + return 4240; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - return 0; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - return 16; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + return 0; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + return 16; } } return null; } -pub fn emissiveUniformDesc(stage: sg.ShaderStage, ub_name: []const u8, u_name: []const u8) ?sg.ShaderUniformDesc { - if (sg.ShaderStage.VS == stage) { - if (std.mem.eql(u8, ub_name, "vs_params")) { - if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_projViewMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_modelMatrix"; - desc.type = .MAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_joints")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_joints"; - desc.type = .MAT4; - desc.array_count = 64; - return desc; - } - if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_tex_pan"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { + if (std.mem.eql(u8, ub_name, "vs_params")) { + if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_projViewMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_modelMatrix")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 0; + desc.glsl_name = "u_modelMatrix"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_color")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_joints")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .MAT4; + desc.array_count = 64; + desc.glsl_name = "u_joints"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_tex_pan")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_tex_pan"; + return desc; } } - if (sg.ShaderStage.FS == stage) { - if (std.mem.eql(u8, ub_name, "fs_params")) { - if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_color_override"; - desc.type = .FLOAT4; - desc.array_count = 0; - return desc; - } - if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.ShaderUniformDesc = .{}; - desc.name = "u_alpha_cutoff"; - desc.type = .FLOAT; - desc.array_count = 0; - return desc; - } + if (std.mem.eql(u8, ub_name, "fs_params")) { + if (std.mem.eql(u8, u_name, "u_color_override")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT4; + desc.array_count = 0; + desc.glsl_name = "u_color_override"; + return desc; + } + if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { + var desc: sg.GlslShaderUniform = .{}; + desc.type = .FLOAT; + desc.array_count = 0; + desc.glsl_name = "u_alpha_cutoff"; + return desc; } } return null; } -pub fn emissiveStoragebufferSlot(stage: sg.ShaderStage, sbuf_name: []const u8) ?usize { - _ = stage; +pub fn emissiveStoragebufferSlot(sbuf_name: []const u8) ?usize { _ = sbuf_name; return null; } diff --git a/src/framework/graphics/skinned-mesh.zig b/src/framework/graphics/skinned-mesh.zig index d273a202..f511782c 100644 --- a/src/framework/graphics/skinned-mesh.zig +++ b/src/framework/graphics/skinned-mesh.zig @@ -527,15 +527,16 @@ pub fn sampleAnimation(comptime T: type, sampler: zmesh.io.zcgltf.AnimationSampl } } +// TODO check this /// Returns the index of the last sample less than `t`. fn stepInterpolation(samples: []const f32, t: f32) usize { std.debug.assert(samples.len > 0); const S = struct { - fn lessThan(_: void, lhs: f32, rhs: f32) bool { - return lhs < rhs; + fn compareF32(context: f32, item: f32) std.math.Order { + return std.math.order(context, item); } }; - const i = std.sort.lowerBound(f32, t, samples, {}, S.lessThan); + const i = std.sort.lowerBound(f32, samples, @as(f32, t), S.compareF32); return if (i > 0) i - 1 else 0; } diff --git a/src/framework/platform/backends/sokol/graphics.zig b/src/framework/platform/backends/sokol/graphics.zig index fa132155..e63a5fda 100644 --- a/src/framework/platform/backends/sokol/graphics.zig +++ b/src/framework/platform/backends/sokol/graphics.zig @@ -64,7 +64,10 @@ pub const BindingsImpl = struct { // maybe have a default material instead? const samplerDesc = convertFilterModeToSamplerDesc(.NEAREST); bindings.impl.default_sokol_sampler = sg.makeSampler(samplerDesc); - bindings.impl.sokol_bindings.?.fs.samplers[0] = bindings.impl.default_sokol_sampler; + // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code + // 1 because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=1) + // they start at 1 + bindings.impl.sokol_bindings.?.samplers[1] = bindings.impl.default_sokol_sampler; return bindings; } @@ -144,19 +147,28 @@ pub const BindingsImpl = struct { return; // set the texture to the default fragment shader image slot - self.impl.sokol_bindings.?.fs.images[0] = texture.sokol_image.?; + // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code + // 1 because in the glsl definitions we have only fs tex and they are annotated with layout(binding=1) + // they start at 1 + self.impl.sokol_bindings.?.images[1] = texture.sokol_image.?; } pub fn updateFromMaterial(self: *Bindings, material: *Material) void { for (0..material.state.textures.len) |i| { if (material.state.textures[i] != null) - self.impl.sokol_bindings.?.fs.images[i] = material.state.textures[i].?.sokol_image.?; + // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code + // + 1 because in the glsl definitions we have only fs tex and they are annotated with layout(binding=1) + // they start at 1 + self.impl.sokol_bindings.?.images[i + 1] = material.state.textures[i].?.sokol_image.?; } // bind samplers for (material.state.sokol_samplers, 0..) |sampler, i| { if (sampler) |s| - self.impl.sokol_bindings.?.fs.samplers[i] = s; + // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code + // + 1 because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=1) + // they start at 1 + self.impl.sokol_bindings.?.samplers[i + 1] = s; } // also set shader uniforms here? @@ -434,10 +446,10 @@ pub const ShaderImpl = struct { // fs images if (shader_program.fs.images) |imgs| { for (imgs) |img| { - desc.fs.images[img.slot].used = true; - desc.fs.images[img.slot].multisampled = stringBool(img.multisampled); - desc.fs.images[img.slot].image_type = stringImageTypeToSokolType(img.type); - desc.fs.images[img.slot].sample_type = stringImageSampleTypeToSokolType(img.sample_type); + desc.images[img.slot].used = true; + desc.images[img.slot].multisampled = stringBool(img.multisampled); + desc.images[img.slot].image_type = stringImageTypeToSokolType(img.type); + desc.images[img.slot].sample_type = stringImageSampleTypeToSokolType(img.sample_type); try fs_images_hashmap.put(img.name, img.slot); } } @@ -454,18 +466,18 @@ pub const ShaderImpl = struct { // fs sampler pairs if (shader_program.fs.image_sampler_pairs) |pairs| { for (pairs) |pair| { - desc.fs.image_sampler_pairs[pair.slot].used = true; - desc.fs.image_sampler_pairs[pair.slot].image_slot = @intCast(pair.slot); - desc.fs.image_sampler_pairs[pair.slot].sampler_slot = @intCast(pair.slot); + desc.image_sampler_pairs[pair.slot].used = true; + desc.image_sampler_pairs[pair.slot].image_slot = @intCast(pair.slot); + desc.image_sampler_pairs[pair.slot].sampler_slot = @intCast(pair.slot); } } // vs sampler pairs if (shader_program.fs.image_sampler_pairs) |pairs| { for (pairs) |pair| { - desc.fs.image_sampler_pairs[pair.slot].used = true; - desc.fs.image_sampler_pairs[pair.slot].image_slot = @intCast(fs_images_hashmap.get(pair.image_name).?); - desc.fs.image_sampler_pairs[pair.slot].sampler_slot = @intCast(fs_samplers_hashmap.get(pair.sampler_name).?); + desc.image_sampler_pairs[pair.slot].used = true; + desc.image_sampler_pairs[pair.slot].image_slot = @intCast(fs_images_hashmap.get(pair.image_name).?); + desc.image_sampler_pairs[pair.slot].sampler_slot = @intCast(fs_samplers_hashmap.get(pair.sampler_name).?); } } @@ -498,12 +510,12 @@ pub const ShaderImpl = struct { /// Find the shader function in the builtin that can actually make the ShaderDesc fn getBuiltinSokolCreateFunction(comptime builtin: anytype) ?fn (sg.Backend) sg.ShaderDesc { comptime { - const decls = @typeInfo(builtin).Struct.decls; + const decls = @typeInfo(builtin).@"struct".decls; for (decls) |d| { const field = @field(builtin, d.name); const field_type = @typeInfo(@TypeOf(field)); - if (field_type == .Fn) { - const fn_info = field_type.Fn; + if (field_type == .@"fn") { + const fn_info = field_type.@"fn"; if (fn_info.return_type == sg.ShaderDesc) { return field; } @@ -561,9 +573,10 @@ pub const ShaderImpl = struct { debug.info("Creating shader: {d}", .{graphics.next_shader_handle}); const shader = sg.makeShader(shader_desc); + // TODO check this var num_fs_images: u8 = 0; for (0..5) |i| { - if (shader_desc.fs.images[i].used) { + if (shader_desc.images[i].stage == sg.ShaderStage.FRAGMENT) { num_fs_images += 1; } else { break; @@ -629,14 +642,16 @@ pub const ShaderImpl = struct { } // apply uniform blocks - for (self.vs_uniformblock_data, 0..) |block, i| { + for (self.vs_uniformblock_data) |block| { if (block) |b| - sg.applyUniforms(.VS, @intCast(i), sg.Range{ .ptr = b.ptr, .size = b.size }); + // sg_apply_uniforms(0, &SG_RANGE(vs_params)); + sg.applyUniforms(0, sg.Range{ .ptr = b.ptr, .size = b.size }); } - for (self.fs_uniformblock_data, 0..) |block, i| { + for (self.fs_uniformblock_data) |block| { if (block) |b| - sg.applyUniforms(.FS, @intCast(i), sg.Range{ .ptr = b.ptr, .size = b.size }); + // sg_apply_uniforms(1, &SG_RANGE(fs_params)); + sg.applyUniforms(1, sg.Range{ .ptr = b.ptr, .size = b.size }); } return true; diff --git a/src/framework/platform/graphics.zig b/src/framework/platform/graphics.zig index 89f96ced..a28ddff0 100644 --- a/src/framework/platform/graphics.zig +++ b/src/framework/platform/graphics.zig @@ -1342,14 +1342,14 @@ fn convertFilterModeToSamplerDesc(filter: FilterMode) sg.SamplerDesc { pub fn asAnything(val: anytype) Anything { const type_info = @typeInfo(@TypeOf(val)); switch (type_info) { - .Pointer => { - switch (type_info.Pointer.size) { - .One => return .{ .ptr = val, .size = @sizeOf(type_info.Pointer.child) }, - .Slice => return .{ .ptr = val.ptr, .size = @sizeOf(type_info.Pointer.child) * val.len }, + .pointer => { + switch (type_info.pointer.size) { + .one => return .{ .ptr = val, .size = @sizeOf(type_info.pointer.child) }, + .slice => return .{ .ptr = val.ptr, .size = @sizeOf(type_info.pointer.child) * val.len }, else => @compileError("FIXME: Pointer type!"), } }, - .Struct, .Array => { + .@"struct", .array => { @compileError("Structs and arrays must be passed as pointers to asAnything"); }, else => { diff --git a/src/framework/scripting/lua.zig b/src/framework/scripting/lua.zig index 754742b7..71cf143d 100644 --- a/src/framework/scripting/lua.zig +++ b/src/framework/scripting/lua.zig @@ -1,9 +1,9 @@ -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const std = @import("std"); const debug = @import("../debug.zig"); const mem = @import("../mem.zig"); -const Lua = ziglua.Lua; +const Lua = zlua.Lua; // Allocator for the Lua VM var lua_arena: std.heap.ArenaAllocator = undefined; @@ -25,7 +25,7 @@ pub fn init() !void { lua_allocator = lua_arena.allocator(); // Initialize the Lua VM! - lua = try Lua.init(&lua_allocator); + lua = try Lua.init(lua_allocator); // Turn on to get lua debug output if (enable_debug_logging) @@ -75,15 +75,15 @@ pub fn runLine(lua_string: [:0]const u8) !void { }; // Execute the new line - lua.protectedCall(0, 0, 0) catch |err| { + lua.protectedCall(.{ .args = 0 }) catch |err| { debug.log("{s}", .{try lua.toString(-1)}); lua.pop(1); return err; }; } -pub fn openModule(comptime name: [:0]const u8, comptime open_func: ziglua.ZigFn) void { - lua.requireF(name, ziglua.wrap(open_func), true); +pub fn openModule(comptime name: [:0]const u8, comptime open_func: zlua.ZigFn) void { + lua.requireF(name, zlua.wrap(open_func), true); debug.log("Lua: registered module '{s}'", .{name}); } @@ -107,7 +107,7 @@ pub fn callFunction(func_name: [:0]const u8) !void { return; } - lua.protectedCall(0, 0, 0) catch |err| { + lua.protectedCall(.{ .args = 0 }) catch |err| { debug.log("Lua: error calling func {s}: {!s} {}", .{ func_name, lua.toString(-1), err }); lua.pop(1); return err; @@ -117,7 +117,7 @@ pub fn callFunction(func_name: [:0]const u8) !void { pub fn setDebugHook() void { // create a debug hook to print state const hook = struct { - fn inner(l: *Lua, event: ziglua.Event, i: *ziglua.DebugInfo) void { + fn inner(l: *Lua, event: zlua.Event, i: *zlua.DebugInfo) void { const type_name = switch (event) { .call => "call", .line => "line", @@ -135,7 +135,7 @@ pub fn setDebugHook() void { } }.inner; - lua.setHook(ziglua.wrap(hook), .{ .call = true, .line = true, .ret = true }, 0); + lua.setHook(zlua.wrap(hook), .{ .call = true, .line = true, .ret = true }, 0); } fn printDebug() void { diff --git a/src/framework/scripting/manager.zig b/src/framework/scripting/manager.zig index 94bd345f..c7a43311 100644 --- a/src/framework/scripting/manager.zig +++ b/src/framework/scripting/manager.zig @@ -3,27 +3,28 @@ const fmt = @import("fmt"); const debug = @import("../debug.zig"); const lua_util = @import("lua.zig"); const modules = @import("../modules.zig"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); -const Lua = ziglua.Lua; +const Lua = zlua.Lua; pub const ScriptFn = struct { name: [*:0]const u8, - luaFn: ziglua.FnReg, + luaFn: zlua.FnReg, }; pub fn init() !void { // Start lua try lua_util.init(); + // TODO fix this // Bind all the libraries using some meta programming magic at compile time - try bindZigLibrary("assets", @import("../api/assets.zig")); - try bindZigLibrary("display", @import("../api/display.zig")); - try bindZigLibrary("draw", @import("../api/draw.zig")); - try bindZigLibrary("text", @import("../api/text.zig")); - try bindZigLibrary("graphics", @import("../api/graphics.zig")); - try bindZigLibrary("input.mouse", @import("../api/mouse.zig")); - try bindZigLibrary("input.keyboard", @import("../api/keyboard.zig")); + // try bindZigLibrary("assets", @import("../api/assets.zig")); + // try bindZigLibrary("display", @import("../api/display.zig")); + // try bindZigLibrary("draw", @import("../api/draw.zig")); + // try bindZigLibrary("text", @import("../api/text.zig")); + // try bindZigLibrary("graphics", @import("../api/graphics.zig")); + // try bindZigLibrary("input.mouse", @import("../api/mouse.zig")); + // try bindZigLibrary("input.keyboard", @import("../api/keyboard.zig")); } pub fn deinit() void { @@ -39,14 +40,15 @@ fn isModuleFunction(comptime name: [:0]const u8, comptime in_type: anytype) bool if (name[0] == '_') return false; - return @typeInfo(in_type) == .Fn; + return @typeInfo(in_type) == .@"fn"; } fn findLibraryFunctions(comptime module: anytype) []const ScriptFn { comptime { + const info = @typeInfo(module); // Get all the public declarations in this module - const decls = @typeInfo(module).Struct.decls; - + const decls = info.@"struct".decls; + @compileLog(@typeName(@TypeOf(module))); // filter out only the public functions var gen_fields: []const std.builtin.Type.Declaration = &[_]std.builtin.Type.Declaration{}; for (decls) |d| { @@ -115,7 +117,7 @@ fn bindLibrary(comptime name: [:0]const u8, comptime funcs: []const ScriptFn) vo fn makeLuaOpenLibFn(comptime funcs: []const ScriptFn) fn (*Lua) i32 { return opaque { pub fn inner(lua: *Lua) i32 { - var lib_funcs: [funcs.len]ziglua.FnReg = undefined; + var lib_funcs: [funcs.len]zlua.FnReg = undefined; inline for (funcs, 0..) |f, i| { lib_funcs[i] = f.luaFn; @@ -127,8 +129,8 @@ fn makeLuaOpenLibFn(comptime funcs: []const ScriptFn) fn (*Lua) i32 { }.inner; } -fn makeLuaBinding(name: [:0]const u8, comptime function: anytype) ziglua.FnReg { - return ziglua.FnReg{ .name = name, .func = ziglua.wrap(bindFuncLua(function)) }; +fn makeLuaBinding(name: [:0]const u8, comptime function: anytype) zlua.FnReg { + return zlua.FnReg{ .name = name, .func = zlua.wrap(bindFuncLua(function)) }; } fn bindFuncLua(comptime function: anytype) fn (lua: *Lua) i32 { @@ -138,7 +140,7 @@ fn bindFuncLua(comptime function: anytype) fn (lua: *Lua) i32 { const ArgsTuple = std.meta.ArgsTuple(@TypeOf(function)); var args: ArgsTuple = undefined; - const fn_info = @typeInfo(@TypeOf(function)).Fn; + const fn_info = @typeInfo(@TypeOf(function)).@"fn"; const params = fn_info.params; inline for (params, 0..) |param, i| { diff --git a/src/framework/spatial/orientedboundingbox.zig b/src/framework/spatial/orientedboundingbox.zig index 1b64b137..b1d48ae0 100644 --- a/src/framework/spatial/orientedboundingbox.zig +++ b/src/framework/spatial/orientedboundingbox.zig @@ -17,7 +17,7 @@ pub const OrientedBoundingBox = struct { min: Vec3, max: Vec3, center: Vec3, - transform: Mat4 = math.Mat4.identity, + transform_matrix: Mat4 = math.Mat4.identity, // transformed axes and vertex positions will get cached on update vertices: [8]Vec3 = undefined, @@ -30,7 +30,7 @@ pub const OrientedBoundingBox = struct { .center = position, .min = position.sub(half_size), .max = position.add(half_size), - .transform = transform_matrix, + .transform_matrix = transform_matrix, }; ret.update(); @@ -76,7 +76,7 @@ pub const OrientedBoundingBox = struct { /// Transforms this bounding box by a matrix pub fn transform(self: *const OrientedBoundingBox, transform_mat: math.Mat4) OrientedBoundingBox { var ret = self.*; - ret.transform = self.transform.mul(transform_mat); + ret.transform_matrix = self.transform_matrix.mul(transform_mat); ret.update(); return ret; } @@ -174,14 +174,14 @@ pub const OrientedBoundingBox = struct { /// Returns locations of all the corners pub fn getCorners(self: *const OrientedBoundingBox) [8]Vec3 { return [8]Vec3{ - Vec3.new(self.min.x, self.max.y, self.min.z).mulMat4(self.transform), - Vec3.new(self.max.x, self.max.y, self.max.z).mulMat4(self.transform), - Vec3.new(self.max.x, self.max.y, self.min.z).mulMat4(self.transform), - Vec3.new(self.min.x, self.max.y, self.max.z).mulMat4(self.transform), - Vec3.new(self.min.x, self.min.y, self.min.z).mulMat4(self.transform), - Vec3.new(self.max.x, self.min.y, self.max.z).mulMat4(self.transform), - Vec3.new(self.max.x, self.min.y, self.min.z).mulMat4(self.transform), - Vec3.new(self.min.x, self.min.y, self.max.z).mulMat4(self.transform), + Vec3.new(self.min.x, self.max.y, self.min.z).mulMat4(self.transform_matrix), + Vec3.new(self.max.x, self.max.y, self.max.z).mulMat4(self.transform_matrix), + Vec3.new(self.max.x, self.max.y, self.min.z).mulMat4(self.transform_matrix), + Vec3.new(self.min.x, self.max.y, self.max.z).mulMat4(self.transform_matrix), + Vec3.new(self.min.x, self.min.y, self.min.z).mulMat4(self.transform_matrix), + Vec3.new(self.max.x, self.min.y, self.max.z).mulMat4(self.transform_matrix), + Vec3.new(self.max.x, self.min.y, self.min.z).mulMat4(self.transform_matrix), + Vec3.new(self.min.x, self.min.y, self.max.z).mulMat4(self.transform_matrix), }; } @@ -189,12 +189,12 @@ pub const OrientedBoundingBox = struct { pub fn getPlanes(self: *const OrientedBoundingBox) [6]Plane { const axes = self.getAxes(); return [6]Plane{ - Plane.init(axes[0], Vec3.new(self.max.x, self.center.y, self.center.z).mulMat4(self.transform)), - Plane.init(axes[0].scale(-1.0), Vec3.new(self.min.x, self.center.y, self.center.z).mulMat4(self.transform)), - Plane.init(axes[1], Vec3.new(self.center.x, self.max.y, self.center.z).mulMat4(self.transform)), - Plane.init(axes[1].scale(-1.0), Vec3.new(self.center.x, self.min.y, self.center.z).mulMat4(self.transform)), - Plane.init(axes[2], Vec3.new(self.center.x, self.center.y, self.max.z).mulMat4(self.transform)), - Plane.init(axes[2].scale(-1.0), Vec3.new(self.center.x, self.center.y, self.min.z).mulMat4(self.transform)), + Plane.init(axes[0], Vec3.new(self.max.x, self.center.y, self.center.z).mulMat4(self.transform_matrix)), + Plane.init(axes[0].scale(-1.0), Vec3.new(self.min.x, self.center.y, self.center.z).mulMat4(self.transform_matrix)), + Plane.init(axes[1], Vec3.new(self.center.x, self.max.y, self.center.z).mulMat4(self.transform_matrix)), + Plane.init(axes[1].scale(-1.0), Vec3.new(self.center.x, self.min.y, self.center.z).mulMat4(self.transform_matrix)), + Plane.init(axes[2], Vec3.new(self.center.x, self.center.y, self.max.z).mulMat4(self.transform_matrix)), + Plane.init(axes[2].scale(-1.0), Vec3.new(self.center.x, self.center.y, self.min.z).mulMat4(self.transform_matrix)), }; } @@ -213,22 +213,22 @@ pub const OrientedBoundingBox = struct { /// Get the X, Y, and Z normals transformed by our transform matrix pub fn getAxes(self: *const OrientedBoundingBox) [3]Vec3 { return [_]Vec3{ - Vec3.new(self.transform.m[0][0], self.transform.m[0][1], self.transform.m[0][2]).norm(), - Vec3.new(self.transform.m[1][0], self.transform.m[1][1], self.transform.m[1][2]).norm(), - Vec3.new(self.transform.m[2][0], self.transform.m[2][1], self.transform.m[2][2]).norm(), + Vec3.new(self.transform_matrix.m[0][0], self.transform_matrix.m[0][1], self.transform_matrix.m[0][2]).norm(), + Vec3.new(self.transform_matrix.m[1][0], self.transform_matrix.m[1][1], self.transform_matrix.m[1][2]).norm(), + Vec3.new(self.transform_matrix.m[2][0], self.transform_matrix.m[2][1], self.transform_matrix.m[2][2]).norm(), }; } /// Check to see if this bounding box contains a point pub fn contains(self: *const OrientedBoundingBox, point: Vec3) bool { - const p = point.mulMat4(self.transform.invert()); + const p = point.mulMat4(self.transform_matrix.invert()); return p.x >= self.min.x and p.y >= self.min.y and p.z >= self.min.z and p.x <= self.max.x and p.y <= self.max.y and p.z <= self.max.z; } /// Check to see if this bounding box completely encloses another pub fn containsOBB(self: *const OrientedBoundingBox, other: OrientedBoundingBox) bool { - const inverse_transform = self.transform.invert(); + const inverse_transform = self.transform_matrix.invert(); for (other.vertices) |point| { const p = point.mulMat4(inverse_transform); const in = p.x >= self.min.x and p.y >= self.min.y and p.z >= self.min.z and @@ -241,7 +241,7 @@ pub const OrientedBoundingBox = struct { } pub fn containsAABB(self: *const OrientedBoundingBox, other: BoundingBox) bool { - const inverse_transform = self.transform.invert(); + const inverse_transform = self.transform_matrix.invert(); for (other.getCorners()) |point| { const p = point.mulMat4(inverse_transform); const in = p.x >= self.min.x and p.y >= self.min.y and p.z >= self.min.z and diff --git a/src/framework/spatial/rays.zig b/src/framework/spatial/rays.zig index 38e6257d..7c307d86 100644 --- a/src/framework/spatial/rays.zig +++ b/src/framework/spatial/rays.zig @@ -100,7 +100,7 @@ pub const Ray = struct { } // we should probably be caching this in the oriented bounding box - const inv_transform = bounds.transform.invert(); + const inv_transform = bounds.transform_matrix.invert(); // get a point pointing down our direction const downrange = self.pos.add(self.dir); @@ -123,7 +123,7 @@ pub const Ray = struct { if (intersection) |i| { const h = i.hit_pos; if (h.y <= bounds.max.y and h.y >= bounds.min.y and h.z <= bounds.max.z and h.z >= bounds.min.z) { - return .{ .hit_pos = h.mulMat4(bounds.transform), .normal = p.normal }; + return .{ .hit_pos = h.mulMat4(bounds.transform_matrix), .normal = p.normal }; } } } @@ -135,7 +135,7 @@ pub const Ray = struct { if (intersection) |i| { const h = i.hit_pos; if (h.x <= bounds.max.x and h.x >= bounds.min.x and h.z <= bounds.max.z and h.z >= bounds.min.z) { - return .{ .hit_pos = h.mulMat4(bounds.transform), .normal = p.normal }; + return .{ .hit_pos = h.mulMat4(bounds.transform_matrix), .normal = p.normal }; } } } @@ -147,7 +147,7 @@ pub const Ray = struct { if (intersection) |i| { const h = i.hit_pos; if (h.y <= bounds.max.y and h.y >= bounds.min.y and h.x <= bounds.max.x and h.x >= bounds.min.x) { - return .{ .hit_pos = h.mulMat4(bounds.transform), .normal = p.normal }; + return .{ .hit_pos = h.mulMat4(bounds.transform_matrix), .normal = p.normal }; } } } diff --git a/src/framework/utils/quakemap.zig b/src/framework/utils/quakemap.zig index 816f01ee..704330ad 100644 --- a/src/framework/utils/quakemap.zig +++ b/src/framework/utils/quakemap.zig @@ -549,7 +549,7 @@ pub const QuakeMap = struct { var worldspawn: ?Entity = null; var entities = std.ArrayList(Entity).init(allocator); - var iter = std.mem.tokenize(u8, data, "\r\n"); + var iter = std.mem.tokenizeAny(u8, data, "\r\n"); errdefer { for (entities.items) |*e| { diff --git a/tools/run-shdc.sh b/tools/run-shdc.sh new file mode 100755 index 00000000..a54bb576 --- /dev/null +++ b/tools/run-shdc.sh @@ -0,0 +1,3 @@ +for shader in basic-lighting default-mesh default emissive skinned-basic-lighting skinned; do + tools/sokol-shdc -i assets/shaders/$shader.glsl -o src/framework/graphics/shaders/$shader.glsl.zig -l glsl300es:glsl430:wgsl:metal_macos:metal_ios:metal_sim:hlsl4 -f sokol_zig --reflection +done \ No newline at end of file From 59ed4a9fcf9a18c2802859fcdedb2f5bb89f14d9 Mon Sep 17 00:00:00 2001 From: Nico Gallinal Date: Mon, 7 Apr 2025 12:04:36 -0300 Subject: [PATCH 2/6] remove local cimgui --- 3rdparty/cimgui/build.zig | 66 ----------------------------------- 3rdparty/cimgui/build.zig.zon | 18 ---------- 2 files changed, 84 deletions(-) delete mode 100644 3rdparty/cimgui/build.zig delete mode 100644 3rdparty/cimgui/build.zig.zon diff --git a/3rdparty/cimgui/build.zig b/3rdparty/cimgui/build.zig deleted file mode 100644 index c7c8f39d..00000000 --- a/3rdparty/cimgui/build.zig +++ /dev/null @@ -1,66 +0,0 @@ -const std = @import("std"); -const builtin = @import("builtin"); - -pub fn build(b: *std.Build) void { - const target = b.standardTargetOptions(.{}); - const optimize = b.standardOptimizeOption(.{}); - - const dep_cimgui = b.dependency("cimgui", .{}); - const dep_imgui = b.dependency("imgui", .{}); - - // create file tree for cimgui and imgui - const wf = b.addNamedWriteFiles("cimgui"); - _ = wf.addCopyDirectory(dep_cimgui.path(""), "", .{}); - _ = wf.addCopyDirectory(dep_imgui.path(""), "imgui", .{}); - const root = wf.getDirectory(); - - // build cimgui as C/C++ library - const lib_cimgui = b.addStaticLibrary(.{ - .name = "cimgui_clib", - .target = target, - .optimize = optimize, - .link_libc = true, - }); - lib_cimgui.linkLibCpp(); - lib_cimgui.addCSourceFiles(.{ - .root = root, - .files = &.{ - b.pathJoin(&.{"cimgui.cpp"}), - b.pathJoin(&.{ "imgui", "imgui.cpp" }), - b.pathJoin(&.{ "imgui", "imgui_widgets.cpp" }), - b.pathJoin(&.{ "imgui", "imgui_draw.cpp" }), - b.pathJoin(&.{ "imgui", "imgui_tables.cpp" }), - b.pathJoin(&.{ "imgui", "imgui_demo.cpp" }), - }, - }); - lib_cimgui.addIncludePath(root); - - // make cimgui available as artifact, this then allows to inject - // the Emscripten include path in another build.zig - b.installArtifact(lib_cimgui); - - // lib compilation depends on file tree - lib_cimgui.step.dependOn(&wf.step); - - // translate-c the cimgui.h file - // NOTE: always run this with the host target, that way we don't need to inject - // the Emscripten SDK include path into the translate-C step when building for WASM - const cimgui_h = dep_cimgui.path("cimgui.h"); - const translateC = b.addTranslateC(.{ - .root_source_file = cimgui_h, - .target = b.graph.host, - .optimize = optimize, - }); - translateC.defineCMacroRaw("CIMGUI_DEFINE_ENUMS_AND_STRUCTS=\"\""); - const entrypoint = translateC.getOutput(); - - // build cimgui as a module with the header file as the entrypoint - const mod_cimgui = b.addModule("cimgui", .{ - .root_source_file = entrypoint, - .target = target, - .optimize = optimize, - .link_libc = true, - .link_libcpp = true, - }); - mod_cimgui.linkLibrary(lib_cimgui); -} diff --git a/3rdparty/cimgui/build.zig.zon b/3rdparty/cimgui/build.zig.zon deleted file mode 100644 index aa9450d5..00000000 --- a/3rdparty/cimgui/build.zig.zon +++ /dev/null @@ -1,18 +0,0 @@ -.{ - .name = "cimgui", - .version = "0.0.0", - - .dependencies = .{ - .cimgui = .{ - .url = "git+https://github.com/floooh/dcimgui.git#3969c14f7c7abda0e4b59d2616b17b7fb9eb0827", - .hash = "cimgui-0.1.0-44ClkTt5hgBU8BelH8W_G8mso3ys_hrqNUWwJvaxXDs5", - }, - // .imgui = .{ - // .url = "git+https://github.com/ocornut/imgui.git#v1.90.7", - // .hash = "122072b125179c7cbdbbee8fa81d22a1050a950ad61cfeefee8dc0dca5423b5d05b9", - // }, - }, - .paths = .{ - "", - }, -} From 4ca2c9dfc27039e0009276d66699090f57246a09 Mon Sep 17 00:00:00 2001 From: Nico Gallinal Date: Mon, 7 Apr 2025 12:04:55 -0300 Subject: [PATCH 3/6] add readme for tools --- tools/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/README.md diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 00000000..ed34aaa2 --- /dev/null +++ b/tools/README.md @@ -0,0 +1 @@ +Download sokol-shdc from https://github.com/floooh/sokol-tools-bin/tree/bindings-cleanup \ No newline at end of file From 31cbc982bf102293a4060bc7d2c5758a69c1413f Mon Sep 17 00:00:00 2001 From: Nico Gallinal Date: Mon, 7 Apr 2025 12:48:47 -0300 Subject: [PATCH 4/6] make lua work again --- build.zig.zon | 5 ----- src/framework/api/assets.zig | 2 +- src/framework/api/display.zig | 8 +++----- src/framework/api/draw.zig | 2 +- src/framework/api/graphics.zig | 2 +- src/framework/api/keyboard.zig | 4 ++-- src/framework/api/mouse.zig | 4 ++-- src/framework/api/text.zig | 2 +- src/framework/scripting/lua.zig | 2 +- src/framework/scripting/manager.zig | 19 ++++++++----------- 10 files changed, 20 insertions(+), 30 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 391bbec6..4fb502ce 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -15,11 +15,6 @@ .url = "git+https://github.com/natecraddock/ziglua#891945ef9c2bffcd06050c4836d414428ed7d95a", .hash = "zlua-0.1.0-hGRpC2rgBACFhBjc9s9dGN37ZaTu7rNVZZqduwitv4O7", }, - // // needed because Lua is a lazy dependency inside of ziglua - // .lua54 = .{ - // .url = "https://www.lua.org/ftp/lua-5.4.6.tar.gz", - // .hash = "1220f93ada1fa077ab096bf88a5b159ad421dbf6a478edec78ddb186d0c21d3476d9", - // }, .sokol = .{ .url = "git+https://github.com/floooh/sokol-zig.git#d8c1205a4dd9ad28da411f998102ce520cdef6bc", .hash = "sokol-0.1.0-pb1HK5mGLABB7_Vt66xb8nbn8sJN_ULvd4v0wg8WypJ_", diff --git a/src/framework/api/assets.zig b/src/framework/api/assets.zig index 69a6d82b..853a340b 100644 --- a/src/framework/api/assets.zig +++ b/src/framework/api/assets.zig @@ -1,6 +1,6 @@ const std = @import("std"); const math = std.math; -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const debug = @import("../debug.zig"); const images = @import("../images.zig"); const graphics = @import("../platform/graphics.zig"); diff --git a/src/framework/api/display.zig b/src/framework/api/display.zig index 342afa3c..84c5e9b9 100644 --- a/src/framework/api/display.zig +++ b/src/framework/api/display.zig @@ -1,17 +1,15 @@ const std = @import("std"); const fmt = @import("fmt"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const debug = @import("../debug.zig"); var enable_debug_logging = false; -pub var test_me: bool = true; - pub fn set_resolution(res_x: i32, res_y: i32) void { // var scale_x: f32 = 1.0; // var scale_y: f32 = 1.0; - debug.log("set resolution: {d}x{d}", .{res_x, res_y}); + debug.log("set resolution: {d}x{d}", .{ res_x, res_y }); // _ = sdl.SDL_RenderGetScale(zigsdl.getRenderer(), &scale_x, &scale_y); // res_x *= @intFromFloat(scale_x); @@ -39,5 +37,5 @@ pub fn set_resolution(res_x: i32, res_y: i32) void { // } pub fn set_size(one: i32, two: i32) void { - debug.log("Set size: {d}x{d}", .{one, two}); + debug.log("Set size: {d}x{d}", .{ one, two }); } diff --git a/src/framework/api/draw.zig b/src/framework/api/draw.zig index 9ed8eca5..3bf3c4ab 100644 --- a/src/framework/api/draw.zig +++ b/src/framework/api/draw.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const app = @import("../app.zig"); const papp = @import("../platform/app.zig"); const debug = @import("../debug.zig"); diff --git a/src/framework/api/graphics.zig b/src/framework/api/graphics.zig index d93c58b2..f4e86532 100644 --- a/src/framework/api/graphics.zig +++ b/src/framework/api/graphics.zig @@ -1,6 +1,6 @@ const std = @import("std"); const math = @import("../math.zig"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const papp = @import("../platform/app.zig"); const debug = @import("../debug.zig"); const colors = @import("../colors.zig"); diff --git a/src/framework/api/keyboard.zig b/src/framework/api/keyboard.zig index 43804ef1..046f521d 100644 --- a/src/framework/api/keyboard.zig +++ b/src/framework/api/keyboard.zig @@ -1,8 +1,8 @@ const std = @import("std"); const debug = @import("../debug.zig"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const input = @import("../platform/input.zig"); pub fn key(key_idx: usize) bool { - return input.isKeyPressed(@enumFromInt(key_idx)); + return input.isKeyPressed(@enumFromInt(key_idx)); } diff --git a/src/framework/api/mouse.zig b/src/framework/api/mouse.zig index c19c96cd..4d338303 100644 --- a/src/framework/api/mouse.zig +++ b/src/framework/api/mouse.zig @@ -1,10 +1,10 @@ const std = @import("std"); -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const input = @import("../platform/input.zig"); const Tuple = std.meta.Tuple; // Get Mouse Position -pub fn position() Tuple(&.{f32, f32}) { +pub fn position() Tuple(&.{ f32, f32 }) { const mouse_pos = input.getMousePosition(); return .{ mouse_pos.x, mouse_pos.y }; } diff --git a/src/framework/api/text.zig b/src/framework/api/text.zig index 4dfae561..93fbb400 100644 --- a/src/framework/api/text.zig +++ b/src/framework/api/text.zig @@ -1,6 +1,6 @@ const std = @import("std"); const math = std.math; -const ziglua = @import("ziglua"); +const zlua = @import("zlua"); const app = @import("../app.zig"); const colors = @import("../colors.zig"); const images = @import("../images.zig"); diff --git a/src/framework/scripting/lua.zig b/src/framework/scripting/lua.zig index 71cf143d..b6b6d1ba 100644 --- a/src/framework/scripting/lua.zig +++ b/src/framework/scripting/lua.zig @@ -82,7 +82,7 @@ pub fn runLine(lua_string: [:0]const u8) !void { }; } -pub fn openModule(comptime name: [:0]const u8, comptime open_func: zlua.ZigFn) void { +pub fn openModule(comptime name: [:0]const u8, comptime open_func: anytype) void { lua.requireF(name, zlua.wrap(open_func), true); debug.log("Lua: registered module '{s}'", .{name}); } diff --git a/src/framework/scripting/manager.zig b/src/framework/scripting/manager.zig index c7a43311..bb5934fd 100644 --- a/src/framework/scripting/manager.zig +++ b/src/framework/scripting/manager.zig @@ -16,15 +16,14 @@ pub fn init() !void { // Start lua try lua_util.init(); - // TODO fix this // Bind all the libraries using some meta programming magic at compile time - // try bindZigLibrary("assets", @import("../api/assets.zig")); - // try bindZigLibrary("display", @import("../api/display.zig")); - // try bindZigLibrary("draw", @import("../api/draw.zig")); - // try bindZigLibrary("text", @import("../api/text.zig")); - // try bindZigLibrary("graphics", @import("../api/graphics.zig")); - // try bindZigLibrary("input.mouse", @import("../api/mouse.zig")); - // try bindZigLibrary("input.keyboard", @import("../api/keyboard.zig")); + try bindZigLibrary("assets", @import("../api/assets.zig")); + try bindZigLibrary("display", @import("../api/display.zig")); + try bindZigLibrary("draw", @import("../api/draw.zig")); + try bindZigLibrary("text", @import("../api/text.zig")); + try bindZigLibrary("graphics", @import("../api/graphics.zig")); + try bindZigLibrary("input.mouse", @import("../api/mouse.zig")); + try bindZigLibrary("input.keyboard", @import("../api/keyboard.zig")); } pub fn deinit() void { @@ -45,10 +44,8 @@ fn isModuleFunction(comptime name: [:0]const u8, comptime in_type: anytype) bool fn findLibraryFunctions(comptime module: anytype) []const ScriptFn { comptime { - const info = @typeInfo(module); // Get all the public declarations in this module - const decls = info.@"struct".decls; - @compileLog(@typeName(@TypeOf(module))); + const decls = @typeInfo(module).@"struct".decls; // filter out only the public functions var gen_fields: []const std.builtin.Type.Declaration = &[_]std.builtin.Type.Declaration{}; for (decls) |d| { From b2c0e42d0da6dcc01635b130882ebd957b52934a Mon Sep 17 00:00:00 2001 From: Nico Gallinal Date: Tue, 15 Apr 2025 08:55:03 -0300 Subject: [PATCH 5/6] feedback update shaders bindings --- assets/shaders/basic-lighting.glsl | 6 +- assets/shaders/default-mesh.glsl | 4 +- assets/shaders/default.glsl | 4 +- assets/shaders/emissive.glsl | 6 +- assets/shaders/skinned-basic-lighting.glsl | 6 +- assets/shaders/skinned.glsl | 6 +- build.zig | 1 - .../graphics/shaders/basic-lighting.glsl.zig | 188 +++++++++--------- .../graphics/shaders/default-mesh.glsl.zig | 144 +++++++------- .../graphics/shaders/default.glsl.zig | 144 +++++++------- .../graphics/shaders/emissive.glsl.zig | 188 +++++++++--------- .../shaders/skinned-basic-lighting.glsl.zig | 188 +++++++++--------- .../graphics/shaders/skinned.glsl.zig | 188 +++++++++--------- .../platform/backends/sokol/graphics.zig | 22 +- 14 files changed, 547 insertions(+), 548 deletions(-) diff --git a/assets/shaders/basic-lighting.glsl b/assets/shaders/basic-lighting.glsl index 9a789cb2..a0347da0 100644 --- a/assets/shaders/basic-lighting.glsl +++ b/assets/shaders/basic-lighting.glsl @@ -40,9 +40,9 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -layout(binding=1) uniform texture2D tex; -layout(binding=2) uniform texture2D tex_emissive; -layout(binding=1) uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=1) uniform texture2D tex_emissive; +layout(binding=0) uniform sampler smp; layout(binding=1) uniform fs_params { vec4 u_cameraPos; diff --git a/assets/shaders/default-mesh.glsl b/assets/shaders/default-mesh.glsl index 2ce2248b..db9ca967 100644 --- a/assets/shaders/default-mesh.glsl +++ b/assets/shaders/default-mesh.glsl @@ -32,8 +32,8 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -layout(binding=1) uniform texture2D tex; -layout(binding=1) uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=0) uniform sampler smp; layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; diff --git a/assets/shaders/default.glsl b/assets/shaders/default.glsl index eea9e78a..43985aea 100644 --- a/assets/shaders/default.glsl +++ b/assets/shaders/default.glsl @@ -30,8 +30,8 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -layout(binding=1) uniform texture2D tex; -layout(binding=1) uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=0) uniform sampler smp; layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; diff --git a/assets/shaders/emissive.glsl b/assets/shaders/emissive.glsl index a3ac80b8..a7b377b8 100644 --- a/assets/shaders/emissive.glsl +++ b/assets/shaders/emissive.glsl @@ -38,9 +38,9 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -layout(binding=1) uniform texture2D tex; -layout(binding=2) uniform texture2D tex_emissive; -layout(binding=1) uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=1) uniform texture2D tex_emissive; +layout(binding=0) uniform sampler smp; layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; diff --git a/assets/shaders/skinned-basic-lighting.glsl b/assets/shaders/skinned-basic-lighting.glsl index 1481df3f..f81291d1 100644 --- a/assets/shaders/skinned-basic-lighting.glsl +++ b/assets/shaders/skinned-basic-lighting.glsl @@ -52,9 +52,9 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -layout(binding=1) uniform texture2D tex; -layout(binding=2) uniform texture2D tex_emissive; -layout(binding=1) uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=1) uniform texture2D tex_emissive; +layout(binding=0) uniform sampler smp; layout(binding=1) uniform fs_params { vec4 u_cameraPos; vec4 u_color_override; diff --git a/assets/shaders/skinned.glsl b/assets/shaders/skinned.glsl index aea12039..c01617c2 100644 --- a/assets/shaders/skinned.glsl +++ b/assets/shaders/skinned.glsl @@ -59,9 +59,9 @@ void main() { #pragma sokol @end #pragma sokol @fs fs -layout(binding=1) uniform texture2D tex; -layout(binding=2) uniform texture2D tex_emissive; -layout(binding=1) uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=1) uniform texture2D tex_emissive; +layout(binding=0) uniform sampler smp; layout(binding=1) uniform fs_params { vec4 u_color_override; float u_alpha_cutoff; diff --git a/build.zig b/build.zig index 7e529d70..95c729a7 100644 --- a/build.zig +++ b/build.zig @@ -95,7 +95,6 @@ pub fn build(b: *std.Build) !void { dep_zmesh.artifact("zmesh"), dep_zstbi.artifact("zstbi"), dep_zaudio.artifact("miniaudio"), - dep_zlua.artifact("lua"), dep_cimgui.artifact("cimgui_clib"), dep_stb_truetype.artifact("stb_truetype"), }; diff --git a/src/framework/graphics/shaders/basic-lighting.glsl.zig b/src/framework/graphics/shaders/basic-lighting.glsl.zig index d4e28c0f..587bbeba 100644 --- a/src/framework/graphics/shaders/basic-lighting.glsl.zig +++ b/src/framework/graphics/shaders/basic-lighting.glsl.zig @@ -32,15 +32,15 @@ const m = @import("../../math.zig"); // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex => 1 +// Bind slot: IMG_tex => 0 // Image 'tex_emissive': // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex_emissive => 2 +// Bind slot: IMG_tex_emissive => 1 // Sampler 'smp': // Type: .FILTERING -// Bind slot: SMP_smp => 1 +// Bind slot: SMP_smp => 0 // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -49,9 +49,9 @@ pub const ATTR_emissive_normals = 3; pub const ATTR_emissive_tangents = 4; pub const UB_vs_params = 0; pub const UB_fs_params = 1; -pub const IMG_tex = 1; -pub const IMG_tex_emissive = 2; -pub const SMP_smp = 1; +pub const IMG_tex = 0; +pub const IMG_tex_emissive = 1; +pub const SMP_smp = 0; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -3610,23 +3610,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { @@ -3656,23 +3656,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { @@ -3705,25 +3705,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].hlsl_register_t_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].hlsl_register_t_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].hlsl_register_t_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].hlsl_register_s_n = 0; + desc.images[1].hlsl_register_t_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].hlsl_register_s_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_MACOS => { desc.vertex_func.source = &vs_source_metal_macos; @@ -3743,25 +3743,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_IOS => { desc.vertex_func.source = &vs_source_metal_ios; @@ -3781,25 +3781,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_SIMULATOR => { desc.vertex_func.source = &vs_source_metal_sim; @@ -3819,25 +3819,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .WGPU => { desc.vertex_func.source = &vs_source_wgsl; @@ -3857,25 +3857,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].wgsl_group1_binding_n = 64; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].wgsl_group1_binding_n = 64; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].wgsl_group1_binding_n = 65; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].wgsl_group1_binding_n = 80; + desc.images[1].wgsl_group1_binding_n = 65; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].wgsl_group1_binding_n = 80; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, else => {}, } @@ -3901,16 +3901,16 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } pub fn emissiveImageSlot(img_name: []const u8) ?usize { if (std.mem.eql(u8, img_name, "tex")) { - return 1; + return 0; } if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 2; + return 1; } return null; } pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { if (std.mem.eql(u8, smp_name, "smp")) { - return 1; + return 0; } return null; } diff --git a/src/framework/graphics/shaders/default-mesh.glsl.zig b/src/framework/graphics/shaders/default-mesh.glsl.zig index ed25360a..86420fb9 100644 --- a/src/framework/graphics/shaders/default-mesh.glsl.zig +++ b/src/framework/graphics/shaders/default-mesh.glsl.zig @@ -32,10 +32,10 @@ const m = @import("../../math.zig"); // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex => 1 +// Bind slot: IMG_tex => 0 // Sampler 'smp': // Type: .FILTERING -// Bind slot: SMP_smp => 1 +// Bind slot: SMP_smp => 0 // pub const ATTR_default_pos = 0; pub const ATTR_default_color0 = 1; @@ -44,8 +44,8 @@ pub const ATTR_default_normals = 3; pub const ATTR_default_tangents = 4; pub const UB_vs_params = 0; pub const UB_fs_params = 1; -pub const IMG_tex = 1; -pub const SMP_smp = 1; +pub const IMG_tex = 0; +pub const SMP_smp = 0; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -1482,15 +1482,15 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .GLES3 => { @@ -1520,15 +1520,15 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .D3D11 => { @@ -1561,17 +1561,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].hlsl_register_b_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].hlsl_register_t_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].hlsl_register_s_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].hlsl_register_t_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].hlsl_register_s_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .METAL_MACOS => { desc.vertex_func.source = &vs_source_metal_macos; @@ -1591,17 +1591,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .METAL_IOS => { desc.vertex_func.source = &vs_source_metal_ios; @@ -1621,17 +1621,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .METAL_SIMULATOR => { desc.vertex_func.source = &vs_source_metal_sim; @@ -1651,17 +1651,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .WGPU => { desc.vertex_func.source = &vs_source_wgsl; @@ -1681,17 +1681,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].wgsl_group0_binding_n = 8; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].wgsl_group1_binding_n = 64; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].wgsl_group1_binding_n = 80; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].wgsl_group1_binding_n = 64; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].wgsl_group1_binding_n = 80; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, else => {}, } @@ -1717,13 +1717,13 @@ pub fn defaultAttrSlot(attr_name: []const u8) ?usize { } pub fn defaultImageSlot(img_name: []const u8) ?usize { if (std.mem.eql(u8, img_name, "tex")) { - return 1; + return 0; } return null; } pub fn defaultSamplerSlot(smp_name: []const u8) ?usize { if (std.mem.eql(u8, smp_name, "smp")) { - return 1; + return 0; } return null; } diff --git a/src/framework/graphics/shaders/default.glsl.zig b/src/framework/graphics/shaders/default.glsl.zig index 07815342..f2e30264 100644 --- a/src/framework/graphics/shaders/default.glsl.zig +++ b/src/framework/graphics/shaders/default.glsl.zig @@ -30,18 +30,18 @@ const m = @import("../../math.zig"); // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex => 1 +// Bind slot: IMG_tex => 0 // Sampler 'smp': // Type: .FILTERING -// Bind slot: SMP_smp => 1 +// Bind slot: SMP_smp => 0 // pub const ATTR_default_pos = 0; pub const ATTR_default_color0 = 1; pub const ATTR_default_texcoord0 = 2; pub const UB_vs_params = 0; pub const UB_fs_params = 1; -pub const IMG_tex = 1; -pub const SMP_smp = 1; +pub const IMG_tex = 0; +pub const SMP_smp = 0; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -1425,15 +1425,15 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .GLES3 => { @@ -1459,15 +1459,15 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; }, .D3D11 => { @@ -1494,17 +1494,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].hlsl_register_b_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].hlsl_register_t_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].hlsl_register_s_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].hlsl_register_t_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].hlsl_register_s_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .METAL_MACOS => { desc.vertex_func.source = &vs_source_metal_macos; @@ -1522,17 +1522,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .METAL_IOS => { desc.vertex_func.source = &vs_source_metal_ios; @@ -1550,17 +1550,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .METAL_SIMULATOR => { desc.vertex_func.source = &vs_source_metal_sim; @@ -1578,17 +1578,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, .WGPU => { desc.vertex_func.source = &vs_source_wgsl; @@ -1606,17 +1606,17 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].wgsl_group0_binding_n = 8; - desc.images[1].stage = .FRAGMENT; - desc.images[1].multisampled = false; - desc.images[1].image_type = ._2D; - desc.images[1].sample_type = .FLOAT; - desc.images[1].wgsl_group1_binding_n = 64; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].wgsl_group1_binding_n = 80; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].wgsl_group1_binding_n = 64; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].wgsl_group1_binding_n = 80; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; }, else => {}, } @@ -1636,13 +1636,13 @@ pub fn defaultAttrSlot(attr_name: []const u8) ?usize { } pub fn defaultImageSlot(img_name: []const u8) ?usize { if (std.mem.eql(u8, img_name, "tex")) { - return 1; + return 0; } return null; } pub fn defaultSamplerSlot(smp_name: []const u8) ?usize { if (std.mem.eql(u8, smp_name, "smp")) { - return 1; + return 0; } return null; } diff --git a/src/framework/graphics/shaders/emissive.glsl.zig b/src/framework/graphics/shaders/emissive.glsl.zig index 31c0fc9f..7f12dc53 100644 --- a/src/framework/graphics/shaders/emissive.glsl.zig +++ b/src/framework/graphics/shaders/emissive.glsl.zig @@ -32,15 +32,15 @@ const m = @import("../../math.zig"); // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex => 1 +// Bind slot: IMG_tex => 0 // Image 'tex_emissive': // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex_emissive => 2 +// Bind slot: IMG_tex_emissive => 1 // Sampler 'smp': // Type: .FILTERING -// Bind slot: SMP_smp => 1 +// Bind slot: SMP_smp => 0 // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -49,9 +49,9 @@ pub const ATTR_emissive_normals = 3; pub const ATTR_emissive_tangents = 4; pub const UB_vs_params = 0; pub const UB_fs_params = 1; -pub const IMG_tex = 1; -pub const IMG_tex_emissive = 2; -pub const SMP_smp = 1; +pub const IMG_tex = 0; +pub const IMG_tex_emissive = 1; +pub const SMP_smp = 0; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -1852,23 +1852,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { @@ -1898,23 +1898,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { @@ -1947,25 +1947,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].hlsl_register_t_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].hlsl_register_t_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].hlsl_register_t_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].hlsl_register_s_n = 0; + desc.images[1].hlsl_register_t_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].hlsl_register_s_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_MACOS => { desc.vertex_func.source = &vs_source_metal_macos; @@ -1985,25 +1985,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_IOS => { desc.vertex_func.source = &vs_source_metal_ios; @@ -2023,25 +2023,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_SIMULATOR => { desc.vertex_func.source = &vs_source_metal_sim; @@ -2061,25 +2061,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .WGPU => { desc.vertex_func.source = &vs_source_wgsl; @@ -2099,25 +2099,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].wgsl_group1_binding_n = 64; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].wgsl_group1_binding_n = 64; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].wgsl_group1_binding_n = 65; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].wgsl_group1_binding_n = 80; + desc.images[1].wgsl_group1_binding_n = 65; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].wgsl_group1_binding_n = 80; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, else => {}, } @@ -2143,16 +2143,16 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } pub fn emissiveImageSlot(img_name: []const u8) ?usize { if (std.mem.eql(u8, img_name, "tex")) { - return 1; + return 0; } if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 2; + return 1; } return null; } pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { if (std.mem.eql(u8, smp_name, "smp")) { - return 1; + return 0; } return null; } diff --git a/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig b/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig index 71204edf..2d1e0336 100644 --- a/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig +++ b/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig @@ -34,15 +34,15 @@ const m = @import("../../math.zig"); // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex => 1 +// Bind slot: IMG_tex => 0 // Image 'tex_emissive': // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex_emissive => 2 +// Bind slot: IMG_tex_emissive => 1 // Sampler 'smp': // Type: .FILTERING -// Bind slot: SMP_smp => 1 +// Bind slot: SMP_smp => 0 // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -53,9 +53,9 @@ pub const ATTR_emissive_joints = 5; pub const ATTR_emissive_weights = 6; pub const UB_vs_params = 0; pub const UB_fs_params = 1; -pub const IMG_tex = 1; -pub const IMG_tex_emissive = 2; -pub const SMP_smp = 1; +pub const IMG_tex = 0; +pub const IMG_tex_emissive = 1; +pub const SMP_smp = 0; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -4138,23 +4138,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { @@ -4188,23 +4188,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 41; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { @@ -4243,25 +4243,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].hlsl_register_t_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].hlsl_register_t_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].hlsl_register_t_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].hlsl_register_s_n = 0; + desc.images[1].hlsl_register_t_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].hlsl_register_s_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_MACOS => { desc.vertex_func.source = &vs_source_metal_macos; @@ -4283,25 +4283,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_IOS => { desc.vertex_func.source = &vs_source_metal_ios; @@ -4323,25 +4323,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_SIMULATOR => { desc.vertex_func.source = &vs_source_metal_sim; @@ -4363,25 +4363,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .WGPU => { desc.vertex_func.source = &vs_source_wgsl; @@ -4403,25 +4403,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 656; desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].wgsl_group1_binding_n = 64; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].wgsl_group1_binding_n = 64; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].wgsl_group1_binding_n = 65; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].wgsl_group1_binding_n = 80; + desc.images[1].wgsl_group1_binding_n = 65; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].wgsl_group1_binding_n = 80; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, else => {}, } @@ -4453,16 +4453,16 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } pub fn emissiveImageSlot(img_name: []const u8) ?usize { if (std.mem.eql(u8, img_name, "tex")) { - return 1; + return 0; } if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 2; + return 1; } return null; } pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { if (std.mem.eql(u8, smp_name, "smp")) { - return 1; + return 0; } return null; } diff --git a/src/framework/graphics/shaders/skinned.glsl.zig b/src/framework/graphics/shaders/skinned.glsl.zig index af8c4081..3d467162 100644 --- a/src/framework/graphics/shaders/skinned.glsl.zig +++ b/src/framework/graphics/shaders/skinned.glsl.zig @@ -34,15 +34,15 @@ const m = @import("../../math.zig"); // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex => 1 +// Bind slot: IMG_tex => 0 // Image 'tex_emissive': // Image type: ._2D // Sample type: .FLOAT // Multisampled: false -// Bind slot: IMG_tex_emissive => 2 +// Bind slot: IMG_tex_emissive => 1 // Sampler 'smp': // Type: .FILTERING -// Bind slot: SMP_smp => 1 +// Bind slot: SMP_smp => 0 // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -53,9 +53,9 @@ pub const ATTR_emissive_joints = 5; pub const ATTR_emissive_weights = 6; pub const UB_vs_params = 0; pub const UB_fs_params = 1; -pub const IMG_tex = 1; -pub const IMG_tex_emissive = 2; -pub const SMP_smp = 1; +pub const IMG_tex = 0; +pub const IMG_tex_emissive = 1; +pub const SMP_smp = 0; pub const VsParams = extern struct { u_projViewMatrix: m.Mat4 align(16), u_modelMatrix: m.Mat4 align(1), @@ -2430,23 +2430,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .GLES3 => { @@ -2480,23 +2480,23 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].glsl_uniforms[0].type = .FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 2; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "fs_params"; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[0].glsl_name = "tex_smp"; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; desc.image_sampler_pairs[1].glsl_name = "tex_emissive_smp"; }, .D3D11 => { @@ -2535,25 +2535,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].hlsl_register_b_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].hlsl_register_t_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].hlsl_register_t_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].hlsl_register_t_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].hlsl_register_s_n = 0; + desc.images[1].hlsl_register_t_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].hlsl_register_s_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_MACOS => { desc.vertex_func.source = &vs_source_metal_macos; @@ -2575,25 +2575,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_IOS => { desc.vertex_func.source = &vs_source_metal_ios; @@ -2615,25 +2615,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .METAL_SIMULATOR => { desc.vertex_func.source = &vs_source_metal_sim; @@ -2655,25 +2655,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].msl_buffer_n = 0; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].msl_texture_n = 0; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].msl_texture_n = 0; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].msl_texture_n = 1; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].msl_sampler_n = 0; + desc.images[1].msl_texture_n = 1; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].msl_sampler_n = 0; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, .WGPU => { desc.vertex_func.source = &vs_source_wgsl; @@ -2695,25 +2695,25 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.uniform_blocks[1].layout = .STD140; desc.uniform_blocks[1].size = 32; desc.uniform_blocks[1].wgsl_group0_binding_n = 8; + desc.images[0].stage = .FRAGMENT; + desc.images[0].multisampled = false; + desc.images[0].image_type = ._2D; + desc.images[0].sample_type = .FLOAT; + desc.images[0].wgsl_group1_binding_n = 64; desc.images[1].stage = .FRAGMENT; desc.images[1].multisampled = false; desc.images[1].image_type = ._2D; desc.images[1].sample_type = .FLOAT; - desc.images[1].wgsl_group1_binding_n = 64; - desc.images[2].stage = .FRAGMENT; - desc.images[2].multisampled = false; - desc.images[2].image_type = ._2D; - desc.images[2].sample_type = .FLOAT; - desc.images[2].wgsl_group1_binding_n = 65; - desc.samplers[1].stage = .FRAGMENT; - desc.samplers[1].sampler_type = .FILTERING; - desc.samplers[1].wgsl_group1_binding_n = 80; + desc.images[1].wgsl_group1_binding_n = 65; + desc.samplers[0].stage = .FRAGMENT; + desc.samplers[0].sampler_type = .FILTERING; + desc.samplers[0].wgsl_group1_binding_n = 80; desc.image_sampler_pairs[0].stage = .FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 1; - desc.image_sampler_pairs[0].sampler_slot = 1; + desc.image_sampler_pairs[0].image_slot = 0; + desc.image_sampler_pairs[0].sampler_slot = 0; desc.image_sampler_pairs[1].stage = .FRAGMENT; - desc.image_sampler_pairs[1].image_slot = 2; - desc.image_sampler_pairs[1].sampler_slot = 1; + desc.image_sampler_pairs[1].image_slot = 1; + desc.image_sampler_pairs[1].sampler_slot = 0; }, else => {}, } @@ -2745,16 +2745,16 @@ pub fn emissiveAttrSlot(attr_name: []const u8) ?usize { } pub fn emissiveImageSlot(img_name: []const u8) ?usize { if (std.mem.eql(u8, img_name, "tex")) { - return 1; + return 0; } if (std.mem.eql(u8, img_name, "tex_emissive")) { - return 2; + return 1; } return null; } pub fn emissiveSamplerSlot(smp_name: []const u8) ?usize { if (std.mem.eql(u8, smp_name, "smp")) { - return 1; + return 0; } return null; } diff --git a/src/framework/platform/backends/sokol/graphics.zig b/src/framework/platform/backends/sokol/graphics.zig index e63a5fda..db3be126 100644 --- a/src/framework/platform/backends/sokol/graphics.zig +++ b/src/framework/platform/backends/sokol/graphics.zig @@ -65,9 +65,9 @@ pub const BindingsImpl = struct { const samplerDesc = convertFilterModeToSamplerDesc(.NEAREST); bindings.impl.default_sokol_sampler = sg.makeSampler(samplerDesc); // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code - // 1 because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=1) - // they start at 1 - bindings.impl.sokol_bindings.?.samplers[1] = bindings.impl.default_sokol_sampler; + // 0 because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=0) + // they start at 0 + bindings.impl.sokol_bindings.?.samplers[0] = bindings.impl.default_sokol_sampler; return bindings; } @@ -148,26 +148,26 @@ pub const BindingsImpl = struct { // set the texture to the default fragment shader image slot // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code - // 1 because in the glsl definitions we have only fs tex and they are annotated with layout(binding=1) - // they start at 1 - self.impl.sokol_bindings.?.images[1] = texture.sokol_image.?; + // 0 because in the glsl definitions we have only fs tex and they are annotated with layout(binding=0) + // they start at 0 + self.impl.sokol_bindings.?.images[0] = texture.sokol_image.?; } pub fn updateFromMaterial(self: *Bindings, material: *Material) void { for (0..material.state.textures.len) |i| { if (material.state.textures[i] != null) // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code - // + 1 because in the glsl definitions we have only fs tex and they are annotated with layout(binding=1) - // they start at 1 - self.impl.sokol_bindings.?.images[i + 1] = material.state.textures[i].?.sokol_image.?; + // i because in the glsl definitions we have only fs tex and they are annotated with layout(binding=0) + // they start at 0 + self.impl.sokol_bindings.?.images[i] = material.state.textures[i].?.sokol_image.?; } // bind samplers for (material.state.sokol_samplers, 0..) |sampler, i| { if (sampler) |s| // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code - // + 1 because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=1) - // they start at 1 + // i because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=0) + // they start at 0 self.impl.sokol_bindings.?.samplers[i + 1] = s; } From 7533a1e4e0201b5c2cb3da7b2b9c8058d5e1a75b Mon Sep 17 00:00:00 2001 From: Interrupt Date: Tue, 21 Oct 2025 09:29:14 -0700 Subject: [PATCH 6/6] Fixing graphics binding offset issue, disabled Lua for web builds --- ...-lighting_emissive_glsl300es_fragment.glsl | 86 + .../basic-lighting_emissive_glsl300es_fs.glsl | 86 + ...ic-lighting_emissive_glsl300es_vertex.glsl | 25 + .../basic-lighting_emissive_glsl300es_vs.glsl | 25 + ...ic-lighting_emissive_glsl430_fragment.glsl | 84 + .../basic-lighting_emissive_glsl430_fs.glsl | 84 + ...asic-lighting_emissive_glsl430_vertex.glsl | 25 + .../basic-lighting_emissive_glsl430_vs.glsl | 25 + ...asic-lighting_emissive_hlsl4_fragment.hlsl | 122 ++ .../basic-lighting_emissive_hlsl4_fs.hlsl | 122 ++ .../basic-lighting_emissive_hlsl4_vertex.hlsl | 67 + .../basic-lighting_emissive_hlsl4_vs.hlsl | 67 + ...lighting_emissive_metal_ios_fragment.metal | 110 ++ ...basic-lighting_emissive_metal_ios_fs.metal | 110 ++ ...c-lighting_emissive_metal_ios_vertex.metal | 44 + ...basic-lighting_emissive_metal_ios_vs.metal | 44 + ...ghting_emissive_metal_macos_fragment.metal | 110 ++ ...sic-lighting_emissive_metal_macos_fs.metal | 110 ++ ...lighting_emissive_metal_macos_vertex.metal | 44 + ...sic-lighting_emissive_metal_macos_vs.metal | 44 + ...lighting_emissive_metal_sim_fragment.metal | 110 ++ ...basic-lighting_emissive_metal_sim_fs.metal | 110 ++ ...c-lighting_emissive_metal_sim_vertex.metal | 44 + ...basic-lighting_emissive_metal_sim_vs.metal | 44 + .../basic-lighting_emissive_wgsl_fragment | 261 +++ .../basic-lighting_emissive_wgsl_fs | 261 +++ .../basic-lighting_emissive_wgsl_vertex | 85 + .../basic-lighting_emissive_wgsl_vs | 85 + .../basic-lighting_reflection.yaml | 1112 ++++++++++++ ...fault-mesh_default_glsl300es_fragment.glsl | 29 + .../default-mesh_default_glsl300es_fs.glsl | 29 + ...default-mesh_default_glsl300es_vertex.glsl | 18 + .../default-mesh_default_glsl300es_vs.glsl | 18 + ...default-mesh_default_glsl430_fragment.glsl | 27 + .../default-mesh_default_glsl430_fs.glsl | 27 + .../default-mesh_default_glsl430_vertex.glsl | 18 + .../default-mesh_default_glsl430_vs.glsl | 18 + .../default-mesh_default_hlsl4_fragment.hlsl | 51 + .../default-mesh_default_hlsl4_fs.hlsl | 51 + .../default-mesh_default_hlsl4_vertex.hlsl | 55 + .../default-mesh_default_hlsl4_vs.hlsl | 55 + ...ault-mesh_default_metal_ios_fragment.metal | 42 + .../default-mesh_default_metal_ios_fs.metal | 42 + ...efault-mesh_default_metal_ios_vertex.metal | 36 + .../default-mesh_default_metal_ios_vs.metal | 36 + ...lt-mesh_default_metal_macos_fragment.metal | 42 + .../default-mesh_default_metal_macos_fs.metal | 42 + ...ault-mesh_default_metal_macos_vertex.metal | 36 + .../default-mesh_default_metal_macos_vs.metal | 36 + ...ault-mesh_default_metal_sim_fragment.metal | 42 + .../default-mesh_default_metal_sim_fs.metal | 42 + ...efault-mesh_default_metal_sim_vertex.metal | 36 + .../default-mesh_default_metal_sim_vs.metal | 36 + .../default-mesh_default_wgsl_fragment | 61 + .../default-mesh/default-mesh_default_wgsl_fs | 61 + .../default-mesh_default_wgsl_vertex | 65 + .../default-mesh/default-mesh_default_wgsl_vs | 65 + .../default-mesh/default-mesh_reflection.yaml | 734 ++++++++ .../default_default_glsl300es_fragment.glsl | 29 + .../default_default_glsl300es_vertex.glsl | 16 + .../default_default_glsl430_fragment.glsl | 27 + .../default_default_glsl430_vertex.glsl | 16 + .../default_default_hlsl4_fragment.hlsl | 51 + .../default/default_default_hlsl4_vertex.hlsl | 49 + .../default_default_metal_ios_fragment.metal | 42 + .../default_default_metal_ios_vertex.metal | 36 + ...default_default_metal_macos_fragment.metal | 42 + .../default_default_metal_macos_vertex.metal | 36 + .../default_default_metal_sim_fragment.metal | 42 + .../default_default_metal_sim_vertex.metal | 36 + .../default/default_default_wgsl_fragment | 61 + .../built/default/default_default_wgsl_vertex | 59 + .../built/default/default_reflection.yaml | 1530 +++++++---------- .../emissive_emissive_glsl300es_fragment.glsl | 38 + .../emissive_emissive_glsl300es_fs.glsl | 38 + .../emissive_emissive_glsl300es_vertex.glsl | 22 + .../emissive_emissive_glsl300es_vs.glsl | 22 + .../emissive_emissive_glsl430_fragment.glsl | 36 + .../emissive_emissive_glsl430_fs.glsl | 36 + .../emissive_emissive_glsl430_vertex.glsl | 22 + .../emissive_emissive_glsl430_vs.glsl | 22 + .../emissive_emissive_hlsl4_fragment.hlsl | 64 + .../emissive/emissive_emissive_hlsl4_fs.hlsl | 64 + .../emissive_emissive_hlsl4_vertex.hlsl | 63 + .../emissive/emissive_emissive_hlsl4_vs.hlsl | 63 + ...emissive_emissive_metal_ios_fragment.metal | 48 + .../emissive_emissive_metal_ios_fs.metal | 48 + .../emissive_emissive_metal_ios_vertex.metal | 42 + .../emissive_emissive_metal_ios_vs.metal | 42 + ...issive_emissive_metal_macos_fragment.metal | 48 + .../emissive_emissive_metal_macos_fs.metal | 48 + ...emissive_emissive_metal_macos_vertex.metal | 42 + .../emissive_emissive_metal_macos_vs.metal | 42 + ...emissive_emissive_metal_sim_fragment.metal | 48 + .../emissive_emissive_metal_sim_fs.metal | 48 + .../emissive_emissive_metal_sim_vertex.metal | 42 + .../emissive_emissive_metal_sim_vs.metal | 42 + .../emissive/emissive_emissive_wgsl_fragment | 85 + .../built/emissive/emissive_emissive_wgsl_fs | 85 + .../emissive/emissive_emissive_wgsl_vertex | 77 + .../built/emissive/emissive_emissive_wgsl_vs | 77 + .../built/emissive/emissive_reflection.yaml | 832 +++++++++ ...-lighting_emissive_glsl300es_fragment.glsl | 87 + ...-basic-lighting_emissive_glsl300es_fs.glsl | 87 + ...ic-lighting_emissive_glsl300es_vertex.glsl | 33 + ...-basic-lighting_emissive_glsl300es_vs.glsl | 33 + ...ic-lighting_emissive_glsl430_fragment.glsl | 85 + ...ed-basic-lighting_emissive_glsl430_fs.glsl | 85 + ...asic-lighting_emissive_glsl430_vertex.glsl | 33 + ...ed-basic-lighting_emissive_glsl430_vs.glsl | 33 + ...asic-lighting_emissive_hlsl4_fragment.hlsl | 125 ++ ...nned-basic-lighting_emissive_hlsl4_fs.hlsl | 125 ++ ...-basic-lighting_emissive_hlsl4_vertex.hlsl | 83 + ...nned-basic-lighting_emissive_hlsl4_vs.hlsl | 83 + ...lighting_emissive_metal_ios_fragment.metal | 110 ++ ...basic-lighting_emissive_metal_ios_fs.metal | 110 ++ ...c-lighting_emissive_metal_ios_vertex.metal | 54 + ...basic-lighting_emissive_metal_ios_vs.metal | 54 + ...ghting_emissive_metal_macos_fragment.metal | 110 ++ ...sic-lighting_emissive_metal_macos_fs.metal | 110 ++ ...lighting_emissive_metal_macos_vertex.metal | 54 + ...sic-lighting_emissive_metal_macos_vs.metal | 54 + ...lighting_emissive_metal_sim_fragment.metal | 110 ++ ...basic-lighting_emissive_metal_sim_fs.metal | 110 ++ ...c-lighting_emissive_metal_sim_vertex.metal | 54 + ...basic-lighting_emissive_metal_sim_vs.metal | 54 + ...nned-basic-lighting_emissive_wgsl_fragment | 264 +++ .../skinned-basic-lighting_emissive_wgsl_fs | 264 +++ ...kinned-basic-lighting_emissive_wgsl_vertex | 124 ++ .../skinned-basic-lighting_emissive_wgsl_vs | 124 ++ .../skinned-basic-lighting_reflection.yaml | 1197 +++++++++++++ .../skinned_emissive_glsl300es_fragment.glsl | 40 + .../skinned_emissive_glsl300es_fs.glsl | 40 + .../skinned_emissive_glsl300es_vertex.glsl | 32 + .../skinned_emissive_glsl300es_vs.glsl | 32 + .../skinned_emissive_glsl430_fragment.glsl | 38 + .../skinned/skinned_emissive_glsl430_fs.glsl | 38 + .../skinned_emissive_glsl430_vertex.glsl | 32 + .../skinned/skinned_emissive_glsl430_vs.glsl | 32 + .../skinned_emissive_hlsl4_fragment.hlsl | 70 + .../skinned/skinned_emissive_hlsl4_fs.hlsl | 70 + .../skinned_emissive_hlsl4_vertex.hlsl | 82 + .../skinned/skinned_emissive_hlsl4_vs.hlsl | 82 + .../skinned_emissive_metal_ios_fragment.metal | 48 + .../skinned_emissive_metal_ios_fs.metal | 48 + .../skinned_emissive_metal_ios_vertex.metal | 53 + .../skinned_emissive_metal_ios_vs.metal | 53 + ...kinned_emissive_metal_macos_fragment.metal | 48 + .../skinned_emissive_metal_macos_fs.metal | 48 + .../skinned_emissive_metal_macos_vertex.metal | 53 + .../skinned_emissive_metal_macos_vs.metal | 53 + .../skinned_emissive_metal_sim_fragment.metal | 48 + .../skinned_emissive_metal_sim_fs.metal | 48 + .../skinned_emissive_metal_sim_vertex.metal | 53 + .../skinned_emissive_metal_sim_vs.metal | 53 + .../skinned/skinned_emissive_wgsl_fragment | 91 + .../built/skinned/skinned_emissive_wgsl_fs | 91 + .../skinned/skinned_emissive_wgsl_vertex | 123 ++ .../built/skinned/skinned_emissive_wgsl_vs | 123 ++ .../built/skinned/skinned_reflection.yaml | 917 ++++++++++ build.zig | 7 +- .../graphics/shaders/basic-lighting.glsl.zig | 71 +- .../graphics/shaders/default-mesh.glsl.zig | 52 +- .../graphics/shaders/default.glsl.zig | 38 +- .../graphics/shaders/emissive.glsl.zig | 55 +- .../shaders/skinned-basic-lighting.glsl.zig | 87 +- .../graphics/shaders/skinned.glsl.zig | 71 +- .../platform/backends/sokol/graphics.zig | 5 +- src/framework/platform/graphics.zig | 2 +- src/framework/scripting/lua.zig | 4 +- 170 files changed, 15234 insertions(+), 1200 deletions(-) create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fragment.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fs.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vertex.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vs.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fragment.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fs.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vertex.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vs.glsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fragment.hlsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fs.hlsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vertex.hlsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vs.hlsl create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fragment.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fs.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vertex.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vs.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fragment.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fs.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vertex.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vs.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fragment.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fs.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vertex.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vs.metal create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fragment create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fs create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vertex create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vs create mode 100644 assets/shaders/built/basic-lighting/basic-lighting_reflection.yaml create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fragment.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fs.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vertex.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vs.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl430_fragment.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl430_fs.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl430_vertex.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_glsl430_vs.glsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fragment.hlsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fs.hlsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vertex.hlsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vs.hlsl create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fragment.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fs.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vertex.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vs.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fragment.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fs.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vertex.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vs.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fragment.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fs.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vertex.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vs.metal create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_wgsl_fragment create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_wgsl_fs create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_wgsl_vertex create mode 100644 assets/shaders/built/default-mesh/default-mesh_default_wgsl_vs create mode 100644 assets/shaders/built/default-mesh/default-mesh_reflection.yaml create mode 100644 assets/shaders/built/default/default_default_glsl300es_fragment.glsl create mode 100644 assets/shaders/built/default/default_default_glsl300es_vertex.glsl create mode 100644 assets/shaders/built/default/default_default_glsl430_fragment.glsl create mode 100644 assets/shaders/built/default/default_default_glsl430_vertex.glsl create mode 100644 assets/shaders/built/default/default_default_hlsl4_fragment.hlsl create mode 100644 assets/shaders/built/default/default_default_hlsl4_vertex.hlsl create mode 100644 assets/shaders/built/default/default_default_metal_ios_fragment.metal create mode 100644 assets/shaders/built/default/default_default_metal_ios_vertex.metal create mode 100644 assets/shaders/built/default/default_default_metal_macos_fragment.metal create mode 100644 assets/shaders/built/default/default_default_metal_macos_vertex.metal create mode 100644 assets/shaders/built/default/default_default_metal_sim_fragment.metal create mode 100644 assets/shaders/built/default/default_default_metal_sim_vertex.metal create mode 100644 assets/shaders/built/default/default_default_wgsl_fragment create mode 100644 assets/shaders/built/default/default_default_wgsl_vertex create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl300es_fragment.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl300es_fs.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl300es_vertex.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl300es_vs.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl430_fragment.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl430_fs.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl430_vertex.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_glsl430_vs.glsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_hlsl4_fragment.hlsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_hlsl4_fs.hlsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_hlsl4_vertex.hlsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_hlsl4_vs.hlsl create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_ios_fragment.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_ios_fs.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_ios_vertex.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_ios_vs.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_macos_fragment.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_macos_fs.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_macos_vertex.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_macos_vs.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_sim_fragment.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_sim_fs.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_sim_vertex.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_metal_sim_vs.metal create mode 100644 assets/shaders/built/emissive/emissive_emissive_wgsl_fragment create mode 100644 assets/shaders/built/emissive/emissive_emissive_wgsl_fs create mode 100644 assets/shaders/built/emissive/emissive_emissive_wgsl_vertex create mode 100644 assets/shaders/built/emissive/emissive_emissive_wgsl_vs create mode 100644 assets/shaders/built/emissive/emissive_reflection.yaml create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fragment.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fs.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vertex.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vs.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fragment.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fs.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vertex.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vs.glsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fragment.hlsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fs.hlsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vertex.hlsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vs.hlsl create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fragment.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fs.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vertex.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vs.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fragment.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fs.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vertex.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vs.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fragment.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fs.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vertex.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vs.metal create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fragment create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fs create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vertex create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vs create mode 100644 assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_reflection.yaml create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl300es_fragment.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl300es_fs.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl300es_vertex.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl300es_vs.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl430_fragment.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl430_fs.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl430_vertex.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_glsl430_vs.glsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_hlsl4_fragment.hlsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_hlsl4_fs.hlsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_hlsl4_vertex.hlsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_hlsl4_vs.hlsl create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_ios_fragment.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_ios_fs.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_ios_vertex.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_ios_vs.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_macos_fragment.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_macos_fs.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_macos_vertex.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_macos_vs.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_sim_fragment.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_sim_fs.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_sim_vertex.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_metal_sim_vs.metal create mode 100644 assets/shaders/built/skinned/skinned_emissive_wgsl_fragment create mode 100644 assets/shaders/built/skinned/skinned_emissive_wgsl_fs create mode 100644 assets/shaders/built/skinned/skinned_emissive_wgsl_vertex create mode 100644 assets/shaders/built/skinned/skinned_emissive_wgsl_vs create mode 100644 assets/shaders/built/skinned/skinned_reflection.yaml diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fragment.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fragment.glsl new file mode 100644 index 00000000..43c70901 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fragment.glsl @@ -0,0 +1,86 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[41]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 color; +in highp vec4 position; +in highp vec3 normal; +layout(location = 0) out highp vec4 frag_color; +in highp vec4 tangent; + +highp float sqr(highp float x) +{ + return x * x; +} + +highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff) +{ + highp float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + highp float param = _30; + highp float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0); +} + +highp float calcFogFactor(highp float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + highp vec4 _113 = texture(tex_smp, uv) * color; + highp vec4 c = _113; + highp vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + highp float param = length(_168); + highp float param_1 = fs_params[_145 * 1 + 7].w; + highp float param_2 = 1.0; + highp float param_3 = 1.0; + highp vec4 _198 = lit_color; + highp vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + highp vec4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + highp vec4 _239 = lit_color; + highp vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + highp vec4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + highp vec4 _250 = c * _335; + highp vec4 _257 = texture(tex_emissive_smp, uv); + highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + highp vec4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + highp vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + highp vec4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + highp float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fs.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fs.glsl new file mode 100644 index 00000000..43c70901 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fs.glsl @@ -0,0 +1,86 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[41]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 color; +in highp vec4 position; +in highp vec3 normal; +layout(location = 0) out highp vec4 frag_color; +in highp vec4 tangent; + +highp float sqr(highp float x) +{ + return x * x; +} + +highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff) +{ + highp float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + highp float param = _30; + highp float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0); +} + +highp float calcFogFactor(highp float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + highp vec4 _113 = texture(tex_smp, uv) * color; + highp vec4 c = _113; + highp vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + highp float param = length(_168); + highp float param_1 = fs_params[_145 * 1 + 7].w; + highp float param_2 = 1.0; + highp float param_3 = 1.0; + highp vec4 _198 = lit_color; + highp vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + highp vec4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + highp vec4 _239 = lit_color; + highp vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + highp vec4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + highp vec4 _250 = c * _335; + highp vec4 _257 = texture(tex_emissive_smp, uv); + highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + highp vec4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + highp vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + highp vec4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + highp float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vertex.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vertex.glsl new file mode 100644 index 00000000..13a798a8 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vertex.glsl @@ -0,0 +1,25 @@ +#version 300 es + +uniform vec4 vs_params[10]; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; +out vec4 position; +layout(location = 0) in vec4 pos; + +void main() +{ + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + mat4 _40 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]); + normal = normalize(_40 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _40 * pos; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vs.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vs.glsl new file mode 100644 index 00000000..13a798a8 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vs.glsl @@ -0,0 +1,25 @@ +#version 300 es + +uniform vec4 vs_params[10]; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; +out vec4 position; +layout(location = 0) in vec4 pos; + +void main() +{ + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + mat4 _40 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]); + normal = normalize(_40 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _40 * pos; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fragment.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fragment.glsl new file mode 100644 index 00000000..168ed414 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fragment.glsl @@ -0,0 +1,84 @@ +#version 430 + +uniform vec4 fs_params[41]; +layout(binding = 16) uniform sampler2D tex_smp; +layout(binding = 17) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 4) in vec4 position; +layout(location = 2) in vec3 normal; +layout(location = 0) out vec4 frag_color; +layout(location = 3) in vec4 tangent; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + vec4 _113 = texture(tex_smp, uv) * color; + vec4 c = _113; + vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + float param = length(_168); + float param_1 = fs_params[_145 * 1 + 7].w; + float param_2 = 1.0; + float param_3 = 1.0; + vec4 _198 = lit_color; + vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + vec4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + vec4 _239 = lit_color; + vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + vec4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + vec4 _250 = c * _335; + vec4 _257 = texture(tex_emissive_smp, uv); + vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + vec4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + vec4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fs.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fs.glsl new file mode 100644 index 00000000..3a3f5181 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fs.glsl @@ -0,0 +1,84 @@ +#version 430 + +uniform vec4 fs_params[41]; +layout(binding = 0) uniform sampler2D tex_smp; +layout(binding = 1) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 4) in vec4 position; +layout(location = 2) in vec3 normal; +layout(location = 0) out vec4 frag_color; +layout(location = 3) in vec4 tangent; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + vec4 _113 = texture(tex_smp, uv) * color; + vec4 c = _113; + vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + float param = length(_168); + float param_1 = fs_params[_145 * 1 + 7].w; + float param_2 = 1.0; + float param_3 = 1.0; + vec4 _198 = lit_color; + vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + vec4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + vec4 _239 = lit_color; + vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + vec4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + vec4 _250 = c * _335; + vec4 _257 = texture(tex_emissive_smp, uv); + vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + vec4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + vec4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vertex.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vertex.glsl new file mode 100644 index 00000000..afcdb2a9 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vertex.glsl @@ -0,0 +1,25 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; +layout(location = 4) out vec4 position; +layout(location = 0) in vec4 pos; + +void main() +{ + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + mat4 _40 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]); + normal = normalize(_40 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _40 * pos; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vs.glsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vs.glsl new file mode 100644 index 00000000..afcdb2a9 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vs.glsl @@ -0,0 +1,25 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; +layout(location = 4) out vec4 position; +layout(location = 0) in vec4 pos; + +void main() +{ + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + mat4 _40 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]); + normal = normalize(_40 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _40 * pos; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fragment.hlsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fragment.hlsl new file mode 100644 index 00000000..ed74aa47 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fragment.hlsl @@ -0,0 +1,122 @@ +cbuffer fs_params : register(b0) +{ + float4 _63_u_cameraPos : packoffset(c0); + float4 _63_u_color_override : packoffset(c1); + float _63_u_alpha_cutoff : packoffset(c2); + float4 _63_u_ambient_light : packoffset(c3); + float4 _63_u_dir_light_dir : packoffset(c4); + float4 _63_u_dir_light_color : packoffset(c5); + float _63_u_num_point_lights : packoffset(c6); + float4 _63_u_point_light_data[32] : packoffset(c7); + float4 _63_u_fog_data : packoffset(c39); + float4 _63_u_fog_color : packoffset(c40); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 color; +static float4 position; +static float3 normal; +static float4 frag_color; +static float4 tangent; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0f) + { + return 0.0f; + } + float param = _30; + float param_1 = 1.0f - sqr(param); + return (max_intensity * sqr(param_1)) / mad(falloff, _30, 1.0f); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - _63_u_fog_data.x) / (_63_u_fog_data.y - _63_u_fog_data.x)) * _63_u_fog_color.w, 0.0f, 1.0f); +} + +void frag_main() +{ + float4 _113 = tex.Sample(smp, uv) * color; + float4 c = _113; + float4 lit_color = _63_u_ambient_light; + if (_113.w <= _63_u_alpha_cutoff) + { + discard; + } + for (int i = 0; i < int(_63_u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63_u_point_light_data[_145].xyz - position.xyz; + float param = length(_168); + float param_1 = _63_u_point_light_data[_145].w; + float param_2 = 1.0f; + float param_3 = 1.0f; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63_u_point_light_data[_145 + 1].xyz * max(dot(normalize(_168), normal), 0.0f)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63_u_dir_light_color.xyz * (max(dot(float4(_63_u_dir_light_dir.x, _63_u_dir_light_dir.y, _63_u_dir_light_dir.z, 0.0f), float4(normal, 0.0f)), 0.0f) * _63_u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.Sample(smp, uv); + float3 _275 = (_250.xyz * (1.0f - min((_257.x + _257.y) + _257.z, 1.0f))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0f - _63_u_color_override.w)) + (_63_u_color_override.xyz * _63_u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63_u_cameraPos - position); + frag_color = float4(lerp(c.xyz, _63_u_fog_color.xyz, calcFogFactor(param_4).xxx), 1.0f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + position = stage_input.position; + normal = stage_input.normal; + tangent = stage_input.tangent; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fs.hlsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fs.hlsl new file mode 100644 index 00000000..ed74aa47 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fs.hlsl @@ -0,0 +1,122 @@ +cbuffer fs_params : register(b0) +{ + float4 _63_u_cameraPos : packoffset(c0); + float4 _63_u_color_override : packoffset(c1); + float _63_u_alpha_cutoff : packoffset(c2); + float4 _63_u_ambient_light : packoffset(c3); + float4 _63_u_dir_light_dir : packoffset(c4); + float4 _63_u_dir_light_color : packoffset(c5); + float _63_u_num_point_lights : packoffset(c6); + float4 _63_u_point_light_data[32] : packoffset(c7); + float4 _63_u_fog_data : packoffset(c39); + float4 _63_u_fog_color : packoffset(c40); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 color; +static float4 position; +static float3 normal; +static float4 frag_color; +static float4 tangent; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0f) + { + return 0.0f; + } + float param = _30; + float param_1 = 1.0f - sqr(param); + return (max_intensity * sqr(param_1)) / mad(falloff, _30, 1.0f); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - _63_u_fog_data.x) / (_63_u_fog_data.y - _63_u_fog_data.x)) * _63_u_fog_color.w, 0.0f, 1.0f); +} + +void frag_main() +{ + float4 _113 = tex.Sample(smp, uv) * color; + float4 c = _113; + float4 lit_color = _63_u_ambient_light; + if (_113.w <= _63_u_alpha_cutoff) + { + discard; + } + for (int i = 0; i < int(_63_u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63_u_point_light_data[_145].xyz - position.xyz; + float param = length(_168); + float param_1 = _63_u_point_light_data[_145].w; + float param_2 = 1.0f; + float param_3 = 1.0f; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63_u_point_light_data[_145 + 1].xyz * max(dot(normalize(_168), normal), 0.0f)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63_u_dir_light_color.xyz * (max(dot(float4(_63_u_dir_light_dir.x, _63_u_dir_light_dir.y, _63_u_dir_light_dir.z, 0.0f), float4(normal, 0.0f)), 0.0f) * _63_u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.Sample(smp, uv); + float3 _275 = (_250.xyz * (1.0f - min((_257.x + _257.y) + _257.z, 1.0f))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0f - _63_u_color_override.w)) + (_63_u_color_override.xyz * _63_u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63_u_cameraPos - position); + frag_color = float4(lerp(c.xyz, _63_u_fog_color.xyz, calcFogFactor(param_4).xxx), 1.0f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + position = stage_input.position; + normal = stage_input.normal; + tangent = stage_input.tangent; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vertex.hlsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vertex.hlsl new file mode 100644 index 00000000..76ea618b --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vertex.hlsl @@ -0,0 +1,67 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _16_u_projViewMatrix : packoffset(c0); + row_major float4x4 _16_u_modelMatrix : packoffset(c4); + float4 _16_u_color : packoffset(c8); + float4 _16_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; +static float4 position; +static float4 pos; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + color = color0 * _16_u_color; + uv = texcoord0 + _16_u_tex_pan.xy; + normal = normalize(mul(float4(normals, 0.0f), _16_u_modelMatrix)).xyz; + tangent = tangents; + position = mul(pos, _16_u_modelMatrix); + gl_Position = mul(position, _16_u_projViewMatrix); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + pos = stage_input.pos; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + stage_output.position = position; + return stage_output; +} diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vs.hlsl b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vs.hlsl new file mode 100644 index 00000000..76ea618b --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vs.hlsl @@ -0,0 +1,67 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _16_u_projViewMatrix : packoffset(c0); + row_major float4x4 _16_u_modelMatrix : packoffset(c4); + float4 _16_u_color : packoffset(c8); + float4 _16_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; +static float4 position; +static float4 pos; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + color = color0 * _16_u_color; + uv = texcoord0 + _16_u_tex_pan.xy; + normal = normalize(mul(float4(normals, 0.0f), _16_u_modelMatrix)).xyz; + tangent = tangents; + position = mul(pos, _16_u_modelMatrix); + gl_Position = mul(position, _16_u_projViewMatrix); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + pos = stage_input.pos; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + stage_output.position = position; + return stage_output; +} diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fragment.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fragment.metal new file mode 100644 index 00000000..6b4e07dc --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fragment.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.color; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fs.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fs.metal new file mode 100644 index 00000000..6b4e07dc --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fs.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.color; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vertex.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vertex.metal new file mode 100644 index 00000000..663e8d00 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vertex.metal @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.color = in.color0 * _16.u_color; + out.uv = in.texcoord0 + _16.u_tex_pan.xy; + out.normal = fast::normalize(_16.u_modelMatrix * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _16.u_modelMatrix * in.pos; + out.gl_Position = _16.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vs.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vs.metal new file mode 100644 index 00000000..663e8d00 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vs.metal @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.color = in.color0 * _16.u_color; + out.uv = in.texcoord0 + _16.u_tex_pan.xy; + out.normal = fast::normalize(_16.u_modelMatrix * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _16.u_modelMatrix * in.pos; + out.gl_Position = _16.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fragment.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fragment.metal new file mode 100644 index 00000000..6b4e07dc --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fragment.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.color; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fs.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fs.metal new file mode 100644 index 00000000..6b4e07dc --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fs.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.color; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vertex.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vertex.metal new file mode 100644 index 00000000..663e8d00 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vertex.metal @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.color = in.color0 * _16.u_color; + out.uv = in.texcoord0 + _16.u_tex_pan.xy; + out.normal = fast::normalize(_16.u_modelMatrix * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _16.u_modelMatrix * in.pos; + out.gl_Position = _16.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vs.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vs.metal new file mode 100644 index 00000000..663e8d00 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vs.metal @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.color = in.color0 * _16.u_color; + out.uv = in.texcoord0 + _16.u_tex_pan.xy; + out.normal = fast::normalize(_16.u_modelMatrix * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _16.u_modelMatrix * in.pos; + out.gl_Position = _16.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fragment.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fragment.metal new file mode 100644 index 00000000..6b4e07dc --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fragment.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.color; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fs.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fs.metal new file mode 100644 index 00000000..6b4e07dc --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fs.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.color; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _329 = _198; + _329.x = _200.x; + _329.y = _200.y; + _329.z = _200.z; + lit_color = _329; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _335 = _239; + _335.x = _241.x; + _335.y = _241.y; + _335.z = _241.z; + lit_color = _335; + float4 _250 = c * _335; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _344 = _250; + _344.x = _275.x; + _344.y = _275.y; + _344.z = _275.z; + float3 _296 = (_344.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _350 = _344; + _350.x = _296.x; + _350.y = _296.y; + _350.z = _296.z; + c = _350; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vertex.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vertex.metal new file mode 100644 index 00000000..663e8d00 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vertex.metal @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.color = in.color0 * _16.u_color; + out.uv = in.texcoord0 + _16.u_tex_pan.xy; + out.normal = fast::normalize(_16.u_modelMatrix * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _16.u_modelMatrix * in.pos; + out.gl_Position = _16.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vs.metal b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vs.metal new file mode 100644 index 00000000..663e8d00 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vs.metal @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.color = in.color0 * _16.u_color; + out.uv = in.texcoord0 + _16.u_tex_pan.xy; + out.normal = fast::normalize(_16.u_modelMatrix * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _16.u_modelMatrix * in.pos; + out.gl_Position = _16.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fragment b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fragment new file mode 100644 index 00000000..f10e0a04 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fragment @@ -0,0 +1,261 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct fs_params { + /* @offset(0) */ + u_cameraPos : vec4f, + /* @offset(16) */ + u_color_override : vec4f, + /* @offset(32) */ + u_alpha_cutoff : f32, + /* @offset(48) */ + u_ambient_light : vec4f, + /* @offset(64) */ + u_dir_light_dir : vec4f, + /* @offset(80) */ + u_dir_light_color : vec4f, + /* @offset(96) */ + u_num_point_lights : f32, + /* @offset(112) */ + u_point_light_data : Arr, + /* @offset(624) */ + u_fog_data : vec4f, + /* @offset(640) */ + u_fog_color : vec4f, +} + +@group(0) @binding(8) var x_63 : fs_params; + +@group(1) @binding(64) var tex : texture_2d; + +@group(1) @binding(80) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +var position_1 : vec4f; + +var normal : vec3f; + +@group(1) @binding(65) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var tangent : vec4f; + +fn sqr_f1_(x : ptr) -> f32 { + let x_22 : f32 = *(x); + let x_23 : f32 = *(x); + return (x_22 * x_23); +} + +fn attenuate_light_f1_f1_f1_f1_(distance_1 : ptr, radius : ptr, max_intensity : ptr, falloff : ptr) -> f32 { + var s : f32; + var s2 : f32; + var param : f32; + var param_1 : f32; + let x_28 : f32 = *(distance_1); + let x_29 : f32 = *(radius); + s = (x_28 / x_29); + let x_31 : f32 = s; + if ((x_31 >= 1.0f)) { + return 0.0f; + } + let x_41 : f32 = s; + param = x_41; + let x_42 : f32 = sqr_f1_(&(param)); + s2 = x_42; + let x_43 : f32 = *(max_intensity); + let x_44 : f32 = s2; + param_1 = (1.0f - x_44); + let x_47 : f32 = sqr_f1_(&(param_1)); + let x_49 : f32 = *(falloff); + let x_50 : f32 = s; + return ((x_43 * x_47) / (1.0f + (x_49 * x_50))); +} + +fn calcFogFactor_f1_(distance_to_eye : ptr) -> f32 { + var fog_start : f32; + var fog_end : f32; + var fog_amount : f32; + var fog_factor : f32; + let x_69 : f32 = x_63.u_fog_data.x; + fog_start = x_69; + let x_73 : f32 = x_63.u_fog_data.y; + fog_end = x_73; + let x_78 : f32 = x_63.u_fog_color.w; + fog_amount = x_78; + let x_80 : f32 = *(distance_to_eye); + let x_81 : f32 = fog_start; + let x_83 : f32 = fog_end; + let x_84 : f32 = fog_start; + fog_factor = ((x_80 - x_81) / (x_83 - x_84)); + let x_87 : f32 = fog_factor; + let x_88 : f32 = fog_amount; + return clamp((x_87 * x_88), 0.0f, 1.0f); +} + +fn main_1() { + var c : vec4f; + var lit_color : vec4f; + var i : i32; + var point_light_pos_data : vec4f; + var point_light_color_data : vec4f; + var lightPosEye : vec3f; + var lightColor : vec3f; + var lightMinusPos : vec3f; + var lightDir : vec3f; + var lightBrightness : f32; + var dist : f32; + var radius_1 : f32; + var attenuation : f32; + var param_2 : f32; + var param_3 : f32; + var param_4 : f32; + var param_5 : f32; + var lightDir_1 : vec4f; + var lightColor_1 : vec4f; + var lightBrightness_1 : f32; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + var fog_factor_1 : f32; + var param_6 : f32; + let x_108 : vec2f = uv; + let x_109 : vec4f = textureSample(tex, smp, x_108); + let x_112 : vec4f = color; + c = (x_109 * x_112); + let x_118 : vec4f = x_63.u_ambient_light; + lit_color = x_118; + let x_120 : f32 = c.w; + let x_123 : f32 = x_63.u_alpha_cutoff; + if ((x_120 <= x_123)) { + discard; + } + i = 0i; + loop { + let x_136 : i32 = i; + let x_139 : f32 = x_63.u_num_point_lights; + if ((x_136 < i32(x_139))) { + } else { + break; + } + let x_144 : i32 = i; + let x_147 : vec4f = x_63.u_point_light_data[(x_144 * 2i)]; + point_light_pos_data = x_147; + let x_149 : i32 = i; + let x_154 : vec4f = x_63.u_point_light_data[((x_149 * 2i) + 1i)]; + point_light_color_data = x_154; + let x_158 : vec4f = point_light_pos_data; + lightPosEye = vec3f(x_158.x, x_158.y, x_158.z); + let x_161 : vec4f = point_light_color_data; + lightColor = vec3f(x_161.x, x_161.y, x_161.z); + let x_164 : vec3f = lightPosEye; + let x_166 : vec4f = position_1; + lightMinusPos = (x_164 - vec3f(x_166.x, x_166.y, x_166.z)); + let x_170 : vec3f = lightMinusPos; + lightDir = normalize(x_170); + let x_173 : vec3f = lightDir; + let x_176 : vec3f = normal; + lightBrightness = max(dot(x_173, x_176), 0.0f); + let x_180 : vec3f = lightMinusPos; + dist = length(x_180); + let x_184 : f32 = point_light_pos_data.w; + radius_1 = x_184; + let x_187 : f32 = dist; + param_2 = x_187; + let x_189 : f32 = radius_1; + param_3 = x_189; + param_4 = 1.0f; + param_5 = 1.0f; + let x_192 : f32 = attenuate_light_f1_f1_f1_f1_(&(param_2), &(param_3), &(param_4), &(param_5)); + attenuation = x_192; + let x_193 : f32 = lightBrightness; + let x_194 : vec3f = lightColor; + let x_196 : f32 = attenuation; + let x_198 : vec4f = lit_color; + let x_200 : vec3f = (vec3f(x_198.x, x_198.y, x_198.z) + ((x_194 * x_193) * x_196)); + lit_color.x = x_200.x; + lit_color.y = x_200.y; + lit_color.z = x_200.z; + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1i); + } + } + let x_213 : f32 = x_63.u_dir_light_dir.x; + let x_215 : f32 = x_63.u_dir_light_dir.y; + let x_217 : f32 = x_63.u_dir_light_dir.z; + lightDir_1 = vec4f(x_213, x_215, x_217, 0.0f); + let x_222 : vec4f = x_63.u_dir_light_color; + lightColor_1 = x_222; + let x_224 : vec4f = lightDir_1; + let x_225 : vec3f = normal; + let x_233 : f32 = x_63.u_dir_light_dir.w; + lightBrightness_1 = (max(dot(x_224, vec4f(x_225.x, x_225.y, x_225.z, 0.0f)), 0.0f) * x_233); + let x_235 : f32 = lightBrightness_1; + let x_236 : vec4f = lightColor_1; + let x_239 : vec4f = lit_color; + let x_241 : vec3f = (vec3f(x_239.x, x_239.y, x_239.z) + (vec3f(x_236.x, x_236.y, x_236.z) * x_235)); + lit_color.x = x_241.x; + lit_color.y = x_241.y; + lit_color.z = x_241.z; + let x_248 : vec4f = lit_color; + let x_249 : vec4f = c; + c = (x_249 * x_248); + let x_256 : vec2f = uv; + let x_257 : vec4f = textureSample(tex_emissive, smp, x_256); + e = x_257; + let x_260 : f32 = e.x; + let x_262 : f32 = e.y; + let x_265 : f32 = e.z; + e_amt = min(((x_260 + x_262) + x_265), 1.0f); + let x_268 : vec4f = c; + let x_270 : f32 = e_amt; + let x_273 : vec4f = e; + let x_275 : vec3f = ((vec3f(x_268.x, x_268.y, x_268.z) * (1.0f - x_270)) + vec3f(x_273.x, x_273.y, x_273.z)); + c.x = x_275.x; + c.y = x_275.y; + c.z = x_275.z; + let x_284 : f32 = x_63.u_color_override.w; + override_mod = (1.0f - x_284); + let x_286 : vec4f = c; + let x_288 : f32 = override_mod; + let x_291 : vec4f = x_63.u_color_override; + let x_294 : f32 = x_63.u_color_override.w; + let x_296 : vec3f = ((vec3f(x_286.x, x_286.y, x_286.z) * x_288) + (vec3f(x_291.x, x_291.y, x_291.z) * x_294)); + c.x = x_296.x; + c.y = x_296.y; + c.z = x_296.z; + let x_305 : vec4f = x_63.u_cameraPos; + let x_306 : vec4f = position_1; + param_6 = length((x_305 - x_306)); + let x_310 : f32 = calcFogFactor_f1_(&(param_6)); + fog_factor_1 = x_310; + let x_313 : vec4f = c; + let x_316 : vec4f = x_63.u_fog_color; + let x_318 : f32 = fog_factor_1; + let x_320 : vec3f = mix(vec3f(x_313.x, x_313.y, x_313.z), vec3f(x_316.x, x_316.y, x_316.z), vec3f(x_318, x_318, x_318)); + frag_color = vec4f(x_320.x, x_320.y, x_320.z, 1.0f); + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f, @location(4) position_1_param : vec4f, @location(2) normal_param : vec3f, @location(3) tangent_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + position_1 = position_1_param; + normal = normal_param; + tangent = tangent_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fs b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fs new file mode 100644 index 00000000..72a5e2d8 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fs @@ -0,0 +1,261 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct fs_params { + /* @offset(0) */ + u_cameraPos : vec4f, + /* @offset(16) */ + u_color_override : vec4f, + /* @offset(32) */ + u_alpha_cutoff : f32, + /* @offset(48) */ + u_ambient_light : vec4f, + /* @offset(64) */ + u_dir_light_dir : vec4f, + /* @offset(80) */ + u_dir_light_color : vec4f, + /* @offset(96) */ + u_num_point_lights : f32, + /* @offset(112) */ + u_point_light_data : Arr, + /* @offset(624) */ + u_fog_data : vec4f, + /* @offset(640) */ + u_fog_color : vec4f, +} + +@group(0) @binding(4) var x_63 : fs_params; + +@group(1) @binding(48) var tex : texture_2d; + +@group(1) @binding(64) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +var position_1 : vec4f; + +var normal : vec3f; + +@group(1) @binding(49) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var tangent : vec4f; + +fn sqr_f1_(x : ptr) -> f32 { + let x_22 : f32 = *(x); + let x_23 : f32 = *(x); + return (x_22 * x_23); +} + +fn attenuate_light_f1_f1_f1_f1_(distance_1 : ptr, radius : ptr, max_intensity : ptr, falloff : ptr) -> f32 { + var s : f32; + var s2 : f32; + var param : f32; + var param_1 : f32; + let x_28 : f32 = *(distance_1); + let x_29 : f32 = *(radius); + s = (x_28 / x_29); + let x_31 : f32 = s; + if ((x_31 >= 1.0f)) { + return 0.0f; + } + let x_41 : f32 = s; + param = x_41; + let x_42 : f32 = sqr_f1_(&(param)); + s2 = x_42; + let x_43 : f32 = *(max_intensity); + let x_44 : f32 = s2; + param_1 = (1.0f - x_44); + let x_47 : f32 = sqr_f1_(&(param_1)); + let x_49 : f32 = *(falloff); + let x_50 : f32 = s; + return ((x_43 * x_47) / (1.0f + (x_49 * x_50))); +} + +fn calcFogFactor_f1_(distance_to_eye : ptr) -> f32 { + var fog_start : f32; + var fog_end : f32; + var fog_amount : f32; + var fog_factor : f32; + let x_69 : f32 = x_63.u_fog_data.x; + fog_start = x_69; + let x_73 : f32 = x_63.u_fog_data.y; + fog_end = x_73; + let x_78 : f32 = x_63.u_fog_color.w; + fog_amount = x_78; + let x_80 : f32 = *(distance_to_eye); + let x_81 : f32 = fog_start; + let x_83 : f32 = fog_end; + let x_84 : f32 = fog_start; + fog_factor = ((x_80 - x_81) / (x_83 - x_84)); + let x_87 : f32 = fog_factor; + let x_88 : f32 = fog_amount; + return clamp((x_87 * x_88), 0.0f, 1.0f); +} + +fn main_1() { + var c : vec4f; + var lit_color : vec4f; + var i : i32; + var point_light_pos_data : vec4f; + var point_light_color_data : vec4f; + var lightPosEye : vec3f; + var lightColor : vec3f; + var lightMinusPos : vec3f; + var lightDir : vec3f; + var lightBrightness : f32; + var dist : f32; + var radius_1 : f32; + var attenuation : f32; + var param_2 : f32; + var param_3 : f32; + var param_4 : f32; + var param_5 : f32; + var lightDir_1 : vec4f; + var lightColor_1 : vec4f; + var lightBrightness_1 : f32; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + var fog_factor_1 : f32; + var param_6 : f32; + let x_108 : vec2f = uv; + let x_109 : vec4f = textureSample(tex, smp, x_108); + let x_112 : vec4f = color; + c = (x_109 * x_112); + let x_118 : vec4f = x_63.u_ambient_light; + lit_color = x_118; + let x_120 : f32 = c.w; + let x_123 : f32 = x_63.u_alpha_cutoff; + if ((x_120 <= x_123)) { + discard; + } + i = 0i; + loop { + let x_136 : i32 = i; + let x_139 : f32 = x_63.u_num_point_lights; + if ((x_136 < i32(x_139))) { + } else { + break; + } + let x_144 : i32 = i; + let x_147 : vec4f = x_63.u_point_light_data[(x_144 * 2i)]; + point_light_pos_data = x_147; + let x_149 : i32 = i; + let x_154 : vec4f = x_63.u_point_light_data[((x_149 * 2i) + 1i)]; + point_light_color_data = x_154; + let x_158 : vec4f = point_light_pos_data; + lightPosEye = vec3f(x_158.x, x_158.y, x_158.z); + let x_161 : vec4f = point_light_color_data; + lightColor = vec3f(x_161.x, x_161.y, x_161.z); + let x_164 : vec3f = lightPosEye; + let x_166 : vec4f = position_1; + lightMinusPos = (x_164 - vec3f(x_166.x, x_166.y, x_166.z)); + let x_170 : vec3f = lightMinusPos; + lightDir = normalize(x_170); + let x_173 : vec3f = lightDir; + let x_176 : vec3f = normal; + lightBrightness = max(dot(x_173, x_176), 0.0f); + let x_180 : vec3f = lightMinusPos; + dist = length(x_180); + let x_184 : f32 = point_light_pos_data.w; + radius_1 = x_184; + let x_187 : f32 = dist; + param_2 = x_187; + let x_189 : f32 = radius_1; + param_3 = x_189; + param_4 = 1.0f; + param_5 = 1.0f; + let x_192 : f32 = attenuate_light_f1_f1_f1_f1_(&(param_2), &(param_3), &(param_4), &(param_5)); + attenuation = x_192; + let x_193 : f32 = lightBrightness; + let x_194 : vec3f = lightColor; + let x_196 : f32 = attenuation; + let x_198 : vec4f = lit_color; + let x_200 : vec3f = (vec3f(x_198.x, x_198.y, x_198.z) + ((x_194 * x_193) * x_196)); + lit_color.x = x_200.x; + lit_color.y = x_200.y; + lit_color.z = x_200.z; + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1i); + } + } + let x_213 : f32 = x_63.u_dir_light_dir.x; + let x_215 : f32 = x_63.u_dir_light_dir.y; + let x_217 : f32 = x_63.u_dir_light_dir.z; + lightDir_1 = vec4f(x_213, x_215, x_217, 0.0f); + let x_222 : vec4f = x_63.u_dir_light_color; + lightColor_1 = x_222; + let x_224 : vec4f = lightDir_1; + let x_225 : vec3f = normal; + let x_233 : f32 = x_63.u_dir_light_dir.w; + lightBrightness_1 = (max(dot(x_224, vec4f(x_225.x, x_225.y, x_225.z, 0.0f)), 0.0f) * x_233); + let x_235 : f32 = lightBrightness_1; + let x_236 : vec4f = lightColor_1; + let x_239 : vec4f = lit_color; + let x_241 : vec3f = (vec3f(x_239.x, x_239.y, x_239.z) + (vec3f(x_236.x, x_236.y, x_236.z) * x_235)); + lit_color.x = x_241.x; + lit_color.y = x_241.y; + lit_color.z = x_241.z; + let x_248 : vec4f = lit_color; + let x_249 : vec4f = c; + c = (x_249 * x_248); + let x_256 : vec2f = uv; + let x_257 : vec4f = textureSample(tex_emissive, smp, x_256); + e = x_257; + let x_260 : f32 = e.x; + let x_262 : f32 = e.y; + let x_265 : f32 = e.z; + e_amt = min(((x_260 + x_262) + x_265), 1.0f); + let x_268 : vec4f = c; + let x_270 : f32 = e_amt; + let x_273 : vec4f = e; + let x_275 : vec3f = ((vec3f(x_268.x, x_268.y, x_268.z) * (1.0f - x_270)) + vec3f(x_273.x, x_273.y, x_273.z)); + c.x = x_275.x; + c.y = x_275.y; + c.z = x_275.z; + let x_284 : f32 = x_63.u_color_override.w; + override_mod = (1.0f - x_284); + let x_286 : vec4f = c; + let x_288 : f32 = override_mod; + let x_291 : vec4f = x_63.u_color_override; + let x_294 : f32 = x_63.u_color_override.w; + let x_296 : vec3f = ((vec3f(x_286.x, x_286.y, x_286.z) * x_288) + (vec3f(x_291.x, x_291.y, x_291.z) * x_294)); + c.x = x_296.x; + c.y = x_296.y; + c.z = x_296.z; + let x_305 : vec4f = x_63.u_cameraPos; + let x_306 : vec4f = position_1; + param_6 = length((x_305 - x_306)); + let x_310 : f32 = calcFogFactor_f1_(&(param_6)); + fog_factor_1 = x_310; + let x_313 : vec4f = c; + let x_316 : vec4f = x_63.u_fog_color; + let x_318 : f32 = fog_factor_1; + let x_320 : vec3f = mix(vec3f(x_313.x, x_313.y, x_313.z), vec3f(x_316.x, x_316.y, x_316.z), vec3f(x_318, x_318, x_318)); + frag_color = vec4f(x_320.x, x_320.y, x_320.z, 1.0f); + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f, @location(4) position_1_param : vec4f, @location(2) normal_param : vec3f, @location(3) tangent_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + position_1 = position_1_param; + normal = normal_param; + tangent = tangent_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vertex b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vertex new file mode 100644 index 00000000..31cc678c --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vertex @@ -0,0 +1,85 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +var color : vec4f; + +var color0 : vec4f; + +@group(0) @binding(0) var x_16 : vs_params; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var position_1 : vec4f; + +var pos : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + let x_12 : vec4f = color0; + let x_21 : vec4f = x_16.u_color; + color = (x_12 * x_21); + let x_28 : vec2f = texcoord0; + let x_31 : vec4f = x_16.u_tex_pan; + uv = (x_28 + vec2f(x_31.x, x_31.y)); + let x_40 : mat4x4f = x_16.u_modelMatrix; + let x_43 : vec3f = normals; + let x_50 : vec4f = normalize((x_40 * vec4f(x_43.x, x_43.y, x_43.z, 0.0f))); + normal = vec3f(x_50.x, x_50.y, x_50.z); + let x_54 : vec4f = tangents; + tangent = x_54; + let x_57 : mat4x4f = x_16.u_modelMatrix; + let x_59 : vec4f = pos; + position_1 = (x_57 * x_59); + let x_69 : mat4x4f = x_16.u_projViewMatrix; + let x_70 : vec4f = position_1; + gl_Position = (x_69 * x_70); + return; +} + +struct main_out { + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, + @location(4) + position_1_1 : vec4f, + @builtin(position) + gl_Position : vec4f, +} + +@vertex +fn main(@location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f, @location(0) pos_param : vec4f) -> main_out { + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + pos = pos_param; + main_1(); + return main_out(color, uv, normal, tangent, position_1, gl_Position); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vs b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vs new file mode 100644 index 00000000..31cc678c --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vs @@ -0,0 +1,85 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +var color : vec4f; + +var color0 : vec4f; + +@group(0) @binding(0) var x_16 : vs_params; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var position_1 : vec4f; + +var pos : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + let x_12 : vec4f = color0; + let x_21 : vec4f = x_16.u_color; + color = (x_12 * x_21); + let x_28 : vec2f = texcoord0; + let x_31 : vec4f = x_16.u_tex_pan; + uv = (x_28 + vec2f(x_31.x, x_31.y)); + let x_40 : mat4x4f = x_16.u_modelMatrix; + let x_43 : vec3f = normals; + let x_50 : vec4f = normalize((x_40 * vec4f(x_43.x, x_43.y, x_43.z, 0.0f))); + normal = vec3f(x_50.x, x_50.y, x_50.z); + let x_54 : vec4f = tangents; + tangent = x_54; + let x_57 : mat4x4f = x_16.u_modelMatrix; + let x_59 : vec4f = pos; + position_1 = (x_57 * x_59); + let x_69 : mat4x4f = x_16.u_projViewMatrix; + let x_70 : vec4f = position_1; + gl_Position = (x_69 * x_70); + return; +} + +struct main_out { + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, + @location(4) + position_1_1 : vec4f, + @builtin(position) + gl_Position : vec4f, +} + +@vertex +fn main(@location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f, @location(0) pos_param : vec4f) -> main_out { + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + pos = pos_param; + main_1(); + return main_out(color, uv, normal, tangent, position_1, gl_Position); +} + diff --git a/assets/shaders/built/basic-lighting/basic-lighting_reflection.yaml b/assets/shaders/built/basic-lighting/basic-lighting_reflection.yaml new file mode 100644 index 00000000..b0141758 --- /dev/null +++ b/assets/shaders/built/basic-lighting/basic-lighting_reflection.yaml @@ -0,0 +1,1112 @@ +shaders: + - + slang: glsl430 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl430_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + glsl_uniforms: + - + type: vec4 + array_count: 41 + offset: 0 + glsl_name: fs_params + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: glsl300es + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_glsl300es_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + glsl_uniforms: + - + type: vec4 + array_count: 41 + offset: 0 + glsl_name: fs_params + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: hlsl4 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_vertex.hlsl + is_binary: false + entry_point: main + d3d11_target: vs_4_0 + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_hlsl4_fragment.hlsl + is_binary: false + entry_point: main + d3d11_target: ps_4_0 + attrs: + - + slot: 0 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 0 + - + slot: 1 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 1 + - + slot: 2 + type: vec2 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 2 + - + slot: 3 + type: vec3 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 3 + - + slot: 4 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + hlsl_register_b_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + hlsl_register_b_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + hlsl_register_s_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_macos + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_macos_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + msl_buffer_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_ios + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_ios_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + msl_buffer_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_sim + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_metal_sim_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + msl_buffer_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: wgsl + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_vertex + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/basic-lighting/basic-lighting_emissive_wgsl_fragment + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _16 + wgsl_group0_binding_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + wgsl_group0_binding_n: 8 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 64 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 65 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + wgsl_group1_binding_n: 80 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fragment.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fragment.glsl new file mode 100644 index 00000000..67177b2a --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fragment.glsl @@ -0,0 +1,29 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _54 = c; + highp vec3 _65 = (_54.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fs.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fs.glsl new file mode 100644 index 00000000..67177b2a --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fs.glsl @@ -0,0 +1,29 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _54 = c; + highp vec3 _65 = (_54.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vertex.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vertex.glsl new file mode 100644 index 00000000..d50c3633 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vertex.glsl @@ -0,0 +1,18 @@ +#version 300 es + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 3) in vec3 normals; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vs.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vs.glsl new file mode 100644 index 00000000..d50c3633 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vs.glsl @@ -0,0 +1,18 @@ +#version 300 es + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 3) in vec3 normals; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl430_fragment.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_fragment.glsl new file mode 100644 index 00000000..408ad35f --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_fragment.glsl @@ -0,0 +1,27 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 16) uniform sampler2D tex_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _54 = c; + vec3 _65 = (_54.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl430_fs.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_fs.glsl new file mode 100644 index 00000000..d2023828 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_fs.glsl @@ -0,0 +1,27 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 0) uniform sampler2D tex_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _54 = c; + vec3 _65 = (_54.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl430_vertex.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_vertex.glsl new file mode 100644 index 00000000..6e4234c8 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_vertex.glsl @@ -0,0 +1,18 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 3) in vec3 normals; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_glsl430_vs.glsl b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_vs.glsl new file mode 100644 index 00000000..6e4234c8 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_glsl430_vs.glsl @@ -0,0 +1,18 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 3) in vec3 normals; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fragment.hlsl b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fragment.hlsl new file mode 100644 index 00000000..b752549a --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fragment.hlsl @@ -0,0 +1,51 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); + +static float2 uv; +static float4 color; +static float4 frag_color; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fs.hlsl b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fs.hlsl new file mode 100644 index 00000000..b752549a --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fs.hlsl @@ -0,0 +1,51 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); + +static float2 uv; +static float4 color; +static float4 frag_color; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vertex.hlsl b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vertex.hlsl new file mode 100644 index 00000000..98bcf894 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vertex.hlsl @@ -0,0 +1,55 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _19_u_projViewMatrix : packoffset(c0); + row_major float4x4 _19_u_modelMatrix : packoffset(c4); + float4 _19_u_color : packoffset(c8); + float4 _19_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normals; +static float4 tangents; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(pos, mul(_19_u_modelMatrix, _19_u_projViewMatrix)); + color = color0 * _19_u_color; + uv = texcoord0 + _19_u_tex_pan.xy; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + return stage_output; +} diff --git a/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vs.hlsl b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vs.hlsl new file mode 100644 index 00000000..98bcf894 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vs.hlsl @@ -0,0 +1,55 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _19_u_projViewMatrix : packoffset(c0); + row_major float4x4 _19_u_modelMatrix : packoffset(c4); + float4 _19_u_color : packoffset(c8); + float4 _19_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normals; +static float4 tangents; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(pos, mul(_19_u_modelMatrix, _19_u_projViewMatrix)); + color = color0 * _19_u_color; + uv = texcoord0 + _19_u_tex_pan.xy; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + return stage_output; +} diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fragment.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fragment.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fragment.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fs.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fs.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fs.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vertex.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vertex.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vertex.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vs.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vs.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vs.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fragment.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fragment.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fragment.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fs.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fs.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fs.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vertex.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vertex.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vertex.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vs.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vs.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vs.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fragment.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fragment.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fragment.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fs.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fs.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fs.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vertex.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vertex.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vertex.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vs.metal b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vs.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vs.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_wgsl_fragment b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_fragment new file mode 100644 index 00000000..133f7d27 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_fragment @@ -0,0 +1,61 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(64) var tex : texture_2d; + +@group(1) @binding(80) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(8) var x_36 : fs_params; + +var frag_color : vec4f; + +fn main_1() { + var c : vec4f; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_51 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_51); + let x_54 : vec4f = c; + let x_56 : f32 = override_mod; + let x_60 : vec4f = x_36.u_color_override; + let x_63 : f32 = x_36.u_color_override.w; + let x_65 : vec3f = ((vec3f(x_54.x, x_54.y, x_54.z) * x_56) + (vec3f(x_60.x, x_60.y, x_60.z) * x_63)); + c.x = x_65.x; + c.y = x_65.y; + c.z = x_65.z; + let x_77 : vec4f = c; + frag_color = x_77; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_wgsl_fs b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_fs new file mode 100644 index 00000000..65aff0c8 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_fs @@ -0,0 +1,61 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(48) var tex : texture_2d; + +@group(1) @binding(64) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(4) var x_36 : fs_params; + +var frag_color : vec4f; + +fn main_1() { + var c : vec4f; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_51 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_51); + let x_54 : vec4f = c; + let x_56 : f32 = override_mod; + let x_60 : vec4f = x_36.u_color_override; + let x_63 : f32 = x_36.u_color_override.w; + let x_65 : vec3f = ((vec3f(x_54.x, x_54.y, x_54.z) * x_56) + (vec3f(x_60.x, x_60.y, x_60.z) * x_63)); + c.x = x_65.x; + c.y = x_65.y; + c.z = x_65.z; + let x_77 : vec4f = c; + frag_color = x_77; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_wgsl_vertex b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_vertex new file mode 100644 index 00000000..83aaf7b7 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_vertex @@ -0,0 +1,65 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +@group(0) @binding(0) var x_19 : vs_params; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normals : vec3f; + +var tangents : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + let x_22 : mat4x4f = x_19.u_projViewMatrix; + let x_25 : mat4x4f = x_19.u_modelMatrix; + let x_29 : vec4f = pos; + gl_Position = ((x_22 * x_25) * x_29); + let x_35 : vec4f = color0; + let x_39 : vec4f = x_19.u_color; + color = (x_35 * x_39); + let x_46 : vec2f = texcoord0; + let x_49 : vec4f = x_19.u_tex_pan; + uv = (x_46 + vec2f(x_49.x, x_49.y)); + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, +} + +@vertex +fn main(@location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f) -> main_out { + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + main_1(); + return main_out(gl_Position, color, uv); +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_default_wgsl_vs b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_vs new file mode 100644 index 00000000..83aaf7b7 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_default_wgsl_vs @@ -0,0 +1,65 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +@group(0) @binding(0) var x_19 : vs_params; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normals : vec3f; + +var tangents : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + let x_22 : mat4x4f = x_19.u_projViewMatrix; + let x_25 : mat4x4f = x_19.u_modelMatrix; + let x_29 : vec4f = pos; + gl_Position = ((x_22 * x_25) * x_29); + let x_35 : vec4f = color0; + let x_39 : vec4f = x_19.u_color; + color = (x_35 * x_39); + let x_46 : vec2f = texcoord0; + let x_49 : vec4f = x_19.u_tex_pan; + uv = (x_46 + vec2f(x_49.x, x_49.y)); + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, +} + +@vertex +fn main(@location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f) -> main_out { + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + main_1(); + return main_out(gl_Position, color, uv); +} + diff --git a/assets/shaders/built/default-mesh/default-mesh_reflection.yaml b/assets/shaders/built/default-mesh/default-mesh_reflection.yaml new file mode 100644 index 00000000..ae8c8f98 --- /dev/null +++ b/assets/shaders/built/default-mesh/default-mesh_reflection.yaml @@ -0,0 +1,734 @@ +shaders: + - + slang: glsl430 + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_glsl430_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_glsl430_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slang: glsl300es + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_glsl300es_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_glsl300es_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slang: hlsl4 + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_hlsl4_vertex.hlsl + is_binary: false + entry_point: main + d3d11_target: vs_4_0 + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_hlsl4_fragment.hlsl + is_binary: false + entry_point: main + d3d11_target: ps_4_0 + attrs: + - + slot: 0 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 0 + - + slot: 1 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 1 + - + slot: 2 + type: vec2 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 2 + - + slot: 3 + type: vec3 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 3 + - + slot: 4 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + hlsl_register_b_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + hlsl_register_b_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + hlsl_register_s_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slang: metal_macos + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_metal_macos_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_metal_macos_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slang: metal_ios + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_metal_ios_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_metal_ios_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slang: metal_sim + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_metal_sim_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_metal_sim_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slang: wgsl + programs: + - + name: default + vertex_func: + path: assets/shaders/built/default-mesh/default-mesh_default_wgsl_vertex + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/default-mesh/default-mesh_default_wgsl_fragment + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + wgsl_group0_binding_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + wgsl_group0_binding_n: 8 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 64 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + wgsl_group1_binding_n: 80 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp diff --git a/assets/shaders/built/default/default_default_glsl300es_fragment.glsl b/assets/shaders/built/default/default_default_glsl300es_fragment.glsl new file mode 100644 index 00000000..67177b2a --- /dev/null +++ b/assets/shaders/built/default/default_default_glsl300es_fragment.glsl @@ -0,0 +1,29 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _54 = c; + highp vec3 _65 = (_54.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + diff --git a/assets/shaders/built/default/default_default_glsl300es_vertex.glsl b/assets/shaders/built/default/default_default_glsl300es_vertex.glsl new file mode 100644 index 00000000..9ac99cf6 --- /dev/null +++ b/assets/shaders/built/default/default_default_glsl300es_vertex.glsl @@ -0,0 +1,16 @@ +#version 300 es + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; +} + diff --git a/assets/shaders/built/default/default_default_glsl430_fragment.glsl b/assets/shaders/built/default/default_default_glsl430_fragment.glsl new file mode 100644 index 00000000..408ad35f --- /dev/null +++ b/assets/shaders/built/default/default_default_glsl430_fragment.glsl @@ -0,0 +1,27 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 16) uniform sampler2D tex_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _54 = c; + vec3 _65 = (_54.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + diff --git a/assets/shaders/built/default/default_default_glsl430_vertex.glsl b/assets/shaders/built/default/default_default_glsl430_vertex.glsl new file mode 100644 index 00000000..e71ae99e --- /dev/null +++ b/assets/shaders/built/default/default_default_glsl430_vertex.glsl @@ -0,0 +1,16 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; +} + diff --git a/assets/shaders/built/default/default_default_hlsl4_fragment.hlsl b/assets/shaders/built/default/default_default_hlsl4_fragment.hlsl new file mode 100644 index 00000000..b752549a --- /dev/null +++ b/assets/shaders/built/default/default_default_hlsl4_fragment.hlsl @@ -0,0 +1,51 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); + +static float2 uv; +static float4 color; +static float4 frag_color; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + frag_color = _80; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/default/default_default_hlsl4_vertex.hlsl b/assets/shaders/built/default/default_default_hlsl4_vertex.hlsl new file mode 100644 index 00000000..1dda26f9 --- /dev/null +++ b/assets/shaders/built/default/default_default_hlsl4_vertex.hlsl @@ -0,0 +1,49 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _19_u_projViewMatrix : packoffset(c0); + row_major float4x4 _19_u_modelMatrix : packoffset(c4); + float4 _19_u_color : packoffset(c8); + float4 _19_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(pos, mul(_19_u_modelMatrix, _19_u_projViewMatrix)); + color = color0 * _19_u_color; + uv = texcoord0 + _19_u_tex_pan.xy; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + return stage_output; +} diff --git a/assets/shaders/built/default/default_default_metal_ios_fragment.metal b/assets/shaders/built/default/default_default_metal_ios_fragment.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default/default_default_metal_ios_fragment.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default/default_default_metal_ios_vertex.metal b/assets/shaders/built/default/default_default_metal_ios_vertex.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default/default_default_metal_ios_vertex.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default/default_default_metal_macos_fragment.metal b/assets/shaders/built/default/default_default_metal_macos_fragment.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default/default_default_metal_macos_fragment.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default/default_default_metal_macos_vertex.metal b/assets/shaders/built/default/default_default_metal_macos_vertex.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default/default_default_metal_macos_vertex.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default/default_default_metal_sim_fragment.metal b/assets/shaders/built/default/default_default_metal_sim_fragment.metal new file mode 100644 index 00000000..0bbbbb4c --- /dev/null +++ b/assets/shaders/built/default/default_default_metal_sim_fragment.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _54 = c; + float3 _65 = (_54.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _80 = _54; + _80.x = _65.x; + _80.y = _65.y; + _80.z = _65.z; + c = _80; + out.frag_color = _80; + return out; +} + diff --git a/assets/shaders/built/default/default_default_metal_sim_vertex.metal b/assets/shaders/built/default/default_default_metal_sim_vertex.metal new file mode 100644 index 00000000..67a5f2cb --- /dev/null +++ b/assets/shaders/built/default/default_default_metal_sim_vertex.metal @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + return out; +} + diff --git a/assets/shaders/built/default/default_default_wgsl_fragment b/assets/shaders/built/default/default_default_wgsl_fragment new file mode 100644 index 00000000..133f7d27 --- /dev/null +++ b/assets/shaders/built/default/default_default_wgsl_fragment @@ -0,0 +1,61 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(64) var tex : texture_2d; + +@group(1) @binding(80) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(8) var x_36 : fs_params; + +var frag_color : vec4f; + +fn main_1() { + var c : vec4f; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_51 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_51); + let x_54 : vec4f = c; + let x_56 : f32 = override_mod; + let x_60 : vec4f = x_36.u_color_override; + let x_63 : f32 = x_36.u_color_override.w; + let x_65 : vec3f = ((vec3f(x_54.x, x_54.y, x_54.z) * x_56) + (vec3f(x_60.x, x_60.y, x_60.z) * x_63)); + c.x = x_65.x; + c.y = x_65.y; + c.z = x_65.z; + let x_77 : vec4f = c; + frag_color = x_77; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/default/default_default_wgsl_vertex b/assets/shaders/built/default/default_default_wgsl_vertex new file mode 100644 index 00000000..c6ed41af --- /dev/null +++ b/assets/shaders/built/default/default_default_wgsl_vertex @@ -0,0 +1,59 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +@group(0) @binding(0) var x_19 : vs_params; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var gl_Position : vec4f; + +fn main_1() { + let x_22 : mat4x4f = x_19.u_projViewMatrix; + let x_25 : mat4x4f = x_19.u_modelMatrix; + let x_29 : vec4f = pos; + gl_Position = ((x_22 * x_25) * x_29); + let x_35 : vec4f = color0; + let x_39 : vec4f = x_19.u_color; + color = (x_35 * x_39); + let x_46 : vec2f = texcoord0; + let x_49 : vec4f = x_19.u_tex_pan; + uv = (x_46 + vec2f(x_49.x, x_49.y)); + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, +} + +@vertex +fn main(@location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f) -> main_out { + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + main_1(); + return main_out(gl_Position, color, uv); +} + diff --git a/assets/shaders/built/default/default_reflection.yaml b/assets/shaders/built/default/default_reflection.yaml index f6a28b6d..3cc70cf5 100644 --- a/assets/shaders/built/default/default_reflection.yaml +++ b/assets/shaders/built/default/default_reflection.yaml @@ -4,971 +4,681 @@ shaders: programs: - name: default - vs: - path: assets/shaders/built/default/default_default_glsl430_vs.glsl + vertex_func: + path: assets/shaders/built/default/default_default_glsl430_vertex.glsl is_binary: false entry_point: main - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_glsl430_fs.glsl + fragment_func: + path: assets/shaders/built/default/default_default_glsl430_fragment.glsl is_binary: false entry_point: main - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp - slang: glsl300es programs: - name: default - vs: - path: assets/shaders/built/default/default_default_glsl300es_vs.glsl + vertex_func: + path: assets/shaders/built/default/default_default_glsl300es_vertex.glsl is_binary: false entry_point: main - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_glsl300es_fs.glsl + fragment_func: + path: assets/shaders/built/default/default_default_glsl300es_fragment.glsl is_binary: false entry_point: main - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp - slang: hlsl4 programs: - name: default - vs: - path: assets/shaders/built/default/default_default_hlsl4_vs.hlsl + vertex_func: + path: assets/shaders/built/default/default_default_hlsl4_vertex.hlsl is_binary: false entry_point: main - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_hlsl4_fs.hlsl + d3d11_target: vs_4_0 + fragment_func: + path: assets/shaders/built/default/default_default_hlsl4_fragment.hlsl is_binary: false entry_point: main - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + d3d11_target: ps_4_0 + attrs: + - + slot: 0 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 0 + - + slot: 1 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 1 + - + slot: 2 + type: vec2 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 2 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + hlsl_register_b_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + hlsl_register_b_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + hlsl_register_s_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp - slang: metal_macos programs: - name: default - vs: - path: assets/shaders/built/default/default_default_metal_macos_vs.metal + vertex_func: + path: assets/shaders/built/default/default_default_metal_macos_vertex.metal is_binary: false entry_point: main0 - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_metal_macos_fs.metal + fragment_func: + path: assets/shaders/built/default/default_default_metal_macos_fragment.metal is_binary: false entry_point: main0 - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp - slang: metal_ios programs: - name: default - vs: - path: assets/shaders/built/default/default_default_metal_ios_vs.metal + vertex_func: + path: assets/shaders/built/default/default_default_metal_ios_vertex.metal is_binary: false entry_point: main0 - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_metal_ios_fs.metal + fragment_func: + path: assets/shaders/built/default/default_default_metal_ios_fragment.metal is_binary: false entry_point: main0 - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp - slang: metal_sim programs: - name: default - vs: - path: assets/shaders/built/default/default_default_metal_sim_vs.metal + vertex_func: + path: assets/shaders/built/default/default_default_metal_sim_vertex.metal is_binary: false entry_point: main0 - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_metal_sim_fs.metal + fragment_func: + path: assets/shaders/built/default/default_default_metal_sim_fragment.metal is_binary: false entry_point: main0 - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp - slang: wgsl programs: - name: default - vs: - path: assets/shaders/built/default/default_default_wgsl_vs + vertex_func: + path: assets/shaders/built/default/default_default_wgsl_vertex is_binary: false entry_point: main - inputs: - - - slot: 0 - name: pos - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: color0 - sem_name: TEXCOORD - sem_index: 1 - type: vec4 - - - slot: 2 - name: texcoord0 - sem_name: TEXCOORD - sem_index: 2 - type: vec2 - outputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - uniform_blocks: - - - slot: 0 - size: 160 - struct_name: vs_params - inst_name: _19 - uniforms: - - - name: vs_params - type: vec4 - array_count: 10 - offset: 0 - members: - - - name: u_projViewMatrix - type: mat4 - array_count: 0 - offset: 0 - - - name: u_modelMatrix - type: mat4 - array_count: 0 - offset: 64 - - - name: u_color - type: vec4 - array_count: 0 - offset: 128 - - - name: u_tex_pan - type: vec4 - array_count: 0 - offset: 144 - fs: - path: assets/shaders/built/default/default_default_wgsl_fs + fragment_func: + path: assets/shaders/built/default/default_default_wgsl_fragment is_binary: false entry_point: main - inputs: - - - slot: 0 - name: color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - - - slot: 1 - name: uv - sem_name: TEXCOORD - sem_index: 1 - type: vec2 - outputs: - - - slot: 0 - name: frag_color - sem_name: TEXCOORD - sem_index: 0 - type: vec4 - uniform_blocks: - - - slot: 0 - size: 32 - struct_name: fs_params - inst_name: _36 - uniforms: - - - name: fs_params - type: vec4 - array_count: 2 - offset: 0 - members: - - - name: u_color_override - type: vec4 - array_count: 0 - offset: 0 - - - name: u_alpha_cutoff - type: float - array_count: 0 - offset: 16 - images: - - - slot: 0 - name: tex - multisampled: false - type: 2d - sample_type: float - samplers: - - - slot: 0 - name: smp - sampler_type: filtering - image_sampler_pairs: - - - slot: 0 - name: tex_smp - image_name: tex - sampler_name: smp + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + wgsl_group0_binding_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + wgsl_group0_binding_n: 8 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 64 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + wgsl_group1_binding_n: 80 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl300es_fragment.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl300es_fragment.glsl new file mode 100644 index 00000000..1b057476 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl300es_fragment.glsl @@ -0,0 +1,38 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; +in highp vec3 normal; +in highp vec4 tangent; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _53 = texture(tex_emissive_smp, uv); + highp vec4 _69 = c; + highp vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + highp vec4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + highp vec3 _99 = (_117.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + frag_color = _123; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl300es_fs.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl300es_fs.glsl new file mode 100644 index 00000000..1b057476 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl300es_fs.glsl @@ -0,0 +1,38 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; +in highp vec3 normal; +in highp vec4 tangent; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _53 = texture(tex_emissive_smp, uv); + highp vec4 _69 = c; + highp vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + highp vec4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + highp vec3 _99 = (_117.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + frag_color = _123; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl300es_vertex.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl300es_vertex.glsl new file mode 100644 index 00000000..71b414cf --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl300es_vertex.glsl @@ -0,0 +1,22 @@ +#version 300 es + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + normal = normals; + tangent = tangents; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl300es_vs.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl300es_vs.glsl new file mode 100644 index 00000000..71b414cf --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl300es_vs.glsl @@ -0,0 +1,22 @@ +#version 300 es + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + normal = normals; + tangent = tangents; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl430_fragment.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl430_fragment.glsl new file mode 100644 index 00000000..b3ff8f2f --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl430_fragment.glsl @@ -0,0 +1,36 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 16) uniform sampler2D tex_smp; +layout(binding = 17) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; +layout(location = 2) in vec3 normal; +layout(location = 3) in vec4 tangent; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _53 = texture(tex_emissive_smp, uv); + vec4 _69 = c; + vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + vec4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + vec3 _99 = (_117.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + frag_color = _123; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl430_fs.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl430_fs.glsl new file mode 100644 index 00000000..328ba037 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl430_fs.glsl @@ -0,0 +1,36 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 0) uniform sampler2D tex_smp; +layout(binding = 1) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; +layout(location = 2) in vec3 normal; +layout(location = 3) in vec4 tangent; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _53 = texture(tex_emissive_smp, uv); + vec4 _69 = c; + vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + vec4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + vec3 _99 = (_117.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + frag_color = _123; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl430_vertex.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl430_vertex.glsl new file mode 100644 index 00000000..d12ef69b --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl430_vertex.glsl @@ -0,0 +1,22 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + normal = normals; + tangent = tangents; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_glsl430_vs.glsl b/assets/shaders/built/emissive/emissive_emissive_glsl430_vs.glsl new file mode 100644 index 00000000..d12ef69b --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_glsl430_vs.glsl @@ -0,0 +1,22 @@ +#version 430 + +uniform vec4 vs_params[10]; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; + +void main() +{ + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[9].xy; + normal = normals; + tangent = tangents; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_hlsl4_fragment.hlsl b/assets/shaders/built/emissive/emissive_emissive_hlsl4_fragment.hlsl new file mode 100644 index 00000000..1ab67ec8 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_hlsl4_fragment.hlsl @@ -0,0 +1,64 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 color; +static float4 frag_color; +static float3 normal; +static float4 tangent; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _53 = tex_emissive.Sample(smp, uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0f - min((_53.x + _53.y) + _53.z, 1.0f))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + frag_color = _123; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + normal = stage_input.normal; + tangent = stage_input.tangent; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/emissive/emissive_emissive_hlsl4_fs.hlsl b/assets/shaders/built/emissive/emissive_emissive_hlsl4_fs.hlsl new file mode 100644 index 00000000..1ab67ec8 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_hlsl4_fs.hlsl @@ -0,0 +1,64 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 color; +static float4 frag_color; +static float3 normal; +static float4 tangent; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _53 = tex_emissive.Sample(smp, uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0f - min((_53.x + _53.y) + _53.z, 1.0f))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + frag_color = _123; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + normal = stage_input.normal; + tangent = stage_input.tangent; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/emissive/emissive_emissive_hlsl4_vertex.hlsl b/assets/shaders/built/emissive/emissive_emissive_hlsl4_vertex.hlsl new file mode 100644 index 00000000..0713c61e --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_hlsl4_vertex.hlsl @@ -0,0 +1,63 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _19_u_projViewMatrix : packoffset(c0); + row_major float4x4 _19_u_modelMatrix : packoffset(c4); + float4 _19_u_color : packoffset(c8); + float4 _19_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(pos, mul(_19_u_modelMatrix, _19_u_projViewMatrix)); + color = color0 * _19_u_color; + uv = texcoord0 + _19_u_tex_pan.xy; + normal = normals; + tangent = tangents; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + return stage_output; +} diff --git a/assets/shaders/built/emissive/emissive_emissive_hlsl4_vs.hlsl b/assets/shaders/built/emissive/emissive_emissive_hlsl4_vs.hlsl new file mode 100644 index 00000000..0713c61e --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_hlsl4_vs.hlsl @@ -0,0 +1,63 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _19_u_projViewMatrix : packoffset(c0); + row_major float4x4 _19_u_modelMatrix : packoffset(c4); + float4 _19_u_color : packoffset(c8); + float4 _19_u_tex_pan : packoffset(c9); +}; + + +static float4 gl_Position; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(pos, mul(_19_u_modelMatrix, _19_u_projViewMatrix)); + color = color0 * _19_u_color; + uv = texcoord0 + _19_u_tex_pan.xy; + normal = normals; + tangent = tangents; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + return stage_output; +} diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_ios_fragment.metal b/assets/shaders/built/emissive/emissive_emissive_metal_ios_fragment.metal new file mode 100644 index 00000000..03ab4fea --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_ios_fragment.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + out.frag_color = _123; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_ios_fs.metal b/assets/shaders/built/emissive/emissive_emissive_metal_ios_fs.metal new file mode 100644 index 00000000..03ab4fea --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_ios_fs.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + out.frag_color = _123; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_ios_vertex.metal b/assets/shaders/built/emissive/emissive_emissive_metal_ios_vertex.metal new file mode 100644 index 00000000..7f5ac6ae --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_ios_vertex.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_ios_vs.metal b/assets/shaders/built/emissive/emissive_emissive_metal_ios_vs.metal new file mode 100644 index 00000000..7f5ac6ae --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_ios_vs.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_macos_fragment.metal b/assets/shaders/built/emissive/emissive_emissive_metal_macos_fragment.metal new file mode 100644 index 00000000..03ab4fea --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_macos_fragment.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + out.frag_color = _123; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_macos_fs.metal b/assets/shaders/built/emissive/emissive_emissive_metal_macos_fs.metal new file mode 100644 index 00000000..03ab4fea --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_macos_fs.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + out.frag_color = _123; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_macos_vertex.metal b/assets/shaders/built/emissive/emissive_emissive_metal_macos_vertex.metal new file mode 100644 index 00000000..7f5ac6ae --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_macos_vertex.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_macos_vs.metal b/assets/shaders/built/emissive/emissive_emissive_metal_macos_vs.metal new file mode 100644 index 00000000..7f5ac6ae --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_macos_vs.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_sim_fragment.metal b/assets/shaders/built/emissive/emissive_emissive_metal_sim_fragment.metal new file mode 100644 index 00000000..03ab4fea --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_sim_fragment.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + out.frag_color = _123; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_sim_fs.metal b/assets/shaders/built/emissive/emissive_emissive_metal_sim_fs.metal new file mode 100644 index 00000000..03ab4fea --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_sim_fs.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _117 = _69; + _117.x = _76.x; + _117.y = _76.y; + _117.z = _76.z; + float3 _99 = (_117.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _123 = _117; + _123.x = _99.x; + _123.y = _99.y; + _123.z = _99.z; + c = _123; + out.frag_color = _123; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_sim_vertex.metal b/assets/shaders/built/emissive/emissive_emissive_metal_sim_vertex.metal new file mode 100644 index 00000000..7f5ac6ae --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_sim_vertex.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_metal_sim_vs.metal b/assets/shaders/built/emissive/emissive_emissive_metal_sim_vs.metal new file mode 100644 index 00000000..7f5ac6ae --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_metal_sim_vs.metal @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_19.u_projViewMatrix * _19.u_modelMatrix) * in.pos; + out.color = in.color0 * _19.u_color; + out.uv = in.texcoord0 + _19.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + return out; +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_wgsl_fragment b/assets/shaders/built/emissive/emissive_emissive_wgsl_fragment new file mode 100644 index 00000000..8824d56e --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_wgsl_fragment @@ -0,0 +1,85 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(64) var tex : texture_2d; + +@group(1) @binding(80) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(8) var x_36 : fs_params; + +@group(1) @binding(65) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var normal : vec3f; + +var tangent : vec4f; + +fn main_1() { + var c : vec4f; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_52 : vec2f = uv; + let x_53 : vec4f = textureSample(tex_emissive, smp, x_52); + e = x_53; + let x_57 : f32 = e.x; + let x_60 : f32 = e.y; + let x_64 : f32 = e.z; + e_amt = min(((x_57 + x_60) + x_64), 1.0f); + let x_69 : vec4f = c; + let x_71 : f32 = e_amt; + let x_74 : vec4f = e; + let x_76 : vec3f = ((vec3f(x_69.x, x_69.y, x_69.z) * (1.0f - x_71)) + vec3f(x_74.x, x_74.y, x_74.z)); + c.x = x_76.x; + c.y = x_76.y; + c.z = x_76.z; + let x_86 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_86); + let x_88 : vec4f = c; + let x_90 : f32 = override_mod; + let x_94 : vec4f = x_36.u_color_override; + let x_97 : f32 = x_36.u_color_override.w; + let x_99 : vec3f = ((vec3f(x_88.x, x_88.y, x_88.z) * x_90) + (vec3f(x_94.x, x_94.y, x_94.z) * x_97)); + c.x = x_99.x; + c.y = x_99.y; + c.z = x_99.z; + let x_108 : vec4f = c; + frag_color = x_108; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f, @location(2) normal_param : vec3f, @location(3) tangent_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + normal = normal_param; + tangent = tangent_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_wgsl_fs b/assets/shaders/built/emissive/emissive_emissive_wgsl_fs new file mode 100644 index 00000000..1b1d49dd --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_wgsl_fs @@ -0,0 +1,85 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(48) var tex : texture_2d; + +@group(1) @binding(64) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(4) var x_36 : fs_params; + +@group(1) @binding(49) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var normal : vec3f; + +var tangent : vec4f; + +fn main_1() { + var c : vec4f; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_52 : vec2f = uv; + let x_53 : vec4f = textureSample(tex_emissive, smp, x_52); + e = x_53; + let x_57 : f32 = e.x; + let x_60 : f32 = e.y; + let x_64 : f32 = e.z; + e_amt = min(((x_57 + x_60) + x_64), 1.0f); + let x_69 : vec4f = c; + let x_71 : f32 = e_amt; + let x_74 : vec4f = e; + let x_76 : vec3f = ((vec3f(x_69.x, x_69.y, x_69.z) * (1.0f - x_71)) + vec3f(x_74.x, x_74.y, x_74.z)); + c.x = x_76.x; + c.y = x_76.y; + c.z = x_76.z; + let x_86 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_86); + let x_88 : vec4f = c; + let x_90 : f32 = override_mod; + let x_94 : vec4f = x_36.u_color_override; + let x_97 : f32 = x_36.u_color_override.w; + let x_99 : vec3f = ((vec3f(x_88.x, x_88.y, x_88.z) * x_90) + (vec3f(x_94.x, x_94.y, x_94.z) * x_97)); + c.x = x_99.x; + c.y = x_99.y; + c.z = x_99.z; + let x_108 : vec4f = c; + frag_color = x_108; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f, @location(2) normal_param : vec3f, @location(3) tangent_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + normal = normal_param; + tangent = tangent_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_wgsl_vertex b/assets/shaders/built/emissive/emissive_emissive_wgsl_vertex new file mode 100644 index 00000000..3ad19261 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_wgsl_vertex @@ -0,0 +1,77 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +@group(0) @binding(0) var x_19 : vs_params; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + let x_22 : mat4x4f = x_19.u_projViewMatrix; + let x_25 : mat4x4f = x_19.u_modelMatrix; + let x_29 : vec4f = pos; + gl_Position = ((x_22 * x_25) * x_29); + let x_35 : vec4f = color0; + let x_39 : vec4f = x_19.u_color; + color = (x_35 * x_39); + let x_46 : vec2f = texcoord0; + let x_49 : vec4f = x_19.u_tex_pan; + uv = (x_46 + vec2f(x_49.x, x_49.y)); + let x_57 : vec3f = normals; + normal = x_57; + let x_60 : vec4f = tangents; + tangent = x_60; + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, +} + +@vertex +fn main(@location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f) -> main_out { + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + main_1(); + return main_out(gl_Position, color, uv, normal, tangent); +} + diff --git a/assets/shaders/built/emissive/emissive_emissive_wgsl_vs b/assets/shaders/built/emissive/emissive_emissive_wgsl_vs new file mode 100644 index 00000000..3ad19261 --- /dev/null +++ b/assets/shaders/built/emissive/emissive_emissive_wgsl_vs @@ -0,0 +1,77 @@ +diagnostic(off, derivative_uniformity); + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_tex_pan : vec4f, +} + +@group(0) @binding(0) var x_19 : vs_params; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + let x_22 : mat4x4f = x_19.u_projViewMatrix; + let x_25 : mat4x4f = x_19.u_modelMatrix; + let x_29 : vec4f = pos; + gl_Position = ((x_22 * x_25) * x_29); + let x_35 : vec4f = color0; + let x_39 : vec4f = x_19.u_color; + color = (x_35 * x_39); + let x_46 : vec2f = texcoord0; + let x_49 : vec4f = x_19.u_tex_pan; + uv = (x_46 + vec2f(x_49.x, x_49.y)); + let x_57 : vec3f = normals; + normal = x_57; + let x_60 : vec4f = tangents; + tangent = x_60; + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, +} + +@vertex +fn main(@location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f) -> main_out { + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + main_1(); + return main_out(gl_Position, color, uv, normal, tangent); +} + diff --git a/assets/shaders/built/emissive/emissive_reflection.yaml b/assets/shaders/built/emissive/emissive_reflection.yaml new file mode 100644 index 00000000..9b515bdf --- /dev/null +++ b/assets/shaders/built/emissive/emissive_reflection.yaml @@ -0,0 +1,832 @@ +shaders: + - + slang: glsl430 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_glsl430_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_glsl430_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: glsl300es + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_glsl300es_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_glsl300es_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + glsl_uniforms: + - + type: vec4 + array_count: 10 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: hlsl4 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_hlsl4_vertex.hlsl + is_binary: false + entry_point: main + d3d11_target: vs_4_0 + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_hlsl4_fragment.hlsl + is_binary: false + entry_point: main + d3d11_target: ps_4_0 + attrs: + - + slot: 0 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 0 + - + slot: 1 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 1 + - + slot: 2 + type: vec2 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 2 + - + slot: 3 + type: vec3 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 3 + - + slot: 4 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + hlsl_register_b_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + hlsl_register_b_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + hlsl_register_s_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_macos + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_metal_macos_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_metal_macos_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_ios + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_metal_ios_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_metal_ios_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_sim + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_metal_sim_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_metal_sim_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: wgsl + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/emissive/emissive_emissive_wgsl_vertex + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/emissive/emissive_emissive_wgsl_fragment + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 160 + struct_name: vs_params + inst_name: _19 + wgsl_group0_binding_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 144 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + wgsl_group0_binding_n: 8 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 64 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 65 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + wgsl_group1_binding_n: 80 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fragment.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fragment.glsl new file mode 100644 index 00000000..6939aa68 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fragment.glsl @@ -0,0 +1,87 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[41]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 baseDiffuse; +in highp vec4 position; +in highp vec3 normal; +layout(location = 0) out highp vec4 frag_color; +in highp vec4 color; +in highp vec4 tangent; + +highp float sqr(highp float x) +{ + return x * x; +} + +highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff) +{ + highp float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + highp float param = _30; + highp float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0); +} + +highp float calcFogFactor(highp float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + highp vec4 _113 = texture(tex_smp, uv) * baseDiffuse; + highp vec4 c = _113; + highp vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + highp float param = length(_168); + highp float param_1 = fs_params[_145 * 1 + 7].w; + highp float param_2 = 1.0; + highp float param_3 = 1.0; + highp vec4 _198 = lit_color; + highp vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + highp vec4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + highp vec4 _239 = lit_color; + highp vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + highp vec4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + highp vec4 _250 = c * _336; + highp vec4 _257 = texture(tex_emissive_smp, uv); + highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + highp vec4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + highp vec3 _296 = (_345.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + highp vec4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + highp float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fs.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fs.glsl new file mode 100644 index 00000000..6939aa68 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fs.glsl @@ -0,0 +1,87 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[41]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 baseDiffuse; +in highp vec4 position; +in highp vec3 normal; +layout(location = 0) out highp vec4 frag_color; +in highp vec4 color; +in highp vec4 tangent; + +highp float sqr(highp float x) +{ + return x * x; +} + +highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff) +{ + highp float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + highp float param = _30; + highp float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0); +} + +highp float calcFogFactor(highp float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + highp vec4 _113 = texture(tex_smp, uv) * baseDiffuse; + highp vec4 c = _113; + highp vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + highp float param = length(_168); + highp float param_1 = fs_params[_145 * 1 + 7].w; + highp float param_2 = 1.0; + highp float param_3 = 1.0; + highp vec4 _198 = lit_color; + highp vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + highp vec4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + highp vec4 _239 = lit_color; + highp vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + highp vec4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + highp vec4 _250 = c * _336; + highp vec4 _257 = texture(tex_emissive_smp, uv); + highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + highp vec4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + highp vec3 _296 = (_345.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + highp vec4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + highp float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vertex.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vertex.glsl new file mode 100644 index 00000000..c939399f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vertex.glsl @@ -0,0 +1,33 @@ +#version 300 es + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +out vec4 color; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; +out vec4 position; +layout(location = 0) in vec4 pos; +out vec4 baseDiffuse; +layout(location = 1) in vec4 color0; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + mat4 _104 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + color = vec4(0.0, 0.0, 0.0, 1.0); + uv = texcoord0 + vs_params[265].xy; + normal = normalize(_104 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _104 * pos; + baseDiffuse = color0 * vs_params[8]; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vs.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vs.glsl new file mode 100644 index 00000000..c939399f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vs.glsl @@ -0,0 +1,33 @@ +#version 300 es + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +out vec4 color; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; +out vec4 position; +layout(location = 0) in vec4 pos; +out vec4 baseDiffuse; +layout(location = 1) in vec4 color0; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + mat4 _104 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + color = vec4(0.0, 0.0, 0.0, 1.0); + uv = texcoord0 + vs_params[265].xy; + normal = normalize(_104 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _104 * pos; + baseDiffuse = color0 * vs_params[8]; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fragment.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fragment.glsl new file mode 100644 index 00000000..ad549362 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fragment.glsl @@ -0,0 +1,85 @@ +#version 430 + +uniform vec4 fs_params[41]; +layout(binding = 16) uniform sampler2D tex_smp; +layout(binding = 17) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 5) in vec4 baseDiffuse; +layout(location = 4) in vec4 position; +layout(location = 2) in vec3 normal; +layout(location = 0) out vec4 frag_color; +layout(location = 0) in vec4 color; +layout(location = 3) in vec4 tangent; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + vec4 _113 = texture(tex_smp, uv) * baseDiffuse; + vec4 c = _113; + vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + float param = length(_168); + float param_1 = fs_params[_145 * 1 + 7].w; + float param_2 = 1.0; + float param_3 = 1.0; + vec4 _198 = lit_color; + vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + vec4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + vec4 _239 = lit_color; + vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + vec4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + vec4 _250 = c * _336; + vec4 _257 = texture(tex_emissive_smp, uv); + vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + vec4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + vec3 _296 = (_345.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + vec4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fs.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fs.glsl new file mode 100644 index 00000000..8ad42675 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fs.glsl @@ -0,0 +1,85 @@ +#version 430 + +uniform vec4 fs_params[41]; +layout(binding = 0) uniform sampler2D tex_smp; +layout(binding = 1) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 5) in vec4 baseDiffuse; +layout(location = 4) in vec4 position; +layout(location = 2) in vec3 normal; +layout(location = 0) out vec4 frag_color; +layout(location = 0) in vec4 color; +layout(location = 3) in vec4 tangent; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0); +} + +void main() +{ + vec4 _113 = texture(tex_smp, uv) * baseDiffuse; + vec4 c = _113; + vec4 lit_color = fs_params[3]; + if (_113.w <= fs_params[2].x) + { + discard; + } + for (int i = 0; i < int(fs_params[6].x); i++) + { + int _145 = i * 2; + vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz; + float param = length(_168); + float param_1 = fs_params[_145 * 1 + 7].w; + float param_2 = 1.0; + float param_3 = 1.0; + vec4 _198 = lit_color; + vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + vec4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + vec4 _239 = lit_color; + vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w)); + vec4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + vec4 _250 = c * _336; + vec4 _257 = texture(tex_emissive_smp, uv); + vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + vec4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + vec3 _296 = (_345.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w); + vec4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(fs_params[0] - position); + frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vertex.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vertex.glsl new file mode 100644 index 00000000..1b7dff15 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vertex.glsl @@ -0,0 +1,33 @@ +#version 430 + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +layout(location = 0) out vec4 color; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; +layout(location = 4) out vec4 position; +layout(location = 0) in vec4 pos; +layout(location = 5) out vec4 baseDiffuse; +layout(location = 1) in vec4 color0; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + mat4 _104 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + color = vec4(0.0, 0.0, 0.0, 1.0); + uv = texcoord0 + vs_params[265].xy; + normal = normalize(_104 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _104 * pos; + baseDiffuse = color0 * vs_params[8]; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vs.glsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vs.glsl new file mode 100644 index 00000000..1b7dff15 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vs.glsl @@ -0,0 +1,33 @@ +#version 430 + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +layout(location = 0) out vec4 color; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; +layout(location = 4) out vec4 position; +layout(location = 0) in vec4 pos; +layout(location = 5) out vec4 baseDiffuse; +layout(location = 1) in vec4 color0; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + mat4 _104 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + color = vec4(0.0, 0.0, 0.0, 1.0); + uv = texcoord0 + vs_params[265].xy; + normal = normalize(_104 * vec4(normals, 0.0)).xyz; + tangent = tangents; + position = _104 * pos; + baseDiffuse = color0 * vs_params[8]; + gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fragment.hlsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fragment.hlsl new file mode 100644 index 00000000..ed1e1c6e --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fragment.hlsl @@ -0,0 +1,125 @@ +cbuffer fs_params : register(b0) +{ + float4 _63_u_cameraPos : packoffset(c0); + float4 _63_u_color_override : packoffset(c1); + float _63_u_alpha_cutoff : packoffset(c2); + float4 _63_u_ambient_light : packoffset(c3); + float4 _63_u_dir_light_dir : packoffset(c4); + float4 _63_u_dir_light_color : packoffset(c5); + float _63_u_num_point_lights : packoffset(c6); + float4 _63_u_point_light_data[32] : packoffset(c7); + float4 _63_u_fog_data : packoffset(c39); + float4 _63_u_fog_color : packoffset(c40); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 baseDiffuse; +static float4 position; +static float3 normal; +static float4 frag_color; +static float4 color; +static float4 tangent; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; + float4 baseDiffuse : TEXCOORD5; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0f) + { + return 0.0f; + } + float param = _30; + float param_1 = 1.0f - sqr(param); + return (max_intensity * sqr(param_1)) / mad(falloff, _30, 1.0f); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - _63_u_fog_data.x) / (_63_u_fog_data.y - _63_u_fog_data.x)) * _63_u_fog_color.w, 0.0f, 1.0f); +} + +void frag_main() +{ + float4 _113 = tex.Sample(smp, uv) * baseDiffuse; + float4 c = _113; + float4 lit_color = _63_u_ambient_light; + if (_113.w <= _63_u_alpha_cutoff) + { + discard; + } + for (int i = 0; i < int(_63_u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63_u_point_light_data[_145].xyz - position.xyz; + float param = length(_168); + float param_1 = _63_u_point_light_data[_145].w; + float param_2 = 1.0f; + float param_3 = 1.0f; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63_u_point_light_data[_145 + 1].xyz * max(dot(normalize(_168), normal), 0.0f)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63_u_dir_light_color.xyz * (max(dot(float4(_63_u_dir_light_dir.x, _63_u_dir_light_dir.y, _63_u_dir_light_dir.z, 0.0f), float4(normal, 0.0f)), 0.0f) * _63_u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.Sample(smp, uv); + float3 _275 = (_250.xyz * (1.0f - min((_257.x + _257.y) + _257.z, 1.0f))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0f - _63_u_color_override.w)) + (_63_u_color_override.xyz * _63_u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63_u_cameraPos - position); + frag_color = float4(lerp(c.xyz, _63_u_fog_color.xyz, calcFogFactor(param_4).xxx), 1.0f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + baseDiffuse = stage_input.baseDiffuse; + position = stage_input.position; + normal = stage_input.normal; + color = stage_input.color; + tangent = stage_input.tangent; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fs.hlsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fs.hlsl new file mode 100644 index 00000000..ed1e1c6e --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fs.hlsl @@ -0,0 +1,125 @@ +cbuffer fs_params : register(b0) +{ + float4 _63_u_cameraPos : packoffset(c0); + float4 _63_u_color_override : packoffset(c1); + float _63_u_alpha_cutoff : packoffset(c2); + float4 _63_u_ambient_light : packoffset(c3); + float4 _63_u_dir_light_dir : packoffset(c4); + float4 _63_u_dir_light_color : packoffset(c5); + float _63_u_num_point_lights : packoffset(c6); + float4 _63_u_point_light_data[32] : packoffset(c7); + float4 _63_u_fog_data : packoffset(c39); + float4 _63_u_fog_color : packoffset(c40); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 baseDiffuse; +static float4 position; +static float3 normal; +static float4 frag_color; +static float4 color; +static float4 tangent; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; + float4 baseDiffuse : TEXCOORD5; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +float sqr(float x) +{ + return x * x; +} + +float attenuate_light(float _distance, float radius, float max_intensity, float falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0f) + { + return 0.0f; + } + float param = _30; + float param_1 = 1.0f - sqr(param); + return (max_intensity * sqr(param_1)) / mad(falloff, _30, 1.0f); +} + +float calcFogFactor(float distance_to_eye) +{ + return clamp(((distance_to_eye - _63_u_fog_data.x) / (_63_u_fog_data.y - _63_u_fog_data.x)) * _63_u_fog_color.w, 0.0f, 1.0f); +} + +void frag_main() +{ + float4 _113 = tex.Sample(smp, uv) * baseDiffuse; + float4 c = _113; + float4 lit_color = _63_u_ambient_light; + if (_113.w <= _63_u_alpha_cutoff) + { + discard; + } + for (int i = 0; i < int(_63_u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63_u_point_light_data[_145].xyz - position.xyz; + float param = length(_168); + float param_1 = _63_u_point_light_data[_145].w; + float param_2 = 1.0f; + float param_3 = 1.0f; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63_u_point_light_data[_145 + 1].xyz * max(dot(normalize(_168), normal), 0.0f)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63_u_dir_light_color.xyz * (max(dot(float4(_63_u_dir_light_dir.x, _63_u_dir_light_dir.y, _63_u_dir_light_dir.z, 0.0f), float4(normal, 0.0f)), 0.0f) * _63_u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.Sample(smp, uv); + float3 _275 = (_250.xyz * (1.0f - min((_257.x + _257.y) + _257.z, 1.0f))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0f - _63_u_color_override.w)) + (_63_u_color_override.xyz * _63_u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63_u_cameraPos - position); + frag_color = float4(lerp(c.xyz, _63_u_fog_color.xyz, calcFogFactor(param_4).xxx), 1.0f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + baseDiffuse = stage_input.baseDiffuse; + position = stage_input.position; + normal = stage_input.normal; + color = stage_input.color; + tangent = stage_input.tangent; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vertex.hlsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vertex.hlsl new file mode 100644 index 00000000..3d93da05 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vertex.hlsl @@ -0,0 +1,83 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _22_u_projViewMatrix : packoffset(c0); + row_major float4x4 _22_u_modelMatrix : packoffset(c4); + float4 _22_u_color : packoffset(c8); + row_major float4x4 _22_u_joints[64] : packoffset(c9); + float4 _22_u_tex_pan : packoffset(c265); +}; + + +static float4 gl_Position; +static float4 weights; +static float4 joints; +static float4 color; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; +static float4 position; +static float4 pos; +static float4 baseDiffuse; +static float4 color0; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; + float4 joints : TEXCOORD5; + float4 weights : TEXCOORD6; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; + float4 baseDiffuse : TEXCOORD5; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4x4 _32 = _22_u_joints[int(joints.x)] * weights.x; + float4x4 _41 = _22_u_joints[int(joints.y)] * weights.y; + float4x4 _63 = _22_u_joints[int(joints.z)] * weights.z; + float4x4 _85 = _22_u_joints[int(joints.w)] * weights.w; + float4x4 _104 = mul(float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]), _22_u_modelMatrix); + color = float4(0.0f, 0.0f, 0.0f, 1.0f); + uv = texcoord0 + _22_u_tex_pan.xy; + normal = normalize(mul(float4(normals, 0.0f), _104)).xyz; + tangent = tangents; + position = mul(pos, _104); + baseDiffuse = color0 * _22_u_color; + gl_Position = mul(position, _22_u_projViewMatrix); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + weights = stage_input.weights; + joints = stage_input.joints; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + pos = stage_input.pos; + color0 = stage_input.color0; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + stage_output.position = position; + stage_output.baseDiffuse = baseDiffuse; + return stage_output; +} diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vs.hlsl b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vs.hlsl new file mode 100644 index 00000000..3d93da05 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vs.hlsl @@ -0,0 +1,83 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _22_u_projViewMatrix : packoffset(c0); + row_major float4x4 _22_u_modelMatrix : packoffset(c4); + float4 _22_u_color : packoffset(c8); + row_major float4x4 _22_u_joints[64] : packoffset(c9); + float4 _22_u_tex_pan : packoffset(c265); +}; + + +static float4 gl_Position; +static float4 weights; +static float4 joints; +static float4 color; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; +static float4 position; +static float4 pos; +static float4 baseDiffuse; +static float4 color0; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; + float4 joints : TEXCOORD5; + float4 weights : TEXCOORD6; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 position : TEXCOORD4; + float4 baseDiffuse : TEXCOORD5; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4x4 _32 = _22_u_joints[int(joints.x)] * weights.x; + float4x4 _41 = _22_u_joints[int(joints.y)] * weights.y; + float4x4 _63 = _22_u_joints[int(joints.z)] * weights.z; + float4x4 _85 = _22_u_joints[int(joints.w)] * weights.w; + float4x4 _104 = mul(float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]), _22_u_modelMatrix); + color = float4(0.0f, 0.0f, 0.0f, 1.0f); + uv = texcoord0 + _22_u_tex_pan.xy; + normal = normalize(mul(float4(normals, 0.0f), _104)).xyz; + tangent = tangents; + position = mul(pos, _104); + baseDiffuse = color0 * _22_u_color; + gl_Position = mul(position, _22_u_projViewMatrix); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + weights = stage_input.weights; + joints = stage_input.joints; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + pos = stage_input.pos; + color0 = stage_input.color0; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + stage_output.position = position; + stage_output.baseDiffuse = baseDiffuse; + return stage_output; +} diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fragment.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fragment.metal new file mode 100644 index 00000000..a50ba5cc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fragment.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.baseDiffuse; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fs.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fs.metal new file mode 100644 index 00000000..a50ba5cc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fs.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.baseDiffuse; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vertex.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vertex.metal new file mode 100644 index 00000000..ddf4dd7f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vertex.metal @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + float4x4 _104 = _22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + out.color = float4(0.0, 0.0, 0.0, 1.0); + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = fast::normalize(_104 * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _104 * in.pos; + out.baseDiffuse = in.color0 * _22.u_color; + out.gl_Position = _22.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vs.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vs.metal new file mode 100644 index 00000000..ddf4dd7f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vs.metal @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + float4x4 _104 = _22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + out.color = float4(0.0, 0.0, 0.0, 1.0); + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = fast::normalize(_104 * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _104 * in.pos; + out.baseDiffuse = in.color0 * _22.u_color; + out.gl_Position = _22.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fragment.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fragment.metal new file mode 100644 index 00000000..a50ba5cc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fragment.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.baseDiffuse; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fs.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fs.metal new file mode 100644 index 00000000..a50ba5cc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fs.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.baseDiffuse; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vertex.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vertex.metal new file mode 100644 index 00000000..ddf4dd7f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vertex.metal @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + float4x4 _104 = _22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + out.color = float4(0.0, 0.0, 0.0, 1.0); + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = fast::normalize(_104 * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _104 * in.pos; + out.baseDiffuse = in.color0 * _22.u_color; + out.gl_Position = _22.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vs.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vs.metal new file mode 100644 index 00000000..ddf4dd7f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vs.metal @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + float4x4 _104 = _22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + out.color = float4(0.0, 0.0, 0.0, 1.0); + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = fast::normalize(_104 * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _104 * in.pos; + out.baseDiffuse = in.color0 * _22.u_color; + out.gl_Position = _22.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fragment.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fragment.metal new file mode 100644 index 00000000..a50ba5cc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fragment.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.baseDiffuse; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fs.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fs.metal new file mode 100644 index 00000000..a50ba5cc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fs.metal @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_cameraPos; + float4 u_color_override; + float u_alpha_cutoff; + float4 u_ambient_light; + float4 u_dir_light_dir; + float4 u_dir_light_color; + float u_num_point_lights; + float4 u_point_light_data[32]; + float4 u_fog_data; + float4 u_fog_color; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; +}; + +static inline __attribute__((always_inline)) +float sqr(thread const float& x) +{ + return x * x; +} + +static inline __attribute__((always_inline)) +float attenuate_light(thread const float& _distance, thread const float& radius, thread const float& max_intensity, thread const float& falloff) +{ + float _30 = _distance / radius; + if (_30 >= 1.0) + { + return 0.0; + } + float param = _30; + float param_1 = 1.0 - sqr(param); + return (max_intensity * sqr(param_1)) / fma(falloff, _30, 1.0); +} + +static inline __attribute__((always_inline)) +float calcFogFactor(thread const float& distance_to_eye, constant fs_params& _63) +{ + return fast::clamp(((distance_to_eye - _63.u_fog_data.x) / (_63.u_fog_data.y - _63.u_fog_data.x)) * _63.u_fog_color.w, 0.0, 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _63 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _113 = tex.sample(smp, in.uv) * in.baseDiffuse; + float4 c = _113; + float4 lit_color = _63.u_ambient_light; + if (_113.w <= _63.u_alpha_cutoff) + { + discard_fragment(); + } + for (int i = 0; i < int(_63.u_num_point_lights); i++) + { + int _145 = i * 2; + float3 _168 = _63.u_point_light_data[_145].xyz - in.position.xyz; + float param = length(_168); + float param_1 = _63.u_point_light_data[_145].w; + float param_2 = 1.0; + float param_3 = 1.0; + float4 _198 = lit_color; + float3 _200 = _198.xyz + ((_63.u_point_light_data[_145 + 1].xyz * fast::max(dot(fast::normalize(_168), in.normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3)); + float4 _330 = _198; + _330.x = _200.x; + _330.y = _200.y; + _330.z = _200.z; + lit_color = _330; + } + float4 _239 = lit_color; + float3 _241 = _239.xyz + (_63.u_dir_light_color.xyz * (fast::max(dot(float4(_63.u_dir_light_dir.x, _63.u_dir_light_dir.y, _63.u_dir_light_dir.z, 0.0), float4(in.normal, 0.0)), 0.0) * _63.u_dir_light_dir.w)); + float4 _336 = _239; + _336.x = _241.x; + _336.y = _241.y; + _336.z = _241.z; + lit_color = _336; + float4 _250 = c * _336; + float4 _257 = tex_emissive.sample(smp, in.uv); + float3 _275 = (_250.xyz * (1.0 - fast::min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz; + float4 _345 = _250; + _345.x = _275.x; + _345.y = _275.y; + _345.z = _275.z; + float3 _296 = (_345.xyz * (1.0 - _63.u_color_override.w)) + (_63.u_color_override.xyz * _63.u_color_override.w); + float4 _351 = _345; + _351.x = _296.x; + _351.y = _296.y; + _351.z = _296.z; + c = _351; + float param_4 = length(_63.u_cameraPos - in.position); + out.frag_color = float4(mix(c.xyz, _63.u_fog_color.xyz, float3(calcFogFactor(param_4, _63))), 1.0); + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vertex.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vertex.metal new file mode 100644 index 00000000..ddf4dd7f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vertex.metal @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + float4x4 _104 = _22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + out.color = float4(0.0, 0.0, 0.0, 1.0); + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = fast::normalize(_104 * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _104 * in.pos; + out.baseDiffuse = in.color0 * _22.u_color; + out.gl_Position = _22.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vs.metal b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vs.metal new file mode 100644 index 00000000..ddf4dd7f --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vs.metal @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 position [[user(locn4)]]; + float4 baseDiffuse [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + float4x4 _104 = _22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]); + out.color = float4(0.0, 0.0, 0.0, 1.0); + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = fast::normalize(_104 * float4(in.normals, 0.0)).xyz; + out.tangent = in.tangents; + out.position = _104 * in.pos; + out.baseDiffuse = in.color0 * _22.u_color; + out.gl_Position = _22.u_projViewMatrix * out.position; + return out; +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fragment b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fragment new file mode 100644 index 00000000..eaa43cdc --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fragment @@ -0,0 +1,264 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct fs_params { + /* @offset(0) */ + u_cameraPos : vec4f, + /* @offset(16) */ + u_color_override : vec4f, + /* @offset(32) */ + u_alpha_cutoff : f32, + /* @offset(48) */ + u_ambient_light : vec4f, + /* @offset(64) */ + u_dir_light_dir : vec4f, + /* @offset(80) */ + u_dir_light_color : vec4f, + /* @offset(96) */ + u_num_point_lights : f32, + /* @offset(112) */ + u_point_light_data : Arr, + /* @offset(624) */ + u_fog_data : vec4f, + /* @offset(640) */ + u_fog_color : vec4f, +} + +@group(0) @binding(8) var x_63 : fs_params; + +@group(1) @binding(64) var tex : texture_2d; + +@group(1) @binding(80) var smp : sampler; + +var uv : vec2f; + +var baseDiffuse : vec4f; + +var position_1 : vec4f; + +var normal : vec3f; + +@group(1) @binding(65) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var color : vec4f; + +var tangent : vec4f; + +fn sqr_f1_(x : ptr) -> f32 { + let x_22 : f32 = *(x); + let x_23 : f32 = *(x); + return (x_22 * x_23); +} + +fn attenuate_light_f1_f1_f1_f1_(distance_1 : ptr, radius : ptr, max_intensity : ptr, falloff : ptr) -> f32 { + var s : f32; + var s2 : f32; + var param : f32; + var param_1 : f32; + let x_28 : f32 = *(distance_1); + let x_29 : f32 = *(radius); + s = (x_28 / x_29); + let x_31 : f32 = s; + if ((x_31 >= 1.0f)) { + return 0.0f; + } + let x_41 : f32 = s; + param = x_41; + let x_42 : f32 = sqr_f1_(&(param)); + s2 = x_42; + let x_43 : f32 = *(max_intensity); + let x_44 : f32 = s2; + param_1 = (1.0f - x_44); + let x_47 : f32 = sqr_f1_(&(param_1)); + let x_49 : f32 = *(falloff); + let x_50 : f32 = s; + return ((x_43 * x_47) / (1.0f + (x_49 * x_50))); +} + +fn calcFogFactor_f1_(distance_to_eye : ptr) -> f32 { + var fog_start : f32; + var fog_end : f32; + var fog_amount : f32; + var fog_factor : f32; + let x_69 : f32 = x_63.u_fog_data.x; + fog_start = x_69; + let x_73 : f32 = x_63.u_fog_data.y; + fog_end = x_73; + let x_78 : f32 = x_63.u_fog_color.w; + fog_amount = x_78; + let x_80 : f32 = *(distance_to_eye); + let x_81 : f32 = fog_start; + let x_83 : f32 = fog_end; + let x_84 : f32 = fog_start; + fog_factor = ((x_80 - x_81) / (x_83 - x_84)); + let x_87 : f32 = fog_factor; + let x_88 : f32 = fog_amount; + return clamp((x_87 * x_88), 0.0f, 1.0f); +} + +fn main_1() { + var c : vec4f; + var lit_color : vec4f; + var i : i32; + var point_light_pos_data : vec4f; + var point_light_color_data : vec4f; + var lightPosEye : vec3f; + var lightColor : vec3f; + var lightMinusPos : vec3f; + var lightDir : vec3f; + var lightBrightness : f32; + var dist : f32; + var radius_1 : f32; + var attenuation : f32; + var param_2 : f32; + var param_3 : f32; + var param_4 : f32; + var param_5 : f32; + var lightDir_1 : vec4f; + var lightColor_1 : vec4f; + var lightBrightness_1 : f32; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + var fog_factor_1 : f32; + var param_6 : f32; + let x_108 : vec2f = uv; + let x_109 : vec4f = textureSample(tex, smp, x_108); + let x_112 : vec4f = baseDiffuse; + c = (x_109 * x_112); + let x_118 : vec4f = x_63.u_ambient_light; + lit_color = x_118; + let x_120 : f32 = c.w; + let x_123 : f32 = x_63.u_alpha_cutoff; + if ((x_120 <= x_123)) { + discard; + } + i = 0i; + loop { + let x_136 : i32 = i; + let x_139 : f32 = x_63.u_num_point_lights; + if ((x_136 < i32(x_139))) { + } else { + break; + } + let x_144 : i32 = i; + let x_147 : vec4f = x_63.u_point_light_data[(x_144 * 2i)]; + point_light_pos_data = x_147; + let x_149 : i32 = i; + let x_154 : vec4f = x_63.u_point_light_data[((x_149 * 2i) + 1i)]; + point_light_color_data = x_154; + let x_158 : vec4f = point_light_pos_data; + lightPosEye = vec3f(x_158.x, x_158.y, x_158.z); + let x_161 : vec4f = point_light_color_data; + lightColor = vec3f(x_161.x, x_161.y, x_161.z); + let x_164 : vec3f = lightPosEye; + let x_166 : vec4f = position_1; + lightMinusPos = (x_164 - vec3f(x_166.x, x_166.y, x_166.z)); + let x_170 : vec3f = lightMinusPos; + lightDir = normalize(x_170); + let x_173 : vec3f = lightDir; + let x_176 : vec3f = normal; + lightBrightness = max(dot(x_173, x_176), 0.0f); + let x_180 : vec3f = lightMinusPos; + dist = length(x_180); + let x_184 : f32 = point_light_pos_data.w; + radius_1 = x_184; + let x_187 : f32 = dist; + param_2 = x_187; + let x_189 : f32 = radius_1; + param_3 = x_189; + param_4 = 1.0f; + param_5 = 1.0f; + let x_192 : f32 = attenuate_light_f1_f1_f1_f1_(&(param_2), &(param_3), &(param_4), &(param_5)); + attenuation = x_192; + let x_193 : f32 = lightBrightness; + let x_194 : vec3f = lightColor; + let x_196 : f32 = attenuation; + let x_198 : vec4f = lit_color; + let x_200 : vec3f = (vec3f(x_198.x, x_198.y, x_198.z) + ((x_194 * x_193) * x_196)); + lit_color.x = x_200.x; + lit_color.y = x_200.y; + lit_color.z = x_200.z; + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1i); + } + } + let x_213 : f32 = x_63.u_dir_light_dir.x; + let x_215 : f32 = x_63.u_dir_light_dir.y; + let x_217 : f32 = x_63.u_dir_light_dir.z; + lightDir_1 = vec4f(x_213, x_215, x_217, 0.0f); + let x_222 : vec4f = x_63.u_dir_light_color; + lightColor_1 = x_222; + let x_224 : vec4f = lightDir_1; + let x_225 : vec3f = normal; + let x_233 : f32 = x_63.u_dir_light_dir.w; + lightBrightness_1 = (max(dot(x_224, vec4f(x_225.x, x_225.y, x_225.z, 0.0f)), 0.0f) * x_233); + let x_235 : f32 = lightBrightness_1; + let x_236 : vec4f = lightColor_1; + let x_239 : vec4f = lit_color; + let x_241 : vec3f = (vec3f(x_239.x, x_239.y, x_239.z) + (vec3f(x_236.x, x_236.y, x_236.z) * x_235)); + lit_color.x = x_241.x; + lit_color.y = x_241.y; + lit_color.z = x_241.z; + let x_248 : vec4f = lit_color; + let x_249 : vec4f = c; + c = (x_249 * x_248); + let x_256 : vec2f = uv; + let x_257 : vec4f = textureSample(tex_emissive, smp, x_256); + e = x_257; + let x_260 : f32 = e.x; + let x_262 : f32 = e.y; + let x_265 : f32 = e.z; + e_amt = min(((x_260 + x_262) + x_265), 1.0f); + let x_268 : vec4f = c; + let x_270 : f32 = e_amt; + let x_273 : vec4f = e; + let x_275 : vec3f = ((vec3f(x_268.x, x_268.y, x_268.z) * (1.0f - x_270)) + vec3f(x_273.x, x_273.y, x_273.z)); + c.x = x_275.x; + c.y = x_275.y; + c.z = x_275.z; + let x_284 : f32 = x_63.u_color_override.w; + override_mod = (1.0f - x_284); + let x_286 : vec4f = c; + let x_288 : f32 = override_mod; + let x_291 : vec4f = x_63.u_color_override; + let x_294 : f32 = x_63.u_color_override.w; + let x_296 : vec3f = ((vec3f(x_286.x, x_286.y, x_286.z) * x_288) + (vec3f(x_291.x, x_291.y, x_291.z) * x_294)); + c.x = x_296.x; + c.y = x_296.y; + c.z = x_296.z; + let x_305 : vec4f = x_63.u_cameraPos; + let x_306 : vec4f = position_1; + param_6 = length((x_305 - x_306)); + let x_310 : f32 = calcFogFactor_f1_(&(param_6)); + fog_factor_1 = x_310; + let x_313 : vec4f = c; + let x_316 : vec4f = x_63.u_fog_color; + let x_318 : f32 = fog_factor_1; + let x_320 : vec3f = mix(vec3f(x_313.x, x_313.y, x_313.z), vec3f(x_316.x, x_316.y, x_316.z), vec3f(x_318, x_318, x_318)); + frag_color = vec4f(x_320.x, x_320.y, x_320.z, 1.0f); + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(5) baseDiffuse_param : vec4f, @location(4) position_1_param : vec4f, @location(2) normal_param : vec3f, @location(0) color_param : vec4f, @location(3) tangent_param : vec4f) -> main_out { + uv = uv_param; + baseDiffuse = baseDiffuse_param; + position_1 = position_1_param; + normal = normal_param; + color = color_param; + tangent = tangent_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fs b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fs new file mode 100644 index 00000000..6666e7c7 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fs @@ -0,0 +1,264 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct fs_params { + /* @offset(0) */ + u_cameraPos : vec4f, + /* @offset(16) */ + u_color_override : vec4f, + /* @offset(32) */ + u_alpha_cutoff : f32, + /* @offset(48) */ + u_ambient_light : vec4f, + /* @offset(64) */ + u_dir_light_dir : vec4f, + /* @offset(80) */ + u_dir_light_color : vec4f, + /* @offset(96) */ + u_num_point_lights : f32, + /* @offset(112) */ + u_point_light_data : Arr, + /* @offset(624) */ + u_fog_data : vec4f, + /* @offset(640) */ + u_fog_color : vec4f, +} + +@group(0) @binding(4) var x_63 : fs_params; + +@group(1) @binding(48) var tex : texture_2d; + +@group(1) @binding(64) var smp : sampler; + +var uv : vec2f; + +var baseDiffuse : vec4f; + +var position_1 : vec4f; + +var normal : vec3f; + +@group(1) @binding(49) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var color : vec4f; + +var tangent : vec4f; + +fn sqr_f1_(x : ptr) -> f32 { + let x_22 : f32 = *(x); + let x_23 : f32 = *(x); + return (x_22 * x_23); +} + +fn attenuate_light_f1_f1_f1_f1_(distance_1 : ptr, radius : ptr, max_intensity : ptr, falloff : ptr) -> f32 { + var s : f32; + var s2 : f32; + var param : f32; + var param_1 : f32; + let x_28 : f32 = *(distance_1); + let x_29 : f32 = *(radius); + s = (x_28 / x_29); + let x_31 : f32 = s; + if ((x_31 >= 1.0f)) { + return 0.0f; + } + let x_41 : f32 = s; + param = x_41; + let x_42 : f32 = sqr_f1_(&(param)); + s2 = x_42; + let x_43 : f32 = *(max_intensity); + let x_44 : f32 = s2; + param_1 = (1.0f - x_44); + let x_47 : f32 = sqr_f1_(&(param_1)); + let x_49 : f32 = *(falloff); + let x_50 : f32 = s; + return ((x_43 * x_47) / (1.0f + (x_49 * x_50))); +} + +fn calcFogFactor_f1_(distance_to_eye : ptr) -> f32 { + var fog_start : f32; + var fog_end : f32; + var fog_amount : f32; + var fog_factor : f32; + let x_69 : f32 = x_63.u_fog_data.x; + fog_start = x_69; + let x_73 : f32 = x_63.u_fog_data.y; + fog_end = x_73; + let x_78 : f32 = x_63.u_fog_color.w; + fog_amount = x_78; + let x_80 : f32 = *(distance_to_eye); + let x_81 : f32 = fog_start; + let x_83 : f32 = fog_end; + let x_84 : f32 = fog_start; + fog_factor = ((x_80 - x_81) / (x_83 - x_84)); + let x_87 : f32 = fog_factor; + let x_88 : f32 = fog_amount; + return clamp((x_87 * x_88), 0.0f, 1.0f); +} + +fn main_1() { + var c : vec4f; + var lit_color : vec4f; + var i : i32; + var point_light_pos_data : vec4f; + var point_light_color_data : vec4f; + var lightPosEye : vec3f; + var lightColor : vec3f; + var lightMinusPos : vec3f; + var lightDir : vec3f; + var lightBrightness : f32; + var dist : f32; + var radius_1 : f32; + var attenuation : f32; + var param_2 : f32; + var param_3 : f32; + var param_4 : f32; + var param_5 : f32; + var lightDir_1 : vec4f; + var lightColor_1 : vec4f; + var lightBrightness_1 : f32; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + var fog_factor_1 : f32; + var param_6 : f32; + let x_108 : vec2f = uv; + let x_109 : vec4f = textureSample(tex, smp, x_108); + let x_112 : vec4f = baseDiffuse; + c = (x_109 * x_112); + let x_118 : vec4f = x_63.u_ambient_light; + lit_color = x_118; + let x_120 : f32 = c.w; + let x_123 : f32 = x_63.u_alpha_cutoff; + if ((x_120 <= x_123)) { + discard; + } + i = 0i; + loop { + let x_136 : i32 = i; + let x_139 : f32 = x_63.u_num_point_lights; + if ((x_136 < i32(x_139))) { + } else { + break; + } + let x_144 : i32 = i; + let x_147 : vec4f = x_63.u_point_light_data[(x_144 * 2i)]; + point_light_pos_data = x_147; + let x_149 : i32 = i; + let x_154 : vec4f = x_63.u_point_light_data[((x_149 * 2i) + 1i)]; + point_light_color_data = x_154; + let x_158 : vec4f = point_light_pos_data; + lightPosEye = vec3f(x_158.x, x_158.y, x_158.z); + let x_161 : vec4f = point_light_color_data; + lightColor = vec3f(x_161.x, x_161.y, x_161.z); + let x_164 : vec3f = lightPosEye; + let x_166 : vec4f = position_1; + lightMinusPos = (x_164 - vec3f(x_166.x, x_166.y, x_166.z)); + let x_170 : vec3f = lightMinusPos; + lightDir = normalize(x_170); + let x_173 : vec3f = lightDir; + let x_176 : vec3f = normal; + lightBrightness = max(dot(x_173, x_176), 0.0f); + let x_180 : vec3f = lightMinusPos; + dist = length(x_180); + let x_184 : f32 = point_light_pos_data.w; + radius_1 = x_184; + let x_187 : f32 = dist; + param_2 = x_187; + let x_189 : f32 = radius_1; + param_3 = x_189; + param_4 = 1.0f; + param_5 = 1.0f; + let x_192 : f32 = attenuate_light_f1_f1_f1_f1_(&(param_2), &(param_3), &(param_4), &(param_5)); + attenuation = x_192; + let x_193 : f32 = lightBrightness; + let x_194 : vec3f = lightColor; + let x_196 : f32 = attenuation; + let x_198 : vec4f = lit_color; + let x_200 : vec3f = (vec3f(x_198.x, x_198.y, x_198.z) + ((x_194 * x_193) * x_196)); + lit_color.x = x_200.x; + lit_color.y = x_200.y; + lit_color.z = x_200.z; + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1i); + } + } + let x_213 : f32 = x_63.u_dir_light_dir.x; + let x_215 : f32 = x_63.u_dir_light_dir.y; + let x_217 : f32 = x_63.u_dir_light_dir.z; + lightDir_1 = vec4f(x_213, x_215, x_217, 0.0f); + let x_222 : vec4f = x_63.u_dir_light_color; + lightColor_1 = x_222; + let x_224 : vec4f = lightDir_1; + let x_225 : vec3f = normal; + let x_233 : f32 = x_63.u_dir_light_dir.w; + lightBrightness_1 = (max(dot(x_224, vec4f(x_225.x, x_225.y, x_225.z, 0.0f)), 0.0f) * x_233); + let x_235 : f32 = lightBrightness_1; + let x_236 : vec4f = lightColor_1; + let x_239 : vec4f = lit_color; + let x_241 : vec3f = (vec3f(x_239.x, x_239.y, x_239.z) + (vec3f(x_236.x, x_236.y, x_236.z) * x_235)); + lit_color.x = x_241.x; + lit_color.y = x_241.y; + lit_color.z = x_241.z; + let x_248 : vec4f = lit_color; + let x_249 : vec4f = c; + c = (x_249 * x_248); + let x_256 : vec2f = uv; + let x_257 : vec4f = textureSample(tex_emissive, smp, x_256); + e = x_257; + let x_260 : f32 = e.x; + let x_262 : f32 = e.y; + let x_265 : f32 = e.z; + e_amt = min(((x_260 + x_262) + x_265), 1.0f); + let x_268 : vec4f = c; + let x_270 : f32 = e_amt; + let x_273 : vec4f = e; + let x_275 : vec3f = ((vec3f(x_268.x, x_268.y, x_268.z) * (1.0f - x_270)) + vec3f(x_273.x, x_273.y, x_273.z)); + c.x = x_275.x; + c.y = x_275.y; + c.z = x_275.z; + let x_284 : f32 = x_63.u_color_override.w; + override_mod = (1.0f - x_284); + let x_286 : vec4f = c; + let x_288 : f32 = override_mod; + let x_291 : vec4f = x_63.u_color_override; + let x_294 : f32 = x_63.u_color_override.w; + let x_296 : vec3f = ((vec3f(x_286.x, x_286.y, x_286.z) * x_288) + (vec3f(x_291.x, x_291.y, x_291.z) * x_294)); + c.x = x_296.x; + c.y = x_296.y; + c.z = x_296.z; + let x_305 : vec4f = x_63.u_cameraPos; + let x_306 : vec4f = position_1; + param_6 = length((x_305 - x_306)); + let x_310 : f32 = calcFogFactor_f1_(&(param_6)); + fog_factor_1 = x_310; + let x_313 : vec4f = c; + let x_316 : vec4f = x_63.u_fog_color; + let x_318 : f32 = fog_factor_1; + let x_320 : vec3f = mix(vec3f(x_313.x, x_313.y, x_313.z), vec3f(x_316.x, x_316.y, x_316.z), vec3f(x_318, x_318, x_318)); + frag_color = vec4f(x_320.x, x_320.y, x_320.z, 1.0f); + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(5) baseDiffuse_param : vec4f, @location(4) position_1_param : vec4f, @location(2) normal_param : vec3f, @location(0) color_param : vec4f, @location(3) tangent_param : vec4f) -> main_out { + uv = uv_param; + baseDiffuse = baseDiffuse_param; + position_1 = position_1_param; + normal = normal_param; + color = color_param; + tangent = tangent_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vertex b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vertex new file mode 100644 index 00000000..67248b94 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vertex @@ -0,0 +1,124 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_joints : Arr, + /* @offset(4240) */ + u_tex_pan : vec4f, +} + +var weights : vec4f; + +@group(0) @binding(0) var x_22 : vs_params; + +var joints : vec4f; + +var color : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var position_1 : vec4f; + +var pos : vec4f; + +var baseDiffuse : vec4f; + +var color0 : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + var skin : mat4x4f; + var model : mat4x4f; + let x_17 : f32 = weights.x; + let x_27 : f32 = joints.x; + let x_31 : mat4x4f = x_22.u_joints[i32(x_27)]; + let x_32 : mat4x4f = (x_31 * x_17); + let x_35 : f32 = weights.y; + let x_37 : f32 = joints.y; + let x_40 : mat4x4f = x_22.u_joints[i32(x_37)]; + let x_41 : mat4x4f = (x_40 * x_35); + let x_54 : mat4x4f = mat4x4f((x_32[0u] + x_41[0u]), (x_32[1u] + x_41[1u]), (x_32[2u] + x_41[2u]), (x_32[3u] + x_41[3u])); + let x_57 : f32 = weights.z; + let x_59 : f32 = joints.z; + let x_62 : mat4x4f = x_22.u_joints[i32(x_59)]; + let x_63 : mat4x4f = (x_62 * x_57); + let x_76 : mat4x4f = mat4x4f((x_54[0u] + x_63[0u]), (x_54[1u] + x_63[1u]), (x_54[2u] + x_63[2u]), (x_54[3u] + x_63[3u])); + let x_79 : f32 = weights.w; + let x_81 : f32 = joints.w; + let x_84 : mat4x4f = x_22.u_joints[i32(x_81)]; + let x_85 : mat4x4f = (x_84 * x_79); + skin = mat4x4f((x_76[0u] + x_85[0u]), (x_76[1u] + x_85[1u]), (x_76[2u] + x_85[2u]), (x_76[3u] + x_85[3u])); + let x_102 : mat4x4f = x_22.u_modelMatrix; + let x_103 : mat4x4f = skin; + model = (x_102 * x_103); + color = vec4f(0.0f, 0.0f, 0.0f, 1.0f); + let x_115 : vec2f = texcoord0; + let x_119 : vec4f = x_22.u_tex_pan; + uv = (x_115 + vec2f(x_119.x, x_119.y)); + let x_125 : mat4x4f = model; + let x_128 : vec3f = normals; + let x_134 : vec4f = normalize((x_125 * vec4f(x_128.x, x_128.y, x_128.z, 0.0f))); + normal = vec3f(x_134.x, x_134.y, x_134.z); + let x_138 : vec4f = tangents; + tangent = x_138; + let x_140 : mat4x4f = model; + let x_142 : vec4f = pos; + position_1 = (x_140 * x_142); + let x_146 : vec4f = color0; + let x_149 : vec4f = x_22.u_color; + baseDiffuse = (x_146 * x_149); + let x_157 : mat4x4f = x_22.u_projViewMatrix; + let x_158 : vec4f = position_1; + gl_Position = (x_157 * x_158); + return; +} + +struct main_out { + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, + @location(4) + position_1_1 : vec4f, + @location(5) + baseDiffuse_1 : vec4f, + @builtin(position) + gl_Position : vec4f, +} + +@vertex +fn main(@location(6) weights_param : vec4f, @location(5) joints_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f, @location(0) pos_param : vec4f, @location(1) color0_param : vec4f) -> main_out { + weights = weights_param; + joints = joints_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + pos = pos_param; + color0 = color0_param; + main_1(); + return main_out(color, uv, normal, tangent, position_1, baseDiffuse, gl_Position); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vs b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vs new file mode 100644 index 00000000..67248b94 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vs @@ -0,0 +1,124 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_joints : Arr, + /* @offset(4240) */ + u_tex_pan : vec4f, +} + +var weights : vec4f; + +@group(0) @binding(0) var x_22 : vs_params; + +var joints : vec4f; + +var color : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var position_1 : vec4f; + +var pos : vec4f; + +var baseDiffuse : vec4f; + +var color0 : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + var skin : mat4x4f; + var model : mat4x4f; + let x_17 : f32 = weights.x; + let x_27 : f32 = joints.x; + let x_31 : mat4x4f = x_22.u_joints[i32(x_27)]; + let x_32 : mat4x4f = (x_31 * x_17); + let x_35 : f32 = weights.y; + let x_37 : f32 = joints.y; + let x_40 : mat4x4f = x_22.u_joints[i32(x_37)]; + let x_41 : mat4x4f = (x_40 * x_35); + let x_54 : mat4x4f = mat4x4f((x_32[0u] + x_41[0u]), (x_32[1u] + x_41[1u]), (x_32[2u] + x_41[2u]), (x_32[3u] + x_41[3u])); + let x_57 : f32 = weights.z; + let x_59 : f32 = joints.z; + let x_62 : mat4x4f = x_22.u_joints[i32(x_59)]; + let x_63 : mat4x4f = (x_62 * x_57); + let x_76 : mat4x4f = mat4x4f((x_54[0u] + x_63[0u]), (x_54[1u] + x_63[1u]), (x_54[2u] + x_63[2u]), (x_54[3u] + x_63[3u])); + let x_79 : f32 = weights.w; + let x_81 : f32 = joints.w; + let x_84 : mat4x4f = x_22.u_joints[i32(x_81)]; + let x_85 : mat4x4f = (x_84 * x_79); + skin = mat4x4f((x_76[0u] + x_85[0u]), (x_76[1u] + x_85[1u]), (x_76[2u] + x_85[2u]), (x_76[3u] + x_85[3u])); + let x_102 : mat4x4f = x_22.u_modelMatrix; + let x_103 : mat4x4f = skin; + model = (x_102 * x_103); + color = vec4f(0.0f, 0.0f, 0.0f, 1.0f); + let x_115 : vec2f = texcoord0; + let x_119 : vec4f = x_22.u_tex_pan; + uv = (x_115 + vec2f(x_119.x, x_119.y)); + let x_125 : mat4x4f = model; + let x_128 : vec3f = normals; + let x_134 : vec4f = normalize((x_125 * vec4f(x_128.x, x_128.y, x_128.z, 0.0f))); + normal = vec3f(x_134.x, x_134.y, x_134.z); + let x_138 : vec4f = tangents; + tangent = x_138; + let x_140 : mat4x4f = model; + let x_142 : vec4f = pos; + position_1 = (x_140 * x_142); + let x_146 : vec4f = color0; + let x_149 : vec4f = x_22.u_color; + baseDiffuse = (x_146 * x_149); + let x_157 : mat4x4f = x_22.u_projViewMatrix; + let x_158 : vec4f = position_1; + gl_Position = (x_157 * x_158); + return; +} + +struct main_out { + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, + @location(4) + position_1_1 : vec4f, + @location(5) + baseDiffuse_1 : vec4f, + @builtin(position) + gl_Position : vec4f, +} + +@vertex +fn main(@location(6) weights_param : vec4f, @location(5) joints_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f, @location(0) pos_param : vec4f, @location(1) color0_param : vec4f) -> main_out { + weights = weights_param; + joints = joints_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + pos = pos_param; + color0 = color0_param; + main_1(); + return main_out(color, uv, normal, tangent, position_1, baseDiffuse, gl_Position); +} + diff --git a/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_reflection.yaml b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_reflection.yaml new file mode 100644 index 00000000..1b2913b4 --- /dev/null +++ b/assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_reflection.yaml @@ -0,0 +1,1197 @@ +shaders: + - + slang: glsl430 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl430_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + - + slot: 5 + type: vec4 + glsl_name: joints + - + slot: 6 + type: vec4 + glsl_name: weights + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + glsl_uniforms: + - + type: vec4 + array_count: 266 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + glsl_uniforms: + - + type: vec4 + array_count: 41 + offset: 0 + glsl_name: fs_params + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: glsl300es + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_glsl300es_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + - + slot: 5 + type: vec4 + glsl_name: joints + - + slot: 6 + type: vec4 + glsl_name: weights + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + glsl_uniforms: + - + type: vec4 + array_count: 266 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + glsl_uniforms: + - + type: vec4 + array_count: 41 + offset: 0 + glsl_name: fs_params + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: hlsl4 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_vertex.hlsl + is_binary: false + entry_point: main + d3d11_target: vs_4_0 + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_hlsl4_fragment.hlsl + is_binary: false + entry_point: main + d3d11_target: ps_4_0 + attrs: + - + slot: 0 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 0 + - + slot: 1 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 1 + - + slot: 2 + type: vec2 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 2 + - + slot: 3 + type: vec3 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 3 + - + slot: 4 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 4 + - + slot: 5 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 5 + - + slot: 6 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 6 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + hlsl_register_b_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + hlsl_register_b_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + hlsl_register_s_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_macos + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_macos_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + msl_buffer_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_ios + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_ios_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + msl_buffer_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_sim + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_metal_sim_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + msl_buffer_n: 0 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: wgsl + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_vertex + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/skinned-basic-lighting/skinned-basic-lighting_emissive_wgsl_fragment + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + wgsl_group0_binding_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 656 + struct_name: fs_params + inst_name: _63 + wgsl_group0_binding_n: 8 + members: + - + name: u_cameraPos + type: vec4 + array_count: 0 + offset: 0 + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 16 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 32 + - + name: u_ambient_light + type: vec4 + array_count: 0 + offset: 48 + - + name: u_dir_light_dir + type: vec4 + array_count: 0 + offset: 64 + - + name: u_dir_light_color + type: vec4 + array_count: 0 + offset: 80 + - + name: u_num_point_lights + type: float + array_count: 0 + offset: 96 + - + name: u_point_light_data + type: vec4 + array_count: 32 + offset: 112 + - + name: u_fog_data + type: vec4 + array_count: 0 + offset: 624 + - + name: u_fog_color + type: vec4 + array_count: 0 + offset: 640 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 64 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 65 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + wgsl_group1_binding_n: 80 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl300es_fragment.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl300es_fragment.glsl new file mode 100644 index 00000000..cb6ca649 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl300es_fragment.glsl @@ -0,0 +1,40 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; +in highp vec3 normal; +in highp vec4 tangent; +in highp vec4 joint; +in highp vec4 weight; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _53 = texture(tex_emissive_smp, uv); + highp vec4 _69 = c; + highp vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + highp vec4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + highp vec3 _99 = (_119.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + frag_color = _125; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl300es_fs.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl300es_fs.glsl new file mode 100644 index 00000000..cb6ca649 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl300es_fs.glsl @@ -0,0 +1,40 @@ +#version 300 es +precision mediump float; +precision highp int; + +uniform highp vec4 fs_params[2]; +uniform highp sampler2D tex_smp; +uniform highp sampler2D tex_emissive_smp; + +in highp vec2 uv; +in highp vec4 color; +layout(location = 0) out highp vec4 frag_color; +in highp vec3 normal; +in highp vec4 tangent; +in highp vec4 joint; +in highp vec4 weight; + +void main() +{ + highp vec4 _28 = texture(tex_smp, uv) * color; + highp vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + highp vec4 _53 = texture(tex_emissive_smp, uv); + highp vec4 _69 = c; + highp vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + highp vec4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + highp vec3 _99 = (_119.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + highp vec4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + frag_color = _125; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl300es_vertex.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl300es_vertex.glsl new file mode 100644 index 00000000..1c46a366 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl300es_vertex.glsl @@ -0,0 +1,32 @@ +#version 300 es + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; +out vec4 joint; +out vec4 weight; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * (mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[265].xy; + normal = normals; + tangent = tangents; + joint = joints; + weight = weights; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl300es_vs.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl300es_vs.glsl new file mode 100644 index 00000000..1c46a366 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl300es_vs.glsl @@ -0,0 +1,32 @@ +#version 300 es + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +layout(location = 0) in vec4 pos; +out vec4 color; +layout(location = 1) in vec4 color0; +out vec2 uv; +layout(location = 2) in vec2 texcoord0; +out vec3 normal; +layout(location = 3) in vec3 normals; +out vec4 tangent; +layout(location = 4) in vec4 tangents; +out vec4 joint; +out vec4 weight; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * (mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[265].xy; + normal = normals; + tangent = tangents; + joint = joints; + weight = weights; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl430_fragment.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl430_fragment.glsl new file mode 100644 index 00000000..69d7fc4d --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl430_fragment.glsl @@ -0,0 +1,38 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 16) uniform sampler2D tex_smp; +layout(binding = 17) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; +layout(location = 2) in vec3 normal; +layout(location = 3) in vec4 tangent; +layout(location = 4) in vec4 joint; +layout(location = 5) in vec4 weight; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _53 = texture(tex_emissive_smp, uv); + vec4 _69 = c; + vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + vec4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + vec3 _99 = (_119.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + frag_color = _125; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl430_fs.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl430_fs.glsl new file mode 100644 index 00000000..181bdee6 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl430_fs.glsl @@ -0,0 +1,38 @@ +#version 430 + +uniform vec4 fs_params[2]; +layout(binding = 0) uniform sampler2D tex_smp; +layout(binding = 1) uniform sampler2D tex_emissive_smp; + +layout(location = 1) in vec2 uv; +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 frag_color; +layout(location = 2) in vec3 normal; +layout(location = 3) in vec4 tangent; +layout(location = 4) in vec4 joint; +layout(location = 5) in vec4 weight; + +void main() +{ + vec4 _28 = texture(tex_smp, uv) * color; + vec4 c = _28; + if (_28.w <= fs_params[1].x) + { + discard; + } + vec4 _53 = texture(tex_emissive_smp, uv); + vec4 _69 = c; + vec3 _76 = (_69.xyz * (1.0 - min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + vec4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + vec3 _99 = (_119.xyz * (1.0 - fs_params[0].w)) + (fs_params[0].xyz * fs_params[0].w); + vec4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + frag_color = _125; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl430_vertex.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl430_vertex.glsl new file mode 100644 index 00000000..57dd68a5 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl430_vertex.glsl @@ -0,0 +1,32 @@ +#version 430 + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; +layout(location = 4) out vec4 joint; +layout(location = 5) out vec4 weight; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * (mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[265].xy; + normal = normals; + tangent = tangents; + joint = joints; + weight = weights; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_glsl430_vs.glsl b/assets/shaders/built/skinned/skinned_emissive_glsl430_vs.glsl new file mode 100644 index 00000000..57dd68a5 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_glsl430_vs.glsl @@ -0,0 +1,32 @@ +#version 430 + +uniform vec4 vs_params[266]; +layout(location = 6) in vec4 weights; +layout(location = 5) in vec4 joints; +layout(location = 0) in vec4 pos; +layout(location = 0) out vec4 color; +layout(location = 1) in vec4 color0; +layout(location = 1) out vec2 uv; +layout(location = 2) in vec2 texcoord0; +layout(location = 2) out vec3 normal; +layout(location = 3) in vec3 normals; +layout(location = 3) out vec4 tangent; +layout(location = 4) in vec4 tangents; +layout(location = 4) out vec4 joint; +layout(location = 5) out vec4 weight; + +void main() +{ + mat4 _32 = mat4(vs_params[int(joints.x) * 4 + 9], vs_params[int(joints.x) * 4 + 10], vs_params[int(joints.x) * 4 + 11], vs_params[int(joints.x) * 4 + 12]) * weights.x; + mat4 _41 = mat4(vs_params[int(joints.y) * 4 + 9], vs_params[int(joints.y) * 4 + 10], vs_params[int(joints.y) * 4 + 11], vs_params[int(joints.y) * 4 + 12]) * weights.y; + mat4 _63 = mat4(vs_params[int(joints.z) * 4 + 9], vs_params[int(joints.z) * 4 + 10], vs_params[int(joints.z) * 4 + 11], vs_params[int(joints.z) * 4 + 12]) * weights.z; + mat4 _85 = mat4(vs_params[int(joints.w) * 4 + 9], vs_params[int(joints.w) * 4 + 10], vs_params[int(joints.w) * 4 + 11], vs_params[int(joints.w) * 4 + 12]) * weights.w; + gl_Position = (mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * (mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]) * mat4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * pos; + color = color0 * vs_params[8]; + uv = texcoord0 + vs_params[265].xy; + normal = normals; + tangent = tangents; + joint = joints; + weight = weights; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_hlsl4_fragment.hlsl b/assets/shaders/built/skinned/skinned_emissive_hlsl4_fragment.hlsl new file mode 100644 index 00000000..a601d4ea --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_hlsl4_fragment.hlsl @@ -0,0 +1,70 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 color; +static float4 frag_color; +static float3 normal; +static float4 tangent; +static float4 joint; +static float4 weight; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 joint : TEXCOORD4; + float4 weight : TEXCOORD5; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _53 = tex_emissive.Sample(smp, uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0f - min((_53.x + _53.y) + _53.z, 1.0f))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + frag_color = _125; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + normal = stage_input.normal; + tangent = stage_input.tangent; + joint = stage_input.joint; + weight = stage_input.weight; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/skinned/skinned_emissive_hlsl4_fs.hlsl b/assets/shaders/built/skinned/skinned_emissive_hlsl4_fs.hlsl new file mode 100644 index 00000000..a601d4ea --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_hlsl4_fs.hlsl @@ -0,0 +1,70 @@ +cbuffer fs_params : register(b0) +{ + float4 _36_u_color_override : packoffset(c0); + float _36_u_alpha_cutoff : packoffset(c1); +}; + +Texture2D tex : register(t0); +SamplerState smp : register(s0); +Texture2D tex_emissive : register(t1); + +static float2 uv; +static float4 color; +static float4 frag_color; +static float3 normal; +static float4 tangent; +static float4 joint; +static float4 weight; + +struct SPIRV_Cross_Input +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 joint : TEXCOORD4; + float4 weight : TEXCOORD5; +}; + +struct SPIRV_Cross_Output +{ + float4 frag_color : SV_Target0; +}; + +void frag_main() +{ + float4 _28 = tex.Sample(smp, uv) * color; + float4 c = _28; + if (_28.w <= _36_u_alpha_cutoff) + { + discard; + } + float4 _53 = tex_emissive.Sample(smp, uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0f - min((_53.x + _53.y) + _53.z, 1.0f))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0f - _36_u_color_override.w)) + (_36_u_color_override.xyz * _36_u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + frag_color = _125; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + uv = stage_input.uv; + color = stage_input.color; + normal = stage_input.normal; + tangent = stage_input.tangent; + joint = stage_input.joint; + weight = stage_input.weight; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.frag_color = frag_color; + return stage_output; +} diff --git a/assets/shaders/built/skinned/skinned_emissive_hlsl4_vertex.hlsl b/assets/shaders/built/skinned/skinned_emissive_hlsl4_vertex.hlsl new file mode 100644 index 00000000..9c01187d --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_hlsl4_vertex.hlsl @@ -0,0 +1,82 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _22_u_projViewMatrix : packoffset(c0); + row_major float4x4 _22_u_modelMatrix : packoffset(c4); + float4 _22_u_color : packoffset(c8); + row_major float4x4 _22_u_joints[64] : packoffset(c9); + float4 _22_u_tex_pan : packoffset(c265); +}; + + +static float4 gl_Position; +static float4 weights; +static float4 joints; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; +static float4 joint; +static float4 weight; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; + float4 joints : TEXCOORD5; + float4 weights : TEXCOORD6; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 joint : TEXCOORD4; + float4 weight : TEXCOORD5; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4x4 _32 = _22_u_joints[int(joints.x)] * weights.x; + float4x4 _41 = _22_u_joints[int(joints.y)] * weights.y; + float4x4 _63 = _22_u_joints[int(joints.z)] * weights.z; + float4x4 _85 = _22_u_joints[int(joints.w)] * weights.w; + gl_Position = mul(pos, mul(mul(float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]), _22_u_modelMatrix), _22_u_projViewMatrix)); + color = color0 * _22_u_color; + uv = texcoord0 + _22_u_tex_pan.xy; + normal = normals; + tangent = tangents; + joint = joints; + weight = weights; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + weights = stage_input.weights; + joints = stage_input.joints; + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + stage_output.joint = joint; + stage_output.weight = weight; + return stage_output; +} diff --git a/assets/shaders/built/skinned/skinned_emissive_hlsl4_vs.hlsl b/assets/shaders/built/skinned/skinned_emissive_hlsl4_vs.hlsl new file mode 100644 index 00000000..9c01187d --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_hlsl4_vs.hlsl @@ -0,0 +1,82 @@ +cbuffer vs_params : register(b0) +{ + row_major float4x4 _22_u_projViewMatrix : packoffset(c0); + row_major float4x4 _22_u_modelMatrix : packoffset(c4); + float4 _22_u_color : packoffset(c8); + row_major float4x4 _22_u_joints[64] : packoffset(c9); + float4 _22_u_tex_pan : packoffset(c265); +}; + + +static float4 gl_Position; +static float4 weights; +static float4 joints; +static float4 pos; +static float4 color; +static float4 color0; +static float2 uv; +static float2 texcoord0; +static float3 normal; +static float3 normals; +static float4 tangent; +static float4 tangents; +static float4 joint; +static float4 weight; + +struct SPIRV_Cross_Input +{ + float4 pos : TEXCOORD0; + float4 color0 : TEXCOORD1; + float2 texcoord0 : TEXCOORD2; + float3 normals : TEXCOORD3; + float4 tangents : TEXCOORD4; + float4 joints : TEXCOORD5; + float4 weights : TEXCOORD6; +}; + +struct SPIRV_Cross_Output +{ + float4 color : TEXCOORD0; + float2 uv : TEXCOORD1; + float3 normal : TEXCOORD2; + float4 tangent : TEXCOORD3; + float4 joint : TEXCOORD4; + float4 weight : TEXCOORD5; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4x4 _32 = _22_u_joints[int(joints.x)] * weights.x; + float4x4 _41 = _22_u_joints[int(joints.y)] * weights.y; + float4x4 _63 = _22_u_joints[int(joints.z)] * weights.z; + float4x4 _85 = _22_u_joints[int(joints.w)] * weights.w; + gl_Position = mul(pos, mul(mul(float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]), _22_u_modelMatrix), _22_u_projViewMatrix)); + color = color0 * _22_u_color; + uv = texcoord0 + _22_u_tex_pan.xy; + normal = normals; + tangent = tangents; + joint = joints; + weight = weights; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + weights = stage_input.weights; + joints = stage_input.joints; + pos = stage_input.pos; + color0 = stage_input.color0; + texcoord0 = stage_input.texcoord0; + normals = stage_input.normals; + tangents = stage_input.tangents; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.color = color; + stage_output.uv = uv; + stage_output.normal = normal; + stage_output.tangent = tangent; + stage_output.joint = joint; + stage_output.weight = weight; + return stage_output; +} diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_ios_fragment.metal b/assets/shaders/built/skinned/skinned_emissive_metal_ios_fragment.metal new file mode 100644 index 00000000..f79d5689 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_ios_fragment.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + out.frag_color = _125; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_ios_fs.metal b/assets/shaders/built/skinned/skinned_emissive_metal_ios_fs.metal new file mode 100644 index 00000000..f79d5689 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_ios_fs.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + out.frag_color = _125; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_ios_vertex.metal b/assets/shaders/built/skinned/skinned_emissive_metal_ios_vertex.metal new file mode 100644 index 00000000..0b53de7a --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_ios_vertex.metal @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 joint [[user(locn4)]]; + float4 weight [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + out.gl_Position = (_22.u_projViewMatrix * (_22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * in.pos; + out.color = in.color0 * _22.u_color; + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + out.joint = in.joints; + out.weight = in.weights; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_ios_vs.metal b/assets/shaders/built/skinned/skinned_emissive_metal_ios_vs.metal new file mode 100644 index 00000000..0b53de7a --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_ios_vs.metal @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 joint [[user(locn4)]]; + float4 weight [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + out.gl_Position = (_22.u_projViewMatrix * (_22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * in.pos; + out.color = in.color0 * _22.u_color; + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + out.joint = in.joints; + out.weight = in.weights; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_macos_fragment.metal b/assets/shaders/built/skinned/skinned_emissive_metal_macos_fragment.metal new file mode 100644 index 00000000..f79d5689 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_macos_fragment.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + out.frag_color = _125; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_macos_fs.metal b/assets/shaders/built/skinned/skinned_emissive_metal_macos_fs.metal new file mode 100644 index 00000000..f79d5689 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_macos_fs.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + out.frag_color = _125; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_macos_vertex.metal b/assets/shaders/built/skinned/skinned_emissive_metal_macos_vertex.metal new file mode 100644 index 00000000..0b53de7a --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_macos_vertex.metal @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 joint [[user(locn4)]]; + float4 weight [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + out.gl_Position = (_22.u_projViewMatrix * (_22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * in.pos; + out.color = in.color0 * _22.u_color; + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + out.joint = in.joints; + out.weight = in.weights; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_macos_vs.metal b/assets/shaders/built/skinned/skinned_emissive_metal_macos_vs.metal new file mode 100644 index 00000000..0b53de7a --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_macos_vs.metal @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 joint [[user(locn4)]]; + float4 weight [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + out.gl_Position = (_22.u_projViewMatrix * (_22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * in.pos; + out.color = in.color0 * _22.u_color; + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + out.joint = in.joints; + out.weight = in.weights; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_sim_fragment.metal b/assets/shaders/built/skinned/skinned_emissive_metal_sim_fragment.metal new file mode 100644 index 00000000..f79d5689 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_sim_fragment.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + out.frag_color = _125; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_sim_fs.metal b/assets/shaders/built/skinned/skinned_emissive_metal_sim_fs.metal new file mode 100644 index 00000000..f79d5689 --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_sim_fs.metal @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct fs_params +{ + float4 u_color_override; + float u_alpha_cutoff; +}; + +struct main0_out +{ + float4 frag_color [[color(0)]]; +}; + +struct main0_in +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant fs_params& _36 [[buffer(0)]], texture2d tex [[texture(0)]], texture2d tex_emissive [[texture(1)]], sampler smp [[sampler(0)]]) +{ + main0_out out = {}; + float4 _28 = tex.sample(smp, in.uv) * in.color; + float4 c = _28; + if (_28.w <= _36.u_alpha_cutoff) + { + discard_fragment(); + } + float4 _53 = tex_emissive.sample(smp, in.uv); + float4 _69 = c; + float3 _76 = (_69.xyz * (1.0 - fast::min((_53.x + _53.y) + _53.z, 1.0))) + _53.xyz; + float4 _119 = _69; + _119.x = _76.x; + _119.y = _76.y; + _119.z = _76.z; + float3 _99 = (_119.xyz * (1.0 - _36.u_color_override.w)) + (_36.u_color_override.xyz * _36.u_color_override.w); + float4 _125 = _119; + _125.x = _99.x; + _125.y = _99.y; + _125.z = _99.z; + c = _125; + out.frag_color = _125; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_sim_vertex.metal b/assets/shaders/built/skinned/skinned_emissive_metal_sim_vertex.metal new file mode 100644 index 00000000..0b53de7a --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_sim_vertex.metal @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 joint [[user(locn4)]]; + float4 weight [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + out.gl_Position = (_22.u_projViewMatrix * (_22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * in.pos; + out.color = in.color0 * _22.u_color; + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + out.joint = in.joints; + out.weight = in.weights; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_metal_sim_vs.metal b/assets/shaders/built/skinned/skinned_emissive_metal_sim_vs.metal new file mode 100644 index 00000000..0b53de7a --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_metal_sim_vs.metal @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct vs_params +{ + float4x4 u_projViewMatrix; + float4x4 u_modelMatrix; + float4 u_color; + float4x4 u_joints[64]; + float4 u_tex_pan; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float2 uv [[user(locn1)]]; + float3 normal [[user(locn2)]]; + float4 tangent [[user(locn3)]]; + float4 joint [[user(locn4)]]; + float4 weight [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; + float4 color0 [[attribute(1)]]; + float2 texcoord0 [[attribute(2)]]; + float3 normals [[attribute(3)]]; + float4 tangents [[attribute(4)]]; + float4 joints [[attribute(5)]]; + float4 weights [[attribute(6)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _22 [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 _32 = _22.u_joints[int(in.joints.x)] * in.weights.x; + float4x4 _41 = _22.u_joints[int(in.joints.y)] * in.weights.y; + float4x4 _63 = _22.u_joints[int(in.joints.z)] * in.weights.z; + float4x4 _85 = _22.u_joints[int(in.joints.w)] * in.weights.w; + out.gl_Position = (_22.u_projViewMatrix * (_22.u_modelMatrix * float4x4(((_32[0] + _41[0]) + _63[0]) + _85[0], ((_32[1] + _41[1]) + _63[1]) + _85[1], ((_32[2] + _41[2]) + _63[2]) + _85[2], ((_32[3] + _41[3]) + _63[3]) + _85[3]))) * in.pos; + out.color = in.color0 * _22.u_color; + out.uv = in.texcoord0 + _22.u_tex_pan.xy; + out.normal = in.normals; + out.tangent = in.tangents; + out.joint = in.joints; + out.weight = in.weights; + return out; +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_wgsl_fragment b/assets/shaders/built/skinned/skinned_emissive_wgsl_fragment new file mode 100644 index 00000000..f6567b4f --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_wgsl_fragment @@ -0,0 +1,91 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(64) var tex : texture_2d; + +@group(1) @binding(80) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(8) var x_36 : fs_params; + +@group(1) @binding(65) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var normal : vec3f; + +var tangent : vec4f; + +var joint : vec4f; + +var weight : vec4f; + +fn main_1() { + var c : vec4f; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_52 : vec2f = uv; + let x_53 : vec4f = textureSample(tex_emissive, smp, x_52); + e = x_53; + let x_57 : f32 = e.x; + let x_60 : f32 = e.y; + let x_64 : f32 = e.z; + e_amt = min(((x_57 + x_60) + x_64), 1.0f); + let x_69 : vec4f = c; + let x_71 : f32 = e_amt; + let x_74 : vec4f = e; + let x_76 : vec3f = ((vec3f(x_69.x, x_69.y, x_69.z) * (1.0f - x_71)) + vec3f(x_74.x, x_74.y, x_74.z)); + c.x = x_76.x; + c.y = x_76.y; + c.z = x_76.z; + let x_86 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_86); + let x_88 : vec4f = c; + let x_90 : f32 = override_mod; + let x_94 : vec4f = x_36.u_color_override; + let x_97 : f32 = x_36.u_color_override.w; + let x_99 : vec3f = ((vec3f(x_88.x, x_88.y, x_88.z) * x_90) + (vec3f(x_94.x, x_94.y, x_94.z) * x_97)); + c.x = x_99.x; + c.y = x_99.y; + c.z = x_99.z; + let x_108 : vec4f = c; + frag_color = x_108; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f, @location(2) normal_param : vec3f, @location(3) tangent_param : vec4f, @location(4) joint_param : vec4f, @location(5) weight_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + normal = normal_param; + tangent = tangent_param; + joint = joint_param; + weight = weight_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_wgsl_fs b/assets/shaders/built/skinned/skinned_emissive_wgsl_fs new file mode 100644 index 00000000..47812aae --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_wgsl_fs @@ -0,0 +1,91 @@ +diagnostic(off, derivative_uniformity); + +struct fs_params { + /* @offset(0) */ + u_color_override : vec4f, + /* @offset(16) */ + u_alpha_cutoff : f32, +} + +@group(1) @binding(48) var tex : texture_2d; + +@group(1) @binding(64) var smp : sampler; + +var uv : vec2f; + +var color : vec4f; + +@group(0) @binding(4) var x_36 : fs_params; + +@group(1) @binding(49) var tex_emissive : texture_2d; + +var frag_color : vec4f; + +var normal : vec3f; + +var tangent : vec4f; + +var joint : vec4f; + +var weight : vec4f; + +fn main_1() { + var c : vec4f; + var e : vec4f; + var e_amt : f32; + var override_mod : f32; + let x_23 : vec2f = uv; + let x_24 : vec4f = textureSample(tex, smp, x_23); + let x_27 : vec4f = color; + c = (x_24 * x_27); + let x_33 : f32 = c.w; + let x_41 : f32 = x_36.u_alpha_cutoff; + if ((x_33 <= x_41)) { + discard; + } + let x_52 : vec2f = uv; + let x_53 : vec4f = textureSample(tex_emissive, smp, x_52); + e = x_53; + let x_57 : f32 = e.x; + let x_60 : f32 = e.y; + let x_64 : f32 = e.z; + e_amt = min(((x_57 + x_60) + x_64), 1.0f); + let x_69 : vec4f = c; + let x_71 : f32 = e_amt; + let x_74 : vec4f = e; + let x_76 : vec3f = ((vec3f(x_69.x, x_69.y, x_69.z) * (1.0f - x_71)) + vec3f(x_74.x, x_74.y, x_74.z)); + c.x = x_76.x; + c.y = x_76.y; + c.z = x_76.z; + let x_86 : f32 = x_36.u_color_override.w; + override_mod = (1.0f - x_86); + let x_88 : vec4f = c; + let x_90 : f32 = override_mod; + let x_94 : vec4f = x_36.u_color_override; + let x_97 : f32 = x_36.u_color_override.w; + let x_99 : vec3f = ((vec3f(x_88.x, x_88.y, x_88.z) * x_90) + (vec3f(x_94.x, x_94.y, x_94.z) * x_97)); + c.x = x_99.x; + c.y = x_99.y; + c.z = x_99.z; + let x_108 : vec4f = c; + frag_color = x_108; + return; +} + +struct main_out { + @location(0) + frag_color_1 : vec4f, +} + +@fragment +fn main(@location(1) uv_param : vec2f, @location(0) color_param : vec4f, @location(2) normal_param : vec3f, @location(3) tangent_param : vec4f, @location(4) joint_param : vec4f, @location(5) weight_param : vec4f) -> main_out { + uv = uv_param; + color = color_param; + normal = normal_param; + tangent = tangent_param; + joint = joint_param; + weight = weight_param; + main_1(); + return main_out(frag_color); +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_wgsl_vertex b/assets/shaders/built/skinned/skinned_emissive_wgsl_vertex new file mode 100644 index 00000000..915e7b7f --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_wgsl_vertex @@ -0,0 +1,123 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_joints : Arr, + /* @offset(4240) */ + u_tex_pan : vec4f, +} + +var weights : vec4f; + +@group(0) @binding(0) var x_22 : vs_params; + +var joints : vec4f; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var joint : vec4f; + +var weight : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + var skin : mat4x4f; + var model : mat4x4f; + let x_17 : f32 = weights.x; + let x_27 : f32 = joints.x; + let x_31 : mat4x4f = x_22.u_joints[i32(x_27)]; + let x_32 : mat4x4f = (x_31 * x_17); + let x_35 : f32 = weights.y; + let x_37 : f32 = joints.y; + let x_40 : mat4x4f = x_22.u_joints[i32(x_37)]; + let x_41 : mat4x4f = (x_40 * x_35); + let x_54 : mat4x4f = mat4x4f((x_32[0u] + x_41[0u]), (x_32[1u] + x_41[1u]), (x_32[2u] + x_41[2u]), (x_32[3u] + x_41[3u])); + let x_57 : f32 = weights.z; + let x_59 : f32 = joints.z; + let x_62 : mat4x4f = x_22.u_joints[i32(x_59)]; + let x_63 : mat4x4f = (x_62 * x_57); + let x_76 : mat4x4f = mat4x4f((x_54[0u] + x_63[0u]), (x_54[1u] + x_63[1u]), (x_54[2u] + x_63[2u]), (x_54[3u] + x_63[3u])); + let x_79 : f32 = weights.w; + let x_81 : f32 = joints.w; + let x_84 : mat4x4f = x_22.u_joints[i32(x_81)]; + let x_85 : mat4x4f = (x_84 * x_79); + skin = mat4x4f((x_76[0u] + x_85[0u]), (x_76[1u] + x_85[1u]), (x_76[2u] + x_85[2u]), (x_76[3u] + x_85[3u])); + let x_102 : mat4x4f = x_22.u_modelMatrix; + let x_103 : mat4x4f = skin; + model = (x_102 * x_103); + let x_111 : mat4x4f = x_22.u_projViewMatrix; + let x_112 : mat4x4f = model; + let x_115 : vec4f = pos; + gl_Position = ((x_111 * x_112) * x_115); + let x_121 : vec4f = color0; + let x_125 : vec4f = x_22.u_color; + color = (x_121 * x_125); + let x_132 : vec2f = texcoord0; + let x_135 : vec4f = x_22.u_tex_pan; + uv = (x_132 + vec2f(x_135.x, x_135.y)); + let x_143 : vec3f = normals; + normal = x_143; + let x_146 : vec4f = tangents; + tangent = x_146; + let x_148 : vec4f = joints; + joint = x_148; + let x_150 : vec4f = weights; + weight = x_150; + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, + @location(4) + joint_1 : vec4f, + @location(5) + weight_1 : vec4f, +} + +@vertex +fn main(@location(6) weights_param : vec4f, @location(5) joints_param : vec4f, @location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f) -> main_out { + weights = weights_param; + joints = joints_param; + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + main_1(); + return main_out(gl_Position, color, uv, normal, tangent, joint, weight); +} + diff --git a/assets/shaders/built/skinned/skinned_emissive_wgsl_vs b/assets/shaders/built/skinned/skinned_emissive_wgsl_vs new file mode 100644 index 00000000..915e7b7f --- /dev/null +++ b/assets/shaders/built/skinned/skinned_emissive_wgsl_vs @@ -0,0 +1,123 @@ +diagnostic(off, derivative_uniformity); + +alias Arr = array; + +struct vs_params { + /* @offset(0) */ + u_projViewMatrix : mat4x4f, + /* @offset(64) */ + u_modelMatrix : mat4x4f, + /* @offset(128) */ + u_color : vec4f, + /* @offset(144) */ + u_joints : Arr, + /* @offset(4240) */ + u_tex_pan : vec4f, +} + +var weights : vec4f; + +@group(0) @binding(0) var x_22 : vs_params; + +var joints : vec4f; + +var pos : vec4f; + +var color : vec4f; + +var color0 : vec4f; + +var uv : vec2f; + +var texcoord0 : vec2f; + +var normal : vec3f; + +var normals : vec3f; + +var tangent : vec4f; + +var tangents : vec4f; + +var joint : vec4f; + +var weight : vec4f; + +var gl_Position : vec4f; + +fn main_1() { + var skin : mat4x4f; + var model : mat4x4f; + let x_17 : f32 = weights.x; + let x_27 : f32 = joints.x; + let x_31 : mat4x4f = x_22.u_joints[i32(x_27)]; + let x_32 : mat4x4f = (x_31 * x_17); + let x_35 : f32 = weights.y; + let x_37 : f32 = joints.y; + let x_40 : mat4x4f = x_22.u_joints[i32(x_37)]; + let x_41 : mat4x4f = (x_40 * x_35); + let x_54 : mat4x4f = mat4x4f((x_32[0u] + x_41[0u]), (x_32[1u] + x_41[1u]), (x_32[2u] + x_41[2u]), (x_32[3u] + x_41[3u])); + let x_57 : f32 = weights.z; + let x_59 : f32 = joints.z; + let x_62 : mat4x4f = x_22.u_joints[i32(x_59)]; + let x_63 : mat4x4f = (x_62 * x_57); + let x_76 : mat4x4f = mat4x4f((x_54[0u] + x_63[0u]), (x_54[1u] + x_63[1u]), (x_54[2u] + x_63[2u]), (x_54[3u] + x_63[3u])); + let x_79 : f32 = weights.w; + let x_81 : f32 = joints.w; + let x_84 : mat4x4f = x_22.u_joints[i32(x_81)]; + let x_85 : mat4x4f = (x_84 * x_79); + skin = mat4x4f((x_76[0u] + x_85[0u]), (x_76[1u] + x_85[1u]), (x_76[2u] + x_85[2u]), (x_76[3u] + x_85[3u])); + let x_102 : mat4x4f = x_22.u_modelMatrix; + let x_103 : mat4x4f = skin; + model = (x_102 * x_103); + let x_111 : mat4x4f = x_22.u_projViewMatrix; + let x_112 : mat4x4f = model; + let x_115 : vec4f = pos; + gl_Position = ((x_111 * x_112) * x_115); + let x_121 : vec4f = color0; + let x_125 : vec4f = x_22.u_color; + color = (x_121 * x_125); + let x_132 : vec2f = texcoord0; + let x_135 : vec4f = x_22.u_tex_pan; + uv = (x_132 + vec2f(x_135.x, x_135.y)); + let x_143 : vec3f = normals; + normal = x_143; + let x_146 : vec4f = tangents; + tangent = x_146; + let x_148 : vec4f = joints; + joint = x_148; + let x_150 : vec4f = weights; + weight = x_150; + return; +} + +struct main_out { + @builtin(position) + gl_Position : vec4f, + @location(0) + color_1 : vec4f, + @location(1) + uv_1 : vec2f, + @location(2) + normal_1 : vec3f, + @location(3) + tangent_1 : vec4f, + @location(4) + joint_1 : vec4f, + @location(5) + weight_1 : vec4f, +} + +@vertex +fn main(@location(6) weights_param : vec4f, @location(5) joints_param : vec4f, @location(0) pos_param : vec4f, @location(1) color0_param : vec4f, @location(2) texcoord0_param : vec2f, @location(3) normals_param : vec3f, @location(4) tangents_param : vec4f) -> main_out { + weights = weights_param; + joints = joints_param; + pos = pos_param; + color0 = color0_param; + texcoord0 = texcoord0_param; + normals = normals_param; + tangents = tangents_param; + main_1(); + return main_out(gl_Position, color, uv, normal, tangent, joint, weight); +} + diff --git a/assets/shaders/built/skinned/skinned_reflection.yaml b/assets/shaders/built/skinned/skinned_reflection.yaml new file mode 100644 index 00000000..ad478cbf --- /dev/null +++ b/assets/shaders/built/skinned/skinned_reflection.yaml @@ -0,0 +1,917 @@ +shaders: + - + slang: glsl430 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_glsl430_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_glsl430_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + - + slot: 5 + type: vec4 + glsl_name: joints + - + slot: 6 + type: vec4 + glsl_name: weights + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + glsl_uniforms: + - + type: vec4 + array_count: 266 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: glsl300es + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_glsl300es_vertex.glsl + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_glsl300es_fragment.glsl + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + glsl_name: pos + - + slot: 1 + type: vec4 + glsl_name: color0 + - + slot: 2 + type: vec2 + glsl_name: texcoord0 + - + slot: 3 + type: vec3 + glsl_name: normals + - + slot: 4 + type: vec4 + glsl_name: tangents + - + slot: 5 + type: vec4 + glsl_name: joints + - + slot: 6 + type: vec4 + glsl_name: weights + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + glsl_uniforms: + - + type: vec4 + array_count: 266 + offset: 0 + glsl_name: vs_params + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + glsl_uniforms: + - + type: vec4 + array_count: 2 + offset: 0 + glsl_name: fs_params + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + glsl_name: tex_smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + glsl_name: tex_emissive_smp + - + slang: hlsl4 + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_hlsl4_vertex.hlsl + is_binary: false + entry_point: main + d3d11_target: vs_4_0 + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_hlsl4_fragment.hlsl + is_binary: false + entry_point: main + d3d11_target: ps_4_0 + attrs: + - + slot: 0 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 0 + - + slot: 1 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 1 + - + slot: 2 + type: vec2 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 2 + - + slot: 3 + type: vec3 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 3 + - + slot: 4 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 4 + - + slot: 5 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 5 + - + slot: 6 + type: vec4 + hlsl_sem_name: TEXCOORD + hlsl_sem_index: 6 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + hlsl_register_b_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + hlsl_register_b_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + hlsl_register_t_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + hlsl_register_s_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_macos + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_metal_macos_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_metal_macos_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_ios + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_metal_ios_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_metal_ios_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: metal_sim + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_metal_sim_vertex.metal + is_binary: false + entry_point: main0 + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_metal_sim_fragment.metal + is_binary: false + entry_point: main0 + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + msl_buffer_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + msl_buffer_n: 0 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 0 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + msl_texture_n: 1 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + msl_sampler_n: 0 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp + - + slang: wgsl + programs: + - + name: emissive + vertex_func: + path: assets/shaders/built/skinned/skinned_emissive_wgsl_vertex + is_binary: false + entry_point: main + fragment_func: + path: assets/shaders/built/skinned/skinned_emissive_wgsl_fragment + is_binary: false + entry_point: main + attrs: + - + slot: 0 + type: vec4 + - + slot: 1 + type: vec4 + - + slot: 2 + type: vec2 + - + slot: 3 + type: vec3 + - + slot: 4 + type: vec4 + - + slot: 5 + type: vec4 + - + slot: 6 + type: vec4 + uniform_blocks: + - + slot: 0 + stage: vertex + size: 4256 + struct_name: vs_params + inst_name: _22 + wgsl_group0_binding_n: 0 + members: + - + name: u_projViewMatrix + type: mat4 + array_count: 0 + offset: 0 + - + name: u_modelMatrix + type: mat4 + array_count: 0 + offset: 64 + - + name: u_color + type: vec4 + array_count: 0 + offset: 128 + - + name: u_joints + type: mat4 + array_count: 64 + offset: 144 + - + name: u_tex_pan + type: vec4 + array_count: 0 + offset: 4240 + - + slot: 1 + stage: fragment + size: 32 + struct_name: fs_params + inst_name: _36 + wgsl_group0_binding_n: 8 + members: + - + name: u_color_override + type: vec4 + array_count: 0 + offset: 0 + - + name: u_alpha_cutoff + type: float + array_count: 0 + offset: 16 + images: + - + slot: 0 + stage: fragment + name: tex + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 64 + - + slot: 1 + stage: fragment + name: tex_emissive + multisampled: false + type: 2d + sample_type: float + wgsl_group1_binding_n: 65 + samplers: + - + slot: 0 + stage: fragment + name: smp + sampler_type: filtering + wgsl_group1_binding_n: 80 + image_sampler_pairs: + - + slot: 0 + stage: fragment + name: tex_smp + image_name: tex + sampler_name: smp + - + slot: 1 + stage: fragment + name: tex_emissive_smp + image_name: tex_emissive + sampler_name: smp diff --git a/build.zig b/build.zig index 95c729a7..c6d0e9ba 100644 --- a/build.zig +++ b/build.zig @@ -33,7 +33,6 @@ pub fn build(b: *std.Build) !void { .target = target, .optimize = optimize, .lang = .lua54, - // .can_use_jmp = !target.result.cpu.arch.isWasm(), }); const dep_zmesh = b.dependency("zmesh", .{ @@ -85,7 +84,6 @@ pub fn build(b: *std.Build) !void { zmesh_item, zstbi_item, zaudio_item, - zlua_item, cimgui_item, stb_truetype_item, ymlz_item, @@ -118,6 +116,11 @@ pub fn build(b: *std.Build) !void { delve_mod.addImport(build_import.name, build_import.module); } + // Only add Lua for non-web builds + if (!target.result.cpu.arch.isWasm()) { + delve_mod.addImport(zlua_item.name, zlua_item.module); + } + for (build_collection.link_libraries) |lib| { if (target.result.cpu.arch.isWasm()) { // ensure these libs all depend on the emcc C lib diff --git a/src/framework/graphics/shaders/basic-lighting.glsl.zig b/src/framework/graphics/shaders/basic-lighting.glsl.zig index 587bbeba..f27f7b94 100644 --- a/src/framework/graphics/shaders/basic-lighting.glsl.zig +++ b/src/framework/graphics/shaders/basic-lighting.glsl.zig @@ -41,6 +41,12 @@ const m = @import("../../math.zig"); // Sampler 'smp': // Type: .FILTERING // Bind slot: SMP_smp => 0 +// Image Sampler Pair 'tex_smp': +// Image: tex +// Sampler: smp +// Image Sampler Pair 'tex_emissive_smp': +// Image: tex_emissive +// Sampler: smp // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -3588,15 +3594,10 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl430; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -3634,15 +3635,10 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl300es; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -3682,19 +3678,14 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.fragment_func.source = &fs_source_hlsl4; desc.fragment_func.d3d11_target = "ps_4_0"; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].hlsl_sem_name = "TEXCOORD"; desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].hlsl_sem_name = "TEXCOORD"; desc.attrs[2].hlsl_sem_index = 2; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].hlsl_sem_name = "TEXCOORD"; desc.attrs[3].hlsl_sem_index = 3; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].hlsl_sem_name = "TEXCOORD"; desc.attrs[4].hlsl_sem_index = 4; desc.uniform_blocks[0].stage = .VERTEX; @@ -3730,11 +3721,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_macos; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -3768,11 +3754,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_ios; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -3806,11 +3787,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_sim; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -3844,11 +3820,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_wgsl; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -3981,31 +3952,31 @@ pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { } return null; } -pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniformDesc { if (std.mem.eql(u8, ub_name, "vs_params")) { if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_projViewMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_modelMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color"; return desc; } if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_tex_pan"; @@ -4014,70 +3985,70 @@ pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShad } if (std.mem.eql(u8, ub_name, "fs_params")) { if (std.mem.eql(u8, u_name, "u_cameraPos")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_cameraPos"; return desc; } if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color_override"; return desc; } if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_alpha_cutoff"; return desc; } if (std.mem.eql(u8, u_name, "u_ambient_light")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_ambient_light"; return desc; } if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_dir_light_dir"; return desc; } if (std.mem.eql(u8, u_name, "u_dir_light_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_dir_light_color"; return desc; } if (std.mem.eql(u8, u_name, "u_num_point_lights")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_num_point_lights"; return desc; } if (std.mem.eql(u8, u_name, "u_point_light_data")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 32; desc.glsl_name = "u_point_light_data"; return desc; } if (std.mem.eql(u8, u_name, "u_fog_data")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_fog_data"; return desc; } if (std.mem.eql(u8, u_name, "u_fog_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_fog_color"; diff --git a/src/framework/graphics/shaders/default-mesh.glsl.zig b/src/framework/graphics/shaders/default-mesh.glsl.zig index 86420fb9..255b4f43 100644 --- a/src/framework/graphics/shaders/default-mesh.glsl.zig +++ b/src/framework/graphics/shaders/default-mesh.glsl.zig @@ -36,6 +36,9 @@ const m = @import("../../math.zig"); // Sampler 'smp': // Type: .FILTERING // Bind slot: SMP_smp => 0 +// Image Sampler Pair 'tex_smp': +// Image: tex +// Sampler: smp // pub const ATTR_default_pos = 0; pub const ATTR_default_color0 = 1; @@ -1460,15 +1463,10 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl430; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -1498,15 +1496,10 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl300es; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -1538,19 +1531,14 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.fragment_func.source = &fs_source_hlsl4; desc.fragment_func.d3d11_target = "ps_4_0"; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].hlsl_sem_name = "TEXCOORD"; desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].hlsl_sem_name = "TEXCOORD"; desc.attrs[2].hlsl_sem_index = 2; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].hlsl_sem_name = "TEXCOORD"; desc.attrs[3].hlsl_sem_index = 3; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].hlsl_sem_name = "TEXCOORD"; desc.attrs[4].hlsl_sem_index = 4; desc.uniform_blocks[0].stage = .VERTEX; @@ -1578,11 +1566,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_macos; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1608,11 +1591,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_ios; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1638,11 +1616,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_sim; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1668,11 +1641,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_wgsl; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1770,31 +1738,31 @@ pub fn defaultUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { } return null; } -pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { +pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniformDesc { if (std.mem.eql(u8, ub_name, "vs_params")) { if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_projViewMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_modelMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color"; return desc; } if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_tex_pan"; @@ -1803,14 +1771,14 @@ pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShade } if (std.mem.eql(u8, ub_name, "fs_params")) { if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color_override"; return desc; } if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_alpha_cutoff"; diff --git a/src/framework/graphics/shaders/default.glsl.zig b/src/framework/graphics/shaders/default.glsl.zig index f2e30264..a4046288 100644 --- a/src/framework/graphics/shaders/default.glsl.zig +++ b/src/framework/graphics/shaders/default.glsl.zig @@ -34,6 +34,9 @@ const m = @import("../../math.zig"); // Sampler 'smp': // Type: .FILTERING // Bind slot: SMP_smp => 0 +// Image Sampler Pair 'tex_smp': +// Image: tex +// Sampler: smp // pub const ATTR_default_pos = 0; pub const ATTR_default_color0 = 1; @@ -1407,11 +1410,8 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl430; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -1441,11 +1441,8 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl300es; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -1477,13 +1474,10 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.fragment_func.source = &fs_source_hlsl4; desc.fragment_func.d3d11_target = "ps_4_0"; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].hlsl_sem_name = "TEXCOORD"; desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].hlsl_sem_name = "TEXCOORD"; desc.attrs[2].hlsl_sem_index = 2; desc.uniform_blocks[0].stage = .VERTEX; @@ -1511,9 +1505,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_macos; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1539,9 +1530,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_ios; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1567,9 +1555,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_sim; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1595,9 +1580,6 @@ pub fn defaultShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_wgsl; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -1689,31 +1671,31 @@ pub fn defaultUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { } return null; } -pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { +pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniformDesc { if (std.mem.eql(u8, ub_name, "vs_params")) { if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_projViewMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_modelMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color"; return desc; } if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_tex_pan"; @@ -1722,14 +1704,14 @@ pub fn defaultUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShade } if (std.mem.eql(u8, ub_name, "fs_params")) { if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color_override"; return desc; } if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_alpha_cutoff"; diff --git a/src/framework/graphics/shaders/emissive.glsl.zig b/src/framework/graphics/shaders/emissive.glsl.zig index 7f12dc53..910c0335 100644 --- a/src/framework/graphics/shaders/emissive.glsl.zig +++ b/src/framework/graphics/shaders/emissive.glsl.zig @@ -41,6 +41,12 @@ const m = @import("../../math.zig"); // Sampler 'smp': // Type: .FILTERING // Bind slot: SMP_smp => 0 +// Image Sampler Pair 'tex_smp': +// Image: tex +// Sampler: smp +// Image Sampler Pair 'tex_emissive_smp': +// Image: tex_emissive +// Sampler: smp // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -1830,15 +1836,10 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl430; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -1876,15 +1877,10 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl300es; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -1924,19 +1920,14 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.fragment_func.source = &fs_source_hlsl4; desc.fragment_func.d3d11_target = "ps_4_0"; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].hlsl_sem_name = "TEXCOORD"; desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].hlsl_sem_name = "TEXCOORD"; desc.attrs[2].hlsl_sem_index = 2; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].hlsl_sem_name = "TEXCOORD"; desc.attrs[3].hlsl_sem_index = 3; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].hlsl_sem_name = "TEXCOORD"; desc.attrs[4].hlsl_sem_index = 4; desc.uniform_blocks[0].stage = .VERTEX; @@ -1972,11 +1963,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_macos; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -2010,11 +1996,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_ios; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -2048,11 +2029,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_sim; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -2086,11 +2062,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_wgsl; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 160; @@ -2199,31 +2170,31 @@ pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { } return null; } -pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniformDesc { if (std.mem.eql(u8, ub_name, "vs_params")) { if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_projViewMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_modelMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color"; return desc; } if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_tex_pan"; @@ -2232,14 +2203,14 @@ pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShad } if (std.mem.eql(u8, ub_name, "fs_params")) { if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color_override"; return desc; } if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_alpha_cutoff"; diff --git a/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig b/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig index 2d1e0336..848940f3 100644 --- a/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig +++ b/src/framework/graphics/shaders/skinned-basic-lighting.glsl.zig @@ -43,6 +43,12 @@ const m = @import("../../math.zig"); // Sampler 'smp': // Type: .FILTERING // Bind slot: SMP_smp => 0 +// Image Sampler Pair 'tex_smp': +// Image: tex +// Sampler: smp +// Image Sampler Pair 'tex_emissive_smp': +// Image: tex_emissive +// Sampler: smp // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -4112,19 +4118,12 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl430; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; - desc.attrs[5].base_type = .FLOAT; desc.attrs[5].glsl_name = "joints"; - desc.attrs[6].base_type = .FLOAT; desc.attrs[6].glsl_name = "weights"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -4162,19 +4161,12 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl300es; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; - desc.attrs[5].base_type = .FLOAT; desc.attrs[5].glsl_name = "joints"; - desc.attrs[6].base_type = .FLOAT; desc.attrs[6].glsl_name = "weights"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -4214,25 +4206,18 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.fragment_func.source = &fs_source_hlsl4; desc.fragment_func.d3d11_target = "ps_4_0"; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].hlsl_sem_name = "TEXCOORD"; desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].hlsl_sem_name = "TEXCOORD"; desc.attrs[2].hlsl_sem_index = 2; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].hlsl_sem_name = "TEXCOORD"; desc.attrs[3].hlsl_sem_index = 3; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].hlsl_sem_name = "TEXCOORD"; desc.attrs[4].hlsl_sem_index = 4; - desc.attrs[5].base_type = .FLOAT; desc.attrs[5].hlsl_sem_name = "TEXCOORD"; desc.attrs[5].hlsl_sem_index = 5; - desc.attrs[6].base_type = .FLOAT; desc.attrs[6].hlsl_sem_name = "TEXCOORD"; desc.attrs[6].hlsl_sem_index = 6; desc.uniform_blocks[0].stage = .VERTEX; @@ -4268,13 +4253,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_macos; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -4308,13 +4286,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_ios; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -4348,13 +4319,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_sim; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -4388,13 +4352,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_wgsl; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -4536,38 +4493,38 @@ pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { } return null; } -pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniformDesc { if (std.mem.eql(u8, ub_name, "vs_params")) { if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_projViewMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_modelMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color"; return desc; } if (std.mem.eql(u8, u_name, "u_joints")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 64; desc.glsl_name = "u_joints"; return desc; } if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_tex_pan"; @@ -4576,70 +4533,70 @@ pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShad } if (std.mem.eql(u8, ub_name, "fs_params")) { if (std.mem.eql(u8, u_name, "u_cameraPos")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_cameraPos"; return desc; } if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color_override"; return desc; } if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_alpha_cutoff"; return desc; } if (std.mem.eql(u8, u_name, "u_ambient_light")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_ambient_light"; return desc; } if (std.mem.eql(u8, u_name, "u_dir_light_dir")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_dir_light_dir"; return desc; } if (std.mem.eql(u8, u_name, "u_dir_light_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_dir_light_color"; return desc; } if (std.mem.eql(u8, u_name, "u_num_point_lights")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_num_point_lights"; return desc; } if (std.mem.eql(u8, u_name, "u_point_light_data")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 32; desc.glsl_name = "u_point_light_data"; return desc; } if (std.mem.eql(u8, u_name, "u_fog_data")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_fog_data"; return desc; } if (std.mem.eql(u8, u_name, "u_fog_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_fog_color"; diff --git a/src/framework/graphics/shaders/skinned.glsl.zig b/src/framework/graphics/shaders/skinned.glsl.zig index 3d467162..1b4b6ca2 100644 --- a/src/framework/graphics/shaders/skinned.glsl.zig +++ b/src/framework/graphics/shaders/skinned.glsl.zig @@ -43,6 +43,12 @@ const m = @import("../../math.zig"); // Sampler 'smp': // Type: .FILTERING // Bind slot: SMP_smp => 0 +// Image Sampler Pair 'tex_smp': +// Image: tex +// Sampler: smp +// Image Sampler Pair 'tex_emissive_smp': +// Image: tex_emissive +// Sampler: smp // pub const ATTR_emissive_pos = 0; pub const ATTR_emissive_color0 = 1; @@ -2404,19 +2410,12 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl430; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; - desc.attrs[5].base_type = .FLOAT; desc.attrs[5].glsl_name = "joints"; - desc.attrs[6].base_type = .FLOAT; desc.attrs[6].glsl_name = "weights"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -2454,19 +2453,12 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_glsl300es; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].glsl_name = "pos"; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].glsl_name = "color0"; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].glsl_name = "texcoord0"; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].glsl_name = "normals"; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].glsl_name = "tangents"; - desc.attrs[5].base_type = .FLOAT; desc.attrs[5].glsl_name = "joints"; - desc.attrs[6].base_type = .FLOAT; desc.attrs[6].glsl_name = "weights"; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; @@ -2506,25 +2498,18 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.fragment_func.source = &fs_source_hlsl4; desc.fragment_func.d3d11_target = "ps_4_0"; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].base_type = .FLOAT; desc.attrs[1].hlsl_sem_name = "TEXCOORD"; desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].base_type = .FLOAT; desc.attrs[2].hlsl_sem_name = "TEXCOORD"; desc.attrs[2].hlsl_sem_index = 2; - desc.attrs[3].base_type = .FLOAT; desc.attrs[3].hlsl_sem_name = "TEXCOORD"; desc.attrs[3].hlsl_sem_index = 3; - desc.attrs[4].base_type = .FLOAT; desc.attrs[4].hlsl_sem_name = "TEXCOORD"; desc.attrs[4].hlsl_sem_index = 4; - desc.attrs[5].base_type = .FLOAT; desc.attrs[5].hlsl_sem_name = "TEXCOORD"; desc.attrs[5].hlsl_sem_index = 5; - desc.attrs[6].base_type = .FLOAT; desc.attrs[6].hlsl_sem_name = "TEXCOORD"; desc.attrs[6].hlsl_sem_index = 6; desc.uniform_blocks[0].stage = .VERTEX; @@ -2560,13 +2545,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_macos; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -2600,13 +2578,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_ios; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -2640,13 +2611,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main0"; desc.fragment_func.source = &fs_source_metal_sim; desc.fragment_func.entry = "main0"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -2680,13 +2644,6 @@ pub fn emissiveShaderDesc(backend: sg.Backend) sg.ShaderDesc { desc.vertex_func.entry = "main"; desc.fragment_func.source = &fs_source_wgsl; desc.fragment_func.entry = "main"; - desc.attrs[0].base_type = .FLOAT; - desc.attrs[1].base_type = .FLOAT; - desc.attrs[2].base_type = .FLOAT; - desc.attrs[3].base_type = .FLOAT; - desc.attrs[4].base_type = .FLOAT; - desc.attrs[5].base_type = .FLOAT; - desc.attrs[6].base_type = .FLOAT; desc.uniform_blocks[0].stage = .VERTEX; desc.uniform_blocks[0].layout = .STD140; desc.uniform_blocks[0].size = 4256; @@ -2804,38 +2761,38 @@ pub fn emissiveUniformOffset(ub_name: []const u8, u_name: []const u8) ?usize { } return null; } -pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniform { +pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShaderUniformDesc { if (std.mem.eql(u8, ub_name, "vs_params")) { if (std.mem.eql(u8, u_name, "u_projViewMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_projViewMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_modelMatrix")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 0; desc.glsl_name = "u_modelMatrix"; return desc; } if (std.mem.eql(u8, u_name, "u_color")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color"; return desc; } if (std.mem.eql(u8, u_name, "u_joints")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .MAT4; desc.array_count = 64; desc.glsl_name = "u_joints"; return desc; } if (std.mem.eql(u8, u_name, "u_tex_pan")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_tex_pan"; @@ -2844,14 +2801,14 @@ pub fn emissiveUniformDesc(ub_name: []const u8, u_name: []const u8) ?sg.GlslShad } if (std.mem.eql(u8, ub_name, "fs_params")) { if (std.mem.eql(u8, u_name, "u_color_override")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT4; desc.array_count = 0; desc.glsl_name = "u_color_override"; return desc; } if (std.mem.eql(u8, u_name, "u_alpha_cutoff")) { - var desc: sg.GlslShaderUniform = .{}; + var desc: sg.ShaderUniformDesc = .{}; desc.type = .FLOAT; desc.array_count = 0; desc.glsl_name = "u_alpha_cutoff"; diff --git a/src/framework/platform/backends/sokol/graphics.zig b/src/framework/platform/backends/sokol/graphics.zig index db3be126..e425a626 100644 --- a/src/framework/platform/backends/sokol/graphics.zig +++ b/src/framework/platform/backends/sokol/graphics.zig @@ -168,7 +168,7 @@ pub const BindingsImpl = struct { // TODO we would need to read from glsl the binding value if we need to assign it manually or remove this manual code // i because in the glsl definitions we have only fs samplers and they are annotated with layout(binding=0) // they start at 0 - self.impl.sokol_bindings.?.samplers[i + 1] = s; + self.impl.sokol_bindings.?.samplers[i] = s; } // also set shader uniforms here? @@ -548,6 +548,7 @@ pub const ShaderImpl = struct { // Find which binding slot we should use by looking at our layout for (layout.attributes) |la| { if (attr.binding == la.binding) { + // debug.log("Found buffer slot {}:{}: {}", .{ idx, la_idx, la.buffer_slot }); pipe_desc.layout.attrs[idx].buffer_index = la.buffer_slot; break; } @@ -615,7 +616,7 @@ pub const ShaderImpl = struct { /// Cache our common pipelines, as an optimization step pub fn makeCommonPipelines(self: *Shader) void { - for (graphics.getCommonVertexLayouts()) |l| { + for (common_vertex_layouts) |l| { _ = self.impl.makePipeline(l); } } diff --git a/src/framework/platform/graphics.zig b/src/framework/platform/graphics.zig index a28ddff0..c8fba41a 100644 --- a/src/framework/platform/graphics.zig +++ b/src/framework/platform/graphics.zig @@ -380,7 +380,7 @@ pub const Shader = struct { } pub fn initFromShaderInfo(cfg: ShaderConfig, shader_info: shaders.ShaderInfo) !Shader { - var shader = try ShaderImpl.initFromShaderInfo(cfg, shader_info); + const shader = try ShaderImpl.initFromShaderInfo(cfg, shader_info); shader.makeCommonPipelines(); return shader; } diff --git a/src/framework/scripting/lua.zig b/src/framework/scripting/lua.zig index b6b6d1ba..8b9a9659 100644 --- a/src/framework/scripting/lua.zig +++ b/src/framework/scripting/lua.zig @@ -1,4 +1,6 @@ -const zlua = @import("zlua"); +const builtin = @import("builtin"); + +const zlua = if (builtin.target.os.tag != .emscripten) @import("zlua") else @compileError("Scripting is currently not supported on web builds."); const std = @import("std"); const debug = @import("../debug.zig"); const mem = @import("../mem.zig");