mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
zink: add flags to zink_gfx_program and zink_context
Adds `optimal_keys` and `needs_inlining` to `zink_gfx_program` and `is_generated_gs_bound` to `zink_context` Those will be needed for shaders that rely on some uniforms to be inlined Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21238>
This commit is contained in:
parent
027ba4ccef
commit
a6de15eff5
2 changed files with 9 additions and 1 deletions
|
|
@ -384,6 +384,7 @@ update_gfx_shader_modules(struct zink_context *ctx,
|
||||||
state->modules[i] = zm->shader;
|
state->modules[i] = zm->shader;
|
||||||
if (prog->modules[i] == zm->shader)
|
if (prog->modules[i] == zm->shader)
|
||||||
continue;
|
continue;
|
||||||
|
prog->optimal_keys &= !prog->shaders[i]->non_fs.is_generated;
|
||||||
variant_hash ^= prog->module_hash[i];
|
variant_hash ^= prog->module_hash[i];
|
||||||
hash_changed = true;
|
hash_changed = true;
|
||||||
default_variants &= zm->default_variant;
|
default_variants &= zm->default_variant;
|
||||||
|
|
@ -565,7 +566,7 @@ ALWAYS_INLINE static void
|
||||||
update_gfx_program_nonseamless(struct zink_context *ctx, struct zink_gfx_program *prog, bool has_nonseamless)
|
update_gfx_program_nonseamless(struct zink_context *ctx, struct zink_gfx_program *prog, bool has_nonseamless)
|
||||||
{
|
{
|
||||||
struct zink_screen *screen = zink_screen(ctx->base.screen);
|
struct zink_screen *screen = zink_screen(ctx->base.screen);
|
||||||
if (screen->driconf.inline_uniforms)
|
if (screen->driconf.inline_uniforms || prog->needs_inlining)
|
||||||
update_gfx_shader_modules(ctx, screen, prog,
|
update_gfx_shader_modules(ctx, screen, prog,
|
||||||
ctx->dirty_gfx_stages & prog->stages_present, &ctx->gfx_pipeline_state,
|
ctx->dirty_gfx_stages & prog->stages_present, &ctx->gfx_pipeline_state,
|
||||||
true, has_nonseamless);
|
true, has_nonseamless);
|
||||||
|
|
@ -1034,6 +1035,7 @@ zink_create_gfx_program(struct zink_context *ctx,
|
||||||
prog->ctx = ctx;
|
prog->ctx = ctx;
|
||||||
prog->gfx_hash = gfx_hash;
|
prog->gfx_hash = gfx_hash;
|
||||||
prog->base.removed = true;
|
prog->base.removed = true;
|
||||||
|
prog->optimal_keys = screen->optimal_keys;
|
||||||
|
|
||||||
prog->has_edgeflags = prog->shaders[MESA_SHADER_VERTEX] &&
|
prog->has_edgeflags = prog->shaders[MESA_SHADER_VERTEX] &&
|
||||||
prog->shaders[MESA_SHADER_VERTEX]->has_edgeflags;
|
prog->shaders[MESA_SHADER_VERTEX]->has_edgeflags;
|
||||||
|
|
@ -1045,6 +1047,7 @@ zink_create_gfx_program(struct zink_context *ctx,
|
||||||
if (stages[i]) {
|
if (stages[i]) {
|
||||||
prog->shaders[i] = stages[i];
|
prog->shaders[i] = stages[i];
|
||||||
prog->stages_present |= BITFIELD_BIT(i);
|
prog->stages_present |= BITFIELD_BIT(i);
|
||||||
|
prog->optimal_keys &= !prog->shaders[i]->non_fs.is_generated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stages[MESA_SHADER_TESS_EVAL] && !stages[MESA_SHADER_TESS_CTRL]) {
|
if (stages[MESA_SHADER_TESS_EVAL] && !stages[MESA_SHADER_TESS_CTRL]) {
|
||||||
|
|
@ -2297,6 +2300,7 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx)
|
||||||
|
|
||||||
bind_gfx_stage(ctx, MESA_SHADER_GEOMETRY,
|
bind_gfx_stage(ctx, MESA_SHADER_GEOMETRY,
|
||||||
ctx->gfx_stages[prev_vertex_stage]->non_fs.generated_gs[ctx->gfx_pipeline_state.gfx_prim_mode][zink_prim_type]);
|
ctx->gfx_stages[prev_vertex_stage]->non_fs.generated_gs[ctx->gfx_pipeline_state.gfx_prim_mode][zink_prim_type]);
|
||||||
|
ctx->is_generated_gs_bound = true;
|
||||||
}
|
}
|
||||||
} else if (ctx->gfx_stages[MESA_SHADER_GEOMETRY] &&
|
} else if (ctx->gfx_stages[MESA_SHADER_GEOMETRY] &&
|
||||||
ctx->gfx_stages[MESA_SHADER_GEOMETRY]->non_fs.is_generated)
|
ctx->gfx_stages[MESA_SHADER_GEOMETRY]->non_fs.is_generated)
|
||||||
|
|
@ -2349,6 +2353,7 @@ zink_create_primitive_emulation_gs(struct zink_context *ctx)
|
||||||
|
|
||||||
bind_gfx_stage(ctx, MESA_SHADER_GEOMETRY,
|
bind_gfx_stage(ctx, MESA_SHADER_GEOMETRY,
|
||||||
ctx->gfx_stages[prev_vertex_stage]->non_fs.generated_gs[ctx->gfx_pipeline_state.gfx_prim_mode][zink_prim_type]);
|
ctx->gfx_stages[prev_vertex_stage]->non_fs.generated_gs[ctx->gfx_pipeline_state.gfx_prim_mode][zink_prim_type]);
|
||||||
|
ctx->is_generated_gs_bound = true;
|
||||||
}
|
}
|
||||||
} else if (ctx->gfx_stages[MESA_SHADER_GEOMETRY] &&
|
} else if (ctx->gfx_stages[MESA_SHADER_GEOMETRY] &&
|
||||||
ctx->gfx_stages[MESA_SHADER_GEOMETRY]->non_fs.is_generated)
|
ctx->gfx_stages[MESA_SHADER_GEOMETRY]->non_fs.is_generated)
|
||||||
|
|
|
||||||
|
|
@ -1030,7 +1030,9 @@ struct zink_gfx_program {
|
||||||
unsigned inlined_variant_count[ZINK_GFX_SHADER_COUNT];
|
unsigned inlined_variant_count[ZINK_GFX_SHADER_COUNT];
|
||||||
uint32_t default_variant_hash;
|
uint32_t default_variant_hash;
|
||||||
uint8_t inline_variants; //which stages are using inlined uniforms
|
uint8_t inline_variants; //which stages are using inlined uniforms
|
||||||
|
bool needs_inlining; // whether this program requires some uniforms to be inlined
|
||||||
bool has_edgeflags;
|
bool has_edgeflags;
|
||||||
|
bool optimal_keys;
|
||||||
|
|
||||||
/* separable */
|
/* separable */
|
||||||
struct zink_gfx_program *full_prog;
|
struct zink_gfx_program *full_prog;
|
||||||
|
|
@ -1708,6 +1710,7 @@ struct zink_context {
|
||||||
uint8_t dirty_gfx_stages; /* mask of changed gfx shader stages */
|
uint8_t dirty_gfx_stages; /* mask of changed gfx shader stages */
|
||||||
bool last_vertex_stage_dirty;
|
bool last_vertex_stage_dirty;
|
||||||
bool compute_dirty;
|
bool compute_dirty;
|
||||||
|
bool is_generated_gs_bound;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
VkRenderingAttachmentInfo attachments[PIPE_MAX_COLOR_BUFS + 2]; //+depth, +stencil
|
VkRenderingAttachmentInfo attachments[PIPE_MAX_COLOR_BUFS + 2]; //+depth, +stencil
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue