summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-07-16 16:25:02 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:07 -0800
commita6d480f892879823bcfe9568c9eb68ed39279f74 (patch)
tree03a341761d41e822bb204424c765c44280350ff7
parent48b826cdaf56253d9c380ef42ad8ac927944eb4b (diff)
iris: bind state helper function
-rw-r--r--src/gallium/drivers/iris/iris_program.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 5ac582955f7..3d3b80bf5fb 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -83,21 +83,26 @@ iris_delete_shader_state(struct pipe_context *ctx, void *state)
}
static void
-iris_bind_vs_state(struct pipe_context *ctx, void *state)
+bind_state(struct iris_context *ice,
+ struct iris_uncompiled_shader *ish,
+ gl_shader_stage stage)
{
- struct iris_context *ice = (struct iris_context *)ctx;
+ uint64_t dirty_bit = IRIS_DIRTY_UNCOMPILED_VS << stage;
- ice->shaders.uncompiled[MESA_SHADER_VERTEX] = state;
- ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_VS;
+ ice->shaders.uncompiled[stage] = ish;
+ ice->state.dirty |= dirty_bit;
}
static void
-iris_bind_tcs_state(struct pipe_context *ctx, void *state)
+iris_bind_vs_state(struct pipe_context *ctx, void *state)
{
- struct iris_context *ice = (struct iris_context *)ctx;
+ bind_state((void *) ctx, state, MESA_SHADER_VERTEX);
+}
- ice->shaders.uncompiled[MESA_SHADER_TESS_CTRL] = state;
- ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_TCS;
+static void
+iris_bind_tcs_state(struct pipe_context *ctx, void *state)
+{
+ bind_state((void *) ctx, state, MESA_SHADER_TESS_CTRL);
}
static void
@@ -108,8 +113,7 @@ iris_bind_tes_state(struct pipe_context *ctx, void *state)
if (!!state != !!ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL])
ice->state.dirty |= IRIS_DIRTY_URB;
- ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL] = state;
- ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_TES;
+ bind_state((void *) ctx, state, MESA_SHADER_TESS_EVAL);
}
static void
@@ -120,17 +124,13 @@ iris_bind_gs_state(struct pipe_context *ctx, void *state)
if (!!state != !!ice->shaders.uncompiled[MESA_SHADER_GEOMETRY])
ice->state.dirty |= IRIS_DIRTY_URB;
- ice->shaders.uncompiled[MESA_SHADER_GEOMETRY] = state;
- ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_GS;
+ bind_state((void *) ctx, state, MESA_SHADER_GEOMETRY);
}
static void
iris_bind_fs_state(struct pipe_context *ctx, void *state)
{
- struct iris_context *ice = (struct iris_context *)ctx;
-
- ice->shaders.uncompiled[MESA_SHADER_FRAGMENT] = state;
- ice->state.dirty |= IRIS_DIRTY_UNCOMPILED_FS;
+ bind_state((void *) ctx, state, MESA_SHADER_FRAGMENT);
}
/**