diff options
-rw-r--r-- | src/vk/graphics_pipeline_3d_layout.cpp | 55 | ||||
-rw-r--r-- | src/vk/graphics_pipeline_3d_layout.hpp | 3 | ||||
-rw-r--r-- | src/vk/skeletal_model.cpp | 2 | ||||
-rw-r--r-- | src/vk/static_model.cpp | 2 |
4 files changed, 9 insertions, 53 deletions
diff --git a/src/vk/graphics_pipeline_3d_layout.cpp b/src/vk/graphics_pipeline_3d_layout.cpp index cbb73e5..644aac9 100644 --- a/src/vk/graphics_pipeline_3d_layout.cpp +++ b/src/vk/graphics_pipeline_3d_layout.cpp @@ -103,7 +103,7 @@ unload_descriptor_set_view(void *obj) } void -load_descriptor_set_skeletal_model(void *obj) +load_descriptor_set_model(void *obj) { auto self = static_cast<VK::GraphicsPipeline3DLayout*>(obj); @@ -129,61 +129,19 @@ load_descriptor_set_skeletal_model(void *obj) if(vkCreateDescriptorSetLayout( cg_core.vk_device_with_swapchain->device, &layout_info, nullptr, - &self->descriptor_set_skeletal_model) != VK_SUCCESS) + &self->descriptor_set_model) != VK_SUCCESS) throw CommandError{ "Failed to create Vulkan descriptor set layout for model instance."}; } void -unload_descriptor_set_skeletal_model(void *obj) +unload_descriptor_set_model(void *obj) { auto self = static_cast<VK::GraphicsPipeline3DLayout*>(obj); vkDestroyDescriptorSetLayout( cg_core.vk_device_with_swapchain->device, - self->descriptor_set_skeletal_model, nullptr); -} - -void -load_descriptor_set_static_model(void *obj) -{ - auto self = static_cast<VK::GraphicsPipeline3DLayout*>(obj); - - std::array<VkDescriptorSetLayoutBinding, 2> layout_bindings; - layout_bindings[0].binding = 0; - layout_bindings[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; - layout_bindings[0].descriptorCount = 1; - layout_bindings[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; - layout_bindings[0].pImmutableSamplers = nullptr; - layout_bindings[1].binding = 1; - layout_bindings[1].descriptorType = - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; - layout_bindings[1].descriptorCount = 1; - layout_bindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; - layout_bindings[1].pImmutableSamplers = nullptr; - - VkDescriptorSetLayoutCreateInfo layout_info{}; - layout_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; - layout_info.pNext = nullptr; - layout_info.flags = 0; - layout_info.bindingCount = static_cast<uint32_t>(layout_bindings.size()); - layout_info.pBindings = layout_bindings.data(); - - if(vkCreateDescriptorSetLayout( - cg_core.vk_device_with_swapchain->device, &layout_info, nullptr, - &self->descriptor_set_static_model) != VK_SUCCESS) - throw CommandError{ - "Failed to create Vulkan descriptor set layout for model instance."}; -} - -void -unload_descriptor_set_static_model(void *obj) -{ - auto self = static_cast<VK::GraphicsPipeline3DLayout*>(obj); - - vkDestroyDescriptorSetLayout( - cg_core.vk_device_with_swapchain->device, - self->descriptor_set_static_model, nullptr); + self->descriptor_set_model, nullptr); } void @@ -194,7 +152,7 @@ load_pipeline(void *obj) std::array<VkDescriptorSetLayout, 3> set_layouts{ self->descriptor_set_world, self->descriptor_set_view, - self->descriptor_set_skeletal_model}; + self->descriptor_set_model}; VkPipelineLayoutCreateInfo pipeline_layout_info{}; pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; @@ -307,8 +265,7 @@ unload_render_pass(void *obj) const CommandChain loader{ {&load_descriptor_set_world, &unload_descriptor_set_world}, {&load_descriptor_set_view, &unload_descriptor_set_view}, - {&load_descriptor_set_skeletal_model, &unload_descriptor_set_skeletal_model}, - {&load_descriptor_set_static_model, &unload_descriptor_set_static_model}, + {&load_descriptor_set_model, &unload_descriptor_set_model}, {&load_pipeline, &unload_pipeline}, {&load_render_pass, &unload_render_pass} }; diff --git a/src/vk/graphics_pipeline_3d_layout.hpp b/src/vk/graphics_pipeline_3d_layout.hpp index cb89b95..f69e3ab 100644 --- a/src/vk/graphics_pipeline_3d_layout.hpp +++ b/src/vk/graphics_pipeline_3d_layout.hpp @@ -26,8 +26,7 @@ struct GraphicsPipeline3DLayout { VkDescriptorSetLayout descriptor_set_world; VkDescriptorSetLayout descriptor_set_view; - VkDescriptorSetLayout descriptor_set_skeletal_model; - VkDescriptorSetLayout descriptor_set_static_model; + VkDescriptorSetLayout descriptor_set_model; VkPipelineLayout pipeline; VkRenderPass render_pass; diff --git a/src/vk/skeletal_model.cpp b/src/vk/skeletal_model.cpp index e7ede6d..b201b25 100644 --- a/src/vk/skeletal_model.cpp +++ b/src/vk/skeletal_model.cpp @@ -92,7 +92,7 @@ load_descriptor_sets(void *obj) std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, - cg_core.vk_graphics_pipeline_3d_layout->descriptor_set_skeletal_model); + cg_core.vk_graphics_pipeline_3d_layout->descriptor_set_model); VkDescriptorSetAllocateInfo alloc_info{}; alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; diff --git a/src/vk/static_model.cpp b/src/vk/static_model.cpp index b1c44fc..91f44ab 100644 --- a/src/vk/static_model.cpp +++ b/src/vk/static_model.cpp @@ -92,7 +92,7 @@ load_descriptor_sets(void *obj) std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, - cg_core.vk_graphics_pipeline_3d_layout->descriptor_set_static_model); + cg_core.vk_graphics_pipeline_3d_layout->descriptor_set_model); VkDescriptorSetAllocateInfo alloc_info{}; alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; |