anv/pipeline: Use nir's num_images for allocating image_params
This commit is contained in:
parent
79c0781f44
commit
e0565f40ea
|
@ -280,6 +280,7 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
|
||||||
struct anv_pipeline_bind_map map = {
|
struct anv_pipeline_bind_map map = {
|
||||||
.surface_count = 0,
|
.surface_count = 0,
|
||||||
.sampler_count = 0,
|
.sampler_count = 0,
|
||||||
|
.image_count = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uint32_t set = 0; set < layout->num_sets; set++) {
|
for (uint32_t set = 0; set < layout->num_sets; set++) {
|
||||||
|
@ -351,6 +352,7 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map.image_count > 0) {
|
if (map.image_count > 0) {
|
||||||
|
assert(map.image_count <= MAX_IMAGES);
|
||||||
nir_foreach_variable(var, &shader->uniforms) {
|
nir_foreach_variable(var, &shader->uniforms) {
|
||||||
if (glsl_type_is_image(var->type) ||
|
if (glsl_type_is_image(var->type) ||
|
||||||
(glsl_type_is_array(var->type) &&
|
(glsl_type_is_array(var->type) &&
|
||||||
|
@ -369,7 +371,8 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct anv_push_constants *null_data = NULL;
|
struct anv_push_constants *null_data = NULL;
|
||||||
const gl_constant_value **param = prog_data->param + shader->num_uniforms;
|
const gl_constant_value **param =
|
||||||
|
prog_data->param + (shader->num_uniforms / 4);
|
||||||
const struct brw_image_param *image_param = null_data->images;
|
const struct brw_image_param *image_param = null_data->images;
|
||||||
for (uint32_t i = 0; i < map.image_count; i++) {
|
for (uint32_t i = 0; i < map.image_count; i++) {
|
||||||
setup_vec4_uniform_value(param + BRW_IMAGE_PARAM_SURFACE_IDX_OFFSET,
|
setup_vec4_uniform_value(param + BRW_IMAGE_PARAM_SURFACE_IDX_OFFSET,
|
||||||
|
|
|
@ -341,9 +341,8 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
|
||||||
if (pipeline->layout && pipeline->layout->stage[stage].has_dynamic_offsets)
|
if (pipeline->layout && pipeline->layout->stage[stage].has_dynamic_offsets)
|
||||||
prog_data->nr_params += MAX_DYNAMIC_BUFFERS * 2;
|
prog_data->nr_params += MAX_DYNAMIC_BUFFERS * 2;
|
||||||
|
|
||||||
if (pipeline->bindings[stage].image_count > 0)
|
if (nir->info.num_images > 0)
|
||||||
prog_data->nr_params += pipeline->bindings[stage].image_count *
|
prog_data->nr_params += nir->info.num_images * BRW_IMAGE_PARAM_SIZE;
|
||||||
BRW_IMAGE_PARAM_SIZE;
|
|
||||||
|
|
||||||
if (prog_data->nr_params > 0) {
|
if (prog_data->nr_params > 0) {
|
||||||
/* XXX: I think we're leaking this */
|
/* XXX: I think we're leaking this */
|
||||||
|
|
Loading…
Reference in New Issue