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;
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;
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,
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);
}
static void
si_resident_handles_update_needs_color_decompress(struct si_context *sctx)
{
- unsigned num_resident_tex_handles, num_resident_img_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_resource *res = tex_handle->view->texture;
+ util_dynarray_foreach(&sctx->resident_tex_handles,
+ struct si_texture_handle *, tex_handle) {
+ struct pipe_resource *res = (*tex_handle)->view->texture;
if (res && res->target != PIPE_BUFFER) {
struct r600_texture *rtex = (struct r600_texture *)res;
- tex_handle->needs_color_decompress =
+ (*tex_handle)->needs_color_decompress =
color_needs_decompression(rtex);
}
}
- 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 pipe_resource *res = view->resource;
if (res && res->target != PIPE_BUFFER) {
struct r600_texture *rtex = (struct r600_texture *)res;
- img_handle->needs_color_decompress =
+ (*img_handle)->needs_color_decompress =
color_needs_decompression(rtex);
}
}
/* Bindless texture handles */
if (rbuffer->texture_handle_allocated) {
- unsigned num_resident_tex_handles;
-
- 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;
- struct si_bindless_descriptor *desc = tex_handle->desc;
+ util_dynarray_foreach(&sctx->resident_tex_handles,
+ struct si_texture_handle *, tex_handle) {
+ struct pipe_sampler_view *view = (*tex_handle)->view;
+ struct si_bindless_descriptor *desc = (*tex_handle)->desc;
if (view->texture == buf) {
si_set_buf_desc_address(rbuffer,
/* Bindless image handles */
if (rbuffer->image_handle_allocated) {
- unsigned num_resident_img_handles;
-
- 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;
- struct si_bindless_descriptor *desc = img_handle->desc;
+ util_dynarray_foreach(&sctx->resident_img_handles,
+ struct si_image_handle *, img_handle) {
+ struct pipe_image_view *view = &(*img_handle)->view;
+ struct si_bindless_descriptor *desc = (*img_handle)->desc;
if (view->resource == buf) {
if (view->access & PIPE_IMAGE_ACCESS_WRITE)
void si_all_resident_buffers_begin_new_cs(struct si_context *sctx)
{
unsigned num_resident_tex_handles, num_resident_img_handles;
- unsigned num_bindless_descriptors;
- unsigned i;
num_resident_tex_handles = sctx->resident_tex_handles.size /
sizeof(struct si_texture_handle *);
if (!num_resident_tex_handles && !num_resident_img_handles)
return;
- num_bindless_descriptors = sctx->bindless_descriptors.size /
- sizeof(struct r600_resource *);
-
/* Add all bindless descriptors. */
- for (i = 0; i < num_bindless_descriptors; i++) {
- struct r600_resource *desc =
- *util_dynarray_element(&sctx->bindless_descriptors,
- struct r600_resource *, i);
+ util_dynarray_foreach(&sctx->bindless_descriptors,
+ struct r600_resource *, desc) {
- radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, desc,
+ radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, *desc,
RADEON_USAGE_READWRITE,
RADEON_PRIO_DESCRIPTORS);
}
/* Add all resident texture handles. */
- 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 si_sampler_view *sview =
- (struct si_sampler_view *)tex_handle->view;
+ (struct si_sampler_view *)(*tex_handle)->view;
si_sampler_view_add_buffer(sctx, sview->base.texture,
RADEON_USAGE_READ,
}
/* Add all resident image handles. */
- 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;
si_sampler_view_add_buffer(sctx, view->resource,
RADEON_USAGE_READWRITE,
static void si_upload_bindless_descriptors(struct si_context *sctx)
{
- unsigned num_resident_tex_handles, num_resident_img_handles;
- unsigned i;
-
if (!sctx->bindless_descriptors_dirty)
return;
SI_CONTEXT_CS_PARTIAL_FLUSH;
si_emit_cache_flush(sctx);
- 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 si_bindless_descriptor *desc = tex_handle->desc;
+ util_dynarray_foreach(&sctx->resident_tex_handles,
+ struct si_texture_handle *, tex_handle) {
+ struct si_bindless_descriptor *desc = (*tex_handle)->desc;
if (!desc->dirty)
continue;
desc->dirty = false;
}
- 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 si_bindless_descriptor *desc = img_handle->desc;
+ util_dynarray_foreach(&sctx->resident_img_handles,
+ struct si_image_handle *, img_handle) {
+ struct si_bindless_descriptor *desc = (*img_handle)->desc;
if (!desc->dirty)
continue;