aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2020-04-21 22:01:03 -0400
committerMarge Bot <[email protected]>2020-04-22 19:03:58 +0000
commit9daeb504543ccf3851ed058a860ada7d84de6f22 (patch)
tree6fd9013cec063cac30b99c847ba602da0a525caf /src
parenta92d2e11095d9f1f8bc1188fd3d2b8391acc4591 (diff)
turnip: implement VK_EXT_filter_cubic
Signed-off-by: Jonathan Marek <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4672>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/registers/a6xx.xml1
-rw-r--r--src/freedreno/vulkan/tu_device.c3
-rw-r--r--src/freedreno/vulkan/tu_extensions.py2
-rw-r--r--src/freedreno/vulkan/tu_formats.c40
4 files changed, 40 insertions, 6 deletions
diff --git a/src/freedreno/registers/a6xx.xml b/src/freedreno/registers/a6xx.xml
index a2bda8aee10..5d6ddcf1785 100644
--- a/src/freedreno/registers/a6xx.xml
+++ b/src/freedreno/registers/a6xx.xml
@@ -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"/>
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 73c264417eb..77794eb3733 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -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;
diff --git a/src/freedreno/vulkan/tu_extensions.py b/src/freedreno/vulkan/tu_extensions.py
index 498b38613b6..e003ea70252 100644
--- a/src/freedreno/vulkan/tu_extensions.py
+++ b/src/freedreno/vulkan/tu_extensions.py
@@ -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:
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index d4100760032..3195baca6c4 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -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: