summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_pipe.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-10-07 01:48:18 +0200
committerMarek Olšák <[email protected]>2015-10-20 12:51:51 +0200
commit9b54ce3362f117b4d46497b578211bb26554dd78 (patch)
tree147c05c7e33aff01d0a983e73f9c6b78ebe5ae15 /src/gallium/drivers/radeonsi/si_pipe.h
parente57dd7a08bfeacab47d64c3adeb392f8c15ca793 (diff)
radeonsi: support thread-safe shaders shared by multiple contexts
The "current" shader pointer is moved from the CSO to the context, so that the CSO is mostly immutable. The only drawback is that the "current" pointer isn't saved when unbinding a shader and it must be looked up when the shader is bound again. This is also a prerequisite for multithreaded shader compilation. Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.h')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 2abd5b5a0c3..d7a2282952a 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -152,6 +152,15 @@ struct si_viewports {
struct pipe_viewport_state states[SI_MAX_VIEWPORTS];
};
+/* A shader state consists of the shader selector, which is a constant state
+ * object shared by multiple contexts and shouldn't be modified, and
+ * the current shader variant selected for this context.
+ */
+struct si_shader_ctx_state {
+ struct si_shader_selector *cso;
+ struct si_shader *current;
+};
+
struct si_context {
struct r600_common_context b;
struct blitter_context *blitter;
@@ -162,7 +171,7 @@ struct si_context {
void *pstipple_sampler_state;
struct si_screen *screen;
struct pipe_fence_handle *last_gfx_fence;
- struct si_shader_selector *fixed_func_tcs_shader;
+ struct si_shader_ctx_state fixed_func_tcs_shader;
LLVMTargetMachineRef tm;
/* Atoms (direct states). */
@@ -199,11 +208,11 @@ struct si_context {
void *dummy_pixel_shader;
/* shaders */
- struct si_shader_selector *ps_shader;
- struct si_shader_selector *gs_shader;
- struct si_shader_selector *vs_shader;
- struct si_shader_selector *tcs_shader;
- struct si_shader_selector *tes_shader;
+ struct si_shader_ctx_state ps_shader;
+ struct si_shader_ctx_state gs_shader;
+ struct si_shader_ctx_state vs_shader;
+ struct si_shader_ctx_state tcs_shader;
+ struct si_shader_ctx_state tes_shader;
struct si_cs_shader_state cs_shader_state;
/* shader information */