summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/zink/zink_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/zink/zink_program.c')
-rw-r--r--src/gallium/drivers/zink/zink_program.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 29dffd49589..e1a52aa18b3 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -106,7 +106,7 @@ get_shader_module_for_stage(struct zink_context *ctx, struct zink_screen *screen
}
if (ctx && zs->nir->info.num_inlinable_uniforms &&
ctx->inlinable_uniforms_valid_mask & BITFIELD64_BIT(pstage)) {
- if (screen->is_cpu || prog->inlined_variant_count[pstage] < ZINK_MAX_INLINED_VARIANTS)
+ if (zs->can_inline && (screen->is_cpu || prog->inlined_variant_count[pstage] < ZINK_MAX_INLINED_VARIANTS))
inline_size = zs->nir->info.num_inlinable_uniforms;
else
key->inline_uniforms = false;
@@ -425,6 +425,7 @@ zink_create_gfx_program(struct zink_context *ctx,
goto fail;
pipe_reference_init(&prog->base.reference, 1);
+ util_queue_fence_init(&prog->base.cache_fence);
for (int i = 0; i < ZINK_SHADER_COUNT; ++i) {
list_inithead(&prog->shader_cache[i][0][0]);
@@ -536,6 +537,7 @@ zink_create_compute_program(struct zink_context *ctx, struct zink_shader *shader
goto fail;
pipe_reference_init(&comp->base.reference, 1);
+ util_queue_fence_init(&comp->base.cache_fence);
comp->base.is_compute = true;
comp->curr = comp->module = CALLOC_STRUCT(zink_shader_module);
@@ -960,6 +962,24 @@ bind_last_vertex_stage(struct zink_context *ctx)
/* always unset vertex shader values when changing to a non-vs last stage */
memset(&ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_VERTEX].key.vs_base, 0, sizeof(struct zink_vs_key_base));
}
+
+ unsigned num_viewports = ctx->vp_state.num_viewports;
+ struct zink_screen *screen = zink_screen(ctx->base.screen);
+ /* number of enabled viewports is based on whether last vertex stage writes viewport index */
+ if (ctx->last_vertex_stage) {
+ if (ctx->last_vertex_stage->nir->info.outputs_written & (VARYING_BIT_VIEWPORT | VARYING_BIT_VIEWPORT_MASK))
+ ctx->vp_state.num_viewports = MIN2(screen->info.props.limits.maxViewports, PIPE_MAX_VIEWPORTS);
+ else
+ ctx->vp_state.num_viewports = 1;
+ } else {
+ ctx->vp_state.num_viewports = 1;
+ }
+ ctx->vp_state_changed |= num_viewports != ctx->vp_state.num_viewports;
+ if (!screen->info.have_EXT_extended_dynamic_state) {
+ if (ctx->gfx_pipeline_state.dyn_state1.num_viewports != ctx->vp_state.num_viewports)
+ ctx->gfx_pipeline_state.dirty = true;
+ ctx->gfx_pipeline_state.dyn_state1.num_viewports = ctx->vp_state.num_viewports;
+ }
ctx->last_vertex_stage_dirty = true;
}
}
@@ -971,8 +991,8 @@ zink_bind_vs_state(struct pipe_context *pctx,
struct zink_context *ctx = zink_context(pctx);
if (!cso && !ctx->gfx_stages[PIPE_SHADER_VERTEX])
return;
- void *prev = ctx->gfx_stages[PIPE_SHADER_VERTEX];
bind_stage(ctx, PIPE_SHADER_VERTEX, cso);
+ bind_last_vertex_stage(ctx);
if (cso) {
struct zink_shader *zs = cso;
ctx->shader_reads_drawid = BITSET_TEST(zs->nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID);
@@ -981,9 +1001,6 @@ zink_bind_vs_state(struct pipe_context *pctx,
ctx->shader_reads_drawid = false;
ctx->shader_reads_basevertex = false;
}
- if (ctx->last_vertex_stage == prev)
- ctx->last_vertex_stage = cso;
-
}
/* if gl_SampleMask[] is written to, we have to ensure that we get a shader with the same sample count: