summaryrefslogtreecommitdiff
path: root/video.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-29 18:39:09 +1100
committerquou <quou@disroot.org>2024-12-29 18:39:51 +1100
commit4123d42aee69537f6fcede748a5d7b88277ef4af (patch)
tree2873af4aed3aba320ddb127b8dd2653f577bd57c /video.cpp
parentee50c66126d56d4b456046ed533f90abb0075363 (diff)
functions to destroy objects immediately
Diffstat (limited to 'video.cpp')
-rw-r--r--video.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/video.cpp b/video.cpp
index 9e9c810..1d71034 100644
--- a/video.cpp
+++ b/video.cpp
@@ -782,6 +782,7 @@ struct Vertex_Format_Vk {
struct Sampler_Vk : public Late_Terminated {
VkSampler sampler;
+ Sampler_Id id;
void init(Device_Vk* dev, const Sampler_State& s);
void destroy(Device_Vk* dev) override;
@@ -2006,6 +2007,11 @@ void Device::destroy_texture(Texture_Id id) {
dev->queue_destroy((Texture_Vk*)&dev->get_texture(id));
}
+void Device::destroy_texturei(Texture_Id id) {
+ Device_Vk* dev = (Device_Vk*)this;
+ ((Texture_Vk*)&dev->get_texture(id))->destroy(dev);
+}
+
void Context::wait() {
Context_Vk* ctx = (Context_Vk*)this;
Device_Vk* dev = ctx->dev;
@@ -3169,6 +3175,12 @@ void Device::destroy_buffer(Buffer_Id id) {
dev->queue_destroy(buf);
}
+void Device::destroy_bufferi(Buffer_Id id) {
+ Device_Vk* dev = (Device_Vk*)this;
+ Buffer_Vk* buf = (Buffer_Vk*)&get_buffer(id);
+ buf->destroy(dev);
+}
+
void* Device::map_buffer(
Buffer_Id id,
size_t offset,
@@ -3288,6 +3300,12 @@ void Device::destroy_sampler(Sampler_Id id) {
dev->queue_destroy(&s);
}
+void Device::destroy_sampleri(Sampler_Id id) {
+ Device_Vk* dev = (Device_Vk*)this;
+ Sampler_Vk& s = dev->samplers[id];
+ s.destroy(dev);
+}
+
void Shader_Loader::init(Device_Vk* d) {
dev = d;
}
@@ -3557,6 +3575,7 @@ void Sampler_Vk::init(Device_Vk* dev, const Sampler_State& s) {
void Sampler_Vk::destroy(Device_Vk* dev) {
vkDestroySampler(dev->dev, sampler, &dev->ac);
+ dev->samplers.remove(id);
}
void Vram_Allocator::Page::init(