summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--video.cpp16
1 files changed, 11 insertions, 5 deletions
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;