mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
i965/vs: generalize gen6_vs_push_constants in preparation for GS.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
4ec2604422
commit
f560ce4a38
2 changed files with 36 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue