]> O.S.I.I.S - jp/vkvg.git/commitdiff
save commit
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 28 Feb 2025 11:15:32 +0000 (12:15 +0100)
committerj-p <jp_bruyere@hotmail.com>
Mon, 24 Mar 2025 18:12:00 +0000 (19:12 +0100)
CMakeLists.txt
clang_overrides.txt [new file with mode: 0644]
cmake.clang-format [new file with mode: 0644]
default.profraw [new file with mode: 0644]
src/vkvg_context.c
src/vkvg_device.c
tests/common/vkengine.c
vkh

index 1723646812390be365037c7c5256ecc5839122da..9049b54bc73b94ce34b186302bf8469edaa828d6 100644 (file)
@@ -30,43 +30,46 @@ ENDIF()
 
 
 IF (UNIX)
-       ADD_COMPILE_OPTIONS(-lm)
-       IF (BUILD_SHARED_LIBS)
-               #force PIC for all subproject, even static libs
-               ADD_COMPILE_OPTIONS(-fPIC)
-       ENDIF()
+    ADD_COMPILE_OPTIONS(-lm)
+    IF (BUILD_SHARED_LIBS)
+        #force PIC for all subproject, even static libs
+        ADD_COMPILE_OPTIONS(-fPIC)
+    ENDIF()
 ENDIF()
 
 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
-       ADD_DEFINITIONS (-DDEBUG)
-       OPTION(ENABLE_VALIDATION "enable vulkan validation layer" ON)
-       OPTION(VKVG_USE_MESA_OVERLAY "enable VK_LAYER_MESA_overlay if present." OFF)
-       IF (VKVG_USE_MESA_OVERLAY)
-               ADD_DEFINITIONS (-DVKVG_USE_MESA_OVERLAY)
-       ENDIF ()
-       OPTION(ENABLE_DBG_UTILS "enable VK_EXT_debug_utils extension" ON)
-       OPTION(VKVG_WIRED_FILL "enable wired polygon draw to check vertices and primitives" OFF)
-       IF (UNIX)
-               ADD_COMPILE_OPTIONS(-Wall -Wno-extra -Wno-unknown-pragmas -Wno-missing-braces -Wno-unused-variable -Wno-switch -Wno-unused-value)
-                IF (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-                    ADD_COMPILE_OPTIONS(-g3) # include macro info in debug
-                ENDIF()
-       ELSEIF(MSVC)
-               ADD_COMPILE_OPTIONS(/TC /W4 /wd4201 /wd4204 /wd4221 /wd4100) # c11 compliant
-       ENDIF()
+    ADD_DEFINITIONS (-DDEBUG)
+    OPTION(ENABLE_VALIDATION "enable vulkan validation layer" ON)
+    OPTION(VKVG_USE_MESA_OVERLAY "enable VK_LAYER_MESA_overlay if present." OFF)
+    IF (VKVG_USE_MESA_OVERLAY)
+      ADD_DEFINITIONS (-DVKVG_USE_MESA_OVERLAY)
+    ENDIF ()
+    OPTION(ENABLE_DBG_UTILS "enable VK_EXT_debug_utils extension" ON)
+    OPTION(VKVG_WIRED_FILL "enable wired polygon draw to check vertices and primitives" OFF)
+    IF (UNIX)
+      ADD_COMPILE_OPTIONS(-Wall -Wno-extra -Wno-unknown-pragmas -Wno-missing-braces -Wno-unused-variable -Wno-switch -Wno-unused-value)
+      IF (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+        ADD_COMPILE_OPTIONS(-g3) # include macro info in debug
+      ENDIF()
+    ELSEIF(MSVC)
+      ADD_COMPILE_OPTIONS(/TC /W4 /wd4201 /wd4204 /wd4221 /wd4100) # c11 compliant
+    ENDIF()
 ELSE()
-       UNSET(ENABLE_VALIDATION CACHE)
-       UNSET(ENABLE_DBG_UTILS CACHE)
-       UNSET(VKVG_WIRED_FILL CACHE)
-       UNSET(VKVG_USE_MESA_OVERLAY CACHE)
-       IF (ANDROID)
-               ADD_COMPILE_OPTIONS(-O3 -w -pedantic)
-       ELSEIF (UNIX)           
-            #ADD_COMPILE_OPTIONS(-O3 -w -pedantic -fvisibility=hidden -fno-rtti)
-            #ADD_COMPILE_OPTIONS(-flto -pthread -lpthread -Wl,--no-as-needed)
-       ELSEIF(MSVC)
-               ADD_COMPILE_OPTIONS(/O2 /TC /W0 /Od)
-       ENDIF()
+    UNSET(ENABLE_VALIDATION CACHE)
+    UNSET(ENABLE_DBG_UTILS CACHE)
+    UNSET(VKVG_WIRED_FILL CACHE)
+    UNSET(VKVG_USE_MESA_OVERLAY CACHE)
+    IF (ANDROID)
+      ADD_COMPILE_OPTIONS(-O3 -w -pedantic)
+    ELSEIF (UNIX)
+      #ADD_COMPILE_OPTIONS(-O3 -w -pedantic -fvisibility=hidden -fno-rtti)
+      #ADD_COMPILE_OPTIONS(-flto -pthread -lpthread -Wl,--no-as-needed)
+      #ADD_COMPILE_OPTIONS(-fno-rtti)
+      #ADD_COMPILE_OPTIONS(-w -flto)
+      #ADD_COMPILE_OPTIONS(-fvisibility=hidden)
+    ELSEIF(MSVC)
+      ADD_COMPILE_OPTIONS(/O2 /TC /W0 /Od)
+    ENDIF()
 ENDIF()
 
 OPTION(ENABLE_PROFILING "compile with the -pg options..." OFF)
@@ -89,8 +92,8 @@ OPTION(VKVG_RECORDING "enable experimental recording functions" OFF)
 
 OPTION(VKVG_PREMULT_ALPHA "use premultiplied alpha for internal rendering" ON)
 IF (VKVG_PREMULT_ALPHA)
-       ADD_DEFINITIONS (-DVKVG_PREMULT_ALPHA)
-       SET(GLSLDEFS ${GLSLDEFS} -DVKVG_PREMULT_ALPHA)
+    ADD_DEFINITIONS (-DVKVG_PREMULT_ALPHA)
+    SET(GLSLDEFS ${GLSLDEFS} -DVKVG_PREMULT_ALPHA)
 ENDIF ()
 
 OPTION(VKVG_DBG_STATS "record contexts statistics in the device" OFF)
@@ -108,18 +111,18 @@ ENDIF()
 
 #use c++ vulkan memory allocator library (https://gpuopen.com/vulkan-memory-allocator/)
 IF (VKH_USE_VMA)
-       ADD_DEFINITIONS (-DVKH_USE_VMA)
+    ADD_DEFINITIONS (-DVKH_USE_VMA)
 ENDIF()
 
 IF (ENABLE_VALIDATION)
-       ADD_DEFINITIONS (-DVKVG_USE_VALIDATION)
-       OPTION(ENABLE_RENDERDOC "enable renderdoc" OFF)
-       IF (ENABLE_RENDERDOC)
-               ADD_DEFINITIONS (-DVKVG_USE_RENDERDOC)
-       ENDIF ()
+    ADD_DEFINITIONS (-DVKVG_USE_VALIDATION)
+    OPTION(ENABLE_RENDERDOC "enable renderdoc" OFF)
+    IF (ENABLE_RENDERDOC)
+        ADD_DEFINITIONS (-DVKVG_USE_RENDERDOC)
+    ENDIF ()
 ENDIF ()
 IF (VKVG_WIRED_FILL)
-       ADD_DEFINITIONS (-DVKVG_WIRED_DEBUG)
+    ADD_DEFINITIONS (-DVKVG_WIRED_DEBUG)
 ENDIF ()
 
 FIND_PACKAGE(Vulkan REQUIRED)
@@ -147,60 +150,60 @@ CMAKE_DEPENDENT_OPTION(VKVG_LCD_FONT_FILTER "enable freetype lcd font filtering"
 # todo if cmake vers >= 3.23: make dependent option on Vulkan_VERSION >= 1_2:
 OPTION(VKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT "Enable scalar block layout support." ON)
 IF (VKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
-       ADD_DEFINITIONS (-DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
-       SET(GLSLDEFS ${GLSLDEFS} -DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
+    ADD_DEFINITIONS (-DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
+    SET(GLSLDEFS ${GLSLDEFS} -DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
 ENDIF ()
 
 OPTION(VKVG_ENABLE_VK_TIMELINE_SEMAPHORE "Enable vulkan TimelineSemaphore support." OFF)
 IF (VKVG_ENABLE_VK_TIMELINE_SEMAPHORE)
-       ADD_DEFINITIONS (-DVKVG_ENABLE_VK_TIMELINE_SEMAPHORE)
+    ADD_DEFINITIONS (-DVKVG_ENABLE_VK_TIMELINE_SEMAPHORE)
 ENDIF ()
 
 
 IF (ENABLE_DBG_UTILS)
-       ADD_DEFINITIONS (-DVKVG_DBG_UTILS)
+    ADD_DEFINITIONS (-DVKVG_DBG_UTILS)
 ENDIF ()
 IF (VKVG_USE_FREETYPE)
-       ADD_DEFINITIONS (-DVKVG_USE_FREETYPE)
+    ADD_DEFINITIONS (-DVKVG_USE_FREETYPE)
 ENDIF ()
 IF (VKVG_USE_FONTCONFIG)
-       ADD_DEFINITIONS (-DVKVG_USE_FONTCONFIG)
+    ADD_DEFINITIONS (-DVKVG_USE_FONTCONFIG)
 ENDIF ()
 IF (VKVG_USE_HARFBUZZ)
-       ADD_DEFINITIONS (-DVKVG_USE_HARFBUZZ)
+    ADD_DEFINITIONS (-DVKVG_USE_HARFBUZZ)
 ENDIF ()
 IF (VKVG_LCD_FONT_FILTER)
-       ADD_DEFINITIONS (-DVKVG_LCD_FONT_FILTER)
+    ADD_DEFINITIONS (-DVKVG_LCD_FONT_FILTER)
 ENDIF ()
 
 # Find glslc shader compiler.
 # On Android, the NDK includes the binary, so no external dependency.
 IF(ANDROID)
-       FILE(GLOB glslc-folders ${ANDROID_NDK}/shader-tools/*)
+  FILE(GLOB glslc-folders ${ANDROID_NDK}/shader-tools/*)
 ELSE()
-       FILE(GLOB glslc-folders ${VULKAN_SDK}/bin)
+  FILE(GLOB glslc-folders ${VULKAN_SDK}/bin)
 ENDIF()
 FIND_PROGRAM(GLSLC glslc HINTS ${glslc-folders})
 FIND_PROGRAM(XXD xxd)
 
 IF(GLSLC AND XXD)
-       SET(SHADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/src/shaders.h")
-       SET(SHADER_DIR "shaders")
-       SET(SHADER_FILES ${SHADER_DIR}/*.frag ${SHADER_DIR}/*.vert ${SHADER_DIR}/*.geom  ${SHADER_DIR}/*.comp)
-       FILE(GLOB_RECURSE SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SHADER_FILES})
-       FOREACH(SHADER ${SHADERS})
-               SET(shader-input ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER})
-               SET(shader-output ${CMAKE_CURRENT_BINARY_DIR}/${SHADER}.spv)
-               ADD_CUSTOM_COMMAND (
-                 OUTPUT ${shader-output}
-                 COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${SHADER_DIR}"
-                 COMMAND ${GLSLC} ${GLSLDEFS} ${shader-input} -o ${shader-output}# --target-env=vulkan1.2
-                 COMMENT "Compiling ${shader-input}"
-                 DEPENDS ${SHADER}
-                 VERBATIM
-               )
-               SET(SHADER_OUTPUTS ${SHADER_OUTPUTS} ${shader-output})
-       ENDFOREACH()
+    SET(SHADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/src/shaders.h")
+    SET(SHADER_DIR "shaders")
+    SET(SHADER_FILES ${SHADER_DIR}/*.frag ${SHADER_DIR}/*.vert ${SHADER_DIR}/*.geom  ${SHADER_DIR}/*.comp)
+    FILE(GLOB_RECURSE SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SHADER_FILES})
+    FOREACH(SHADER ${SHADERS})
+        SET(shader-input ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER})
+        SET(shader-output ${CMAKE_CURRENT_BINARY_DIR}/${SHADER}.spv)
+        ADD_CUSTOM_COMMAND (
+          OUTPUT ${shader-output}
+          COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${SHADER_DIR}"
+          COMMAND ${GLSLC} ${GLSLDEFS} ${shader-input} -o ${shader-output}# --target-env=vulkan1.2
+          COMMENT "Compiling ${shader-input}"
+          DEPENDS ${SHADER}
+          VERBATIM
+        )
+        SET(SHADER_OUTPUTS ${SHADER_OUTPUTS} ${shader-output})
+    ENDFOREACH()
 
        ADD_CUSTOM_TARGET(BuildShaders ALL DEPENDS ${SHADER_OUTPUTS})
 
diff --git a/clang_overrides.txt b/clang_overrides.txt
new file mode 100644 (file)
index 0000000..aaadf6c
--- /dev/null
@@ -0,0 +1,12 @@
+# CMAKE_USER_MAKE_RULES_OVERRIDE should point to this file
+SET (CMAKE_C_FLAGS_INIT                "-Wall -std=c11 -fdiagnostics-color=always -fdiagnostics-show-hotness -Rpass-analysis=loop-vectorize -fsave-optimization-record -Weverything")
+SET (CMAKE_C_FLAGS_DEBUG_INIT          "-g -fprofile-instr-generate -fcoverage-mapping")
+SET (CMAKE_C_FLAGS_MINSIZEREL_INIT     "-Os -DNDEBUG")
+SET (CMAKE_C_FLAGS_RELEASE_INIT        "-O3 -DNDEBUG")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+SET (CMAKE_CXX_FLAGS_INIT                "-Wall -std=c++17")
+SET (CMAKE_CXX_FLAGS_DEBUG_INIT          "-g -fprofile-instr-generate -fcoverage-mapping")
+SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT     "-Os -DNDEBUG")
+SET (CMAKE_CXX_FLAGS_RELEASE_INIT        "-O3 -DNDEBUG")
+SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
diff --git a/cmake.clang-format b/cmake.clang-format
new file mode 100644 (file)
index 0000000..f343a7f
--- /dev/null
@@ -0,0 +1,192 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignArrayOfStructures: None
+AlignConsecutiveMacros: None
+AlignConsecutiveAssignments: None
+AlignConsecutiveBitFields: None
+AlignConsecutiveDeclarations: None
+AlignEscapedNewlines: Right
+AlignOperands:   Align
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortEnumsOnASingleLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortLambdasOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: MultiLine
+AttributeMacros:
+  - __capability
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterCaseLabel:  false
+  AfterClass:      false
+  AfterControlStatement: Never
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: false
+  AfterStruct:     false
+  AfterUnion:      false
+  AfterExternBlock: false
+  BeforeCatch:     false
+  BeforeElse:      false
+  BeforeLambdaBody: false
+  BeforeWhile:     false
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeConceptDeclarations: true
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit:    120 
+CommentPragmas:  '^ IWYU pragma:'
+QualifierAlignment: Leave
+CompactNamespaces: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DeriveLineEnding: true
+DerivePointerAlignment: false
+DisableFormat:   false
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: LogicalBlock
+ExperimentalAutoDetectBinPacking: false
+PackConstructorInitializers: BinPack
+BasedOnStyle:    ''
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+AllowAllConstructorInitializersOnNextLine: true
+FixNamespaceComments: true
+ForEachMacros:
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+IfMacros:
+  - KJ_IF_MAYBE
+IncludeBlocks:   Preserve
+IncludeCategories:
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        2
+    SortPriority:    0
+    CaseSensitive:   false
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+    Priority:        3
+    SortPriority:    0
+    CaseSensitive:   false
+  - Regex:           '.*'
+    Priority:        1
+    SortPriority:    0
+    CaseSensitive:   false
+IncludeIsMainRegex: '(Test)?$'
+IncludeIsMainSourceRegex: ''
+IndentAccessModifiers: false
+IndentCaseLabels: false
+IndentCaseBlocks: false
+IndentGotoLabels: true
+IndentPPDirectives: None
+IndentExternBlock: AfterExternBlock
+IndentRequires:  false
+IndentWidth:     2
+IndentWrappedFunctionNames: false
+InsertTrailingCommas: None
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+LambdaBodyIndentation: Signature
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 2
+ObjCBreakBeforeNestedBlockParam: true
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakOpenParenthesis: 0
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+PointerAlignment: Right
+PPIndentWidth:   -1
+ReferenceAlignment: Pointer
+ReflowComments:  true
+RemoveBracesLLVM: false
+SeparateDefinitionBlocks: Leave
+ShortNamespaceLines: 1
+SortIncludes:    CaseSensitive
+SortJavaStaticImport: Before
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeParensOptions:
+  AfterControlStatements: true
+  AfterForeachMacros: true
+  AfterFunctionDefinitionName: false
+  AfterFunctionDeclarationName: false
+  AfterIfMacros:   true
+  AfterOverloadedOperator: false
+  BeforeNonEmptyParentheses: false
+SpaceAroundPointerQualifiers: Default
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  Never
+SpacesInConditionalStatement: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInLineCommentPrefix:
+  Minimum:         1
+  Maximum:         -1
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+BitFieldColonSpacing: Both
+Standard:        Latest
+StatementAttributeLikeMacros:
+  - Q_EMIT
+StatementMacros:
+  - Q_UNUSED
+  - QT_REQUIRE_VERSION
+TabWidth:        8
+UseCRLF:         false
+UseTab:          Never
+WhitespaceSensitiveMacros:
+  - STRINGIZE
+  - PP_STRINGIZE
+  - BOOST_PP_STRINGIZE
+  - NS_SWIFT_NAME
+  - CF_SWIFT_NAME
+...
+
diff --git a/default.profraw b/default.profraw
new file mode 100644 (file)
index 0000000..298838f
Binary files /dev/null and b/default.profraw differ
index a548103fe91be57ac4c0e8efa52421a08ed87869..6e8f6b00780e4bf0dd51547a18d13be28f54effc 100644 (file)
@@ -22,8 +22,8 @@ static VkClearValue clearValues[3] = {
     {.color.float32 = {0, 0, 0, 0}}, {.depthStencil = {1.0f, 0}}, {.color.float32 = {0, 0, 0, 0}}};
 
 void _init_ctx(VkvgContext ctx) {
-    ctx->lineWidth                       = 1;
-    ctx->miterLimit                      = 10;
+    ctx->lineWidth                       = 1.f;
+    ctx->miterLimit                      = 10.f;
     ctx->curOperator                     = VKVG_OPERATOR_OVER;
     ctx->curFillRule                     = VKVG_FILL_RULE_NON_ZERO;
     ctx->bounds                          = (VkRect2D){{0, 0}, {ctx->pSurf->width, ctx->pSurf->height}};
@@ -41,11 +41,12 @@ void _init_ctx(VkvgContext ctx) {
 
     LOCK_SURFACE(ctx->pSurf)
 
-    if (ctx->pSurf->newSurf)
+    if (ctx->pSurf->newSurf) {
         ctx->renderPassBeginInfo.renderPass = ctx->dev->renderPass_ClearAll;
-    else
+        ctx->pSurf->newSurf = false;
+    } else {
         ctx->renderPassBeginInfo.renderPass = ctx->dev->renderPass_ClearStencil;
-    ctx->pSurf->newSurf = false;
+    }
 
     UNLOCK_SURFACE(ctx->pSurf);
 
@@ -60,6 +61,8 @@ void _init_ctx(VkvgContext ctx) {
     ctx->curColor            = 0xff000000; // opaque black
     ctx->cmdStarted          = false;
     ctx->curClipState        = vkvg_clip_state_none;
+
+
     ctx->vertCount = ctx->indCount = 0;
 #ifdef VKVG_ENABLE_VK_TIMELINE_SEMAPHORE
     ctx->timelineStep = 0;
index d45a28e38b60b80e630935c0bac2ced6ea468abe..b5c881ef673059264dd9cc1899e1a1682397c794 100644 (file)
         if (vkh_phyinfo_try_get_extension_properties(pi, #ext, NULL))                                                  \
             enabledExts[enabledExtsCount++] = #ext;                                                                    \
     }
+
+#define _CHECK_INST_EXT(ext)                                                                                           \
+if (vkh_instance_extension_supported(#ext)) {                                                                      \
+        if (pExtensions)                                                                                               \
+        pExtensions[*pExtCount] = #ext;                                                                            \
+        (*pExtCount)++;                                                                                                \
+}
+
+#define _CHECK_DEV_EXT(ext)                                                                                            \
+{                                                                                                                  \
+        if (_get_dev_extension_is_supported(pExtensionProperties, extensionCount, #ext)) {                             \
+            if (pExtensions)                                                                                           \
+            pExtensions[*pExtCount] = #ext;                                                                        \
+            (*pExtCount)++;                                                                                            \
+    }                                                                                                              \
+}
+
 void vkvg_device_set_context_cache_size(VkvgDevice dev, uint32_t maxCount) {
     if (maxCount == dev->cachedContextMaxCount)
         return;
@@ -152,12 +169,7 @@ void _device_init(VkvgDevice dev, const vkvg_device_create_info_t *info) {
     dev->status = VKVG_STATUS_SUCCESS;
 }
 
-#define _CHECK_INST_EXT(ext)                                                                                           \
-    if (vkh_instance_extension_supported(#ext)) {                                                                      \
-        if (pExtensions)                                                                                               \
-            pExtensions[*pExtCount] = #ext;                                                                            \
-        (*pExtCount)++;                                                                                                \
-    }
+
 void vkvg_get_required_instance_extensions(const char **pExtensions, uint32_t *pExtCount) {
     *pExtCount = 0;
 
@@ -179,14 +191,7 @@ bool _get_dev_extension_is_supported(VkExtensionProperties *pExtensionProperties
     }
     return false;
 }
-#define _CHECK_DEV_EXT(ext)                                                                                            \
-    {                                                                                                                  \
-        if (_get_dev_extension_is_supported(pExtensionProperties, extensionCount, #ext)) {                             \
-            if (pExtensions)                                                                                           \
-                pExtensions[*pExtCount] = #ext;                                                                        \
-            (*pExtCount)++;                                                                                            \
-        }                                                                                                              \
-    }
+
 
 vkvg_status_t vkvg_get_required_device_extensions(VkPhysicalDevice phy, const char **pExtensions, uint32_t *pExtCount) {
     VkExtensionProperties *pExtensionProperties;
index 57307ff87b597ae1108cd82abe5ae35be1a910d3..4fcc8212317199f974275c92751dc135699411c0 100644 (file)
@@ -178,13 +178,13 @@ vk_engine_t *vkengine_create(VkPhysicalDeviceType preferedGPU, VkPresentModeKHR
 #if defined(DEBUG) && defined(VKVG_DBG_UTILS)
     vkh_app_enable_debug_messenger(e->app,
                                    VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT
-                                   //| VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
-                                   //| VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT
+                                   | VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
+                                   | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT
                                    ,
                                    VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT |
                                        VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
-                                   //| VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
-                                   //| VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT
+                                   | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
+                                   | VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT
                                    ,
                                    NULL);
 #endif
diff --git a/vkh b/vkh
index d17d759e06d5a96aeb3d5e06474b6ec7ecbb0b93..06fa5e993cb62fb40f5f093919db116dc0fa8dc9 160000 (submodule)
--- a/vkh
+++ b/vkh
@@ -1 +1 @@
-Subproject commit d17d759e06d5a96aeb3d5e06474b6ec7ecbb0b93
+Subproject commit 06fa5e993cb62fb40f5f093919db116dc0fa8dc9