summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_blit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_blit.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_blit.c62
1 files changed, 15 insertions, 47 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 9c38ae9edc8..bfce5a411f1 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -634,20 +634,12 @@ static void si_check_render_feedback_images(struct si_context *sctx,
static void si_check_render_feedback_resident_textures(struct si_context *sctx)
{
- unsigned num_resident_tex_handles;
- unsigned i;
-
- num_resident_tex_handles = sctx->resident_tex_handles.size /
- sizeof(struct si_texture_handle *);
-
- for (i = 0; i < num_resident_tex_handles; i++) {
- struct si_texture_handle *tex_handle =
- *util_dynarray_element(&sctx->resident_tex_handles,
- struct si_texture_handle *, i);
+ util_dynarray_foreach(&sctx->resident_tex_handles,
+ struct si_texture_handle *, tex_handle) {
struct pipe_sampler_view *view;
struct r600_texture *tex;
- view = tex_handle->view;
+ view = (*tex_handle)->view;
if (view->texture->target == PIPE_BUFFER)
continue;
@@ -663,20 +655,12 @@ static void si_check_render_feedback_resident_textures(struct si_context *sctx)
static void si_check_render_feedback_resident_images(struct si_context *sctx)
{
- unsigned num_resident_img_handles;
- unsigned i;
-
- num_resident_img_handles = sctx->resident_img_handles.size /
- sizeof(struct si_image_handle *);
-
- for (i = 0; i < num_resident_img_handles; i++) {
- struct si_image_handle *img_handle =
- *util_dynarray_element(&sctx->resident_img_handles,
- struct si_image_handle *, i);
+ util_dynarray_foreach(&sctx->resident_img_handles,
+ struct si_image_handle *, img_handle) {
struct pipe_image_view *view;
struct r600_texture *tex;
- view = &img_handle->view;
+ view = &(*img_handle)->view;
if (view->resource->target == PIPE_BUFFER)
continue;
@@ -709,28 +693,20 @@ static void si_check_render_feedback(struct si_context *sctx)
static void si_decompress_resident_textures(struct si_context *sctx)
{
- unsigned num_resident_tex_handles;
- unsigned i;
-
- num_resident_tex_handles = sctx->resident_tex_handles.size /
- sizeof(struct si_texture_handle *);
-
- for (i = 0; i < num_resident_tex_handles; i++) {
- struct si_texture_handle *tex_handle =
- *util_dynarray_element(&sctx->resident_tex_handles,
- struct si_texture_handle *, i);
- struct pipe_sampler_view *view = tex_handle->view;
+ util_dynarray_foreach(&sctx->resident_tex_handles,
+ struct si_texture_handle *, tex_handle) {
+ struct pipe_sampler_view *view = (*tex_handle)->view;
struct si_sampler_view *sview = (struct si_sampler_view *)view;
struct r600_texture *tex = (struct r600_texture *)view->texture;
if (view->texture->target == PIPE_BUFFER)
continue;
- if (tex_handle->needs_color_decompress)
+ if ((*tex_handle)->needs_color_decompress)
si_decompress_color_texture(sctx, tex, view->u.tex.first_level,
view->u.tex.last_level);
- if (tex_handle->needs_depth_decompress)
+ if ((*tex_handle)->needs_depth_decompress)
si_decompress_depth(sctx, tex,
sview->is_stencil_sampler ? PIPE_MASK_S : PIPE_MASK_Z,
view->u.tex.first_level, view->u.tex.last_level,
@@ -740,23 +716,15 @@ static void si_decompress_resident_textures(struct si_context *sctx)
static void si_decompress_resident_images(struct si_context *sctx)
{
- unsigned num_resident_img_handles;
- unsigned i;
-
- num_resident_img_handles = sctx->resident_img_handles.size /
- sizeof(struct si_image_handle *);
-
- for (i = 0; i < num_resident_img_handles; i++) {
- struct si_image_handle *img_handle =
- *util_dynarray_element(&sctx->resident_img_handles,
- struct si_image_handle *, i);
- struct pipe_image_view *view = &img_handle->view;
+ util_dynarray_foreach(&sctx->resident_img_handles,
+ struct si_image_handle *, img_handle) {
+ struct pipe_image_view *view = &(*img_handle)->view;
struct r600_texture *tex = (struct r600_texture *)view->resource;
if (view->resource->target == PIPE_BUFFER)
continue;
- if (img_handle->needs_color_decompress)
+ if ((*img_handle)->needs_color_decompress)
si_decompress_color_texture(sctx, tex, view->u.tex.level,
view->u.tex.level);
}