GPU/Vulkan: Use geometry shader for line rendering at >1xIR

This commit is contained in:
Connor McLaughlin
2020-06-21 01:33:08 +10:00
parent 97ef905f10
commit bf60f9dd61
4 changed files with 51 additions and 21 deletions

View File

@ -197,7 +197,6 @@ bool Context::SelectInstanceExtensions(ExtensionList* extension_list, bool enabl
return false;
#endif
// VK_EXT_debug_report
if (enable_debug_report && !SupportsExtension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, false))
Log_WarningPrintf("Vulkan: Debug report requested, but extension is not available.");
@ -422,12 +421,15 @@ bool Context::SelectDeviceExtensions(ExtensionList* extension_list, bool enable_
bool Context::SelectDeviceFeatures()
{
VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(m_physical_device, &properties);
VkPhysicalDeviceFeatures available_features;
vkGetPhysicalDeviceFeatures(m_physical_device, &available_features);
if (!available_features.fillModeNonSolid)
{
Log_ErrorPrintf("fillModeNonSolid feature is required for line drawing.");
return false;
}
// Enable the features we use.
m_device_features.dualSrcBlend = available_features.dualSrcBlend;
m_device_features.geometryShader = available_features.geometryShader;

View File

@ -178,6 +178,15 @@ void SafeDestroyFramebuffer(VkFramebuffer& fb)
}
}
void SafeDestroyShaderModule(VkShaderModule& sm)
{
if (sm != VK_NULL_HANDLE)
{
vkDestroyShaderModule(g_vulkan_context->GetDevice(), sm, nullptr);
sm = VK_NULL_HANDLE;
}
}
void SafeDestroyPipeline(VkPipeline& p)
{
if (p != VK_NULL_HANDLE)

View File

@ -35,6 +35,7 @@ VkBlendFactor GetAlphaBlendFactor(VkBlendFactor factor);
// Safe destroy helpers
void SafeDestroyFramebuffer(VkFramebuffer& fb);
void SafeDestroyShaderModule(VkShaderModule& sm);
void SafeDestroyPipeline(VkPipeline& p);
void SafeDestroyPipelineLayout(VkPipelineLayout& pl);
void SafeDestroyDescriptorSetLayout(VkDescriptorSetLayout& dsl);
@ -43,7 +44,7 @@ void SafeDestroySampler(VkSampler& samp);
void SafeFreeGlobalDescriptorSet(VkDescriptorSet& ds);
void SetViewport(VkCommandBuffer command_buffer, int x, int y, int width, int height, float min_depth = 0.0f,
float max_depth = 1.0f);
float max_depth = 1.0f);
void SetScissor(VkCommandBuffer command_buffer, int x, int y, int width, int height);
// Combines viewport and scissor updates