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

Remove the shader input IsOffChip #2861

Merged
merged 1 commit into from
Dec 12, 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
1 change: 0 additions & 1 deletion lgc/include/lgc/patch/ShaderInputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ enum class ShaderInput : unsigned {
GsWaveId, // GS wave ID

// Unmerged hardware ES SGPRs
IsOffChip, // is_off_chip
EsGsOffset, // ES to GS offset

// Unmerged hardware HS SGPRs
Expand Down
8 changes: 1 addition & 7 deletions lgc/patch/NggPrimShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3117,9 +3117,7 @@ void NggPrimShader::runEs(ArrayRef<Argument *> args) {

if (m_hasTes) {
// Set up system value SGPRs
Value *isOffChip = PoisonValue::get(m_builder.getInt32Ty()); // Unused
esArgs.push_back(m_hasGs ? offChipLdsBase : isOffChip);
esArgs.push_back(m_hasGs ? isOffChip : offChipLdsBase);
esArgs.push_back(offChipLdsBase);

if (m_hasGs)
esArgs.push_back(esGsOffset);
Expand Down Expand Up @@ -3333,8 +3331,6 @@ Value *NggPrimShader::runPartEs(ArrayRef<Argument *> args, Value *position) {

if (m_hasTes) {
// Set up system value SGPRs
Value *isOffChip = PoisonValue::get(m_builder.getInt32Ty()); // Unused
partEsArgs.push_back(isOffChip);
partEsArgs.push_back(offChipLdsBase);

// Set up system value VGPRs
Expand Down Expand Up @@ -7506,8 +7502,6 @@ Value *NggPrimShader::fetchXfbOutput(Function *target, ArrayRef<Argument *> args

if (m_hasTes) {
// Set up system value SGPRs
Value *isOffChip = PoisonValue::get(m_builder.getInt32Ty()); // Unused
xfbFetcherArgs.push_back(isOffChip);
xfbFetcherArgs.push_back(offChipLdsBase);

// Set up system value VGPRs
Expand Down
24 changes: 5 additions & 19 deletions lgc/patch/ShaderInputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ const char *ShaderInputs::getInputName(ShaderInput inputKind) {
return "GsVsOffset";
case ShaderInput::GsWaveId:
return "GsWaveId";
case ShaderInput::IsOffChip:
return "IsOffChip";
case ShaderInput::EsGsOffset:
return "EsGsOffset";
case ShaderInput::TfBufferBase:
Expand Down Expand Up @@ -458,8 +456,7 @@ static const ShaderInputDesc VsAsVsSgprInputs[] = {

// SGPRs: TES as hardware ES
static const ShaderInputDesc TesAsEsSgprInputs[] = {
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tes.offChipLdsBase)},
{ShaderInput::IsOffChip, 0},
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tes.offChipLdsBase), true},
{ShaderInput::EsGsOffset, offsetof(InterfaceData, entryArgIdxs.tes.esGsOffset), true},
};

Expand All @@ -471,12 +468,12 @@ static const ShaderInputDesc TesAsVsSgprInputs[] = {
{ShaderInput::StreamOutOffset1, offsetof(InterfaceData, entryArgIdxs.tes.streamOutData.streamOffsets[1])},
{ShaderInput::StreamOutOffset2, offsetof(InterfaceData, entryArgIdxs.tes.streamOutData.streamOffsets[2])},
{ShaderInput::StreamOutOffset3, offsetof(InterfaceData, entryArgIdxs.tes.streamOutData.streamOffsets[3])},
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tes.offChipLdsBase)},
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tes.offChipLdsBase), true},
};

// SGPRs: TCS
static const ShaderInputDesc TcsSgprInputs[] = {
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tcs.offChipLdsBase)},
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tcs.offChipLdsBase), true},
{ShaderInput::TfBufferBase, offsetof(InterfaceData, entryArgIdxs.tcs.tfBufferBase), true},
};

Expand Down Expand Up @@ -608,22 +605,11 @@ uint64_t ShaderInputs::getShaderArgTys(PipelineState *pipelineState, ShaderStage
getShaderInputUsage(shaderStage, ShaderInput::InstanceId)->enable();
}
break;
case ShaderStageTessControl:
// LDS buffer base for off-chip
getShaderInputUsage(shaderStage, ShaderInput::OffChipLdsBase)->enable();
break;
case ShaderStageTessEval:
// LDS buffer base for off-chip
getShaderInputUsage(shaderStage, ShaderInput::OffChipLdsBase)->enable();
// is_off_chip register. Enabling it here only has an effect when TES is hardware ES.
getShaderInputUsage(shaderStage, ShaderInput::IsOffChip)->enable();

if (!hasGs) {
// TES as hardware VS: handle HW stream-out. StreamOutInfo is required for off-chip even if there is no
// stream-out.
getShaderInputUsage(shaderStage, ShaderInput::StreamOutInfo)->enable();

// TES as hardware VS: handle HW stream-out.
if (enableHwXfb) {
getShaderInputUsage(shaderStage, ShaderInput::StreamOutInfo)->enable();
getShaderInputUsage(shaderStage, ShaderInput::StreamOutWriteIndex)->enable();
for (unsigned i = 0; i < MaxTransformFeedbackBuffers; ++i) {
if (xfbStrides[i] > 0)
Expand Down
1 change: 0 additions & 1 deletion lgc/patch/ShaderMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@ Function *ShaderMerger::generateEsGsEntryPoint(Function *esEntryPoint, Function
if (hasTs) {
// Set up system value SGPRs
esArgs.push_back(offChipLdsBase);
esArgs.push_back(offChipLdsBase);
esArgs.push_back(esGsOffset);

// Set up system value VGPRs
Expand Down
Loading