Skip to content

Commit e566bb4

Browse files
mmereckiZuul
authored andcommitted
Restrict code in WorkaroundAnalysis::visitCallInst() to bound resources only.
Change-Id: I1bd134b21a210005e86fe54b548ae5f3fef1fc2f
1 parent f8e06b6 commit e566bb4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

IGC/Compiler/WorkaroundAnalysisPass.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ IGC_INITIALIZE_PASS_END(WorkaroundAnalysis, PASS_FLAG, PASS_DESCRIPTION, PASS_CF
6363

6464
char WorkaroundAnalysis::ID = 0;
6565

66+
// Returns BTI of the texture when resource is not dynamically indexed and when
67+
// resource is not bindless.
6668
int GetSampleCResourceIdx(llvm::CallInst& I)
6769
{
6870
int textLocation = -1;
@@ -75,8 +77,11 @@ int GetSampleCResourceIdx(llvm::CallInst& I)
7577
uint as = pArgLocation->getType()->getPointerAddressSpace();
7678
uint bufferIndex;
7779
bool directIdx;
78-
DecodeAS4GFXResource(as, directIdx, bufferIndex);
79-
return bufferIndex;
80+
const BufferType resourceType = DecodeAS4GFXResource(as, directIdx, bufferIndex);
81+
if (resourceType == RESOURCE && directIdx)
82+
{
83+
return bufferIndex;
84+
}
8085
}
8186
}
8287
return textLocation;
@@ -279,6 +284,8 @@ void WorkaroundAnalysis::visitCallInst(llvm::CallInst& I)
279284
uint bufferIndex = GetSampleCResourceIdx(I);
280285
if (bufferIndex == -1) break;
281286

287+
assert(bufferIndex < 256);
288+
282289
if (pCodeGenCtx->type == ShaderType::PIXEL_SHADER)
283290
{
284291
PixelShaderContext* pShaderCtx = static_cast <PixelShaderContext*>(pCodeGenCtx);

0 commit comments

Comments
 (0)