mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
turnip: implement VK_EXT_filter_cubic
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4672>
This commit is contained in:
parent
a92d2e1109
commit
9daeb50454
4 changed files with 40 additions and 6 deletions
|
|
@ -3291,6 +3291,7 @@ to upconvert to 32b float internally?
|
|||
<value name="A6XX_TEX_NEAREST" value="0"/>
|
||||
<value name="A6XX_TEX_LINEAR" value="1"/>
|
||||
<value name="A6XX_TEX_ANISO" value="2"/>
|
||||
<value name="A6XX_TEX_CUBIC" value="3"/> <!-- a650 only -->
|
||||
</enum>
|
||||
<enum name="a6xx_tex_clamp"> <!-- same as a4xx? -->
|
||||
<value name="A6XX_TEX_REPEAT" value="0"/>
|
||||
|
|
|
|||
|
|
@ -2093,7 +2093,8 @@ tu6_tex_filter(VkFilter filter, unsigned aniso)
|
|||
return A6XX_TEX_NEAREST;
|
||||
case VK_FILTER_LINEAR:
|
||||
return aniso ? A6XX_TEX_ANISO : A6XX_TEX_LINEAR;
|
||||
case VK_FILTER_CUBIC_IMG:
|
||||
case VK_FILTER_CUBIC_EXT:
|
||||
return A6XX_TEX_CUBIC;
|
||||
default:
|
||||
unreachable("illegal texture filter");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ EXTENSIONS = [
|
|||
Extension('VK_ANDROID_native_buffer', 1, True),
|
||||
Extension('VK_KHR_external_semaphore_fd', 1, True),
|
||||
Extension('VK_KHR_external_fence_fd', 1, True),
|
||||
Extension('VK_IMG_filter_cubic', 1, 'device->gpu_id == 650'),
|
||||
Extension('VK_EXT_filter_cubic', 1, 'device->gpu_id == 650'),
|
||||
]
|
||||
|
||||
class VkVersion:
|
||||
|
|
|
|||
|
|
@ -384,6 +384,9 @@ tu_physical_device_get_format_properties(
|
|||
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
|
||||
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
|
||||
buffer |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
|
||||
|
||||
if (physical_device->supported_extensions.EXT_filter_cubic)
|
||||
optimal |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT;
|
||||
}
|
||||
|
||||
if (native_fmt.supported & FMT_COLOR) {
|
||||
|
|
@ -457,8 +460,8 @@ static VkResult
|
|||
tu_get_image_format_properties(
|
||||
struct tu_physical_device *physical_device,
|
||||
const VkPhysicalDeviceImageFormatInfo2 *info,
|
||||
VkImageFormatProperties *pImageFormatProperties)
|
||||
|
||||
VkImageFormatProperties *pImageFormatProperties,
|
||||
VkFormatFeatureFlags *p_feature_flags)
|
||||
{
|
||||
VkFormatProperties format_props;
|
||||
VkFormatFeatureFlags format_feature_flags;
|
||||
|
|
@ -580,6 +583,9 @@ tu_get_image_format_properties(
|
|||
.maxResourceSize = UINT32_MAX,
|
||||
};
|
||||
|
||||
if (p_feature_flags)
|
||||
*p_feature_flags = format_feature_flags;
|
||||
|
||||
return VK_SUCCESS;
|
||||
unsupported:
|
||||
*pImageFormatProperties = (VkImageFormatProperties) {
|
||||
|
|
@ -616,7 +622,7 @@ tu_GetPhysicalDeviceImageFormatProperties(
|
|||
};
|
||||
|
||||
return tu_get_image_format_properties(physical_device, &info,
|
||||
pImageFormatProperties);
|
||||
pImageFormatProperties, NULL);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
@ -683,11 +689,14 @@ tu_GetPhysicalDeviceImageFormatProperties2(
|
|||
{
|
||||
TU_FROM_HANDLE(tu_physical_device, physical_device, physicalDevice);
|
||||
const VkPhysicalDeviceExternalImageFormatInfo *external_info = NULL;
|
||||
const VkPhysicalDeviceImageViewImageFormatInfoEXT *image_view_info = NULL;
|
||||
VkExternalImageFormatProperties *external_props = NULL;
|
||||
VkFilterCubicImageViewImageFormatPropertiesEXT *cubic_props = NULL;
|
||||
VkFormatFeatureFlags format_feature_flags;
|
||||
VkResult result;
|
||||
|
||||
result = tu_get_image_format_properties(
|
||||
physical_device, base_info, &base_props->imageFormatProperties);
|
||||
result = tu_get_image_format_properties(physical_device,
|
||||
base_info, &base_props->imageFormatProperties, &format_feature_flags);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
|
|
@ -698,6 +707,9 @@ tu_GetPhysicalDeviceImageFormatProperties2(
|
|||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO:
|
||||
external_info = (const void *) s;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT:
|
||||
image_view_info = (const void *) s;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -710,6 +722,9 @@ tu_GetPhysicalDeviceImageFormatProperties2(
|
|||
case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES:
|
||||
external_props = (void *) s;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT:
|
||||
cubic_props = (void *) s;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -729,6 +744,21 @@ tu_GetPhysicalDeviceImageFormatProperties2(
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (cubic_props) {
|
||||
/* note: blob only allows cubic filtering for 2D and 2D array views
|
||||
* its likely we can enable it for 1D and CUBE, needs testing however
|
||||
*/
|
||||
if ((image_view_info->imageViewType == VK_IMAGE_VIEW_TYPE_2D ||
|
||||
image_view_info->imageViewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY) &&
|
||||
(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT)) {
|
||||
cubic_props->filterCubic = true;
|
||||
cubic_props->filterCubicMinmax = true;
|
||||
} else {
|
||||
cubic_props->filterCubic = false;
|
||||
cubic_props->filterCubicMinmax = false;
|
||||
}
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue