From 14911e8f83f726eb2bd6b413d5054d9c332976e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Tue, 7 Jun 2022 13:03:24 +0200 Subject: [PATCH] spirv, compiler: add "bool nv" to shader_info.mesh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Not knowing whether we deal with the NV or EXT extension makes implementation difficult for Intel HW. NV support will be dropped at some point, so this ugliness will go away eventually. Reviewed-by: Timur Kristóf Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/shader_info.h | 3 +++ src/compiler/spirv/spirv_to_nir.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 2bffee4..ef1bea4 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -540,6 +540,9 @@ typedef struct shader_info { uint16_t max_vertices_out; uint16_t max_primitives_out; uint16_t primitive_type; /* GL_POINTS, GL_LINES or GL_TRIANGLES. */ + + /* TODO: remove this when we stop supporting NV_mesh_shader. */ + bool nv; } mesh; }; } shader_info; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 4f71268..f9b93de 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -4458,9 +4458,18 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, break; } + case SpvOpExtension: { + /* Implementing both NV_mesh_shader and EXT_mesh_shader + * is difficult without knowing which we're dealing with. + * TODO: remove this when we stop supporting NV_mesh_shader. + */ + const char *ext_name = (const char *)&w[1]; + if (strcmp(ext_name, "SPV_NV_mesh_shader") == 0) + b->shader->info.mesh.nv = true; + break; + } case SpvOpSourceExtension: case SpvOpSourceContinued: - case SpvOpExtension: case SpvOpModuleProcessed: /* Unhandled, but these are for debug so that's ok. */ break; -- 2.7.4