Skip to content

Commit bba8e94

Browse files
mmereckisys_zuul
authored andcommitted
Update EOTRenderTarget() to use RTW instruction instead of a raw send.
Change-Id: I2919c9a0eaa131d97da4b4114257fa0a368ee49c
1 parent 0ee9c25 commit bba8e94

File tree

3 files changed

+28
-37
lines changed

3 files changed

+28
-37
lines changed

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ SProgramOutput* CShader::ProgramOutput()
159159

160160
void CShader::EOTURBWrite()
161161
{
162+
162163
CEncoder& encoder = GetEncoder();
163164
uint messageLength = 3;
164165

@@ -192,41 +193,29 @@ void CShader::EOTURBWrite()
192193
encoder.Push();
193194
}
194195

195-
void CShader::EOTRenderTarget()
196-
{
197-
// dummy render target to do EOT and free release the pixel scoreboard
198-
EU_GEN6_DATA_PORT_RENDER_TARGET_WRITE_CONTROL msgControl =
199-
(m_SIMDSize == SIMDMode::SIMD8)
200-
? EU_GEN6_DATA_PORT_RENDER_TARGET_WRITE_CONTROL_SIMD8_SINGLE_SOURCE_LOW
201-
: EU_GEN6_DATA_PORT_RENDER_TARGET_WRITE_CONTROL_SIMD16_SINGLE_SOURCE;
202-
203-
bool perCoarse = false;
204-
if (GetShaderType() == ShaderType::PIXEL_SHADER)
205-
{
206-
perCoarse = (static_cast<CPixelShader*>(this)->GetPhase() != PSPHASE_LEGACY);
207-
}
208-
209-
const uint Desc = PixelDataPort(
210-
false,
211-
m_SIMDSize == SIMDMode::SIMD8 ? 4 : 8,
212-
0,
213-
false,
214-
perCoarse,
215-
false,
216-
true, // scoreboard release
217-
false,
218-
msgControl,
219-
m_pBtiLayout->GetNullSurfaceIdx());
220-
221-
// we don't want to update the usage mask for null surface, so set the buffer type to be unknown.
222-
this->SetBindingTableEntryCountAndBitmap(true, BUFFER_TYPE_UNKNOWN, 0, m_pBtiLayout->GetNullSurfaceIdx());
223-
224-
constexpr uint nullRenderTargetBit = BIT(20);
225-
constexpr uint exDesc = EU_MESSAGE_TARGET_DATA_PORT_WRITE | cMessageExtendedDescriptorEOTBit | nullRenderTargetBit;
226-
227-
CVariable* payload = GetNewVariable(
228-
4 * numLanes(m_SIMDSize), ISA_TYPE_UD, EALIGN_GRF, "EOTPayload");
229-
encoder.SendC(nullptr, payload, exDesc, ImmToVariable(Desc, ISA_TYPE_UD));
196+
void CShader::EOTRenderTarget(CVariable* r1, bool isPerCoarse)
197+
{
198+
CVariable* src[4] = { nullptr, nullptr, nullptr, nullptr };
199+
bool isUndefined[4] = { true, true, true, true };
200+
CVariable* const nullSurfaceBti = ImmToVariable(m_pBtiLayout->GetNullSurfaceIdx(), ISA_TYPE_D);
201+
CVariable* const blendStateIndex = ImmToVariable(0, ISA_TYPE_D);
202+
SetBindingTableEntryCountAndBitmap(true, BUFFER_TYPE_UNKNOWN, 0, m_pBtiLayout->GetNullSurfaceIdx());
203+
encoder.RenderTargetWrite(
204+
src,
205+
isUndefined,
206+
true, // lastRenderTarget,
207+
false, // perSample,
208+
isPerCoarse, // coarseMode,
209+
false, // isHeaderMaskFromCe0,
210+
nullSurfaceBti,
211+
blendStateIndex,
212+
nullptr, // source0Alpha,
213+
nullptr, // oMaskOpnd,
214+
nullptr, // outputDepthOpnd,
215+
nullptr, // stencilOpnd,
216+
nullptr, // cpscounter,
217+
nullptr, // sampleIndex,
218+
r1);
230219
encoder.Push();
231220
}
232221

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,9 @@ void CPixelShader::AddEpilogue(llvm::ReturnInst* ret)
11031103
encoder.Push();
11041104
encoder.Jump(flag, m_pixelPhaseLabel);
11051105
encoder.Push();
1106-
EOTRenderTarget();
1106+
const bool isPerCoarse = true;
1107+
EOTRenderTarget(GetR1(), isPerCoarse);
1108+
m_hasEOT = true;
11071109
}
11081110
if (IsLastPhase())
11091111
{

IGC/Compiler/CISACodeGen/ShaderCodeGen.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class CShader
9090
virtual void PreAnalysisPass();
9191
virtual void ExtractGlobalVariables() {}
9292
void EOTURBWrite();
93-
void EOTRenderTarget();
93+
void EOTRenderTarget(CVariable* r1, bool isPerCoarse);
9494
virtual void AddEpilogue(llvm::ReturnInst* ret);
9595

9696
virtual CVariable* GetURBOutputHandle()

0 commit comments

Comments
 (0)