[WIP] Continue working on pipeline
This commit is contained in:
1 parent
f8eb98ddf4
commit
daed76f02f
28 files changed
+467
-2156
No files matched your search
+19
-27
@@ -12,20 +12,8 @@
|
||||
#include "vulkan_base.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
/* We are building with -Werror flag on, but there are some warning in VMA implementation. Thus diagnostic push */
|
||||
// #pragma GCC diagnostic push
|
||||
// #pragma GCC diagnostic ignored "-Wunused-function"
|
||||
// #pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
// #pragma GCC diagnostic ignored "-Wpedantic"
|
||||
// #pragma GCC diagnostic ignored "-Wignored-qualifiers"
|
||||
// #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
// #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
// #pragma GCC diagnostic ignored "-Wswitch"
|
||||
// #pragma GCC diagnostic ignored "-Wparentheses"
|
||||
#include "utilities/localization.h"
|
||||
#include "vk_mem_alloc.h"
|
||||
// #pragma GCC diagnostic pop
|
||||
#include <vma/vk_mem_alloc.h>
|
||||
|
||||
#include "utilities/commons.h"
|
||||
#include "utilities/errors_common.h"
|
||||
@@ -363,19 +351,21 @@ static rse_err_t pick_physical_device(VkInstance instance, VkPhysicalDevice* phy
|
||||
*/
|
||||
static rse_err_t create_device(struct graphics_context_t* context)
|
||||
{
|
||||
size_t device_queues_count = 0;
|
||||
uint32_t queue_families_property_count = 0U;
|
||||
ssize_t graphics_family_idx = -1;
|
||||
ssize_t presentation_familiy_idx = -1;
|
||||
VkQueueFamilyProperties* queue_family_properties = NULL;
|
||||
VkDeviceCreateInfo device_create_info = {0};
|
||||
VkDeviceQueueCreateInfo device_queue_createinfos[2] = {0};
|
||||
bool graphics_family_found = false;
|
||||
bool presentation_familiy_found = false;
|
||||
float* graphics_familiy_queue_priorities = NULL;
|
||||
float* presentation_familiy_queue_priorities = NULL;
|
||||
uint32_t device_queues_count = 0;
|
||||
uint32_t graphics_family_idx = 0;
|
||||
uint32_t presentation_familiy_idx = 0;
|
||||
uint32_t queue_families_property_count = 0U;
|
||||
uint32_t enabled_device_extensions_count = 2;
|
||||
VkBool32 bindless_supported = VK_FALSE;
|
||||
VkDeviceCreateInfo device_create_info = {0};
|
||||
VkQueueFamilyProperties* queue_family_properties = NULL;
|
||||
VkDeviceQueueCreateInfo device_queue_createinfos[2] = {0};
|
||||
VkPhysicalDeviceFeatures2 physical_features2 = {0};
|
||||
VkPhysicalDeviceDescriptorIndexingFeatures indexing_features = {0};
|
||||
VkBool32 bindless_supported = VK_FALSE;
|
||||
uint32_t enabled_device_extensions_count = 2;
|
||||
const char* enabled_device_extensions_names[] = {
|
||||
"VK_KHR_swapchain",
|
||||
"VK_EXT_descriptor_indexing",
|
||||
@@ -405,12 +395,13 @@ static rse_err_t create_device(struct graphics_context_t* context)
|
||||
* queues. */
|
||||
{
|
||||
size_t numberOfQueues = 0;
|
||||
for (size_t familyIdx = 0; familyIdx < queue_families_property_count; ++familyIdx) {
|
||||
for (uint32_t familyIdx = 0; familyIdx < queue_families_property_count; ++familyIdx) {
|
||||
LOGI("Checking queue: %ld", familyIdx);
|
||||
if (queue_family_properties[familyIdx].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
if (queue_family_properties[familyIdx].queueCount > numberOfQueues) {
|
||||
graphics_family_idx = familyIdx;
|
||||
LOGI("Setting graphics family idx to %d", familyIdx);
|
||||
graphics_family_found = true;
|
||||
LOGI("Setting graphics family idx to %ld", familyIdx);
|
||||
numberOfQueues = queue_family_properties[familyIdx].queueCount;
|
||||
device_queues_count++;
|
||||
}
|
||||
@@ -421,13 +412,14 @@ static rse_err_t create_device(struct graphics_context_t* context)
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(context->physical_device, familyIdx, context->surface, &presentSupport);
|
||||
if (presentSupport) {
|
||||
presentation_familiy_idx = familyIdx;
|
||||
presentation_familiy_found = true;
|
||||
/* If this is the same queue family as in graphics family, don't increase queue count */
|
||||
if (presentation_familiy_idx != graphics_family_idx) {
|
||||
device_queues_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (graphics_family_idx > 0 && presentation_familiy_idx > 0) {
|
||||
if (graphics_family_found && presentation_familiy_found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -529,10 +521,10 @@ static rse_err_t create_memory_allocator(struct graphics_context_t* context)
|
||||
*/
|
||||
static rse_err_t create_sync_objects(struct graphics_context_t* context)
|
||||
{
|
||||
VkSemaphoreCreateInfo semaphore_info = {};
|
||||
VkSemaphoreCreateInfo semaphore_info = {0};
|
||||
semaphore_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
|
||||
VkFenceCreateInfo fenceInfo = {};
|
||||
VkFenceCreateInfo fenceInfo = {0};
|
||||
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
|
||||
|
||||
|
||||
Reference in new issue
Block a user