From c67b38ea1e43b5253b109197a74a81e34c8a6eb1 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Fri, 31 Jan 2025 20:35:00 +0000 Subject: [PATCH] Update Compute Shader --- Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h | 60 ++++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h b/Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h index 3db7266..7efb1a3 100644 --- a/Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h +++ b/Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h @@ -4,69 +4,69 @@ #include vbyte *hl_kinc_compute_create_shader(vbyte *data, int length) { - kinc_compute_shader_t *shader = (kinc_compute_shader_t *)malloc(sizeof(kinc_compute_shader_t)); - kinc_compute_shader_init(shader, data, length); + kinc_g4_compute_shader *shader = (kinc_g4_compute_shader *)malloc(sizeof(kinc_g4_compute_shader)); + kinc_g4_compute_shader_init(shader, data, length); return (vbyte *)shader; } void hl_kinc_compute_delete_shader(vbyte *shader) { - kinc_compute_shader_t *sh = (kinc_compute_shader_t *)shader; - kinc_compute_shader_destroy(sh); + kinc_g4_compute_shader *sh = (kinc_g4_compute_shader *)shader; + kinc_g4_compute_shader_destroy(sh); free(sh); } vbyte *hl_kinc_compute_get_constantlocation(vbyte *shader, vbyte *name) { - kinc_compute_shader_t *sh = (kinc_compute_shader_t *)shader; - kinc_compute_constant_location_t *location = (kinc_compute_constant_location_t *)malloc(sizeof(kinc_compute_constant_location_t)); - *location = kinc_compute_shader_get_constant_location(sh, (char *)name), sizeof(kinc_compute_constant_location_t); + kinc_g4_compute_shader *sh = (kinc_g4_compute_shader *)shader; + kinc_g4_constant_location_t *location = (kinc_g4_constant_location_t *)malloc(sizeof(kinc_g4_constant_location_t)); + *location = kinc_g4_compute_shader_get_constant_location(sh, (char *)name), sizeof(kinc_g4_constant_location_t); return (vbyte *)location; } vbyte *hl_kinc_compute_get_textureunit(vbyte *shader, vbyte *name) { - kinc_compute_shader_t *sh = (kinc_compute_shader_t *)shader; - kinc_compute_texture_unit_t *unit = (kinc_compute_texture_unit_t *)malloc(sizeof(kinc_compute_texture_unit_t)); - *unit = kinc_compute_shader_get_texture_unit(sh, (char *)name), sizeof(kinc_compute_texture_unit_t); + kinc_g4_compute_shader *sh = (kinc_g4_compute_shader *)shader; + kinc_g4_texture_unit_t *unit = (kinc_g4_texture_unit_t *)malloc(sizeof(kinc_g4_texture_unit_t)); + *unit = kinc_g4_compute_shader_get_texture_unit(sh, (char *)name), sizeof(kinc_g4_texture_unit_t); return (vbyte *)unit; } void hl_kinc_compute_set_bool(vbyte *location, bool value) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_bool(*loc, value); } void hl_kinc_compute_set_int(vbyte *location, int value) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_int(*loc, value); } void hl_kinc_compute_set_float(vbyte *location, float value) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_float(*loc, value); } void hl_kinc_compute_set_float2(vbyte *location, float value1, float value2) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_float2(*loc, value1, value2); } void hl_kinc_compute_set_float3(vbyte *location, float value1, float value2, float value3) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_float3(*loc, value1, value2, value3); } void hl_kinc_compute_set_float4(vbyte *location, float value1, float value2, float value3, float value4) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_float4(*loc, value1, value2, value3, value4); } void hl_kinc_compute_set_floats(vbyte *location, vbyte *values, int count) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_compute_set_floats(*loc, (float *)values, count); } void hl_kinc_compute_set_matrix(vbyte *location, float _00, float _10, float _20, float _30, float _01, float _11, float _21, float _31, float _02, float _12, float _22, float _32, float _03, float _13, float _23, float _33) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_matrix4x4_t value; kinc_matrix4x4_set(&value, 0, 0, _00); kinc_matrix4x4_set(&value, 0, 1, _01); @@ -88,7 +88,7 @@ void hl_kinc_compute_set_matrix(vbyte *location, float _00, float _10, float _20 } void hl_kinc_compute_set_matrix3(vbyte *location, float _00, float _10, float _20, float _01, float _11, float _21, float _02, float _12, float _22) { - kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location; + kinc_g4_constant_location_t *loc = (kinc_g4_constant_location_t *)location; kinc_matrix3x3_t value; kinc_matrix3x3_set(&value, 0, 0, _00); kinc_matrix3x3_set(&value, 0, 1, _01); @@ -103,55 +103,55 @@ void hl_kinc_compute_set_matrix3(vbyte *location, float _00, float _10, float _2 } void hl_kinc_compute_set_texture(vbyte *unit, vbyte *texture, int access) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_texture_t *tex = (kinc_g4_texture_t *)texture; kinc_compute_set_texture(*u, tex, (kinc_compute_access_t)access); } void hl_kinc_compute_set_target(vbyte *unit, vbyte *renderTarget, int access) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget; kinc_compute_set_render_target(*u, rt, (kinc_compute_access_t)access); } void hl_kinc_compute_set_sampled_texture(vbyte *unit, vbyte *texture) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_texture_t *tex = (kinc_g4_texture_t *)texture; kinc_compute_set_sampled_texture(*u, tex); } void hl_kinc_compute_set_sampled_target(vbyte *unit, vbyte *renderTarget) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget; kinc_compute_set_sampled_render_target(*u, rt); } void hl_kinc_compute_set_sampled_depth_target(vbyte *unit, vbyte *renderTarget) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget; kinc_compute_set_sampled_depth_from_render_target(*u, rt); } void hl_kinc_compute_set_sampled_cubemap_texture(vbyte *unit, vbyte *texture) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_texture_t *tex = (kinc_g4_texture_t *)texture; kinc_compute_set_sampled_texture(*u, tex); } void hl_kinc_compute_set_sampled_cubemap_target(vbyte *unit, vbyte *renderTarget) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget; kinc_compute_set_sampled_render_target(*u, rt); } void hl_kinc_compute_set_sampled_cubemap_depth_target(vbyte *unit, vbyte *renderTarget) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget; kinc_compute_set_sampled_depth_from_render_target(*u, rt); } void hl_kinc_compute_set_texture_parameters(vbyte *unit, int uAddressing, int vAddressing, int minificationFilter, int magnificationFilter, int mipmapFilter) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_compute_set_texture_addressing(*u, KINC_G4_TEXTURE_DIRECTION_U, (kinc_g4_texture_addressing_t)uAddressing); kinc_compute_set_texture_addressing(*u, KINC_G4_TEXTURE_DIRECTION_V, (kinc_g4_texture_addressing_t)vAddressing); kinc_compute_set_texture_minification_filter(*u, (kinc_g4_texture_filter_t)minificationFilter); @@ -161,7 +161,7 @@ void hl_kinc_compute_set_texture_parameters(vbyte *unit, int uAddressing, int vA void hl_kinc_compute_set_texture3d_parameters(vbyte *unit, int uAddressing, int vAddressing, int wAddressing, int minificationFilter, int magnificationFilter, int mipmapFilter) { - kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit; + kinc_g4_texture_unit_t *u = (kinc_g4_texture_unit_t *)unit; kinc_compute_set_texture3d_addressing(*u, KINC_G4_TEXTURE_DIRECTION_U, (kinc_g4_texture_addressing_t)uAddressing); kinc_compute_set_texture3d_addressing(*u, KINC_G4_TEXTURE_DIRECTION_V, (kinc_g4_texture_addressing_t)vAddressing); kinc_compute_set_texture3d_addressing(*u, KINC_G4_TEXTURE_DIRECTION_W, (kinc_g4_texture_addressing_t)wAddressing); @@ -171,7 +171,7 @@ void hl_kinc_compute_set_texture3d_parameters(vbyte *unit, int uAddressing, int } void hl_kinc_compute_set_shader(vbyte *shader) { - kinc_compute_set_shader((kinc_compute_shader_t *)shader); + kinc_compute_set_shader((kinc_g4_compute_shader *)shader); } void hl_kinc_compute_compute(int x, int y, int z) {