Update kong

This commit is contained in:
luboslenco
2025-07-16 17:39:34 +02:00
parent 0bb080b4d5
commit fe9b47d6c1
4 changed files with 33 additions and 0 deletions
+4
View File
@@ -1420,6 +1420,10 @@ static void write_functions(char *hlsl, size_t *offset, shader_stage stage, func
*offset += sprintf(&hlsl[*offset], "%s _%" PRIu64 " = max(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_call.var.type.type),
o->op_call.var.index, o->op_call.parameters[0].index, o->op_call.parameters[1].index);
}
else if (o->op_call.func == add_name("max4")) {
*offset += sprintf(&hlsl[*offset], "%s _%" PRIu64 " = max(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_call.var.type.type),
o->op_call.var.index, o->op_call.parameters[0].index, o->op_call.parameters[1].index);
}
else if (o->op_call.func == add_name("step3")) {
*offset += sprintf(&hlsl[*offset], "%s _%" PRIu64 " = step(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_call.var.type.type),
o->op_call.var.index, o->op_call.parameters[0].index, o->op_call.parameters[1].index);
+4
View File
@@ -773,6 +773,10 @@ static void write_functions(char *code, size_t *offset) {
*offset += sprintf(&code[*offset], "%s _%" PRIu64 " = max(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_call.var.type.type),
o->op_call.var.index, o->op_call.parameters[0].index, o->op_call.parameters[1].index);
}
else if (o->op_call.func == add_name("max4")) {
*offset += sprintf(&code[*offset], "%s _%" PRIu64 " = max(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_call.var.type.type),
o->op_call.var.index, o->op_call.parameters[0].index, o->op_call.parameters[1].index);
}
else if (o->op_call.func == add_name("step3")) {
*offset += sprintf(&code[*offset], "%s _%" PRIu64 " = step(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_call.var.type.type),
o->op_call.var.index, o->op_call.parameters[0].index, o->op_call.parameters[1].index);
+6
View File
@@ -2518,6 +2518,12 @@ static void write_function(instructions_buffer *instructions, function *f, spirv
spirv_id id = write_op_ext_inst2(instructions, spirv_float3_type, glsl_import, SPIRV_GLSL_STD_FMAX, operand1, operand2);
hmput(index_map, o->op_call.var.index, id);
}
else if (func == add_name("max4")) {
spirv_id operand1 = get_var(instructions, o->op_call.parameters[0]);
spirv_id operand2 = get_var(instructions, o->op_call.parameters[1]);
spirv_id id = write_op_ext_inst2(instructions, spirv_float4_type, glsl_import, SPIRV_GLSL_STD_FMAX, operand1, operand2);
hmput(index_map, o->op_call.var.index, id);
}
else if (func == add_name("step3")) {
spirv_id operand1 = get_var(instructions, o->op_call.parameters[0]);
spirv_id operand2 = get_var(instructions, o->op_call.parameters[1]);
+19
View File
@@ -277,6 +277,24 @@ static void add_func_float3_float3_float3(char *name) {
f->block = NULL;
}
static void add_func_float4_float4_float4(char *name) {
function_id func = add_function(add_name(name));
function *f = get_function(func);
init_type_ref(&f->return_type, add_name("float4"));
f->return_type.type = find_type_by_ref(&f->return_type);
f->parameter_names[0] = add_name("a");
init_type_ref(&f->parameter_types[0], add_name("float4"));
f->parameter_types[0].type = find_type_by_ref(&f->parameter_types[0]);
f->parameter_names[1] = add_name("b");
init_type_ref(&f->parameter_types[1], add_name("float4"));
f->parameter_types[1].type = find_type_by_ref(&f->parameter_types[1]);
f->parameters_size = 2;
f->block = NULL;
}
static void add_func_void_uint_uint(char *name) {
function_id func = add_function(add_name(name));
function *f = get_function(func);
@@ -843,6 +861,7 @@ void functions_init(void) {
add_func_float3_float3_float_float("clamp3");
add_func_float3_float3_float3("min3");
add_func_float3_float3_float3("max3");
add_func_float4_float4_float4("max4");
add_func_float3_float3_float3("step3");
add_func_float3_float3_float3("pow3");
add_func_float3_float3_float3("floor3");