mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 04:00:10 +01:00
tu: Drop tu_vk_format_to_pipe_format helper function
All the fomats are properly handled in vk_format_to_pipe_format so this is no longer needed. Signed-off-by: Valentine Burley <valentine.burley@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30269>
This commit is contained in:
parent
7fe8033e8b
commit
fb03aed435
6 changed files with 18 additions and 41 deletions
|
|
@ -29,7 +29,7 @@ tu_CreateBufferView(VkDevice _device,
|
|||
PIPE_SWIZZLE_W };
|
||||
|
||||
fdl6_buffer_view_init(
|
||||
view->descriptor, tu_vk_format_to_pipe_format(view->vk.format),
|
||||
view->descriptor, vk_format_to_pipe_format(view->vk.format),
|
||||
swiz, buffer->iova + view->vk.offset, view->vk.range);
|
||||
|
||||
*pView = tu_buffer_view_to_handle(view);
|
||||
|
|
|
|||
|
|
@ -1705,7 +1705,7 @@ copy_format(VkFormat vk_format, VkImageAspectFlags aspect_mask)
|
|||
}
|
||||
}
|
||||
|
||||
enum pipe_format format = tu_vk_format_to_pipe_format(vk_format);
|
||||
enum pipe_format format = vk_format_to_pipe_format(vk_format);
|
||||
|
||||
/* For SNORM formats, copy them as the equivalent UNORM format. If we treat
|
||||
* them as snorm then the 0x80 (-1.0 snorm8) value will get clamped to 0x81
|
||||
|
|
@ -2706,9 +2706,9 @@ tu_CmdResolveImage2(VkCommandBuffer commandBuffer,
|
|||
struct tu_cs *cs = &cmd->cs;
|
||||
|
||||
enum pipe_format src_format =
|
||||
tu_vk_format_to_pipe_format(src_image->vk.format);
|
||||
vk_format_to_pipe_format(src_image->vk.format);
|
||||
enum pipe_format dst_format =
|
||||
tu_vk_format_to_pipe_format(dst_image->vk.format);
|
||||
vk_format_to_pipe_format(dst_image->vk.format);
|
||||
ops->setup(cmd, cs, src_format, dst_format,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT, 0, false, dst_image->layout[0].ubwc,
|
||||
VK_SAMPLE_COUNT_1_BIT);
|
||||
|
|
@ -2762,8 +2762,8 @@ resolve_sysmem(struct tu_cmd_buffer *cmd,
|
|||
|
||||
trace_start_sysmem_resolve(&cmd->trace, cs, vk_dst_format);
|
||||
|
||||
enum pipe_format src_format = tu_vk_format_to_pipe_format(vk_src_format);
|
||||
enum pipe_format dst_format = tu_vk_format_to_pipe_format(vk_dst_format);
|
||||
enum pipe_format src_format = vk_format_to_pipe_format(vk_src_format);
|
||||
enum pipe_format dst_format = vk_format_to_pipe_format(vk_dst_format);
|
||||
|
||||
ops->setup(cmd, cs, src_format, dst_format,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT, 0, false, dst->view.ubwc_enabled,
|
||||
|
|
@ -3250,7 +3250,7 @@ tu_emit_clear_gmem_attachment(struct tu_cmd_buffer *cmd,
|
|||
tu_cs_emit_regs(cs,
|
||||
A6XX_RB_BLIT_GMEM_MSAA_CNTL(tu_msaa_samples(att->samples)));
|
||||
|
||||
enum pipe_format format = tu_vk_format_to_pipe_format(att->format);
|
||||
enum pipe_format format = vk_format_to_pipe_format(att->format);
|
||||
for_each_layer(i, layer_mask, layers) {
|
||||
uint32_t layer = i + base_layer;
|
||||
if (att->format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
|
||||
|
|
@ -3394,7 +3394,7 @@ clear_sysmem_attachment(struct tu_cmd_buffer *cmd,
|
|||
uint32_t a,
|
||||
bool separate_ds)
|
||||
{
|
||||
enum pipe_format format = tu_vk_format_to_pipe_format(vk_format);
|
||||
enum pipe_format format = vk_format_to_pipe_format(vk_format);
|
||||
const struct tu_framebuffer *fb = cmd->state.framebuffer;
|
||||
const struct tu_image_view *iview = cmd->state.attachments[a];
|
||||
const uint32_t clear_views = cmd->state.pass->attachments[a].clear_views;
|
||||
|
|
@ -4114,11 +4114,11 @@ tu_store_gmem_attachment(struct tu_cmd_buffer *cmd,
|
|||
|
||||
assert(cmd->state.gmem_layout == TU_GMEM_LAYOUT_AVOID_CCU);
|
||||
|
||||
enum pipe_format src_format = tu_vk_format_to_pipe_format(src->format);
|
||||
enum pipe_format src_format = vk_format_to_pipe_format(src->format);
|
||||
if (src_format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
|
||||
src_format = PIPE_FORMAT_Z32_FLOAT;
|
||||
|
||||
enum pipe_format dst_format = tu_vk_format_to_pipe_format(dst->format);
|
||||
enum pipe_format dst_format = vk_format_to_pipe_format(dst->format);
|
||||
if (dst_format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
|
||||
dst_format = PIPE_FORMAT_Z32_FLOAT;
|
||||
|
||||
|
|
|
|||
|
|
@ -977,7 +977,7 @@ write_texel_buffer_descriptor_addr(uint32_t *dst,
|
|||
uint8_t swiz[4] = { PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z,
|
||||
PIPE_SWIZZLE_W };
|
||||
fdl6_buffer_view_init(dst,
|
||||
tu_vk_format_to_pipe_format(buffer_info->format),
|
||||
vk_format_to_pipe_format(buffer_info->format),
|
||||
swiz, buffer_info->address, buffer_info->range);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,27 +20,6 @@
|
|||
|
||||
#include <vulkan/vulkan_android.h>
|
||||
|
||||
/* Map non-colorspace-converted YUV formats to RGB pipe formats where we can,
|
||||
* since our hardware doesn't support colorspace conversion.
|
||||
*
|
||||
* Really, we should probably be returning the RGB formats in
|
||||
* vk_format_to_pipe_format, but we don't have all the equivalent pipe formats
|
||||
* for VK RGB formats yet, and we'd have to switch all consumers of that
|
||||
* function at once.
|
||||
*/
|
||||
enum pipe_format
|
||||
tu_vk_format_to_pipe_format(VkFormat vk_format)
|
||||
{
|
||||
switch (vk_format) {
|
||||
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
|
||||
return PIPE_FORMAT_G8_B8R8_420_UNORM;
|
||||
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
|
||||
return PIPE_FORMAT_G8_B8_R8_420_UNORM;
|
||||
default:
|
||||
return vk_format_to_pipe_format(vk_format);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
tu6_format_vtx_supported(enum pipe_format format)
|
||||
{
|
||||
|
|
@ -131,7 +110,7 @@ tu_physical_device_get_format_properties(
|
|||
VkFormatProperties3 *out_properties)
|
||||
{
|
||||
VkFormatFeatureFlags2 linear = 0, optimal = 0, buffer = 0;
|
||||
enum pipe_format format = tu_vk_format_to_pipe_format(vk_format);
|
||||
enum pipe_format format = vk_format_to_pipe_format(vk_format);
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
bool supported_vtx = tu6_format_vtx_supported(format);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ struct tu_native_format
|
|||
enum a3xx_color_swap swap : 8;
|
||||
};
|
||||
|
||||
enum pipe_format tu_vk_format_to_pipe_format(VkFormat vk_format);
|
||||
|
||||
static inline bool
|
||||
tu_pipe_format_is_float16(enum pipe_format format)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ tu6_plane_format(VkFormat format, uint32_t plane)
|
|||
case VK_FORMAT_D32_SFLOAT_S8_UINT:
|
||||
return plane ? PIPE_FORMAT_S8_UINT : PIPE_FORMAT_Z32_FLOAT;
|
||||
default:
|
||||
return tu_vk_format_to_pipe_format(format);
|
||||
return vk_format_to_pipe_format(format);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ tu_image_view_init(struct tu_device *device,
|
|||
if (aspect_mask != VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
format = tu6_plane_format(vk_format, tu6_plane_index(vk_format, aspect_mask));
|
||||
else
|
||||
format = tu_vk_format_to_pipe_format(vk_format);
|
||||
format = vk_format_to_pipe_format(vk_format);
|
||||
|
||||
if (image->vk.format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM &&
|
||||
aspect_mask == VK_IMAGE_ASPECT_PLANE_0_BIT) {
|
||||
|
|
@ -424,7 +424,7 @@ format_list_reinterprets_r8g8_r16(enum pipe_format format, const VkImageFormatLi
|
|||
bool has_non_r8g8 = false;
|
||||
for (uint32_t i = 0; i < fmt_list->viewFormatCount; i++) {
|
||||
enum pipe_format format =
|
||||
tu_vk_format_to_pipe_format(fmt_list->pViewFormats[i]);
|
||||
vk_format_to_pipe_format(fmt_list->pViewFormats[i]);
|
||||
if (tu_is_r8g8(format))
|
||||
has_r8g8 = true;
|
||||
else
|
||||
|
|
@ -444,7 +444,7 @@ format_list_has_swaps(const VkImageFormatListCreateInfo *fmt_list)
|
|||
|
||||
for (uint32_t i = 0; i < fmt_list->viewFormatCount; i++) {
|
||||
enum pipe_format format =
|
||||
tu_vk_format_to_pipe_format(fmt_list->pViewFormats[i]);
|
||||
vk_format_to_pipe_format(fmt_list->pViewFormats[i]);
|
||||
|
||||
if (tu6_format_texture(format, TILE6_LINEAR).swap)
|
||||
return true;
|
||||
|
|
@ -470,7 +470,7 @@ tu_image_update_layout(struct tu_device *device, struct tu_image *image,
|
|||
}
|
||||
|
||||
/* Whether a view of the image with an R8G8 format could be made. */
|
||||
bool has_r8g8 = tu_is_r8g8(tu_vk_format_to_pipe_format(image->vk.format));
|
||||
bool has_r8g8 = tu_is_r8g8(vk_format_to_pipe_format(image->vk.format));
|
||||
|
||||
/* With AHB, we could be asked to create an image with VK_IMAGE_TILING_LINEAR
|
||||
* but gralloc doesn't know this. So if we are explicitly told that it is
|
||||
|
|
@ -691,7 +691,7 @@ tu_image_init(struct tu_device *device, struct tu_image *image,
|
|||
image->ubwc_enabled = false;
|
||||
}
|
||||
|
||||
bool r8g8_r16 = format_list_reinterprets_r8g8_r16(tu_vk_format_to_pipe_format(image->vk.format), fmt_list);
|
||||
bool r8g8_r16 = format_list_reinterprets_r8g8_r16(vk_format_to_pipe_format(image->vk.format), fmt_list);
|
||||
|
||||
/* A750+ TODO: Correctly handle swaps when copying mutable images.
|
||||
* We should be able to support UBWC for mutable images with swaps.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue