Skip to content

Commit 3d198aa

Browse files
skarczewigcbot
authored andcommitted
Remove omitting zero/undef sample params for cube maps.
1 parent 90e765c commit 3d198aa

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

IGC/Compiler/CISACodeGen/PayloadMapping.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -451,22 +451,27 @@ uint PayloadMapping::GetNonAdjustedNumPayloadElements_Sample(const SampleIntrins
451451
numSources = numOperands - 3;
452452
}
453453

454-
//Check for valid number of sources from the end of the list
455-
for (uint i = (numSources - 1); i >= 1; i--)
454+
llvm::Type* cubeTextureType = GetResourceDimensionType(*inst->getModule(), RESOURCE_DIMENSION_TYPE::DIM_CUBE_TYPE);
455+
llvm::Type* textureType = inst->getTextureValue()->getType()->getPointerElementType();
456+
if (textureType != cubeTextureType)
456457
{
457-
if (IsUndefOrZeroImmediate(inst->getOperand(i)))
458-
{
459-
numSources--;
460-
}
461-
else
458+
//Check for valid number of sources from the end of the list
459+
for (uint i = (numSources - 1); i >= 1; i--)
462460
{
463-
break;
461+
if (IsUndefOrZeroImmediate(inst->getOperand(i)))
462+
{
463+
numSources--;
464+
}
465+
else
466+
{
467+
break;
468+
}
464469
}
465-
}
466470

467-
//temp solution to send valid sources but having 0 as their values.
468-
EOPCODE opCode = GetOpCode(inst);
469-
ValidateNumberofSources(opCode, numSources);
471+
//temp solution to send valid sources but having 0 as their values.
472+
EOPCODE opCode = GetOpCode(inst);
473+
ValidateNumberofSources(opCode, numSources);
474+
}
470475

471476
if (IsZeroLOD(inst))
472477
{

IGC/common/igc_resourceDimTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace IGC
6060
}
6161
}
6262

63-
inline llvm::Type* GetResourceDimensionType(llvm::Module& module, RESOURCE_DIMENSION_TYPE resourceDimTypeId)
63+
inline llvm::Type* GetResourceDimensionType(const llvm::Module& module, RESOURCE_DIMENSION_TYPE resourceDimTypeId)
6464
{
6565
IGC_ASSERT((resourceDimTypeId == DIM_TYPED_BUFFER_TYPE ||
6666
resourceDimTypeId == DIM_1D_TYPE || resourceDimTypeId == DIM_1D_ARRAY_TYPE ||

0 commit comments

Comments
 (0)