#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
* 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",
}
}
+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,