diff options
author | Petri Latvala <[email protected]> | 2014-02-27 16:15:04 +0200 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-02-28 15:05:38 -0800 |
commit | 7189fce237cc7f4bc76a85cca8bcf75756d9affc (patch) | |
tree | 610b1f94173f5210eab4f2eadb6b1ae73edbc16a /src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | |
parent | 96f324e229d035e6b00e15c96b69a00999d1adcb (diff) |
i965: Allocate vec4_visitor's uniform_size and uniform_vector_size arrays dynamically.
v2: Don't add function parameters, pass the required size in
prog_data->nr_params.
v3:
- Use the name uniform_array_size instead of uniform_param_count.
- Round up when dividing param_count by 4.
- Use MAX2() instead of taking the maximum by hand.
- Don't crash if prog_data passed to vec4_visitor constructor is NULL
v4: Rebase for current master
v5 (idr): Trivial whitespace change.
Signed-off-by: Petri Latvala <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71254
Cc: "10.1" <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index aedab931701..cc92a8acc89 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -3401,6 +3401,17 @@ vec4_visitor::vec4_visitor(struct brw_context *brw, this->max_grf = brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF; this->uniforms = 0; + + /* Initialize uniform_array_size to at least 1 because pre-gen6 VS requires + * at least one. See setup_uniforms() in brw_vec4.cpp. + */ + this->uniform_array_size = 1; + if (prog_data) { + this->uniform_array_size = MAX2(stage_prog_data->nr_params, 1); + } + + this->uniform_size = rzalloc_array(mem_ctx, int, this->uniform_array_size); + this->uniform_vector_size = rzalloc_array(mem_ctx, int, this->uniform_array_size); } vec4_visitor::~vec4_visitor() |