[Mesa-dev] [PATCH 5/7] anv: descriptorSet: allocate hidden ubo for border colors
Lionel Landwerlin
llandwerlin at gmail.com
Mon Nov 21 17:47:38 UTC 2016
This additional buffer stores workaround border colors & mask based of the
format's number of channels for integer formats on Gen7.5.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
src/intel/vulkan/anv_descriptor_set.c | 16 ++++++++++++++++
src/intel/vulkan/anv_private.h | 13 +++++++++++++
2 files changed, 29 insertions(+)
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 30aa50e..7b5efc2 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -500,6 +500,7 @@ anv_descriptor_set_create(struct anv_device *device,
set->buffer_views =
(struct anv_buffer_view *) &set->descriptors[layout->size];
set->buffer_count = layout->buffer_count;
+ memset(&set->gen7, 0, sizeof(set->gen7));
/* By defining the descriptors to be zero now, we can later verify that
* a descriptor has not been populated with user data.
@@ -542,6 +543,15 @@ anv_descriptor_set_create(struct anv_device *device,
set->buffer_views[b].surface_state = state;
}
+ /* Allocate border color workaround buffer if needed. */
+ if (layout->border_color_index > 0) {
+ set->gen7.border_colors_state =
+ anv_state_pool_alloc(&device->dynamic_state_pool,
+ sizeof(*set->gen7.border_colors) *
+ layout->border_color_count, 64);
+ set->gen7.border_colors = set->gen7.border_colors_state.map;
+ }
+
*out_set = set;
return VK_SUCCESS;
@@ -552,6 +562,12 @@ anv_descriptor_set_destroy(struct anv_device *device,
struct anv_descriptor_pool *pool,
struct anv_descriptor_set *set)
{
+ /* Free border color workaround buffer if it was allocated. */
+ if (set->gen7.border_colors_state.alloc_size > 0) {
+ anv_state_pool_free(&device->dynamic_state_pool,
+ set->gen7.border_colors_state);
+ }
+
/* Put the buffer view surface state back on the free list. */
for (uint32_t b = 0; b < set->buffer_count; b++) {
struct surface_state_free_list_entry *entry =
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 19b08b3..d3bbd97 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -878,8 +878,21 @@ struct anv_descriptor {
};
};
+struct gen7_border_color {
+ uint32_t color[4];
+ uint32_t color_mask[4];
+ uint32_t alpha_overwrite;
+ uint32_t wrapping;
+};
+
struct anv_descriptor_set {
const struct anv_descriptor_set_layout *layout;
+
+ struct {
+ struct anv_state border_colors_state;
+ struct gen7_border_color *border_colors;
+ } gen7;
+
uint32_t size;
uint32_t buffer_count;
struct anv_buffer_view *buffer_views;
--
2.10.2
More information about the mesa-dev
mailing list