mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 06:20:19 +01:00
turnip: Switch format_to_ifmt() to take a pipe_format.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13379>
This commit is contained in:
parent
e4e8db0132
commit
cbdc8e09bf
1 changed files with 10 additions and 10 deletions
|
|
@ -30,27 +30,27 @@ tu_pack_float32_for_unorm(float val, int bits)
|
|||
/* r2d_ = BLIT_OP_SCALE operations */
|
||||
|
||||
static enum a6xx_2d_ifmt
|
||||
format_to_ifmt(VkFormat format)
|
||||
format_to_ifmt(enum pipe_format format)
|
||||
{
|
||||
if (format == VK_FORMAT_D24_UNORM_S8_UINT ||
|
||||
format == VK_FORMAT_X8_D24_UNORM_PACK32)
|
||||
if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT ||
|
||||
format == PIPE_FORMAT_Z24X8_UNORM)
|
||||
return R2D_UNORM8;
|
||||
|
||||
/* get_component_bits doesn't work with depth/stencil formats: */
|
||||
if (format == VK_FORMAT_D16_UNORM || format == VK_FORMAT_D32_SFLOAT)
|
||||
if (format == PIPE_FORMAT_Z16_UNORM || format == PIPE_FORMAT_Z32_FLOAT)
|
||||
return R2D_FLOAT32;
|
||||
if (format == VK_FORMAT_S8_UINT)
|
||||
if (format == PIPE_FORMAT_S8_UINT)
|
||||
return R2D_INT8;
|
||||
|
||||
/* use the size of the red channel to find the corresponding "ifmt" */
|
||||
bool is_int = vk_format_is_int(format);
|
||||
switch (vk_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, PIPE_SWIZZLE_X)) {
|
||||
bool is_int = util_format_is_pure_integer(format);
|
||||
switch (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, PIPE_SWIZZLE_X)) {
|
||||
case 4: case 5: case 8:
|
||||
return is_int ? R2D_INT8 : R2D_UNORM8;
|
||||
case 10: case 11:
|
||||
return is_int ? R2D_INT16 : R2D_FLOAT16;
|
||||
case 16:
|
||||
if (vk_format_is_float(format))
|
||||
if (util_format_is_float(format))
|
||||
return R2D_FLOAT16;
|
||||
return is_int ? R2D_INT16 : R2D_FLOAT32;
|
||||
case 32:
|
||||
|
|
@ -110,7 +110,7 @@ r2d_clear_value(struct tu_cs *cs, VkFormat format, const VkClearValue *val)
|
|||
default:
|
||||
assert(!vk_format_is_depth_or_stencil(format));
|
||||
const struct util_format_description *desc = vk_format_description(format);
|
||||
enum a6xx_2d_ifmt ifmt = format_to_ifmt(format);
|
||||
enum a6xx_2d_ifmt ifmt = format_to_ifmt(tu_vk_format_to_pipe_format(format));
|
||||
|
||||
assert(desc && (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ||
|
||||
format == VK_FORMAT_B10G11R11_UFLOAT_PACK32));
|
||||
|
|
@ -243,7 +243,7 @@ r2d_setup_common(struct tu_cmd_buffer *cmd,
|
|||
{
|
||||
enum pipe_format format = tu_vk_format_to_pipe_format(vk_format);
|
||||
enum a6xx_format fmt = tu6_base_format(format);
|
||||
enum a6xx_2d_ifmt ifmt = format_to_ifmt(vk_format);
|
||||
enum a6xx_2d_ifmt ifmt = format_to_ifmt(format);
|
||||
uint32_t unknown_8c01 = 0;
|
||||
|
||||
if ((vk_format == VK_FORMAT_D24_UNORM_S8_UINT ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue