mt->logical_height0 = height0;
mt->logical_depth0 = depth0;
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_NO_MCS;
+ exec_list_make_empty(&mt->hiz_map);
/* The cpp is bytes per (1, blockheight)-sized block for compressed
* textures. This is why you'll see divides by blockheight all over
return false;
/* Mark that all slices need a HiZ resolve. */
- struct intel_resolve_map *head = &mt->hiz_map;
for (int level = mt->first_level; level <= mt->last_level; ++level) {
if (!intel_miptree_level_enable_hiz(brw, mt, level))
continue;
for (int layer = 0; layer < mt->level[level].depth; ++layer) {
- head->next = malloc(sizeof(*head->next));
- head->next->prev = head;
- head->next->next = NULL;
- head = head->next;
-
- head->level = level;
- head->layer = layer;
- head->need = GEN6_HIZ_OP_HIZ_RESOLVE;
+ struct intel_resolve_map *m = malloc(sizeof(struct intel_resolve_map));
+ exec_node_init(&m->link);
+ m->level = level;
+ m->layer = layer;
+ m->need = GEN6_HIZ_OP_HIZ_RESOLVE;
+
+ exec_list_push_tail(&mt->hiz_map, &m->link);
}
}
enum gen6_hiz_op need)
{
bool did_resolve = false;
- struct intel_resolve_map *i, *next;
- for (i = mt->hiz_map.next; i; i = next) {
- next = i->next;
- if (i->need != need)
+ foreach_list_safe(node, &mt->hiz_map) {
+ struct intel_resolve_map *map = (struct intel_resolve_map *)node;
+
+ if (map->need != need)
continue;
- intel_hiz_exec(brw, mt, i->level, i->layer, need);
- intel_resolve_map_remove(i);
+ intel_hiz_exec(brw, mt, map->level, map->layer, need);
+ intel_resolve_map_remove(map);
did_resolve = true;
}
* \c mt->hiz_map. The resolve map of the child HiZ miptree, \c
* mt->hiz_mt->hiz_map, is unused.
*/
- struct intel_resolve_map hiz_map;
+ struct exec_list hiz_map; /* List of intel_resolve_map. */
/**
* \brief Stencil miptree for depthstencil textures.
* changed to the given value of \c need.
*/
void
-intel_resolve_map_set(struct intel_resolve_map *head,
+intel_resolve_map_set(struct exec_list *resolve_map,
uint32_t level,
uint32_t layer,
enum gen6_hiz_op need)
{
- struct intel_resolve_map **tail = &head->next;
- struct intel_resolve_map *prev = head;
-
- while (*tail) {
- if ((*tail)->level == level && (*tail)->layer == layer) {
- (*tail)->need = need;
+ foreach_list_typed(struct intel_resolve_map, map, link, resolve_map) {
+ if (map->level == level && map->layer == layer) {
+ map->need = need;
return;
}
- prev = *tail;
- tail = &(*tail)->next;
}
- *tail = malloc(sizeof(**tail));
- (*tail)->prev = prev;
- (*tail)->next = NULL;
- (*tail)->level = level;
- (*tail)->layer = layer;
- (*tail)->need = need;
+ struct intel_resolve_map *m = malloc(sizeof(struct intel_resolve_map));
+ exec_node_init(&m->link);
+ m->level = level;
+ m->layer = layer;
+ m->need = need;
+
+ exec_list_push_tail(resolve_map, &m->link);
}
/**
* \brief Get an element from the map.
* \return null if element is not contained in map.
*/
-struct intel_resolve_map*
-intel_resolve_map_get(struct intel_resolve_map *head,
+struct intel_resolve_map *
+intel_resolve_map_get(struct exec_list *resolve_map,
uint32_t level,
uint32_t layer)
{
- struct intel_resolve_map *item = head->next;
-
- while (item) {
- if (item->level == level && item->layer == layer)
- break;
- else
- item = item->next;
+ foreach_list_typed(struct intel_resolve_map, map, link, resolve_map) {
+ if (map->level == level && map->layer == layer)
+ return map;
}
- return item;
+ return NULL;
}
/**
void
intel_resolve_map_remove(struct intel_resolve_map *elem)
{
- if (elem->prev)
- elem->prev->next = elem->next;
- if (elem->next)
- elem->next->prev = elem->prev;
+ exec_node_remove(&elem->link);
free(elem);
}
* \brief Remove and free all elements of the map.
*/
void
-intel_resolve_map_clear(struct intel_resolve_map *head)
+intel_resolve_map_clear(struct exec_list *resolve_map)
{
- struct intel_resolve_map *next = head->next;
- struct intel_resolve_map *trash;
-
- while (next) {
- trash = next;
- next = next->next;
- free(trash);
+ foreach_list_safe(node, resolve_map) {
+ free(node);
}
- head->next = NULL;
+ exec_list_make_empty(resolve_map);
}
#pragma once
#include <stdint.h>
+#include "glsl/list.h"
#ifdef __cplusplus
extern "C" {
* necessary.
*/
struct intel_resolve_map {
+ struct exec_node link;
+
uint32_t level;
uint32_t layer;
enum gen6_hiz_op need;
-
- struct intel_resolve_map *next;
- struct intel_resolve_map *prev;
};
void
-intel_resolve_map_set(struct intel_resolve_map *head,
+intel_resolve_map_set(struct exec_list *resolve_map,
uint32_t level,
uint32_t layer,
enum gen6_hiz_op need);
-struct intel_resolve_map*
-intel_resolve_map_get(struct intel_resolve_map *head,
+struct intel_resolve_map *
+intel_resolve_map_get(struct exec_list *resolve_map,
uint32_t level,
uint32_t layer);
void
-intel_resolve_map_remove(struct intel_resolve_map *elem);
+intel_resolve_map_remove(struct intel_resolve_map *resolve_map);
void
-intel_resolve_map_clear(struct intel_resolve_map *head);
+intel_resolve_map_clear(struct exec_list *resolve_map);
#ifdef __cplusplus
} /* extern "C" */