mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
radeonsi: move shader pipe context state into a separate structure
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
b0cc55f298
commit
3ae3be6dd4
2 changed files with 22 additions and 14 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue