summaryrefslogtreecommitdiffstats
path: root/src/vulkan/gen8_state.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-01-06 19:48:57 -0800
committerJason Ekstrand <[email protected]>2016-01-14 07:30:46 -0800
commited4fe3e9ba9018e68afe6fdd4f267218a537fdaa (patch)
treeb688ea318d32ac49700c21131465f2b41b838ba0 /src/vulkan/gen8_state.c
parent8a81d136f833ca2fda27438d0b16d3aed7c78746 (diff)
anv/state: Respect SamplerCreateInfo.anisotropyEnable
Diffstat (limited to 'src/vulkan/gen8_state.c')
-rw-r--r--src/vulkan/gen8_state.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c
index 13b7e1149d9..b6741e005d3 100644
--- a/src/vulkan/gen8_state.c
+++ b/src/vulkan/gen8_state.c
@@ -363,7 +363,6 @@ VkResult genX(CreateSampler)(
{
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_sampler *sampler;
- uint32_t mag_filter, min_filter, max_anisotropy;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
@@ -372,15 +371,8 @@ VkResult genX(CreateSampler)(
if (!sampler)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- if (pCreateInfo->maxAnisotropy > 1) {
- mag_filter = MAPFILTER_ANISOTROPIC;
- min_filter = MAPFILTER_ANISOTROPIC;
- max_anisotropy = (pCreateInfo->maxAnisotropy - 2) / 2;
- } else {
- mag_filter = vk_to_gen_tex_filter[pCreateInfo->magFilter];
- min_filter = vk_to_gen_tex_filter[pCreateInfo->minFilter];
- max_anisotropy = RATIO21;
- }
+ uint32_t filter = vk_to_gen_tex_filter(pCreateInfo->magFilter,
+ pCreateInfo->anisotropyEnable);
struct GENX(SAMPLER_STATE) sampler_state = {
.SamplerDisable = false,
@@ -390,8 +382,8 @@ VkResult genX(CreateSampler)(
.BaseMipLevel = 0.0,
#endif
.MipModeFilter = vk_to_gen_mipmap_mode[pCreateInfo->mipmapMode],
- .MagModeFilter = mag_filter,
- .MinModeFilter = min_filter,
+ .MagModeFilter = filter,
+ .MinModeFilter = filter,
.TextureLODBias = anv_clamp_f(pCreateInfo->mipLodBias, -16, 15.996),
.AnisotropicAlgorithm = EWAApproximation,
.MinLOD = anv_clamp_f(pCreateInfo->minLod, 0, 14),
@@ -407,7 +399,7 @@ VkResult genX(CreateSampler)(
pCreateInfo->borderColor * sizeof(float) * 4,
.LODClampMagnificationMode = MIPNONE,
- .MaximumAnisotropy = max_anisotropy,
+ .MaximumAnisotropy = vk_to_gen_max_anisotropy(pCreateInfo->maxAnisotropy),
.RAddressMinFilterRoundingEnable = 0,
.RAddressMagFilterRoundingEnable = 0,
.VAddressMinFilterRoundingEnable = 0,