]> O.S.I.I.S - jp/vkvg.git/commitdiff
deffered resolve funcs, comments, some warnings resolves
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 28 Feb 2019 08:23:04 +0000 (09:23 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 28 Feb 2019 08:23:04 +0000 (09:23 +0100)
20 files changed:
CMakeLists.txt
CMakeLists.txt.user.4.8-pre1 [new file with mode: 0644]
include/vkvg.h
shaders/wired.frag
src/shaders.h
src/vectors.c
src/vectors.h
src/vkvg_context.c
src/vkvg_context_internal.c
src/vkvg_context_internal.h
src/vkvg_device.c
src/vkvg_device_internal.c
src/vkvg_device_internal.h
src/vkvg_fonts.c
src/vkvg_fonts.h
src/vkvg_internal.h
src/vkvg_surface.c
tests/test1.c
tests/vkengine.c
vkh

index 832f9778a075520ca43e26bce044723599f12965..4e5e45cde61c8ee7351ff11ff0035ad22cb6b77b 100644 (file)
@@ -13,8 +13,10 @@ ENDIF()
 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
        ADD_DEFINITIONS (-DDEBUG)
        OPTION(ENABLE_VALIDATION "enable vulkan validation layer" ON)
+       OPTION(ENABLE_WIRED_FILL "enable wired polygon draw to check vertices and primitives" OFF)
 ELSE()
-       OPTION(ENABLE_VALIDATION "enable vulkan validation layer" OFF)
+       UNSET(ENABLE_VALIDATION CACHE)
+       UNSET(ENABLE_WIRED_FILL CACHE)
 ENDIF()
 
 OPTION(VKVG_TILING_OPTIMAL "use VK_IMAGE_TILING_OPTIMAL for surface backend texture" OFF)
@@ -40,7 +42,9 @@ endif()
 IF (ENABLE_VALIDATION)
        ADD_DEFINITIONS (-DVKVG_USE_VALIDATION)
 ENDIF ()
-
+IF (ENABLE_WIRED_FILL)
+       ADD_DEFINITIONS (-DVKVG_WIRED_DEBUG)
+ENDIF ()
 
 #be aware that system libraries have priority on SDK in the finding.
 FIND_PACKAGE(Vulkan REQUIRED)
diff --git a/CMakeLists.txt.user.4.8-pre1 b/CMakeLists.txt.user.4.8-pre1
new file mode 100644 (file)
index 0000000..f37959b
--- /dev/null
@@ -0,0 +1,667 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QtCreatorProject>
+<!-- Written by QtCreator 4.7.2, 2019-01-18T14:19:32. -->
+<qtcreator>
+ <data>
+  <variable>EnvironmentId</variable>
+  <value type="QByteArray">{961cb273-e1a2-4675-b40c-c0bceac9bf63}</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
+  <value type="int">0</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
+  <valuemap type="QVariantMap">
+   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
+   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
+   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
+    <value type="QString" key="language">Cpp</value>
+    <valuemap type="QVariantMap" key="value">
+     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+    </valuemap>
+   </valuemap>
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
+    <value type="QString" key="language">QmlJS</value>
+    <valuemap type="QVariantMap" key="value">
+     <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
+    </valuemap>
+   </valuemap>
+   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
+   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
+   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
+   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
+   <value type="int" key="EditorConfiguration.MarginColumn">80</value>
+   <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
+   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
+   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
+   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
+   <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
+   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">1</value>
+   <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
+   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
+   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
+   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
+   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+   <value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.PluginSettings</variable>
+  <valuemap type="QVariantMap">
+   <valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
+   <value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.0</variable>
+  <valuemap type="QVariantMap">
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Imported Kit</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Imported Kit</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{f19ccac4-98ac-4fd0-a51d-b683584e99fb}</value>
+   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">4</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+    <valuelist type="QVariantList" key="CMake.Configuration">
+     <value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
+     <value type="QString">CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++</value>
+     <value type="QString">CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc</value>
+     <value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
+     <value type="QString">ENABLE_VALIDATION:BOOL=OFF</value>
+     <value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
+     <value type="QString">VKVG_TILING_OPTIMAL:BOOL=OFF</value>
+    </valuelist>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/mnt/devel/gts/vkvg/build</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+      <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
+       <value type="QString">all</value>
+      </valuelist>
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compilation</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Compilation</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+   </valuemap>
+   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Configuration de déploiement</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+   </valuemap>
+   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
+    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+     <value type="int">0</value>
+     <value type="int">1</value>
+     <value type="int">2</value>
+     <value type="int">3</value>
+     <value type="int">4</value>
+     <value type="int">5</value>
+     <value type="int">6</value>
+     <value type="int">7</value>
+     <value type="int">8</value>
+     <value type="int">9</value>
+     <value type="int">10</value>
+     <value type="int">11</value>
+     <value type="int">12</value>
+     <value type="int">13</value>
+     <value type="int">14</value>
+    </valuelist>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">vkvg_test</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.vkvg_test</value>
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
+    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
+    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+     <value type="int">0</value>
+     <value type="int">1</value>
+     <value type="int">2</value>
+     <value type="int">3</value>
+     <value type="int">4</value>
+     <value type="int">5</value>
+     <value type="int">6</value>
+     <value type="int">7</value>
+     <value type="int">8</value>
+     <value type="int">9</value>
+     <value type="int">10</value>
+     <value type="int">11</value>
+     <value type="int">12</value>
+     <value type="int">13</value>
+     <value type="int">14</value>
+    </valuelist>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">vkvg_test1</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.vkvg_test1</value>
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2">
+    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
+    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+     <value type="int">0</value>
+     <value type="int">1</value>
+     <value type="int">2</value>
+     <value type="int">3</value>
+     <value type="int">4</value>
+     <value type="int">5</value>
+     <value type="int">6</value>
+     <value type="int">7</value>
+     <value type="int">8</value>
+     <value type="int">9</value>
+     <value type="int">10</value>
+     <value type="int">11</value>
+     <value type="int">12</value>
+     <value type="int">13</value>
+     <value type="int">14</value>
+    </valuelist>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">vkvg_test_curves</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.vkvg_test_curves</value>
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.3">
+    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
+    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+     <value type="int">0</value>
+     <value type="int">1</value>
+     <value type="int">2</value>
+     <value type="int">3</value>
+     <value type="int">4</value>
+     <value type="int">5</value>
+     <value type="int">6</value>
+     <value type="int">7</value>
+     <value type="int">8</value>
+     <value type="int">9</value>
+     <value type="int">10</value>
+     <value type="int">11</value>
+     <value type="int">12</value>
+     <value type="int">13</value>
+     <value type="int">14</value>
+    </valuelist>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">vkvg_perf_test_0</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.vkvg_perf_test_0</value>
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.4">
+    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
+    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+     <value type="int">0</value>
+     <value type="int">1</value>
+     <value type="int">2</value>
+     <value type="int">3</value>
+     <value type="int">4</value>
+     <value type="int">5</value>
+     <value type="int">6</value>
+     <value type="int">7</value>
+     <value type="int">8</value>
+     <value type="int">9</value>
+     <value type="int">10</value>
+     <value type="int">11</value>
+     <value type="int">12</value>
+     <value type="int">13</value>
+     <value type="int">14</value>
+    </valuelist>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/mnt/devel/gts/vkvg/build</value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">vkvg_test</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">vkvg_test2</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.vkvg_test
+/mnt/devel/gts/vkvg/</value>
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+   </valuemap>
+   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">5</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.1</variable>
+  <valuemap type="QVariantMap">
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{81275d56-2237-4c29-a364-8221c7c7c53e}</value>
+   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+    <valuelist type="QVariantList" key="CMake.Configuration"/>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/mnt/devel/gts/build-vkvg-Desktop-Du00e9faut</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+      <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
+       <value type="QString">all</value>
+      </valuelist>
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Défaut</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Défaut</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+    <valuelist type="QVariantList" key="CMake.Configuration">
+     <value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
+    </valuelist>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/mnt/devel/gts/build-vkvg-Desktop-Debug</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+      <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
+       <value type="QString">all</value>
+      </valuelist>
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
+    <valuelist type="QVariantList" key="CMake.Configuration">
+     <value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
+    </valuelist>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/mnt/devel/gts/build-vkvg-Desktop-Release</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+      <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
+       <value type="QString">all</value>
+      </valuelist>
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
+    <valuelist type="QVariantList" key="CMake.Configuration">
+     <value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
+    </valuelist>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/mnt/devel/gts/build-vkvg-Desktop-Release with Debug Information</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+      <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
+       <value type="QString">all</value>
+      </valuelist>
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release with Debug Information</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.4">
+    <valuelist type="QVariantList" key="CMake.Configuration">
+     <value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
+    </valuelist>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/mnt/devel/gts/build-vkvg-Desktop-Minimum Size Release</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+      <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
+       <value type="QString">all</value>
+      </valuelist>
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Minimum Size Release</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+   </valuemap>
+   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">5</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Configuration de déploiement</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+   </valuemap>
+   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
+    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+     <value type="int">0</value>
+     <value type="int">1</value>
+     <value type="int">2</value>
+     <value type="int">3</value>
+     <value type="int">4</value>
+     <value type="int">5</value>
+     <value type="int">6</value>
+     <value type="int">7</value>
+     <value type="int">8</value>
+     <value type="int">9</value>
+     <value type="int">10</value>
+     <value type="int">11</value>
+     <value type="int">12</value>
+     <value type="int">13</value>
+     <value type="int">14</value>
+    </valuelist>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
+    <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">vkvg_test</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.vkvg_test</value>
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+   </valuemap>
+   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.TargetCount</variable>
+  <value type="int">2</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+  <value type="int">18</value>
+ </data>
+ <data>
+  <variable>Version</variable>
+  <value type="int">18</value>
+ </data>
+</qtcreator>
index 550b90cb8682d26e074ce80831ef3e4e9b55e038..108461e3bbc75593c784e21d7a7f25de1978ce29 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+ * Copyright (c) 2018-2019 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
@@ -28,6 +28,7 @@ extern "C" {
 
 #include <vulkan/vulkan.h>
 #include <math.h>
+#include <stdbool.h>
 
 #ifdef VKVG_TILING_OPTIMAL
     #define VKVG_TILING VK_IMAGE_TILING_OPTIMAL
@@ -160,7 +161,7 @@ typedef struct _vkvg_device_t*  VkvgDevice;
 typedef struct _vkvg_pattern_t* VkvgPattern;
 
 VkvgDevice     vkvg_device_create              (VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex);
-VkvgDevice  vkvg_device_create_multisample  (VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex, VkSampleCountFlags samples);
+VkvgDevice  vkvg_device_create_multisample  (VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex, VkSampleCountFlags samples, bool deferredResolve);
 void           vkvg_device_destroy             (VkvgDevice dev);
 VkvgDevice  vkvg_device_reference           (VkvgDevice dev);
 uint32_t    vkvg_device_get_reference_count (VkvgDevice dev);
@@ -180,6 +181,7 @@ uint32_t    vkvg_surface_get_width      (VkvgSurface surf);
 uint32_t       vkvg_surface_get_height     (VkvgSurface surf);
 VkImage                vkvg_surface_get_vkh_image      (VkvgSurface surf);
 void        vkvg_surface_write_to_png   (VkvgSurface surf, const char* path);
+void        vkvg_multisample_surface_resolve (VkvgSurface surf);
 
 //mimic from cairo, to facilitate usage of vkvg as cairo vulkan backend
 typedef enum _vkvg_operator {
index 5bd59ccb035c3a0d469c15d6a5121de9295e40d0..f5cd70145e784695e8d1e4b3a161159755377a0b 100644 (file)
@@ -5,9 +5,15 @@
 
 layout (set=0, binding = 0) uniform sampler2DArray fontMap;
 layout (set=1, binding = 0) uniform sampler2D          source;
+layout (set=2, binding = 0) uniform _uboGrad {
+       vec4    cp[3];
+       vec4    colors[16];
+       vec4    stops[16];
+       uint    count;
+}uboGrad;
 
-layout (location = 0) in vec3 inFontUV;                //if it is a text drawing, inFontUV.z hold fontMap layer
-layout (location = 1) in vec4 inColor;         //source rgba
+layout (location = 0) in vec3  inFontUV;               //if it is a text drawing, inFontUV.z hold fontMap layer
+layout (location = 1) in vec4  inSrc;                  //source bounds or color
 layout (location = 2) in flat int inPatType;
 layout (location = 3) in mat3x2 inMat;
 
@@ -17,5 +23,5 @@ layout (constant_id = 0) const int NUM_SAMPLES = 8;
 
 void main()
 {
-       outFragColor = inColor;
+       outFragColor = vec4(1,1,1,1);//inSrc;
 }
index 43948aea3b2b4428dd26daafaeb3d7d050906ffc..909c604e89d6d025d08b311b8439d364a2e3c043 100644 (file)
@@ -1234,14 +1234,14 @@ unsigned char vkvg_main_vert_spv[] = {
 unsigned int vkvg_main_vert_spv_len = 2680;
 unsigned char wired_frag_spv[] = {
   0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x0d, 0x00,
-  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
+  0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
   0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
   0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30,
   0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00,
   0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00,
-  0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
-  0x1a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00,
+  0x09, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
+  0x24, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00,
   0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00,
   0x02, 0x00, 0x00, 0x00, 0xc2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00,
   0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72,
@@ -1259,73 +1259,111 @@ unsigned char wired_frag_spv[] = {
   0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00,
   0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6f, 0x75, 0x74, 0x46,
   0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x43, 0x6f,
-  0x6c, 0x6f, 0x72, 0x00, 0x05, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x66, 0x6f, 0x6e, 0x74, 0x4d, 0x61, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x00,
-  0x05, 0x00, 0x05, 0x00, 0x17, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x46, 0x6f,
-  0x6e, 0x74, 0x55, 0x56, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00,
-  0x1a, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x50, 0x61, 0x74, 0x54, 0x79, 0x70,
-  0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00,
-  0x69, 0x6e, 0x4d, 0x61, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00,
-  0x1f, 0x00, 0x00, 0x00, 0x4e, 0x55, 0x4d, 0x5f, 0x53, 0x41, 0x4d, 0x50,
-  0x4c, 0x45, 0x53, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
-  0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
-  0x0b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x47, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00,
+  0x05, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6e, 0x74,
+  0x4d, 0x61, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00,
+  0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00,
+  0x1a, 0x00, 0x00, 0x00, 0x5f, 0x75, 0x62, 0x6f, 0x47, 0x72, 0x61, 0x64,
+  0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x63, 0x70, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00,
+  0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f,
+  0x72, 0x73, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x1a, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x00, 0x73, 0x74, 0x6f, 0x70, 0x73, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x05, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x63, 0x6f, 0x75, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00,
+  0x1c, 0x00, 0x00, 0x00, 0x75, 0x62, 0x6f, 0x47, 0x72, 0x61, 0x64, 0x00,
+  0x05, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x46, 0x6f,
+  0x6e, 0x74, 0x55, 0x56, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00,
+  0x21, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x53, 0x72, 0x63, 0x00, 0x00, 0x00,
+  0x05, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x50, 0x61,
+  0x74, 0x54, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00,
+  0x28, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x00, 0x00, 0x00,
+  0x05, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x4e, 0x55, 0x4d, 0x5f,
+  0x53, 0x41, 0x4d, 0x50, 0x4c, 0x45, 0x53, 0x00, 0x47, 0x00, 0x04, 0x00,
+  0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x47, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00,
   0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x47, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00,
-  0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00,
-  0x1a, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
-  0x1a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x47, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
-  0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
-  0x3b, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
-  0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x19, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x13, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x47, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
+  0x18, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+  0x47, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+  0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1a, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x48, 0x00, 0x05, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x23, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00,
+  0x1a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00,
+  0x30, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1a, 0x00, 0x00, 0x00,
+  0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00,
+  0x47, 0x00, 0x03, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x47, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00,
+  0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
+  0x1f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x47, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x24, 0x00, 0x00, 0x00,
+  0x0e, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00,
+  0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
+  0x28, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+  0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
+  0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00,
+  0x0b, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+  0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00,
+  0x0c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x1b, 0x00, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
-  0x20, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00,
-  0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00,
-  0x11, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00,
-  0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
-  0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
-  0x3b, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
-  0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
-  0x3b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00,
+  0x0d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+  0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
+  0x3b, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x10, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00,
+  0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
+  0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00,
+  0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00,
+  0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+  0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+  0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00,
+  0x07, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00,
+  0x19, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+  0x1e, 0x00, 0x06, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
+  0x18, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+  0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x1a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00,
+  0x1c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00,
+  0x1d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x20, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00,
+  0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+  0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+  0x3b, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00,
   0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
-  0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
-  0x3b, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00,
+  0x23, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
+  0x3b, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00,
   0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x20, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00,
-  0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x04, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x26, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00,
+  0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x04, 0x00,
+  0x22, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
   0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00,
-  0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00,
-  0x09, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00,
-  0x38, 0x00, 0x01, 0x00
+  0x05, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00,
+  0x0b, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
 };
-unsigned int wired_frag_spv_len = 1120;
+unsigned int wired_frag_spv_len = 1584;
index 236ce4565feae55fea1b672f11a7b919110170be..5f7374cf08013f5851d04bf6064454263acdad52 100644 (file)
 
 #include "vectors.h"
 
-#define ROUNDF(f, c) (((float)((int)((f) * (c))) / (c)))
-
+// init float vector
 inline vec2 vec2_create (float x, float y) {
     vec2 v = {x,y};
     return v;
 }
+// compute normal direction vector from line defined by 2 points in double precision
+vec2d vec2d_line_norm(vec2d a, vec2d b)
+{
+    vec2d d = {b.x - a.x, b.y - a.y};
+    double md = sqrt (d.x*d.x + d.y*d.y);
+    d.x/=md;
+    d.y/=md;
+    return d;
+}
+// compute normal direction vector from line defined by 2 points
 vec2 vec2_line_norm(vec2 a, vec2 b)
 {
     vec2 d = {b.x - a.x, b.y - a.y};
@@ -36,74 +45,81 @@ vec2 vec2_line_norm(vec2 a, vec2 b)
     d.y/=md;
     return d;
 }
+// compute length of double vector 2d
 double vec2d_length(vec2d v){
     return sqrt (v.x*v.x + v.y*v.y);
 }
+// compute length of float vector 2d
 float vec2_length(vec2 v){
     return sqrt (v.x*v.x + v.y*v.y);
 }
+// normalize float vector
 vec2 vec2_norm(vec2 a)
 {
     float m = sqrt (a.x*a.x + a.y*a.y);
     vec2 d = {a.x/m, a.y/m};
     return d;
 }
+// normalize double vector
 vec2d vec2d_norm(vec2d a)
 {
     double m = sqrt (a.x*a.x + a.y*a.y);
     vec2d d = {a.x/m, a.y/m};
     return d;
 }
+// multiply 2d vector by scalar
 vec2d vec2d_mult(vec2d a, double m){
     vec2d r = {a.x*m,a.y*m};
     return r;
 }
+// multiply 2d vector by scalar
 vec2 vec2_mult(vec2 a, float m){
     vec2 r = {a.x*m,a.y*m};
     return r;
 }
-
-vec2d vec2d_line_norm(vec2d a, vec2d b)
-{
-    vec2d d = {b.x - a.x, b.y - a.y};
-    double md = sqrt (d.x*d.x + d.y*d.y);
-    d.x/=md;
-    d.y/=md;
-    return d;
-}
+// compute perpendicular vector
 vec2d vec2d_perp (vec2d a){
     vec2d vp = {a.y, -a.x};
     return vp;
 }
+// compute perpendicular vector
 vec2 vec2_perp (vec2 a){
     vec2 vp = {a.y, -a.x};
     return vp;
 }
+// convert double precision vector to single precision
 vec2 vec2d_to_vec2(vec2d vd){
     vec2 v = {vd.x,vd.y};
     return v;
 }
+// compute sum of two single precision vectors
 vec2 vec2_add (vec2 a, vec2 b){
     vec2 r = {a.x + b.x, a.y + b.y};
     return r;
 }
+// compute sum of two double precision vectors
 vec2d vec2d_add (vec2d a, vec2d b){
     vec2d r = {a.x + b.x, a.y + b.y};
     return r;
 }
+// compute subbstraction of two single precision vectors
 vec2 vec2_sub (vec2 a, vec2 b){
     vec2 r = {a.x - b.x, a.y - b.y};
     return r;
 }
+// compute subbstraction of two double precision vectors
 vec2d vec2d_sub (vec2d a, vec2d b){
     vec2d r = {a.x - b.x, a.y - b.y};
     return r;
 }
+// test equality of two single precision vectors
 bool vec2_equ (vec2 a, vec2 b){
-    if ((ROUNDF(a.x,10000) == ROUNDF(b.x,10000)) && (ROUNDF(a.y,10000) == ROUNDF(b.y,10000)))
+    /*if ((ROUNDF(a.x,10000) == ROUNDF(b.x,10000)) && (ROUNDF(a.y,10000) == ROUNDF(b.y,10000)))
         return true;
-    return false;
+    return false;*/
+    return (EQUF(a.x,b.x)&EQUF(a.y,b.y));
 }
+// compute opposite of single precision vector
 void vec2_inv (vec2* v){
     v->x = -v->x;
     v->y = -v->y;
index db569aa83374b2a644ae7112b77ff0dfdc3cfd91..dbd37bb278db7f640be37d5059ff44f9e0d67a49 100644 (file)
@@ -22,9 +22,7 @@
 #ifndef VKVG_VECTORS_H
 #define VKVG_VECTORS_H
 
-#include <math.h>
-#include <stdint.h>
-#include <stdbool.h>
+#include "vkvg_internal.h"
 
 typedef struct {
     float x;
index 8020651e0046f9f782a2f58bacff48e06eb52b5e..755d9bae8b520a3f197be5cc5cb0c4c9f3ac847a 100644 (file)
@@ -31,6 +31,11 @@ static vec2 debugLinePoints[1000];
 static uint32_t dlpCount = 0;
 #endif
 
+/**
+ * @brief create new context for surface
+ * @param drawing operation output surface
+ * @return newly created context pointer
+ */
 VkvgContext vkvg_create(VkvgSurface surf)
 {
     LOG(LOG_INFO, "CREATE Context: surf = %lu\n", (ulong)surf);
@@ -38,8 +43,10 @@ VkvgContext vkvg_create(VkvgSurface surf)
     VkvgDevice dev = surf->dev;
     VkvgContext ctx = (vkvg_context*)calloc(1, sizeof(vkvg_context));
 
-    if (ctx==NULL)
+    if (ctx==NULL) {
+        dev->status = VKVG_STATUS_NO_MEMORY;
         return NULL;
+    }
 
     ctx->sizePoints     = VKVG_PTS_SIZE;
     ctx->sizeVertices   = VKVG_VBO_SIZE;
@@ -95,8 +102,11 @@ VkvgContext vkvg_create(VkvgSurface surf)
     ctx->status = VKVG_STATUS_SUCCESS;
     return ctx;
 }
+/**
+ * @brief explicitly flush pending drawing operations on context
+ * @param context pointer to flush
+ */
 void vkvg_flush (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _flush_cmd_buff(ctx);
     _init_cmd_buff(ctx);
 /*
@@ -123,6 +133,10 @@ void vkvg_flush (VkvgContext ctx){
 */
 }
 
+/**
+ * @brief decrement reference count on context and release ressources if reference equal 0.
+ * @param context to destroy
+ */
 void vkvg_destroy (VkvgContext ctx)
 {
     ctx->references--;
@@ -165,6 +179,7 @@ void vkvg_destroy (VkvgContext ctx)
             vkvg_pattern_destroy (cur->pattern);
     }
 
+    //remove context from double linked list of context in device
     if (ctx->pSurf->dev->lastCtx == ctx){
         ctx->pSurf->dev->lastCtx = ctx->pPrev;
         if (ctx->pPrev != NULL)
@@ -179,28 +194,46 @@ void vkvg_destroy (VkvgContext ctx)
 
     free(ctx);
 }
+/**
+ * @brief increment reference count on context
+ * @param context pointer
+ * @return
+ */
 VkvgContext vkvg_reference (VkvgContext ctx) {
     ctx->references++;
     return ctx;
 }
+/**
+ * @brief get current reference count for context
+ * @param context pointer
+ * @return
+ */
 uint32_t vkvg_get_reference_count (VkvgContext ctx) {
     return ctx->references;
 }
-
+/**
+ * @brief Start new sub path, no current point is defined
+ * @param context pointer
+ */
 void vkvg_new_sub_path (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _finish_path(ctx);
 }
+/**
+ * @brief clear current context path without drawing anything
+ * @param context pointer
+ */
 void vkvg_new_path (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _clear_path(ctx);
 }
 //path closing is done by setting the endpoint of the path to the same index
 //as the start point.
 //I'll test if closing by adding a new point with the same x,y as the start point
 //would not make more sense.
+/**
+ * @brief Close current path if at least 3 points are present
+ * @param context pointer
+ */
 void vkvg_close_path (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (_current_path_is_empty(ctx)){
         ctx->status = VKVG_STATUS_NO_CURRENT_POINT;
         return;
@@ -217,8 +250,13 @@ void vkvg_close_path (VkvgContext ctx){
     }else
         _finish_path(ctx);
 }
+/**
+ * @brief draw line with second point coordinates relative to current point
+ * @param context pointer
+ * @param delta x
+ * @param delta y
+ */
 void vkvg_rel_line_to (VkvgContext ctx, float x, float y){
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (_current_path_is_empty(ctx)){
         ctx->status = VKVG_STATUS_NO_CURRENT_POINT;
         return;
@@ -226,9 +264,14 @@ void vkvg_rel_line_to (VkvgContext ctx, float x, float y){
     vec2 cp = _get_current_position(ctx);
     vkvg_line_to(ctx, cp.x + x, cp.y + y);
 }
+/**
+ * @brief Draw line from current point, if no current point is defined, only a move to will be executed.
+ * @param context pointer
+ * @param absolute x coordinate of second point
+ * @param aboslute y coordinate of second point
+ */
 void vkvg_line_to (VkvgContext ctx, float x, float y)
 {
-    ctx->status = VKVG_STATUS_SUCCESS;
     vec2 p = {x,y};
     if (_current_path_is_empty(ctx)){
         vkvg_move_to(ctx, x,y);
@@ -238,15 +281,25 @@ void vkvg_line_to (VkvgContext ctx, float x, float y)
 
     _add_point(ctx,x,y);
 }
-
+/**
+ * @brief Draw arc
+ * @param context pointer
+ * @param center x coordinate
+ * @param center y coordinate
+ * @param radius
+ * @param start angle of arc
+ * @param end angle of arc
+ */
 void vkvg_arc (VkvgContext ctx, float xc, float yc, float radius, float a1, float a2){
-    ctx->status = VKVG_STATUS_SUCCESS;
-    while (a2 < a1)
-        a2 += 2*M_PI;
+    while (a2 < a1)//positive arc must have a1<a2
+        a2 += 2.f*M_PIF;
+
+    if (a2 - a1 > 2.f * M_PIF) //limit arc to 2PI
+        a2 = a1 + 2.f * M_PIF;
 
-    vec2 v = {cos(a1)*radius + xc, sin(a1)*radius + yc};
+    vec2 v = {cosf(a1)*radius + xc, sinf(a1)*radius + yc};
 
-    float step = M_PI/radius;
+    float step = M_PIF/radius*1.5f;
     float a = a1;
 
     if (_current_path_is_empty(ctx))
@@ -256,31 +309,33 @@ void vkvg_arc (VkvgContext ctx, float xc, float yc, float radius, float a1, floa
 
     a+=step;
 
-    if (a2 == a1)
+    if (EQUF(a2, a1))
         return;
 
     while(a < a2){
-        v.x = cos(a)*radius + xc;
-        v.y = sin(a)*radius + yc;
+        v.x = cosf(a)*radius + xc;
+        v.y = sinf(a)*radius + yc;
         _add_point (ctx, v.x, v.y);
         a+=step;
     }
-
+    if (EQUF(a2-a1,M_PIF*2.f))//if arc is complete circle, last point is the same as the first one
+        return;
     a = a2;
     vec2 lastP = v;
-    v.x = cos(a)*radius + xc;
-    v.y = sin(a)*radius + yc;
+    v.x = cosf(a)*radius + xc;
+    v.y = sinf(a)*radius + yc;
     //if (!vec2_equ (v,lastP))//this test should not be required
         _add_point (ctx, v.x, v.y);
 }
 void vkvg_arc_negative (VkvgContext ctx, float xc, float yc, float radius, float a1, float a2) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     while (a2 > a1)
-        a2 -= 2*M_PI;
+        a2 -= 2.f*M_PIF;
+    if (a1 - a2 > a1 + 2.f * M_PIF) //limit arc to 2PI
+        a2 = a1 - 2.f * M_PIF;
 
-    vec2 v = {cos(a1)*radius + xc, sin(a1)*radius + yc};
+    vec2 v = {cosf(a1)*radius + xc, sinf(a1)*radius + yc};
 
-    float step = M_PI/radius;
+    float step = M_PIF/radius*1.5f;
     float a = a1;
 
     if (_current_path_is_empty(ctx))
@@ -291,26 +346,28 @@ void vkvg_arc_negative (VkvgContext ctx, float xc, float yc, float radius, float
 
     a-=step;
 
-    if (a2 == a1)//double check if this test should not be in the previous if
+    if (EQUF(a2, a1))
         return;
 
     while(a > a2){
-        v.x = cos(a)*radius + xc;
-        v.y = sin(a)*radius + yc;
+        v.x = cosf(a)*radius + xc;
+        v.y = sinf(a)*radius + yc;
         _add_point (ctx,v.x,v.y);
         a-=step;
     }
 
+    if (EQUF(a1-a2,M_PIF*2.f))//if arc is complete circle, last point is the same as the first one
+        return;
+
     a = a2;
     vec2 lastP = v;
-    v.x = cos(a)*radius + xc;
-    v.y = sin(a)*radius + yc;
+    v.x = cosf(a)*radius + xc;
+    v.y = sinf(a)*radius + yc;
     //if (!vec2_equ (v,lastP))
         _add_point (ctx, v.x, v.y);
 }
 void vkvg_rel_move_to (VkvgContext ctx, float x, float y)
 {
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (_current_path_is_empty(ctx)){
         ctx->status = VKVG_STATUS_NO_CURRENT_POINT;
         return;
@@ -320,12 +377,10 @@ void vkvg_rel_move_to (VkvgContext ctx, float x, float y)
 }
 void vkvg_move_to (VkvgContext ctx, float x, float y)
 {
-    ctx->status = VKVG_STATUS_SUCCESS;
     _finish_path(ctx);
     _start_sub_path(ctx, x, y);
 }
 void vkvg_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, float x3, float y3) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (_current_path_is_empty(ctx))
         vkvg_move_to(ctx, x1, y1);
 
@@ -337,7 +392,6 @@ void vkvg_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, flo
     _add_point(ctx,x3,y3);
 }
 void vkvg_rel_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, float x3, float y3) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (_current_path_is_empty(ctx)){
         ctx->status = VKVG_STATUS_NO_CURRENT_POINT;
         return;
@@ -347,7 +401,6 @@ void vkvg_rel_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2,
 }
 
 void vkvg_rectangle (VkvgContext ctx, float x, float y, float w, float h){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _finish_path (ctx);
 
     _start_sub_path(ctx, x, y);
@@ -357,16 +410,14 @@ void vkvg_rectangle (VkvgContext ctx, float x, float y, float w, float h){
 
     vkvg_close_path (ctx);
 }
-const VkClearAttachment clearStencil        = {VK_IMAGE_ASPECT_STENCIL_BIT, 1, {0}};
-const VkClearAttachment clearColorAttach    = {VK_IMAGE_ASPECT_COLOR_BIT,   0, {0}};
+static const VkClearAttachment clearStencil        = {VK_IMAGE_ASPECT_STENCIL_BIT, 1, {0}};
+static const VkClearAttachment clearColorAttach    = {VK_IMAGE_ASPECT_COLOR_BIT,   0, {0}};
 
 void vkvg_reset_clip (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _check_cmd_buff_state (ctx);
     vkCmdClearAttachments(ctx->cmd, 1, &clearStencil, 1, &ctx->clearRect);
 }
 void vkvg_clear (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _check_cmd_buff_state (ctx);
     VkClearAttachment ca[2] = {clearColorAttach, clearStencil};
     vkCmdClearAttachments(ctx->cmd, 2, ca, 1, &ctx->clearRect);
@@ -414,7 +465,6 @@ void _poly_fill (VkvgContext ctx){
     }
 }
 void vkvg_clip_preserve (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (ctx->pathPtr == 0)      //nothing to fill
         return;
     _finish_path(ctx);
@@ -433,7 +483,6 @@ void vkvg_clip_preserve (VkvgContext ctx){
     CmdSetStencilCompareMask(ctx->cmd, VK_STENCIL_FRONT_AND_BACK, STENCIL_CLIP_BIT);
 }
 void vkvg_fill_preserve (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (ctx->pathPtr == 0)      //nothing to fill
         return;
     _finish_path(ctx);
@@ -453,7 +502,6 @@ void vkvg_fill_preserve (VkvgContext ctx){
 }
 void vkvg_stroke_preserve (VkvgContext ctx)
 {
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (ctx->pathPtr == 0)//nothing to stroke
         return;
     _finish_path(ctx);
@@ -584,45 +632,36 @@ void vkvg_stroke_preserve (VkvgContext ctx)
     _record_draw_cmd(ctx);
 }
 void vkvg_paint (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _check_cmd_buff_state(ctx);
     CmdDrawIndexed (ctx->cmd,6,1,0,0,0);
 }
 inline void vkvg_set_source_rgb (VkvgContext ctx, float r, float g, float b) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     vkvg_set_source_rgba (ctx, r, g, b, 1);
 }
 void vkvg_set_source_rgba (VkvgContext ctx, float r, float g, float b, float a)
 {
-    ctx->status = VKVG_STATUS_SUCCESS;
     _update_cur_pattern (ctx, vkvg_pattern_create_rgba (r,g,b,a));
 }
 void vkvg_set_source_surface(VkvgContext ctx, VkvgSurface surf, float x, float y){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _update_cur_pattern (ctx, vkvg_pattern_create_for_surface(surf));
     ctx->pushConsts.source.x = x;
     ctx->pushConsts.source.y = y;
     ctx->pushCstDirty = true;
 }
 void vkvg_set_source (VkvgContext ctx, VkvgPattern pat){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _update_cur_pattern (ctx, pat);
     vkvg_pattern_reference  (pat);
 }
 void vkvg_set_line_width (VkvgContext ctx, float width){
-    ctx->status = VKVG_STATUS_SUCCESS;
     ctx->lineWidth = width;
 }
 void vkvg_set_line_cap (VkvgContext ctx, vkvg_line_cap_t cap){
-    ctx->status = VKVG_STATUS_SUCCESS;
     ctx->lineCap = cap;
 }
 void vkvg_set_line_join (VkvgContext ctx, vkvg_line_join_t join){
-    ctx->status = VKVG_STATUS_SUCCESS;
     ctx->lineJoin = join;
 }
 void vkvg_set_operator (VkvgContext ctx, vkvg_operator_t op){
-    ctx->status = VKVG_STATUS_SUCCESS;
     ctx->curOperator = op;
     _bind_draw_pipeline (ctx);
 }
@@ -644,27 +683,23 @@ VkvgPattern vkvg_get_source (VkvgContext ctx){
 }
 
 void vkvg_select_font_face (VkvgContext ctx, const char* name){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _select_font_face (ctx, name);
 }
 void vkvg_set_font_size (VkvgContext ctx, uint32_t size){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _set_font_size (ctx,size);
 }
 
 void vkvg_set_text_direction (vkvg_context* ctx, vkvg_direction_t direction){
-    ctx->status = VKVG_STATUS_SUCCESS;
+
 }
 
 void vkvg_show_text (VkvgContext ctx, const char* text){
-    ctx->status = VKVG_STATUS_SUCCESS;
     _check_cmd_buff_state(ctx);
     _show_text (ctx, text);
     _record_draw_cmd (ctx);
 }
 
 VkvgText vkvg_text_run_create (VkvgContext ctx, const char* text) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     VkvgText tr = (vkvg_text_run_t*)calloc(1, sizeof(vkvg_text_run_t));
     _create_text_run(ctx, text, tr);
     return tr;
@@ -674,7 +709,6 @@ void vkvg_text_run_destroy (VkvgText textRun) {
     free (textRun);
 }
 void vkvg_show_text_run (VkvgContext ctx, VkvgText textRun) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     _show_text_run(ctx, textRun);
 }
 vkvg_text_extents_t* vkvg_text_run_get_extents (VkvgText textRun) {
@@ -689,7 +723,6 @@ void vkvg_font_extents (VkvgContext ctx, vkvg_font_extents_t* extents) {
 }
 
 void vkvg_save (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     LOG(LOG_INFO, "SAVE CONTEXT: ctx = %lu\n", (ulong)ctx);
 
     _flush_cmd_buff(ctx);
@@ -761,7 +794,6 @@ void vkvg_save (VkvgContext ctx){
     _init_cmd_buff          (ctx);
 }
 void vkvg_restore (VkvgContext ctx){
-    ctx->status = VKVG_STATUS_SUCCESS;
     if (ctx->pSavedCtxs == NULL){
         ctx->status = VKVG_STATUS_INVALID_RESTORE;
         return;
@@ -833,35 +865,29 @@ void vkvg_restore (VkvgContext ctx){
 }
 
 void vkvg_translate (VkvgContext ctx, float dx, float dy){
-    ctx->status = VKVG_STATUS_SUCCESS;
     vkvg_matrix_translate (&ctx->pushConsts.mat, dx, dy);
     _set_mat_inv_and_vkCmdPush (ctx);
 }
 void vkvg_scale (VkvgContext ctx, float sx, float sy){
-    ctx->status = VKVG_STATUS_SUCCESS;
     vkvg_matrix_scale (&ctx->pushConsts.mat, sx, sy);
     _set_mat_inv_and_vkCmdPush (ctx);
 }
 void vkvg_rotate (VkvgContext ctx, float radians){
-    ctx->status = VKVG_STATUS_SUCCESS;
     vkvg_matrix_rotate (&ctx->pushConsts.mat, radians);
     _set_mat_inv_and_vkCmdPush (ctx);
 }
 void vkvg_transform (VkvgContext ctx, const vkvg_matrix_t* matrix) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     vkvg_matrix_t res;
     vkvg_matrix_multiply (&res, &ctx->pushConsts.mat, matrix);
     ctx->pushConsts.mat = res;
     _set_mat_inv_and_vkCmdPush (ctx);
 }
 void vkvg_identity_matrix (VkvgContext ctx) {
-    ctx->status = VKVG_STATUS_SUCCESS;
     vkvg_matrix_t im = VKVG_IDENTITY_MATRIX;
     ctx->pushConsts.mat = im;
     _set_mat_inv_and_vkCmdPush (ctx);
 }
 void vkvg_set_matrix (VkvgContext ctx, const vkvg_matrix_t* matrix){
-    ctx->status = VKVG_STATUS_SUCCESS;
     ctx->pushConsts.mat = (*matrix);
     _set_mat_inv_and_vkCmdPush (ctx);
 }
index 081ba9798e09f3636c3101af4ab87ed96412ce5e..2ffe7b3963810521d2b5dbefde6c1aa44a5c9d4a 100644 (file)
@@ -102,9 +102,9 @@ void _add_point_vec2(VkvgContext ctx, vec2 v){
 }
 float _normalizeAngle(float a)
 {
-    float res = ROUND_DOWN(fmod(a,2.0f*M_PI),100);
+    float res = ROUND_DOWN(fmod(a,2.0f*M_PIF),100);
     if (res < 0.0f)
-        return res + 2.0f*M_PI;
+        return res + 2.0f*M_PIF;
     else
         return res;
 }
@@ -184,11 +184,11 @@ void _record_draw_cmd (VkvgContext ctx){
     _check_cmd_buff_state(ctx);
     CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, 0, 1);
 
-    //DEBUG
-    /*CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
+#ifdef VKVG_WIRED_DEBUG
+    CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
     CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, 0, 1);
-    CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);*/
-    //////////
+    CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
+#endif
 
     ctx->curIndStart = ctx->indCount;
 }
@@ -211,7 +211,7 @@ inline void _submit_wait_and_reset_cmd (VkvgContext ctx){
     _submit_ctx_cmd(ctx);
     _wait_and_reset_ctx_cmd(ctx);
 }
-void _explicit_ms_resolve (VkvgContext ctx){//should init cmd before calling this (unused, using automatic resolve by renderpass)
+/*void _explicit_ms_resolve (VkvgContext ctx){//should init cmd before calling this (unused, using automatic resolve by renderpass)
     vkh_image_set_layout (ctx->cmd, ctx->pSurf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
                           VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
                           VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
@@ -232,7 +232,7 @@ void _explicit_ms_resolve (VkvgContext ctx){//should init cmd before calling thi
     vkh_image_set_layout (ctx->cmd, ctx->pSurf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
                           VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ,
                           VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
-}
+}*/
 
 void _end_render_pass (VkvgContext ctx) {
     LOG(LOG_INFO, "FLUSH Context: ctx = %lu; vert cpt = %d; ind cpt = %d\n", ctx, ctx->vertCount -4, ctx->indCount - 6);
@@ -560,13 +560,13 @@ void _build_vb_step (vkvg_context* ctx, Vertex v, float hw, uint32_t iL, uint32_
             _add_triangle_indices(ctx, idx+2, idx+3, idx+1);
             _add_triangle_indices(ctx, idx+1, idx+3, idx+4);
         }else if (ctx->lineJoin == VKVG_LINE_JOIN_ROUND){
-            float step = M_PI / hw;
+            float step = M_PIF / hw;
             float a = acos(vp.x);
             if (vp.y < 0)
                 a = -a;
 
             if (cross<0){
-                a+=M_PI;
+                a+=M_PIF;
                 float a1 = a + alpha*2;
                 a-=step;
                 while (a > a1){
@@ -700,8 +700,8 @@ void _recursive_bezier (VkvgContext ctx,
                 float a23 = atan2(y3 - y2, x3 - x2);
                 da1 = fabs(a23 - atan2(y2 - y1, x2 - x1));
                 da2 = fabs(atan2(y4 - y3, x4 - x3) - a23);
-                if(da1 >= M_PI) da1 = M_2_PI - da1;
-                if(da2 >= M_PI) da2 = M_2_PI - da2;
+                if(da1 >= M_PIF) da1 = M_2_PI - da1;
+                if(da2 >= M_PIF) da2 = M_2_PI - da2;
 
                 if(da1 + da2 < m_angle_tolerance)
                 {
@@ -742,7 +742,7 @@ void _recursive_bezier (VkvgContext ctx,
                     // Angle Condition
                     //----------------------
                     da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
-                    if(da1 >= M_PI) da1 = M_2_PI - da1;
+                    if(da1 >= M_PIF) da1 = M_2_PI - da1;
 
                     if(da1 < m_angle_tolerance)
                     {
@@ -774,7 +774,7 @@ void _recursive_bezier (VkvgContext ctx,
                     // Angle Condition
                     //----------------------
                     da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2));
-                    if(da1 >= M_PI) da1 = M_2_PI - da1;
+                    if(da1 >= M_PIF) da1 = M_2_PI - da1;
 
                     if(da1 < m_angle_tolerance)
                     {
index a282c47a8b620dd25e7533ea61cbb478f586d96f..56149235e83d7ffaff3ff93d3e9cb183c2f83e38 100644 (file)
 #include "vkh.h"
 #include "vkvg_fonts.h"
 
-#define VKVG_PTS_SIZE                          16384
+#define VKVG_PTS_SIZE                          10000
 #define VKVG_VBO_SIZE                          VKVG_PTS_SIZE * 2
 #define VKVG_IBO_SIZE                          VKVG_VBO_SIZE * 2
-#define VKVG_PATHES_SIZE                       256
+#define VKVG_PATHES_SIZE                       16
 #define VKVG_ARRAY_THRESHOLD           4
 
-#define ROUND_DOWN(v,p) (floorf(v * p) / p)
-
 typedef struct{
     vec2 pos;
     vec3 uv;
index f0b145839a90b9faaf814da5f75b1eb7c457c872..1ea7e79844e4fdcf1b8e42874d086dda123f322f 100644 (file)
 #include "vkh_queue.h"
 #include "vkh_phyinfo.h"
 #include "vk_mem_alloc.h"
-
+/**
+ * @brief Create VkvgDevice with default multisampling configuration
+ * @param Vulkan instance, usefull to retrieve function pointers
+ * @param Vulkan physical device
+ * @param Vulkan Device
+ * @param Queue familly index
+ * @param Queue index in selected familly
+ * @return
+ */
 VkvgDevice vkvg_device_create(VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex)
 {
-    return vkvg_device_create_multisample (inst,phy,vkdev,qFamIdx,qIndex, VK_SAMPLE_COUNT_4_BIT);
+    return vkvg_device_create_multisample (inst,phy,vkdev,qFamIdx,qIndex, VK_SAMPLE_COUNT_4_BIT, false);
 }
-VkvgDevice vkvg_device_create_multisample(VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex, VkSampleCountFlags samples)
+/**
+ * @brief Create VkvgDevice with default multisampling configuration
+ * @param Vulkan instance, usefull to retrieve function pointers
+ * @param Vulkan physical device
+ * @param Vulkan Device
+ * @param Queue familly index
+ * @param Queue index in selected familly
+ * @param multisample count
+ * @param When set to false, surface is resolve after each renderpasses on resolve attachment of surface.
+ * If set to true, multisample surface image is resolve with vkvg_multisample_surface_resolve. This function
+ * is called automatically when surface's VkImage is querried with vkvg_surface_get_vk_image.
+ * @return
+ */
+VkvgDevice vkvg_device_create_multisample(VkInstance inst, VkPhysicalDevice phy, VkDevice vkdev, uint32_t qFamIdx, uint32_t qIndex, VkSampleCountFlags samples, bool deferredResolve)
 {
     LOG(LOG_INFO, "CREATE Device: qFam = %d; qIdx = %d\n", qFamIdx, qIndex);
 
@@ -39,6 +60,7 @@ VkvgDevice vkvg_device_create_multisample(VkInstance inst, VkPhysicalDevice phy,
     dev->hdpi   = 72;
     dev->vdpi   = 72;
     dev->samples= samples;
+    dev->deferredResolve = deferredResolve;
     dev->vkDev  = vkdev;
     dev->phy    = phy;
 
@@ -66,7 +88,10 @@ VkvgDevice vkvg_device_create_multisample(VkInstance inst, VkPhysicalDevice phy,
 
     _create_pipeline_cache      (dev);
     _init_fonts_cache           (dev);
-    _setupRenderPass            (dev);
+    if (dev->deferredResolve)
+        _setupRenderPassDeferredResolve(dev);
+    else
+        _setupRenderPass        (dev);
     _createDescriptorSetLayout  (dev);
     _setupPipelines             (dev);
 
@@ -98,7 +123,7 @@ void vkvg_device_destroy (VkvgDevice dev)
     vkDestroyPipeline               (dev->vkDev, dev->pipe_SUB,     NULL);
     vkDestroyPipeline               (dev->vkDev, dev->pipe_CLEAR,   NULL);
 
-#if DEBUG
+#ifdef VKVG_WIRED_DEBUG
     vkDestroyPipeline               (dev->vkDev, dev->pipelineWired, NULL);
     vkDestroyPipeline               (dev->vkDev, dev->pipelineLineList, NULL);
 #endif
index 5d30911b9e56508337e3a6d910f30c5ccf03198b..23d65726434e627c8d8cc36c978550766ee30988 100644 (file)
@@ -45,6 +45,59 @@ void _create_pipeline_cache(VkvgDevice dev){
     VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO};
     VK_CHECK_RESULT(vkCreatePipelineCache(dev->vkDev, &pipelineCacheCreateInfo, NULL, &dev->pipelineCache));
 }
+void _setupRenderPassDeferredResolve(VkvgDevice dev)
+{
+    VkAttachmentDescription attColor = {
+                    .format = FB_COLOR_FORMAT,
+                    .samples = dev->samples,
+                    .loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
+                    .storeOp = VK_ATTACHMENT_STORE_OP_STORE,
+                    .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
+                    .stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
+                    .initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+                    .finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+    VkAttachmentDescription attDS = {
+                    .format = VK_FORMAT_S8_UINT,
+                    .samples = dev->samples,
+                    .loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
+                    .storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
+                    .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
+                    .stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE,
+                    .initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+                    .finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
+
+    VkAttachmentDescription attachments[] = {attColor,attDS};
+    VkAttachmentReference colorRef  = {0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL};
+    VkAttachmentReference dsRef     = {1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL};
+
+    VkSubpassDescription subpassDescription = { .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
+                        .colorAttachmentCount   = 1,
+                        .pColorAttachments      = &colorRef,
+                        .pDepthStencilAttachment= &dsRef};
+
+    VkSubpassDependency dependencies[] =
+    {
+        { VK_SUBPASS_EXTERNAL, 0,
+          VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
+          VK_ACCESS_COLOR_ATTACHMENT_READ_BIT, VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
+          VK_DEPENDENCY_BY_REGION_BIT},
+        { 0, VK_SUBPASS_EXTERNAL,
+          VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
+          VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_MEMORY_READ_BIT,
+          VK_DEPENDENCY_BY_REGION_BIT},
+    };
+
+    VkRenderPassCreateInfo renderPassInfo = { .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+                .attachmentCount = 2,
+                .pAttachments = attachments,
+                .subpassCount = 1,
+                .pSubpasses = &subpassDescription,
+                .dependencyCount = 2,
+                .pDependencies = dependencies
+    };
+
+    VK_CHECK_RESULT(vkCreateRenderPass(dev->vkDev, &renderPassInfo, NULL, &dev->renderPass));
+}
 void _setupRenderPass(VkvgDevice dev)
 {
     VkAttachmentDescription attColor = {
@@ -259,7 +312,7 @@ void _setupPipelines(VkvgDevice dev)
     VK_CHECK_RESULT(vkCreateGraphicsPipelines(dev->vkDev, dev->pipelineCache, 1, &pipelineCreateInfo, NULL, &dev->pipe_CLEAR));
 
 
-#if DEBUG
+#ifdef VKVG_WIRED_DEBUG
     rasterizationState.polygonMode = VK_POLYGON_MODE_FILL;
     inputAssemblyState.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
     shaderStages[1].pName = "main";
index e7366836c8593ad240984cc267122ec77389c322..c888fed600760cfe96f58d159a146f288c130620 100644 (file)
@@ -49,50 +49,49 @@ PFN_vkCmdPushDescriptorSetKHR   CmdPushDescriptorSet;
 
 
 typedef struct _vkvg_device_t{
-    VkDevice                           vkDev;
-    VkPhysicalDeviceMemoryProperties phyMemProps;
-    VkPhysicalDevice        phy;
-    VmaAllocator            allocator;
-
-    VkhQueue                gQueue;
-    MUTEX                   gQMutex;//queue submission has to be externally syncronized
-    VkRenderPass                       renderPass;
-
-    uint32_t                references;
-    VkCommandPool                      cmdPool;
-    VkCommandBuffer         cmd;
-    //this fence is kept signaled when idle, wait and reset are called before each recording.
-    VkFence                 fence;
-
-    VkPipeline                         pipe_OVER;  //default operator
+    VkDevice                           vkDev;                  /**< Vulkan Logical Device */
+    VkPhysicalDeviceMemoryProperties phyMemProps;   /**< Vulkan Physical device memory properties */
+    VkPhysicalDevice        phy;                    /**< Vulkan Physical device */
+    VmaAllocator            allocator;              /**< Vulkan Memory allocator */
+    VkInstance              instance;               /**< Vulkan instance */
+
+    VkhQueue                gQueue;                 /**< Vulkan Queue with Graphic flag */
+    MUTEX                   gQMutex;                /**< queue submission has to be externally syncronized */
+    VkRenderPass                       renderPass;             /**< Vulkan render pass, common for all surfaces */
+
+    uint32_t                references;             /**< Reference count, prevent destroying device if still in use */
+    VkCommandPool                      cmdPool;                /**< Global command pool for processing on surfaces without context */
+    VkCommandBuffer         cmd;                    /**< Global command buffer */
+    VkFence                 fence;                  /**< this fence is kept signaled when idle, wait and reset are called before each recording. */
+
+    VkPipeline                         pipe_OVER;              /**< default operator */
     VkPipeline                         pipe_SUB;
-    VkPipeline                         pipe_CLEAR; //clear operator
+    VkPipeline                         pipe_CLEAR;             /**< clear operator */
 
-    VkPipeline                         pipelinePolyFill;   //
-    VkPipeline                         pipelineClipping;   //to update clip
+    VkPipeline                         pipelinePolyFill;       /**< even-odd polygon filling first step */
+    VkPipeline                         pipelineClipping;       /**< draw on stencil to update clipping regions */
 
-#if DEBUG
+#ifdef VKVG_WIRED_DEBUG
     VkPipeline                         pipelineWired;
     VkPipeline                         pipelineLineList;
 #endif
 
-    VkPipelineCache                    pipelineCache;
-    VkPipelineLayout           pipelineLayout;
-    VkDescriptorPool           descriptorPool;
-    VkDescriptorSetLayout      dslFont;
-    VkDescriptorSetLayout      dslSrc;
-    VkDescriptorSetLayout      dslGrad;
+    VkPipelineCache                    pipelineCache;          /**< speed up startup by caching configured pipelines on disk */
+    VkPipelineLayout           pipelineLayout;         /**< layout common to all pipelines */
+    VkDescriptorSetLayout      dslFont;                /**< font cache descriptors layout */
+    VkDescriptorSetLayout      dslSrc;                 /**< context source surface descriptors layout */
+    VkDescriptorSetLayout      dslGrad;                /**< context gradient descriptors layout */
 
-    int                hdpi,
+    int                hdpi,                                   /**< only used for FreeType fonts */
             vdpi;
-    VkInstance              instance;
 
-    VkhImage                emptyImg;//prevent unbound descriptor to trigger Validation error 61
-    VkSampleCountFlags      samples;//samples count for all surfaces
-    vkvg_status_t           status;
+    VkhImage                emptyImg;               /**< prevent unbound descriptor to trigger Validation error 61 */
+    VkSampleCountFlags      samples;                /**< samples count common to all surfaces */
+    bool                    deferredResolve;        /**< if true, resolve only on context destruction and set as source */
+    vkvg_status_t           status;                 /**< Current status of device, affected by last operation */
 
-    _font_cache_t*     fontCache;
-    VkvgContext     lastCtx;    //double linked list last elmt
+    _font_cache_t*     fontCache;                      /**< Store everything relative to common font caching system */
+    VkvgContext     lastCtx;                        /**< last element of double linked list of context, used to trigger font caching system update on all contexts*/
 }vkvg_device;
 
 void _init_function_pointers    (VkvgDevice dev);
@@ -100,6 +99,7 @@ void _create_empty_texture      (VkvgDevice dev);
 void _check_image_format_properties (VkvgDevice dev);
 void _create_pipeline_cache     (VkvgDevice dev);
 void _setupRenderPass           (VkvgDevice dev);
+void _setupRenderPassDeferredResolve (VkvgDevice dev);
 void _setupPipelines            (VkvgDevice dev);
 void _createDescriptorSetLayout (VkvgDevice dev);
 void _flush_all_contexes        (VkvgDevice dev);
index 3215fa08f991c2dfcd360be920234118de6856b2..79bf4933670f1a14f8616fd010f5fe4ce9593c8e 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "vkh.h"
 
-int defaultFontCharSize = 12<<6;
+static int defaultFontCharSize = 12<<6;
 
 void _init_fonts_cache (VkvgDevice dev){
     _font_cache_t* cache = (_font_cache_t*)calloc(1, sizeof(_font_cache_t));
@@ -59,6 +59,7 @@ void _init_fonts_cache (VkvgDevice dev){
 
     dev->fontCache = cache;
 }
+///increase layer count of 2d texture array used as font cache.
 void _increase_font_tex_array (VkvgDevice dev){
     _font_cache_t* cache = dev->fontCache;
 
@@ -118,6 +119,7 @@ void _increase_font_tex_array (VkvgDevice dev){
 
     _init_all_contexes  (dev);
 }
+///Start a new line in font cache, increase texture layer count if needed.
 void _init_next_line_in_tex_cache (VkvgDevice dev, _vkvg_font_t* f){
     _font_cache_t* cache = dev->fontCache;
     int i;
@@ -169,6 +171,8 @@ void _destroy_font_cache (VkvgDevice dev){
 
 }
 
+#ifdef DEBUG
+//helper function
 void _dump_glyphs (FT_Face face){
     FT_GlyphSlot    slot;
     char gname[256];
@@ -185,7 +189,8 @@ void _dump_glyphs (FT_Face face){
                face->size->metrics.max_advance/64);
     }
 }
-
+#endif
+//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)
@@ -225,7 +230,7 @@ void _flush_chars_to_tex (VkvgDevice dev, _vkvg_font_t* f) {
     cache->stagingX = 0;
     memset(cache->hostBuff, 0, FONT_PAGE_SIZE * FONT_PAGE_SIZE);
 }
-
+//create a new char entry and put glyph in stagging buffer, ready for upload.
 _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){
     FT_CHECK_RESULT(FT_Load_Glyph(f->face, gindex, FT_LOAD_RENDER));
 
@@ -253,18 +258,19 @@ _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){
         bmp.rows};
     cr->bounds = uvBounds;
     cr->pageIdx = f->curLine.pageIdx;
-    cr->bmpDiff.x = slot->bitmap_left;
-    cr->bmpDiff.y = slot->bitmap_top;
+    cr->bmpDiff.x = (int16_t)slot->bitmap_left;
+    cr->bmpDiff.y = (int16_t)slot->bitmap_top;
 
     f->charLookup[gindex] = cr;
     dev->fontCache->stagingX += bmp.width;
     return cr;
 }
-
+//set current font size for context
 void _set_font_size (VkvgContext ctx, uint32_t size){
     ctx->selectedFont.charSize = size << 6;
     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;
 
@@ -289,7 +295,7 @@ void _select_font_face (VkvgContext ctx, const char* name){
 
     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;
     for (int i = 0; i < cache->fontsCount; ++i) {
@@ -298,7 +304,7 @@ _vkvg_font_t* _tryFindVkvgFont (VkvgContext ctx){
     }
     return NULL;
 }
-
+//try to find corresponding font in cache (defined by context selectedFont) and create a new font entry if not found.
 void _update_current_font (VkvgContext ctx) {
     VkvgDevice dev = ctx->pSurf->dev;
     if (ctx->currentFont == NULL){
@@ -336,7 +342,7 @@ void _update_current_font (VkvgContext ctx) {
         }
     }
 }
-
+//Get harfBuzz buffer for provided text.
 hb_buffer_t * _get_hb_buffer (VkvgContext ctx, const char* text) {
     hb_buffer_t *buf = hb_buffer_create();
 
@@ -353,6 +359,7 @@ hb_buffer_t * _get_hb_buffer (VkvgContext ctx, const char* text) {
     hb_shape (ctx->currentFont->hb_font, buf, NULL, 0);
     return buf;
 }
+//retrieve global font extends of context's current font as defined by FreeType
 void _font_extents (VkvgContext ctx, vkvg_font_extents_t *extents) {
     _update_current_font (ctx);
 
@@ -365,7 +372,7 @@ void _font_extents (VkvgContext ctx, vkvg_font_extents_t *extents) {
     extents->max_x_advance = bbox->xMax >> 6;
     extents->max_y_advance = bbox->yMax >> 6;
 }
-
+//compute text extends for provided string.
 void _text_extents (VkvgContext ctx, const char* text, vkvg_text_extents_t *extents) {
     _update_current_font (ctx);
 
@@ -470,7 +477,7 @@ void _show_text (VkvgContext ctx, const char* text){
     //_show_texture(ctx); return;
 }
 
-#if DEBUG
+#ifdef DEBUG
 void _show_texture (vkvg_context* ctx){
     Vertex vs[] = {
         {{0,0},                             {0,0,1}},
index ac5ad8cd34a23023229a33b136d2502aed5e23cf..0c4be3b420294a17a57300abe6b1c8306c1605f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+ * Copyright (c) 2018-2019 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
 #include "vkvg.h"
 #include "vkvg_buff.h"
 #include "vkh.h"
-//#include "vkh_image.h"
 
-
-///texture coords of one char
+//texture coordinates of one character in font cache array texture.
 typedef struct {
-    vec4    bounds;
-    vec2i16    bmpDiff;
-    uint8_t pageIdx;
+    vec4    bounds;                 /* normalized float bounds of character bitmap in font cache texture. */
+    vec2i16    bmpDiff;                /* Difference in pixel between char bitmap top left corner and char glyph*/
+    uint8_t pageIdx;                /* Page index in font cache texture array */
 }_char_ref;
-//chars texture atlas reference
+// Current location in font cache texture array for new character addition. Each font holds such structure to locate
+// where to upload new chars.
 typedef struct {
-    uint8_t     pageIdx;
-    int         penX;
-    int         penY;
-    int         height;
+    uint8_t     pageIdx;            /* Current page number in font cache */
+    int         penX;               /* Current X in cache for next char addition */
+    int         penY;               /* Current Y in cache for next char addition */
+    int         height;             /* Height of current line pointed by this structure */
 }_tex_ref_t;
-
+// Loaded font structure, holds informations for glyphes upload in cache and the lookup table of characters.
 typedef struct {
-    char*       fontFile;
-    FT_F26Dot6  charSize;
-    hb_font_t*  hb_font;
-    FT_Face     face;
-    _char_ref** charLookup;
+    char*       fontFile;           /* Font file full path*/
+    FT_F26Dot6  charSize;           /* Font size*/
+    hb_font_t*  hb_font;            /* HarfBuzz font instance*/
+    FT_Face     face;               /* FreeType face*/
+    _char_ref** charLookup;         /* Lookup table of characteres in cache, if not found, upload is queued*/
 
-    _tex_ref_t  curLine;    //tex coord where to add new char bmp's
+    _tex_ref_t  curLine;            /* tex coord where to add new char bmp's */
 }_vkvg_font_t;
-
+// Font cache global structure, entry point for all font related operations.
 typedef struct {
-    FT_Library         library;
-    FcConfig*       config;
+    FT_Library         library;        /* FreeType library*/
+    FcConfig*       config;         /* Font config, used to find font files by font names*/
 
-    int             stagingX;   //x pen in host buffer
-    uint8_t*           hostBuff;       //host mem where bitmaps are first loaded
+    int             stagingX;       /* x pen in host buffer */
+    uint8_t*           hostBuff;       /* host memory where bitmaps are first loaded */
 
-    VkCommandBuffer cmd;        //upload cmd buff
-    vkvg_buff       buff;       //stagin buffer
-    VkhImage           cacheTex;       //tex 2d array
-    uint8_t         cacheTexLength;  //tex array length
-    int*            pensY;      //y pen pos in each texture of array
-    VkFence                    uploadFence;
+    VkCommandBuffer cmd;            /* vulkan command buffer for font textures upload */
+    vkvg_buff       buff;           /* stagin buffer */
+    VkhImage           cacheTex;       /* 2d array texture used by contexts to draw characteres */
+    uint8_t         cacheTexLength; /* layer count of 2d array texture, starts with FONT_CACHE_INIT_LAYERS count and increased when needed */
+    int*            pensY;          /* array of current y pen positions for each texture in cache 2d array */
+    VkFence                    uploadFence;    /* Signaled when upload is finished */
 
-    _vkvg_font_t*      fonts;
-    uint8_t                    fontsCount;
+    _vkvg_font_t*      fonts;          /* Loaded fonts structure array */
+    uint8_t                    fontsCount;     /* Loaded fonts array count*/
 }_font_cache_t;
-
+// Precompute everything necessary to draw one line of text, usefull to draw the same text multiple times.
 typedef struct _vkvg_text_run_t {
-    hb_buffer_t*        hbBuf;
-    _vkvg_font_t*       font;
-    VkvgDevice          dev;
-    vkvg_text_extents_t extents;
-    const char*         text;
-    unsigned int         glyph_count;
-    hb_glyph_position_t *glyph_pos;
+    hb_buffer_t*        hbBuf;      /* HarfBuzz buffer of text */
+    _vkvg_font_t*       font;       /* vkvg font structure pointer */
+    VkvgDevice          dev;        /* vkvg device associated with this text run */
+    vkvg_text_extents_t extents;    /* store computed text extends */
+    const char*         text;       /* utf8 char array of text*/
+    unsigned int         glyph_count;/* Total glyph count */
+    hb_glyph_position_t *glyph_pos; /* HarfBuzz computed glyph positions array */
 } vkvg_text_run_t;
-
+//Create font cache.
 void _init_fonts_cache      (VkvgDevice dev);
+//Release all ressources of font cache.
 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);
+//Set current font size for context
 void _set_font_size         (VkvgContext ctx, uint32_t size);
+//Draw text
 void _show_text                                (VkvgContext ctx, const char* text);
+//Get text dimmensions
 void _text_extents          (VkvgContext ctx, const char* text, vkvg_text_extents_t *extents);
+//Get font global dimmensions
 void _font_extents          (VkvgContext ctx, vkvg_font_extents_t* extents);
-
+//Create text object that could be drawn multiple times minimizing harfbuzz and compute processing.
 void _create_text_run       (VkvgContext ctx, const char* text, VkvgText textRun);
+//Release ressources held by a text run.
 void _destroy_text_run      (VkvgText textRun);
+//Draw text run
 void _show_text_run         (VkvgContext ctx, VkvgText tr);
+//Trigger stagging buffer to be uploaded in font cache. Groupping upload improve performances.
 void _flush_chars_to_tex    (VkvgDevice dev, _vkvg_font_t* f);
 #endif
index e1bced2df81c0830a6e495fa622c11fa29dbba4b..980116785a7434f45695f0026440015b9fe0d7c4 100644 (file)
 #include <string.h>
 #include <stdint.h>
 #include <stdbool.h>
+#include <float.h>
+#include <math.h>
+
+# define M_PIF         3.14159265358979323846f /* float pi */
+
+#define ROUNDF(f, c) (((float)((int)((f) * (c))) / (c)))
+#define ROUND_DOWN(v,p) (floorf(v * p) / p)
+#define EQUF(a, b) (fabsf(a-b)<=FLT_EPSILON)
+
 #include "vectors.h"
 #include "cross_mutex.h"
 
index d904f36a2a73d4a294d85733c61b6e5ee9babe65..0dd14aa77455257896abf8b0a3e9526820b2942f 100644 (file)
 #include "stb_image_write.h"
 #include "vkh_image.h"
 
+void _explicit_ms_resolve (VkvgSurface surf){
+    VkvgDevice      dev = surf->dev;
+    VkCommandBuffer cmd = dev->cmd;
+
+    _wait_and_reset_device_fence (dev);
+
+    vkh_cmd_begin (cmd, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
+    vkh_image_set_layout (cmd, surf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
+                          VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+                          VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
+    vkh_image_set_layout (cmd, surf->img, VK_IMAGE_ASPECT_COLOR_BIT,
+                          VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+                          VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
+
+    VkImageResolve re = {
+        .extent = {surf->width, surf->height,1},
+        .srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},
+        .dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT,0,0,1}
+    };
+
+    vkCmdResolveImage(cmd,
+                      vkh_image_get_vkimage (surf->imgMS), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+                      vkh_image_get_vkimage (surf->img) ,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+                      1,&re);
+    vkh_image_set_layout (cmd, surf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
+                          VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ,
+                          VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
+    vkh_cmd_end (cmd);
+
+    _submit_cmd (dev, &cmd, dev->fence);
+}
+
 void _clear_surface (VkvgSurface surf, VkImageAspectFlags aspect)
 {
     VkvgDevice      dev = surf->dev;
@@ -99,6 +131,10 @@ void _create_framebuffer (VkvgSurface surf) {
                                                       .width = surf->width,
                                                       .height = surf->height,
                                                       .layers = 1 };
+    if (surf->dev->deferredResolve) {
+        attachments[1] = attachments[2];
+        frameBufferCreateInfo.attachmentCount = 2;
+    }
     VK_CHECK_RESULT(vkCreateFramebuffer(surf->dev->vkDev, &frameBufferCreateInfo, NULL, &surf->fb));
 }
 void _init_surface (VkvgSurface surf) {
@@ -292,8 +328,13 @@ uint32_t vkvg_surface_get_reference_count (VkvgSurface surf) {
 
 VkImage vkvg_surface_get_vk_image(VkvgSurface surf)
 {
+    if (surf->dev->deferredResolve)
+        _explicit_ms_resolve(surf);
     return vkh_image_get_vkimage (surf->img);
 }
+void vkvg_multisample_surface_resolve (VkvgSurface surf){
+    _explicit_ms_resolve(surf);
+}
 VkFormat vkvg_surface_get_vk_format(VkvgSurface surf)
 {
     return surf->format;
index 32fac3c709b63a19659c66f903f6133c89a79ac8..82aa6947708ecc3e60e08074d0fc3988c1a9c98c 100644 (file)
 VkvgDevice device;
 VkvgSurface surf = NULL;
 
+static float panX = 0.f;
+static float panY = 0.f;
+static float lastX = 0.f;
+static float lastY = 0.f;
+static float zoom = 1.0f;
+static bool mouseDown = false;
+
 static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
     if (action != GLFW_PRESS)
         return;
@@ -100,8 +107,28 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
     }
 }
 static void char_callback (GLFWwindow* window, uint32_t c){}
-static void mouse_move_callback(GLFWwindow* window, double x, double y){}
-static void mouse_button_callback(GLFWwindow* window, int but, int state, int modif){}
+static void mouse_move_callback(GLFWwindow* window, double x, double y){
+    if (mouseDown) {
+        panX += ((float)x-lastX);
+        panY += ((float)y-lastY);
+    }
+    lastX = (float)x;
+    lastY = (float)y;
+}
+static void scroll_callback(GLFWwindow* window, double x, double y){
+    if (y<0.f)
+        zoom *= 0.5f;
+    else
+        zoom *= 2.0f;
+}
+static void mouse_button_callback(GLFWwindow* window, int but, int state, int modif){
+    if (but != GLFW_MOUSE_BUTTON_1)
+        return;
+    if (state == GLFW_TRUE)
+        mouseDown = true;
+    else
+        mouseDown = false;
+}
 
 double time_diff(struct timeval x , struct timeval y)
 {
@@ -642,11 +669,11 @@ void cairo_test_fill_rule (VkvgContext cr){
     vkvg_rectangle (cr, 12, 12, 232, 70);
     //vkvg_stroke (cr);
 //    vkvg_new_sub_path (cr);
-    vkvg_arc (cr, 64, 64, 40, 0, M_PI*2);
+    vkvg_arc (cr, 64, 64, 40, 0, (float)M_PI*2.f);
     //vkvg_close_path(cr);
 
     vkvg_new_sub_path (cr);
-    vkvg_arc_negative (cr, 192, 64, 40, 2*M_PI, 0);
+    vkvg_arc_negative (cr, 192, 64, 40, (float)M_PI*2.f, 0);
     //vkvg_close_path(cr);
 
     //vkvg_rectangle (cr, 30, 30, 20, 200);
@@ -678,6 +705,7 @@ void cairo_test_text (VkvgContext cr) {
     /* draw helping lines */
     vkvg_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
     vkvg_set_line_width (cr, 6.0);
+    vkvg_new_path(cr);
     vkvg_arc (cr, x, y, 10.0, 0, 2*M_PI);
     vkvg_fill (cr);
     vkvg_move_to (cr, x,y);
@@ -811,13 +839,13 @@ void cairo_print_arc_neg (VkvgContext cr){
     float angle2 = 180.0 * (M_PI/180.0);  /* in radians           */
 
     vkvg_set_source_rgba(cr, 0, 0, 0, 1);
-    vkvg_set_line_width (cr, 10.0);
+    vkvg_set_line_width (cr, 5.0);
     vkvg_arc_negative (cr, xc, yc, radius, angle1, angle2);
     vkvg_stroke (cr);
 
     /* draw helping lines */
     vkvg_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
-    vkvg_set_line_width (cr, 6.0);
+    vkvg_set_line_width (cr, 10.0);
 
     vkvg_arc (cr, xc, yc, 10.0, 0, 2*M_PI);
     vkvg_fill (cr);
@@ -896,13 +924,16 @@ void cairo_print_arc (VkvgContext cr) {
     vkvg_stroke (cr);
 }
 static float rotation = 0.f;
+
 void cairo_tests () {
     rotation+=0.01f;
 
     vkvg_matrix_t mat;
     vkvg_matrix_init_translate (&mat, 512,400);
     vkvg_matrix_rotate(&mat,rotation);
-    vkvg_matrix_translate(&mat,-512,-400);
+    vkvg_matrix_scale(&mat,zoom,zoom);
+    vkvg_matrix_translate(&mat,-512.f + panX,-400.f +panY);
+
 
     VkvgContext ctx = vkvg_create(surf);
     vkvg_set_source_rgba(ctx,0.7,0.7,0.7,1);
@@ -970,10 +1001,19 @@ void svg_set_color (VkvgContext ctx, uint32_t c, float alpha) {
 }
 
 void test_svg () {
+    rotation+=0.01f;
+
+    vkvg_matrix_t mat;
+    vkvg_matrix_init_translate (&mat, 512,400);
+    vkvg_matrix_rotate(&mat,rotation);
+    vkvg_matrix_translate(&mat,-512,-400);
+
     VkvgContext ctx = vkvg_create(surf);
     vkvg_set_source_rgba(ctx,1.0,1.0,1.0,1);
     vkvg_paint(ctx);
 
+    vkvg_set_matrix(ctx,&mat);
+
     NSVGimage* svg;
     NSVGshape* shape;
     NSVGpath* path;
@@ -1149,11 +1189,11 @@ void simple_rectangle_fill () {
 void simple_rectangle_stroke () {
     VkvgContext ctx = vkvg_create(surf);
     vkvg_clear(ctx);
-    vkvg_line_to(ctx,100,100);
+    vkvg_set_line_width(ctx,100.f);
+    vkvg_arc (ctx, 300, 300, 200, 0, M_PI*2.0);
     vkvg_set_source_rgba(ctx,0,0,1,1);
-    vkvg_set_line_width(ctx,50.f);
-    vkvg_set_line_join(ctx,VKVG_LINE_JOIN_ROUND);
-    vkvg_rectangle(ctx,100,100,200,200);
+    vkvg_fill_preserve(ctx);
+    vkvg_set_source_rgba(ctx,1,0,1,1);
     vkvg_stroke(ctx);
     vkvg_destroy(ctx);
 }
@@ -1172,16 +1212,21 @@ int main(int argc, char *argv[]) {
     //dumpLayerExts();
     uint width=1024, height=768;
 
-    vk_engine_t* e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_FIFO_KHR, width, height);
+    vk_engine_t* 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);
+    vkengine_set_mouse_but_callback(e, mouse_button_callback);
+    vkengine_set_cursor_pos_callback(e, mouse_move_callback);
+    vkengine_set_scroll_callback(e, scroll_callback);
 
-    device  = vkvg_device_create (vkh_app_get_inst(e->app), r->dev->phy, r->dev->dev, r->qFam, 0);
+    bool deferredResolve = false;
+
+    device  = vkvg_device_create_multisample(vkh_app_get_inst(e->app), r->dev->phy, r->dev->dev, r->qFam, 0, VK_SAMPLE_COUNT_4_BIT, deferredResolve);
     surf    = vkvg_surface_create(device, width, height);
 
-    //test_svg();
     //test_grad_transforms();
     //test_colinear();
+    //simple_rectangle_stroke();
 
     vkh_presenter_build_blit_cmd (r, vkvg_surface_get_vk_image(surf), width, height);
 
@@ -1193,19 +1238,22 @@ int main(int argc, char *argv[]) {
 
         gettimeofday(&before , NULL);
 
+        //test_svg();
         cairo_tests();
         //random_rectangles();
         //simple_rectangle_stroke();
         //test_1();
         //vkvg_surface_clear(surf);
         //simple_paint();
-        //simple_rectangle_stroke();
+
         //simple_rectangle_fill();
         //test_img_surface();
         //multi_test1();
         //test_painting();
         //vkvg_surface_clear(surf);
         //lines_stroke();
+        if (deferredResolve)
+            vkvg_multisample_surface_resolve(surf);
         if (!vkh_presenter_draw (r))
             vkh_presenter_build_blit_cmd (r, vkvg_surface_get_vk_image(surf), width, height);
 
index d0052452ff3d29e3b0fde4bbf0abb5ae95348537..6d0f0ef7a00014afebf4c1cf884216761db8a957 100644 (file)
@@ -86,7 +86,7 @@ vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, VkPresentModeKHR
     uint32_t enabledExtsCount = 0, phyCount = 0;
     const char ** enabledExts = glfwGetRequiredInstanceExtensions (&enabledExtsCount);
 
-    e->app = vkh_app_create("vkvgTest", (int)enabledExtsCount, enabledExts);
+    e->app = vkh_app_create("vkvgTest", enabledExtsCount, enabledExts);
 
     glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
     glfwWindowHint(GLFW_RESIZABLE,  GLFW_TRUE);
@@ -150,23 +150,15 @@ vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, VkPresentModeKHR
     }
 
     char const * dex [] = {"VK_KHR_swapchain"};
-#if VKVG_USE_VALIDATION
-    uint32_t dlayCpt = 1;
-    static char const * dlay [] = {"VK_LAYER_LUNARG_standard_validation"};
-#else
-    uint32_t dlayCpt = 0;
-    static char const * dlay [] = {NULL};
-#endif
+
     VkPhysicalDeviceFeatures enabledFeatures = {
         .fillModeNonSolid = true,
-        .sampleRateShading = true
+        //.sampleRateShading = true
     };
 
     VkDeviceCreateInfo device_info = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
                                        .queueCreateInfoCount = qCount,
                                        .pQueueCreateInfos = (VkDeviceQueueCreateInfo*)&pQueueInfos,
-                                       .enabledLayerCount = dlayCpt,
-                                       .ppEnabledLayerNames = dlay,
                                        .enabledExtensionCount = 1,
                                        .ppEnabledExtensionNames = dex,
                                        .pEnabledFeatures = &enabledFeatures
@@ -175,6 +167,7 @@ vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, VkPresentModeKHR
     VkDevice dev;
     VK_CHECK_RESULT(vkCreateDevice (pi->phy, &device_info, NULL, &dev));
     e->dev = vkh_device_create(pi->phy, dev);
+    e->dev->instance = vkh_app_get_inst (e->app);
 
     e->renderer = vkh_presenter_create
             (e->dev, (uint32_t) pi->pQueue, surf, width, height, VK_FORMAT_B8G8R8A8_UNORM, presentMode);
@@ -194,7 +187,7 @@ void vkengine_destroy (VkEngine e) {
     vkh_presenter_destroy (e->renderer);
     vkDestroySurfaceKHR (e->app->inst, surf, NULL);
 
-    vkDestroyDevice (e->dev->dev, NULL);
+    vkh_device_destroy (e->dev);
 
     glfwDestroyWindow (e->window);
     glfwTerminate ();
diff --git a/vkh b/vkh
index 012ca283a29bca6dd6b828406fe490ff356484f1..041a39cf003ece2604c167cb115c3210bde5c9b0 160000 (submodule)
--- a/vkh
+++ b/vkh
@@ -1 +1 @@
-Subproject commit 012ca283a29bca6dd6b828406fe490ff356484f1
+Subproject commit 041a39cf003ece2604c167cb115c3210bde5c9b0