Skip to content

Commit 6487b7c

Browse files
committed
Make the Kompjuta backend compile and almost link
1 parent d20c00b commit 6487b7c

47 files changed

Lines changed: 982 additions & 5 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef KORE_KOMPJUTA_BUFFER_FUNCTIONS_HEADER
2+
#define KORE_KOMPJUTA_BUFFER_FUNCTIONS_HEADER
3+
4+
#include <kore3/gpu/buffer.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
void kore_kompjuta_buffer_set_name(kore_gpu_buffer *buffer, const char *name);
11+
12+
void kore_kompjuta_buffer_destroy(kore_gpu_buffer *buffer);
13+
14+
void *kore_kompjuta_buffer_try_to_lock_all(kore_gpu_buffer *buffer);
15+
16+
void *kore_kompjuta_buffer_lock_all(kore_gpu_buffer *buffer);
17+
18+
void *kore_kompjuta_buffer_try_to_lock(kore_gpu_buffer *buffer, uint64_t offset, uint64_t size);
19+
20+
void *kore_kompjuta_buffer_lock(kore_gpu_buffer *buffer, uint64_t offset, uint64_t size);
21+
22+
void kore_kompjuta_buffer_unlock(kore_gpu_buffer *buffer);
23+
24+
#ifdef __cplusplus
25+
}
26+
#endif
27+
28+
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef KORE_KOMPJUTA_BUFFER_STRUCTS_HEADER
2+
#define KORE_KOMPJUTA_BUFFER_STRUCTS_HEADER
3+
4+
#include <stdbool.h>
5+
#include <stdint.h>
6+
7+
#ifdef __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
struct kore_gpu_device;
12+
13+
// add-ons to kore_gpu_buffer_usage, top 16 bits only
14+
typedef enum kore_kompjuta_buffer_usage {
15+
KORE_KOMPJUTA_BUFFER_USAGE_VERTEX = 0x00010000,
16+
KORE_KOMPJUTA_BUFFER_USAGE_UNIFORM = 0x00020000,
17+
KORE_KOMPJUTA_BUFFER_USAGE_STORAGE = 0x00040000,
18+
} kore_kompjuta_buffer_usage;
19+
20+
typedef struct kore_kompjuta_buffer {
21+
int nothing;
22+
} kore_kompjuta_buffer;
23+
24+
#ifdef __cplusplus
25+
}
26+
#endif
27+
28+
#endif
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#ifndef KORE_KOMPJUTA_COMMANDLIST_FUNCTIONS_HEADER
2+
#define KORE_KOMPJUTA_COMMANDLIST_FUNCTIONS_HEADER
3+
4+
#include <kore3/gpu/commandlist.h>
5+
6+
#include "descriptorset_structs.h"
7+
#include "pipeline_structs.h"
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
void kore_kompjuta_command_list_destroy(kore_gpu_command_list *list);
14+
15+
void kore_kompjuta_command_list_copy_buffer_to_buffer(kore_gpu_command_list *list, kore_gpu_buffer *source, uint64_t source_offset, kore_gpu_buffer *destination,
16+
uint64_t destination_offset, uint64_t size);
17+
18+
void kore_kompjuta_command_list_copy_buffer_to_texture(kore_gpu_command_list *list, const kore_gpu_image_copy_buffer *source,
19+
const kore_gpu_image_copy_texture *destination, uint32_t width, uint32_t height,
20+
uint32_t depth_or_array_layers);
21+
22+
void kore_kompjuta_command_list_copy_texture_to_buffer(kore_gpu_command_list *list, const kore_gpu_image_copy_texture *source,
23+
const kore_gpu_image_copy_buffer *destination, uint32_t width, uint32_t height,
24+
uint32_t depth_or_array_layers);
25+
26+
void kore_kompjuta_command_list_copy_texture_to_texture(kore_gpu_command_list *list, const kore_gpu_image_copy_texture *source,
27+
const kore_gpu_image_copy_texture *destination, uint32_t width, uint32_t height,
28+
uint32_t depth_or_array_layers);
29+
30+
void kore_kompjuta_command_list_clear_buffer(kore_gpu_command_list *list, kore_gpu_buffer *buffer, size_t offset, uint64_t size);
31+
32+
void kore_kompjuta_command_list_begin_render_pass(kore_gpu_command_list *list, const kore_gpu_render_pass_parameters *parameters);
33+
34+
void kore_kompjuta_command_list_end_render_pass(kore_gpu_command_list *list);
35+
36+
void kore_kompjuta_command_list_present(kore_gpu_command_list *list);
37+
38+
void kore_kompjuta_command_list_set_viewport(kore_gpu_command_list *list, float x, float y, float width, float height, float min_depth, float max_depth);
39+
40+
void kore_kompjuta_command_list_set_scissor_rect(kore_gpu_command_list *list, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
41+
42+
void kore_kompjuta_command_list_set_blend_constant(kore_gpu_command_list *list, kore_gpu_color color);
43+
44+
void kore_kompjuta_command_list_set_stencil_reference(kore_gpu_command_list *list, uint32_t reference);
45+
46+
void kore_kompjuta_command_list_set_index_buffer(kore_gpu_command_list *list, kore_gpu_buffer *buffer, kore_gpu_index_format index_format, uint64_t offset);
47+
48+
void kore_kompjuta_command_list_set_vertex_buffer(kore_gpu_command_list *list, uint32_t slot, kore_kompjuta_buffer *buffer, uint64_t offset, uint64_t size,
49+
uint64_t stride);
50+
51+
void kore_kompjuta_command_list_set_render_pipeline(kore_gpu_command_list *list, kore_kompjuta_render_pipeline *pipeline);
52+
53+
void kore_kompjuta_command_list_draw(kore_gpu_command_list *list, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance);
54+
55+
void kore_kompjuta_command_list_draw_indexed(kore_gpu_command_list *list, uint32_t index_count, uint32_t instance_count, uint32_t first_index,
56+
int32_t base_vertex, uint32_t first_instance);
57+
58+
void kore_kompjuta_command_list_set_bind_group(kore_gpu_command_list *list, uint32_t index, kore_kompjuta_descriptor_set *set, uint32_t dynamic_count,
59+
uint32_t *dynamic_offsets);
60+
61+
void kore_kompjuta_command_list_set_root_constants(kore_gpu_command_list *list, uint32_t table_index, const void *data, size_t data_size);
62+
63+
void kore_kompjuta_command_list_set_compute_pipeline(kore_gpu_command_list *list, kore_kompjuta_compute_pipeline *pipeline);
64+
65+
void kore_kompjuta_command_list_compute(kore_gpu_command_list *list, uint32_t workgroup_count_x, uint32_t workgroup_count_y, uint32_t workgroup_count_z);
66+
67+
void kore_kompjuta_command_list_prepare_raytracing_volume(kore_gpu_command_list *list, kore_gpu_raytracing_volume *volume);
68+
69+
void kore_kompjuta_command_list_prepare_raytracing_hierarchy(kore_gpu_command_list *list, kore_gpu_raytracing_hierarchy *hierarchy);
70+
71+
void kore_kompjuta_command_list_update_raytracing_hierarchy(kore_gpu_command_list *list, kore_matrix4x4 *volume_transforms, uint32_t volumes_count,
72+
kore_gpu_raytracing_hierarchy *hierarchy);
73+
74+
void kore_kompjuta_command_list_set_ray_pipeline(kore_gpu_command_list *list, kore_kompjuta_ray_pipeline *pipeline);
75+
76+
void kore_kompjuta_command_list_trace_rays(kore_gpu_command_list *list, uint32_t width, uint32_t height, uint32_t depth);
77+
78+
void kore_kompjuta_command_list_set_name(kore_gpu_command_list *list, const char *name);
79+
80+
void kore_kompjuta_command_list_push_debug_group(kore_gpu_command_list *list, const char *name);
81+
82+
void kore_kompjuta_command_list_pop_debug_group(kore_gpu_command_list *list);
83+
84+
void kore_kompjuta_command_list_insert_debug_marker(kore_gpu_command_list *list, const char *name);
85+
86+
void kore_kompjuta_command_list_begin_occlusion_query(kore_gpu_command_list *list, uint32_t query_index);
87+
88+
void kore_kompjuta_command_list_end_occlusion_query(kore_gpu_command_list *list);
89+
90+
void kore_kompjuta_command_list_resolve_query_set(kore_gpu_command_list *list, kore_gpu_query_set *query_set, uint32_t first_query, uint32_t query_count,
91+
kore_gpu_buffer *destination, uint64_t destination_offset);
92+
93+
void kore_kompjuta_command_list_draw_indirect(kore_gpu_command_list *list, kore_gpu_buffer *indirect_buffer, uint64_t indirect_offset, uint32_t max_draw_count,
94+
kore_gpu_buffer *count_buffer, uint64_t count_offset);
95+
96+
void kore_kompjuta_command_list_draw_indexed_indirect(kore_gpu_command_list *list, kore_gpu_buffer *indirect_buffer, uint64_t indirect_offset,
97+
uint32_t max_draw_count, kore_gpu_buffer *count_buffer, uint64_t count_offset);
98+
99+
void kore_kompjuta_command_list_compute_indirect(kore_gpu_command_list *list, kore_gpu_buffer *indirect_buffer, uint64_t indirect_offset);
100+
101+
void kore_kompjuta_command_list_queue_buffer_access(kore_gpu_command_list *list, kore_gpu_buffer *buffer, uint32_t offset, uint32_t size);
102+
103+
void kore_kompjuta_command_list_queue_descriptor_set_access(kore_gpu_command_list *list, kore_kompjuta_descriptor_set *descriptor_set);
104+
105+
#ifdef __cplusplus
106+
}
107+
#endif
108+
109+
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef KORE_KOMPJUTA_COMMANDLIST_STRUCTS_HEADER
2+
#define KORE_KOMPJUTA_COMMANDLIST_STRUCTS_HEADER
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
typedef struct kore_kompjuta_compute_bind_group {
9+
int nothing;
10+
} kore_kompjuta_compute_bind_group;
11+
12+
typedef struct kore_kompjuta_command_list {
13+
int nothing;
14+
} kore_kompjuta_command_list;
15+
16+
#ifdef __cplusplus
17+
}
18+
#endif
19+
20+
#endif
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef KORE_KOMPJUTA_DESCRIPTORSET_FUNCTIONS_HEADER
2+
#define KORE_KOMPJUTA_DESCRIPTORSET_FUNCTIONS_HEADER
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#ifdef __cplusplus
9+
}
10+
#endif
11+
12+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef KORE_KOMPJUTA_DESCRIPTORSET_STRUCTS_HEADER
2+
#define KORE_KOMPJUTA_DESCRIPTORSET_STRUCTS_HEADER
3+
4+
#include "device_structs.h"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
typedef struct kore_kompjuta_descriptor_set {
11+
int nothing;
12+
} kore_kompjuta_descriptor_set;
13+
14+
#ifdef __cplusplus
15+
}
16+
#endif
17+
18+
#endif
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#ifndef KORE_KOMPJUTA_DEVICE_FUNCTIONS_HEADER
2+
#define KORE_KOMPJUTA_DEVICE_FUNCTIONS_HEADER
3+
4+
#include <kore3/gpu/device.h>
5+
6+
#include <kore3/math/matrix.h>
7+
8+
#include "descriptorset_structs.h"
9+
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
14+
void kore_kompjuta_device_create(kore_gpu_device *device, const kore_gpu_device_wishlist *wishlist);
15+
16+
void kore_kompjuta_device_destroy(kore_gpu_device *device);
17+
18+
void kore_kompjuta_device_set_name(kore_gpu_device *device, const char *name);
19+
20+
void kore_kompjuta_device_create_buffer(kore_gpu_device *device, const kore_gpu_buffer_parameters *parameters, kore_gpu_buffer *buffer);
21+
22+
void kore_kompjuta_device_create_command_list(kore_gpu_device *device, kore_gpu_command_list_type type, kore_gpu_command_list *list);
23+
24+
void kore_kompjuta_device_create_texture(kore_gpu_device *device, const kore_gpu_texture_parameters *parameters, kore_gpu_texture *texture);
25+
26+
void kore_kompjuta_device_create_sampler(kore_gpu_device *device, const kore_gpu_sampler_parameters *parameters, kore_gpu_sampler *sampler);
27+
28+
kore_gpu_texture *kore_kompjuta_device_get_framebuffer(kore_gpu_device *device);
29+
30+
kore_gpu_texture_format kore_kompjuta_device_framebuffer_format(kore_gpu_device *device);
31+
32+
void kore_kompjuta_device_execute_command_list(kore_gpu_device *device, kore_gpu_command_list *list);
33+
34+
void kore_kompjuta_device_wait_until_idle(kore_gpu_device *device);
35+
36+
void kore_kompjuta_device_create_raytracing_volume(kore_gpu_device *device, kore_gpu_buffer *vertex_buffer, uint64_t vertex_count, kore_gpu_buffer *index_buffer,
37+
uint32_t index_count, kore_gpu_raytracing_volume *volume);
38+
39+
void kore_kompjuta_device_create_raytracing_hierarchy(kore_gpu_device *device, kore_gpu_raytracing_volume **volumes, kore_matrix4x4 *volume_transforms,
40+
uint32_t volumes_count, kore_gpu_raytracing_hierarchy *hierarchy);
41+
42+
void kore_kompjuta_device_create_query_set(kore_gpu_device *device, const kore_gpu_query_set_parameters *parameters, kore_gpu_query_set *query_set);
43+
44+
void kore_kompjuta_device_create_fence(kore_gpu_device *device, kore_gpu_fence *fence);
45+
46+
uint32_t kore_kompjuta_device_align_texture_row_bytes(kore_gpu_device *device, uint32_t row_bytes);
47+
48+
void kore_kompjuta_device_signal(kore_gpu_device *device, kore_gpu_command_list_type list_type, kore_gpu_fence *fence, uint64_t value);
49+
50+
void kore_kompjuta_device_wait(kore_gpu_device *device, kore_gpu_command_list_type list_type, kore_gpu_fence *fence, uint64_t value);
51+
52+
#ifdef __cplusplus
53+
}
54+
#endif
55+
56+
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef KORE_KOMPJUTA_DEVICE_STRUCTS_HEADER
2+
#define KORE_KOMPJUTA_DEVICE_STRUCTS_HEADER
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
typedef struct kore_kompjuta_device {
9+
int nothing;
10+
} kore_kompjuta_device;
11+
12+
typedef struct kore_kompjuta_query_set {
13+
int nothing;
14+
} kore_kompjuta_query_set;
15+
16+
#ifdef __cplusplus
17+
}
18+
#endif
19+
20+
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef KORE_KOMPJUTA_FENCE_FUNCTIONS_HEADER
2+
#define KORE_KOMPJUTA_FENCE_FUNCTIONS_HEADER
3+
4+
#include <kore3/gpu/fence.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
void kore_kompjuta_fence_destroy(kore_gpu_fence *fence);
11+
12+
#ifdef __cplusplus
13+
}
14+
#endif
15+
16+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef KORE_KOMPJUTA_FENCE_STRUCTS_HEADER
2+
#define KORE_KOMPJUTA_FENCE_STRUCTS_HEADER
3+
4+
#include <kore3/gpu/buffer.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
typedef struct kore_kompjuta_fence {
11+
int nothing;
12+
} kore_kompjuta_fence;
13+
14+
#ifdef __cplusplus
15+
}
16+
#endif
17+
18+
#endif

0 commit comments

Comments
 (0)