Shader fixes

This commit is contained in:
luboslenco
2025-07-16 17:40:00 +02:00
parent fe9b47d6c1
commit e4c2c0c7c5
3 changed files with 69 additions and 46 deletions
+11 -9
View File
@@ -316,15 +316,17 @@ function uniforms_set_context_const(location: i32, c: shader_const_t): bool {
v.y = (-zfar * znear) / (zfar - znear);
}
else if (starts_with(c.link, "_size(")) {
let tex: string = substring(c.link, 6, c.link.length - 1);
for (let i: i32 = 0; i < math_floor(_render_path_bind_params.length / 2); ++i) {
let pos: i32 = i * 2; // bind params = [texture, sampler_id]
let sampler_id: string = _render_path_bind_params[pos + 1];
if (sampler_id == tex) {
let rt_id: string = _render_path_bind_params[pos];
let rt: render_target_t = map_get(render_path_render_targets, rt_id);
v.x = rt.width;
v.y = rt.height;
if (_render_path_bind_params != null) {
let tex: string = substring(c.link, 6, c.link.length - 1);
for (let i: i32 = 0; i < math_floor(_render_path_bind_params.length / 2); ++i) {
let pos: i32 = i * 2; // bind params = [texture, sampler_id]
let sampler_id: string = _render_path_bind_params[pos + 1];
if (sampler_id == tex) {
let rt_id: string = _render_path_bind_params[pos];
let rt: render_target_t = map_get(render_path_render_targets, rt_id);
v.x = rt.width;
v.y = rt.height;
}
}
}
}