From 392da43dd328c91d53b9c517b5b6e20c88d1fd88 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 8 Aug 2025 20:41:02 +0200 Subject: [PATCH] vkd3d-shader/ir: Remove VSIR_OP_DCL_INPUT_PRIMITIVE instructions. --- libs/vkd3d-shader/ir.c | 1 + libs/vkd3d-shader/spirv.c | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 5a7a1ceab..0a59ce44b 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -1750,6 +1750,7 @@ static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *pr case VSIR_OP_DCL: case VSIR_OP_DCL_CONSTANT_BUFFER: case VSIR_OP_DCL_GLOBAL_FLAGS: + case VSIR_OP_DCL_INPUT_PRIMITIVE: case VSIR_OP_DCL_SAMPLER: case VSIR_OP_DCL_TEMPS: case VSIR_OP_DCL_TESSELLATOR_DOMAIN: diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 89c054f5a..36d1ab6c3 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -7209,10 +7209,9 @@ static void spirv_compiler_emit_output_vertex_count(struct spirv_compiler *compi SpvExecutionModeOutputVertices, instruction->declaration.count); } -static void spirv_compiler_emit_dcl_input_primitive(struct spirv_compiler *compiler, - const struct vkd3d_shader_instruction *instruction) +static void spirv_compiler_emit_input_primitive(struct spirv_compiler *compiler) { - enum vkd3d_primitive_type primitive_type = instruction->declaration.primitive_type.type; + enum vkd3d_primitive_type primitive_type = compiler->program->input_primitive; SpvExecutionMode mode; switch (primitive_type) @@ -7233,7 +7232,8 @@ static void spirv_compiler_emit_dcl_input_primitive(struct spirv_compiler *compi mode = SpvExecutionModeInputTrianglesAdjacency; break; default: - FIXME("Unhandled primitive type %#x.\n", primitive_type); + spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_NOT_IMPLEMENTED, + "Unhandled input primitive type %#x.", primitive_type); return; } @@ -10608,9 +10608,6 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler, case VSIR_OP_DCL_VERTICES_OUT: spirv_compiler_emit_output_vertex_count(compiler, instruction); break; - case VSIR_OP_DCL_INPUT_PRIMITIVE: - spirv_compiler_emit_dcl_input_primitive(compiler, instruction); - break; case VSIR_OP_DCL_OUTPUT_TOPOLOGY: spirv_compiler_emit_dcl_output_topology(compiler, instruction); break; @@ -11067,6 +11064,8 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, spirv_compiler_allocate_ssa_register_ids(compiler, program->ssa_count); if (compiler->shader_type == VKD3D_SHADER_TYPE_COMPUTE) spirv_compiler_emit_thread_group_size(compiler, &program->thread_group_size); + else if (compiler->shader_type == VKD3D_SHADER_TYPE_GEOMETRY) + spirv_compiler_emit_input_primitive(compiler); spirv_compiler_emit_global_flags(compiler, program->global_flags); spirv_compiler_emit_descriptor_declarations(compiler);