renderer_vulkan: Check for VK_EXT_pipeline_creation_feedback

* Unused at the moment but will be useful later
This commit is contained in:
GPUCode
2023-01-26 14:32:58 +02:00
parent b29f263e1b
commit a629aa0dde
3 changed files with 15 additions and 6 deletions

View File

@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include <span>
#include <boost/container/small_vector.hpp>
#include "common/assert.h"
#include "common/settings.h"
#include "core/frontend/emu_window.h"
@ -567,6 +566,7 @@ bool Instance::CreateDevice() {
AddExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
timeline_semaphores = AddExtension(VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME);
image_format_list = AddExtension(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
pipeline_creation_feedback = AddExtension(VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME);
bool has_portability_subset = AddExtension(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME);
bool has_extended_dynamic_state = AddExtension(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
bool has_extended_dynamic_state2 = AddExtension(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);

View File

@ -173,6 +173,11 @@ public:
return pipeline_creation_cache_control;
}
/// Returns true when VK_EXT_pipeline_creation_feedback is supported
bool IsPipelineCreationFeedbackSupported() const {
return pipeline_creation_feedback;
}
/// Returns the vendor ID of the physical device
u32 GetVendorID() const {
return properties.vendorID;
@ -299,6 +304,7 @@ private:
bool index_type_uint8{};
bool image_format_list{};
bool pipeline_creation_cache_control{};
bool pipeline_creation_feedback{};
bool enable_validation{};
bool dump_command_buffers{};
};

View File

@ -328,11 +328,7 @@ bool PipelineCache::GraphicsPipeline::Build(bool fail_on_compile_required) {
.pPipelineStageCreationFeedbacks = creation_stage_feedback.data(),
};
const vk::GraphicsPipelineCreateInfo pipeline_info = {
.pNext = fail_on_compile_required ? &creation_feedback_info : nullptr,
.flags = fail_on_compile_required
? vk::PipelineCreateFlagBits::eFailOnPipelineCompileRequiredEXT
: vk::PipelineCreateFlags{},
vk::GraphicsPipelineCreateInfo pipeline_info = {
.stageCount = shader_count,
.pStages = shader_stages.data(),
.pVertexInputState = &vertex_input_info,
@ -347,6 +343,13 @@ bool PipelineCache::GraphicsPipeline::Build(bool fail_on_compile_required) {
.renderPass = renderpass,
};
if (fail_on_compile_required) {
pipeline_info.flags |= vk::PipelineCreateFlagBits::eFailOnPipelineCompileRequiredEXT;
}
if (instance.IsPipelineCreationFeedbackSupported()) {
pipeline_info.pNext = &creation_feedback_info;
}
const vk::ResultValue result = device.createGraphicsPipeline(pipeline_cache, pipeline_info);
if (result.result == vk::Result::eSuccess) {
pipeline = result.value;