Gpu cleanup

This commit is contained in:
luboslenco
2025-07-21 15:06:21 +02:00
parent be44ab4fae
commit 0bde9a03a9
6 changed files with 11 additions and 14 deletions
+2 -2
View File
@@ -999,14 +999,14 @@ void gpu_vertex_buffer_init(gpu_buffer_t *buffer, int count, gpu_vertex_structur
buffer->impl.vertex_buffer_view.StrideInBytes = buffer->stride;
}
float *gpu_vertex_buffer_lock(gpu_buffer_t *buffer) {
void *gpu_vertex_buffer_lock(gpu_buffer_t *buffer) {
D3D12_RANGE range = {
.Begin = 0,
.End = buffer->count * buffer->stride,
};
void *p;
buffer->impl.buffer->lpVtbl->Map(buffer->impl.buffer, 0, &range, &p);
return (float *)p;
return p;
}
void gpu_vertex_buffer_unlock(gpu_buffer_t *buffer) {
+2 -3
View File
@@ -587,10 +587,9 @@ void gpu_vertex_buffer_init(gpu_buffer_t *buffer, int count, gpu_vertex_structur
buffer->impl.metal_buffer = (__bridge_retained void *)buf;
}
float *gpu_vertex_buffer_lock(gpu_buffer_t *buf) {
void *gpu_vertex_buffer_lock(gpu_buffer_t *buf) {
id<MTLBuffer> buffer = (__bridge id<MTLBuffer>)buf->impl.metal_buffer;
float *floats = (float *)[buffer contents];
return floats;
return [buffer contents];
}
void gpu_vertex_buffer_unlock(gpu_buffer_t *buf) {
+4 -3
View File
@@ -1818,9 +1818,10 @@ void gpu_vertex_buffer_init(gpu_buffer_t *buffer, int count, gpu_vertex_structur
vkBindBufferMemory(device, buffer->impl.buf, buffer->impl.mem, 0);
}
float *gpu_vertex_buffer_lock(gpu_buffer_t *buffer) {
vkMapMemory(device, buffer->impl.mem, 0, buffer->count * buffer->stride, 0, (void **)&buffer->impl.data);
return buffer->impl.data;
void *gpu_vertex_buffer_lock(gpu_buffer_t *buffer) {
void *p;
vkMapMemory(device, buffer->impl.mem, 0, buffer->count * buffer->stride, 0, (void **)&p);
return p;
}
void gpu_vertex_buffer_unlock(gpu_buffer_t *buffer) {
-1
View File
@@ -30,7 +30,6 @@ typedef struct {
VkBuffer buf;
VkDeviceMemory mem;
VkMemoryAllocateInfo mem_alloc;
float *data;
} gpu_buffer_impl_t;
typedef struct {