Skip to content

Commit 40a982e

Browse files
MaciejKalinskiigcbot
authored andcommitted
Trivial refactoring.
1 parent 81b88fa commit 40a982e

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8054,10 +8054,12 @@ void EmitPass::emitPSSGV(GenIntrinsicInst* inst)
80548054
m_encoder->Push();
80558055
}
80568056
break;
8057+
80578058
default:
80588059
IGC_ASSERT(0);
80598060
break;
80608061
}
8062+
80618063
psProgram->DeclareSGV(usage);
80628064
}
80638065

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,7 @@ CVariable* CPixelShader::GetBaryReg(e_interpolation mode)
456456

457457
CVariable* CPixelShader::GetBaryRegLoweredHalf(e_interpolation mode)
458458
{
459-
IGC_ASSERT(mode == EINTERPOLATION_LINEAR ||
460-
mode == EINTERPOLATION_LINEARCENTROID ||
461-
mode == EINTERPOLATION_LINEARSAMPLE ||
462-
mode == EINTERPOLATION_LINEARNOPERSPECTIVE ||
463-
mode == EINTERPOLATION_LINEARNOPERSPECTIVECENTROID ||
464-
mode == EINTERPOLATION_LINEARNOPERSPECTIVESAMPLE);
459+
IGC_ASSERT(IsInterpolationLinear(mode));
465460

466461
const char* const name =
467462
mode == EINTERPOLATION_LINEAR ? "PerspectivePixelLoweredHalf" :
@@ -487,12 +482,7 @@ CVariable* CPixelShader::GetBaryRegLoweredHalf(e_interpolation mode)
487482

488483
CVariable* CPixelShader::GetBaryRegLoweredFloat(e_interpolation mode)
489484
{
490-
IGC_ASSERT(mode == EINTERPOLATION_LINEAR ||
491-
mode == EINTERPOLATION_LINEARCENTROID ||
492-
mode == EINTERPOLATION_LINEARSAMPLE ||
493-
mode == EINTERPOLATION_LINEARNOPERSPECTIVE ||
494-
mode == EINTERPOLATION_LINEARNOPERSPECTIVECENTROID ||
495-
mode == EINTERPOLATION_LINEARNOPERSPECTIVESAMPLE);
485+
IGC_ASSERT(IsInterpolationLinear(mode));
496486

497487
const char* const name =
498488
mode == EINTERPOLATION_LINEAR ? "PerspectivePixelLoweredFloat" :
@@ -893,6 +883,7 @@ void CPixelShader::FillProgram(SPixelShaderKernelProgram* pKernelProgram)
893883
pKernelProgram->NOSBufferSize = m_NOSBufferSize / getMinPushConstantBufferAlignmentInBytes();
894884
pKernelProgram->isMessageTargetDataCacheDataPort = isMessageTargetDataCacheDataPort;
895885

886+
896887
CreateGatherMap();
897888
CreateConstantBufferOutput(pKernelProgram);
898889

@@ -997,14 +988,16 @@ void CPixelShader::ParseShaderSpecificOpcode(llvm::Instruction* inst)
997988
e_interpolation mode = static_cast<e_interpolation>(llvm::cast<llvm::ConstantInt>(inst->getOperand(1))->getZExtValue());
998989
if (mode != EINTERPOLATION_CONSTANT)
999990
{
1000-
if (inst->getType()->isHalfTy())
1001-
{
1002-
loweredSetupIndexes.insert(setupIndex);
1003-
m_ModeUsedHalf.set(mode);
1004-
}
1005-
else
1006991
{
1007-
m_ModeUsedFloat.set(mode);
992+
if (inst->getType()->isHalfTy())
993+
{
994+
loweredSetupIndexes.insert(setupIndex);
995+
m_ModeUsedHalf.set(mode);
996+
}
997+
else
998+
{
999+
m_ModeUsedFloat.set(mode);
1000+
}
10081001
}
10091002
}
10101003
break;
@@ -1654,6 +1647,16 @@ bool CPixelShader::LowerPSInput()
16541647
return (m_SIMDSize == SIMDMode::SIMD16 || !m_Platform->supportMixMode());
16551648
}
16561649

1650+
bool CPixelShader::IsInterpolationLinear(e_interpolation mode)
1651+
{
1652+
return mode == EINTERPOLATION_LINEAR ||
1653+
mode == EINTERPOLATION_LINEARCENTROID ||
1654+
mode == EINTERPOLATION_LINEARSAMPLE ||
1655+
mode == EINTERPOLATION_LINEARNOPERSPECTIVE ||
1656+
mode == EINTERPOLATION_LINEARNOPERSPECTIVECENTROID ||
1657+
mode == EINTERPOLATION_LINEARNOPERSPECTIVESAMPLE;
1658+
}
1659+
16571660
void CPixelShader::emitPSInputLowering()
16581661
{
16591662
auto iterSetupIndex = loweredSetupIndexes.begin();

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class CPixelShader : public CShader
113113
std::bitset<NUMBER_EINTERPOLATION> m_ModeUsedHalf;
114114
std::bitset<NUMBER_EINTERPOLATION> m_ModeUsedFloat;
115115
bool LowerPSInput();
116+
static bool IsInterpolationLinear(e_interpolation mode);
117+
116118
protected:
117119
void CreatePassThroughVar();
118120
bool IsReturnBlock(llvm::BasicBlock* bb);

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,6 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
790790

791791
mpm.add(new LowPrecisionOpt());
792792

793-
794793
// 3D input/output lowering
795794
switch (ctx.type)
796795
{

0 commit comments

Comments
 (0)