diff options
author | Dave Airlie <[email protected]> | 2017-11-03 11:33:44 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-12-05 20:31:50 +0000 |
commit | 12a96aaf907ac3a64dc61943234f9bb479bef701 (patch) | |
tree | 3013d486d551b4786f51bb3ec5c9f95e124e5706 /src/gallium/drivers | |
parent | ca64281690a9c9f8ff083e1f1df963f2f70fe07c (diff) |
r600: refactor and export some shader selector code for compute
This just moves some code around to make it easier to add compute.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 24 |
2 files changed, 27 insertions, 7 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 4af87e1a3ae..4028d98d960 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -1023,6 +1023,16 @@ void eg_trace_emit(struct r600_context *rctx); void eg_dump_debug_state(struct pipe_context *ctx, FILE *f, unsigned flags); +struct r600_pipe_shader_selector *r600_create_shader_state_tokens(struct pipe_context *ctx, + const struct tgsi_token *tokens, + unsigned pipe_shader_type); +int r600_shader_select(struct pipe_context *ctx, + struct r600_pipe_shader_selector* sel, + bool *dirty); + +void r600_delete_shader_selector(struct pipe_context *ctx, + struct r600_pipe_shader_selector *sel); + struct r600_shader_atomic; bool evergreen_emit_atomic_buffer_setup(struct r600_context *rctx, struct r600_pipe_shader *cs_shader, diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index aedf210a22a..938a85f2387 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -829,7 +829,7 @@ static inline void r600_shader_selector_key(const struct pipe_context *ctx, /* Select the hw shader variant depending on the current state. * (*dirty) is set to 1 if current variant was changed */ -static int r600_shader_select(struct pipe_context *ctx, +int r600_shader_select(struct pipe_context *ctx, struct r600_pipe_shader_selector* sel, bool *dirty) { @@ -897,17 +897,27 @@ static int r600_shader_select(struct pipe_context *ctx, return 0; } +struct r600_pipe_shader_selector *r600_create_shader_state_tokens(struct pipe_context *ctx, + const struct tgsi_token *tokens, + unsigned pipe_shader_type) +{ + struct r600_pipe_shader_selector *sel = CALLOC_STRUCT(r600_pipe_shader_selector); + int i; + + sel->type = pipe_shader_type; + sel->tokens = tgsi_dup_tokens(tokens); + tgsi_scan_shader(tokens, &sel->info); + return sel; +} + static void *r600_create_shader_state(struct pipe_context *ctx, const struct pipe_shader_state *state, unsigned pipe_shader_type) { - struct r600_pipe_shader_selector *sel = CALLOC_STRUCT(r600_pipe_shader_selector); int i; + struct r600_pipe_shader_selector *sel = r600_create_shader_state_tokens(ctx, state->tokens, pipe_shader_type); - sel->type = pipe_shader_type; - sel->tokens = tgsi_dup_tokens(state->tokens); sel->so = state->stream_output; - tgsi_scan_shader(state->tokens, &sel->info); switch (pipe_shader_type) { case PIPE_SHADER_GEOMETRY: @@ -1048,8 +1058,8 @@ static void r600_bind_tes_state(struct pipe_context *ctx, void *state) rctx->b.streamout.stride_in_dw = rctx->tes_shader->so.stride; } -static void r600_delete_shader_selector(struct pipe_context *ctx, - struct r600_pipe_shader_selector *sel) +void r600_delete_shader_selector(struct pipe_context *ctx, + struct r600_pipe_shader_selector *sel) { struct r600_pipe_shader *p = sel->current, *c; while (p) { |