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