Browse Source

anv: add VK_EXT_sampler_filter_minmax support

This extension can be supported on SKL+. With this patch,
all corresponding tests (6K+) in CTS can pass. No test fails.

I verified CTS with the command below:
deqp-vk --deqp-case=dEQP-VK.pipeline.sampler.view_type.*reduce*

v2: 1) support all depth formats, not depth-only formats, 2) fix
a wrong indention (Jason).

v3: fix a few nits (Lionel).

v4: fix failures in CI: disable sampler reduction when sampler
reduction mode is not specified via this extension (Lionel).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
tags/18.3-branchpoint
Yunchao He 7 years ago
parent
commit
bea4d4c78c

+ 8
- 0
src/intel/vulkan/anv_device.c View File

break; break;
} }


case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT: {
VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT *properties =
(VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT *)ext;
properties->filterMinmaxImageComponentMapping = pdevice->info.gen >= 9;
properties->filterMinmaxSingleComponentFormats = true;
break;
}

case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: {
VkPhysicalDeviceSubgroupProperties *properties = (void *)ext; VkPhysicalDeviceSubgroupProperties *properties = (void *)ext;



+ 1
- 0
src/intel/vulkan/anv_extensions.py View File

Extension('VK_EXT_shader_stencil_export', 1, 'device->info.gen >= 9'), Extension('VK_EXT_shader_stencil_export', 1, 'device->info.gen >= 9'),
Extension('VK_EXT_vertex_attribute_divisor', 2, True), Extension('VK_EXT_vertex_attribute_divisor', 2, True),
Extension('VK_EXT_post_depth_coverage', 1, 'device->info.gen >= 9'), Extension('VK_EXT_post_depth_coverage', 1, 'device->info.gen >= 9'),
Extension('VK_EXT_sampler_filter_minmax', 1, 'device->info.gen >= 9'),
] ]


class VkVersion: class VkVersion:

+ 6
- 0
src/intel/vulkan/anv_formats.c View File

if (aspects == VK_IMAGE_ASPECT_DEPTH_BIT || devinfo->gen >= 8) if (aspects == VK_IMAGE_ASPECT_DEPTH_BIT || devinfo->gen >= 8)
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;


if ((aspects & VK_IMAGE_ASPECT_DEPTH_BIT) && devinfo->gen >= 9)
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT;

flags |= VK_FORMAT_FEATURE_BLIT_SRC_BIT | flags |= VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR |
if (isl_format_supports_sampling(devinfo, plane_format.isl_format)) { if (isl_format_supports_sampling(devinfo, plane_format.isl_format)) {
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;


if (devinfo->gen >= 9)
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT;

if (isl_format_supports_filtering(devinfo, plane_format.isl_format)) if (isl_format_supports_filtering(devinfo, plane_format.isl_format))
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
} }

+ 28
- 0
src/intel/vulkan/genX_state.c View File

[VK_COMPARE_OP_ALWAYS] = PREFILTEROPNEVER, [VK_COMPARE_OP_ALWAYS] = PREFILTEROPNEVER,
}; };


#if GEN_GEN >= 9
static const uint32_t vk_to_gen_sampler_reduction_mode[] = {
[VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT] = STD_FILTER,
[VK_SAMPLER_REDUCTION_MODE_MIN_EXT] = MINIMUM,
[VK_SAMPLER_REDUCTION_MODE_MAX_EXT] = MAXIMUM,
};
#endif

VkResult genX(CreateSampler)( VkResult genX(CreateSampler)(
VkDevice _device, VkDevice _device,
const VkSamplerCreateInfo* pCreateInfo, const VkSamplerCreateInfo* pCreateInfo,
uint32_t border_color_offset = device->border_colors.offset + uint32_t border_color_offset = device->border_colors.offset +
pCreateInfo->borderColor * 64; pCreateInfo->borderColor * 64;


#if GEN_GEN >= 9
unsigned sampler_reduction_mode = STD_FILTER;
bool enable_sampler_reduction = false;
#endif

vk_foreach_struct(ext, pCreateInfo->pNext) { vk_foreach_struct(ext, pCreateInfo->pNext) {
switch (ext->sType) { switch (ext->sType) {
case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: { case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: {
sampler->conversion = conversion; sampler->conversion = conversion;
break; break;
} }
#if GEN_GEN >= 9
case VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT: {
struct VkSamplerReductionModeCreateInfoEXT *sampler_reduction =
(struct VkSamplerReductionModeCreateInfoEXT *) ext;
sampler_reduction_mode =
vk_to_gen_sampler_reduction_mode[sampler_reduction->reductionMode];
enable_sampler_reduction = true;
break;
}
#endif
default: default:
anv_debug_ignored_stype(ext->sType); anv_debug_ignored_stype(ext->sType);
break; break;
.TCXAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeU], .TCXAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeU],
.TCYAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeV], .TCYAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeV],
.TCZAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeW], .TCZAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeW],

#if GEN_GEN >= 9
.ReductionType = sampler_reduction_mode,
.ReductionTypeEnable = enable_sampler_reduction,
#endif
}; };


GENX(SAMPLER_STATE_pack)(NULL, sampler->state[p], &sampler_state); GENX(SAMPLER_STATE_pack)(NULL, sampler->state[p], &sampler_state);

Loading…
Cancel
Save