@@ -8583,6 +8583,22 @@ static void setUniformSampler(G4_InstSend* sendInst, bool uniformSampler)
8583
8583
Need to split sample_d and sample_dc in to two simd8 sends since HW doesn't support it.
8584
8584
Also need to split any sample instruciton that has more then 5 parameters. Since there is a limit on msg length.
8585
8585
*/
8586
+ static unsigned TmpSmplDstID = 0 ;
8587
+ const char * getNameString (Mem_Manager& mem, size_t size, const char * format, ...)
8588
+ {
8589
+ #ifdef _DEBUG
8590
+ char * name = (char *) mem.alloc (size);
8591
+ va_list args;
8592
+ va_start (args, format);
8593
+ std::vsnprintf (name, size, format, args);
8594
+ va_end (args);
8595
+ return name;
8596
+ #else
8597
+ const char * name = " " ;
8598
+ return const_cast <char *>(name);
8599
+ #endif
8600
+ }
8601
+
8586
8602
static int splitSampleInst (VISASampler3DSubOpCode actualop,
8587
8603
bool pixelNullMask,
8588
8604
bool cpsEnable,
@@ -8599,6 +8615,7 @@ static int splitSampleInst(VISASampler3DSubOpCode actualop,
8599
8615
IR_Builder *builder,
8600
8616
unsigned int numParms,
8601
8617
G4_SrcRegRegion ** params,
8618
+ Mem_Manager& mem,
8602
8619
bool uniformSampler = true )
8603
8620
{
8604
8621
int status = CM_SUCCESS;
@@ -8640,7 +8657,9 @@ static int splitSampleInst(VISASampler3DSubOpCode actualop,
8640
8657
++tmpDstRows;
8641
8658
}
8642
8659
8643
- tempDstDcl = builder->createDeclareNoLookup (" TmpSmplDst" ,
8660
+ const char *name = getNameString (mem, 20 , " %s%d" , " TmpSmplDst_" , TmpSmplDstID++);
8661
+
8662
+ tempDstDcl = builder->createDeclareNoLookup (name,
8644
8663
originalDstDcl->getRegFile (),
8645
8664
originalDstDcl->getNumElems (),
8646
8665
(uint16_t )tmpDstRows,
@@ -8734,7 +8753,9 @@ static int splitSampleInst(VISASampler3DSubOpCode actualop,
8734
8753
G4_Declare* tempDstDcl2 = nullptr ;
8735
8754
if (!dst->isNullReg ())
8736
8755
{
8737
- tempDstDcl2 = builder->createDeclareNoLookup (" TmpSmplDst2" ,
8756
+ const char *name = getNameString (mem, 20 , " %s%d" , " TmpSmplDst2_" , TmpSmplDstID++);
8757
+
8758
+ tempDstDcl2 = builder->createDeclareNoLookup (name,
8738
8759
originalDstDcl->getRegFile (),
8739
8760
originalDstDcl->getNumElems (),
8740
8761
(uint16_t )tmpDstRows,
@@ -9097,7 +9118,7 @@ int IR_Builder::translateVISASampler3DInst(
9097
9118
9098
9119
return splitSampleInst (actualop, pixelNullMask, cpsEnable, pred, chMask,
9099
9120
numChannels, aoffimmi, sampler, surface, dst,
9100
- emask, useHeader, numRows, this , numParms, params, uniformSampler);
9121
+ emask, useHeader, numRows, this , numParms, params, mem, uniformSampler);
9101
9122
}
9102
9123
9103
9124
bool useSplitSend = useSends ();
@@ -9230,7 +9251,7 @@ int IR_Builder::translateVISALoad3DInst(
9230
9251
return splitSampleInst (actualop, pixelNullMask, /* cpsEnable*/ false ,
9231
9252
pred_opnd, channelMask, numChannels, aoffimmi,
9232
9253
NULL , surface, dst, em, useHeader, numRows,
9233
- this , numParms, opndArray);
9254
+ this , numParms, opndArray, mem );
9234
9255
}
9235
9256
9236
9257
bool useSplitSend = useSends ();
@@ -9348,7 +9369,7 @@ int IR_Builder::translateVISAGather3dInst(
9348
9369
return splitSampleInst (actualop, pixelNullMask, /* cpsEnable*/ false ,
9349
9370
pred, channelMask, 4 , aoffimmi, sampler,
9350
9371
surface, dst, em, useHeader, numRows, this ,
9351
- numOpnds, opndArray);
9372
+ numOpnds, opndArray, mem );
9352
9373
}
9353
9374
9354
9375
bool useSplitSend = useSends ();
0 commit comments