From 5a513ffcec7e4eb85e2c790823e08a497c954d30 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Mon, 4 Nov 2024 22:33:13 -0600 Subject: [PATCH] vkd3d-shader/hlsl: Enforce FOG component count for sm1 VS output. --- libs/vkd3d-shader/hlsl_codegen.c | 4 ++++ tests/hlsl/fog.shader_test | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 2a6dbbca..3f1ff5a6 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -6523,6 +6523,10 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog && program->shader_version.type == VKD3D_SHADER_TYPE_VERTEX && var->data_type->dimx > 1) hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, "PSIZE output must have only 1 component in this shader model."); + if (!ascii_strcasecmp(var->semantic.name, "FOG") && output && program->shader_version.major < 3 + && program->shader_version.type == VKD3D_SHADER_TYPE_VERTEX && var->data_type->dimx > 1) + hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, + "FOG output must have only 1 component in this shader model."); mask = (1 << var->data_type->dimx) - 1; use_mask = mask; /* FIXME: retrieve use mask accurately. */ diff --git a/tests/hlsl/fog.shader_test b/tests/hlsl/fog.shader_test index 7c4c161c..940e85a8 100644 --- a/tests/hlsl/fog.shader_test +++ b/tests/hlsl/fog.shader_test @@ -1,7 +1,7 @@ [require] shader model < 3.0 -[vertex shader fail todo] +[vertex shader fail] void main(float4 pos : position, out float2 fog : fog, out float4 out_pos : sv_position) { fog = 0.5;