From b2e3c890ec942b703e1d00425fe3171da66d6f58 Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Wed, 17 Jan 2024 16:12:43 +0100 Subject: [PATCH] [WebGPU] Make compute things compile again --- .../WebGPU/Sources/kinc/backend/compute.cpp | 43 ------------------- .../WebGPU/Sources/kinc/backend/compute.h | 13 ------ .../kinc/backend/graphics5/commandlist.c | 8 ++++ .../Sources/kinc/backend/graphics5/compute.c | 16 +++++++ .../Sources/kinc/backend/graphics5/compute.h | 5 +++ .../Sources/kinc/backend/graphics5/pipeline.h | 1 + 6 files changed, 30 insertions(+), 56 deletions(-) delete mode 100644 Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.cpp delete mode 100644 Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.h create mode 100644 Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.c create mode 100644 Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.h diff --git a/Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.cpp b/Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.cpp deleted file mode 100644 index 9985ad51f..000000000 --- a/Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -void kinc_compute_shader_init(kinc_compute_shader_t *shader, void *source, int length) {} - -void kinc_compute_shader_destroy(kinc_compute_shader_t *shader) {} - -kinc_compute_constant_location_t kinc_compute_shader_get_constant_location(kinc_compute_shader_t *shader, const char *name) { - kinc_compute_constant_location_t location; - location.impl.nothing = 0; - return location; -} - -kinc_compute_texture_unit_t kinc_compute_shader_get_texture_unit(kinc_compute_shader_t *shader, const char *name) { - kinc_compute_texture_unit_t unit; - unit.impl.nothing = 0; - return unit; -} - -void kinc_compute_set_bool(kinc_compute_constant_location_t location, bool value) {} -void kinc_compute_set_int(kinc_compute_constant_location_t location, int value) {} -void kinc_compute_set_float(kinc_compute_constant_location_t location, float value) {} -void kinc_compute_set_float2(kinc_compute_constant_location_t location, float value1, float value2) {} -void kinc_compute_set_float3(kinc_compute_constant_location_t location, float value1, float value2, float value3) {} -void kinc_compute_set_float4(kinc_compute_constant_location_t location, float value1, float value2, float value3, float value4) {} -void kinc_compute_set_floats(kinc_compute_constant_location_t location, float *values, int count) {} -void kinc_compute_set_matrix4(kinc_compute_constant_location_t location, kinc_matrix4x4_t *value) {} -void kinc_compute_set_matrix3(kinc_compute_constant_location_t location, kinc_matrix3x3_t *value) {} -void kinc_compute_set_texture(kinc_compute_texture_unit_t unit, kinc_g4_texture *texture, kinc_compute_access_t access) {} -void kinc_compute_set_render_target(kinc_compute_texture_unit_t unit, kinc_g4_render_target *texture, kinc_compute_access_t access) {} -void kinc_compute_set_sampled_texture(kinc_compute_texture_unit_t unit, kinc_g4_texture *texture) {} -void kinc_compute_set_sampled_render_target(kinc_compute_texture_unit_t unit, kinc_g4_render_target *target) {} -void kinc_compute_set_sampled_depth_from_render_target(kinc_compute_texture_unit_t unit, kinc_g4_render_target *target) {} -void kinc_compute_set_texture_addressing(kinc_compute_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing) {} -void kinc_compute_set_texture_magnification_filter(kinc_compute_texture_unit_t unit, kinc_g4_texture_filter_t filter) {} -void kinc_compute_set_texture_minification_filter(kinc_compute_texture_unit_t unit, kinc_g4_texture_filter_t filter) {} -void kinc_compute_set_texture_mipmap_filter(kinc_compute_texture_unit_t unit, kinc_g4_mipmap_filter_t filter) {} -void kinc_compute_set_texture3d_addressing(kinc_compute_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing) {} -void kinc_compute_set_texture3d_magnification_filter(kinc_compute_texture_unit_t unit, kinc_g4_texture_filter_t filter) {} -void kinc_compute_set_texture3d_minification_filter(kinc_compute_texture_unit_t unit, kinc_g4_texture_filter_t filter) {} -void kinc_compute_set_texture3d_mipmap_filter(kinc_compute_texture_unit_t unit, kinc_g4_mipmap_filter_t filter) {} -void kinc_compute_set_shader(kinc_compute_shader_t *shader) {} -void kinc_compute(int x, int y, int z) {} diff --git a/Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.h b/Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.h deleted file mode 100644 index ad6125cd1..000000000 --- a/Backends/Graphics5/WebGPU/Sources/kinc/backend/compute.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -typedef struct { - int nothing; -} kinc_compute_constant_location_impl_t; - -typedef struct { - int nothing; -} kinc_compute_texture_unit_impl_t; - -typedef struct { - int nothing; -} kinc_compute_shader_impl_t; diff --git a/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/commandlist.c b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/commandlist.c index 57f194410..5dc02fcd4 100644 --- a/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/commandlist.c +++ b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/commandlist.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -124,6 +125,9 @@ void kinc_g5_command_list_set_fragment_constant_buffer(kinc_g5_command_list_t *l } +void kinc_g5_command_list_set_compute_constant_buffer(kinc_g5_command_list_t *list, struct kinc_g5_constant_buffer *buffer, int offset, size_t size) { + +} void kinc_g5_command_list_set_render_target_face(kinc_g5_command_list_t *list, kinc_g5_render_target_t *texture, int face) {} @@ -152,3 +156,7 @@ void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigne void kinc_g5_command_list_set_texture_from_render_target(kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_render_target_t *renderTarget) {} void kinc_g5_command_list_set_texture_from_render_target_depth(kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_render_target_t *renderTarget) {} + +void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, kinc_g5_compute_shader *shader) {} + +void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z) {} diff --git a/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.c b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.c new file mode 100644 index 000000000..6869e08c8 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.c @@ -0,0 +1,16 @@ +#include +#include + +void kinc_g5_compute_shader_init(kinc_g5_compute_shader *shader, void *source, int length) {} + +void kinc_g5_compute_shader_destroy(kinc_g5_compute_shader *shader) {} + +kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5_compute_shader *shader, const char *name) { + kinc_g5_constant_location_t location = {0}; + return location; +} + +kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_shader *shader, const char *name) { + kinc_g5_texture_unit_t unit = {0}; + return unit; +} diff --git a/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.h b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.h new file mode 100644 index 000000000..cbea4ecd2 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/compute.h @@ -0,0 +1,5 @@ +#pragma once + +typedef struct kinc_g5_compute_shader_impl { + int nothing; +} kinc_g5_compute_shader_impl; diff --git a/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/pipeline.h b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/pipeline.h index b1611e3cf..fb006092d 100644 --- a/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/pipeline.h +++ b/Backends/Graphics5/WebGPU/Sources/kinc/backend/graphics5/pipeline.h @@ -17,6 +17,7 @@ typedef struct { typedef struct { int vertexOffset; int fragmentOffset; + int computeOffset; } ConstantLocation5Impl; #ifdef __cplusplus