Revert "Use correct enum values for sampler in clamp mode"

This reverts commit c8737c6b4b3c67a81f7b4d1ea0918a5f9daac87d.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2021-12-22 21:45:00 +00:00
committed by Compute-Runtime-Automation
parent 896e01c1cb
commit 7364288ed9
8 changed files with 41 additions and 81 deletions

View File

@@ -32,7 +32,6 @@
#include "level_zero/core/source/driver/driver_handle_imp.h"
#include "level_zero/core/source/image/image.h"
#include "level_zero/core/source/image/image_format_desc_helper.h"
#include "level_zero/core/source/kernel/sampler_patch_values.h"
#include "level_zero/core/source/module/module.h"
#include "level_zero/core/source/module/module_imp.h"
#include "level_zero/core/source/printf_handler/printf_handler.h"
@@ -41,6 +40,35 @@
#include <memory>
namespace L0 {
enum class SamplerPatchValues : uint32_t {
DefaultSampler = 0x00,
AddressNone = 0x00,
AddressClamp = 0x01,
AddressClampToEdge = 0x02,
AddressRepeat = 0x03,
AddressMirroredRepeat = 0x04,
AddressMirroredRepeat101 = 0x05,
NormalizedCoordsFalse = 0x00,
NormalizedCoordsTrue = 0x08
};
inline SamplerPatchValues getAddrMode(ze_sampler_address_mode_t addressingMode) {
switch (addressingMode) {
case ZE_SAMPLER_ADDRESS_MODE_REPEAT:
return SamplerPatchValues::AddressRepeat;
case ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER:
return SamplerPatchValues::AddressClampToEdge;
case ZE_SAMPLER_ADDRESS_MODE_CLAMP:
return SamplerPatchValues::AddressClamp;
case ZE_SAMPLER_ADDRESS_MODE_NONE:
return SamplerPatchValues::AddressNone;
case ZE_SAMPLER_ADDRESS_MODE_MIRROR:
return SamplerPatchValues::AddressMirroredRepeat;
default:
DEBUG_BREAK_IF(true);
}
return SamplerPatchValues::AddressNone;
}
KernelImmutableData::KernelImmutableData(L0::Device *l0device) : device(l0device) {}
@@ -653,7 +681,7 @@ ze_result_t KernelImp::setArgSampler(uint32_t argIndex, size_t argSize, const vo
auto samplerDesc = sampler->getSamplerDesc();
NEO::patchNonPointer<uint32_t>(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize), arg.metadataPayload.samplerSnapWa, (samplerDesc.addressMode == ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER && samplerDesc.filterMode == ZE_SAMPLER_FILTER_MODE_NEAREST) ? std::numeric_limits<uint32_t>::max() : 0u);
NEO::patchNonPointer<uint32_t>(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize), arg.metadataPayload.samplerSnapWa, (samplerDesc.addressMode == ZE_SAMPLER_ADDRESS_MODE_CLAMP && samplerDesc.filterMode == ZE_SAMPLER_FILTER_MODE_NEAREST) ? std::numeric_limits<uint32_t>::max() : 0u);
NEO::patchNonPointer<uint32_t>(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize), arg.metadataPayload.samplerAddressingMode, static_cast<uint32_t>(getAddrMode(samplerDesc.addressMode)));
NEO::patchNonPointer<uint32_t>(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize), arg.metadataPayload.samplerNormalizedCoords, samplerDesc.isNormalized ? static_cast<uint32_t>(SamplerPatchValues::NormalizedCoordsTrue) : static_cast<uint32_t>(SamplerPatchValues::NormalizedCoordsFalse));

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/debug_helpers.h"
#include <level_zero/ze_api.h>
namespace L0 {
enum class SamplerPatchValues : uint32_t {
DefaultSampler = 0x00,
AddressNone = 0x00,
AddressClampToBorder = 0x01,
AddressClampToEdge = 0x02,
AddressRepeat = 0x03,
AddressMirroredRepeat = 0x04,
AddressMirroredRepeat101 = 0x05,
NormalizedCoordsFalse = 0x00,
NormalizedCoordsTrue = 0x08
};
inline SamplerPatchValues getAddrMode(ze_sampler_address_mode_t addressingMode) {
switch (addressingMode) {
case ZE_SAMPLER_ADDRESS_MODE_REPEAT:
return SamplerPatchValues::AddressRepeat;
case ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER:
return SamplerPatchValues::AddressClampToBorder;
case ZE_SAMPLER_ADDRESS_MODE_CLAMP:
return SamplerPatchValues::AddressClampToEdge;
case ZE_SAMPLER_ADDRESS_MODE_NONE:
return SamplerPatchValues::AddressNone;
case ZE_SAMPLER_ADDRESS_MODE_MIRROR:
return SamplerPatchValues::AddressMirroredRepeat;
default:
DEBUG_BREAK_IF(true);
}
return SamplerPatchValues::AddressNone;
}
} // namespace L0