Some fixes to valid clangd warnings, since I am using it as linter.
Also, I am removing enum hlsl_error_level on 4/6, since it doesn't seem to be meant to be used anywhere after 3/6.
-- v3: vkd3d-shader/d3dbc: Use D3DSIO_TEXKILL instead of VKD3D_SM1_OP_TEXKILL (clangd). vkd3d-shader/hlsl: Remove enum hlsl_error_level (clangd). vkd3d-shader/tpf: Avoid translations to D3DDECLUSAGE and back (clangd). vkd3d-shader: Remove unnecessary fallthroughs (clangd).
From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/spirv.c | 7 ++++--- libs/vkd3d-shader/tpf.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 1c8b52e6d..f7c8f3899 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2464,9 +2464,6 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve compiler->formatting = option->value; break;
- default: - WARN("Ignoring unrecognised option %#x with value %#x.\n", option->name, option->value); - case VKD3D_SHADER_COMPILE_OPTION_API_VERSION: break;
@@ -2482,6 +2479,10 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve case VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE: compiler->write_tess_geom_point_size = option->value; break; + + default: + WARN("Ignoring unrecognised option %#x with value %#x.\n", option->name, option->value); + break; } }
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index c471d1c58..cd6f3ee13 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -1803,10 +1803,11 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui *modifier = VKD3DSPSM_ABSNEG; break;
+ case VKD3D_SM4_REGISTER_MODIFIER_NONE: + break; + default: FIXME("Unhandled register modifier %#x.\n", m); - /* fall-through */ - case VKD3D_SM4_REGISTER_MODIFIER_NONE: break; }
From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/tpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index cd6f3ee13..876bb8290 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -2729,7 +2729,7 @@ bool hlsl_sm4_usage_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_semant const char *name; bool output; enum vkd3d_shader_type shader_type; - D3DDECLUSAGE usage; + D3D_NAME usage; } semantics[] = {
From: Francisco Casas fcasas@codeweavers.com
It is only used once for calling hlsl_note(), and it expects an enum vkd3d_shader_log_level values instead. --- libs/vkd3d-shader/hlsl.h | 7 ------- libs/vkd3d-shader/hlsl_codegen.c | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 59c543c7b..9f1a3fe21 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -864,13 +864,6 @@ struct hlsl_ctx uint32_t found_numthreads : 1; };
-enum hlsl_error_level -{ - HLSL_LEVEL_ERROR = 0, - HLSL_LEVEL_WARNING, - HLSL_LEVEL_NOTE, -}; - struct hlsl_resource_load_params { struct hlsl_type *format; diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 5c816e895..7d17ca8ce 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -249,7 +249,7 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir { hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, "Output semantic "%s%u" is used multiple times.", semantic->name, index); - hlsl_note(ctx, &ext_var->loc, HLSL_LEVEL_ERROR, + hlsl_note(ctx, &ext_var->loc, VKD3D_SHADER_LOG_ERROR, "First use of "%s%u" is here.", semantic->name, index); semantic->reported_duplicated_output_next_index = index + 1; } @@ -262,7 +262,7 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, "Input semantic "%s%u" is used multiple times with incompatible types.", semantic->name, index); - hlsl_note(ctx, &ext_var->loc, HLSL_LEVEL_ERROR, + hlsl_note(ctx, &ext_var->loc, VKD3D_SHADER_LOG_ERROR, "First declaration of "%s%u" is here.", semantic->name, index); semantic->reported_duplicated_input_incompatible_next_index = index + 1; }
From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/d3dbc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 598b75183..67fa32710 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -2221,7 +2221,7 @@ static void write_sm1_jump(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
struct sm1_instruction instr = { - .opcode = VKD3D_SM1_OP_TEXKILL, + .opcode = D3DSIO_TEXKILL,
.dst.type = D3DSPR_TEMP, .dst.reg = reg->id,
I think `-Wimplicit-fallback` has some value, but I can live without it.
I'd rather keep it if possible. I'm fairly sure it's caught my errors before.
This merge request was approved by Henri Verbeet.