refactor: move depth limitation from release helper to image_hw

Related-To: NEO-8390, HSD-16021488507
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2024-11-19 14:58:41 +00:00
committed by Compute-Runtime-Automation
parent d8ac8641e5
commit 46c345789d
25 changed files with 30 additions and 113 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2023 Intel Corporation
# Copyright (C) 2018-2024 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -14,6 +14,7 @@ set(RUNTIME_SRCS_MEM_OBJ
${CMAKE_CURRENT_SOURCE_DIR}/image.h
${CMAKE_CURRENT_SOURCE_DIR}/image.inl
${CMAKE_CURRENT_SOURCE_DIR}/image_tgllp_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/image_xe2_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/image_factory_init.inl
${CMAKE_CURRENT_SOURCE_DIR}/map_operations_handler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/map_operations_handler.h

View File

@@ -346,7 +346,7 @@ class ImageHw : public Image {
void appendSurfaceStateExt(void *memory);
void transformImage2dArrayTo3d(void *memory) override;
void transformImage3dTo2dArray(void *memory) override;
static void adjustDepthLimitations(RENDER_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv, ReleaseHelper *releaseHelper);
static void adjustDepthLimitations(RENDER_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv);
static Image *create(Context *context,
const MemoryProperties &memoryProperties,
cl_mem_flags flags,

View File

@@ -100,9 +100,8 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
appendSurfaceStateDepthParams(surfaceState, gmm);
EncodeSurfaceState<GfxFamily>::appendImageCompressionParams(surfaceState, graphicsAllocation, gmmHelper, isImageFromBuffer(),
this->plane);
auto releaseHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getReleaseHelper();
adjustDepthLimitations(surfaceState, minArrayElement, renderTargetViewExtent, depth, mipCount, is3DUAVOrRTV, releaseHelper);
adjustDepthLimitations(surfaceState, minArrayElement, renderTargetViewExtent, depth, mipCount, is3DUAVOrRTV);
appendSurfaceStateParams(surfaceState, rootDeviceIndex);
appendSurfaceStateExt(surfaceState);
}
@@ -212,11 +211,7 @@ void ImageHw<GfxFamily>::transformImage3dTo2dArray(void *memory) {
}
template <typename GfxFamily>
void ImageHw<GfxFamily>::adjustDepthLimitations(RENDER_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv, ReleaseHelper *releaseHelper) {
if (is3DUavOrRtv && releaseHelper && releaseHelper->shouldAdjustDepth()) {
auto newDepth = std::min(depth, (renderTargetViewExtent + minArrayElement) << mipCount);
surfaceState->setDepth(newDepth);
}
void ImageHw<GfxFamily>::adjustDepthLimitations(RENDER_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv) {
}
template <typename GfxFamily>

View File

@@ -0,0 +1,18 @@
/*
* Copyright (C) 2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/mem_obj/image.h"
namespace NEO {
template <>
void ImageHw<Family>::adjustDepthLimitations(RENDER_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv) {
if (is3DUavOrRtv) {
auto newDepth = std::min(depth, (renderTargetViewExtent + minArrayElement) << mipCount);
surfaceState->setDepth(newDepth);
}
}
} // namespace NEO

View File

@@ -16,6 +16,7 @@ static auto gfxCore = IGFX_XE2_HPG_CORE;
} // namespace NEO
#include "opencl/source/mem_obj/image_tgllp_and_later.inl"
#include "opencl/source/mem_obj/image_xe2_and_later.inl"
// factory initializer
#include "opencl/source/mem_obj/image_factory_init.inl"