vkd3d-shader/fx: Reject fx_2_0 output without techniques.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-02-23 02:11:38 +01:00 committed by Alexandre Julliard
parent dd5e42d347
commit 8c5db57ea7
Notes: Alexandre Julliard 2024-03-06 23:29:49 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/676
3 changed files with 18 additions and 15 deletions

View File

@ -179,7 +179,6 @@ static void fx_write_context_init(struct hlsl_ctx *ctx, const struct fx_write_co
static int fx_write_context_cleanup(struct fx_write_context *fx)
{
struct type_entry *type, *next_type;
int status = fx->status;
rb_destroy(&fx->strings, string_storage_destroy, NULL);
@ -189,7 +188,7 @@ static int fx_write_context_cleanup(struct fx_write_context *fx)
vkd3d_free(type);
}
return status;
return fx->ctx->result;
}
static bool technique_matches_version(const struct hlsl_ir_var *var, const struct fx_write_context *fx)
@ -643,15 +642,18 @@ static int hlsl_fx_2_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
vkd3d_free(fx.unstructured.data);
vkd3d_free(fx.structured.data);
if (!fx.status)
if (!fx.technique_count)
hlsl_error(ctx, &ctx->location, VKD3D_SHADER_ERROR_HLSL_MISSING_TECHNIQUE, "No techniques found.");
if (fx.status < 0)
ctx->result = fx.status;
if (!ctx->result)
{
out->code = buffer.data;
out->size = buffer.size;
}
if (fx.status < 0)
ctx->result = fx.status;
return fx_write_context_cleanup(&fx);
}
@ -870,15 +872,15 @@ static int hlsl_fx_4_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
set_status(&fx, buffer.status);
if (!fx.status)
if (fx.status < 0)
ctx->result = fx.status;
if (!ctx->result)
{
out->code = buffer.data;
out->size = buffer.size;
}
if (fx.status < 0)
ctx->result = fx.status;
return fx_write_context_cleanup(&fx);
}
@ -933,15 +935,15 @@ static int hlsl_fx_5_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
set_status(&fx, buffer.status);
if (!fx.status)
if (fx.status < 0)
ctx->result = fx.status;
if (!ctx->result)
{
out->code = buffer.data;
out->size = buffer.size;
}
if (fx.status < 0)
ctx->result = fx.status;
return fx_write_context_cleanup(&fx);
}

View File

@ -148,6 +148,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_HLSL_INCONSISTENT_SAMPLER = 5026,
VKD3D_SHADER_ERROR_HLSL_NON_FINITE_RESULT = 5027,
VKD3D_SHADER_ERROR_HLSL_DUPLICATE_SWITCH_CASE = 5028,
VKD3D_SHADER_ERROR_HLSL_MISSING_TECHNIQUE = 5029,
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300,
VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301,

View File

@ -86,7 +86,7 @@ technique10
}
% Effects without techniques are not allowed for fx_2_0
[effect fail todo]
[effect fail]
float4 f;
% fx_5_0 keyword fails with fx_2_0 profile