diff options
author | quou <quou@disroot.org> | 2024-12-25 22:00:00 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-25 22:00:00 +1100 |
commit | 080cdf1e0b7ebf32c20673035cffeaa66d67dbe0 (patch) | |
tree | 1ce6e16a5dfa3d870ddc949d3949c13c8ce75571 | |
parent | b16885555b024172f010e7d1b9865f6341ba3d43 (diff) |
Fix some of the object ID getters and stuff
-rw-r--r-- | video.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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; |