We'll be using that to track things for the new VS backend, and this will
avoid cluttering brw_vs_surface_state.c for it.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
GLuint total_grf;
GLbitfield64 outputs_written;
GLuint nr_params; /**< number of float params/constants */
GLuint total_grf;
GLbitfield64 outputs_written;
GLuint nr_params; /**< number of float params/constants */
+ GLuint nr_pull_params; /**< number of dwords referenced by pull_param[] */
GLuint total_scratch;
GLuint inputs_read;
GLuint total_scratch;
GLuint inputs_read;
int constant = 0;
int vert_result_reoder[VERT_RESULT_MAX];
int bfc = 0;
int constant = 0;
int vert_result_reoder[VERT_RESULT_MAX];
int bfc = 0;
+ struct brw_vertex_program *vp = c->vp;
+ const struct gl_program_parameter_list *params = vp->program.Base.Parameters;
/* Determine whether to use a real constant buffer or use a block
* of GRF registers for constants. The later is faster but only
/* Determine whether to use a real constant buffer or use a block
* of GRF registers for constants. The later is faster but only
if (constant == max_constant)
c->vp->use_const_buffer = GL_TRUE;
if (constant == max_constant)
c->vp->use_const_buffer = GL_TRUE;
+ /* Set up the references to the pull parameters if present. This backend
+ * uses a 1:1 mapping from Mesa IR's index to location in the pull constant
+ * buffer, while the new VS backend allocates values to the pull buffer on
+ * demand.
+ */
+ if (c->vp->use_const_buffer) {
+ for (i = 0; i < params->NumParameters * 4; i++) {
+ c->prog_data.pull_param[i] = ¶ms->ParameterValues[i / 4][i % 4].f;
+ }
+ c->prog_data.nr_pull_params = i;
+ }
+
for (i = 0; i < constant; i++) {
c->regs[PROGRAM_STATE_VAR][i] = stride(brw_vec4_grf(reg + i / 2,
(i % 2) * 4),
for (i = 0; i < constant; i++) {
c->regs[PROGRAM_STATE_VAR][i] = stride(brw_vec4_grf(reg + i / 2,
(i % 2) * 4),
{
struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
{
struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
+ /* BRW_NEW_VERTEX_PROGRAM */
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
const struct gl_program_parameter_list *params = vp->program.Base.Parameters;
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
const struct gl_program_parameter_list *params = vp->program.Base.Parameters;
- const int size = params->NumParameters * 4 * sizeof(GLfloat);
int i;
if (vp->program.IsNVProgram)
int i;
if (vp->program.IsNVProgram)
*/
_mesa_load_state_parameters(&brw->intel.ctx, vp->program.Base.Parameters);
*/
_mesa_load_state_parameters(&brw->intel.ctx, vp->program.Base.Parameters);
- /* BRW_NEW_VERTEX_PROGRAM */
- if (!vp->use_const_buffer) {
+ /* CACHE_NEW_VS_PROG */
+ if (!brw->vs.prog_data->nr_pull_params) {
if (brw->vs.const_bo) {
drm_intel_bo_unreference(brw->vs.const_bo);
brw->vs.const_bo = NULL;
if (brw->vs.const_bo) {
drm_intel_bo_unreference(brw->vs.const_bo);
brw->vs.const_bo = NULL;
/* _NEW_PROGRAM_CONSTANTS */
drm_intel_bo_unreference(brw->vs.const_bo);
brw->vs.const_bo = drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer",
/* _NEW_PROGRAM_CONSTANTS */
drm_intel_bo_unreference(brw->vs.const_bo);
brw->vs.const_bo = drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer",
+ brw->vs.prog_data->nr_pull_params * 4,
+ 64);
drm_intel_gem_bo_map_gtt(brw->vs.const_bo);
drm_intel_gem_bo_map_gtt(brw->vs.const_bo);
- for (i = 0; i < params->NumParameters; i++) {
- memcpy(brw->vs.const_bo->virtual + i * 4 * sizeof(float),
- params->ParameterValues[i],
- 4 * sizeof(float));
+ for (i = 0; i < brw->vs.prog_data->nr_pull_params; i++) {
+ memcpy(brw->vs.const_bo->virtual + i * 4,
+ brw->vs.prog_data->pull_param[i],
+ 4);
.dirty = {
.mesa = (_NEW_PROGRAM_CONSTANTS),
.brw = (BRW_NEW_VERTEX_PROGRAM),
.dirty = {
.mesa = (_NEW_PROGRAM_CONSTANTS),
.brw = (BRW_NEW_VERTEX_PROGRAM),
+ .cache = CACHE_NEW_VS_PROG,
},
.prepare = prepare_vs_constants,
};
},
.prepare = prepare_vs_constants,
};