From 75b782f261e880760b698e78ef74f245a09a8570 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 8 May 2023 20:56:50 +1000 Subject: [PATCH] GS/Vulkan: Enable geometryShader for Primitive ID Apparently it is needed.. --- pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp | 13 ++++++++++--- pcsx2/GS/Renderers/Vulkan/VKContext.cpp | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp index e171ecc006..c0da80a6b4 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp @@ -675,14 +675,17 @@ bool GSDeviceVK::CheckFeatures() m_features.framebuffer_fetch = g_vulkan_context->GetOptionalExtensions().vk_ext_rasterization_order_attachment_access && !GSConfig.DisableFramebufferFetch; m_features.texture_barrier = GSConfig.OverrideTextureBarriers != 0; m_features.broken_point_sampler = isAMD; + + // geometryShader is needed because gl_PrimitiveID is part of the Geometry SPIR-V Execution Model. + m_features.primitive_id = g_vulkan_context->GetDeviceFeatures().geometryShader; + #ifdef __APPLE__ // On Metal (MoltenVK), primid is sometimes available, but broken on some older GPUs and MacOS versions. // Officially, it's available on GPUs that support barycentric coordinates (Newer AMD and Apple) // Unofficially, it seems to work on older Intel GPUs (but breaks other things on newer Intel GPUs, see GSMTLDeviceInfo.mm for details) - m_features.primitive_id = g_vulkan_context->GetOptionalExtensions().vk_khr_fragment_shader_barycentric; -#else - m_features.primitive_id = true; + m_features.primitive_id &= g_vulkan_context->GetOptionalExtensions().vk_khr_fragment_shader_barycentric; #endif + m_features.prefer_new_textures = true; m_features.provoking_vertex_last = g_vulkan_context->GetOptionalExtensions().vk_ext_provoking_vertex; m_features.dual_source_blend = features.dualSrcBlend && !GSConfig.DisableDualSourceBlend; @@ -721,6 +724,10 @@ bool GSDeviceVK::CheckFeatures() m_features.line_expand = (features.wideLines && limits.lineWidthRange[0] <= f_upscale && limits.lineWidthRange[1] >= f_upscale); + DevCon.WriteLn("Optional features:%s%s%s%s%s%s", m_features.primitive_id ? " primitive_id" : "", + m_features.texture_barrier ? " texture_barrier" : "", m_features.framebuffer_fetch ? " framebuffer_fetch" : "", + m_features.dual_source_blend ? " dual_source_blend" : "", + m_features.provoking_vertex_last ? " provoking_vertex_last" : "", m_features.vs_expand ? " vs_expand" : ""); DevCon.WriteLn("Using %s for point expansion and %s for line expansion.", m_features.point_expand ? "hardware" : "vertex expanding", m_features.line_expand ? "hardware" : "vertex expanding"); diff --git a/pcsx2/GS/Renderers/Vulkan/VKContext.cpp b/pcsx2/GS/Renderers/Vulkan/VKContext.cpp index 4dd5414008..7cd9b5dfe8 100644 --- a/pcsx2/GS/Renderers/Vulkan/VKContext.cpp +++ b/pcsx2/GS/Renderers/Vulkan/VKContext.cpp @@ -389,7 +389,7 @@ bool VKContext::SelectDeviceExtensions(ExtensionList* extension_list, bool enabl #ifdef _WIN32 m_optional_extensions.vk_ext_full_screen_exclusive = - SupportsExtension(VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, false); + enable_surface && SupportsExtension(VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, false); #endif return true; @@ -410,6 +410,7 @@ bool VKContext::SelectDeviceFeatures(const VkPhysicalDeviceFeatures* required_fe m_device_features.fragmentStoresAndAtomics = available_features.fragmentStoresAndAtomics; m_device_features.textureCompressionBC = available_features.textureCompressionBC; m_device_features.samplerAnisotropy = available_features.samplerAnisotropy; + m_device_features.geometryShader = available_features.geometryShader; return true; }