Skip to content

Commit c90f3fc

Browse files
test: adjusting sampler border color when heapless is enabled
Related-to: NEO-12737 Signed-off-by: Damian Tomczak <[email protected]>
1 parent 2f1128f commit c90f3fc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ struct SamplerSupportedMatcher {
331331
HWTEST2_F(CommandEncodeStatesTest, giveNumSamplersOneWhenDispatchKernelThensamplerStateWasCopied, SamplerSupportedMatcher) {
332332
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
333333
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
334+
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
334335

335336
if (!pDevice->getDeviceInfo().imageSupport) {
336337
GTEST_SKIP();
@@ -346,8 +347,9 @@ HWTEST2_F(CommandEncodeStatesTest, giveNumSamplersOneWhenDispatchKernelThensampl
346347
uint32_t dims[] = {2, 1, 1};
347348
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
348349

350+
constexpr auto samplerTableBorderColorOffset = 0u;
349351
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.numSamplers = numSamplers;
350-
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.borderColor = 0;
352+
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.borderColor = samplerTableBorderColorOffset;
351353
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.tableOffset = 0;
352354

353355
unsigned char *samplerStateRaw = reinterpret_cast<unsigned char *>(&samplerState);
@@ -369,8 +371,13 @@ HWTEST2_F(CommandEncodeStatesTest, giveNumSamplersOneWhenDispatchKernelThensampl
369371
auto cmd = genCmdCast<COMPUTE_WALKER *>(*itor);
370372
auto &idd = cmd->getInterfaceDescriptor();
371373

372-
auto borderColorOffsetInDsh = usedBefore;
373-
samplerState.setIndirectStatePointer(static_cast<uint32_t>(borderColorOffsetInDsh));
374+
if (pDevice->getCompilerProductHelper().isHeaplessModeEnabled()) {
375+
auto borderColor = reinterpret_cast<const SAMPLER_BORDER_COLOR_STATE *>(ptrOffset(dispatchInterface->getDynamicStateHeapData(), samplerTableBorderColorOffset));
376+
EncodeStates<FamilyType>::adjustSamplerStateBorderColor(samplerState, *borderColor);
377+
} else {
378+
auto borderColorOffsetInDsh = usedBefore;
379+
samplerState.setIndirectStatePointer(static_cast<uint32_t>(borderColorOffsetInDsh));
380+
}
374381

375382
auto samplerStateOffset = idd.getSamplerStatePointer();
376383

0 commit comments

Comments
 (0)