Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Xfb for relocatable compilation.. #2798

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions llpc/context/llpcCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -1442,6 +1439,28 @@ bool Compiler::canUseRelocatableGraphicsShaderElf(const ArrayRef<const PipelineS
if (pipelineInfo->iaState.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<const ShaderModuleData *>(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<const ShaderModuleData *>(shaderInfos[0]->pModuleData);
if (moduleData && moduleData->binType != BinaryType::Spirv)
Expand Down
2 changes: 2 additions & 0 deletions llpc/util/llpcShaderModuleHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ ShaderModuleUsage ShaderModuleHelper::getShaderModuleUsageInfo(const BinaryData
case ExecutionModePixelCenterInteger:
shaderModuleUsage.pixelCenterInteger = true;
break;
case ExecutionModeXfb:
shaderModuleUsage.enableXfb = true;
default: {
break;
}
Expand Down
Loading