From cb43bd20951841c5a0292e39fdb9bbd08ce1ac39 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 17 Jul 2025 23:44:56 +0200 Subject: [PATCH] Shader fixes --- armorpaint/sources/make_mesh.ts | 8 ++------ armorsculpt/sources/make_mesh.ts | 6 +----- base/assets/shader_datas.arm | Bin 15103 -> 14517 bytes base/sources/ts/iron/iron.ts | 3 ++- base/sources/ts/iron/shader_data.ts | 3 +++ 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/armorpaint/sources/make_mesh.ts b/armorpaint/sources/make_mesh.ts index eaaf3cf9..81233137 100644 --- a/armorpaint/sources/make_mesh.ts +++ b/armorpaint/sources/make_mesh.ts @@ -93,7 +93,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte node_shader_add_texture(kong, "gbuffer0"); node_shader_add_texture(kong, "gbuffer1"); node_shader_add_texture(kong, "gbuffer2"); - node_shader_write_frag(kong, "var fragcoord: float2 = (input.wvpposition.x / input.wvpposition.w, input.wvpposition.y / input.wvpposition.w) * 0.5 + 0.5;"); + node_shader_write_frag(kong, "var fragcoord: float2 = float2(input.wvpposition.x / input.wvpposition.w, input.wvpposition.y / input.wvpposition.w) * 0.5 + 0.5;"); node_shader_write_frag(kong, "fragcoord.y = 1.0 - fragcoord.y;"); node_shader_write_frag(kong, "var gbuffer0_sample: float4 = sample_lod(gbuffer0, sampler_linear, fragcoord, 0.0);"); node_shader_write_frag(kong, "var gbuffer1_sample: float4 = sample_lod(gbuffer1, sampler_linear, fragcoord, 0.0);"); @@ -177,7 +177,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte count += masks.length; } texture_count += count; - if (texture_count >= make_mesh_get_max_textures()) { + if (texture_count >= GPU_MAX_TEXTURES - 3) { texture_count = start_count + count + 3; // gbuffer0_copy, gbuffer1_copy, gbuffer2_copy make_mesh_layer_pass_count++; } @@ -528,7 +528,3 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte return con_mesh; } - -function make_mesh_get_max_textures(): i32 { - return 16 - 3; // G4onG5/G4.c.h MAX_TEXTURES -} diff --git a/armorsculpt/sources/make_mesh.ts b/armorsculpt/sources/make_mesh.ts index 1ee73261..3564de8c 100644 --- a/armorsculpt/sources/make_mesh.ts +++ b/armorsculpt/sources/make_mesh.ts @@ -137,7 +137,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte count += masks.length; } texture_count += count; - if (texture_count >= make_mesh_get_max_textures()) { + if (texture_count >= GPU_MAX_TEXTURES - 3) { texture_count = start_count + count + 3; // gbuffer0_copy, gbuffer1_copy, gbuffer2_copy make_mesh_layer_pass_count++; } @@ -342,7 +342,3 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte gpu_create_shaders_from_kong(node_shader_get(kong), ADDRESS(con_mesh.data.vertex_shader), ADDRESS(con_mesh.data.fragment_shader), ADDRESS(con_mesh.data._.vertex_shader_size), ADDRESS(con_mesh.data._.fragment_shader_size)); return con_mesh; } - -function make_mesh_get_max_textures(): i32 { - return 16 - 3; // G4onG5/G4.c.h MAX_TEXTURES -} diff --git a/base/assets/shader_datas.arm b/base/assets/shader_datas.arm index a0c76a23d4088ecc5a789a2cf0c7152ba621f4cc..52840907185e5cbdf0d335d67007c5b906afefb8 100644 GIT binary patch delta 67 zcmexgy0vh_Cbr2Fl!YfxXXBgvojGjtYHkb0$y}nrlWlozHh