From: Kenneth Graunke Date: Mon, 16 Jul 2018 23:25:02 +0000 (-0700) Subject: iris: bind state helper function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a6d480f892879823bcfe9568c9eb68ed39279f74;p=mesa.git iris: bind state helper function --- 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); } /**