summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>2016-02-22 17:00:10 -0800
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>2016-02-22 17:00:10 -0800
commit01a0552d13ace0c9b649fa90915cc5c5ea2ac4a0 (patch)
treed02e87e8adabe83121692c2562cd958e846955dc
parentc1e510a9ec1155f68ae91a93ab53cbd71f57c959 (diff)
Add support for t_descriptor_pool
-rw-r--r--include/tapi/t_data.h2
-rw-r--r--src/framework/test/t_data.c9
-rw-r--r--src/framework/test/t_phase_setup.c31
-rw-r--r--src/framework/test/test.h1
-rw-r--r--src/tests/func/compute-local-id.c4
-rw-r--r--src/tests/func/compute-num-workgroups.c4
-rw-r--r--src/tests/func/compute.c4
-rw-r--r--src/tests/func/desc/dynamic.c4
-rw-r--r--src/tests/func/first.c2
-rw-r--r--src/tests/func/miptree/miptree.c4
-rw-r--r--src/tests/func/ssbo/interleave.c4
11 files changed, 62 insertions, 7 deletions
diff --git a/include/tapi/t_data.h b/include/tapi/t_data.h
index 76769d5..99f1b73 100644
--- a/include/tapi/t_data.h
+++ b/include/tapi/t_data.h
@@ -61,6 +61,7 @@ typedef struct cru_image cru_image_t;
#define t_mem_type_index_for_device_access (__t_mem_type_index_for_device_access())
#define t_device (*__t_device())
#define t_queue (*__t_queue())
+#define t_descriptor_pool (*__t_descriptor_pool())
#define t_cmd_pool (*__t_cmd_pool())
#define t_cmd_buffer (*__t_cmd_buffer())
#define t_color_image (*__t_color_image())
@@ -86,6 +87,7 @@ const VkPhysicalDeviceMemoryProperties *__t_physical_dev_mem_props(void);
const uint32_t __t_mem_type_index_for_mmap(void);
const uint32_t __t_mem_type_index_for_device_access(void);
const VkQueue *__t_queue(void);
+const VkDescriptorPool *__t_descriptor_pool(void);
const VkCommandPool *__t_cmd_pool(void);
const VkCommandBuffer *__t_cmd_buffer(void);
const VkImage *__t_color_image(void);
diff --git a/src/framework/test/t_data.c b/src/framework/test/t_data.c
index 2215683..9f7eb9e 100644
--- a/src/framework/test/t_data.c
+++ b/src/framework/test/t_data.c
@@ -93,6 +93,15 @@ __t_queue(void)
return &t->vk.queue;
}
+const VkDescriptorPool *
+__t_descriptor_pool(void)
+{
+ ASSERT_TEST_IN_MAJOR_PHASE;
+ GET_CURRENT_TEST(t);
+
+ return &t->vk.descriptor_pool;
+}
+
const VkCommandPool *
__t_cmd_pool(void)
{
diff --git a/src/framework/test/t_phase_setup.c b/src/framework/test/t_phase_setup.c
index 75cb26e..a46b169 100644
--- a/src/framework/test/t_phase_setup.c
+++ b/src/framework/test/t_phase_setup.c
@@ -268,6 +268,35 @@ t_setup_framebuffer(void)
.pAttachments = attachments);
}
+static void
+t_setup_descriptor_pool(void)
+{
+ ASSERT_TEST_IN_SETUP_PHASE;
+ GET_CURRENT_TEST(t);
+
+ VkDescriptorPoolSize pool_sizes[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
+ for (uint32_t i = 0; i < VK_DESCRIPTOR_TYPE_RANGE_SIZE; i++) {
+ pool_sizes[i].type = i;
+ pool_sizes[i].descriptorCount = 5;
+ }
+
+ const VkDescriptorPoolCreateInfo create_info = {
+ .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
+ .pNext = NULL,
+ .flags = 0,
+ .maxSets = 1,
+ .poolSizeCount = 5,
+ .pPoolSizes = pool_sizes
+ };
+
+ VkResult res = vkCreateDescriptorPool(t->vk.device, &create_info, NULL,
+ &t->vk.descriptor_pool);
+ t_assert(res == VK_SUCCESS);
+ t_assert(t->vk.descriptor_pool != VK_NULL_HANDLE);
+
+ t_cleanup_push_vk_descriptor_pool(t->vk.device, t->vk.descriptor_pool);
+}
+
void
t_setup_vulkan(void)
{
@@ -298,6 +327,8 @@ t_setup_vulkan(void)
t_cleanup_push_vk_device(t->vk.device, NULL);
+ t_setup_descriptor_pool();
+
t_setup_framebuffer();
vkGetDeviceQueue(t->vk.device, 0, 0, &t->vk.queue);
diff --git a/src/framework/test/test.h b/src/framework/test/test.h
index d6aa705..a180632 100644
--- a/src/framework/test/test.h
+++ b/src/framework/test/test.h
@@ -144,6 +144,7 @@ struct test {
VkPhysicalDeviceMemoryProperties physical_dev_mem_props;
VkDevice device;
VkQueue queue;
+ VkDescriptorPool descriptor_pool;
VkPipelineCache pipeline_cache;
VkCommandPool cmd_pool;
VkCommandBuffer cmd_buffer;
diff --git a/src/tests/func/compute-local-id.c b/src/tests/func/compute-local-id.c
index 331ca24..90eb0ea 100644
--- a/src/tests/func/compute-local-id.c
+++ b/src/tests/func/compute-local-id.c
@@ -67,7 +67,9 @@ common_init(VkShaderModule cs, const uint32_t ssbo_size)
}, NULL, &pipeline);
VkDescriptorSet set =
- qoAllocateDescriptorSet(t_device, .pSetLayouts = &set_layout);
+ qoAllocateDescriptorSet(t_device,
+ .descriptorPool = t_descriptor_pool,
+ .pSetLayouts = &set_layout);
VkBuffer buffer_out = qoCreateBuffer(t_device, .size = ssbo_size);
VkDeviceMemory mem_out = qoAllocBufferMemory(t_device, buffer_out,
diff --git a/src/tests/func/compute-num-workgroups.c b/src/tests/func/compute-num-workgroups.c
index 213c30d..543af9b 100644
--- a/src/tests/func/compute-num-workgroups.c
+++ b/src/tests/func/compute-num-workgroups.c
@@ -90,7 +90,9 @@ common_init(CTX *ctx)
.layout = ctx->pipeline_layout
}, NULL, &ctx->pipeline);
- ctx->set = qoAllocateDescriptorSet(t_device, .pSetLayouts = &set_layout);
+ ctx->set = qoAllocateDescriptorSet(t_device,
+ .descriptorPool = t_descriptor_pool,
+ .pSetLayouts = &set_layout);
ctx->ssbo_buf = qoCreateBuffer(t_device, .size = ctx->ssbo_size);
ctx->ssbo = qoAllocBufferMemory(t_device, ctx->ssbo_buf,
diff --git a/src/tests/func/compute.c b/src/tests/func/compute.c
index 4107d14..1ada519 100644
--- a/src/tests/func/compute.c
+++ b/src/tests/func/compute.c
@@ -76,7 +76,9 @@ test(void)
}, NULL, &pipeline);
VkDescriptorSet set =
- qoAllocateDescriptorSet(t_device, .pSetLayouts = &set_layout);
+ qoAllocateDescriptorSet(t_device,
+ .descriptorPool = t_descriptor_pool,
+ .pSetLayouts = &set_layout);
VkBuffer buffer = qoCreateBuffer(t_device, .size = 1024);
diff --git a/src/tests/func/desc/dynamic.c b/src/tests/func/desc/dynamic.c
index a6bb811..9cf69ed 100644
--- a/src/tests/func/desc/dynamic.c
+++ b/src/tests/func/desc/dynamic.c
@@ -173,7 +173,9 @@ test(void)
VkPipeline pipeline = create_pipeline(t_device, pipeline_layout, pass);
VkDescriptorSet set =
- qoAllocateDescriptorSet(t_device, .pSetLayouts = &set_layout);
+ qoAllocateDescriptorSet(t_device,
+ .descriptorPool = t_descriptor_pool,
+ .pSetLayouts = &set_layout);
VkBuffer buffer = qoCreateBuffer(t_device, .size = 4096);
diff --git a/src/tests/func/first.c b/src/tests/func/first.c
index f02b6e9..7d6d7de 100644
--- a/src/tests/func/first.c
+++ b/src/tests/func/first.c
@@ -174,7 +174,7 @@ test(void)
VkResult result = vkAllocateDescriptorSets(t_device,
&(VkDescriptorSetAllocateInfo) {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
- .descriptorPool = VK_NULL_HANDLE,
+ .descriptorPool = t_descriptor_pool,
.descriptorSetCount = 2,
.pSetLayouts = set_layout,
}, set);
diff --git a/src/tests/func/miptree/miptree.c b/src/tests/func/miptree/miptree.c
index f5c3d53..0ced389 100644
--- a/src/tests/func/miptree/miptree.c
+++ b/src/tests/func/miptree/miptree.c
@@ -1140,7 +1140,9 @@ init_draw_data(test_draw_data_t *draw_data)
position_data, sizeof(position_data));
VkDescriptorSet desc_set =
- qoAllocateDescriptorSet(t_device, .pSetLayouts = &set_layout);
+ qoAllocateDescriptorSet(t_device,
+ .descriptorPool = t_descriptor_pool,
+ .pSetLayouts = &set_layout);
// Prevent dumb bugs by initializing the struct in one shot.
*draw_data = (test_draw_data_t) {
diff --git a/src/tests/func/ssbo/interleave.c b/src/tests/func/ssbo/interleave.c
index 7fca63f..f7f72cc 100644
--- a/src/tests/func/ssbo/interleave.c
+++ b/src/tests/func/ssbo/interleave.c
@@ -134,7 +134,9 @@ test(void)
}});
VkDescriptorSet set =
- qoAllocateDescriptorSet(t_device, .pSetLayouts = &set_layout);
+ qoAllocateDescriptorSet(t_device,
+ .descriptorPool = t_descriptor_pool,
+ .pSetLayouts = &set_layout);
VkBuffer buffer_in = qoCreateBuffer(t_device, .size = 4096);