aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan/present/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan/present/util.cpp')
-rw-r--r--src/video_core/renderer_vulkan/present/util.cpp38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/present/util.cpp b/src/video_core/renderer_vulkan/present/util.cpp
index 2b83902bc0..11250687d6 100644
--- a/src/video_core/renderer_vulkan/present/util.cpp
+++ b/src/video_core/renderer_vulkan/present/util.cpp
@@ -320,15 +320,16 @@ vk::DescriptorPool CreateWrappedDescriptorPool(const Device& device, size_t max_
});
}
-vk::DescriptorSetLayout CreateWrappedDescriptorSetLayout(
- const Device& device, std::initializer_list<VkDescriptorType> types) {
+vk::DescriptorSetLayout CreateWrappedDescriptorSetLayout(const Device& device,
+ std::span<const VkDescriptorType> types,
+ VkShaderStageFlags stages) {
std::vector<VkDescriptorSetLayoutBinding> bindings(types.size());
for (size_t i = 0; i < types.size(); i++) {
bindings[i] = {
.binding = static_cast<u32>(i),
- .descriptorType = std::data(types)[i],
+ .descriptorType = types[i],
.descriptorCount = 1,
- .stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
+ .stageFlags = stages,
.pImmutableSamplers = nullptr,
};
}
@@ -342,6 +343,13 @@ vk::DescriptorSetLayout CreateWrappedDescriptorSetLayout(
});
}
+vk::DescriptorSetLayout CreateWrappedDescriptorSetLayout(
+ const Device& device, std::initializer_list<VkDescriptorType> types,
+ VkShaderStageFlags stages) {
+ return CreateWrappedDescriptorSetLayout(
+ device, std::span<const VkDescriptorType>{std::data(types), types.size()}, stages);
+}
+
vk::DescriptorSets CreateWrappedDescriptorSets(vk::DescriptorPool& pool,
vk::Span<VkDescriptorSetLayout> layouts) {
return pool.Allocate(VkDescriptorSetAllocateInfo{
@@ -353,6 +361,28 @@ vk::DescriptorSets CreateWrappedDescriptorSets(vk::DescriptorPool& pool,
});
}
+vk::Pipeline CreateWrappedComputePipeline(const Device& device, vk::PipelineLayout& layout,
+ VkShaderModule shader) {
+ return device.GetLogical().CreateComputePipeline(VkComputePipelineCreateInfo{
+ .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
+ .pNext = nullptr,
+ .flags = 0,
+ .stage =
+ {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
+ .pNext = nullptr,
+ .flags = 0,
+ .stage = VK_SHADER_STAGE_COMPUTE_BIT,
+ .module = shader,
+ .pName = "main",
+ .pSpecializationInfo = nullptr,
+ },
+ .layout = *layout,
+ .basePipelineHandle = VK_NULL_HANDLE,
+ .basePipelineIndex = 0,
+ });
+}
+
vk::PipelineLayout CreateWrappedPipelineLayout(const Device& device,
vk::DescriptorSetLayout& layout) {
return device.GetLogical().CreatePipelineLayout(VkPipelineLayoutCreateInfo{