Add various assertions throughout renderer
This commit is contained in:
@@ -22,4 +22,4 @@ namespace Nova {
|
||||
u32 deviceID;
|
||||
void* handle;
|
||||
};
|
||||
} // namespace Nova
|
||||
} // namespace Nova
|
||||
|
||||
@@ -53,16 +53,14 @@ u32 VulkanRenderDriver::get_device_count() const {
|
||||
}
|
||||
|
||||
const RenderDevice& VulkanRenderDriver::get_device(const u32 index) const {
|
||||
NOVA_ASSERT(index < m_devices.size());
|
||||
return m_devices[index];
|
||||
}
|
||||
|
||||
void VulkanRenderDriver::create_device(const u32 index) {
|
||||
NOVA_AUTO_TRACE();
|
||||
|
||||
if (m_device) {
|
||||
NOVA_ERROR("VkDevice already created");
|
||||
return;
|
||||
}
|
||||
NOVA_ASSERT(index < m_devices.size());
|
||||
NOVA_ASSERT(!m_device);
|
||||
|
||||
m_physical_device = static_cast<VkPhysicalDevice>(m_devices[index].handle);
|
||||
std::vector<VkDeviceQueueCreateInfo> queues;
|
||||
@@ -324,4 +322,4 @@ VkAllocationCallbacks* VulkanRenderDriver::_get_allocator(const VkObjectType typ
|
||||
// TODO: Add custom allocator
|
||||
(void)type;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Nova {
|
||||
void _init_instance();
|
||||
void _init_hardware();
|
||||
|
||||
// TODO: Other init functions for device
|
||||
void _check_device_extensions();
|
||||
void _check_device_features();
|
||||
void _init_queues(std::vector<VkDeviceQueueCreateInfo>& queues) const;
|
||||
|
||||
@@ -17,6 +17,7 @@ static std::unique_ptr<RenderDriver> s_driver;
|
||||
|
||||
void Renderer::create(const RenderAPI api) {
|
||||
NOVA_AUTO_TRACE();
|
||||
NOVA_ASSERT(!s_driver);
|
||||
switch (api) {
|
||||
case RenderAPI::VULKAN:
|
||||
s_driver = std::make_unique<VulkanRenderDriver>();
|
||||
@@ -33,5 +34,6 @@ void Renderer::shutdown() {
|
||||
}
|
||||
|
||||
RenderDriver* Renderer::get_driver() {
|
||||
NOVA_ASSERT(s_driver);
|
||||
return s_driver.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user