From 080cdf1e0b7ebf32c20673035cffeaa66d67dbe0 Mon Sep 17 00:00:00 2001 From: quou Date: Wed, 25 Dec 2024 22:00:00 +1100 Subject: Fix some of the object ID getters and stuff --- video.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'video.cpp') diff --git a/video.cpp b/video.cpp index d6180bd..1ce0cba 100644 --- a/video.cpp +++ b/video.cpp @@ -1624,9 +1624,10 @@ void Device_Vk::destroy_vf(Vertex_Format_Id id) { } Shader_Id Device_Vk::alloc_shader() { - Shader_Vk buf{}; + Shader_Vk s{}; Shader_Id id(shader_count++); - shaders.set(id, buf); + s.id = id; + shaders.set(id, s); return id; } @@ -2704,11 +2705,17 @@ void Device::unmap_buffer(Buffer_Id id) { } Buffer& Device::get_buffer(Buffer_Id id) { - return ((Device_Vk*)this)->buffers[id]; + Device_Vk* dev = (Device_Vk*)this; + assert(id.index); + assert(dev->buffers.has(id)); + return dev->buffers[id]; } Shader& Device::get_shader(Shader_Id id) { - return ((Device_Vk*)this)->shaders[id]; + Device_Vk* dev = (Device_Vk*)this; + assert(id.index); + assert(dev->shaders.has(id)); + return dev->shaders[id]; } Sampler_Id Device::create_sampler(const Sampler_State& state) { @@ -2740,7 +2747,6 @@ Asset* Shader_Loader::load( (void)a; id = dev->alloc_shader(); shader = (Shader_Vk*)&dev->get_shader(id); - shader->id = id; if (!shader->init(dev, f)) { dev->shaders.remove(id); return 0; -- cgit v1.2.3-54-g00ecf