diff options
-rw-r--r-- | src/freedreno/vulkan/tu_device.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 5bf3d1d6c39..c471117e5ed 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -2186,6 +2186,8 @@ tu_init_sampler(struct tu_device *device, unsigned aniso = pCreateInfo->anisotropyEnable ? util_last_bit(MIN2((uint32_t)pCreateInfo->maxAnisotropy >> 1, 8)) : 0; bool miplinear = (pCreateInfo->mipmapMode == VK_SAMPLER_MIPMAP_MODE_LINEAR); + float min_lod = CLAMP(pCreateInfo->minLod, 0.0f, 4095.0f / 256.0f); + float max_lod = CLAMP(pCreateInfo->maxLod, 0.0f, 4095.0f / 256.0f); sampler->descriptor[0] = COND(miplinear, A6XX_TEX_SAMP_0_MIPFILTER_LINEAR_NEAR) | @@ -2199,8 +2201,8 @@ tu_init_sampler(struct tu_device *device, sampler->descriptor[1] = /* COND(!cso->seamless_cube_map, A6XX_TEX_SAMP_1_CUBEMAPSEAMLESSFILTOFF) | */ COND(pCreateInfo->unnormalizedCoordinates, A6XX_TEX_SAMP_1_UNNORM_COORDS) | - A6XX_TEX_SAMP_1_MIN_LOD(pCreateInfo->minLod) | - A6XX_TEX_SAMP_1_MAX_LOD(pCreateInfo->maxLod) | + A6XX_TEX_SAMP_1_MIN_LOD(min_lod) | + A6XX_TEX_SAMP_1_MAX_LOD(max_lod) | COND(pCreateInfo->compareEnable, A6XX_TEX_SAMP_1_COMPARE_FUNC(tu6_compare_func(pCreateInfo->compareOp))); /* This is an offset into the border_color BO, which we fill with all the |