Skip to content

Commit c0b18b0

Browse files
committed
[Kompjuta] Implement buffers
1 parent 6c0410e commit c0b18b0

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

backends/gpu/kompjuta/includes/kore3/kompjuta/buffer_structs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ typedef enum kore_kompjuta_buffer_usage {
1818
} kore_kompjuta_buffer_usage;
1919

2020
typedef struct kore_kompjuta_buffer {
21-
int nothing;
21+
void *data;
2222
} kore_kompjuta_buffer;
2323

2424
#ifdef __cplusplus

backends/gpu/kompjuta/sources/buffer.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ void kore_kompjuta_buffer_set_name(kore_gpu_buffer *buffer, const char *name) {}
99
void kore_kompjuta_buffer_destroy(kore_gpu_buffer *buffer) {}
1010

1111
void *kore_kompjuta_buffer_try_to_lock_all(kore_gpu_buffer *buffer) {
12-
return NULL;
12+
return buffer->kompjuta.data;
1313
}
1414

1515
void *kore_kompjuta_buffer_lock_all(kore_gpu_buffer *buffer) {
16-
return NULL;
16+
return buffer->kompjuta.data;
1717
}
1818

1919
void *kore_kompjuta_buffer_try_to_lock(kore_gpu_buffer *buffer, uint64_t offset, uint64_t size) {
20-
return NULL;
20+
uint8_t *data = (uint8_t *)buffer->kompjuta.data;
21+
return &data[offset];
2122
}
2223

2324
void *kore_kompjuta_buffer_lock(kore_gpu_buffer *buffer, uint64_t offset, uint64_t size) {
24-
return NULL;
25+
uint8_t *data = (uint8_t *)buffer->kompjuta.data;
26+
return &data[offset];
2527
}
2628

2729
void kore_kompjuta_buffer_unlock(kore_gpu_buffer *buffer) {}

backends/gpu/kompjuta/sources/device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ void kore_kompjuta_device_destroy(kore_gpu_device *device) {}
1717

1818
void kore_kompjuta_device_set_name(kore_gpu_device *device, const char *name) {}
1919

20-
void kore_kompjuta_device_create_buffer(kore_gpu_device *device, const kore_gpu_buffer_parameters *parameters, kore_gpu_buffer *buffer) {}
20+
void kore_kompjuta_device_create_buffer(kore_gpu_device *device, const kore_gpu_buffer_parameters *parameters, kore_gpu_buffer *buffer) {
21+
buffer->kompjuta.data = malloc(parameters->size);
22+
}
2123

2224
void kore_kompjuta_device_create_command_list(kore_gpu_device *device, kore_gpu_command_list_type type, kore_gpu_command_list *list) {
2325
list->kompjuta.commands_count = 1024;

0 commit comments

Comments
 (0)