GLuint offset = brw->curbe.wm_start * 16;
/* BRW_NEW_FS_PROG_DATA | _NEW_PROGRAM_CONSTANTS: copy uniform values */
- for (i = 0; i < brw->wm.base.prog_data->nr_params; i++) {
- buf[offset + i] = *brw->wm.base.prog_data->param[i];
- }
+ brw_populate_constant_data(brw, fp, brw->wm.base.prog_data, &buf[offset],
+ brw->wm.base.prog_data->param,
+ brw->wm.base.prog_data->nr_params);
}
/* clipper constants */
GLuint offset = brw->curbe.vs_start * 16;
/* BRW_NEW_VS_PROG_DATA | _NEW_PROGRAM_CONSTANTS: copy uniform values */
- for (i = 0; i < brw->vs.base.prog_data->nr_params; i++) {
- buf[offset + i] = *brw->vs.base.prog_data->param[i];
- }
+ brw_populate_constant_data(brw, vp, brw->vs.base.prog_data, &buf[offset],
+ brw->vs.base.prog_data->param,
+ brw->vs.base.prog_data->nr_params);
}
if (0) {
/* gen6_constant_state.c */
void
+brw_populate_constant_data(struct brw_context *brw,
+ const struct gl_program *prog,
+ const struct brw_stage_prog_data *prog_data,
+ void *dst,
+ const union gl_constant_value **param,
+ unsigned nr_params);
+void
brw_upload_pull_constants(struct brw_context *brw,
GLbitfield64 brw_new_constbuf,
const struct gl_program *prog,
#include "intel_buffer_objects.h"
#include "program/prog_parameter.h"
+void
+brw_populate_constant_data(struct brw_context *brw,
+ const struct gl_program *prog,
+ const struct brw_stage_prog_data *prog_data,
+ void *void_dst,
+ const union gl_constant_value **param,
+ unsigned nr_params)
+{
+ gl_constant_value *dst = void_dst;
+ for (unsigned i = 0; i < nr_params; i++)
+ dst[i] = *param[i];
+}
+
+
/**
* Creates a streamed BO containing the push constants for the VS or GS on
* gen6+.
* side effect of dereferencing uniforms, so _NEW_PROGRAM_CONSTANTS
* wouldn't be set for them.
*/
- for (i = 0; i < prog_data->nr_params; i++) {
- param[i] = *prog_data->param[i];
- }
+ brw_populate_constant_data(brw, prog, prog_data, param,
+ prog_data->param,
+ prog_data->nr_params);
if (0) {
fprintf(stderr, "%s constants:\n",
STATIC_ASSERT(sizeof(gl_constant_value) == sizeof(float));
- for (i = 0; i < prog_data->nr_pull_params; i++) {
- constants[i] = *prog_data->pull_param[i];
- }
+ brw_populate_constant_data(brw, prog, prog_data, constants,
+ prog_data->pull_param,
+ prog_data->nr_pull_params);
if (0) {
for (i = 0; i < ALIGN(prog_data->nr_pull_params, 4) / 4; i++) {