v3d,v3dv: stop copying and pasting the translate_swizzle helper

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>
This commit is contained in:
Iago Toral Quiroga
2022-07-13 09:24:18 +02:00
committed by Marge Bot
parent 8d8491df5e
commit 40976356f2
5 changed files with 51 additions and 86 deletions
+21
View File
@@ -122,3 +122,24 @@ v3d_choose_tile_size(uint32_t color_attachment_count, uint32_t max_color_bpp,
*width = tile_sizes[idx * 2];
*height = tile_sizes[idx * 2 + 1];
}
/* Translates a pipe swizzle to the swizzle values used in the
* TEXTURE_SHADER_STATE packet.
*/
uint32_t
v3d_translate_pipe_swizzle(enum pipe_swizzle swizzle)
{
switch (swizzle) {
case PIPE_SWIZZLE_0:
return 0;
case PIPE_SWIZZLE_1:
return 1;
case PIPE_SWIZZLE_X:
case PIPE_SWIZZLE_Y:
case PIPE_SWIZZLE_Z:
case PIPE_SWIZZLE_W:
return 2 + swizzle;
default:
unreachable("unknown swizzle");
}
}
+4
View File
@@ -25,6 +25,7 @@
#define V3D_UTIL_H
#include "common/v3d_device_info.h"
#include "pipe/p_defines.h"
uint32_t
v3d_csd_choose_workgroups_per_supergroup(struct v3d_device_info *devinfo,
@@ -39,4 +40,7 @@ v3d_choose_tile_size(uint32_t color_attachment_count, uint32_t max_color_bpp,
bool msaa, bool double_buffer,
uint32_t *width, uint32_t *height);
uint32_t
v3d_translate_pipe_swizzle(enum pipe_swizzle swizzle);
#endif