mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Program border color once per dsh
Related-To: NEO-4928 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
5ea2f625d1
commit
b943ad078f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -946,6 +946,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
|
||||
typedef typename FamilyType::BINDING_TABLE_STATE BINDING_TABLE_STATE;
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
typedef typename FamilyType::SAMPLER_BORDER_COLOR_STATE SAMPLER_BORDER_COLOR_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER;
|
||||
|
||||
@ -960,7 +961,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
|
||||
auto &ioh = cmdQ.getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 8192);
|
||||
auto &ssh = cmdQ.getIndirectHeap(IndirectHeap::SURFACE_STATE, 8192);
|
||||
|
||||
const uint32_t samplerTableOffset = 64;
|
||||
const uint32_t samplerTableOffset = static_cast<uint32_t>(alignUp(sizeof(SAMPLER_BORDER_COLOR_STATE), INTERFACE_DESCRIPTOR_DATA::SAMPLERSTATEPOINTER_ALIGN_SIZE));
|
||||
const uint32_t samplerStateSize = sizeof(SAMPLER_STATE) * 2;
|
||||
mockKernelWithInternal->kernelInfo.setSamplerTable(0, 2, static_cast<DynamicStateHeapOffset>(samplerTableOffset));
|
||||
|
||||
@ -1007,7 +1008,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
|
||||
true,
|
||||
*pDevice);
|
||||
|
||||
bool isMemorySame = memcmp(borderColorPointer, mockDsh, samplerTableOffset) == 0;
|
||||
auto expectedBorderColor = FamilyType::cmdInitBorderColor;
|
||||
bool isMemorySame = memcmp(borderColorPointer, &expectedBorderColor, sizeof(SAMPLER_BORDER_COLOR_STATE)) == 0;
|
||||
EXPECT_TRUE(isMemorySame);
|
||||
|
||||
SAMPLER_STATE *pSamplerStatesCopied = reinterpret_cast<SAMPLER_STATE *>(borderColorPointer + samplerTableOffset);
|
||||
|
@ -36,7 +36,6 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
|
||||
const void *fnDynamicStateHeap,
|
||||
BindlessHeapsHelper *bindlessHeapHelper) {
|
||||
auto sizeSamplerState = sizeof(SAMPLER_STATE) * samplerCount;
|
||||
auto borderColorSize = samplerStateOffset - borderColorOffset;
|
||||
|
||||
SAMPLER_STATE *dstSamplerState = nullptr;
|
||||
uint32_t samplerStateOffsetInDsh = 0;
|
||||
@ -44,27 +43,21 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
|
||||
dsh->align(EncodeStates<Family>::alignIndirectStatePointer);
|
||||
uint32_t borderColorOffsetInDsh = 0;
|
||||
if (!ApiSpecificConfig::getBindlessConfiguration()) {
|
||||
borderColorOffsetInDsh = static_cast<uint32_t>(dsh->getUsed());
|
||||
auto borderColor = dsh->getSpace(borderColorSize);
|
||||
|
||||
memcpy_s(borderColor, borderColorSize, ptrOffset(fnDynamicStateHeap, borderColorOffset),
|
||||
borderColorSize);
|
||||
|
||||
borderColorOffsetInDsh = dsh->getBorderColorOffset();
|
||||
if (borderColorOffsetInDsh == std::numeric_limits<uint32_t>::max()) {
|
||||
auto borderColor = Family::cmdInitBorderColor;
|
||||
dsh->setBorderColor(&borderColor, sizeof(borderColor));
|
||||
borderColorOffsetInDsh = dsh->getBorderColorOffset();
|
||||
}
|
||||
dsh->align(INTERFACE_DESCRIPTOR_DATA::SAMPLERSTATEPOINTER_ALIGN_SIZE);
|
||||
samplerStateOffsetInDsh = static_cast<uint32_t>(dsh->getUsed());
|
||||
|
||||
dstSamplerState = reinterpret_cast<SAMPLER_STATE *>(dsh->getSpace(sizeSamplerState));
|
||||
} else {
|
||||
auto borderColor = reinterpret_cast<const SAMPLER_BORDER_COLOR_STATE *>(ptrOffset(fnDynamicStateHeap, borderColorOffset));
|
||||
if (borderColor->getBorderColorRed() != 0.0f ||
|
||||
borderColor->getBorderColorGreen() != 0.0f ||
|
||||
borderColor->getBorderColorBlue() != 0.0f ||
|
||||
(borderColor->getBorderColorAlpha() != 0.0f && borderColor->getBorderColorAlpha() != 1.0f)) {
|
||||
UNRECOVERABLE_IF(true);
|
||||
} else if (borderColor->getBorderColorAlpha() == 0.0f) {
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getDefaultBorderColorOffset();
|
||||
} else {
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getAlphaBorderColorOffset();
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getBorderColorOffset();
|
||||
if (borderColorOffsetInDsh == std::numeric_limits<uint32_t>::max()) {
|
||||
auto borderColor = Family::cmdInitBorderColor;
|
||||
bindlessHeapHelper->setBorderColor(&borderColor, sizeof(borderColor));
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getBorderColorOffset();
|
||||
}
|
||||
dsh->align(INTERFACE_DESCRIPTOR_DATA::SAMPLERSTATEPOINTER_ALIGN_SIZE);
|
||||
auto samplerStateInDsh = bindlessHeapHelper->allocateSSInHeap(sizeSamplerState, nullptr, BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -189,4 +189,5 @@ const Family::MI_USER_INTERRUPT Family::cmdInitUserInterrupt = Family::MI_USER_I
|
||||
const Family::XY_SRC_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_SRC_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
@ -84,6 +84,7 @@ struct ICLFamily : public GEN11 {
|
||||
static const XY_SRC_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
@ -194,4 +194,5 @@ const Family::L3_CONTROL Family::cmdInitL3ControlWithPostSync = Family::L3_CONTR
|
||||
const Family::XY_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_FAST_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_FAST_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
@ -90,6 +90,7 @@ struct TGLLPFamily : public GEN12LP {
|
||||
static const XY_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_FAST_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -68,4 +68,5 @@ const Family::MI_USER_INTERRUPT Family::cmdInitUserInterrupt = Family::MI_USER_I
|
||||
const Family::XY_SRC_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_SRC_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
@ -85,6 +85,7 @@ struct BDWFamily : public GEN8 {
|
||||
static const XY_SRC_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -63,4 +63,5 @@ const Family::MI_USER_INTERRUPT Family::cmdInitUserInterrupt = Family::MI_USER_I
|
||||
const Family::XY_SRC_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_SRC_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
@ -86,6 +86,7 @@ struct SKLFamily : public GEN9 {
|
||||
static const XY_SRC_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
@ -14,7 +14,6 @@
|
||||
namespace NEO {
|
||||
|
||||
constexpr size_t globalSshAllocationSize = 4 * MemoryConstants::pageSize64k;
|
||||
constexpr size_t borderColorAlphaOffset = alignUp(4 * sizeof(float), MemoryConstants::cacheLineSize);
|
||||
using BindlesHeapType = BindlessHeapsHelper::BindlesHeapType;
|
||||
|
||||
BindlessHeapsHelper::BindlessHeapsHelper(MemoryManager *memManager, bool isMultiOsContextCapable, const uint32_t rootDeviceIndex) : memManager(memManager), isMultiOsContextCapable(isMultiOsContextCapable), rootDeviceIndex(rootDeviceIndex) {
|
||||
@ -28,10 +27,6 @@ BindlessHeapsHelper::BindlessHeapsHelper(MemoryManager *memManager, bool isMulti
|
||||
|
||||
borderColorStates = getHeapAllocation(MemoryConstants::pageSize, MemoryConstants::pageSize, true);
|
||||
UNRECOVERABLE_IF(borderColorStates == nullptr);
|
||||
float borderColorDefault[4] = {0, 0, 0, 0};
|
||||
memcpy_s(borderColorStates->getUnderlyingBuffer(), sizeof(borderColorDefault), borderColorDefault, sizeof(borderColorDefault));
|
||||
float borderColorAlpha[4] = {0, 0, 0, 1.0};
|
||||
memcpy_s(ptrOffset(borderColorStates->getUnderlyingBuffer(), borderColorAlphaOffset), sizeof(borderColorAlpha), borderColorAlpha, sizeof(borderColorDefault));
|
||||
}
|
||||
|
||||
BindlessHeapsHelper::~BindlessHeapsHelper() {
|
||||
@ -94,11 +89,12 @@ uint64_t BindlessHeapsHelper::getGlobalHeapsBase() {
|
||||
return surfaceStateHeaps[BindlesHeapType::GLOBAL_SSH]->getGraphicsAllocation()->getGpuBaseAddress();
|
||||
}
|
||||
|
||||
uint32_t BindlessHeapsHelper::getDefaultBorderColorOffset() {
|
||||
return static_cast<uint32_t>(borderColorStates->getGpuAddress() - borderColorStates->getGpuBaseAddress());
|
||||
uint32_t BindlessHeapsHelper::getBorderColorOffset() {
|
||||
return borderColorOffset;
|
||||
}
|
||||
uint32_t BindlessHeapsHelper::getAlphaBorderColorOffset() {
|
||||
return getDefaultBorderColorOffset() + borderColorAlphaOffset;
|
||||
void BindlessHeapsHelper::setBorderColor(void *borderColor, size_t size) {
|
||||
borderColorOffset = static_cast<uint32_t>(borderColorStates->getGpuAddress() - borderColorStates->getGpuBaseAddress());
|
||||
memcpy_s(borderColorStates->getUnderlyingBuffer(), borderColorStates->getUnderlyingBufferSize(), borderColor, size);
|
||||
}
|
||||
|
||||
IndirectHeap *BindlessHeapsHelper::getHeap(BindlesHeapType heapType) {
|
||||
|
@ -44,8 +44,8 @@ class BindlessHeapsHelper {
|
||||
SurfaceStateInHeapInfo allocateSSInHeap(size_t ssSize, GraphicsAllocation *surfaceAllocation, BindlesHeapType heapType);
|
||||
uint64_t getGlobalHeapsBase();
|
||||
void *getSpaceInHeap(size_t ssSize, BindlesHeapType heapType);
|
||||
uint32_t getDefaultBorderColorOffset();
|
||||
uint32_t getAlphaBorderColorOffset();
|
||||
uint32_t getBorderColorOffset();
|
||||
void setBorderColor(void *borderColor, size_t size);
|
||||
IndirectHeap *getHeap(BindlesHeapType heapType);
|
||||
void placeSSAllocationInReuseVectorOnFreeMemory(GraphicsAllocation *gfxAllocation);
|
||||
|
||||
@ -54,6 +54,7 @@ class BindlessHeapsHelper {
|
||||
MemoryManager *memManager = nullptr;
|
||||
bool isMultiOsContextCapable = false;
|
||||
const uint32_t rootDeviceIndex;
|
||||
uint32_t borderColorOffset = std::numeric_limits<uint32_t>::max();
|
||||
std::unique_ptr<IndirectHeap> surfaceStateHeaps[BindlesHeapType::NUM_HEAP_TYPES];
|
||||
GraphicsAllocation *borderColorStates;
|
||||
std::vector<GraphicsAllocation *> ssHeapsAllocations;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -11,6 +11,7 @@
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
|
||||
namespace NEO {
|
||||
@ -44,9 +45,12 @@ class IndirectHeap : public LinearStream {
|
||||
uint64_t getHeapGpuStartOffset() const;
|
||||
uint64_t getHeapGpuBase() const;
|
||||
uint32_t getHeapSizeInPages() const;
|
||||
uint32_t getBorderColorOffset() const;
|
||||
void setBorderColor(void *borderColor, size_t size);
|
||||
|
||||
protected:
|
||||
bool canBeUtilizedAs4GbHeap = false;
|
||||
uint32_t borderColorOffset = std::numeric_limits<uint32_t>::max();
|
||||
};
|
||||
|
||||
inline void IndirectHeap::align(size_t alignment) {
|
||||
@ -77,4 +81,13 @@ inline uint64_t IndirectHeap::getHeapGpuBase() const {
|
||||
return this->graphicsAllocation->getGpuAddress();
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t IndirectHeap::getBorderColorOffset() const {
|
||||
return borderColorOffset;
|
||||
}
|
||||
inline void IndirectHeap::setBorderColor(void *borderColor, size_t size) {
|
||||
borderColorOffset = static_cast<uint32_t>(getUsed());
|
||||
auto ptr = getSpace(size);
|
||||
memcpy_s(ptr, size, borderColor, size);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -110,17 +110,17 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocatio
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetCalledThenCorrectOffsetReturned) {
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetWithoutSettingThenMaxUintReturned) {
|
||||
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress();
|
||||
EXPECT_EQ(bindlessHeapHelper->getDefaultBorderColorOffset(), expectedOffset);
|
||||
auto expectedOffset = std::numeric_limits<uint32_t>::max();
|
||||
EXPECT_EQ(bindlessHeapHelper->getBorderColorOffset(), expectedOffset);
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetAlphaBorderColorOffsetCalledThenCorrectOffsetReturned) {
|
||||
auto borderColorSize = 0x40;
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetAfterSettingThenCorrectOffsetReturned) {
|
||||
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + borderColorSize;
|
||||
EXPECT_EQ(bindlessHeapHelper->getAlphaBorderColorOffset(), expectedOffset);
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress();
|
||||
bindlessHeapHelper->setBorderColor(nullptr, 0);
|
||||
EXPECT_EQ(bindlessHeapHelper->getBorderColorOffset(), expectedOffset);
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialHeapThenOffsetLessThanFrontWindowSize) {
|
||||
|
@ -33,7 +33,7 @@ HWTEST_F(CommandEncodeStatesTest, GivenCommandStreamWhenEncodeCopySamplerStateTh
|
||||
}
|
||||
using BindlessCommandEncodeStatesTest = Test<MemManagerFixture>;
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithoutAlphaThenBorderColorPtrReturned) {
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenCopySamplerStateThenBorderSetCorrectly) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
@ -41,99 +41,34 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
uint32_t borderColorSize = 0;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getDefaultBorderColorOffset();
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getBorderColorOffset();
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), expectedValue);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithAlphaThenBorderColorPtrOffseted) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenCopySamplerStateCalledTwiceThenTheSameIndirectPointerIsSet) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
SAMPLER_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(1.0);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getAlphaBorderColorOffset();
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), expectedValue);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRedChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorRed(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGreenChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorGreen(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBlueChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorBlue(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAlphaChanelIsNotZeroOrOneThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
auto pSmplr1 = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
auto pSmplr2 = reinterpret_cast<SAMPLER_STATE *>(ptrOffset(dsh->getGraphicsAllocation()->getUnderlyingBuffer(), static_cast<uint32_t>(alignUp(sizeof(samplerState), EncodeStates<FamilyType>::alignIndirectStatePointer))));
|
||||
EXPECT_EQ(pSmplr1->getIndirectStatePointer(), pSmplr2->getIndirectStatePointer());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenUseAllocationAsInput) {
|
||||
|
Reference in New Issue
Block a user