language: cpp
-dist: xenial
+dist: bionic
os:
- linux
install:
- wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
- - sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.1.106-xenial.list http://packages.lunarg.com/vulkan/1.1.106/lunarg-vulkan-1.1.106-xenial.list
+ - sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-bionic.list https://packages.lunarg.com/vulkan/lunarg-vulkan-bionic.list
- sudo apt -qq update
- sudo apt install vulkan-sdk libharfbuzz-dev libfreetype6-dev libfontconfig1-dev
# - sudo apt install libglfw3-dev
-CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
PROJECT(vkvg VERSION 0.1.1 DESCRIPTION "Vulkan Vector Graphic")
INCLUDE(CheckSymbolExists)
INCLUDE(CheckIncludeFile)
INCLUDE(GNUInstallDirs)
+INCLUDE(CMakeDependentOption)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-SET(CMAKE_CXX_FLAGS "-W -Wall -Wno-extra")
+
+IF (UNIX)
+ SET(CMAKE_CXX_FLAGS "-Wall -Wno-extra")
+ELSEIF(MSVC)
+ SET(CMAKE_CXX_FLAGS "-W4")
+ENDIF()
+
SET(CMAKE_EXE_LINKER_FLAGS "-lm")
IF(NOT CMAKE_BUILD_TYPE)
ADD_DEFINITIONS (-DVKVG_TILING_OPTIMAL)
ENDIF ()
-OPTION(VKVG_BUILD_TESTS "build tests with glfw" ON)
-
set(VULKAN_SDK "$ENV{VULKAN_SDK}" CACHE STRING "LunarG Vulkan SDK path")
if (VULKAN_SDK)
- set(ENV{VULKAN_SDK} ${VULKAN_SDK})
- SET(vulkanSdkLayerPath "${VULKAN_SDK}/etc/vulkan/explicit_layer.d")
- IF (NOT EXISTS "${vulkanSdkLayerPath}")
- SET(vulkanSdkLayerPath "${VULKAN_SDK}/etc/explicit_layer.d")
- endif ()
- SET(ENV{VK_LAYER_PATH} "${vulkanSdkLayerPath}")
- link_directories("${VULKAN_SDK}/lib")
+ set(ENV{VULKAN_SDK} ${VULKAN_SDK})
+ SET(vulkanSdkLayerPath "${VULKAN_SDK}/etc/vulkan/explicit_layer.d")
+ IF (NOT EXISTS "${vulkanSdkLayerPath}")
+ SET(vulkanSdkLayerPath "${VULKAN_SDK}/etc/explicit_layer.d")
+ endif ()
+ SET(ENV{VK_LAYER_PATH} "${vulkanSdkLayerPath}")
endif ()
if (NOT TARGET vkh_static)
ADD_DEFINITIONS (-DVKVG_WIRED_DEBUG)
ENDIF ()
-#be aware that system libraries have priority on SDK in the finding.
FIND_PACKAGE(Vulkan REQUIRED)
-FIND_PACKAGE(GLFW3)
FIND_PACKAGE(Freetype REQUIRED)
-FIND_PACKAGE(FontConfig REQUIRED)
+FIND_PACKAGE(Fontconfig REQUIRED)
FIND_PACKAGE(HarfBuzz REQUIRED)
+FIND_PACKAGE(GLFW3)
+
+CMAKE_DEPENDENT_OPTION(VKVG_BUILD_TESTS "build tests with glfw" ON "GLFW3_FOUND" OFF)
+
#Freetype lcd font filtering
#CHECK_SYMBOL_EXISTS (FT_CONFIG_OPTION_SUBPIXEL_RENDERING "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/config/ftoption.h" FT_HAS_SUBPIXEL_RENDERING)
#IF (FT_HAS_SUBPIXEL_RENDERING)
PUBLIC_HEADER include/vkvg.h
)
TARGET_INCLUDE_DIRECTORIES(${LibName} PRIVATE
- ${Vulkan_INCLUDE_DIRS}
- ${FREETYPE_INCLUDE_DIRS}
- ${HARFBUZZ_INCLUDE_DIRS}
- ${FONTCONFIG_INCLUDE_DIRS}
+ ${Vulkan_INCLUDE_DIRS}
+ ${FREETYPE_INCLUDE_DIRS}
+ ${HarfBuzz_INCLUDE_DIRS}
+ ${Fontconfig_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/vkh/include
${CMAKE_CURRENT_SOURCE_DIR}/vkh/src
)
TARGET_LINK_LIBRARIES(${LibName}
- ${Vulkan_LIBRARIES}
- ${FREETYPE_LIBRARIES}
- ${HARFBUZZ_LIBRARIES}
- ${FONTCONFIG_LIBRARIES}
+ ${Vulkan_LIBRARIES}
+ ${FREETYPE_LIBRARIES}
+ ${HarfBuzz_LIBRARIES}
+ ${Fontconfig_LIBRARIES}
vkh_static
)
INSTALL(TARGETS ${LibName}
FUNCTION (buildtest TEST_NAME)
ADD_EXECUTABLE(test_${TEST_NAME} "tests/${TEST_NAME}.c" )
TARGET_INCLUDE_DIRECTORIES(test_${TEST_NAME} PRIVATE
- ${Vulkan_INCLUDE_DIRS}
+ ${Vulkan_INCLUDE_DIRS}
${GLFW3_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
)
ENDFUNCTION (buildtest)
-if (GLFW3_FOUND)
+if (VKVG_BUILD_TESTS)
ADD_LIBRARY("tests_common" STATIC tests/common/vkengine.c tests/common/test.c)
TARGET_INCLUDE_DIRECTORIES(tests_common PRIVATE
- ${Vulkan_INCLUDE_DIRS}
- ${GLFW3_INCLUDE_DIR}
+ ${Vulkan_INCLUDE_DIRS}
+ ${GLFW3_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/tests/common
${CMAKE_CURRENT_SOURCE_DIR}/vkh/src
)
TARGET_LINK_LIBRARIES(tests_common
- ${Vulkan_LIBRARIES}
- ${GLFW3_LIBRARY}
+ ${Vulkan_LIBRARIES}
+ ${GLFW3_LIBRARY}
vkh_static
vkvg_static
)
ENDFOREACH()
endif ()
+MESSAGE(STATUS "HarfBuzz_INCLUDE_DIRS = ${HarfBuzz_INCLUDE_DIRS}")
+
MESSAGE(STATUS "\n\n--------------------------------------------------------------------------")
- MESSAGE(STATUS "Build type\t\t= ${CMAKE_BUILD_TYPE}")
- MESSAGE(STATUS "VULKAN_SDK\t\t= $ENV{VULKAN_SDK}")
- MESSAGE(STATUS "VK_LAYER_PATH\t= $ENV{VK_LAYER_PATH}")
+MESSAGE(STATUS "Build type\t\t= ${CMAKE_BUILD_TYPE}")
+MESSAGE(STATUS "VULKAN_SDK\t\t= $ENV{VULKAN_SDK}")
+MESSAGE(STATUS "VK_LAYER_PATH\t= $ENV{VK_LAYER_PATH}")
+IF (VKVG_BUILD_TESTS)
+MESSAGE(STATUS "Build tests\t\t= true.")
+ELSE ()
+MESSAGE(STATUS "Build tests\t\t= false.")
+ENDIF ()
IF (ENABLE_VALIDATION)
MESSAGE(STATUS "Validation\t\t= enabled.")
ELSE ()
<a href="https://travis-ci.org/jpbruyere/vkvg">
<img src="https://travis-ci.org/jpbruyere/vkvg.svg?branch=master">
</a>
+ <a href="https://ci.appveyor.com/project/jpbruyere/vkvg">
+ <img src="https://ci.appveyor.com/api/projects/status/github/gruntjs/grunt?branch=master&svg=true">
+ </a>
<img src="https://img.shields.io/github/license/jpbruyere/vkvg.svg?style=flat-square">
<a href="https://www.paypal.me/GrandTetraSoftware">
<img src="https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square">
-version: 1.0.{build}
-image:
-- Visual Studio 2015
-- Visual Studio 2017
-- Ubuntu
-build:
- verbosity: minimal
+version: 0.1.{build}
+
+environment:
+ VCPKG_DEFAULT_TRIPLET: x64-windows
+ VULKAN_SDK: C:/VulkanSDK/1.1.130.0
+ APPVEYOR_SAVE_CACHE_ON_ERROR: true
+
+install:
+ - if not exist VulkanSDK.exe curl -L --silent --show-error --output VulkanSDK.exe https://vulkan.lunarg.com/sdk/download/1.1.130.0/windows/VulkanSDK-1.1.130.0-Installer.exe?Human=true && VulkanSDK.exe /S
+ - vcpkg install freetype harfbuzz fontconfig glfw3
+cache:
+ - VulkanSDK.exe
+ - c:\tools\vcpkg\installed\
+ - c:\VulkanSDK\
+
+before_build:
+ - git submodule update --init --recursive
+ - mkdir build
+ - cd build
+ - cmake -G "Visual Studio 14 Win64" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake ..
+
+build_script:
+ - msbuild vkvg.sln /p:Configuration=Debug /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+
+++ /dev/null
-# - Find FontConfig library
-# Find the FontConfig includes and library
-# This module defines
-# FONTCONFIG_INCLUDE_DIR, where to find fontconfig.h
-# FONTCONFIG_LIBRARIES, libraries to link against to use the FontConfig API.
-# FONTCONFIG_FOUND, If false, do not try to use FontConfig.
-
-#=============================================================================
-# Copyright 2012 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of VTK, substitute the full
-# License text for the above reference.)
-
-find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h)
-
-find_library(FONTCONFIG_LIBRARY NAMES fontconfig)
-
-# handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if
-# all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(FontConfig DEFAULT_MSG
- FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
-
-if(FONTCONFIG_FOUND)
- set( FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY} )
-endif()
-
-mark_as_advanced(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY FONTCONFIG_LIBRARIES)
# installation.
#
# default search dirs
-#
+#
# Cmake file from: https://github.com/daw42/glslcookbook
set( _glfw3_HEADER_SEARCH_DIRS
PATHS ${_glfw3_HEADER_SEARCH_DIRS} )
# Search for the library
-FIND_LIBRARY(GLFW3_LIBRARY NAMES glfw3 glfw
+FIND_LIBRARY(GLFW3_LIBRARY NAMES glfw3 glfw glfw3dll
PATHS ${_glfw3_LIB_SEARCH_DIRS} )
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 DEFAULT_MSG
-# Copyright (c) 2012, Intel Corporation
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#.rst:
+# FindHarfBuzz
+# ------------
+#
+# Find the HarfBuzz text shaping engine includes and library.
+#
+# Imported Targets
+# ^^^^^^^^^^^^^^^^
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
+# This module defines the following :prop_tgt:`IMPORTED` target:
#
-# * Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors may
-# be used to endorse or promote products derived from this software without
-# specific prior written permission.
+# ``HarfBuzz::HarfBuzz``
+# The Harfbuzz ``harfbuzz`` library, if found
#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# Result Variables
+# ^^^^^^^^^^^^^^^^
#
-# Try to find Harfbuzz include and library directories.
+# This module will set the following variables in your project:
#
-# After successful discovery, this will set for inclusion where needed:
-# HARFBUZZ_INCLUDE_DIRS - containg the HarfBuzz headers
-# HARFBUZZ_LIBRARIES - containg the HarfBuzz library
+# ``HarfBuzz_FOUND``
+# true if the HarfBuzz headers and libraries were found
+# ``HarfBuzz_INCLUDE_DIRS``
+# directories containing the Harfbuzz headers.
+# ``HarfBuzz_LIBRARIES``
+# the library to link against
-INCLUDE(FindPkgConfig)
+find_path(HarfBuzz_INCLUDE_DIR
+ NAMES harfbuzz/hb.h
+)
+find_library(HarfBuzz_LIBRARY
+ NAMES harfbuzz libharfbuzz
+)
-PKG_CHECK_MODULES(PC_HARFBUZZ harfbuzz>=0.9.0)
+# set the user variables
+set(HarfBuzz_LIBRARIES "${HarfBuzz_LIBRARY}")
-FIND_PATH(HARFBUZZ_INCLUDE_DIRS NAMES hb.h
- HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
-)
-FIND_LIBRARY(HARFBUZZ_LIBRARIES NAMES harfbuzz
- HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
-)
+set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY})
+set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HarfBuzz
+ DEFAULT_MSG
+ HarfBuzz_LIBRARY HarfBuzz_INCLUDE_DIR)
+
+mark_as_advanced(HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY)
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES)
+if(HarfBuzz_FOUND AND NOT TARGET HarfBuzz::HarfBuzz)
+ add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED)
+ set_target_properties(HarfBuzz::HarfBuzz PROPERTIES
+ IMPORTED_LOCATION "${HarfBuzz_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIRS}")
+endif()
#include "cross_os.h"
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
+//#include <unistd.h>
int directoryExists (const char* path) {
-#ifdef _WIN32
+#if defined(_WIN32) || defined(_WIN64)
return getenv("HOME");
#elif __APPLE__
#elif __unix__
return -1;
}
const char* getUserDir () {
-#ifdef _WIN32
+#if defined(_WIN32) || defined(_WIN64)
return getenv("HOME");
#elif __APPLE__
#elif __unix__
#define CROSS_OS_H
//cross platform os helpers
-#ifdef _WIN32
+#if defined(_WIN32) || defined(_WIN64)
#include "windows.h"
+#define isnanf _isnanf
#elif __APPLE__
#elif __unix__
#include <unistd.h>
return d;
}
// compute length of double vector 2d
-inline double vec2d_length(vec2d v){
+double vec2d_length(vec2d v){
return sqrt (v.x*v.x + v.y*v.y);
}
// compute length of float vector 2d
-inline float vec2_length(vec2 v){
+float vec2_length(vec2 v){
return sqrtf (v.x*v.x + v.y*v.y);
}
// normalize float vector
return (vec2d){a.x/m, a.y/m};
}
// multiply 2d vector by scalar
-inline vec2d vec2d_mult(vec2d a, double m){
+vec2d vec2d_mult(vec2d a, double m){
return (vec2d){a.x*m,a.y*m};
}
// multiply 2d vector by scalar
-inline vec2 vec2_mult(vec2 a, float m){
+vec2 vec2_mult(vec2 a, float m){
return (vec2){a.x*m,a.y*m};
}
// compute perpendicular vector
-inline vec2d vec2d_perp (vec2d a){
+vec2d vec2d_perp (vec2d a){
return (vec2d){a.y, -a.x};
}
// compute perpendicular vector
-inline vec2 vec2_perp (vec2 a){
+vec2 vec2_perp (vec2 a){
return (vec2){a.y, -a.x};
}
// convert double precision vector to single precision
-inline vec2 vec2d_to_vec2(vec2d vd){
+vec2 vec2d_to_vec2(vec2d vd){
return (vec2){(float)vd.x,(float)vd.y};
}
// compute sum of two single precision vectors
-inline vec2 vec2_add (vec2 a, vec2 b){
+vec2 vec2_add (vec2 a, vec2 b){
return (vec2){a.x + b.x, a.y + b.y};
}
// compute sum of two double precision vectors
-inline vec2d vec2d_add (vec2d a, vec2d b){
+vec2d vec2d_add (vec2d a, vec2d b){
return (vec2d){a.x + b.x, a.y + b.y};
}
// compute subbstraction of two single precision vectors
-inline vec2 vec2_sub (vec2 a, vec2 b){
+vec2 vec2_sub (vec2 a, vec2 b){
return (vec2){a.x - b.x, a.y - b.y};
}
// compute subbstraction of two double precision vectors
-inline vec2d vec2d_sub (vec2d a, vec2d b){
+vec2d vec2d_sub (vec2d a, vec2d b){
return (vec2d){a.x - b.x, a.y - b.y};
}
// test equality of two single precision vectors
v->y = -v->y;
}
// test if one component of float vector is nan
-inline bool vec2_isnan (vec2 v){
+bool vec2_isnan (vec2 v){
return (bool)(isnanf (v.x) || isnanf (v.y));
}
// test if one component of double vector is nan
-inline bool vec2d_isnan (vec2d v){
+bool vec2d_isnan (vec2d v){
return (bool)(isnan (v.x) || isnan (v.y));
}
/*
- * Copyright (c) 2018 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+ * Copyright (c) 2018-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
VkvgDevice dev = surf->dev;
VkvgContext ctx = (vkvg_context*)calloc(1, sizeof(vkvg_context));
- LOG(LOG_INFO, "CREATE Context: ctx = %lu; surf = %lu\n", (ulong)ctx, (ulong)surf);
+ LOG(LOG_INFO, "CREATE Context: ctx = %lu; surf = %lu\n", (uint64_t)ctx, (uint64_t)surf);
if (ctx==NULL) {
dev->status = VKVG_STATUS_NO_MEMORY;
_flush_cmd_buff(ctx);
_wait_flush_fence(ctx);
- LOG(LOG_INFO, "DESTROY Context: ctx = %lu; surf = %lu\n", (ulong)ctx, (ulong)ctx->pSurf);
+ LOG(LOG_INFO, "DESTROY Context: ctx = %lu; surf = %lu\n", (uint64_t)ctx, (uint64_t)ctx->pSurf);
if (ctx->pattern)
vkvg_pattern_destroy (ctx->pattern);
v.uv.z = -1;
float hw = ctx->lineWidth / 2.0f;
- uint i = 0, ptrPath = 0;
+ uint32_t i = 0, ptrPath = 0;
uint32_t lastPathPointIdx, iL, iR;
while (ptrPath < ctx->pathPtr){
- uint ptrCurve = 0;
+ uint32_t ptrCurve = 0;
VKVG_IBO_INDEX_TYPE firstIdx = (VKVG_IBO_INDEX_TYPE)(ctx->vertCount - ctx->curVertOffset);
i = ctx->pathes[ptrPath]&PATH_ELT_MASK;
_check_cmd_buff_state (ctx);
_draw_full_screen_quad (ctx, true);
}
-inline void vkvg_set_source_rgb (VkvgContext ctx, float r, float g, float b) {
+void vkvg_set_source_rgb (VkvgContext ctx, float r, float g, float b) {
vkvg_set_source_rgba (ctx, r, g, b, 1);
}
void vkvg_set_source_rgba (VkvgContext ctx, float r, float g, float b, float a)
}
void vkvg_save (VkvgContext ctx){
- LOG(LOG_INFO, "SAVE CONTEXT: ctx = %lu\n", (ulong)ctx);
+ LOG(LOG_INFO, "SAVE CONTEXT: ctx = %lu\n", (uint64_t)ctx);
_flush_cmd_buff (ctx);
_wait_flush_fence (ctx);
}
//when empty, ptr is even, else it's odd
//when empty, no current point is defined.
-inline bool _current_path_is_empty (VkvgContext ctx) {
+bool _current_path_is_empty (VkvgContext ctx) {
return ctx->pathPtr % 2 == 0;
}
//this function expect that current point exists
-inline vec2 _get_current_position (VkvgContext ctx) {
+vec2 _get_current_position (VkvgContext ctx) {
return ctx->points[ctx->pointCount-1];
}
//set curve start point and set path has curve bit
-inline void _set_curve_start (VkvgContext ctx) {
+void _set_curve_start (VkvgContext ctx) {
ctx->pathes[ctx->pathPtr+ctx->curvePtr+1] = (ctx->pointCount - 1);
ctx->pathes[ctx->pathPtr-1] |= PATH_HAS_CURVES_BIT;
}
//set curve end point and set path has curve bit
-inline void _set_curve_end (VkvgContext ctx) {
+void _set_curve_end (VkvgContext ctx) {
ctx->pathes[ctx->pathPtr+ctx->curvePtr+2] = (ctx->pointCount - 1)|PATH_IS_CURVE_BIT;
ctx->curvePtr+=2;
_check_pathes_array(ctx);
}
//path start pointed at ptrPath has curve bit
-inline bool _path_has_curves (VkvgContext ctx, uint ptrPath) {
+bool _path_has_curves (VkvgContext ctx, uint32_t ptrPath) {
return ctx->pathes[ptrPath] & PATH_HAS_CURVES_BIT;
}
//this function expect that current path is empty
ctx->curvePtr = 0;
_resetMinMax(ctx);
}
-inline bool _path_is_closed (VkvgContext ctx, uint32_t ptrPath){
+bool _path_is_closed (VkvgContext ctx, uint32_t ptrPath){
return ctx->pathes[ptrPath] & PATH_CLOSED_BIT;
}
void _resetMinMax (VkvgContext ctx) {
else
return res;
}
-inline float _get_arc_step (float radius) {
+float _get_arc_step (float radius) {
return M_PIF/sqrtf(radius)*0.35f;
}
void _create_gradient_buff (VkvgContext ctx){
void _clear_attachment (VkvgContext ctx) {
}
-inline void _wait_flush_fence (VkvgContext ctx) {
+void _wait_flush_fence (VkvgContext ctx) {
vkWaitForFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence, VK_TRUE, VKVG_FENCE_TIMEOUT);
}
-inline void _reset_flush_fence (VkvgContext ctx) {
+void _reset_flush_fence (VkvgContext ctx) {
vkResetFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence);
}
void _wait_and_submit_cmd (VkvgContext ctx){
CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d (vxOff = %d idxStart = %d idxTot = %d )\n",
- (ulong)ctx, ctx->vertCount - ctx->curVertOffset,
+ (uint64_t)ctx, ctx->vertCount - ctx->curVertOffset,
ctx->indCount - ctx->curIndStart, ctx->curVertOffset, ctx->curIndStart, ctx->indCount);
#ifdef VKVG_WIRED_DEBUG
LOG(LOG_INFO, "START RENDER PASS: ctx = %lu\n", ctx);
vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
-#ifdef DEBUG
- vkh_cmd_label_start(ctx->cmd, "ctx render pass", LAB_COLOR_RP);
-#endif
-
if (ctx->pSurf->img->layout == VK_IMAGE_LAYOUT_UNDEFINED){
VkhImage imgMs = ctx->pSurf->imgMS;
if (imgMs != NULL)
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
}
+#ifdef DEBUG
+ vkh_cmd_label_start(ctx->cmd, "ctx render pass", LAB_COLOR_RP);
+#endif
+
CmdBeginRenderPass (ctx->cmd, &ctx->renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
VkViewport viewport = {0,0,ctx->pSurf->width,ctx->pSurf->height,0,1};
CmdSetViewport(ctx->cmd, 0, 1, &viewport);
vkvg_matrix_invert (&ctx->pushConsts.matInv);
ctx->pushCstDirty = true;
}
-inline void _update_push_constants (VkvgContext ctx) {
+void _update_push_constants (VkvgContext ctx) {
CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(push_constants),&ctx->pushConsts);
ctx->pushCstDirty = false;
ctx->pushConsts.source = bounds;
//transform control point with current ctx matrix
- vkvg_gradient_t grad = {};
+ vkvg_gradient_t grad = {0};
memcpy(&grad, pat->data, sizeof(vkvg_gradient_t));
vkvg_matrix_transform_point(&ctx->pushConsts.mat, &grad.cp[0].x, &grad.cp[0].y);
VKVG_IBO_INDEX_TYPE firstVertIdx = ctx->vertCount;
- for (uint i = 0; i < pathPointCount; i++) {
+ for (uint32_t i = 0; i < pathPointCount; i++) {
v.pos = ctx->points [i+firstPtIdx];
ctx->vertexCache[ctx->vertCount] = v;
ctx->vertCount++;
}
void _fill_ec (VkvgContext ctx){
uint32_t ptrPath = 0;;
- Vertex v = {};
+ Vertex v = {0};
v.uv.z = -1;
while (ptrPath < ctx->pathPtr){
uint32_t pathPointCount = lastPtIdx - firstPtIdx + 1;
uint32_t firstVertIdx = ctx->vertCount-ctx->curVertOffset;
- ear_clip_point ecps[pathPointCount];
+ ear_clip_point* ecps = (ear_clip_point*)malloc(pathPointCount*sizeof(ear_clip_point));
uint32_t ecps_count = pathPointCount;
uint32_t i = 0;
_add_triangle_indices(ctx, ecp_current->next->idx, ecp_current->idx, ecp_current->next->next->idx);
ptrPath+=2;
+ free (ecps);
}
_record_draw_cmd(ctx);
}
if (ctx->xMin < 0 || ctx->yMin < 0)
useScissor = false;
if (useScissor && ctx->xMin < FLT_MAX) {
- VkRect2D r = {ctx->xMin, ctx->yMin, ctx->xMax - ctx->xMin, ctx->yMax - ctx->yMin};
+ VkRect2D r = {{ctx->xMin, ctx->yMin}, {ctx->xMax - ctx->xMin, ctx->yMax - ctx->yMin}};
CmdSetScissor(ctx->cmd, 0, 1, &r);
}
CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
bool _path_is_closed (VkvgContext ctx, uint32_t ptrPath);
void _set_curve_start (VkvgContext ctx);
void _set_curve_end (VkvgContext ctx);
-bool _path_has_curves (VkvgContext ctx, uint ptrPath);
+bool _path_has_curves (VkvgContext ctx, uint32_t ptrPath);
float _normalizeAngle (float a);
float _get_arc_step (float radius);
FT_Get_Glyph_Name(face,i,gname,256);
- printf("glyph: %s (%d,%d;%d), max advance:%d\n", gname,
+ printf("glyph: %s (%d,%d;%d), max advance:%ld\n", gname,
slot->bitmap.width, slot->bitmap.rows, slot->bitmap.pitch,
face->size->metrics.max_advance/64);
}
vkResetCommandBuffer(cache->cmd,0);
vkResetFences (dev->vkDev,1,&cache->uploadFence);
- memcpy(cache->buff.allocInfo.pMappedData, cache->hostBuff, (ulong)(f->curLine.height * FONT_PAGE_SIZE * cache->texPixelSize));
+ memcpy(cache->buff.allocInfo.pMappedData, cache->hostBuff, (uint64_t)(f->curLine.height * FONT_PAGE_SIZE * cache->texPixelSize));
vkh_cmd_begin (cache->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
FT_CHECK_RESULT(FT_Load_Glyph(f->face, gindex, FT_LOAD_RENDER));
#endif
- FT_GlyphSlot slot = f->face->glyph;
- FT_Bitmap bmp = slot->bitmap;
- uint8_t* data = dev->fontCache->hostBuff;
- uint bmpWidth = bmp.width; //real width in pixel of char bitmap
+ FT_GlyphSlot slot = f->face->glyph;
+ FT_Bitmap bmp = slot->bitmap;
+ uint8_t* data = dev->fontCache->hostBuff;
+ uint32_t bmpWidth= bmp.width; //real width in pixel of char bitmap
#ifdef VKVG_LCD_FONT_FILTER
bmpWidth /= 3;
void _text_extents (VkvgContext ctx, const char* text, vkvg_text_extents_t *extents) {
_update_current_font (ctx);
- vkvg_text_run_t tr = {};
+ vkvg_text_run_t tr = {0};
_create_text_run (ctx, text, &tr);
*extents = tr.extents;
void _show_text (VkvgContext ctx, const char* text){
- vkvg_text_run_t tr = {};
+ vkvg_text_run_t tr = {0};
_create_text_run (ctx, text, &tr);
_show_text_run (ctx, &tr);
#include <freetype/ftlcdfil.h>
#endif
-#include <hb.h>
-#include <hb-ft.h>
+#include <harfbuzz/hb.h>
+#include <harfbuzz/hb-ft.h>
#include <fontconfig/fontconfig.h>
#include <stdint.h>
#include <stdbool.h>
#include <float.h>
+
+#define _USE_MATH_DEFINES
#include <math.h>
#define M_PIF 3.14159265358979323846f /* float pi */
#define M_PIF_2 1.57079632679489661923f
+
+/*#ifndef M_2_PI
+ #define M_2_PI 0.63661977236758134308 // 2/pi
+#endif*/
+
#define PATH_CLOSED_BIT 0x80000000 /* most significant bit of path elmts is closed/open path state */
#define PATH_HAS_CURVES_BIT 0x40000000 /* 2d most significant bit of path elmts start = true if curve data are present,
stored to avoid emiting join in curves */
#define ROUND_DOWN(v,p) (floorf(v * p) / p)
#define EQUF(a, b) (fabsf(a-b)<=FLT_EPSILON)
+#include "cross_os.h"
#include "vectors.h"
#include "cross_mutex.h"
frameBufferCreateInfo.attachmentCount = 2;
}
VK_CHECK_RESULT(vkCreateFramebuffer(surf->dev->vkDev, &frameBufferCreateInfo, NULL, &surf->fb));
+#ifdef DEBUG
vkh_device_set_object_name((VkhDevice)surf->dev, VK_OBJECT_TYPE_FRAMEBUFFER, (uint64_t)surf->fb, "SURF FB");
+#endif
}
void _init_surface (VkvgSurface surf) {
surf->format = FB_COLOR_FORMAT;//force bgra internally
}
VkvgSurface _svg_load (VkvgDevice dev, NSVGimage* svg) {
- NSVGshape* shape;
- NSVGpath* path;
VkvgSurface surf = (vkvg_surface*)calloc(1,sizeof(vkvg_surface));
surf->dev = dev;
- surf->width = (uint)svg->width;
- surf->height = (uint)svg->height;
+ surf->width = (uint32_t)svg->width;
+ surf->height = (uint32_t)svg->height;
surf->new = true;
_init_surface (surf);
#include "test.h"
+#if defined(_WIN32) || defined(_WIN64)
+int gettimeofday(struct timeval * tp, struct timezone * tzp)
+{
+ // FILETIME Jan 1 1970 00:00:00
+ // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
+ static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
+
+ SYSTEMTIME nSystemTime;
+ FILETIME nFileTime;
+ uint64_t nTime;
+
+ GetSystemTime( &nSystemTime );
+ SystemTimeToFileTime( &nSystemTime, &nFileTime );
+ nTime = ((uint64_t)nFileTime.dwLowDateTime ) ;
+ nTime += ((uint64_t)nFileTime.dwHighDateTime) << 32;
+
+ tp->tv_sec = (long) ((nTime - EPOCH) / 10000000L);
+ tp->tv_usec = (long) (nSystemTime.wMilliseconds * 1000);
+ return 0;
+}
+#endif
+
float panX = 0.f;
float panY = 0.f;
float lastX = 0.f;
VkvgDevice device = NULL;
VkvgSurface surf = NULL;
-uint test_size = 100; // items drawn in one run, or complexity
+uint32_t test_size = 100; // items drawn in one run, or complexity
int iterations = 10000; // repeat test n times
static bool paused = false;
}
/***************/
-void init_test (uint width, uint height){
+void init_test (uint32_t width, uint32_t height){
e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_MAILBOX_KHR, width, height);
VkhPresenter r = e->renderer;
vkengine_set_key_callback (e, key_callback);
vkh_presenter_build_blit_cmd (r, vkvg_surface_get_vk_image(surf), width, height);
}
-void run_test_func (void(*testfunc)(void),uint width, uint height) {
+void run_test_func (void(*testfunc)(void),uint32_t width, uint32_t height) {
bool deferredResolve = false;
VkhPresenter r = e->renderer;
- double start_time, stop_time, run_time, run_total, min_run_time = -1, max_run_time;
- double run_time_values[iterations];
+ double start_time, stop_time, run_time, run_total = 0.0, min_run_time = -1, max_run_time;
+ double* run_time_values = (double*)malloc(iterations*sizeof(double));
int i = 0;
double avg_frames_per_second = (1.0 / avg_run_time);
avg_frames_per_second = (avg_frames_per_second<9999) ? avg_frames_per_second:9999;
- printf ("size:%d iter:%d avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", test_size, iterations, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+ free (run_time_values);
+ printf ("size:%d iter:%d avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", test_size, iterations, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
}
void clear_test () {
vkDeviceWaitIdle(e->dev->dev);
VkvgSurface* surfaces;
#endif
-void perform_test (void(*testfunc)(void),uint width, uint height) {
+void perform_test (void(*testfunc)(void),uint32_t width, uint32_t height) {
//dumpLayerExts();
e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_MAILBOX_KHR, width, height);
#ifdef VKVG_TEST_DIRECT_DRAW
surfaces = (VkvgSurface*)malloc(r->imgCount * sizeof (VkvgSurface));
- for (uint i=0; i < r->imgCount;i++)
+ for (uint32_t i=0; i < r->imgCount;i++)
surfaces[i] = vkvg_surface_create_for_VkhImage (device, r->ScBuffers[i]);
#else
surf = vkvg_surface_create(device, width, height);
#endif
- double start_time, stop_time, run_time, run_total, min_run_time = -1, max_run_time;
- double run_time_values[iterations];
+ double start_time, stop_time, run_time, run_total = 0.0, min_run_time = -1, max_run_time;
+ double* run_time_values = (double*)malloc(iterations*sizeof(double));
int i = 0;
#ifdef VKVG_TEST_DIRECT_DRAW
if (!vkh_presenter_acquireNextImage(r, NULL, NULL)) {
- for (uint i=0; i < r->imgCount;i++)
+ for (uint32_t i=0; i < r->imgCount;i++)
vkvg_surface_destroy (surfaces[i]);
vkh_presenter_create_swapchain (r);
- for (uint i=0; i < r->imgCount;i++)
+ for (uint32_t i=0; i < r->imgCount;i++)
surfaces[i] = vkvg_surface_create_for_VkhImage (device, r->ScBuffers[i]);
}else{
surf = surfaces[r->currentScBufferIndex];
double avg_frames_per_second = (1.0 / avg_run_time);
avg_frames_per_second = (avg_frames_per_second<9999) ? avg_frames_per_second:9999;
+ free (run_time_values);
+
printf ("size:%d iter:%d avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", test_size, iterations, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
vkDeviceWaitIdle(e->dev->dev);
#ifdef VKVG_TEST_DIRECT_DRAW
- for (uint i=0; i<r->imgCount;i++)
+ for (uint32_t i=0; i<r->imgCount;i++)
vkvg_surface_destroy (surfaces[i]);
free (surfaces);
#include "vkengine.h"
-#include "stdio.h"
-#include "stdlib.h"
-#include "time.h"
+#include <stdio.h>
+#include <stdlib.h>
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include <time.h>
+
#include "vkvg.h"
#include "vkh_device.h"
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
-#ifdef _WIN32 // MSC_VER
+#if defined(_WIN32) || defined(_WIN64)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h> // Windows.h -> WinDef.h defines min() max()
} timeval;
// *sigh* no gettimeofday on Win32/Win64
- int gettimeofday(struct timeval * tp, struct timezone * tzp)
- {
- // FILETIME Jan 1 1970 00:00:00
- // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
- static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
-
- SYSTEMTIME nSystemTime;
- FILETIME nFileTime;
- uint64_t nTime;
-
- GetSystemTime( &nSystemTime );
- SystemTimeToFileTime( &nSystemTime, &nFileTime );
- nTime = ((uint64_t)nFileTime.dwLowDateTime ) ;
- nTime += ((uint64_t)nFileTime.dwHighDateTime) << 32;
-
- tp->tv_sec = (long) ((nTime - EPOCH) / 10000000L);
- tp->tv_usec = (long) (nSystemTime.wMilliseconds * 1000);
- return 0;
- }
+ int gettimeofday(struct timeval * tp, struct timezone * tzp);
#else
#include <sys/time.h>
-#endif // _WIN32
+#endif
-extern uint test_size;
+extern uint32_t test_size;
extern int iterations;
extern float panX;
extern VkvgSurface surf;
//run test in one step
-void perform_test (void(*testfunc)(void),uint width, uint height);
+void perform_test (void(*testfunc)(void),uint32_t width, uint32_t height);
void randomize_color (VkvgContext ctx);
//run test in 3 step: init, run, clear.
-void init_test (uint width, uint height);
-void run_test_func (void(*testfunc)(void),uint width, uint height);
+void init_test (uint32_t width, uint32_t height);
+void run_test_func (void(*testfunc)(void),uint32_t width, uint32_t height);
void clear_test ();
uint32_t layerCount;
vkEnumerateInstanceLayerProperties(&layerCount, NULL);
- VkLayerProperties availableLayers [layerCount];
+ VkLayerProperties* availableLayers = (VkLayerProperties*)malloc(layerCount*sizeof(VkLayerProperties));
vkEnumerateInstanceLayerProperties(&layerCount, availableLayers);
printf("Available Layers:\n");
printf("-----------------\n");
- for (uint i=0; i<layerCount; i++) {
+ for (uint32_t i=0; i<layerCount; i++) {
printf ("\t - %s\n", availableLayers[i].layerName);
}
printf("-----------------\n\n");
+ free (availableLayers);
}
-static VkDebugReportCallbackEXT dbgReport;
-
vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, VkPresentModeKHR presentMode, uint32_t width, uint32_t height) {
vk_engine_t* e = (vk_engine_t*)calloc(1,sizeof(vk_engine_t));
uint32_t enabledExtsCount = 0, phyCount = 0;
const char** gflwExts = glfwGetRequiredInstanceExtensions (&enabledExtsCount);
- const char* enabledExts [enabledExtsCount+1];
+ const char* enabledExts [10];
- for (uint i=0;i<enabledExtsCount;i++)
+ for (uint32_t i=0;i<enabledExtsCount;i++)
enabledExts[i] = gflwExts[i];
#ifdef VKVG_USE_RENDERDOC
const uint32_t enabledLayersCount = 2;
#include "test.h"
void test(){
- vkvg_surface_clear(surf);
- struct timeval currentTime;
- gettimeofday(¤tTime, NULL);
-
- srand((unsigned) currentTime.tv_usec);
- const float w = 1024.f;
- const float h = 800.f;
-
- VkvgContext ctx = vkvg_create(surf);
- //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
- vkvg_set_line_width(ctx,1);
- //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
-
- for (uint i=0; i<test_size; i++) {
- randomize_color(ctx);
- float x1 = w*rand()/RAND_MAX;
- float y1 = h*rand()/RAND_MAX;
- float v = 500.f*rand()/RAND_MAX;
-
- vkvg_move_to (ctx, x1, y1);
- vkvg_line_to (ctx, x1 + v, y1);
- vkvg_stroke (ctx);
- }
- vkvg_destroy(ctx);
+ vkvg_surface_clear(surf);
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
+
+ srand((unsigned) currentTime.tv_usec);
+ const float w = 1024.f;
+ const float h = 800.f;
+
+ VkvgContext ctx = vkvg_create(surf);
+ //vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
+ vkvg_set_line_width(ctx,1);
+ //vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
+
+ for (uint32_t i=0; i<test_size; i++) {
+ randomize_color(ctx);
+ float x1 = w*rand()/RAND_MAX;
+ float y1 = h*rand()/RAND_MAX;
+ float v = 500.f*rand()/RAND_MAX;
+
+ vkvg_move_to (ctx, x1, y1);
+ vkvg_line_to (ctx, x1 + v, y1);
+ vkvg_stroke (ctx);
+ }
+ vkvg_destroy(ctx);
}
int main(int argc, char *argv[]) {
- perform_test (test, 1024, 768);
+ perform_test (test, 1024, 768);
- return 0;
+ return 0;
}
vkvg_set_line_width (ctx,1);
//vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
- for (uint i=0; i<test_size; i++) {
+ for (uint32_t i=0; i<test_size; i++) {
randomize_color(ctx);
float x1 = w*rand()/RAND_MAX;
vkvg_set_line_width(ctx, 1.0f);
//vkvg_set_line_join(ctx,VKVG_LINE_JOIN_BEVEL);
- for (uint i=0; i<test_size; i++) {
+ for (uint32_t i=0; i<test_size; i++) {
randomize_color(ctx);
float r = 0.5f*w*rand()/RAND_MAX;
#include "test.h"
void test(){
- struct timeval currentTime;
- gettimeofday(¤tTime, NULL);
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
- srand((unsigned) currentTime.tv_usec);
- const float w = 800.f;
+ srand((unsigned) currentTime.tv_usec);
+ const float w = 800.f;
- vkvg_surface_clear(surf);
+ vkvg_surface_clear(surf);
- VkvgContext ctx = vkvg_create(surf);
- vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
+ VkvgContext ctx = vkvg_create(surf);
+ vkvg_set_fill_rule(ctx, VKVG_FILL_RULE_EVEN_ODD);
- for (uint i=0; i<test_size; i++) {
- randomize_color(ctx);
+ for (uint32_t i=0; i<test_size; i++) {
+ randomize_color(ctx);
- float x = truncf(0.5f*w*rand()/RAND_MAX);
- float y = truncf(0.5f*w*rand()/RAND_MAX);
- float z = truncf((0.5f*w*rand()/RAND_MAX)+1.f);
- float v = truncf((0.5f*w*rand()/RAND_MAX)+1.f);
+ float x = truncf(0.5f*w*rand()/RAND_MAX);
+ float y = truncf(0.5f*w*rand()/RAND_MAX);
+ float z = truncf((0.5f*w*rand()/RAND_MAX)+1.f);
+ float v = truncf((0.5f*w*rand()/RAND_MAX)+1.f);
- vkvg_rectangle(ctx, x, y, z, v);
- vkvg_fill(ctx);
- }
- vkvg_destroy(ctx);
+ vkvg_rectangle(ctx, x, y, z, v);
+ vkvg_fill(ctx);
+ }
+ vkvg_destroy(ctx);
}
int main(int argc, char *argv[]) {
- perform_test (test, 800, 600);
+ perform_test (test, 800, 600);
- return 0;
+ return 0;
}
-Subproject commit 02b846b9d89340ceee42b4de3cf3a498bff726a2
+Subproject commit fe84bd171b3ef9ea34ee961859c148c4892e548d