Fix: Crash when using Vulkan backend.
Command buffer was not availble at the time dummy buffers are initialized. Resulting in undefined behavior.
This commit is contained in:
@@ -135,7 +135,6 @@ Context *VKBackend::context_alloc(void *ghost_window, void *ghost_context)
|
||||
|
||||
VKContext *context = new VKContext(ghost_window, ghost_context);
|
||||
device_.context_register(*context);
|
||||
device_.init_dummy_buffer(*context);
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ void VKContext::sync_backbuffer()
|
||||
command_buffer_.init(device.device_get(), device.queue_get(), command_buffer);
|
||||
command_buffer_.begin_recording();
|
||||
device.descriptor_pools_get().reset();
|
||||
device.init_dummy_buffer(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,12 @@ class VKDevice : public NonCopyable {
|
||||
|
||||
bool is_initialized() const;
|
||||
void init(void *ghost_context);
|
||||
/**
|
||||
* Initialize a dummy buffer that can be bound for missing attributes.
|
||||
*
|
||||
* Dummy buffer can only be initialized after the command buffer of the context is retrieved.
|
||||
*/
|
||||
void init_dummy_buffer(VKContext &context);
|
||||
void deinit();
|
||||
|
||||
eGPUDeviceType device_type() const;
|
||||
@@ -159,7 +165,6 @@ class VKDevice : public NonCopyable {
|
||||
void init_debug_callbacks();
|
||||
void init_memory_allocator();
|
||||
void init_descriptor_pools();
|
||||
void init_dummy_buffer(VKContext &context);
|
||||
|
||||
/* During initialization the backend requires access to update the workarounds. */
|
||||
friend VKBackend;
|
||||
|
||||
Reference in New Issue
Block a user