Module: Mesa
Branch: main
Commit: 6a08dc7cabf54a6369b657a68363f0c2aa7d9f2b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a08dc7cabf54a6369b657a68363f0c2aa7d9f2b

Author: Eric Engestrom <[email protected]>
Date:   Thu Apr 27 17:16:22 2023 +0100

v3d: fix tfu_supports_tex_format() param type, and document why

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 use a `uint32_t` for now.

"fix" the one place that was using the correct enum, because doing so
triggers `-Wenum-int-mismatch` in GCC 13 as the function declaration
doesn't match the function definition.

Reported-by: Michel Dänzer <[email protected]>
Signed-off-by: Eric Engestrom <[email protected]>
Acked-by: Juan A. Suarez <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22739>

---

 src/broadcom/vulkan/v3dvx_private.h         | 4 ++++
 src/gallium/drivers/v3d/v3dx_context.h      | 5 +++++
 src/gallium/drivers/v3d/v3dx_format_table.c | 4 ++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/broadcom/vulkan/v3dvx_private.h 
b/src/broadcom/vulkan/v3dvx_private.h
index c693952d09b..ad8ddfa5731 100644
--- a/src/broadcom/vulkan/v3dvx_private.h
+++ b/src/broadcom/vulkan/v3dvx_private.h
@@ -165,6 +165,10 @@ v3dX(format_supports_tlb_resolve)(const struct v3dv_format 
*format);
 bool
 v3dX(format_supports_blending)(const struct v3dv_format *format);
 
+/* 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);
 
diff --git a/src/gallium/drivers/v3d/v3dx_context.h 
b/src/gallium/drivers/v3d/v3dx_context.h
index 9c64752e8fb..03d7c244ea2 100644
--- a/src/gallium/drivers/v3d/v3dx_context.h
+++ b/src/gallium/drivers/v3d/v3dx_context.h
@@ -44,5 +44,10 @@ const struct v3d_format *v3dX(get_format_desc)(enum 
pipe_format f);
 void v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
                                                    uint32_t *type,
                                                    uint32_t *bpp);
+
+/* 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 for_mipmap);
diff --git a/src/gallium/drivers/v3d/v3dx_format_table.c 
b/src/gallium/drivers/v3d/v3dx_format_table.c
index 89b44491879..9920aa85431 100644
--- a/src/gallium/drivers/v3d/v3dx_format_table.c
+++ b/src/gallium/drivers/v3d/v3dx_format_table.c
@@ -327,10 +327,10 @@ v3dX(get_internal_type_bpp_for_output_format)(uint32_t 
format,
 }
 
 bool
-v3dX(tfu_supports_tex_format)(enum V3DX(Texture_Data_Formats) format,
+v3dX(tfu_supports_tex_format)(uint32_t tex_format,
                               bool for_mipmap)
 {
-        switch (format) {
+        switch (tex_format) {
         case TEXTURE_DATA_FORMAT_R8:
         case TEXTURE_DATA_FORMAT_R8_SNORM:
         case TEXTURE_DATA_FORMAT_RG8:

Reply via email to