From c8ffe8e1a88cb58db955b12e6d44a7ed9eb935a7 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 21 Jun 2023 12:28:44 -0500 Subject: [PATCH] vkd3d-shader/hlsl: Don't report a register type mismatch for unused reserved variables. --- libs/vkd3d-shader/hlsl_codegen.c | 4 ++-- tests/register-reservations.shader_test | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 37afdc2d..765b1907 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -2698,7 +2698,7 @@ static void allocate_register_reservations(struct hlsl_ctx *ctx) continue; regset = hlsl_type_get_regset(var->data_type); - if (var->reg_reservation.reg_type) + if (var->reg_reservation.reg_type && var->regs[regset].bind_count) { if (var->reg_reservation.reg_type != get_regset_name(regset)) { @@ -2710,7 +2710,7 @@ static void allocate_register_reservations(struct hlsl_ctx *ctx) type_string->buffer, get_regset_name(regset)); hlsl_release_string_buffer(ctx, type_string); } - else if (var->regs[regset].bind_count) + else { var->regs[regset].allocated = true; var->regs[regset].id = var->reg_reservation.reg_index; diff --git a/tests/register-reservations.shader_test b/tests/register-reservations.shader_test index 23d4ae5c..26f4381d 100644 --- a/tests/register-reservations.shader_test +++ b/tests/register-reservations.shader_test @@ -70,7 +70,7 @@ probe all rgba (1.0, 1.0, 1.0, 99.0) % Register reservation with incorrect register type. -[pixel shader todo] +[pixel shader] Texture2D unused : register(s0); Texture2D tex; @@ -80,12 +80,12 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (0.0, 0.0, 0.0, 99.0) % Register reservation with incorrect register type. -[pixel shader todo] +[pixel shader] sampler2D unused : register(t0); Texture2D tex; @@ -96,7 +96,7 @@ float4 main() : sv_target [test] -todo draw quad +draw quad probe all rgba (0.0, 0.0, 0.0, 99.0) [pixel shader]