Mesa (main): turnip: Switch tu6_format_texture() to a pipe_format.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Oct 21 09:15:39 UTC 2021
Module: Mesa
Branch: main
Commit: 3b68fc0c6a6caddd228755ae3d43ce92e0b1f807
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b68fc0c6a6caddd228755ae3d43ce92e0b1f807
Author: Emma Anholt <emma at anholt.net>
Date: Tue Oct 5 20:46:54 2021 -0700
turnip: Switch tu6_format_texture() to a pipe_format.
To handle Y8 specially, we want a PIPE_FORMAT instead of VK_FORMAT.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13379>
---
src/freedreno/vulkan/tu_clear_blit.c | 12 ++++++------
src/freedreno/vulkan/tu_formats.c | 15 +++++++--------
src/freedreno/vulkan/tu_image.c | 6 +++---
src/freedreno/vulkan/tu_private.h | 5 +++--
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/freedreno/vulkan/tu_clear_blit.c b/src/freedreno/vulkan/tu_clear_blit.c
index efb5f0ec6a2..bd350c0a3c3 100644
--- a/src/freedreno/vulkan/tu_clear_blit.c
+++ b/src/freedreno/vulkan/tu_clear_blit.c
@@ -183,7 +183,7 @@ r2d_src_buffer(struct tu_cmd_buffer *cmd,
uint64_t va, uint32_t pitch,
uint32_t width, uint32_t height)
{
- struct tu_native_format format = tu6_format_texture(vk_format, TILE6_LINEAR);
+ struct tu_native_format format = tu6_format_texture(tu_vk_format_to_pipe_format(vk_format), TILE6_LINEAR);
tu_cs_emit_regs(cs,
A6XX_SP_PS_2D_SRC_INFO(
@@ -873,7 +873,7 @@ r3d_src_buffer(struct tu_cmd_buffer *cmd,
{
uint32_t desc[A6XX_TEX_CONST_DWORDS];
- struct tu_native_format format = tu6_format_texture(vk_format, TILE6_LINEAR);
+ struct tu_native_format format = tu6_format_texture(tu_vk_format_to_pipe_format(vk_format), TILE6_LINEAR);
desc[0] =
COND(vk_format_is_srgb(vk_format), A6XX_TEX_CONST_0_SRGB) |
@@ -910,7 +910,7 @@ r3d_src_gmem(struct tu_cmd_buffer *cmd,
/* patch the format so that depth/stencil get the right format */
desc[0] &= ~A6XX_TEX_CONST_0_FMT__MASK;
- desc[0] |= A6XX_TEX_CONST_0_FMT(tu6_format_texture(format, TILE6_2).fmt);
+ desc[0] |= A6XX_TEX_CONST_0_FMT(tu6_format_texture(tu_vk_format_to_pipe_format(format), TILE6_2).fmt);
/* patched for gmem */
desc[0] &= ~(A6XX_TEX_CONST_0_SWAP__MASK | A6XX_TEX_CONST_0_TILE_MODE__MASK);
@@ -1670,8 +1670,8 @@ tu_CmdCopyImageToBuffer(VkCommandBuffer commandBuffer,
static bool
is_swapped_format(VkFormat format)
{
- struct tu_native_format linear = tu6_format_texture(format, TILE6_LINEAR);
- struct tu_native_format tiled = tu6_format_texture(format, TILE6_3);
+ struct tu_native_format linear = tu6_format_texture(tu_vk_format_to_pipe_format(format), TILE6_LINEAR);
+ struct tu_native_format tiled = tu6_format_texture(tu_vk_format_to_pipe_format(format), TILE6_3);
return linear.fmt != tiled.fmt || linear.swap != tiled.swap;
}
@@ -2797,7 +2797,7 @@ store_cp_blit(struct tu_cmd_buffer *cmd,
tu_cs_emit_regs(cs,
A6XX_SP_PS_2D_SRC_INFO(
- .color_format = tu6_format_texture(format, TILE6_2).fmt,
+ .color_format = tu6_format_texture(tu_vk_format_to_pipe_format(format), TILE6_2).fmt,
.tile_mode = TILE6_2,
.srgb = vk_format_is_srgb(format),
.samples = tu_msaa_samples(samples),
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 8a8ca4c1c55..b5519595728 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -114,9 +114,8 @@ tu6_format_color(VkFormat vk_format, enum a6xx_tile_mode tile_mode)
}
static struct tu_native_format
-tu6_format_texture_unchecked(VkFormat vk_format, enum a6xx_tile_mode tile_mode)
+tu6_format_texture_unchecked(enum pipe_format format, enum a6xx_tile_mode tile_mode)
{
- enum pipe_format format = tu_vk_format_to_pipe_format(vk_format);
struct tu_native_format fmt = {
.fmt = fd6_texture_format(format, tile_mode),
.swap = fd6_texture_swap(format, tile_mode),
@@ -148,17 +147,17 @@ tu6_format_texture_unchecked(VkFormat vk_format, enum a6xx_tile_mode tile_mode)
}
struct tu_native_format
-tu6_format_texture(VkFormat vk_format, enum a6xx_tile_mode tile_mode)
+tu6_format_texture(enum pipe_format format, enum a6xx_tile_mode tile_mode)
{
- struct tu_native_format fmt = tu6_format_texture_unchecked(vk_format, tile_mode);
+ struct tu_native_format fmt = tu6_format_texture_unchecked(format, tile_mode);
assert(fmt.fmt != FMT6_NONE);
return fmt;
}
bool
-tu6_format_texture_supported(VkFormat vk_format)
+tu6_format_texture_supported(enum pipe_format format)
{
- return tu6_format_texture_unchecked(vk_format, TILE6_LINEAR).fmt != FMT6_NONE;
+ return tu6_format_texture_unchecked(format, TILE6_LINEAR).fmt != FMT6_NONE;
}
static void
@@ -173,7 +172,7 @@ tu_physical_device_get_format_properties(
bool supported_vtx = tu6_format_vtx_supported(vk_format);
bool supported_color = tu6_format_color_supported(vk_format);
- bool supported_tex = tu6_format_texture_supported(vk_format);
+ bool supported_tex = tu6_format_texture_supported(format);
if (format == PIPE_FORMAT_NONE ||
!(supported_vtx || supported_color || supported_tex)) {
@@ -223,7 +222,7 @@ tu_physical_device_get_format_properties(
* after we enable shaderStorageImageReadWithoutFormat and there are
* tests for these formats.
*/
- struct tu_native_format tex = tu6_format_texture(vk_format, TILE6_LINEAR);
+ struct tu_native_format tex = tu6_format_texture(format, TILE6_LINEAR);
if (tex.swap == WZYX && tex.fmt != FMT6_1_5_5_5_UNORM) {
optimal |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index dd7bcd832b8..0a04109b45a 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -462,7 +462,7 @@ tu_CreateImage(VkDevice _device,
if (fmt_list) {
may_be_swapped = false;
for (uint32_t i = 0; i < fmt_list->viewFormatCount; i++) {
- if (tu6_format_texture(fmt_list->pViewFormats[i], TILE6_LINEAR).swap) {
+ if (tu6_format_texture(tu_vk_format_to_pipe_format(fmt_list->pViewFormats[i]), TILE6_LINEAR).swap) {
may_be_swapped = true;
break;
}
@@ -706,8 +706,8 @@ tu_buffer_view_init(struct tu_buffer_view *view,
view->buffer = buffer;
enum VkFormat vfmt = pCreateInfo->format;
- enum pipe_format pfmt = vk_format_to_pipe_format(vfmt);
- const struct tu_native_format fmt = tu6_format_texture(vfmt, TILE6_LINEAR);
+ enum pipe_format pfmt = tu_vk_format_to_pipe_format(vfmt);
+ const struct tu_native_format fmt = tu6_format_texture(pfmt, TILE6_LINEAR);
uint32_t range;
if (pCreateInfo->range == VK_WHOLE_SIZE)
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index 7c73940eeaf..0bc571d8ad6 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -1382,12 +1382,13 @@ struct tu_native_format
enum a6xx_tile_mode tile_mode : 8;
};
+enum pipe_format tu_vk_format_to_pipe_format(VkFormat vk_format);
bool tu6_format_vtx_supported(VkFormat format);
struct tu_native_format tu6_format_vtx(VkFormat format);
bool tu6_format_color_supported(VkFormat format);
struct tu_native_format tu6_format_color(VkFormat format, enum a6xx_tile_mode tile_mode);
-bool tu6_format_texture_supported(VkFormat format);
-struct tu_native_format tu6_format_texture(VkFormat format, enum a6xx_tile_mode tile_mode);
+bool tu6_format_texture_supported(enum pipe_format format);
+struct tu_native_format tu6_format_texture(enum pipe_format format, enum a6xx_tile_mode tile_mode);
static inline enum a6xx_format
tu6_base_format(VkFormat format)
More information about the mesa-commit
mailing list