Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
Added query
Browse files Browse the repository at this point in the history
  • Loading branch information
abergmeier committed Nov 20, 2019
1 parent 505fb02 commit 2bb02aa
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/broadcom/vulkan/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_fence, VkFence)
V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_framebuffer, VkFramebuffer)
V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_image, VkImage)
V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_image_view, VkImageView)
V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_query_pool, VkQueryPool)
V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_render_pass, VkRenderPass)
V3DVK_DEFINE_NONDISP_HANDLE_CASTS(v3dvk_semaphore, VkSemaphore)

Expand Down
1 change: 1 addition & 0 deletions src/broadcom/vulkan/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ libv3dvk_files = files(
'v3dvk_image.c',
'v3dvk_memory.c',
'v3dvk_physical_device.c',
'v3dvk_query.c',
'v3dvk_queue.c',
'v3dvk_macro.h',
'v3dvk_semaphore.c',
Expand Down
39 changes: 39 additions & 0 deletions src/broadcom/vulkan/v3dvk_query.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

#include "common.h"
#include "device.h"
#include "vk_alloc.h"
#include "v3dvk_entrypoints.h"
#include "v3dvk_error.h"
#include "v3dvk_query.h"

VkResult
v3dvk_CreateQueryPool(VkDevice _device,
const VkQueryPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkQueryPool *pQueryPool)
{
V3DVK_FROM_HANDLE(v3dvk_device, device, _device);
struct v3dvk_query_pool *pool =
vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);

if (!pool)
return v3dvk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);

*pQueryPool = v3dvk_query_pool_to_handle(pool);
return VK_SUCCESS;
}

void
v3dvk_DestroyQueryPool(VkDevice _device,
VkQueryPool _pool,
const VkAllocationCallbacks *pAllocator)
{
V3DVK_FROM_HANDLE(v3dvk_device, device, _device);
V3DVK_FROM_HANDLE(v3dvk_query_pool, pool, _pool);

if (!pool)
return;

vk_free2(&device->alloc, pAllocator, pool);
}
17 changes: 17 additions & 0 deletions src/broadcom/vulkan/v3dvk_query.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#ifndef V3DVK_QUERY_H
#define V3DVK_QUERY_H

struct v3dvk_query_pool
{
#if 0
uint32_t stride;
uint32_t availability_offset;
uint64_t size;
char *ptr;
VkQueryType type;
uint32_t pipeline_stats_mask;
#endif
};

#endif

0 comments on commit 2bb02aa

Please sign in to comment.