diff options
author | Kenneth Graunke <[email protected]> | 2018-09-14 00:49:13 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:09 -0800 |
commit | a06f0fe517e1133458786e249649c2c9375765a9 (patch) | |
tree | 3404020716dcd9d05db998652fa7a2778206c100 /src | |
parent | 5d1dadfc38a0a6a7af1ad66d33466f9dd7916753 (diff) |
iris: set image access correctly
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/iris/iris_context.h | 7 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 21 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 83978aebb99..67460fa2669 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -255,8 +255,11 @@ struct iris_shader_state { struct iris_state_ref ssbo_surface_state[PIPE_MAX_SHADER_BUFFERS]; /** Shader Storage Images (image load store) */ - struct pipe_resource *image[PIPE_MAX_SHADER_IMAGES]; - struct iris_state_ref image_surface_state[PIPE_MAX_SHADER_IMAGES]; + struct { + struct pipe_resource *res; + struct iris_state_ref surface_state; + unsigned access; + } image[PIPE_MAX_SHADER_IMAGES]; struct iris_state_ref sampler_table; struct iris_sampler_state *samplers[IRIS_MAX_TEXTURE_SAMPLERS]; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 0b7cc0db512..3c33d0cc97f 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1513,21 +1513,21 @@ iris_set_shader_images(struct pipe_context *ctx, if (p_images && p_images[i].resource) { const struct pipe_image_view *img = &p_images[i]; struct iris_resource *res = (void *) img->resource; - pipe_resource_reference(&shs->image[start_slot + i], &res->base); + pipe_resource_reference(&shs->image[start_slot + i].res, &res->base); // XXX: these are not retained forever, use a separate uploader? void *map = upload_state(ice->state.surface_uploader, - &shs->image_surface_state[start_slot + i], + &shs->image[start_slot + i].surface_state, 4 * GENX(RENDER_SURFACE_STATE_length), 64); if (!unlikely(map)) { - pipe_resource_reference(&shs->image[start_slot + i], NULL); + pipe_resource_reference(&shs->image[start_slot + i].res, NULL); return; } struct iris_bo *surf_state_bo = - iris_resource_bo(shs->image_surface_state[start_slot + i].res); - shs->image_surface_state[start_slot + i].offset += + iris_resource_bo(shs->image[start_slot + i].surface_state.res); + shs->image[start_slot + i].surface_state.offset += iris_bo_offset_from_base_address(surf_state_bo); isl_surf_usage_flags_t usage = ISL_SURF_USAGE_STORAGE_BIT; @@ -1567,8 +1567,8 @@ iris_set_shader_images(struct pipe_context *ctx, .mocs = MOCS_WB); } } else { - pipe_resource_reference(&shs->image[start_slot + i], NULL); - pipe_resource_reference(&shs->image_surface_state[start_slot + i].res, + pipe_resource_reference(&shs->image[start_slot + i].res, NULL); + pipe_resource_reference(&shs->image[start_slot + i].surface_state.res, NULL); } } @@ -3252,12 +3252,13 @@ static uint32_t use_image(struct iris_batch *batch, struct iris_context *ice, struct iris_shader_state *shs, int i) { - if (!shs->image[i]) + if (!shs->image[i].res) return use_null_surface(batch, ice); - struct iris_state_ref *surf_state = &shs->image_surface_state[i]; + struct iris_state_ref *surf_state = &shs->image[i].surface_state; - iris_use_pinned_bo(batch, iris_resource_bo(shs->image[i]), true); + iris_use_pinned_bo(batch, iris_resource_bo(shs->image[i].res), + shs->image[i].access & PIPE_IMAGE_ACCESS_WRITE); iris_use_pinned_bo(batch, iris_resource_bo(surf_state->res), false); return surf_state->offset; |