fix minor spirv val

This commit is contained in:
2025-12-26 01:16:58 +00:00
parent 7c485737cd
commit 0cb35e8bc4
2 changed files with 20 additions and 14 deletions
+19 -13
View File
@@ -514,21 +514,23 @@ pub(crate) fn compile_interval_function(
float: u32, float: u32,
b: &mut rspirv::dr::Builder, b: &mut rspirv::dr::Builder,
bool: u32, bool: u32,
choice: u32, choice_type: u32,
glsl: u32, glsl: u32,
val_a: (u32, u32), val_a: (u32, u32),
val_b: (u32, u32), val_b: (u32, u32),
) -> ((u32, u32), u32) { ) -> ((u32, u32), u32) {
let choice_left = b.constant_bit32(choice, Choice::Left as u32); let choice_left = b.constant_bit32(choice_type, Choice::Left as u32);
let choice_right = b.constant_bit32(choice, Choice::Right as u32); let choice_right = b.constant_bit32(choice_type, Choice::Right as u32);
let choice_both = b.constant_bit32(choice, Choice::Both as u32); let choice_both = b.constant_bit32(choice_type, Choice::Both as u32);
let alt = b.f_ord_less_than(bool, None, val_a.1, val_b.0).unwrap(); let alt = b.f_ord_less_than(bool, None, val_a.1, val_b.0).unwrap();
let blt = b.f_ord_less_than(bool, None, val_b.1, val_a.0).unwrap(); let blt = b.f_ord_less_than(bool, None, val_b.1, val_a.0).unwrap();
let choice = b let choice = b
.select(choice, None, alt, choice_left, choice_both) .select(choice_type, None, alt, choice_left, choice_both)
.unwrap();
let choice = b
.select(choice_type, None, blt, choice_right, choice)
.unwrap(); .unwrap();
let choice = b.select(choice, None, blt, choice_right, choice).unwrap();
( (
( (
b.ext_inst( b.ext_inst(
@@ -564,21 +566,23 @@ pub(crate) fn compile_interval_function(
float: u32, float: u32,
b: &mut rspirv::dr::Builder, b: &mut rspirv::dr::Builder,
bool: u32, bool: u32,
choice: u32, choice_type: u32,
glsl: u32, glsl: u32,
val_a: (u32, u32), val_a: (u32, u32),
val_b: (u32, u32), val_b: (u32, u32),
) -> ((u32, u32), u32) { ) -> ((u32, u32), u32) {
let choice_left = b.constant_bit32(choice, Choice::Left as u32); let choice_left = b.constant_bit32(choice_type, Choice::Left as u32);
let choice_right = b.constant_bit32(choice, Choice::Right as u32); let choice_right = b.constant_bit32(choice_type, Choice::Right as u32);
let choice_both = b.constant_bit32(choice, Choice::Both as u32); let choice_both = b.constant_bit32(choice_type, Choice::Both as u32);
let agt = b.f_ord_greater_than(bool, None, val_a.0, val_b.1).unwrap(); let agt = b.f_ord_greater_than(bool, None, val_a.0, val_b.1).unwrap();
let bgt = b.f_ord_greater_than(bool, None, val_b.0, val_a.1).unwrap(); let bgt = b.f_ord_greater_than(bool, None, val_b.0, val_a.1).unwrap();
let choice = b let choice = b
.select(choice, None, agt, choice_left, choice_both) .select(choice_type, None, agt, choice_left, choice_both)
.unwrap();
let choice = b
.select(choice_type, None, bgt, choice_right, choice)
.unwrap(); .unwrap();
let choice = b.select(choice, None, bgt, choice_right, choice).unwrap();
( (
( (
b.ext_inst( b.ext_inst(
@@ -779,7 +783,9 @@ pub(crate) fn compile_interval_function(
}, },
SSAReturn => { SSAReturn => {
let value = input_resolve(types.float, b, &mapping, instruction.inputs[0]); let value = input_resolve(types.float, b, &mapping, instruction.inputs[0]);
let value_vec2 = b.constant_composite(types.vec2, [value.0, value.1]); let value_vec2 = b
.composite_construct(types.vec2, None, [value.0, value.1])
.unwrap();
b.ret_value(value_vec2).unwrap(); b.ret_value(value_vec2).unwrap();
}, },
SSAPosition => { SSAPosition => {
+1 -1
View File
@@ -474,7 +474,7 @@ impl SSATape {
let void = b.type_void(); let void = b.type_void();
let float = b.type_float(32); let float = b.type_float(32);
let bool = b.type_bool(); let bool = b.type_bool();
let choice = b.type_int(8, 0); let choice = b.type_int(32, 0);
let vec2 = b.type_vector(float, 2); let vec2 = b.type_vector(float, 2);
let vec3 = b.type_vector(float, 3); let vec3 = b.type_vector(float, 3);
let vec4 = b.type_vector(float, 4); let vec4 = b.type_vector(float, 4);