From b945e9dfb722f9a3f0cf019be4cf844e74c57155 Mon Sep 17 00:00:00 2001 From: Beliefzh Date: Thu, 26 Jun 2025 22:01:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?CTS=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Beliefzh --- src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c | 6 +++++- src/gallium/drivers/zink/zink_context.c | 2 +- src/gallium/drivers/zink/zink_lower_cubemap_to_array.c | 4 +++- src/gallium/drivers/zink/zink_screen.c | 2 -- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c index f02ffda1caa..7c0d62db329 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -300,6 +300,7 @@ spirv_builder_emit_vertex(struct spirv_builder *b, uint32_t stream, bool multist unsigned words = 1; SpvOp op = SpvOpEmitVertex; if (multistream) { + spirv_builder_emit_cap(b, SpvCapabilityGeometryStreams); op = SpvOpEmitStreamVertex; words++; } @@ -314,6 +315,9 @@ spirv_builder_end_primitive(struct spirv_builder *b, uint32_t stream, bool multi { unsigned words = 1; SpvOp op = SpvOpEndPrimitive; + + if (multistream) + spirv_builder_emit_cap(b, SpvCapabilityGeometryStreams); if (multistream || stream > 0) { op = SpvOpEndStreamPrimitive; words++; @@ -417,7 +421,7 @@ spirv_builder_emit_member_builtin(struct spirv_builder *b, SpvId target, uint32_t member, SpvBuiltIn builtin) { uint32_t args[] = { builtin }; - emit_member_decoration(b, target, member, SpvDecorationBuiltin, + emit_member_decoration(b, target, member, SpvDecorationBuiltIn, args, ARRAY_SIZE(args)); } diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index aa23d79db9c..9bc47a52abe 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -5203,7 +5203,7 @@ zink_get_dummy_pipe_surface(struct zink_context *ctx, int samples_index) if (ctx->dummy_surface[samples_index]) { /* delete old surface if ETOOSMALL */ struct zink_resource *res = zink_resource(ctx->dummy_surface[samples_index]->texture); - if (res->base.b.width0 > size || res->base.b.height0 > size) { + if (res->base.b.width0 < size || res->base.b.height0 < size) { pipe_surface_release(&ctx->base, &ctx->dummy_surface[samples_index]); needs_null_init = !samples_index && ctx->di.null_fbfetch_init; if (!samples_index) diff --git a/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c b/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c index cfadb6e9ba8..8557c114d5b 100644 --- a/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c +++ b/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c @@ -388,9 +388,11 @@ lower_cube_coords(nir_builder *b, nir_def *coord, bool is_array) static void rewrite_cube_var_type(nir_builder *b, nir_tex_instr *tex) { - nir_variable *sampler = nir_deref_instr_get_variable(nir_instr_as_deref(tex->src[nir_tex_instr_src_index(tex, nir_tex_src_texture_deref)].src.ssa->parent_instr)); + nir_deref_instr *texture_deref = nir_instr_as_deref(tex->src[nir_tex_instr_src_index(tex, nir_tex_src_texture_deref)].src.ssa->parent_instr); + nir_variable *sampler = nir_deref_instr_get_variable(texture_deref); assert(sampler); sampler->type = make_2darray_from_cubemap_with_array(sampler->type); + texture_deref->type = sampler->type; } /* txb(s, coord, bias) = txl(s, coord, lod(s, coord).y + bias) */ diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index a0709d094fe..c25737d9d09 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -3392,8 +3392,6 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev goto fail; } - screen->info.feats.features.geometryShader = false; - if (zink_set_driver_strings(screen)) { mesa_loge("ZINK: failed to set driver strings\n"); goto fail; -- Gitee From c24ccf4fedd70188e3f950ceb3712073b0beae09 Mon Sep 17 00:00:00 2001 From: Beliefzh Date: Thu, 26 Jun 2025 22:01:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?CTS=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Beliefzh --- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 2 -- src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c | 6 +++++- src/gallium/drivers/zink/zink_context.c | 2 +- src/gallium/drivers/zink/zink_lower_cubemap_to_array.c | 4 +++- src/gallium/drivers/zink/zink_screen.c | 2 -- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index f0a56a724a2..0a7bb948d34 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -4766,8 +4766,6 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, const s case MESA_SHADER_GEOMETRY: spirv_builder_emit_cap(&ctx.builder, SpvCapabilityGeometry); - if (s->info.gs.active_stream_mask) - spirv_builder_emit_cap(&ctx.builder, SpvCapabilityGeometryStreams); if (s->info.outputs_written & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) spirv_builder_emit_cap(&ctx.builder, SpvCapabilityGeometryPointSize); break; diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c index f02ffda1caa..7c0d62db329 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -300,6 +300,7 @@ spirv_builder_emit_vertex(struct spirv_builder *b, uint32_t stream, bool multist unsigned words = 1; SpvOp op = SpvOpEmitVertex; if (multistream) { + spirv_builder_emit_cap(b, SpvCapabilityGeometryStreams); op = SpvOpEmitStreamVertex; words++; } @@ -314,6 +315,9 @@ spirv_builder_end_primitive(struct spirv_builder *b, uint32_t stream, bool multi { unsigned words = 1; SpvOp op = SpvOpEndPrimitive; + + if (multistream) + spirv_builder_emit_cap(b, SpvCapabilityGeometryStreams); if (multistream || stream > 0) { op = SpvOpEndStreamPrimitive; words++; @@ -417,7 +421,7 @@ spirv_builder_emit_member_builtin(struct spirv_builder *b, SpvId target, uint32_t member, SpvBuiltIn builtin) { uint32_t args[] = { builtin }; - emit_member_decoration(b, target, member, SpvDecorationBuiltin, + emit_member_decoration(b, target, member, SpvDecorationBuiltIn, args, ARRAY_SIZE(args)); } diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index aa23d79db9c..9bc47a52abe 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -5203,7 +5203,7 @@ zink_get_dummy_pipe_surface(struct zink_context *ctx, int samples_index) if (ctx->dummy_surface[samples_index]) { /* delete old surface if ETOOSMALL */ struct zink_resource *res = zink_resource(ctx->dummy_surface[samples_index]->texture); - if (res->base.b.width0 > size || res->base.b.height0 > size) { + if (res->base.b.width0 < size || res->base.b.height0 < size) { pipe_surface_release(&ctx->base, &ctx->dummy_surface[samples_index]); needs_null_init = !samples_index && ctx->di.null_fbfetch_init; if (!samples_index) diff --git a/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c b/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c index cfadb6e9ba8..8557c114d5b 100644 --- a/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c +++ b/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c @@ -388,9 +388,11 @@ lower_cube_coords(nir_builder *b, nir_def *coord, bool is_array) static void rewrite_cube_var_type(nir_builder *b, nir_tex_instr *tex) { - nir_variable *sampler = nir_deref_instr_get_variable(nir_instr_as_deref(tex->src[nir_tex_instr_src_index(tex, nir_tex_src_texture_deref)].src.ssa->parent_instr)); + nir_deref_instr *texture_deref = nir_instr_as_deref(tex->src[nir_tex_instr_src_index(tex, nir_tex_src_texture_deref)].src.ssa->parent_instr); + nir_variable *sampler = nir_deref_instr_get_variable(texture_deref); assert(sampler); sampler->type = make_2darray_from_cubemap_with_array(sampler->type); + texture_deref->type = sampler->type; } /* txb(s, coord, bias) = txl(s, coord, lod(s, coord).y + bias) */ diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index a0709d094fe..c25737d9d09 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -3392,8 +3392,6 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev goto fail; } - screen->info.feats.features.geometryShader = false; - if (zink_set_driver_strings(screen)) { mesa_loge("ZINK: failed to set driver strings\n"); goto fail; -- Gitee