diff options
author | Marek Olšák <[email protected]> | 2017-01-17 17:39:16 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-01-18 19:51:31 +0100 |
commit | 3ae3be6dd44dbc5ac6ec847ce67c53c10479a75c (patch) | |
tree | 51695a67b5ab6dc054474274028dc230ff4015db | |
parent | b0cc55f29831638069407a4c1a5c809b26902ab6 (diff) |
radeonsi: move shader pipe context state into a separate structure
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 20 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 16 |
2 files changed, 22 insertions, 14 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 758403518f6..5a24318b96f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -251,18 +251,26 @@ enum { struct si_shader; +/* State of the context creating the shader object. */ +struct si_compiler_ctx_state { + /* Should only be used by si_init_shader_selector_async and + * si_build_shader_variant if thread_index == -1 (non-threaded). */ + LLVMTargetMachineRef tm; + + /* Used if thread_index == -1 or if debug.async is true. */ + struct pipe_debug_callback debug; + + /* Used for creating the log string for gallium/ddebug. */ + bool is_debug_context; +}; + /* A shader selector is a gallium CSO and contains shader variants and * binaries for one TGSI program. This can be shared by multiple contexts. */ struct si_shader_selector { struct si_screen *screen; struct util_queue_fence ready; - - /* Should only be used by si_init_shader_selector_async - * if thread_index == -1 (non-threaded). */ - LLVMTargetMachineRef tm; - struct pipe_debug_callback debug; - bool is_debug_context; + struct si_compiler_ctx_state compiler_ctx_state; pipe_mutex mutex; struct si_shader *first_variant; /* immutable after the first variant */ diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 1ae344a62cc..eaba19a8bc1 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1086,7 +1086,7 @@ static void si_build_shader_variant(void *job, int thread_index) struct si_shader_selector *sel = shader->selector; struct si_screen *sscreen = sel->screen; LLVMTargetMachineRef tm; - struct pipe_debug_callback *debug = &sel->debug; + struct pipe_debug_callback *debug = &sel->compiler_ctx_state.debug; int r; if (thread_index >= 0) { @@ -1095,7 +1095,7 @@ static void si_build_shader_variant(void *job, int thread_index) if (!debug->async) debug = NULL; } else { - tm = sel->tm; + tm = sel->compiler_ctx_state.tm; } r = si_shader_create(sscreen, tm, shader, debug); @@ -1106,7 +1106,7 @@ static void si_build_shader_variant(void *job, int thread_index) return; } - if (sel->is_debug_context) { + if (sel->compiler_ctx_state.is_debug_context) { FILE *f = open_memstream(&shader->shader_log, &shader->shader_log_size); if (f) { @@ -1292,7 +1292,7 @@ void si_init_shader_selector_async(void *job, int thread_index) struct si_shader_selector *sel = (struct si_shader_selector *)job; struct si_screen *sscreen = sel->screen; LLVMTargetMachineRef tm; - struct pipe_debug_callback *debug = &sel->debug; + struct pipe_debug_callback *debug = &sel->compiler_ctx_state.debug; unsigned i; if (thread_index >= 0) { @@ -1301,7 +1301,7 @@ void si_init_shader_selector_async(void *job, int thread_index) if (!debug->async) debug = NULL; } else { - tm = sel->tm; + tm = sel->compiler_ctx_state.tm; } /* Compile the main shader part for use with a prolog and/or epilog. @@ -1455,9 +1455,9 @@ static void *si_create_shader_selector(struct pipe_context *ctx, return NULL; sel->screen = sscreen; - sel->tm = sctx->tm; - sel->debug = sctx->b.debug; - sel->is_debug_context = sctx->is_debug; + sel->compiler_ctx_state.tm = sctx->tm; + sel->compiler_ctx_state.debug = sctx->b.debug; + sel->compiler_ctx_state.is_debug_context = sctx->is_debug; sel->tokens = tgsi_dup_tokens(state->tokens); if (!sel->tokens) { FREE(sel); |