OSDN Git Service

anv/state: enable coordinate address rounding for Min/Mag filters
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 18 Nov 2016 12:44:27 +0000 (13:44 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 21 Nov 2016 07:01:54 +0000 (08:01 +0100)
This patch improves pass rate of dEQP-VK.texture.explicit_lod.2d.sizes.*
from 68.0% (98/144) to 83.3% (120/144) by enabling sampler address
rounding mode when the selected filter is not nearest, which is the same
thing we do for OpenGL.

These tests check texture filtering for various texture sizes and mipmap
levels. The failures (without this patch) affect cases where the target
texture has odd dimensions (like 57x35) and either the Min or the Mag filter
is not nearest.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/genX_state.c

index be1bd78..4122395 100644 (file)
@@ -167,6 +167,11 @@ VkResult genX(CreateSampler)(
    uint32_t border_color_offset = device->border_colors.offset +
                                   pCreateInfo->borderColor * 64;
 
+   bool enable_min_filter_addr_rounding =
+      pCreateInfo->minFilter != VK_FILTER_NEAREST;
+   bool enable_mag_filter_addr_rounding =
+      pCreateInfo->magFilter != VK_FILTER_NEAREST;
+
    struct GENX(SAMPLER_STATE) sampler_state = {
       .SamplerDisable = false,
       .TextureBorderColorMode = DX10OGL,
@@ -202,12 +207,12 @@ VkResult genX(CreateSampler)(
 #endif
 
       .MaximumAnisotropy = vk_to_gen_max_anisotropy(pCreateInfo->maxAnisotropy),
-      .RAddressMinFilterRoundingEnable = 0,
-      .RAddressMagFilterRoundingEnable = 0,
-      .VAddressMinFilterRoundingEnable = 0,
-      .VAddressMagFilterRoundingEnable = 0,
-      .UAddressMinFilterRoundingEnable = 0,
-      .UAddressMagFilterRoundingEnable = 0,
+      .RAddressMinFilterRoundingEnable = enable_min_filter_addr_rounding,
+      .RAddressMagFilterRoundingEnable = enable_mag_filter_addr_rounding,
+      .VAddressMinFilterRoundingEnable = enable_min_filter_addr_rounding,
+      .VAddressMagFilterRoundingEnable = enable_mag_filter_addr_rounding,
+      .UAddressMinFilterRoundingEnable = enable_min_filter_addr_rounding,
+      .UAddressMagFilterRoundingEnable = enable_mag_filter_addr_rounding,
       .TrilinearFilterQuality = 0,
       .NonnormalizedCoordinateEnable = pCreateInfo->unnormalizedCoordinates,
       .TCXAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeU],