summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_private.h
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-10-05 14:43:23 -0700
committerChad Versace <[email protected]>2015-10-05 17:46:04 -0700
commitffd051830d837705f4da6d16e59953b02066c91e (patch)
tree32d5af74dce2d9d4ecd0cd459aeddab3497ea322 /src/vulkan/anv_private.h
parent63439953d7f51700e1834e3003e209b387772b5e (diff)
vk: Unionize anv_desciptor
For a given struct anv_descriptor, all members are NULL (in which case the descriptor is empty) or exactly one member is non-NULL. To make struct anv_descriptor better reflect its set of valid states, convert the struct into a tagged union.
Diffstat (limited to 'src/vulkan/anv_private.h')
-rw-r--r--src/vulkan/anv_private.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h
index bc747fcd27c..6ce5db209cb 100644
--- a/src/vulkan/anv_private.h
+++ b/src/vulkan/anv_private.h
@@ -728,9 +728,19 @@ struct anv_descriptor_set_layout {
struct anv_descriptor_slot entries[0];
};
+enum anv_descriptor_type {
+ ANV_DESCRIPTOR_TYPE_EMPTY = 0,
+ ANV_DESCRIPTOR_TYPE_SAMPLER,
+ ANV_DESCRIPTOR_TYPE_SURFACE_VIEW,
+};
+
struct anv_descriptor {
- struct anv_sampler *sampler;
- struct anv_surface_view *view;
+ union {
+ struct anv_sampler *sampler;
+ struct anv_surface_view *surface_view;
+ };
+
+ enum anv_descriptor_type type;
};
struct anv_descriptor_set {