mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
v3dv: replace raw integers with enum types in helper functions.
Update function return types, parameters, and struct fields to use enums instead of uint8_t or uint32_t. Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38732>
This commit is contained in:
parent
b06aa98246
commit
e9c3d42ad5
7 changed files with 72 additions and 62 deletions
|
|
@ -47,10 +47,10 @@
|
|||
|
||||
struct v3dv_format_plane {
|
||||
/* One of V3D42_OUTPUT_IMAGE_FORMAT_*, or OUTPUT_IMAGE_FORMAT_NO */
|
||||
uint8_t rt_type;
|
||||
enum V3DX(Output_Image_Format) rt_type;
|
||||
|
||||
/* One of V3D42_TEXTURE_DATA_FORMAT_*. */
|
||||
uint8_t tex_type;
|
||||
enum V3DX(Texture_Data_Formats) tex_type;
|
||||
|
||||
/* Swizzle to apply to the RGBA shader output for storing to the tile
|
||||
* buffer, to the RGBA tile buffer to produce shader input (for
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "v3dv_private.h"
|
||||
#include "v3dv_format_table.h"
|
||||
#include "v3dvx_format_table.h"
|
||||
#include "broadcom/common/v3d_util.h"
|
||||
#include "broadcom/compiler/v3d_compiler.h"
|
||||
|
||||
|
|
@ -828,19 +829,27 @@ set_rcl_early_z_config(struct v3dv_job *job,
|
|||
* seems to be the equivalent for no-clamp on 4.2), but not pq or hlg. In
|
||||
* summary right now we are just porting what we were doing on 4.2
|
||||
*/
|
||||
uint32_t
|
||||
v3dX(clamp_for_format_and_type)(uint32_t rt_type,
|
||||
|
||||
#if V3D_VERSION == 42
|
||||
enum V3DX(Render_Target_Clamp)
|
||||
v3dX(clamp_for_format_and_type)(enum V3DX(Internal_Type) rt_type,
|
||||
VkFormat vk_format)
|
||||
{
|
||||
#if V3D_VERSION == 42
|
||||
if (vk_format_is_int(vk_format))
|
||||
return V3D_RENDER_TARGET_CLAMP_INT;
|
||||
else if (vk_format_is_srgb(vk_format))
|
||||
return V3D_RENDER_TARGET_CLAMP_NORM;
|
||||
else
|
||||
return V3D_RENDER_TARGET_CLAMP_NONE;
|
||||
UNREACHABLE("Wrong V3D_VERSION");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if V3D_VERSION >= 71
|
||||
enum V3DX(Render_Target_Type_Clamp)
|
||||
v3dX(clamp_for_format_and_type)(enum V3DX(Internal_Type) rt_type,
|
||||
VkFormat vk_format)
|
||||
{
|
||||
switch (rt_type) {
|
||||
case V3D_INTERNAL_TYPE_8I:
|
||||
return V3D_RENDER_TARGET_TYPE_CLAMP_8I_CLAMPED;
|
||||
|
|
@ -867,10 +876,11 @@ v3dX(clamp_for_format_and_type)(uint32_t rt_type,
|
|||
default:
|
||||
UNREACHABLE("Unknown internal render target type");
|
||||
}
|
||||
|
||||
return V3D_RENDER_TARGET_TYPE_CLAMP_INVALID;
|
||||
#endif
|
||||
|
||||
UNREACHABLE("Wrong V3D_VERSION");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
cmd_buffer_render_pass_setup_render_target(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
|
|
@ -2362,7 +2372,7 @@ emit_tes_gs_common_params(struct v3dv_job *job,
|
|||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
static enum V3DX(Pack_Mode)
|
||||
simd_width_to_gs_pack_mode(uint32_t width)
|
||||
{
|
||||
switch (width) {
|
||||
|
|
|
|||
|
|
@ -28,11 +28,44 @@
|
|||
#include "broadcom/common/v3d_macros.h"
|
||||
#include "broadcom/cle/v3dx_pack.h"
|
||||
|
||||
/* FIXME: tex_format should be `enum V3DX(Texture_Data_Formats)`, but using
|
||||
* that enum type in the header requires including v3dx_pack.h, which triggers
|
||||
* circular include dependencies issues, so we're using a `uint32_t` for now.
|
||||
*/
|
||||
bool v3dX(tfu_supports_tex_format)(uint32_t tex_format);
|
||||
bool v3dX(tfu_supports_tex_format)(enum V3DX(Texture_Data_Formats) tex_format);
|
||||
|
||||
void v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
|
||||
void v3dX(get_internal_type_bpp_for_output_format)(enum V3DX(Output_Image_Format) format,
|
||||
uint32_t *type, uint32_t *bpp);
|
||||
|
||||
void
|
||||
v3dX(meta_emit_copy_buffer)(struct v3dv_job *job,
|
||||
struct v3dv_bo *dst,
|
||||
struct v3dv_bo *src,
|
||||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
enum V3DX(Output_Image_Format) format,
|
||||
uint32_t item_size);
|
||||
|
||||
void
|
||||
v3dX(meta_emit_copy_buffer_rcl)(struct v3dv_job *job,
|
||||
struct v3dv_bo *dst,
|
||||
struct v3dv_bo *src,
|
||||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
enum V3DX(Output_Image_Format) format,
|
||||
uint32_t item_size);
|
||||
|
||||
enum V3DX(Internal_Depth_Type)
|
||||
v3dX(get_internal_depth_type)(VkFormat format);
|
||||
|
||||
#if V3D_VERSION == 42
|
||||
enum V3DX(Render_Target_Clamp)
|
||||
v3dX(clamp_for_format_and_type)(enum V3DX(Internal_Type) rt_type,
|
||||
VkFormat vk_format);
|
||||
#endif
|
||||
#if V3D_VERSION >= 71
|
||||
enum V3DX(Render_Target_Type_Clamp)
|
||||
v3dX(clamp_for_format_and_type)(enum V3DX(Internal_Type) rt_type,
|
||||
VkFormat vk_format);
|
||||
#endif
|
||||
|
||||
enum V3DX(Stencil_Op)
|
||||
v3dX(translate_stencil_op)(VkStencilOp op);
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ v3dX(get_format)(VkFormat format)
|
|||
}
|
||||
|
||||
void
|
||||
v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
|
||||
v3dX(get_internal_type_bpp_for_output_format)(enum V3DX(Output_Image_Format) format,
|
||||
uint32_t *type,
|
||||
uint32_t *bpp)
|
||||
{
|
||||
|
|
@ -501,7 +501,7 @@ v3dX(format_supports_blending)(const struct v3dv_format *format)
|
|||
}
|
||||
|
||||
bool
|
||||
v3dX(tfu_supports_tex_format)(uint32_t tex_format)
|
||||
v3dX(tfu_supports_tex_format)(enum V3DX(Texture_Data_Formats) tex_format)
|
||||
{
|
||||
switch (tex_format) {
|
||||
case TEXTURE_DATA_FORMAT_R8:
|
||||
|
|
@ -542,7 +542,7 @@ v3dX(tfu_supports_tex_format)(uint32_t tex_format)
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
enum V3DX(Internal_Depth_Type)
|
||||
v3dX(get_internal_depth_type)(VkFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,11 @@
|
|||
|
||||
#include "v3dv_private.h"
|
||||
#include "v3dv_format_table.h"
|
||||
#include "v3dvx_format_table.h"
|
||||
#include "v3dv_meta_common.h"
|
||||
|
||||
#include "broadcom/common/v3d_macros.h"
|
||||
#include "broadcom/common/v3d_tfu.h"
|
||||
#include "broadcom/common/v3d_util.h"
|
||||
#include "broadcom/cle/v3dx_pack.h"
|
||||
#include "broadcom/compiler/v3d_compiler.h"
|
||||
|
||||
struct rcl_clear_info {
|
||||
|
|
@ -277,7 +276,7 @@ emit_linear_load(struct v3dv_cl *cl,
|
|||
struct v3dv_bo *bo,
|
||||
uint32_t offset,
|
||||
uint32_t stride,
|
||||
uint32_t format)
|
||||
enum V3DX(Output_Image_Format) format)
|
||||
{
|
||||
cl_emit(cl, LOAD_TILE_BUFFER_GENERAL, load) {
|
||||
load.buffer_to_load = buffer;
|
||||
|
|
@ -296,7 +295,7 @@ emit_linear_store(struct v3dv_cl *cl,
|
|||
uint32_t offset,
|
||||
uint32_t stride,
|
||||
bool msaa,
|
||||
uint32_t format)
|
||||
enum V3DX(Output_Image_Format) format)
|
||||
{
|
||||
cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) {
|
||||
store.buffer_to_store = RENDER_TARGET_0;
|
||||
|
|
@ -316,7 +315,7 @@ emit_linear_store(struct v3dv_cl *cl,
|
|||
* we need to load and store to/from a tile color buffer using a compatible
|
||||
* color format.
|
||||
*/
|
||||
static uint32_t
|
||||
static enum V3DX(Output_Image_Format)
|
||||
choose_tlb_format(struct v3dv_meta_framebuffer *framebuffer,
|
||||
VkImageAspectFlags aspect,
|
||||
bool for_store,
|
||||
|
|
@ -628,7 +627,7 @@ emit_copy_layer_to_buffer_per_tile_list(struct v3dv_job *job,
|
|||
uint32_t buffer_offset = buffer->mem_offset + region->bufferOffset +
|
||||
height * buffer_stride * layer_offset;
|
||||
|
||||
uint32_t format = choose_tlb_format(framebuffer,
|
||||
enum V3DX(Output_Image_Format) format = choose_tlb_format(framebuffer,
|
||||
region->imageSubresource.aspectMask,
|
||||
true, true, false);
|
||||
bool msaa = image->vk.samples > VK_SAMPLE_COUNT_1_BIT;
|
||||
|
|
@ -772,7 +771,7 @@ emit_copy_buffer_per_tile_list(struct v3dv_job *job,
|
|||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
uint32_t stride,
|
||||
uint32_t format)
|
||||
enum V3DX(Output_Image_Format) format)
|
||||
{
|
||||
struct v3dv_cl *cl = &job->indirect;
|
||||
v3dv_cl_ensure_space(cl, 200, 1);
|
||||
|
|
@ -808,7 +807,7 @@ v3dX(meta_emit_copy_buffer)(struct v3dv_job *job,
|
|||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
uint32_t format,
|
||||
enum V3DX(Output_Image_Format) format,
|
||||
uint32_t item_size)
|
||||
{
|
||||
const uint32_t stride = job->frame_tiling.width * item_size;
|
||||
|
|
@ -825,7 +824,7 @@ v3dX(meta_emit_copy_buffer_rcl)(struct v3dv_job *job,
|
|||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
uint32_t format,
|
||||
enum V3DX(Output_Image_Format) format,
|
||||
uint32_t item_size)
|
||||
{
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, NULL);
|
||||
|
|
@ -1223,7 +1222,7 @@ emit_copy_buffer_to_layer_per_tile_list(struct v3dv_job *job,
|
|||
uint32_t buffer_offset =
|
||||
buffer->mem_offset + region->bufferOffset + height * buffer_stride * layer;
|
||||
|
||||
uint32_t format = choose_tlb_format(framebuffer, imgrsc->aspectMask,
|
||||
enum V3DX(Output_Image_Format) format = choose_tlb_format(framebuffer, imgrsc->aspectMask,
|
||||
false, false, true);
|
||||
|
||||
uint32_t image_layer = layer + (image->vk.image_type != VK_IMAGE_TYPE_3D ?
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@
|
|||
|
||||
#include "v3dv_private.h"
|
||||
#include "v3dv_format_table.h"
|
||||
#include "v3dvx_format_table.h"
|
||||
#include "broadcom/compiler/v3d_compiler.h"
|
||||
|
||||
static uint8_t
|
||||
static enum V3DX(Blend_Factor)
|
||||
blend_factor(VkBlendFactor factor, bool dst_alpha_one, bool *needs_constants,
|
||||
bool *needs_dual_src)
|
||||
{
|
||||
|
|
@ -244,7 +245,7 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline,
|
|||
};
|
||||
}
|
||||
|
||||
uint32_t
|
||||
enum V3DX(Stencil_Op)
|
||||
v3dX(translate_stencil_op)(VkStencilOp op)
|
||||
{
|
||||
switch (op) {
|
||||
|
|
|
|||
|
|
@ -187,9 +187,6 @@ v3dX(pack_texture_shader_state_from_buffer_view)(struct v3dv_device *device,
|
|||
uint32_t
|
||||
v3dX(zs_buffer_from_aspect_bits)(VkImageAspectFlags aspects);
|
||||
|
||||
uint8_t
|
||||
v3dX(get_internal_depth_type)(VkFormat format);
|
||||
|
||||
struct v3dv_meta_framebuffer;
|
||||
|
||||
void
|
||||
|
|
@ -206,26 +203,6 @@ v3dX(meta_emit_resolve_image_rcl)(struct v3dv_job *job,
|
|||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
const VkImageResolve2 *region);
|
||||
|
||||
void
|
||||
v3dX(meta_emit_copy_buffer)(struct v3dv_job *job,
|
||||
struct v3dv_bo *dst,
|
||||
struct v3dv_bo *src,
|
||||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
uint32_t format,
|
||||
uint32_t item_size);
|
||||
|
||||
void
|
||||
v3dX(meta_emit_copy_buffer_rcl)(struct v3dv_job *job,
|
||||
struct v3dv_bo *dst,
|
||||
struct v3dv_bo *src,
|
||||
uint32_t dst_offset,
|
||||
uint32_t src_offset,
|
||||
struct v3dv_meta_framebuffer *framebuffer,
|
||||
uint32_t format,
|
||||
uint32_t item_size);
|
||||
|
||||
void
|
||||
v3dX(meta_emit_copy_image_rcl)(struct v3dv_job *job,
|
||||
struct v3dv_image *dst,
|
||||
|
|
@ -337,18 +314,8 @@ uint32_t v3dX(combined_image_sampler_sampler_state_offset)(uint8_t plane);
|
|||
|
||||
/* General utils */
|
||||
|
||||
uint32_t
|
||||
v3dX(clamp_for_format_and_type)(uint32_t rt_type,
|
||||
VkFormat vk_format);
|
||||
|
||||
uint32_t
|
||||
v3dX(clamp_for_format_and_type)(uint32_t rt_type,
|
||||
VkFormat vk_format);
|
||||
|
||||
void
|
||||
v3dX(viewport_compute_xform)(const VkViewport *viewport,
|
||||
float scale[3],
|
||||
float translate[3]);
|
||||
|
||||
uint32_t
|
||||
v3dX(translate_stencil_op)(VkStencilOp op);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue