From 5f7281bd8e52bc7ed51f8f5bcded36e21fa91e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 8 Jul 2026 18:24:16 +0200 Subject: [PATCH] Remove old vestiges of geometry shader support --- Common/GPU/Vulkan/VulkanRenderManager.cpp | 23 ++++------------------- Common/GPU/Vulkan/VulkanRenderManager.h | 4 +--- Common/GPU/Vulkan/thin3d_vulkan.cpp | 9 +-------- Common/GPU/thin3d.cpp | 1 - Common/GPU/thin3d.h | 10 ---------- Core/Config.cpp | 1 - Core/Config.h | 1 - GPU/Vulkan/DrawEngineVulkan.cpp | 2 +- GPU/Vulkan/PipelineManagerVulkan.cpp | 1 - UI/GameSettingsScreen.cpp | 9 --------- 10 files changed, 7 insertions(+), 54 deletions(-) diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 4f8ef64164..9a33896d0f 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -52,9 +52,8 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR // Fill in the last part of the desc since now it's time to block. VkShaderModule vs = desc->vertexShader->BlockUntilReady(); VkShaderModule fs = desc->fragmentShader->BlockUntilReady(); - VkShaderModule gs = desc->geometryShader ? desc->geometryShader->BlockUntilReady() : VK_NULL_HANDLE; - if (!vs || !fs || (!gs && desc->geometryShader)) { + if (!vs || !fs) { ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - missing shader modules"); pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE); return false; @@ -66,8 +65,8 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR return false; } - uint32_t stageCount = 2; - VkPipelineShaderStageCreateInfo ss[3]{}; + constexpr uint32_t stageCount = 2; + VkPipelineShaderStageCreateInfo ss[stageCount]{}; ss[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; ss[0].stage = VK_SHADER_STAGE_VERTEX_BIT; ss[0].pSpecializationInfo = nullptr; @@ -78,14 +77,6 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR ss[1].pSpecializationInfo = nullptr; ss[1].module = fs; ss[1].pName = "main"; - if (gs) { - stageCount++; - ss[2].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; - ss[2].stage = VK_SHADER_STAGE_GEOMETRY_BIT; - ss[2].pSpecializationInfo = nullptr; - ss[2].module = gs; - ss[2].pName = "main"; - } VkGraphicsPipelineCreateInfo pipe{ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO }; pipe.pStages = ss; @@ -242,9 +233,6 @@ u32 VKRGraphicsPipeline::GetVariantsBitmask() const { void VKRGraphicsPipeline::LogCreationFailure() const { ERROR_LOG(Log::G3D, "vs: %s\n[END VS]", desc->vertexShaderSource.c_str()); ERROR_LOG(Log::G3D, "fs: %s\n[END FS]", desc->fragmentShaderSource.c_str()); - if (desc->geometryShader) { - ERROR_LOG(Log::G3D, "gs: %s\n[END GS]", desc->geometryShaderSource.c_str()); - } // TODO: Maybe log various other state? ERROR_LOG(Log::G3D, "======== END OF PIPELINE =========="); } @@ -1738,7 +1726,7 @@ void VulkanRenderManager::ResetStats() { renderCPUTimeMs_.Reset(); } -VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindingTypes, size_t bindingTypesCount, bool geoShadersEnabled, const char *tag) { +VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindingTypes, size_t bindingTypesCount, const char *tag) { VKRPipelineLayout *layout = new VKRPipelineLayout(); layout->SetTag(tag); layout->bindingTypesCount = (uint32_t)bindingTypesCount; @@ -1764,9 +1752,6 @@ VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindin case BindingType::UNIFORM_BUFFER_DYNAMIC_ALL: bindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; bindings[i].stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT; - if (geoShadersEnabled) { - bindings[i].stageFlags |= VK_SHADER_STAGE_GEOMETRY_BIT; - } break; case BindingType::STORAGE_BUFFER_VERTEX: bindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; diff --git a/Common/GPU/Vulkan/VulkanRenderManager.h b/Common/GPU/Vulkan/VulkanRenderManager.h index 2469ef37b2..68680d4e33 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.h +++ b/Common/GPU/Vulkan/VulkanRenderManager.h @@ -94,13 +94,11 @@ public: // Replaced the ShaderStageInfo with promises here so we can wait for compiles to finish. Promise *vertexShader = nullptr; Promise *fragmentShader = nullptr; - Promise *geometryShader = nullptr; // These are for pipeline creation failure logging. // TODO: Store pointers to the string instead? Feels iffy but will probably work. std::string vertexShaderSource; std::string fragmentShaderSource; - std::string geometryShaderSource; VkPrimitiveTopology topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; VkVertexInputAttributeDescription attrs[8]{}; @@ -282,7 +280,7 @@ public: // WARNING: desc must stick around during the lifetime of the pipeline! It's not enough to build it on the stack and drop it. VKRGraphicsPipeline *CreateGraphicsPipeline(VKRGraphicsPipelineDesc *desc, PipelineFlags pipelineFlags, uint32_t variantBitmask, VkSampleCountFlagBits sampleCount, bool cacheLoad, const char *tag); - VKRPipelineLayout *CreatePipelineLayout(BindingType *bindingTypes, size_t bindingCount, bool geoShadersEnabled, const char *tag); + VKRPipelineLayout *CreatePipelineLayout(BindingType *bindingTypes, size_t bindingCount, const char *tag); void DestroyPipelineLayout(VKRPipelineLayout *pipelineLayout); void ReportBadStateForDraw(); diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 7b64accebf..2035829e9d 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -921,7 +921,6 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) caps_.coordConvention = CoordConvention::Vulkan; caps_.setMaxFrameLatencySupported = true; caps_.anisoSupported = vulkan->GetDeviceFeatures().enabled.standard.samplerAnisotropy != 0; - caps_.geometryShaderSupported = vulkan->GetDeviceFeatures().enabled.standard.geometryShader != 0; caps_.tesselationShaderSupported = vulkan->GetDeviceFeatures().enabled.standard.tessellationShader != 0; caps_.dualSourceBlend = vulkan->GetDeviceFeatures().enabled.standard.dualSrcBlend != 0; caps_.depthClampSupported = vulkan->GetDeviceFeatures().enabled.standard.depthClamp != 0; @@ -1070,12 +1069,6 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) bugs_.Infest(Bugs::EMPTY_RENDERPASS_BROKEN_MALI); } - // Older ARM devices have very slow geometry shaders, not worth using. At least before 15. - // Also seen to cause weird issues on 18, so let's lump it in. - if (majorVersion <= 18 || isOldVersion) { - bugs_.Infest(Bugs::GEOMETRY_SHADERS_SLOW_OR_BROKEN); - } - // Attempt to workaround #17386 if (isOldVersion) { if (!strcmp(deviceProps.deviceName, "Mali-T880") || @@ -1143,7 +1136,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) for (int i = 0; i < MAX_BOUND_TEXTURES; ++i) { bindings[1 + i] = BindingType::COMBINED_IMAGE_SAMPLER; } - pipelineLayout_ = renderManager_.CreatePipelineLayout(bindings, ARRAY_SIZE(bindings), caps_.geometryShaderSupported, "thin3d_layout"); + pipelineLayout_ = renderManager_.CreatePipelineLayout(bindings, ARRAY_SIZE(bindings), "thin3d_layout"); VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); diff --git a/Common/GPU/thin3d.cpp b/Common/GPU/thin3d.cpp index ea6542b4de..49afb2b971 100644 --- a/Common/GPU/thin3d.cpp +++ b/Common/GPU/thin3d.cpp @@ -530,7 +530,6 @@ const char *Bugs::GetBugName(uint32_t bug) { case RASPBERRY_SHADER_COMP_HANG: return "RASPBERRY_SHADER_COMP_HANG"; case MALI_CONSTANT_LOAD_BUG: return "MALI_CONSTANT_LOAD_BUG"; case SUBPASS_FEEDBACK_BROKEN: return "SUBPASS_FEEDBACK_BROKEN"; - case GEOMETRY_SHADERS_SLOW_OR_BROKEN: return "GEOMETRY_SHADERS_SLOW_OR_BROKEN"; case ADRENO_RESOURCE_DEADLOCK: return "ADRENO_RESOURCE_DEADLOCK"; case PVR_BAD_16BIT_TEXFORMATS: return "PVR_BAD_16BIT_TEXFORMATS"; case EMPTY_RENDERPASS_BROKEN_MALI: return "EMPTY_RENDERPASS_BROKEN_MALI"; diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index 5a60a05f1f..4a776bab56 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -133,14 +133,6 @@ enum class Primitive { TRIANGLE_LIST, TRIANGLE_STRIP, TRIANGLE_FAN, - // Tesselation shader only - PATCH_LIST, - // These are for geometry shaders only. - LINE_LIST_ADJ, - LINE_STRIP_ADJ, - TRIANGLE_LIST_ADJ, - TRIANGLE_STRIP_ADJ, - UNDEFINED, PRIMITIVE_TYPE_COUNT, }; @@ -351,7 +343,6 @@ public: RASPBERRY_SHADER_COMP_HANG = 8, MALI_CONSTANT_LOAD_BUG = 9, SUBPASS_FEEDBACK_BROKEN = 10, - GEOMETRY_SHADERS_SLOW_OR_BROKEN = 11, ADRENO_RESOURCE_DEADLOCK = 12, UNIFORM_INDEXING_BROKEN = 13, // not a properly diagnosed issue, a workaround attempt: #17386 PVR_BAD_16BIT_TEXFORMATS = 14, @@ -609,7 +600,6 @@ struct DeviceCaps { bool anisoSupported; bool depthRangeMinusOneToOne; // OpenGL style depth - bool geometryShaderSupported; bool tesselationShaderSupported; bool dualSourceBlend; bool logicOpSupported; diff --git a/Core/Config.cpp b/Core/Config.cpp index 14c66cbbc1..772543cab1 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -716,7 +716,6 @@ static const ConfigSetting graphicsSettings[] = { ConfigSetting("CameraMirrorHorizontal", SETTING(g_Config, bCameraMirrorHorizontal), false, CfgFlag::DEFAULT), ConfigSetting("AndroidFramerateMode", SETTING(g_Config, iDisplayFramerateMode), 1, CfgFlag::DEFAULT), ConfigSetting("VendorBugChecksEnabled", SETTING(g_Config, bVendorBugChecksEnabled), true, CfgFlag::DONT_SAVE), - ConfigSetting("UseGeometryShader", SETTING(g_Config, bUseGeometryShader), false, CfgFlag::PER_GAME), ConfigSetting("SkipBufferEffects", SETTING(g_Config, bSkipBufferEffects), false, CfgFlag::PER_GAME | CfgFlag::REPORT), ConfigSetting("DepthRasterMode", SETTING(g_Config, iDepthRasterMode), &DefaultDepthRaster, CfgFlag::PER_GAME | CfgFlag::REPORT), ConfigSetting("SoftwareRenderer", SETTING(g_Config, bSoftwareRendering), false, CfgFlag::PER_GAME), diff --git a/Core/Config.h b/Core/Config.h index 0fabad5be4..ea4480c8aa 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -287,7 +287,6 @@ public: bool bHardwareTransform; bool bSoftwareSkinning; bool bVendorBugChecksEnabled; - bool bUseGeometryShader; // Speedhacks (more will be moved here): bool bSkipBufferEffects; diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 9d30606750..032e58282a 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -70,7 +70,7 @@ void DrawEngineVulkan::InitDeviceObjects() { VkDevice device = vulkan->GetDevice(); VulkanRenderManager *renderManager = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); - pipelineLayout_ = renderManager->CreatePipelineLayout(bindingTypes, ARRAY_SIZE(bindingTypes), draw_->GetDeviceCaps().geometryShaderSupported, "drawengine_layout"); + pipelineLayout_ = renderManager->CreatePipelineLayout(bindingTypes, ARRAY_SIZE(bindingTypes), "drawengine_layout"); pushUBO_ = (VulkanPushPool *)draw_->GetNativeObject(Draw::NativeObject::PUSH_POOL); pushVertex_ = new VulkanPushPool(vulkan, "pushVertex", 4 * 1024 * 1024, 256, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); diff --git a/GPU/Vulkan/PipelineManagerVulkan.cpp b/GPU/Vulkan/PipelineManagerVulkan.cpp index 5b81420858..4a4614fa6f 100644 --- a/GPU/Vulkan/PipelineManagerVulkan.cpp +++ b/GPU/Vulkan/PipelineManagerVulkan.cpp @@ -205,7 +205,6 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, desc->fragmentShader = fs->GetModule(); desc->vertexShader = vs->GetModule(); - desc->geometryShader = nullptr; PROFILE_THIS_SCOPE("pipelinebuild"); bool useBlendConstant = false; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index af4cd23013..7c8945fe9a 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -516,15 +516,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings) graphicsSettings->Add(new SettingHint(gr->T("Faster, input lag"), inflightChoice)); // TODO: This hint could use improvement. } - if (GetGPUBackend() == GPUBackend::VULKAN) { - const bool usable = draw->GetDeviceCaps().geometryShaderSupported && !draw->GetBugs().Has(Draw::Bugs::GEOMETRY_SHADERS_SLOW_OR_BROKEN); - const bool vertexSupported = draw->GetDeviceCaps().maxClipDistances >= 2 && draw->GetDeviceCaps().maxCullDistances >= 1; - if (usable && !vertexSupported) { - CheckBox *geometryCulling = graphicsSettings->Add(new CheckBox(&g_Config.bUseGeometryShader, gr->T("Geometry shader culling"))); - geometryCulling->SetDisabledPtr(&g_Config.bSoftwareRendering); - } - } - if (deviceType != DEVICE_TYPE_VR) { CheckBox *hwTransform = graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gr->T("Hardware Transform"))); hwTransform->SetDisabledPtr(&g_Config.bSoftwareRendering);