gen8_state: Clamp sampler values to HW limitations
This commit is contained in:
parent
48228c114e
commit
1d42f773d3
|
@ -100,6 +100,19 @@ anv_minify(uint32_t n, uint32_t levels)
|
|||
return MAX(n >> levels, 1);
|
||||
}
|
||||
|
||||
static inline float
|
||||
anv_clamp_f(float f, float min, float max)
|
||||
{
|
||||
assert(min < max);
|
||||
|
||||
if (f > max)
|
||||
return max;
|
||||
else if (f < min)
|
||||
return min;
|
||||
else
|
||||
return f;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
anv_clear_mask(uint32_t *inout_mask, uint32_t clear_mask)
|
||||
{
|
||||
|
|
|
@ -316,10 +316,10 @@ VkResult gen8_CreateSampler(
|
|||
.MipModeFilter = vk_to_gen_mipmap_mode[pCreateInfo->mipMode],
|
||||
.MagModeFilter = mag_filter,
|
||||
.MinModeFilter = min_filter,
|
||||
.TextureLODBias = pCreateInfo->mipLodBias * 256,
|
||||
.TextureLODBias = anv_clamp_f(pCreateInfo->mipLodBias, -16, 15.996),
|
||||
.AnisotropicAlgorithm = EWAApproximation,
|
||||
.MinLOD = pCreateInfo->minLod,
|
||||
.MaxLOD = pCreateInfo->maxLod,
|
||||
.MinLOD = anv_clamp_f(pCreateInfo->minLod, 0, 14),
|
||||
.MaxLOD = anv_clamp_f(pCreateInfo->maxLod, 0, 14),
|
||||
.ChromaKeyEnable = 0,
|
||||
.ChromaKeyIndex = 0,
|
||||
.ChromaKeyMode = 0,
|
||||
|
|
Loading…
Reference in New Issue