summaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-10-14 09:36:50 +0200
committerj-p <jp_bruyere@hotmail.com>2021-05-10 08:46:18 +0200
commitb42af4e54b90dc92debadfb8a09d26fc740bc18a (patch)
tree62b177943b8f6e4d59771815461bccdcd6053950 /src
parentc9f7b0155f423afc29339774c0c2ec9546035c8f (diff)
solve macro=type problem for ibo int, debug statistic
Diffstat (limited to 'src')
-rw-r--r--src/vkvg_context.c17
-rw-r--r--src/vkvg_context_internal.c6
-rw-r--r--src/vkvg_context_internal.h17
-rw-r--r--src/vkvg_device.c13
-rw-r--r--src/vkvg_device_internal.h3
5 files changed, 47 insertions, 9 deletions
diff --git a/src/vkvg_context.c b/src/vkvg_context.c
index f0ae09e..7a99356 100644
--- a/src/vkvg_context.c
+++ b/src/vkvg_context.c
@@ -201,6 +201,23 @@ void vkvg_destroy (VkvgContext ctx)
VkDevice dev = ctx->pSurf->dev->vkDev;
+#if VKVG_DBG_STATS
+ vkvg_debug_stats_t* dbgstats = &ctx->pSurf->dev->debug_stats;
+ if (dbgstats->sizePoints < ctx->sizePoints)
+ dbgstats->sizePoints = ctx->sizePoints;
+ if (dbgstats->sizePathes < ctx->sizePathes)
+ dbgstats->sizePathes = ctx->sizePathes;
+ if (dbgstats->sizeVertices < ctx->sizeVertices)
+ dbgstats->sizeVertices = ctx->sizeVertices;
+ if (dbgstats->sizeIndices < ctx->sizeIndices)
+ dbgstats->sizeIndices = ctx->sizeIndices;
+ if (dbgstats->sizeVBO < ctx->sizeVBO)
+ dbgstats->sizeVBO = ctx->sizeVBO;
+ if (dbgstats->sizeIBO < ctx->sizeIBO)
+ dbgstats->sizeIBO = ctx->sizeIBO;
+
+#endif
+
vkDestroyFence (dev, ctx->flushFence,NULL);
vkFreeCommandBuffers(dev, ctx->cmdPool, 2, ctx->cmdBuffers);
vkDestroyCommandPool(dev, ctx->cmdPool, NULL);
diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c
index cfe944c..d3df56b 100644
--- a/src/vkvg_context_internal.c
+++ b/src/vkvg_context_internal.c
@@ -534,11 +534,7 @@ void _start_cmd_for_render_pass (VkvgContext ctx) {
VkDeviceSize offsets[1] = { 0 };
CmdBindVertexBuffers(ctx->cmd, 0, 1, &ctx->vertices.buffer, offsets);
-#if VKVG_IBO_INDEX_TYPE == uint16_t
- CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VK_INDEX_TYPE_UINT16);
-#else
- CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VK_INDEX_TYPE_UINT32);
-#endif
+ CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VKVG_VK_INDEX_TYPE);
_update_push_constants (ctx);
diff --git a/src/vkvg_context_internal.h b/src/vkvg_context_internal.h
index e9b45c9..4f65868 100644
--- a/src/vkvg_context_internal.h
+++ b/src/vkvg_context_internal.h
@@ -33,11 +33,20 @@
#define VKVG_IBO_SIZE (VKVG_VBO_SIZE * 6)
#define VKVG_PATHES_SIZE 16
#define VKVG_ARRAY_THRESHOLD 8
-#define VKVG_IBO_INDEX_TYPE uint16_t
-#if VKVG_IBO_INDEX_TYPE == uint16_t
- #define VKVG_IBO_MAX UINT16_MAX
+
+#define VKVG_IBO_16 0
+#define VKVG_IBO_32 1
+
+#define VKVG_CUR_IBO_TYPE VKVG_IBO_16//change this only
+
+#if VKVG_CUR_IBO_TYPE == VKVG_IBO_16
+ #define VKVG_IBO_MAX UINT16_MAX
+ #define VKVG_IBO_INDEX_TYPE uint16_t
+ #define VKVG_VK_INDEX_TYPE VK_INDEX_TYPE_UINT16
#else
- #define VKVG_IBO_MAX UINT32_MAX
+ #define VKVG_IBO_MAX UINT32_MAX
+ #define VKVG_IBO_INDEX_TYPE uint32_t
+ #define VKVG_VK_INDEX_TYPE VK_INDEX_TYPE_UINT32
#endif
diff --git a/src/vkvg_device.c b/src/vkvg_device.c
index e17b81b..f71b48d 100644
--- a/src/vkvg_device.c
+++ b/src/vkvg_device.c
@@ -43,6 +43,10 @@ VkvgDevice vkvg_device_create_multisample(VkInstance inst, VkPhysicalDevice phy,
dev->vkDev = vkdev;
dev->phy = phy;
+#if VKVG_DBG_STATS
+ dev->debug_stats = (vkvg_debug_stats_t) {0};
+#endif
+
VkFormat format = FB_COLOR_FORMAT;
VkImageTiling tiling;
if (!_get_best_image_tiling (dev, format, &tiling)) {
@@ -187,3 +191,12 @@ void vkvg_device_get_dpy (VkvgDevice dev, int* hdpy, int* vdpy) {
*hdpy = dev->hdpi;
*vdpy = dev->vdpi;
}
+
+#if VKVG_DBG_STATS
+vkvg_debug_stats_t vkvg_device_get_stats (VkvgDevice dev) {
+ return dev->debug_stats;
+}
+vkvg_debug_stats_t vkvg_device_reset_stats (VkvgDevice dev) {
+ dev->debug_stats = (vkvg_debug_stats_t) {0};
+}
+#endif
diff --git a/src/vkvg_device_internal.h b/src/vkvg_device_internal.h
index 8d8da08..ff5378d 100644
--- a/src/vkvg_device_internal.h
+++ b/src/vkvg_device_internal.h
@@ -78,6 +78,9 @@ typedef struct _vkvg_device_t{
VkPipeline pipelineWired;
VkPipeline pipelineLineList;
#endif
+#if VKVG_DBG_STATS
+ vkvg_debug_stats_t debug_stats; /**< debug statistics on memory usage and vulkan ressources */
+#endif
VkPipelineCache pipelineCache; /**< speed up startup by caching configured pipelines on disk */
VkPipelineLayout pipelineLayout; /**< layout common to all pipelines */
VkDescriptorSetLayout dslFont; /**< font cache descriptors layout */