VCPKG_DEFAULT_TRIPLET: x64-windows
VULKAN_SDK: C:/VulkanSDK/1.1.130.0
APPVEYOR_SAVE_CACHE_ON_ERROR: true
- APPVEYOR_CACHE_SKIP_RESTORE: true
+ APPVEYOR_CACHE_SKIP_RESTORE: false
cache:
- VulkanSDK.exe
- c:\tools\vcpkg\installed\
vkvg_public
void vkvg_get_matrix (VkvgContext ctx, const vkvg_matrix_t* matrix);
/**
- * @brief
+ * @brief Reset the current transformation matrix of the provided context to the identity matrix.
*
* @param ctx a valid vkvg #context
*/
vkvg_public
void vkvg_identity_matrix (VkvgContext ctx);
-//text
/**
- * @brief
+ * @brief Try find font with the specified name using the FontConfig library.
*
* @param ctx a valid vkvg #context
- * @param name
+ * @param name A name to be recognized by the FontConfig library
*/
vkvg_public
void vkvg_select_font_face (VkvgContext ctx, const char* name);
+/**
+ * @brief Select a new font by providing its file path.
+ *
+ * @param ctx a valid vkvg #context
+ * @param name A valid font file path.
+ */
+vkvg_public
+void vkvg_select_font_path (VkvgContext ctx, const char* path);
/**
* @brief
*
void vkvg_select_font_face (VkvgContext ctx, const char* name){
_select_font_face (ctx, name);
}
+void vkvg_select_font_path (VkvgContext ctx, const char* path){
+ _select_font_path (ctx, path);
+}
void vkvg_set_font_size (VkvgContext ctx, uint32_t size){
_set_font_size (ctx,size);
}
_end_render_pass(ctx);
_flush_vertices_caches(ctx);
vkh_cmd_end(ctx->cmd);
- _wait_and_submit_cmd(ctx);
+ _wait_and_submit_cmd(ctx);//the extra wait here is not useful.
if (ctx->vertCount + ctx->pointCount > ctx->sizeVBO){
//_resize_vertex_cache(ctx, ctx->vertCount + ctx->pointCount);
_resize_vbo(ctx, ctx->vertCount + ctx->pointCount);
//vk buffers, holds data until flush
vkvg_buff indices; //index buffer with persistent map memory
- uint32_t sizeIBO; //size of vk ibo size
+ uint32_t sizeIBO; //size of vk ibo
uint32_t sizeIndices; //reserved size
uint32_t indCount; //current indice count
//flush font stagging buffer to cache texture array
void _flush_chars_to_tex (VkvgDevice dev, _vkvg_font_t* f) {
_font_cache_t* cache = dev->fontCache;
- if (cache->stagingX == 0)
+ if (cache->stagingX == 0)//no char in stagging buff to flush
return;
LOG(VKVG_LOG_INFO, "_flush_chars_to_tex pen(%d, %d)\n",f->curLine.penX, f->curLine.penY);
ctx->selectedFont.charSize = size << 6;
ctx->currentFont = NULL;
}
+
+void _select_font_path (VkvgContext ctx, const char* fontFile){
+ memset (ctx->selectedFont.fontFile, 0, FONT_FILE_NAME_MAX_SIZE);
+ memcpy (ctx->selectedFont.fontFile, fontFile, FONT_FILE_NAME_MAX_SIZE);
+ ctx->currentFont = NULL;
+}
//select current font for context
void _select_font_face (VkvgContext ctx, const char* name){
_font_cache_t* cache = (_font_cache_t*)ctx->pSurf->dev->fontCache;
FcPattern* font = FcFontMatch(cache->config, pat, &result);
if (font)
{
- if (FcPatternGetString(font, FC_FILE, 0, (FcChar8 **)&fontFile) == FcResultMatch){
- memset (ctx->selectedFont.fontFile, 0, FONT_FILE_NAME_MAX_SIZE);
- memcpy (ctx->selectedFont.fontFile, fontFile, FONT_FILE_NAME_MAX_SIZE);
- }
+ if (FcPatternGetString(font, FC_FILE, 0, (FcChar8 **)&fontFile) == FcResultMatch)
+ _select_font_path (ctx, fontFile);
}
FcPatternDestroy(pat);
FcPatternDestroy(font);
-
- ctx->currentFont = NULL;
}
+
//try to find font in cache with same font file path and font size as selected in context.
_vkvg_font_t* _tryFindVkvgFont (VkvgContext ctx){
_font_cache_t* cache = (_font_cache_t*)ctx->pSurf->dev->fontCache;
void _destroy_font_cache (VkvgDevice dev);
//Select current font for context from font name, create new font entry in cache if required
void _select_font_face (VkvgContext ctx, const char* name);
+void _select_font_path (VkvgContext ctx, const char* fontFile);
//Set current font size for context
void _set_font_size (VkvgContext ctx, uint32_t size);
//Draw text
static bool paused = false;
static VkSampleCountFlags samples = VK_SAMPLE_COUNT_1_BIT;
+static VkPhysicalDeviceType preferedPhysicalDeviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
static vk_engine_t* e;
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
void init_test (uint32_t width, uint32_t height){
if (test_vsync)
- e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_FIFO_KHR, width, height);
+ e = vkengine_create (preferedPhysicalDeviceType, VK_PRESENT_MODE_FIFO_KHR, width, height);
else
- e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_MAILBOX_KHR, width, height);
+ e = vkengine_create (preferedPhysicalDeviceType, VK_PRESENT_MODE_MAILBOX_KHR, width, height);
VkhPresenter r = e->renderer;
vkengine_set_key_callback (e, key_callback);
}
if (test_vsync)
- e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_FIFO_KHR, test_width, test_height);
+ e = vkengine_create (preferedPhysicalDeviceType, VK_PRESENT_MODE_FIFO_KHR, test_width, test_height);
else
- e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_MAILBOX_KHR, test_width, test_height);
+ e = vkengine_create (preferedPhysicalDeviceType, VK_PRESENT_MODE_MAILBOX_KHR, test_width, test_height);
VkhPresenter r = e->renderer;
vkengine_set_key_callback (e, key_callback);