diff options
author | Paul Berry <[email protected]> | 2013-03-27 13:15:45 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-08-31 17:12:43 -0700 |
commit | f560ce4a38f1316586ad2650488f1a812cfab058 (patch) | |
tree | d7d3d1103070d41f287489479cf7eec793bec453 /src | |
parent | 4ec2604422fc820e35d8de7f1dd91500a270ff5a (diff) |
i965/vs: generalize gen6_vs_push_constants in preparation for GS.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_vs_state.c | 45 |
2 files changed, 36 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index f4a8647a0c1..7aafe6e4579 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1628,6 +1628,13 @@ brw_setup_vec4_key_clip_info(struct brw_context *brw, struct brw_vec4_prog_key *key, bool program_uses_clip_distance); +void +gen6_upload_vec4_push_constants(struct brw_context *brw, + const struct gl_program *prog, + const struct brw_vec4_prog_data *prog_data, + struct brw_stage_state *stage_state, + enum state_struct_type type); + #ifdef __cplusplus } #endif diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index 98c7aec1ec6..569ec8cdc89 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -33,32 +33,30 @@ #include "program/prog_statevars.h" #include "intel_batchbuffer.h" -static void -gen6_upload_vs_push_constants(struct brw_context *brw) +void +gen6_upload_vec4_push_constants(struct brw_context *brw, + const struct gl_program *prog, + const struct brw_vec4_prog_data *prog_data, + struct brw_stage_state *stage_state, + enum state_struct_type type) { struct gl_context *ctx = &brw->ctx; - struct brw_stage_state *stage_state = &brw->vs.base; - - /* _BRW_NEW_VERTEX_PROGRAM */ - const struct brw_vertex_program *vp = - brw_vertex_program_const(brw->vertex_program); /* Updates the ParamaterValues[i] pointers for all parameters of the * basic type of PROGRAM_STATE_VAR. */ /* XXX: Should this happen somewhere before to get our state flag set? */ - _mesa_load_state_parameters(ctx, vp->program.Base.Parameters); + _mesa_load_state_parameters(ctx, prog->Parameters); - /* CACHE_NEW_VS_PROG */ - if (brw->vs.prog_data->base.nr_params == 0) { + if (prog_data->nr_params == 0) { stage_state->push_const_size = 0; } else { int params_uploaded; float *param; int i; - param = brw_state_batch(brw, AUB_TRACE_VS_CONSTANTS, - brw->vs.prog_data->base.nr_params * sizeof(float), + param = brw_state_batch(brw, type, + prog_data->nr_params * sizeof(float), 32, &stage_state->push_const_offset); /* _NEW_PROGRAM_CONSTANTS @@ -67,13 +65,13 @@ gen6_upload_vs_push_constants(struct brw_context *brw) * side effect of dereferencing uniforms, so _NEW_PROGRAM_CONSTANTS * wouldn't be set for them. */ - for (i = 0; i < brw->vs.prog_data->base.nr_params; i++) { - param[i] = *brw->vs.prog_data->base.param[i]; + for (i = 0; i < prog_data->nr_params; i++) { + param[i] = *prog_data->param[i]; } - params_uploaded = brw->vs.prog_data->base.nr_params / 4; + params_uploaded = prog_data->nr_params / 4; if (0) { - printf("VS constant buffer:\n"); + printf("Constant buffer:\n"); for (i = 0; i < params_uploaded; i++) { float *buf = param + i * 4; printf("%d: %f %f %f %f\n", @@ -87,6 +85,21 @@ gen6_upload_vs_push_constants(struct brw_context *brw) } } +static void +gen6_upload_vs_push_constants(struct brw_context *brw) +{ + struct brw_stage_state *stage_state = &brw->vs.base; + + /* _BRW_NEW_VERTEX_PROGRAM */ + const struct brw_vertex_program *vp = + brw_vertex_program_const(brw->vertex_program); + /* CACHE_NEW_VS_PROG */ + const struct brw_vec4_prog_data *prog_data = &brw->vs.prog_data->base; + + gen6_upload_vec4_push_constants(brw, &vp->program.Base, prog_data, + stage_state, AUB_TRACE_VS_CONSTANTS); +} + const struct brw_tracked_state gen6_vs_push_constants = { .dirty = { .mesa = _NEW_TRANSFORM | _NEW_PROGRAM_CONSTANTS, |