diff --git a/llpc/context/llpcCompiler.cpp b/llpc/context/llpcCompiler.cpp index db4c8743a4..eccdc18610 100644 --- a/llpc/context/llpcCompiler.cpp +++ b/llpc/context/llpcCompiler.cpp @@ -790,9 +790,6 @@ void Compiler::buildShaderModuleResourceUsage( return; if (func) { - if (shaderStage >= ShaderStageVertex && shaderStage <= ShaderStageGeometry) - shaderModuleUsage.enableXfb = func->getExecutionMode(ExecutionModeXfb) != nullptr; - if (auto em = func->getExecutionMode(ExecutionModeLocalSize)) { shaderModuleUsage.localSizeX = em->getLiterals()[0]; shaderModuleUsage.localSizeX = em->getLiterals()[1]; @@ -1442,6 +1439,28 @@ bool Compiler::canUseRelocatableGraphicsShaderElf(const ArrayRefiaState.enableMultiView) return false; + // NOTE: On gfx11, Xfb depends on the count of primitive vertex. If UnlinkedStageVertexProcess only contains + // VS (no TES and GS), the primitive type might be unknown at compiling VS time, so we have to fall back to full + // pipeline. + // Currently, We treat Triangle_list as the default value. Therefore, we only disable relocatable compilation + // when primitive is point or line. + bool hasVs = pipelineInfo->vs.pModuleData != nullptr; + bool hasTes = (pipelineInfo->tes.pModuleData != nullptr) || (pipelineInfo->tcs.pModuleData != nullptr); + bool hasGs = pipelineInfo->gs.pModuleData != nullptr; + if (m_gfxIp.major >= 11 && hasVs && !hasGs && !hasTes && + static_cast(pipelineInfo->vs.pModuleData)->usage.enableXfb) { + switch (pipelineInfo->iaState.topology) { + case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: + return false; + default: + break; + } + } + if (shaderInfos[0]) { const ShaderModuleData *moduleData = reinterpret_cast(shaderInfos[0]->pModuleData); if (moduleData && moduleData->binType != BinaryType::Spirv) diff --git a/llpc/util/llpcShaderModuleHelper.cpp b/llpc/util/llpcShaderModuleHelper.cpp index 60e5b8ebe6..330ad95500 100644 --- a/llpc/util/llpcShaderModuleHelper.cpp +++ b/llpc/util/llpcShaderModuleHelper.cpp @@ -113,6 +113,8 @@ ShaderModuleUsage ShaderModuleHelper::getShaderModuleUsageInfo(const BinaryData case ExecutionModePixelCenterInteger: shaderModuleUsage.pixelCenterInteger = true; break; + case ExecutionModeXfb: + shaderModuleUsage.enableXfb = true; default: { break; }