diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device.c b/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device.c deleted file mode 100644 index 8c7b2032e..000000000 --- a/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "device_functions.h" - -#include - -void kope_vulkan_device_create(kope_g5_device *device, kope_g5_device_wishlist wishlist) {} - -void kope_vulkan_device_destroy(kope_g5_device *device) {} - -void kope_vulkan_device_set_name(kope_g5_device *device, const char *name) {} diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device_functions.h b/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device_functions.h deleted file mode 100644 index 112776c5e..000000000 --- a/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device_functions.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef KOPE_VULKAN_DEVICE_FUNCTIONS_HEADER -#define KOPE_VULKAN_DEVICE_FUNCTIONS_HEADER - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct kope_vulkan_device { - int nothing; -} kope_vulkan_device; - -void kope_vulkan_device_create(kope_g5_device *device, kope_g5_device_wishlist wishlist); - -void kope_vulkan_device_destroy(kope_g5_device *device); - -void kope_vulkan_device_set_name(kope_g5_device *device, const char *name); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device_structs.h b/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device_structs.h deleted file mode 100644 index 011a54f43..000000000 --- a/Backends/Graphics5/Direct3D12/Sources/kope/vulkan/device_structs.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef KOPE_VULKAN_DEVICE_STRUCTS_HEADER -#define KOPE_VULKAN_DEVICE_STRUCTS_HEADER - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct kope_vulkan_device { - int nothing; -} kope_vulkan_device; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer.c new file mode 100644 index 000000000..c13f5514e --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer.c @@ -0,0 +1,31 @@ +#include "buffer_functions.h" + +#include + +void kope_vulkan_buffer_set_name(kope_g5_buffer *buffer, const char *name) { + +} + +void kope_vulkan_buffer_destroy(kope_g5_buffer *buffer) { + +} + +void *kope_vulkan_buffer_try_to_lock_all(kope_g5_buffer *buffer) { + return NULL; +} + +void *kope_vulkan_buffer_lock_all(kope_g5_buffer *buffer) { + return NULL; +} + +void *kope_vulkan_buffer_try_to_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size) { + return NULL; +} + +void *kope_vulkan_buffer_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size) { + return NULL; +} + +void kope_vulkan_buffer_unlock(kope_g5_buffer *buffer) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer_functions.h new file mode 100644 index 000000000..e217181ee --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer_functions.h @@ -0,0 +1,28 @@ +#ifndef KOPE_VULKAN_BUFFER_FUNCTIONS_HEADER +#define KOPE_VULKAN_BUFFER_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_buffer_set_name(kope_g5_buffer *buffer, const char *name); + +void kope_vulkan_buffer_destroy(kope_g5_buffer *buffer); + +void *kope_vulkan_buffer_try_to_lock_all(kope_g5_buffer *buffer); + +void *kope_vulkan_buffer_lock_all(kope_g5_buffer *buffer); + +void *kope_vulkan_buffer_try_to_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size); + +void *kope_vulkan_buffer_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size); + +void kope_vulkan_buffer_unlock(kope_g5_buffer *buffer); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer_structs.h new file mode 100644 index 000000000..88008aa5e --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/buffer_structs.h @@ -0,0 +1,20 @@ +#ifndef KOPE_VULKAN_BUFFER_STRUCTS_HEADER +#define KOPE_VULKAN_BUFFER_STRUCTS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct kope_g5_device; + +typedef struct kope_vulkan_buffer { + int nothing; +} kope_vulkan_buffer; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist.c new file mode 100644 index 000000000..b4a54efd8 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist.c @@ -0,0 +1,185 @@ +#include "commandlist_functions.h" + +#include "vulkanunit.h" + +#include +#include + +#include + +#include "pipeline_structs.h" + +#include + +#include + +void kope_vulkan_command_list_destroy(kope_g5_command_list *list) { + +} + +void kope_vulkan_command_list_begin_render_pass(kope_g5_command_list *list, const kope_g5_render_pass_parameters *parameters) { + +} + +void kope_vulkan_command_list_end_render_pass(kope_g5_command_list *list) { + +} + +void kope_vulkan_command_list_present(kope_g5_command_list *list) { + +} + +void kope_vulkan_command_list_set_index_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, kope_g5_index_format index_format, uint64_t offset, + uint64_t size) { + +} + +void kope_vulkan_command_list_set_vertex_buffer(kope_g5_command_list *list, uint32_t slot, kope_vulkan_buffer *buffer, uint64_t offset, uint64_t size, + uint64_t stride) { + +} + +void kope_vulkan_command_list_set_render_pipeline(kope_g5_command_list *list, kope_vulkan_render_pipeline *pipeline) { + +} + +void kope_vulkan_command_list_draw(kope_g5_command_list *list, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance) { + +} + +void kope_vulkan_command_list_draw_indexed(kope_g5_command_list *list, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t base_vertex, + uint32_t first_instance) { + +} + +void kope_vulkan_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_vulkan_descriptor_set *set, + kope_g5_buffer **dynamic_buffers, uint32_t *dynamic_offsets, uint32_t *dynamic_sizes) { + +} + +void kope_vulkan_command_list_set_root_constants(kope_g5_command_list *list, uint32_t table_index, const void *data, size_t data_size) { + +} + +void kope_vulkan_command_list_copy_buffer_to_buffer(kope_g5_command_list *list, kope_g5_buffer *source, uint64_t source_offset, kope_g5_buffer *destination, + uint64_t destination_offset, uint64_t size) { + +} + +void kope_vulkan_command_list_copy_buffer_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_buffer *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers) { + +} + +void kope_vulkan_command_list_copy_texture_to_buffer(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_buffer *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers) { + +} + +void kope_vulkan_command_list_copy_texture_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers) { + +} + +void kope_vulkan_command_list_clear_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, size_t offset, uint64_t size) { + +} + +void kope_vulkan_command_list_set_compute_pipeline(kope_g5_command_list *list, kope_vulkan_compute_pipeline *pipeline) { + +} + +void kope_vulkan_command_list_compute(kope_g5_command_list *list, uint32_t workgroup_count_x, uint32_t workgroup_count_y, uint32_t workgroup_count_z) { + +} + +void kope_vulkan_command_list_prepare_raytracing_volume(kope_g5_command_list *list, kope_g5_raytracing_volume *volume) { + +} + +void kope_vulkan_command_list_prepare_raytracing_hierarchy(kope_g5_command_list *list, kope_g5_raytracing_hierarchy *hierarchy) { + +} + +void kope_vulkan_command_list_update_raytracing_hierarchy(kope_g5_command_list *list, kinc_matrix4x4_t *volume_transforms, uint32_t volumes_count, + kope_g5_raytracing_hierarchy *hierarchy) { + +} + +void kope_vulkan_command_list_set_ray_pipeline(kope_g5_command_list *list, kope_vulkan_ray_pipeline *pipeline) { + +} + +void kope_vulkan_command_list_trace_rays(kope_g5_command_list *list, uint32_t width, uint32_t height, uint32_t depth) { + +} + +void kope_vulkan_command_list_set_viewport(kope_g5_command_list *list, float x, float y, float width, float height, float min_depth, float max_depth) { + +} + +void kope_vulkan_command_list_set_scissor_rect(kope_g5_command_list *list, uint32_t x, uint32_t y, uint32_t width, uint32_t height) { + +} + +void kope_vulkan_command_list_set_blend_constant(kope_g5_command_list *list, kope_g5_color color) { + +} + +void kope_vulkan_command_list_set_stencil_reference(kope_g5_command_list *list, uint32_t reference) { + +} + +void kope_vulkan_command_list_set_name(kope_g5_command_list *list, const char *name) { + +} + +void kope_vulkan_command_list_push_debug_group(kope_g5_command_list *list, const char *name) { + +} + +void kope_vulkan_command_list_pop_debug_group(kope_g5_command_list *list) { + +} + +void kope_vulkan_command_list_insert_debug_marker(kope_g5_command_list *list, const char *name) { + +} + +void kope_vulkan_command_list_begin_occlusion_query(kope_g5_command_list *list, uint32_t query_index) { + +} + +void kope_vulkan_command_list_end_occlusion_query(kope_g5_command_list *list) { + +} + +void kope_vulkan_command_list_resolve_query_set(kope_g5_command_list *list, kope_g5_query_set *query_set, uint32_t first_query, uint32_t query_count, + kope_g5_buffer *destination, uint64_t destination_offset) { + +} + +void kope_vulkan_command_list_draw_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, uint32_t max_draw_count, + kope_g5_buffer *count_buffer, uint64_t count_offset) { + +} + +void kope_vulkan_command_list_draw_indexed_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, + uint32_t max_draw_count, kope_g5_buffer *count_buffer, uint64_t count_offset) { + +} + +void kope_vulkan_command_list_compute_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset) { + +} + +void kope_vulkan_command_list_queue_buffer_access(kope_g5_command_list *list, kope_g5_buffer *buffer, uint32_t offset, uint32_t size) { + +} + +void kope_vulkan_command_list_queue_descriptor_set_access(kope_g5_command_list *list, kope_vulkan_descriptor_set *descriptor_set) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist_functions.h new file mode 100644 index 000000000..a43924bfd --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist_functions.h @@ -0,0 +1,110 @@ +#ifndef KOPE_VULKAN_COMMANDLIST_FUNCTIONS_HEADER +#define KOPE_VULKAN_COMMANDLIST_FUNCTIONS_HEADER + +#include + +#include "descriptorset_structs.h" +#include "pipeline_structs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_command_list_destroy(kope_g5_command_list *list); + +void kope_vulkan_command_list_copy_buffer_to_buffer(kope_g5_command_list *list, kope_g5_buffer *source, uint64_t source_offset, kope_g5_buffer *destination, + uint64_t destination_offset, uint64_t size); + +void kope_vulkan_command_list_copy_buffer_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_buffer *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers); + +void kope_vulkan_command_list_copy_texture_to_buffer(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_buffer *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers); + +void kope_vulkan_command_list_copy_texture_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers); + +void kope_vulkan_command_list_clear_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, size_t offset, uint64_t size); + +void kope_vulkan_command_list_begin_render_pass(kope_g5_command_list *list, const kope_g5_render_pass_parameters *parameters); + +void kope_vulkan_command_list_end_render_pass(kope_g5_command_list *list); + +void kope_vulkan_command_list_present(kope_g5_command_list *list); + +void kope_vulkan_command_list_set_viewport(kope_g5_command_list *list, float x, float y, float width, float height, float min_depth, float max_depth); + +void kope_vulkan_command_list_set_scissor_rect(kope_g5_command_list *list, uint32_t x, uint32_t y, uint32_t width, uint32_t height); + +void kope_vulkan_command_list_set_blend_constant(kope_g5_command_list *list, kope_g5_color color); + +void kope_vulkan_command_list_set_stencil_reference(kope_g5_command_list *list, uint32_t reference); + +void kope_vulkan_command_list_set_index_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, kope_g5_index_format index_format, uint64_t offset, + uint64_t size); + +void kope_vulkan_command_list_set_vertex_buffer(kope_g5_command_list *list, uint32_t slot, kope_vulkan_buffer *buffer, uint64_t offset, uint64_t size, + uint64_t stride); + +void kope_vulkan_command_list_set_render_pipeline(kope_g5_command_list *list, kope_vulkan_render_pipeline *pipeline); + +void kope_vulkan_command_list_draw(kope_g5_command_list *list, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance); + +void kope_vulkan_command_list_draw_indexed(kope_g5_command_list *list, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t base_vertex, + uint32_t first_instance); + +void kope_vulkan_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_vulkan_descriptor_set *set, + kope_g5_buffer **dynamic_buffers, uint32_t *dynamic_offsets, uint32_t *dynamic_sizes); + +void kope_vulkan_command_list_set_root_constants(kope_g5_command_list *list, uint32_t table_index, const void *data, size_t data_size); + +void kope_vulkan_command_list_set_compute_pipeline(kope_g5_command_list *list, kope_vulkan_compute_pipeline *pipeline); + +void kope_vulkan_command_list_compute(kope_g5_command_list *list, uint32_t workgroup_count_x, uint32_t workgroup_count_y, uint32_t workgroup_count_z); + +void kope_vulkan_command_list_prepare_raytracing_volume(kope_g5_command_list *list, kope_g5_raytracing_volume *volume); + +void kope_vulkan_command_list_prepare_raytracing_hierarchy(kope_g5_command_list *list, kope_g5_raytracing_hierarchy *hierarchy); + +void kope_vulkan_command_list_update_raytracing_hierarchy(kope_g5_command_list *list, kinc_matrix4x4_t *volume_transforms, uint32_t volumes_count, + kope_g5_raytracing_hierarchy *hierarchy); + +void kope_vulkan_command_list_set_ray_pipeline(kope_g5_command_list *list, kope_vulkan_ray_pipeline *pipeline); + +void kope_vulkan_command_list_trace_rays(kope_g5_command_list *list, uint32_t width, uint32_t height, uint32_t depth); + +void kope_vulkan_command_list_set_name(kope_g5_command_list *list, const char *name); + +void kope_vulkan_command_list_push_debug_group(kope_g5_command_list *list, const char *name); + +void kope_vulkan_command_list_pop_debug_group(kope_g5_command_list *list); + +void kope_vulkan_command_list_insert_debug_marker(kope_g5_command_list *list, const char *name); + +void kope_vulkan_command_list_begin_occlusion_query(kope_g5_command_list *list, uint32_t query_index); + +void kope_vulkan_command_list_end_occlusion_query(kope_g5_command_list *list); + +void kope_vulkan_command_list_resolve_query_set(kope_g5_command_list *list, kope_g5_query_set *query_set, uint32_t first_query, uint32_t query_count, + kope_g5_buffer *destination, uint64_t destination_offset); + +void kope_vulkan_command_list_draw_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, uint32_t max_draw_count, + kope_g5_buffer *count_buffer, uint64_t count_offset); + +void kope_vulkan_command_list_draw_indexed_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, + uint32_t max_draw_count, kope_g5_buffer *count_buffer, uint64_t count_offset); + +void kope_vulkan_command_list_compute_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset); + +void kope_vulkan_command_list_queue_buffer_access(kope_g5_command_list *list, kope_g5_buffer *buffer, uint32_t offset, uint32_t size); + +void kope_vulkan_command_list_queue_descriptor_set_access(kope_g5_command_list *list, kope_vulkan_descriptor_set *descriptor_set); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist_structs.h new file mode 100644 index 000000000..78975bcb6 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/commandlist_structs.h @@ -0,0 +1,30 @@ +#ifndef KOPE_VULKAN_COMMANDLIST_STRUCTS_HEADER +#define KOPE_VULKAN_COMMANDLIST_STRUCTS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct kope_vulkan_device; +struct kope_vulkan_texture; +struct kope_vulkan_compute_pipeline; +struct kope_vulkan_ray_pipeline; +struct kope_vulkan_rendery_pipeline; +struct kope_vulkan_descriptor_set; +struct kope_g5_query_set; + +typedef struct kope_vulkan_buffer_access { + int nothing; +} kope_vulkan_buffer_access; + +typedef struct kope_vulkan_command_list { + int nothing; +} kope_vulkan_command_list; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset.c new file mode 100644 index 000000000..513bca955 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset.c @@ -0,0 +1,6 @@ +#include "descriptorset_functions.h" +#include "descriptorset_structs.h" + +#include + +#include diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset_functions.h new file mode 100644 index 000000000..4446aec17 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset_functions.h @@ -0,0 +1,34 @@ +#ifndef KOPE_VULKAN_DESCRIPTORSET_FUNCTIONS_HEADER +#define KOPE_VULKAN_DESCRIPTORSET_FUNCTIONS_HEADER + +#include "buffer_structs.h" +#include "descriptorset_structs.h" +#include "device_structs.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_descriptor_set_set_buffer_view_cbv(kope_g5_device *device, kope_vulkan_descriptor_set *set, kope_g5_buffer *buffer, uint32_t index); +void kope_vulkan_descriptor_set_set_buffer_view_srv(kope_g5_device *device, kope_vulkan_descriptor_set *set, kope_g5_buffer *buffer, uint32_t index); +void kope_vulkan_descriptor_set_set_bvh_view_srv(kope_g5_device *device, kope_vulkan_descriptor_set *set, kope_g5_raytracing_hierarchy *bvh, uint32_t index); +void kope_vulkan_descriptor_set_set_texture_view_srv(kope_g5_device *device, uint32_t offset, const kope_g5_texture_view *texture_view); +void kope_vulkan_descriptor_set_set_texture_array_view_srv(kope_g5_device *device, kope_vulkan_descriptor_set *set, const kope_g5_texture_view *texture_view, + uint32_t index); +void kope_vulkan_descriptor_set_set_texture_cube_view_srv(kope_g5_device *device, kope_vulkan_descriptor_set *set, const kope_g5_texture_view *texture_view, + uint32_t index); +void kope_vulkan_descriptor_set_set_texture_view_uav(kope_g5_device *device, kope_vulkan_descriptor_set *set, const kope_g5_texture_view *texture_view, + uint32_t index); +void kope_vulkan_descriptor_set_set_sampler(kope_g5_device *device, kope_vulkan_descriptor_set *set, kope_g5_sampler *sampler, uint32_t index); + +void kope_vulkan_descriptor_set_prepare_cbv_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, uint32_t offset, uint32_t size); +void kope_vulkan_descriptor_set_prepare_srv_texture(kope_g5_command_list *list, const kope_g5_texture_view *texture_view); +void kope_vulkan_descriptor_set_prepare_uav_texture(kope_g5_command_list *list, const kope_g5_texture_view *texture_view); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset_structs.h new file mode 100644 index 000000000..5fc82caa4 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/descriptorset_structs.h @@ -0,0 +1,20 @@ +#ifndef KOPE_VULKAN_DESCRIPTORSET_STRUCTS_HEADER +#define KOPE_VULKAN_DESCRIPTORSET_STRUCTS_HEADER + +#include "device_structs.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_vulkan_descriptor_set { + int nothing; +} kope_vulkan_descriptor_set; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device.c new file mode 100644 index 000000000..aa6dd86f8 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device.c @@ -0,0 +1,86 @@ +#include "device_functions.h" + +#include "vulkanunit.h" + +#include +#include + +#include +#include + +#include + +void kope_vulkan_device_create(kope_g5_device *device, const kope_g5_device_wishlist *wishlist) { + +} + +void kope_vulkan_device_destroy(kope_g5_device *device) { + +} + +void kope_vulkan_device_set_name(kope_g5_device *device, const char *name) { + +} + +void kope_vulkan_device_create_buffer(kope_g5_device *device, const kope_g5_buffer_parameters *parameters, kope_g5_buffer *buffer) { + +} + +void kope_vulkan_device_create_command_list(kope_g5_device *device, kope_g5_command_list_type type, kope_g5_command_list *list) { + +} + +void kope_vulkan_device_create_texture(kope_g5_device *device, const kope_g5_texture_parameters *parameters, kope_g5_texture *texture) { + +} + +kope_g5_texture *kope_vulkan_device_get_framebuffer(kope_g5_device *device) { + return NULL; +} + +void kope_vulkan_device_execute_command_list(kope_g5_device *device, kope_g5_command_list *list) { + +} + +void kope_vulkan_device_wait_until_idle(kope_g5_device *device) { + +} + +void kope_vulkan_device_create_descriptor_set(kope_g5_device *device, uint32_t descriptor_count, uint32_t dynamic_descriptor_count, + uint32_t bindless_descriptor_count, uint32_t sampler_count, kope_vulkan_descriptor_set *set) { + +} + +void kope_vulkan_device_create_sampler(kope_g5_device *device, const kope_g5_sampler_parameters *parameters, kope_g5_sampler *sampler) { + +} + +void kope_vulkan_device_create_raytracing_volume(kope_g5_device *device, kope_g5_buffer *vertex_buffer, uint64_t vertex_count, kope_g5_buffer *index_buffer, + uint32_t index_count, kope_g5_raytracing_volume *volume) { + +} + +void kope_vulkan_device_create_raytracing_hierarchy(kope_g5_device *device, kope_g5_raytracing_volume **volumes, kinc_matrix4x4_t *volume_transforms, + uint32_t volumes_count, kope_g5_raytracing_hierarchy *hierarchy) { + +} + +void kope_vulkan_device_create_query_set(kope_g5_device *device, const kope_g5_query_set_parameters *parameters, kope_g5_query_set *query_set) { + +} + +uint32_t kope_vulkan_device_align_texture_row_bytes(kope_g5_device *device, uint32_t row_bytes) { + return 0; +} + +void kope_vulkan_device_create_fence(kope_g5_device *device, kope_g5_fence *fence) { + +} + +void kope_vulkan_device_signal(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value) { + +} + +void kope_vulkan_device_wait(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device_functions.h new file mode 100644 index 000000000..479612fb9 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device_functions.h @@ -0,0 +1,57 @@ +#ifndef KOPE_VULKAN_DEVICE_FUNCTIONS_HEADER +#define KOPE_VULKAN_DEVICE_FUNCTIONS_HEADER + +#include + +#include + +#include "descriptorset_structs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_device_create(kope_g5_device *device, const kope_g5_device_wishlist *wishlist); + +void kope_vulkan_device_destroy(kope_g5_device *device); + +void kope_vulkan_device_set_name(kope_g5_device *device, const char *name); + +void kope_vulkan_device_create_buffer(kope_g5_device *device, const kope_g5_buffer_parameters *parameters, kope_g5_buffer *buffer); + +void kope_vulkan_device_create_command_list(kope_g5_device *device, kope_g5_command_list_type type, kope_g5_command_list *list); + +void kope_vulkan_device_create_texture(kope_g5_device *device, const kope_g5_texture_parameters *parameters, kope_g5_texture *texture); + +void kope_vulkan_device_create_descriptor_set(kope_g5_device *device, uint32_t descriptor_count, uint32_t dynamic_descriptor_count, + uint32_t bindless_descriptor_count, uint32_t sampler_count, kope_vulkan_descriptor_set *set); + +void kope_vulkan_device_create_sampler(kope_g5_device *device, const kope_g5_sampler_parameters *parameters, kope_g5_sampler *sampler); + +kope_g5_texture *kope_vulkan_device_get_framebuffer(kope_g5_device *device); + +void kope_vulkan_device_execute_command_list(kope_g5_device *device, kope_g5_command_list *list); + +void kope_vulkan_device_wait_until_idle(kope_g5_device *device); + +void kope_vulkan_device_create_raytracing_volume(kope_g5_device *device, kope_g5_buffer *vertex_buffer, uint64_t vertex_count, kope_g5_buffer *index_buffer, + uint32_t index_count, kope_g5_raytracing_volume *volume); + +void kope_vulkan_device_create_raytracing_hierarchy(kope_g5_device *device, kope_g5_raytracing_volume **volumes, kinc_matrix4x4_t *volume_transforms, + uint32_t volumes_count, kope_g5_raytracing_hierarchy *hierarchy); + +void kope_vulkan_device_create_query_set(kope_g5_device *device, const kope_g5_query_set_parameters *parameters, kope_g5_query_set *query_set); + +void kope_vulkan_device_create_fence(kope_g5_device *device, kope_g5_fence *fence); + +uint32_t kope_vulkan_device_align_texture_row_bytes(kope_g5_device *device, uint32_t row_bytes); + +void kope_vulkan_device_signal(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value); + +void kope_vulkan_device_wait(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device_structs.h new file mode 100644 index 000000000..644b470c6 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/device_structs.h @@ -0,0 +1,35 @@ +#ifndef KOPE_VULKAN_DEVICE_STRUCTS_HEADER +#define KOPE_VULKAN_DEVICE_STRUCTS_HEADER + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define KOPE_VULKAN_FRAME_COUNT 2 + +typedef struct kope_vulkan_device { + int nothing; +} kope_vulkan_device; + +typedef struct kope_vulkan_query_set { + int nothing; +} kope_vulkan_query_set; + +typedef struct kope_vulkan_raytracing_volume { + int nothing; +} kope_vulkan_raytracing_volume; + +typedef struct kope_vulkan_raytracing_hierarchy { + int nothing; +} kope_vulkan_raytracing_hierarchy; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence.c new file mode 100644 index 000000000..cec5eebf6 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence.c @@ -0,0 +1,7 @@ +#include "fence_functions.h" + +#include + +void kope_vulkan_fence_destroy(kope_g5_fence *fence) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence_functions.h new file mode 100644 index 000000000..c2788f1c0 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence_functions.h @@ -0,0 +1,16 @@ +#ifndef KOPE_VULKAN_FENCE_FUNCTIONS_HEADER +#define KOPE_VULKAN_FENCE_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_fence_destroy(kope_g5_fence *fence); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence_structs.h new file mode 100644 index 000000000..cd85f8f7f --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/fence_structs.h @@ -0,0 +1,18 @@ +#ifndef KOPE_VULKAN_FENCE_STRUCTS_HEADER +#define KOPE_VULKAN_FENCE_STRUCTS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_vulkan_fence { + int nothing; +} kope_vulkan_fence; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline.c new file mode 100644 index 000000000..6e093a5de --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline.c @@ -0,0 +1,28 @@ +#include "pipeline_functions.h" +#include "pipeline_structs.h" + +#include + +void kope_vulkan_render_pipeline_init(kope_vulkan_device *device, kope_vulkan_render_pipeline *pipe, const kope_vulkan_render_pipeline_parameters *parameters) { + +} + +void kope_vulkan_render_pipeline_destroy(kope_vulkan_render_pipeline *pipe) { + +} + +void kope_vulkan_compute_pipeline_init(kope_vulkan_device *device, kope_vulkan_compute_pipeline *pipe, const kope_vulkan_compute_pipeline_parameters *parameters) { + +} + +void kope_vulkan_compute_pipeline_destroy(kope_vulkan_compute_pipeline *pipe) { + +} + +void kope_vulkan_ray_pipeline_init(kope_g5_device *device, kope_vulkan_ray_pipeline *pipe, const kope_vulkan_ray_pipeline_parameters *parameters) { + +} + +void kope_vulkan_ray_pipeline_destroy(kope_vulkan_ray_pipeline *pipe) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline_functions.h new file mode 100644 index 000000000..f035fc2f9 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline_functions.h @@ -0,0 +1,27 @@ +#ifndef KOPE_VULKAN_PIPELINE_FUNCTIONS_HEADER +#define KOPE_VULKAN_PIPELINE_FUNCTIONS_HEADER + +#include "device_structs.h" +#include "pipeline_structs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_render_pipeline_init(kope_vulkan_device *device, kope_vulkan_render_pipeline *pipe, const kope_vulkan_render_pipeline_parameters *parameters); + +void kope_vulkan_render_pipeline_destroy(kope_vulkan_render_pipeline *pipe); + +void kope_vulkan_compute_pipeline_init(kope_vulkan_device *device, kope_vulkan_compute_pipeline *pipe, const kope_vulkan_compute_pipeline_parameters *parameters); + +void kope_vulkan_compute_pipeline_destroy(kope_vulkan_compute_pipeline *pipe); + +void kope_vulkan_ray_pipeline_init(kope_g5_device *device, kope_vulkan_ray_pipeline *pipe, const kope_vulkan_ray_pipeline_parameters *parameters); + +void kope_vulkan_ray_pipeline_destroy(kope_vulkan_ray_pipeline *pipe); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline_structs.h new file mode 100644 index 000000000..3f22b7fde --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/pipeline_structs.h @@ -0,0 +1,227 @@ +#ifndef KOPE_VULKAN_PIPELINE_STRUCTS_HEADER +#define KOPE_VULKAN_PIPELINE_STRUCTS_HEADER + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum kope_vulkan_vertex_step_mode { KOPE_VULKAN_VERTEX_STEP_MODE_VERTEX, KOPE_VULKAN_VERTEX_STEP_MODE_INSTANCE } kope_vulkan_vertex_step_mode; + +typedef enum kope_vulkan_vertex_format { + KOPE_VULKAN_VERTEX_FORMAT_UINT8X2, + KOPE_VULKAN_VERTEX_FORMAT_UINT8X4, + KOPE_VULKAN_VERTEX_FORMAT_SINT8X2, + KOPE_VULKAN_VERTEX_FORMAT_SINT8X4, + KOPE_VULKAN_VERTEX_FORMAT_UNORM8X2, + KOPE_VULKAN_VERTEX_FORMAT_UNORM8X4, + KOPE_VULKAN_VERTEX_FORMAT_SNORM8X2, + KOPE_VULKAN_VERTEX_FORMAT_SNORM8X4, + KOPE_VULKAN_VERTEX_FORMAT_UINT16X2, + KOPE_VULKAN_VERTEX_FORMAT_UINT16X4, + KOPE_VULKAN_VERTEX_FORMAT_SINT16X2, + KOPE_VULKAN_VERTEX_FORMAT_SINT16X4, + KOPE_VULKAN_VERTEX_FORMAT_UNORM16X2, + KOPE_VULKAN_VERTEX_FORMAT_UNORM16X4, + KOPE_VULKAN_VERTEX_FORMAT_SNORM16X2, + KOPE_VULKAN_VERTEX_FORMAT_SNORM16X4, + KOPE_VULKAN_VERTEX_FORMAT_FLOAT16X2, + KOPE_VULKAN_VERTEX_FORMAT_FLOAT16X4, + KOPE_VULKAN_VERTEX_FORMAT_FLOAT32, + KOPE_VULKAN_VERTEX_FORMAT_FLOAT32X2, + KOPE_VULKAN_VERTEX_FORMAT_FLOAT32X3, + KOPE_VULKAN_VERTEX_FORMAT_FLOAT32X4, + KOPE_VULKAN_VERTEX_FORMAT_UINT32, + KOPE_VULKAN_VERTEX_FORMAT_UINT32X2, + KOPE_VULKAN_VERTEX_FORMAT_UINT32X3, + KOPE_VULKAN_VERTEX_FORMAT_UINT32X4, + KOPE_VULKAN_VERTEX_FORMAT_SIN32, + KOPE_VULKAN_VERTEX_FORMAT_SINT32X2, + KOPE_VULKAN_VERTEX_FORMAT_SINT32X3, + KOPE_VULKAN_VERTEX_FORMAT_SINT32X4, + KOPE_VULKAN_VERTEX_FORMAT_UNORM10_10_10_2 +} kope_vulkan_vertex_format; + +typedef struct kope_vulkan_vertex_attribute { + kope_vulkan_vertex_format format; + uint64_t offset; + uint32_t shader_location; +} kope_vulkan_vertex_attribute; + +#define KOPE_VULKAN_MAX_VERTEX_ATTRIBUTES 32 + +typedef struct kope_vulkan_vertex_buffer_layout { + uint64_t array_stride; + kope_vulkan_vertex_step_mode step_mode; + kope_vulkan_vertex_attribute attributes[KOPE_VULKAN_MAX_VERTEX_ATTRIBUTES]; + size_t attributes_count; +} kope_vulkan_vertex_buffer_layout; + +typedef struct kope_vulkan_shader { + uint8_t *data; + size_t size; +} kope_vulkan_shader; + +#define KOPE_VULKAN_MAX_VERTEX_BUFFERS 16 + +typedef struct kope_vulkan_vertex_state { + kope_vulkan_shader shader; + kope_vulkan_vertex_buffer_layout buffers[KOPE_VULKAN_MAX_VERTEX_BUFFERS]; + size_t buffers_count; +} kope_vulkan_vertex_state; + +typedef enum kope_vulkan_primitive_topology { + KOPE_VULKAN_PRIMITIVE_TOPOLOGY_POINT_LIST, + KOPE_VULKAN_PRIMITIVE_TOPOLOGY_LINE_LIST, + KOPE_VULKAN_PRIMITIVE_TOPOLOGY_LINE_STRIP, + KOPE_VULKAN_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, + KOPE_VULKAN_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP +} kope_vulkan_primitive_topology; + +typedef enum kope_vulkan_front_face { KOPE_VULKAN_FRONT_FACE_CCW, KOPE_VULKAN_FRONT_FACE_CW } kope_vulkan_front_face; + +typedef enum kope_vulkan_cull_mode { KOPE_VULKAN_CULL_MODE_NONE, KOPE_VULKAN_CULL_MODE_FRONT, KOPE_VULKAN_CULL_MODE_BACK } kope_vulkan_cull_mode; + +typedef struct kope_vulkan_primitive_state { + kope_vulkan_primitive_topology topology; + kope_g5_index_format strip_index_format; + kope_vulkan_front_face front_face; + kope_vulkan_cull_mode cull_mode; + bool unclipped_depth; +} kope_vulkan_primitive_state; + +typedef enum kope_vulkan_stencil_operation { + KOPE_VULKAN_STENCIL_OPERATION_KEEP, + KOPE_VULKAN_STENCIL_OPERATION_ZERO, + KOPE_VULKAN_STENCIL_OPERATION_REPLACE, + KOPE_VULKAN_STENCIL_OPERATION_INVERT, + KOPE_VULKAN_STENCIL_OPERATION_INCREMENT_CLAMP, + KOPE_VULKAN_STENCIL_OPERATION_DECREMENT_CLAMP, + KOPE_VULKAN_STENCIL_OPERATION_INCREMENT_WRAP, + KOPE_VULKAN_STENCIL_OPERATION_DECREMENT_WRAP +} kope_vulkan_stencil_operation; + +typedef struct kope_vulkan_stencil_face_state { + kope_g5_compare_function compare; + kope_vulkan_stencil_operation fail_op; + kope_vulkan_stencil_operation depth_fail_op; + kope_vulkan_stencil_operation pass_op; +} kope_vulkan_stencil_face_state; + +typedef struct kope_vulkan_depth_stencil_state { + kope_g5_texture_format format; + bool depth_write_enabled; + kope_g5_compare_function depth_compare; + kope_vulkan_stencil_face_state stencil_front; + kope_vulkan_stencil_face_state stencil_back; + uint32_t stencil_read_mask; + uint32_t stencil_write_mask; + int32_t depth_bias; + float depth_bias_slope_scale; + float depth_bias_clamp; +} kope_vulkan_depth_stencil_state; + +typedef struct kope_vulkan_multisample_state { + uint32_t count; + uint32_t mask; + bool alpha_to_coverage_enabled; +} kope_vulkan_multisample_state; + +typedef enum kope_vulkan_blend_operation { + KOPE_VULKAN_BLEND_OPERATION_ADD, + KOPE_VULKAN_BLEND_OPERATION_SUBTRACT, + KOPE_VULKAN_BLEND_OPERATION_REVERSE_SUBTRACT, + KOPE_VULKAN_BLEND_OPERATION_MIN, + KOPE_VULKAN_BLEND_OPERATION_MAX +} kope_vulkan_blend_operation; + +typedef enum kope_vulkan_blend_factor { + KOPE_VULKAN_BLEND_FACTOR_ZERO, + KOPE_VULKAN_BLEND_FACTOR_ONE, + KOPE_VULKAN_BLEND_FACTOR_SRC, + KOPE_VULKAN_BLEND_FACTOR_ONE_MINUS_SRC, + KOPE_VULKAN_BLEND_FACTOR_SRC_ALPHA, + KOPE_VULKAN_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, + KOPE_VULKAN_BLEND_FACTOR_DST, + KOPE_VULKAN_BLEND_FACTOR_ONE_MINUS_DST, + KOPE_VULKAN_BLEND_FACTOR_DST_ALPHA, + KOPE_VULKAN_BLEND_FACTOR_ONE_MINUS_DST_ALPHA, + KOPE_VULKAN_BLEND_FACTOR_SRC_ALPHA_SATURATED, + KOPE_VULKAN_BLEND_FACTOR_CONSTANT, + KOPE_VULKAN_BLEND_FACTOR_ONE_MINUS_CONSTANT +} kope_vulkan_blend_factor; + +typedef struct kope_vulkan_blend_component { + kope_vulkan_blend_operation operation; + kope_vulkan_blend_factor src_factor; + kope_vulkan_blend_factor dst_factor; +} kope_vulkan_blend_component; + +typedef struct kope_vulkan_blend_state { + kope_vulkan_blend_component color; + kope_vulkan_blend_component alpha; +} kope_vulkan_blend_state; + +typedef enum kope_vulkan_color_write_flags { + KOPE_VULKAN_COLOR_WRITE_FLAGS_RED = 0x1, + KOPE_VULKAN_COLOR_WRITE_FLAGS_GREEN = 0x2, + KOPE_VULKAN_COLOR_WRITE_FLAGS_BLUE = 0x4, + KOPE_VULKAN_COLOR_WRITE_FLAGS_ALPHA = 0x8, + KOPE_VULKAN_COLOR_WRITE_FLAGS_ALL = 0xF +} kope_vulkan_color_write_flags; + +typedef struct kope_vulkan_color_target_state { + kope_g5_texture_format format; + kope_vulkan_blend_state blend; + uint32_t write_mask; +} kope_vulkan_color_target_state; + +#define KOPE_VULKAN_MAX_COLOR_TARGETS 8 + +typedef struct kope_vulkan_fragment_state { + kope_vulkan_shader shader; + kope_vulkan_color_target_state targets[KOPE_VULKAN_MAX_COLOR_TARGETS]; + size_t targets_count; +} kope_vulkan_fragment_state; + +typedef struct kope_vulkan_render_pipeline_parameters { + kope_vulkan_vertex_state vertex; + kope_vulkan_primitive_state primitive; + kope_vulkan_depth_stencil_state depth_stencil; + kope_vulkan_multisample_state multisample; + kope_vulkan_fragment_state fragment; +} kope_vulkan_render_pipeline_parameters; + +typedef struct kope_vulkan_render_pipeline { + int nothing; +} kope_vulkan_render_pipeline; + +typedef struct kope_vulkan_compute_pipeline_parameters { + kope_vulkan_shader shader; +} kope_vulkan_compute_pipeline_parameters; + +typedef struct kope_vulkan_compute_pipeline { + int nothing; +} kope_vulkan_compute_pipeline; + +typedef struct kope_vulkan_ray_pipeline_parameters { + kope_vulkan_shader gen_shader; + kope_vulkan_shader miss_shader; + kope_vulkan_shader closest_shader; + kope_vulkan_shader intersection_shader; + kope_vulkan_shader any_shader; +} kope_vulkan_ray_pipeline_parameters; + +typedef struct kope_vulkan_ray_pipeline { + int nothing; +} kope_vulkan_ray_pipeline; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler.c new file mode 100644 index 000000000..b20fa7b22 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler.c @@ -0,0 +1,9 @@ +#include "sampler_functions.h" + +#include "vulkanunit.h" + +#include + +void kope_vulkan_sampler_set_name(kope_g5_sampler *sampler, const char *name) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler_functions.h new file mode 100644 index 000000000..cfb35284e --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler_functions.h @@ -0,0 +1,16 @@ +#ifndef KOPE_VULKAN_SAMPLER_FUNCTIONS_HEADER +#define KOPE_VULKAN_SAMPLER_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_sampler_set_name(kope_g5_sampler *sampler, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler_structs.h new file mode 100644 index 000000000..3bddfd9b4 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/sampler_structs.h @@ -0,0 +1,16 @@ +#ifndef KOPE_VULKAN_SAMPLER_STRUCTS_HEADER +#define KOPE_VULKAN_SAMPLER_STRUCTS_HEADER + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_vulkan_sampler { + int nothing; +} kope_vulkan_sampler; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture.c new file mode 100644 index 000000000..9d9fe0f61 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture.c @@ -0,0 +1,9 @@ +#include "texture_functions.h" + +#include "vulkanunit.h" + +#include + +void kope_vulkan_texture_set_name(kope_g5_texture *texture, const char *name) { + +} diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture_functions.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture_functions.h new file mode 100644 index 000000000..52fc5de3a --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture_functions.h @@ -0,0 +1,16 @@ +#ifndef KOPE_VULKAN_TEXTURE_FUNCTIONS_HEADER +#define KOPE_VULKAN_TEXTURE_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_vulkan_texture_set_name(kope_g5_texture *texture, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture_structs.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture_structs.h new file mode 100644 index 000000000..ad81a1e20 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/texture_structs.h @@ -0,0 +1,16 @@ +#ifndef KOPE_VULKAN_TEXTURE_STRUCTS_HEADER +#define KOPE_VULKAN_TEXTURE_STRUCTS_HEADER + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_vulkan_texture { + int nothing; +} kope_vulkan_texture; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/vulkanunit.c b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/vulkanunit.c new file mode 100644 index 000000000..959759aef --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/vulkanunit.c @@ -0,0 +1,15 @@ +#include "vulkanunit.h" + +#include + +#include + + + +#include "buffer.c" +#include "commandlist.c" +#include "descriptorset.c" +#include "device.c" +#include "pipeline.c" +#include "sampler.c" +#include "texture.c" diff --git a/Backends/Graphics5/Vulkan/Sources/kope/vulkan/vulkanunit.h b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/vulkanunit.h new file mode 100644 index 000000000..51af147f1 --- /dev/null +++ b/Backends/Graphics5/Vulkan/Sources/kope/vulkan/vulkanunit.h @@ -0,0 +1,6 @@ +#ifndef KOPE_VULKAN_UNIT_HEADER +#define KOPE_VULKAN_UNIT_HEADER + + + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer.c new file mode 100644 index 000000000..f64dab2f0 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer.c @@ -0,0 +1,31 @@ +#include "buffer_functions.h" + +#include + +void kope_webgpu_buffer_set_name(kope_g5_buffer *buffer, const char *name) { + +} + +void kope_webgpu_buffer_destroy(kope_g5_buffer *buffer) { + +} + +void *kope_webgpu_buffer_try_to_lock_all(kope_g5_buffer *buffer) { + return NULL; +} + +void *kope_webgpu_buffer_lock_all(kope_g5_buffer *buffer) { + return NULL; +} + +void *kope_webgpu_buffer_try_to_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size) { + return NULL; +} + +void *kope_webgpu_buffer_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size) { + return NULL; +} + +void kope_webgpu_buffer_unlock(kope_g5_buffer *buffer) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer_functions.h new file mode 100644 index 000000000..89c1d215e --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer_functions.h @@ -0,0 +1,28 @@ +#ifndef KOPE_WEBGPU_BUFFER_FUNCTIONS_HEADER +#define KOPE_WEBGPU_BUFFER_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_buffer_set_name(kope_g5_buffer *buffer, const char *name); + +void kope_webgpu_buffer_destroy(kope_g5_buffer *buffer); + +void *kope_webgpu_buffer_try_to_lock_all(kope_g5_buffer *buffer); + +void *kope_webgpu_buffer_lock_all(kope_g5_buffer *buffer); + +void *kope_webgpu_buffer_try_to_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size); + +void *kope_webgpu_buffer_lock(kope_g5_buffer *buffer, uint64_t offset, uint64_t size); + +void kope_webgpu_buffer_unlock(kope_g5_buffer *buffer); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer_structs.h new file mode 100644 index 000000000..f3287bd41 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/buffer_structs.h @@ -0,0 +1,20 @@ +#ifndef KOPE_WEBGPU_BUFFER_STRUCTS_HEADER +#define KOPE_WEBGPU_BUFFER_STRUCTS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct kope_g5_device; + +typedef struct kope_webgpu_buffer { + int nothing; +} kope_webgpu_buffer; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist.c new file mode 100644 index 000000000..fb53d2618 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist.c @@ -0,0 +1,185 @@ +#include "commandlist_functions.h" + +#include "webgpuunit.h" + +#include +#include + +#include + +#include "pipeline_structs.h" + +#include + +#include + +void kope_webgpu_command_list_destroy(kope_g5_command_list *list) { + +} + +void kope_webgpu_command_list_begin_render_pass(kope_g5_command_list *list, const kope_g5_render_pass_parameters *parameters) { + +} + +void kope_webgpu_command_list_end_render_pass(kope_g5_command_list *list) { + +} + +void kope_webgpu_command_list_present(kope_g5_command_list *list) { + +} + +void kope_webgpu_command_list_set_index_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, kope_g5_index_format index_format, uint64_t offset, + uint64_t size) { + +} + +void kope_webgpu_command_list_set_vertex_buffer(kope_g5_command_list *list, uint32_t slot, kope_webgpu_buffer *buffer, uint64_t offset, uint64_t size, + uint64_t stride) { + +} + +void kope_webgpu_command_list_set_render_pipeline(kope_g5_command_list *list, kope_webgpu_render_pipeline *pipeline) { + +} + +void kope_webgpu_command_list_draw(kope_g5_command_list *list, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance) { + +} + +void kope_webgpu_command_list_draw_indexed(kope_g5_command_list *list, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t base_vertex, + uint32_t first_instance) { + +} + +void kope_webgpu_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_webgpu_descriptor_set *set, + kope_g5_buffer **dynamic_buffers, uint32_t *dynamic_offsets, uint32_t *dynamic_sizes) { + +} + +void kope_webgpu_command_list_set_root_constants(kope_g5_command_list *list, uint32_t table_index, const void *data, size_t data_size) { + +} + +void kope_webgpu_command_list_copy_buffer_to_buffer(kope_g5_command_list *list, kope_g5_buffer *source, uint64_t source_offset, kope_g5_buffer *destination, + uint64_t destination_offset, uint64_t size) { + +} + +void kope_webgpu_command_list_copy_buffer_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_buffer *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers) { + +} + +void kope_webgpu_command_list_copy_texture_to_buffer(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_buffer *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers) { + +} + +void kope_webgpu_command_list_copy_texture_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers) { + +} + +void kope_webgpu_command_list_clear_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, size_t offset, uint64_t size) { + +} + +void kope_webgpu_command_list_set_compute_pipeline(kope_g5_command_list *list, kope_webgpu_compute_pipeline *pipeline) { + +} + +void kope_webgpu_command_list_compute(kope_g5_command_list *list, uint32_t workgroup_count_x, uint32_t workgroup_count_y, uint32_t workgroup_count_z) { + +} + +void kope_webgpu_command_list_prepare_raytracing_volume(kope_g5_command_list *list, kope_g5_raytracing_volume *volume) { + +} + +void kope_webgpu_command_list_prepare_raytracing_hierarchy(kope_g5_command_list *list, kope_g5_raytracing_hierarchy *hierarchy) { + +} + +void kope_webgpu_command_list_update_raytracing_hierarchy(kope_g5_command_list *list, kinc_matrix4x4_t *volume_transforms, uint32_t volumes_count, + kope_g5_raytracing_hierarchy *hierarchy) { + +} + +void kope_webgpu_command_list_set_ray_pipeline(kope_g5_command_list *list, kope_webgpu_ray_pipeline *pipeline) { + +} + +void kope_webgpu_command_list_trace_rays(kope_g5_command_list *list, uint32_t width, uint32_t height, uint32_t depth) { + +} + +void kope_webgpu_command_list_set_viewport(kope_g5_command_list *list, float x, float y, float width, float height, float min_depth, float max_depth) { + +} + +void kope_webgpu_command_list_set_scissor_rect(kope_g5_command_list *list, uint32_t x, uint32_t y, uint32_t width, uint32_t height) { + +} + +void kope_webgpu_command_list_set_blend_constant(kope_g5_command_list *list, kope_g5_color color) { + +} + +void kope_webgpu_command_list_set_stencil_reference(kope_g5_command_list *list, uint32_t reference) { + +} + +void kope_webgpu_command_list_set_name(kope_g5_command_list *list, const char *name) { + +} + +void kope_webgpu_command_list_push_debug_group(kope_g5_command_list *list, const char *name) { + +} + +void kope_webgpu_command_list_pop_debug_group(kope_g5_command_list *list) { + +} + +void kope_webgpu_command_list_insert_debug_marker(kope_g5_command_list *list, const char *name) { + +} + +void kope_webgpu_command_list_begin_occlusion_query(kope_g5_command_list *list, uint32_t query_index) { + +} + +void kope_webgpu_command_list_end_occlusion_query(kope_g5_command_list *list) { + +} + +void kope_webgpu_command_list_resolve_query_set(kope_g5_command_list *list, kope_g5_query_set *query_set, uint32_t first_query, uint32_t query_count, + kope_g5_buffer *destination, uint64_t destination_offset) { + +} + +void kope_webgpu_command_list_draw_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, uint32_t max_draw_count, + kope_g5_buffer *count_buffer, uint64_t count_offset) { + +} + +void kope_webgpu_command_list_draw_indexed_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, + uint32_t max_draw_count, kope_g5_buffer *count_buffer, uint64_t count_offset) { + +} + +void kope_webgpu_command_list_compute_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset) { + +} + +void kope_webgpu_command_list_queue_buffer_access(kope_g5_command_list *list, kope_g5_buffer *buffer, uint32_t offset, uint32_t size) { + +} + +void kope_webgpu_command_list_queue_descriptor_set_access(kope_g5_command_list *list, kope_webgpu_descriptor_set *descriptor_set) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist_functions.h new file mode 100644 index 000000000..b2e55bcc7 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist_functions.h @@ -0,0 +1,110 @@ +#ifndef KOPE_WEBGPU_COMMANDLIST_FUNCTIONS_HEADER +#define KOPE_WEBGPU_COMMANDLIST_FUNCTIONS_HEADER + +#include + +#include "descriptorset_structs.h" +#include "pipeline_structs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_command_list_destroy(kope_g5_command_list *list); + +void kope_webgpu_command_list_copy_buffer_to_buffer(kope_g5_command_list *list, kope_g5_buffer *source, uint64_t source_offset, kope_g5_buffer *destination, + uint64_t destination_offset, uint64_t size); + +void kope_webgpu_command_list_copy_buffer_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_buffer *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers); + +void kope_webgpu_command_list_copy_texture_to_buffer(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_buffer *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers); + +void kope_webgpu_command_list_copy_texture_to_texture(kope_g5_command_list *list, const kope_g5_image_copy_texture *source, + const kope_g5_image_copy_texture *destination, uint32_t width, uint32_t height, + uint32_t depth_or_array_layers); + +void kope_webgpu_command_list_clear_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, size_t offset, uint64_t size); + +void kope_webgpu_command_list_begin_render_pass(kope_g5_command_list *list, const kope_g5_render_pass_parameters *parameters); + +void kope_webgpu_command_list_end_render_pass(kope_g5_command_list *list); + +void kope_webgpu_command_list_present(kope_g5_command_list *list); + +void kope_webgpu_command_list_set_viewport(kope_g5_command_list *list, float x, float y, float width, float height, float min_depth, float max_depth); + +void kope_webgpu_command_list_set_scissor_rect(kope_g5_command_list *list, uint32_t x, uint32_t y, uint32_t width, uint32_t height); + +void kope_webgpu_command_list_set_blend_constant(kope_g5_command_list *list, kope_g5_color color); + +void kope_webgpu_command_list_set_stencil_reference(kope_g5_command_list *list, uint32_t reference); + +void kope_webgpu_command_list_set_index_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, kope_g5_index_format index_format, uint64_t offset, + uint64_t size); + +void kope_webgpu_command_list_set_vertex_buffer(kope_g5_command_list *list, uint32_t slot, kope_webgpu_buffer *buffer, uint64_t offset, uint64_t size, + uint64_t stride); + +void kope_webgpu_command_list_set_render_pipeline(kope_g5_command_list *list, kope_webgpu_render_pipeline *pipeline); + +void kope_webgpu_command_list_draw(kope_g5_command_list *list, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance); + +void kope_webgpu_command_list_draw_indexed(kope_g5_command_list *list, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t base_vertex, + uint32_t first_instance); + +void kope_webgpu_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_webgpu_descriptor_set *set, + kope_g5_buffer **dynamic_buffers, uint32_t *dynamic_offsets, uint32_t *dynamic_sizes); + +void kope_webgpu_command_list_set_root_constants(kope_g5_command_list *list, uint32_t table_index, const void *data, size_t data_size); + +void kope_webgpu_command_list_set_compute_pipeline(kope_g5_command_list *list, kope_webgpu_compute_pipeline *pipeline); + +void kope_webgpu_command_list_compute(kope_g5_command_list *list, uint32_t workgroup_count_x, uint32_t workgroup_count_y, uint32_t workgroup_count_z); + +void kope_webgpu_command_list_prepare_raytracing_volume(kope_g5_command_list *list, kope_g5_raytracing_volume *volume); + +void kope_webgpu_command_list_prepare_raytracing_hierarchy(kope_g5_command_list *list, kope_g5_raytracing_hierarchy *hierarchy); + +void kope_webgpu_command_list_update_raytracing_hierarchy(kope_g5_command_list *list, kinc_matrix4x4_t *volume_transforms, uint32_t volumes_count, + kope_g5_raytracing_hierarchy *hierarchy); + +void kope_webgpu_command_list_set_ray_pipeline(kope_g5_command_list *list, kope_webgpu_ray_pipeline *pipeline); + +void kope_webgpu_command_list_trace_rays(kope_g5_command_list *list, uint32_t width, uint32_t height, uint32_t depth); + +void kope_webgpu_command_list_set_name(kope_g5_command_list *list, const char *name); + +void kope_webgpu_command_list_push_debug_group(kope_g5_command_list *list, const char *name); + +void kope_webgpu_command_list_pop_debug_group(kope_g5_command_list *list); + +void kope_webgpu_command_list_insert_debug_marker(kope_g5_command_list *list, const char *name); + +void kope_webgpu_command_list_begin_occlusion_query(kope_g5_command_list *list, uint32_t query_index); + +void kope_webgpu_command_list_end_occlusion_query(kope_g5_command_list *list); + +void kope_webgpu_command_list_resolve_query_set(kope_g5_command_list *list, kope_g5_query_set *query_set, uint32_t first_query, uint32_t query_count, + kope_g5_buffer *destination, uint64_t destination_offset); + +void kope_webgpu_command_list_draw_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, uint32_t max_draw_count, + kope_g5_buffer *count_buffer, uint64_t count_offset); + +void kope_webgpu_command_list_draw_indexed_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset, + uint32_t max_draw_count, kope_g5_buffer *count_buffer, uint64_t count_offset); + +void kope_webgpu_command_list_compute_indirect(kope_g5_command_list *list, kope_g5_buffer *indirect_buffer, uint64_t indirect_offset); + +void kope_webgpu_command_list_queue_buffer_access(kope_g5_command_list *list, kope_g5_buffer *buffer, uint32_t offset, uint32_t size); + +void kope_webgpu_command_list_queue_descriptor_set_access(kope_g5_command_list *list, kope_webgpu_descriptor_set *descriptor_set); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist_structs.h new file mode 100644 index 000000000..66e251950 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/commandlist_structs.h @@ -0,0 +1,30 @@ +#ifndef KOPE_WEBGPU_COMMANDLIST_STRUCTS_HEADER +#define KOPE_WEBGPU_COMMANDLIST_STRUCTS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct kope_webgpu_device; +struct kope_webgpu_texture; +struct kope_webgpu_compute_pipeline; +struct kope_webgpu_ray_pipeline; +struct kope_webgpu_rendery_pipeline; +struct kope_webgpu_descriptor_set; +struct kope_g5_query_set; + +typedef struct kope_webgpu_buffer_access { + int nothing; +} kope_webgpu_buffer_access; + +typedef struct kope_webgpu_command_list { + int nothing; +} kope_webgpu_command_list; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset.c new file mode 100644 index 000000000..7a2804ab4 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset.c @@ -0,0 +1,6 @@ +#include "descriptorset_functions.h" +#include "descriptorset_structs.h" + +#include + +#include diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset_functions.h new file mode 100644 index 000000000..ce23461d3 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset_functions.h @@ -0,0 +1,34 @@ +#ifndef KOPE_WEBGPU_DESCRIPTORSET_FUNCTIONS_HEADER +#define KOPE_WEBGPU_DESCRIPTORSET_FUNCTIONS_HEADER + +#include "buffer_structs.h" +#include "descriptorset_structs.h" +#include "device_structs.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_descriptor_set_set_buffer_view_cbv(kope_g5_device *device, kope_webgpu_descriptor_set *set, kope_g5_buffer *buffer, uint32_t index); +void kope_webgpu_descriptor_set_set_buffer_view_srv(kope_g5_device *device, kope_webgpu_descriptor_set *set, kope_g5_buffer *buffer, uint32_t index); +void kope_webgpu_descriptor_set_set_bvh_view_srv(kope_g5_device *device, kope_webgpu_descriptor_set *set, kope_g5_raytracing_hierarchy *bvh, uint32_t index); +void kope_webgpu_descriptor_set_set_texture_view_srv(kope_g5_device *device, uint32_t offset, const kope_g5_texture_view *texture_view); +void kope_webgpu_descriptor_set_set_texture_array_view_srv(kope_g5_device *device, kope_webgpu_descriptor_set *set, const kope_g5_texture_view *texture_view, + uint32_t index); +void kope_webgpu_descriptor_set_set_texture_cube_view_srv(kope_g5_device *device, kope_webgpu_descriptor_set *set, const kope_g5_texture_view *texture_view, + uint32_t index); +void kope_webgpu_descriptor_set_set_texture_view_uav(kope_g5_device *device, kope_webgpu_descriptor_set *set, const kope_g5_texture_view *texture_view, + uint32_t index); +void kope_webgpu_descriptor_set_set_sampler(kope_g5_device *device, kope_webgpu_descriptor_set *set, kope_g5_sampler *sampler, uint32_t index); + +void kope_webgpu_descriptor_set_prepare_cbv_buffer(kope_g5_command_list *list, kope_g5_buffer *buffer, uint32_t offset, uint32_t size); +void kope_webgpu_descriptor_set_prepare_srv_texture(kope_g5_command_list *list, const kope_g5_texture_view *texture_view); +void kope_webgpu_descriptor_set_prepare_uav_texture(kope_g5_command_list *list, const kope_g5_texture_view *texture_view); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset_structs.h new file mode 100644 index 000000000..e10ff9558 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/descriptorset_structs.h @@ -0,0 +1,20 @@ +#ifndef KOPE_WEBGPU_DESCRIPTORSET_STRUCTS_HEADER +#define KOPE_WEBGPU_DESCRIPTORSET_STRUCTS_HEADER + +#include "device_structs.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_webgpu_descriptor_set { + int nothing; +} kope_webgpu_descriptor_set; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device.c new file mode 100644 index 000000000..548239f1f --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device.c @@ -0,0 +1,86 @@ +#include "device_functions.h" + +#include "webgpuunit.h" + +#include +#include + +#include +#include + +#include + +void kope_webgpu_device_create(kope_g5_device *device, const kope_g5_device_wishlist *wishlist) { + +} + +void kope_webgpu_device_destroy(kope_g5_device *device) { + +} + +void kope_webgpu_device_set_name(kope_g5_device *device, const char *name) { + +} + +void kope_webgpu_device_create_buffer(kope_g5_device *device, const kope_g5_buffer_parameters *parameters, kope_g5_buffer *buffer) { + +} + +void kope_webgpu_device_create_command_list(kope_g5_device *device, kope_g5_command_list_type type, kope_g5_command_list *list) { + +} + +void kope_webgpu_device_create_texture(kope_g5_device *device, const kope_g5_texture_parameters *parameters, kope_g5_texture *texture) { + +} + +kope_g5_texture *kope_webgpu_device_get_framebuffer(kope_g5_device *device) { + return NULL; +} + +void kope_webgpu_device_execute_command_list(kope_g5_device *device, kope_g5_command_list *list) { + +} + +void kope_webgpu_device_wait_until_idle(kope_g5_device *device) { + +} + +void kope_webgpu_device_create_descriptor_set(kope_g5_device *device, uint32_t descriptor_count, uint32_t dynamic_descriptor_count, + uint32_t bindless_descriptor_count, uint32_t sampler_count, kope_webgpu_descriptor_set *set) { + +} + +void kope_webgpu_device_create_sampler(kope_g5_device *device, const kope_g5_sampler_parameters *parameters, kope_g5_sampler *sampler) { + +} + +void kope_webgpu_device_create_raytracing_volume(kope_g5_device *device, kope_g5_buffer *vertex_buffer, uint64_t vertex_count, kope_g5_buffer *index_buffer, + uint32_t index_count, kope_g5_raytracing_volume *volume) { + +} + +void kope_webgpu_device_create_raytracing_hierarchy(kope_g5_device *device, kope_g5_raytracing_volume **volumes, kinc_matrix4x4_t *volume_transforms, + uint32_t volumes_count, kope_g5_raytracing_hierarchy *hierarchy) { + +} + +void kope_webgpu_device_create_query_set(kope_g5_device *device, const kope_g5_query_set_parameters *parameters, kope_g5_query_set *query_set) { + +} + +uint32_t kope_webgpu_device_align_texture_row_bytes(kope_g5_device *device, uint32_t row_bytes) { + return 0; +} + +void kope_webgpu_device_create_fence(kope_g5_device *device, kope_g5_fence *fence) { + +} + +void kope_webgpu_device_signal(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value) { + +} + +void kope_webgpu_device_wait(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device_functions.h new file mode 100644 index 000000000..493023b68 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device_functions.h @@ -0,0 +1,57 @@ +#ifndef KOPE_WEBGPU_DEVICE_FUNCTIONS_HEADER +#define KOPE_WEBGPU_DEVICE_FUNCTIONS_HEADER + +#include + +#include + +#include "descriptorset_structs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_device_create(kope_g5_device *device, const kope_g5_device_wishlist *wishlist); + +void kope_webgpu_device_destroy(kope_g5_device *device); + +void kope_webgpu_device_set_name(kope_g5_device *device, const char *name); + +void kope_webgpu_device_create_buffer(kope_g5_device *device, const kope_g5_buffer_parameters *parameters, kope_g5_buffer *buffer); + +void kope_webgpu_device_create_command_list(kope_g5_device *device, kope_g5_command_list_type type, kope_g5_command_list *list); + +void kope_webgpu_device_create_texture(kope_g5_device *device, const kope_g5_texture_parameters *parameters, kope_g5_texture *texture); + +void kope_webgpu_device_create_descriptor_set(kope_g5_device *device, uint32_t descriptor_count, uint32_t dynamic_descriptor_count, + uint32_t bindless_descriptor_count, uint32_t sampler_count, kope_webgpu_descriptor_set *set); + +void kope_webgpu_device_create_sampler(kope_g5_device *device, const kope_g5_sampler_parameters *parameters, kope_g5_sampler *sampler); + +kope_g5_texture *kope_webgpu_device_get_framebuffer(kope_g5_device *device); + +void kope_webgpu_device_execute_command_list(kope_g5_device *device, kope_g5_command_list *list); + +void kope_webgpu_device_wait_until_idle(kope_g5_device *device); + +void kope_webgpu_device_create_raytracing_volume(kope_g5_device *device, kope_g5_buffer *vertex_buffer, uint64_t vertex_count, kope_g5_buffer *index_buffer, + uint32_t index_count, kope_g5_raytracing_volume *volume); + +void kope_webgpu_device_create_raytracing_hierarchy(kope_g5_device *device, kope_g5_raytracing_volume **volumes, kinc_matrix4x4_t *volume_transforms, + uint32_t volumes_count, kope_g5_raytracing_hierarchy *hierarchy); + +void kope_webgpu_device_create_query_set(kope_g5_device *device, const kope_g5_query_set_parameters *parameters, kope_g5_query_set *query_set); + +void kope_webgpu_device_create_fence(kope_g5_device *device, kope_g5_fence *fence); + +uint32_t kope_webgpu_device_align_texture_row_bytes(kope_g5_device *device, uint32_t row_bytes); + +void kope_webgpu_device_signal(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value); + +void kope_webgpu_device_wait(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device_structs.h new file mode 100644 index 000000000..0e69ce1d1 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/device_structs.h @@ -0,0 +1,35 @@ +#ifndef KOPE_WEBGPU_DEVICE_STRUCTS_HEADER +#define KOPE_WEBGPU_DEVICE_STRUCTS_HEADER + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define KOPE_WEBGPU_FRAME_COUNT 2 + +typedef struct kope_webgpu_device { + int nothing; +} kope_webgpu_device; + +typedef struct kope_webgpu_query_set { + int nothing; +} kope_webgpu_query_set; + +typedef struct kope_webgpu_raytracing_volume { + int nothing; +} kope_webgpu_raytracing_volume; + +typedef struct kope_webgpu_raytracing_hierarchy { + int nothing; +} kope_webgpu_raytracing_hierarchy; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence.c new file mode 100644 index 000000000..901fd6def --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence.c @@ -0,0 +1,7 @@ +#include "fence_functions.h" + +#include + +void kope_webgpu_fence_destroy(kope_g5_fence *fence) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence_functions.h new file mode 100644 index 000000000..f288a213d --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence_functions.h @@ -0,0 +1,16 @@ +#ifndef KOPE_WEBGPU_FENCE_FUNCTIONS_HEADER +#define KOPE_WEBGPU_FENCE_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_fence_destroy(kope_g5_fence *fence); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence_structs.h new file mode 100644 index 000000000..5e8290673 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/fence_structs.h @@ -0,0 +1,18 @@ +#ifndef KOPE_WEBGPU_FENCE_STRUCTS_HEADER +#define KOPE_WEBGPU_FENCE_STRUCTS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_webgpu_fence { + int nothing; +} kope_webgpu_fence; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline.c new file mode 100644 index 000000000..b803a3d5a --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline.c @@ -0,0 +1,28 @@ +#include "pipeline_functions.h" +#include "pipeline_structs.h" + +#include + +void kope_webgpu_render_pipeline_init(kope_webgpu_device *device, kope_webgpu_render_pipeline *pipe, const kope_webgpu_render_pipeline_parameters *parameters) { + +} + +void kope_webgpu_render_pipeline_destroy(kope_webgpu_render_pipeline *pipe) { + +} + +void kope_webgpu_compute_pipeline_init(kope_webgpu_device *device, kope_webgpu_compute_pipeline *pipe, const kope_webgpu_compute_pipeline_parameters *parameters) { + +} + +void kope_webgpu_compute_pipeline_destroy(kope_webgpu_compute_pipeline *pipe) { + +} + +void kope_webgpu_ray_pipeline_init(kope_g5_device *device, kope_webgpu_ray_pipeline *pipe, const kope_webgpu_ray_pipeline_parameters *parameters) { + +} + +void kope_webgpu_ray_pipeline_destroy(kope_webgpu_ray_pipeline *pipe) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline_functions.h new file mode 100644 index 000000000..f13bd7234 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline_functions.h @@ -0,0 +1,27 @@ +#ifndef KOPE_WEBGPU_PIPELINE_FUNCTIONS_HEADER +#define KOPE_WEBGPU_PIPELINE_FUNCTIONS_HEADER + +#include "device_structs.h" +#include "pipeline_structs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_render_pipeline_init(kope_webgpu_device *device, kope_webgpu_render_pipeline *pipe, const kope_webgpu_render_pipeline_parameters *parameters); + +void kope_webgpu_render_pipeline_destroy(kope_webgpu_render_pipeline *pipe); + +void kope_webgpu_compute_pipeline_init(kope_webgpu_device *device, kope_webgpu_compute_pipeline *pipe, const kope_webgpu_compute_pipeline_parameters *parameters); + +void kope_webgpu_compute_pipeline_destroy(kope_webgpu_compute_pipeline *pipe); + +void kope_webgpu_ray_pipeline_init(kope_g5_device *device, kope_webgpu_ray_pipeline *pipe, const kope_webgpu_ray_pipeline_parameters *parameters); + +void kope_webgpu_ray_pipeline_destroy(kope_webgpu_ray_pipeline *pipe); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline_structs.h new file mode 100644 index 000000000..0120721ca --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/pipeline_structs.h @@ -0,0 +1,227 @@ +#ifndef KOPE_WEBGPU_PIPELINE_STRUCTS_HEADER +#define KOPE_WEBGPU_PIPELINE_STRUCTS_HEADER + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum kope_webgpu_vertex_step_mode { KOPE_WEBGPU_VERTEX_STEP_MODE_VERTEX, KOPE_WEBGPU_VERTEX_STEP_MODE_INSTANCE } kope_webgpu_vertex_step_mode; + +typedef enum kope_webgpu_vertex_format { + KOPE_WEBGPU_VERTEX_FORMAT_UINT8X2, + KOPE_WEBGPU_VERTEX_FORMAT_UINT8X4, + KOPE_WEBGPU_VERTEX_FORMAT_SINT8X2, + KOPE_WEBGPU_VERTEX_FORMAT_SINT8X4, + KOPE_WEBGPU_VERTEX_FORMAT_UNORM8X2, + KOPE_WEBGPU_VERTEX_FORMAT_UNORM8X4, + KOPE_WEBGPU_VERTEX_FORMAT_SNORM8X2, + KOPE_WEBGPU_VERTEX_FORMAT_SNORM8X4, + KOPE_WEBGPU_VERTEX_FORMAT_UINT16X2, + KOPE_WEBGPU_VERTEX_FORMAT_UINT16X4, + KOPE_WEBGPU_VERTEX_FORMAT_SINT16X2, + KOPE_WEBGPU_VERTEX_FORMAT_SINT16X4, + KOPE_WEBGPU_VERTEX_FORMAT_UNORM16X2, + KOPE_WEBGPU_VERTEX_FORMAT_UNORM16X4, + KOPE_WEBGPU_VERTEX_FORMAT_SNORM16X2, + KOPE_WEBGPU_VERTEX_FORMAT_SNORM16X4, + KOPE_WEBGPU_VERTEX_FORMAT_FLOAT16X2, + KOPE_WEBGPU_VERTEX_FORMAT_FLOAT16X4, + KOPE_WEBGPU_VERTEX_FORMAT_FLOAT32, + KOPE_WEBGPU_VERTEX_FORMAT_FLOAT32X2, + KOPE_WEBGPU_VERTEX_FORMAT_FLOAT32X3, + KOPE_WEBGPU_VERTEX_FORMAT_FLOAT32X4, + KOPE_WEBGPU_VERTEX_FORMAT_UINT32, + KOPE_WEBGPU_VERTEX_FORMAT_UINT32X2, + KOPE_WEBGPU_VERTEX_FORMAT_UINT32X3, + KOPE_WEBGPU_VERTEX_FORMAT_UINT32X4, + KOPE_WEBGPU_VERTEX_FORMAT_SIN32, + KOPE_WEBGPU_VERTEX_FORMAT_SINT32X2, + KOPE_WEBGPU_VERTEX_FORMAT_SINT32X3, + KOPE_WEBGPU_VERTEX_FORMAT_SINT32X4, + KOPE_WEBGPU_VERTEX_FORMAT_UNORM10_10_10_2 +} kope_webgpu_vertex_format; + +typedef struct kope_webgpu_vertex_attribute { + kope_webgpu_vertex_format format; + uint64_t offset; + uint32_t shader_location; +} kope_webgpu_vertex_attribute; + +#define KOPE_WEBGPU_MAX_VERTEX_ATTRIBUTES 32 + +typedef struct kope_webgpu_vertex_buffer_layout { + uint64_t array_stride; + kope_webgpu_vertex_step_mode step_mode; + kope_webgpu_vertex_attribute attributes[KOPE_WEBGPU_MAX_VERTEX_ATTRIBUTES]; + size_t attributes_count; +} kope_webgpu_vertex_buffer_layout; + +typedef struct kope_webgpu_shader { + uint8_t *data; + size_t size; +} kope_webgpu_shader; + +#define KOPE_WEBGPU_MAX_VERTEX_BUFFERS 16 + +typedef struct kope_webgpu_vertex_state { + kope_webgpu_shader shader; + kope_webgpu_vertex_buffer_layout buffers[KOPE_WEBGPU_MAX_VERTEX_BUFFERS]; + size_t buffers_count; +} kope_webgpu_vertex_state; + +typedef enum kope_webgpu_primitive_topology { + KOPE_WEBGPU_PRIMITIVE_TOPOLOGY_POINT_LIST, + KOPE_WEBGPU_PRIMITIVE_TOPOLOGY_LINE_LIST, + KOPE_WEBGPU_PRIMITIVE_TOPOLOGY_LINE_STRIP, + KOPE_WEBGPU_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, + KOPE_WEBGPU_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP +} kope_webgpu_primitive_topology; + +typedef enum kope_webgpu_front_face { KOPE_WEBGPU_FRONT_FACE_CCW, KOPE_WEBGPU_FRONT_FACE_CW } kope_webgpu_front_face; + +typedef enum kope_webgpu_cull_mode { KOPE_WEBGPU_CULL_MODE_NONE, KOPE_WEBGPU_CULL_MODE_FRONT, KOPE_WEBGPU_CULL_MODE_BACK } kope_webgpu_cull_mode; + +typedef struct kope_webgpu_primitive_state { + kope_webgpu_primitive_topology topology; + kope_g5_index_format strip_index_format; + kope_webgpu_front_face front_face; + kope_webgpu_cull_mode cull_mode; + bool unclipped_depth; +} kope_webgpu_primitive_state; + +typedef enum kope_webgpu_stencil_operation { + KOPE_WEBGPU_STENCIL_OPERATION_KEEP, + KOPE_WEBGPU_STENCIL_OPERATION_ZERO, + KOPE_WEBGPU_STENCIL_OPERATION_REPLACE, + KOPE_WEBGPU_STENCIL_OPERATION_INVERT, + KOPE_WEBGPU_STENCIL_OPERATION_INCREMENT_CLAMP, + KOPE_WEBGPU_STENCIL_OPERATION_DECREMENT_CLAMP, + KOPE_WEBGPU_STENCIL_OPERATION_INCREMENT_WRAP, + KOPE_WEBGPU_STENCIL_OPERATION_DECREMENT_WRAP +} kope_webgpu_stencil_operation; + +typedef struct kope_webgpu_stencil_face_state { + kope_g5_compare_function compare; + kope_webgpu_stencil_operation fail_op; + kope_webgpu_stencil_operation depth_fail_op; + kope_webgpu_stencil_operation pass_op; +} kope_webgpu_stencil_face_state; + +typedef struct kope_webgpu_depth_stencil_state { + kope_g5_texture_format format; + bool depth_write_enabled; + kope_g5_compare_function depth_compare; + kope_webgpu_stencil_face_state stencil_front; + kope_webgpu_stencil_face_state stencil_back; + uint32_t stencil_read_mask; + uint32_t stencil_write_mask; + int32_t depth_bias; + float depth_bias_slope_scale; + float depth_bias_clamp; +} kope_webgpu_depth_stencil_state; + +typedef struct kope_webgpu_multisample_state { + uint32_t count; + uint32_t mask; + bool alpha_to_coverage_enabled; +} kope_webgpu_multisample_state; + +typedef enum kope_webgpu_blend_operation { + KOPE_WEBGPU_BLEND_OPERATION_ADD, + KOPE_WEBGPU_BLEND_OPERATION_SUBTRACT, + KOPE_WEBGPU_BLEND_OPERATION_REVERSE_SUBTRACT, + KOPE_WEBGPU_BLEND_OPERATION_MIN, + KOPE_WEBGPU_BLEND_OPERATION_MAX +} kope_webgpu_blend_operation; + +typedef enum kope_webgpu_blend_factor { + KOPE_WEBGPU_BLEND_FACTOR_ZERO, + KOPE_WEBGPU_BLEND_FACTOR_ONE, + KOPE_WEBGPU_BLEND_FACTOR_SRC, + KOPE_WEBGPU_BLEND_FACTOR_ONE_MINUS_SRC, + KOPE_WEBGPU_BLEND_FACTOR_SRC_ALPHA, + KOPE_WEBGPU_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, + KOPE_WEBGPU_BLEND_FACTOR_DST, + KOPE_WEBGPU_BLEND_FACTOR_ONE_MINUS_DST, + KOPE_WEBGPU_BLEND_FACTOR_DST_ALPHA, + KOPE_WEBGPU_BLEND_FACTOR_ONE_MINUS_DST_ALPHA, + KOPE_WEBGPU_BLEND_FACTOR_SRC_ALPHA_SATURATED, + KOPE_WEBGPU_BLEND_FACTOR_CONSTANT, + KOPE_WEBGPU_BLEND_FACTOR_ONE_MINUS_CONSTANT +} kope_webgpu_blend_factor; + +typedef struct kope_webgpu_blend_component { + kope_webgpu_blend_operation operation; + kope_webgpu_blend_factor src_factor; + kope_webgpu_blend_factor dst_factor; +} kope_webgpu_blend_component; + +typedef struct kope_webgpu_blend_state { + kope_webgpu_blend_component color; + kope_webgpu_blend_component alpha; +} kope_webgpu_blend_state; + +typedef enum kope_webgpu_color_write_flags { + KOPE_WEBGPU_COLOR_WRITE_FLAGS_RED = 0x1, + KOPE_WEBGPU_COLOR_WRITE_FLAGS_GREEN = 0x2, + KOPE_WEBGPU_COLOR_WRITE_FLAGS_BLUE = 0x4, + KOPE_WEBGPU_COLOR_WRITE_FLAGS_ALPHA = 0x8, + KOPE_WEBGPU_COLOR_WRITE_FLAGS_ALL = 0xF +} kope_webgpu_color_write_flags; + +typedef struct kope_webgpu_color_target_state { + kope_g5_texture_format format; + kope_webgpu_blend_state blend; + uint32_t write_mask; +} kope_webgpu_color_target_state; + +#define KOPE_WEBGPU_MAX_COLOR_TARGETS 8 + +typedef struct kope_webgpu_fragment_state { + kope_webgpu_shader shader; + kope_webgpu_color_target_state targets[KOPE_WEBGPU_MAX_COLOR_TARGETS]; + size_t targets_count; +} kope_webgpu_fragment_state; + +typedef struct kope_webgpu_render_pipeline_parameters { + kope_webgpu_vertex_state vertex; + kope_webgpu_primitive_state primitive; + kope_webgpu_depth_stencil_state depth_stencil; + kope_webgpu_multisample_state multisample; + kope_webgpu_fragment_state fragment; +} kope_webgpu_render_pipeline_parameters; + +typedef struct kope_webgpu_render_pipeline { + int nothing; +} kope_webgpu_render_pipeline; + +typedef struct kope_webgpu_compute_pipeline_parameters { + kope_webgpu_shader shader; +} kope_webgpu_compute_pipeline_parameters; + +typedef struct kope_webgpu_compute_pipeline { + int nothing; +} kope_webgpu_compute_pipeline; + +typedef struct kope_webgpu_ray_pipeline_parameters { + kope_webgpu_shader gen_shader; + kope_webgpu_shader miss_shader; + kope_webgpu_shader closest_shader; + kope_webgpu_shader intersection_shader; + kope_webgpu_shader any_shader; +} kope_webgpu_ray_pipeline_parameters; + +typedef struct kope_webgpu_ray_pipeline { + int nothing; +} kope_webgpu_ray_pipeline; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler.c new file mode 100644 index 000000000..e796b266e --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler.c @@ -0,0 +1,9 @@ +#include "sampler_functions.h" + +#include "webgpuunit.h" + +#include + +void kope_webgpu_sampler_set_name(kope_g5_sampler *sampler, const char *name) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler_functions.h new file mode 100644 index 000000000..ce1012b34 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler_functions.h @@ -0,0 +1,16 @@ +#ifndef KOPE_WEBGPU_SAMPLER_FUNCTIONS_HEADER +#define KOPE_WEBGPU_SAMPLER_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_sampler_set_name(kope_g5_sampler *sampler, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler_structs.h new file mode 100644 index 000000000..e655eea04 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/sampler_structs.h @@ -0,0 +1,16 @@ +#ifndef KOPE_WEBGPU_SAMPLER_STRUCTS_HEADER +#define KOPE_WEBGPU_SAMPLER_STRUCTS_HEADER + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_webgpu_sampler { + int nothing; +} kope_webgpu_sampler; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture.c new file mode 100644 index 000000000..ddc66c1de --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture.c @@ -0,0 +1,9 @@ +#include "texture_functions.h" + +#include "webgpuunit.h" + +#include + +void kope_webgpu_texture_set_name(kope_g5_texture *texture, const char *name) { + +} diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture_functions.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture_functions.h new file mode 100644 index 000000000..e27bdb89e --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture_functions.h @@ -0,0 +1,16 @@ +#ifndef KOPE_WEBGPU_TEXTURE_FUNCTIONS_HEADER +#define KOPE_WEBGPU_TEXTURE_FUNCTIONS_HEADER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void kope_webgpu_texture_set_name(kope_g5_texture *texture, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture_structs.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture_structs.h new file mode 100644 index 000000000..401def2f2 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/texture_structs.h @@ -0,0 +1,16 @@ +#ifndef KOPE_WEBGPU_TEXTURE_STRUCTS_HEADER +#define KOPE_WEBGPU_TEXTURE_STRUCTS_HEADER + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kope_webgpu_texture { + int nothing; +} kope_webgpu_texture; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/vulkanunit.c b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/vulkanunit.c new file mode 100644 index 000000000..ea4616ec2 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/vulkanunit.c @@ -0,0 +1,15 @@ +#include "webgpuunit.h" + +#include + +#include + + + +#include "buffer.c" +#include "commandlist.c" +#include "descriptorset.c" +#include "device.c" +#include "pipeline.c" +#include "sampler.c" +#include "texture.c" diff --git a/Backends/Graphics5/WebGPU/Sources/kope/vulkan/vulkanunit.h b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/vulkanunit.h new file mode 100644 index 000000000..2178cebd7 --- /dev/null +++ b/Backends/Graphics5/WebGPU/Sources/kope/vulkan/vulkanunit.h @@ -0,0 +1,6 @@ +#ifndef KOPE_WEBGPU_UNIT_HEADER +#define KOPE_WEBGPU_UNIT_HEADER + + + +#endif