zink: add ZINK_DEBUG=nopc to completely disable precompilation

I hack this in all the time for debugging anyway

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28766>
This commit is contained in:
Mike Blumenkrantz
2024-04-15 09:32:13 -04:00
committed by Marge Bot
parent a83fd26d0e
commit b7b51295bf
3 changed files with 18 additions and 10 deletions
+16 -10
View File
@@ -2217,16 +2217,18 @@ zink_create_gfx_shader_state(struct pipe_context *pctx, const struct pipe_shader
void *ret = zink_shader_create(zink_screen(pctx->screen), nir);
if (nir->info.separate_shader && zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB &&
(screen->info.have_EXT_shader_object ||
(screen->info.have_EXT_graphics_pipeline_library && (nir->info.stage == MESA_SHADER_FRAGMENT || nir->info.stage == MESA_SHADER_VERTEX)))) {
struct zink_shader *zs = ret;
/* sample shading can't precompile */
if (nir->info.stage != MESA_SHADER_FRAGMENT || !nir->info.fs.uses_sample_shading) {
if (zink_debug & ZINK_DEBUG_NOBGC)
precompile_separate_shader_job(zs, screen, 0);
else
util_queue_add_job(&screen->cache_get_thread, zs, &zs->precompile.fence, precompile_separate_shader_job, NULL, 0);
if (!(zink_debug & ZINK_DEBUG_NOPC)) {
if (nir->info.separate_shader && zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB &&
(screen->info.have_EXT_shader_object ||
(screen->info.have_EXT_graphics_pipeline_library && (nir->info.stage == MESA_SHADER_FRAGMENT || nir->info.stage == MESA_SHADER_VERTEX)))) {
struct zink_shader *zs = ret;
/* sample shading can't precompile */
if (nir->info.stage != MESA_SHADER_FRAGMENT || !nir->info.fs.uses_sample_shading) {
if (zink_debug & ZINK_DEBUG_NOBGC)
precompile_separate_shader_job(zs, screen, 0);
else
util_queue_add_job(&screen->cache_get_thread, zs, &zs->precompile.fence, precompile_separate_shader_job, NULL, 0);
}
}
}
ralloc_free(nir);
@@ -2297,6 +2299,10 @@ zink_program_init(struct zink_context *ctx)
STATIC_ASSERT(sizeof(union zink_shader_key_optimal) == sizeof(uint32_t));
/* no precompile at all */
if (zink_debug & ZINK_DEBUG_NOPC)
return;
struct zink_screen *screen = zink_screen(ctx->base.screen);
if (screen->info.have_EXT_graphics_pipeline_library || screen->info.have_EXT_shader_object || zink_debug & ZINK_DEBUG_SHADERDB)
ctx->base.link_shader = zink_link_gfx_shader;
+1
View File
@@ -118,6 +118,7 @@ zink_debug_options[] = {
{ "mem", ZINK_DEBUG_MEM, "Debug memory allocations" },
{ "quiet", ZINK_DEBUG_QUIET, "Suppress warnings" },
{ "ioopt", ZINK_DEBUG_IOOPT, "Optimize IO" },
{ "nopc", ZINK_DEBUG_NOPC, "No precompilation" },
DEBUG_NAMED_VALUE_END
};
+1
View File
@@ -242,6 +242,7 @@ enum zink_debug {
ZINK_DEBUG_MEM = (1<<18),
ZINK_DEBUG_QUIET = (1<<19),
ZINK_DEBUG_IOOPT = (1<<20),
ZINK_DEBUG_NOPC = (1<<21),
};
enum zink_pv_emulation_primitive {