ADD_DEFINITIONS (-DVKVG_PREMULT_ALPHA)
ENDIF ()
+OPTION(VKVG_DBG_STATS "record contexts statistics in the device" OFF)
+IF (VKVG_DBG_STATS)
+ ADD_DEFINITIONS (-DVKVG_DBG_STATS)
+ENDIF ()
+
+
SET(VULKAN_SDK "$ENV{VULKAN_SDK}" CACHE STRING "LunarG Vulkan SDK path")
IF (VULKAN_SDK)
SET(ENV{VULKAN_SDK} ${VULKAN_SDK})
IF (VKVG_TEST_OFFSCREEN)
MESSAGE(STATUS "Offscreen\t\t= true.")
ENDIF ()
+IF (VKVG_DBG_STATS)
+ MESSAGE(STATUS "Debug statistics\t= enabled.")
+ELSE ()
+ MESSAGE(STATUS "Debug statistics\t= disabled.")
+ENDIF ()
IF (ENABLE_DBG_UTILS)
MESSAGE(STATUS "Debug utils\t\t= enabled.")
ELSE ()
*/
typedef struct _vkvg_pattern_t* VkvgPattern;
+#if VKVG_DBG_STATS
+/**
+ * @brief vkvg memory and vulkan statistiques.
+ *
+ * @ingroup device
+ */
+typedef struct {
+ uint32_t sizePoints; /**< maximum point array size */
+ uint32_t sizePathes; /**< maximum path array size */
+ uint32_t sizeVertices; /**< maximum size of host vertice cache */
+ uint32_t sizeIndices; /**< maximum size of host index cache */
+ uint32_t sizeVBO; /**< maximum size of vulkan vertex buffer */
+ uint32_t sizeIBO; /**< maximum size of vulkan index buffer */
+} vkvg_debug_stats_t;
+
+vkvg_debug_stats_t vkvg_device_get_stats (VkvgDevice dev);
+vkvg_debug_stats_t vkvg_device_reset_stats (VkvgDevice dev);
+#endif
+
+
/**
* @defgroup matrix Matrices
* @brief Generic matrix operations
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);
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);
#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
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)) {
*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
#ifdef VKVG_WIRED_DEBUG
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 */
avg_frames_per_second = (avg_frames_per_second<9999) ? avg_frames_per_second:9999;
if (!quiet && (test_index == 0 || test_index == single_test)) {
- printf ("__________________________________________________________________________________________________________\n");
+#if VKVG_DBG_STATS
+ printf ("_____________________________________________________________________________________________________________________________\n");
+ printf ("| N° | Test File Name | Sub Test | Iter | Size | Pts |Pathes| Vx cache | Ix cache | VBO | IBO |\n");
+ printf ("|----|-----------------|---------------------------|------|------|-------|------|----------|----------|----------|----------|\n");
+#else
+ printf ("__________________________________________________________________________________________________________\n");
printf ("| N° | Test File Name | Sub Test | Iter | Size | FPS | Average | Median | Sigma |\n");
printf ("|----|-----------------|---------------------------|------|------|---------|---------|---------|---------|\n");
+#endif
}
- printf ("| %2d | %-15s | %-25s | ", test_index, whoami + 5, testName);
+
+ printf ("| %2d | %-15s | %-25s | %4d | ", test_index, whoami + 5, testName, i);
if (no_test_size)
- printf ("%4d | %4d | %7.2f | %6.5f | %6.5f | %6.5f |\n",
- i, 1, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+ printf ("%4d | ", 1);
else
- printf ("%4d | %4d | %7.2f | %6.5f | %6.5f | %6.5f |\n",
- i, test_size, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
-
+ printf ("%4d | ", test_size);
+
+#if VKVG_DBG_STATS
+ vkvg_debug_stats_t dbgStats = vkvg_device_get_stats (device);
+ printf ("%5d | %4d | %8d | %8d | %8d | %8d |\n",
+ dbgStats.sizePoints, dbgStats.sizePathes, dbgStats.sizeVertices,
+ dbgStats.sizeIndices, dbgStats.sizeVBO, dbgStats.sizeIBO);
+#else
+ printf ("%7.2f | %6.5f | %6.5f | %6.5f |\n",
+ avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+#endif
+}
+
+#if VKVG_DBG_STATS
+void _print_debug_stats () {
+
+ vkvg_debug_stats_t dbgStats = vkvg_device_get_stats (device);
+ printf ("| %8d | %8d | %8d | %8d | %8d | %8d |\n", dbgStats.sizePoints, dbgStats.sizePathes, dbgStats.sizeVertices,
+ dbgStats.sizeIndices, dbgStats.sizeVBO, dbgStats.sizeIBO);
}
+#endif
void perform_test_offscreen (void(*testfunc)(void), const char *testName, int argc, char* argv[]) {
//init random gen
#else
vkvg_surface_destroy (surf);
#endif
-
+
vkvg_device_destroy (device);
vkengine_destroy (e);
float dashes[] = {20.0f, 10.0f};
uint32_t dashes_count= 0;
float dash_offset = 0;
-float line_width = 1.f;
+float line_width = 10.f;
VkvgContext _initCtx() {
VkvgContext ctx = vkvg_create(surf);