Skip to content

Commit

Permalink
Merged pull request "Fixes for turnip": #406
Browse files Browse the repository at this point in the history
  • Loading branch information
apanteleev committed Jul 5, 2024
2 parents d9c994b + 0a0d698 commit e9d5af4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
9 changes: 7 additions & 2 deletions src/refresh/vkpt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,16 +1069,21 @@ init_vulkan(void)

if (picked_driver_ray_query == VK_DRIVER_ID_NVIDIA_PROPRIETARY)
{
// Pick KHR_ray_query on NVIDIA drivers, if available.
// Prefer KHR_ray_query on NVIDIA drivers, if available.
qvk.use_ray_query = true;
picked_device = picked_device_with_ray_query;
}
else if (picked_device_with_ray_pipeline >= 0)
{
// Pick KHR_ray_tracing_pipeline otherwise
// Prefer KHR_ray_tracing_pipeline otherwise
qvk.use_ray_query = false;
picked_device = picked_device_with_ray_pipeline;
}
else if (picked_device_with_ray_query >= 0)
{
qvk.use_ray_query = true;
picked_device = picked_device_with_ray_query;
}
}

if (picked_device < 0)
Expand Down
18 changes: 10 additions & 8 deletions src/refresh/vkpt/uniform_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,25 @@ static size_t ubo_alignment = 0;
VkResult
vkpt_uniform_buffer_create()
{
VkDescriptorPoolSize pool_sizes[2] = { };
VkDescriptorSetLayoutBinding ubo_layout_bindings[2] = { 0 };

ubo_layout_bindings[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
ubo_layout_bindings[0].descriptorCount = 1;
ubo_layout_bindings[0].binding = GLOBAL_UBO_BINDING_IDX;
ubo_layout_bindings[0].stageFlags = VK_SHADER_STAGE_ALL;

pool_sizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
pool_sizes[0].descriptorCount = 1;

ubo_layout_bindings[1].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
ubo_layout_bindings[1].descriptorCount = 1;
ubo_layout_bindings[1].binding = GLOBAL_INSTANCE_BUFFER_BINDING_IDX;
ubo_layout_bindings[1].stageFlags = VK_SHADER_STAGE_ALL;

pool_sizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
pool_sizes[1].descriptorCount = 1;

VkDescriptorSetLayoutCreateInfo layout_info = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.bindingCount = LENGTH(ubo_layout_bindings),
Expand All @@ -63,16 +70,11 @@ vkpt_uniform_buffer_create()
buffer_create(&device_uniform_buffer, buffer_size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
device_memory_flags);

VkDescriptorPoolSize pool_size = {
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.descriptorCount = MAX_FRAMES_IN_FLIGHT,
};

VkDescriptorPoolCreateInfo pool_info = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.poolSizeCount = 1,
.pPoolSizes = &pool_size,
.maxSets = MAX_FRAMES_IN_FLIGHT,
.poolSizeCount = LENGTH(pool_sizes),
.pPoolSizes = pool_sizes,
.maxSets = 1,
};

_VK(vkCreateDescriptorPool(qvk.device, &pool_info, NULL, &desc_pool_ubo));
Expand Down

0 comments on commit e9d5af4

Please sign in to comment.