mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 00:50:07 +01:00
zink: use a macro for spir-v versions
Instead of repeating constants over and over, let's use a macro for the SPIR-V version definition instead. Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11044>
This commit is contained in:
parent
263ec2fd2a
commit
baf4b05aad
3 changed files with 9 additions and 6 deletions
|
|
@ -3559,8 +3559,8 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, uint32_t
|
|||
struct ntv_context ctx = {};
|
||||
ctx.mem_ctx = ralloc_context(NULL);
|
||||
ctx.builder.mem_ctx = ctx.mem_ctx;
|
||||
assert(spirv_version >= 0x10000);
|
||||
ctx.spirv_1_4_interfaces = spirv_version >= 0x10400;
|
||||
assert(spirv_version >= SPIRV_VERSION(1, 0));
|
||||
ctx.spirv_1_4_interfaces = spirv_version >= SPIRV_VERSION(1, 4);
|
||||
|
||||
ctx.glsl_types = _mesa_pointer_hash_table_create(ctx.mem_ctx);
|
||||
if (!ctx.glsl_types)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "zink_compiler.h"
|
||||
|
||||
#define SPIRV_VERSION(major, minor) (((major) << 16) | ((minor) << 8))
|
||||
|
||||
struct spirv_shader {
|
||||
uint32_t *words;
|
||||
size_t num_words;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "zink_instance.h"
|
||||
#include "zink_public.h"
|
||||
#include "zink_resource.h"
|
||||
#include "nir_to_spirv/nir_to_spirv.h" // for SPIRV_VERSION
|
||||
|
||||
#include "os/os_process.h"
|
||||
#include "util/u_debug.h"
|
||||
|
|
@ -257,7 +258,7 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||
return 1;
|
||||
|
||||
case PIPE_CAP_TGSI_VOTE:
|
||||
return screen->spirv_version >= 0x00010300;
|
||||
return screen->spirv_version >= SPIRV_VERSION(1, 3);
|
||||
|
||||
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
|
||||
return screen->info.have_EXT_provoking_vertex;
|
||||
|
|
@ -1054,11 +1055,11 @@ choose_pdev(struct zink_screen *screen)
|
|||
|
||||
/* calculate SPIR-V version based on VK version */
|
||||
if (screen->vk_version >= VK_MAKE_VERSION(1, 2, 0))
|
||||
screen->spirv_version = 0x00010500;
|
||||
screen->spirv_version = SPIRV_VERSION(1, 5);
|
||||
else if (screen->vk_version >= VK_MAKE_VERSION(1, 1, 0))
|
||||
screen->spirv_version = 0x00010300;
|
||||
screen->spirv_version = SPIRV_VERSION(1, 3);
|
||||
else
|
||||
screen->spirv_version = 0x00010000;
|
||||
screen->spirv_version = SPIRV_VERSION(1, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue