zink: generate spirv 1.5 from ntv when using vk >= 1.2
this has an ntv option so further tuning here should be easy enough Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10512>
This commit is contained in:
committed by
Marge Bot
parent
6398605f28
commit
3bf52471cc
@@ -34,6 +34,7 @@
|
||||
|
||||
struct ntv_context {
|
||||
void *mem_ctx;
|
||||
bool spirv_15;
|
||||
|
||||
struct spirv_builder builder;
|
||||
|
||||
@@ -3487,13 +3488,14 @@ get_spacing(enum gl_tess_spacing spacing)
|
||||
}
|
||||
|
||||
struct spirv_shader *
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info)
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, bool spirv_15)
|
||||
{
|
||||
struct spirv_shader *ret = NULL;
|
||||
|
||||
struct ntv_context ctx = {};
|
||||
ctx.mem_ctx = ralloc_context(NULL);
|
||||
ctx.builder.mem_ctx = ctx.mem_ctx;
|
||||
ctx.spirv_15 = spirv_15;
|
||||
|
||||
switch (s->info.stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
@@ -3812,7 +3814,7 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info)
|
||||
if (!ret->words)
|
||||
goto fail;
|
||||
|
||||
ret->num_words = spirv_builder_get_words(&ctx.builder, ret->words, num_words);
|
||||
ret->num_words = spirv_builder_get_words(&ctx.builder, ret->words, num_words, ctx.spirv_15);
|
||||
assert(ret->num_words == num_words);
|
||||
|
||||
ralloc_free(ctx.mem_ctx);
|
||||
|
||||
@@ -43,7 +43,7 @@ struct nir_shader;
|
||||
struct pipe_stream_output_info;
|
||||
|
||||
struct spirv_shader *
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info);
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, bool spirv_15);
|
||||
|
||||
void
|
||||
spirv_shader_delete(struct spirv_shader *s);
|
||||
|
||||
@@ -1542,13 +1542,13 @@ spirv_builder_get_num_words(struct spirv_builder *b)
|
||||
|
||||
size_t
|
||||
spirv_builder_get_words(struct spirv_builder *b, uint32_t *words,
|
||||
size_t num_words)
|
||||
size_t num_words, bool spirv_15)
|
||||
{
|
||||
assert(num_words >= spirv_builder_get_num_words(b));
|
||||
|
||||
size_t written = 0;
|
||||
words[written++] = SpvMagicNumber;
|
||||
words[written++] = 0x00010000;
|
||||
words[written++] = spirv_15 ? 0x00010500 : 0x00010000;
|
||||
words[written++] = 0;
|
||||
words[written++] = b->prev_id + 1;
|
||||
words[written++] = 0;
|
||||
|
||||
@@ -448,7 +448,7 @@ spirv_builder_get_num_words(struct spirv_builder *b);
|
||||
|
||||
size_t
|
||||
spirv_builder_get_words(struct spirv_builder *b, uint32_t *words,
|
||||
size_t num_words);
|
||||
size_t num_words, bool spirv_15);
|
||||
|
||||
void
|
||||
spirv_builder_emit_vertex(struct spirv_builder *b, uint32_t stream);
|
||||
|
||||
@@ -629,7 +629,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, struct z
|
||||
|
||||
assign_io_locations(nir, shader_slot_map, shader_slots_reserved);
|
||||
|
||||
struct spirv_shader *spirv = nir_to_spirv(nir, streamout);
|
||||
struct spirv_shader *spirv = nir_to_spirv(nir, streamout, screen->vk_version >= VK_MAKE_VERSION(1, 2, 0));
|
||||
if (!spirv)
|
||||
goto done;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user