From 9a4db70a19f41a9747563b89bd1e4b9b6ead8af6 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Thu, 11 May 2023 14:33:46 -0700 Subject: [PATCH] spirv: Fix gl_spirv_validation when OpLine with strings is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix issue by handling the OpString instructions when walking through the preamble for validation. The gl_spirv_validation() creates a vtn_builder() and walks the instructions looking for a subset of the information. However our current way to walk the instructions will also perform tracking of OpLine/OpNoLine, that may make references to OpString instructions that were being previously ignored by gl_spirv_validation(). This would cause the parsing to fail. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9004 Reviewed-by: Alejandro PiƱeiro Part-of: (cherry picked from commit 1b31d528b9c5cc1bc17af0f58d9c314b74f8e8b3) --- .pick_status.json | 2 +- src/compiler/spirv/gl_spirv.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f07048c7513..0eba83da0ff 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6493,7 +6493,7 @@ "description": "spirv: Fix gl_spirv_validation when OpLine with strings is present", "nominated": false, "nomination_type": null, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/compiler/spirv/gl_spirv.c b/src/compiler/spirv/gl_spirv.c index 5ef38928edd..9b5e351c6c0 100644 --- a/src/compiler/spirv/gl_spirv.c +++ b/src/compiler/spirv/gl_spirv.c @@ -33,14 +33,22 @@ vtn_validate_preamble_instruction(struct vtn_builder *b, SpvOp opcode, const uint32_t *w, unsigned count) { switch (opcode) { + case SpvOpString: case SpvOpSource: case SpvOpSourceExtension: case SpvOpSourceContinued: + case SpvOpModuleProcessed: + /* We need this since vtn_foreach_instruction automatically handles + * OpLine / OpNoLine and relies on the SpvOpString from preamble being + * handled. + */ + vtn_handle_debug_text(b, opcode, w, count); + break; + case SpvOpExtension: case SpvOpCapability: case SpvOpExtInstImport: case SpvOpMemoryModel: - case SpvOpString: case SpvOpName: case SpvOpMemberName: case SpvOpExecutionMode: