turnip: implement VK_EXT_sampler_filter_minmax

Passes dEQP-VK.pipeline.sampler.view_type.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4662>
This commit is contained in:
Jonathan Marek 2020-04-20 17:54:36 -04:00 committed by Marge Bot
parent a77e2ac835
commit c552b5fd1d
4 changed files with 26 additions and 2 deletions

View File

@ -3307,6 +3307,12 @@ to upconvert to 32b float internally?
<value name="A6XX_TEX_ANISO_8" value="3"/>
<value name="A6XX_TEX_ANISO_16" value="4"/>
</enum>
<enum name="a6xx_reduction_mode">
<value name="A6XX_REDUCTION_MODE_AVERAGE" value="0"/>
<value name="A6XX_REDUCTION_MODE_MIN" value="1"/>
<value name="A6XX_REDUCTION_MODE_MAX" value="2"/>
</enum>
<reg32 offset="0" name="0">
<bitfield name="MIPFILTER_LINEAR_NEAR" pos="0" type="boolean"/>
<bitfield name="XY_MAG" low="1" high="2" type="a6xx_tex_filter"/>
@ -3326,7 +3332,8 @@ to upconvert to 32b float internally?
<bitfield name="MIN_LOD" low="20" high="31" type="ufixed" radix="8"/>
</reg32>
<reg32 offset="2" name="2">
<bitfield name="BCOLOR_OFFSET" low="0" high="31"/>
<bitfield name="REDUCTION_MODE" low="0" high="1" type="a6xx_reduction_mode"/>
<bitfield name="BCOLOR_OFFSET" low="7" high="31" shr="7"/>
</reg32>
<reg32 offset="3" name="3"/>
</domain>

View File

@ -943,6 +943,13 @@ tu_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
properties->variableSampleLocations = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES: {
VkPhysicalDeviceSamplerFilterMinmaxProperties *properties =
(VkPhysicalDeviceSamplerFilterMinmaxProperties *)ext;
properties->filterMinmaxImageComponentMapping = true;
properties->filterMinmaxSingleComponentFormats = true;
break;
}
default:
break;
@ -2112,6 +2119,9 @@ tu_init_sampler(struct tu_device *device,
struct tu_sampler *sampler,
const VkSamplerCreateInfo *pCreateInfo)
{
const struct VkSamplerReductionModeCreateInfo *reduction =
vk_find_struct_const(pCreateInfo->pNext, SAMPLER_REDUCTION_MODE_CREATE_INFO);
unsigned aniso = pCreateInfo->anisotropyEnable ?
util_last_bit(MIN2((uint32_t)pCreateInfo->maxAnisotropy >> 1, 8)) : 0;
bool miplinear = (pCreateInfo->mipmapMode == VK_SAMPLER_MIPMAP_MODE_LINEAR);
@ -2141,6 +2151,11 @@ tu_init_sampler(struct tu_device *device,
sizeof(struct bcolor_entry));
sampler->descriptor[3] = 0;
if (reduction) {
/* note: vulkan enum matches hw */
sampler->descriptor[2] |= A6XX_TEX_SAMP_2_REDUCTION_MODE(reduction->reductionMode);
}
/* TODO:
* A6XX_TEX_SAMP_1_MIPFILTER_LINEAR_FAR disables mipmapping, but vk has no NONE mipfilter?
*/

View File

@ -78,6 +78,7 @@ EXTENSIONS = [
Extension('VK_EXT_external_memory_dma_buf', 1, True),
Extension('VK_EXT_image_drm_format_modifier', 1, False),
Extension('VK_EXT_sample_locations', 1, 'device->gpu_id == 650'),
Extension('VK_EXT_sampler_filter_minmax', 1, True),
Extension('VK_EXT_transform_feedback', 1, True),
Extension('VK_ANDROID_native_buffer', 1, True),
Extension('VK_KHR_external_semaphore_fd', 1, True),

View File

@ -382,7 +382,8 @@ tu_physical_device_get_format_properties(
optimal |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT;
buffer |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
if (physical_device->supported_extensions.EXT_filter_cubic)