From 1625a228b61fefc82d9537dcdc1ba53df892f6f9 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 2 Aug 2023 09:16:42 +0000 Subject: [PATCH 01/48] Write nullptr to end of argv array after shifting it Argv is specified both by the length of argc and a trailing nullptr. The motivation for this fix is unpleasant behavior in Qt, which under Windows presents the user's main() function with an argv built up using new and delete. However, this is a useful invariant in general. --- include/vsg/utils/CommandLine.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/vsg/utils/CommandLine.h b/include/vsg/utils/CommandLine.h index 150ae3cd6..fd6fdbe44 100644 --- a/include/vsg/utils/CommandLine.h +++ b/include/vsg/utils/CommandLine.h @@ -102,16 +102,19 @@ namespace vsg { // removed section is at end of argv so just reset argc to i *_argc = i; - return; } - - // shift all the remaining entries down to fill the removed space - for (; source < *_argc; ++i, ++source) + else { - _argv[i] = _argv[source]; - } + // shift all the remaining entries down to fill the removed space + for (; source < *_argc; ++i, ++source) + { + _argv[i] = _argv[source]; + } - *_argc -= num; + *_argc -= num; + } + // Preserve C invariant that argv ends with a null pointer + _argv[*_argc] = nullptr; } template From 032604e544d8fa9736d24e3db4dc2b9afc6bc915 Mon Sep 17 00:00:00 2001 From: siystar Date: Fri, 4 Aug 2023 17:23:18 +0200 Subject: [PATCH 02/48] [FIXED] typos --- CMakeLists.txt | 2 +- INSTALL.md | 34 +++++++++---------- README.md | 18 +++++----- ROADMAP.md | 8 ++--- cmake/vsgMacros.cmake | 2 +- docs/CONTRIBUTING.md | 6 ++-- include/vsg/app/Camera.h | 6 ++-- include/vsg/app/CommandGraph.h | 2 +- include/vsg/app/CompileManager.h | 2 +- include/vsg/app/CompileTraversal.h | 6 ++-- include/vsg/app/EllipsoidModel.h | 2 +- include/vsg/app/ProjectionMatrix.h | 12 +++---- include/vsg/app/RecordAndSubmitTask.h | 6 ++-- include/vsg/app/RecordTraversal.h | 8 ++--- include/vsg/app/RenderGraph.h | 20 +++++------ include/vsg/app/SecondaryCommandGraph.h | 2 +- include/vsg/app/Trackball.h | 4 +-- include/vsg/app/TransferTask.h | 6 ++-- include/vsg/app/View.h | 2 +- include/vsg/app/ViewMatrix.h | 8 ++--- include/vsg/app/Viewer.h | 14 ++++---- include/vsg/app/Window.h | 10 +++--- include/vsg/app/WindowAdapter.h | 6 ++-- include/vsg/app/WindowResizeHandler.h | 4 +-- include/vsg/commands/BindIndexBuffer.h | 2 +- include/vsg/commands/BindVertexBuffers.h | 2 +- include/vsg/commands/ClearAttachments.h | 2 +- include/vsg/commands/Command.h | 2 +- include/vsg/commands/Commands.h | 4 +-- include/vsg/commands/CopyAndReleaseBuffer.h | 4 +-- include/vsg/commands/CopyAndReleaseImage.h | 4 +-- include/vsg/commands/Dispatch.h | 2 +- include/vsg/commands/Event.h | 2 +- include/vsg/commands/ExecuteCommands.h | 6 ++-- include/vsg/commands/SetDepthBias.h | 2 +- include/vsg/commands/SetLineWidth.h | 2 +- include/vsg/commands/SetScissor.h | 2 +- include/vsg/commands/SetViewport.h | 2 +- include/vsg/core/Allocator.h | 8 ++--- include/vsg/core/Array.h | 4 +-- include/vsg/core/Array2D.h | 4 +-- include/vsg/core/Array3D.h | 4 +-- include/vsg/core/ConstVisitor.h | 4 +-- include/vsg/core/Data.h | 12 +++---- include/vsg/core/Exception.h | 2 +- include/vsg/core/External.h | 8 ++--- include/vsg/core/MemorySlots.h | 4 +-- include/vsg/core/Visitor.h | 4 +-- include/vsg/core/observer_ptr.h | 4 +-- include/vsg/core/ref_ptr.h | 8 ++--- include/vsg/io/AsciiInput.h | 2 +- include/vsg/io/BinaryOutput.h | 4 +-- include/vsg/io/DatabasePager.h | 2 +- include/vsg/io/FileSystem.h | 10 +++--- include/vsg/io/Input.h | 4 +-- include/vsg/io/Logger.h | 12 +++---- include/vsg/io/ObjectFactory.h | 4 +-- include/vsg/io/Options.h | 6 ++-- include/vsg/io/Output.h | 2 +- include/vsg/io/Path.h | 12 +++---- include/vsg/io/ReaderWriter.h | 4 +-- include/vsg/io/mem_stream.h | 2 +- include/vsg/io/stream.h | 4 +-- include/vsg/io/tile.h | 2 +- include/vsg/maths/box.h | 2 +- include/vsg/maths/plane.h | 4 +-- include/vsg/maths/quat.h | 6 ++-- include/vsg/maths/sphere.h | 2 +- include/vsg/maths/transform.h | 12 +++---- include/vsg/maths/vec2.h | 6 ++-- include/vsg/maths/vec3.h | 4 +-- include/vsg/maths/vec4.h | 4 +-- include/vsg/nodes/AbsoluteTransform.h | 4 +-- include/vsg/nodes/Bin.h | 2 +- include/vsg/nodes/Compilable.h | 2 +- include/vsg/nodes/CullNode.h | 2 +- include/vsg/nodes/DepthSorted.h | 6 ++-- include/vsg/nodes/Geometry.h | 2 +- include/vsg/nodes/LOD.h | 8 ++--- include/vsg/nodes/Light.h | 8 ++--- include/vsg/nodes/MatrixTransform.h | 2 +- include/vsg/nodes/PagedLOD.h | 8 ++--- include/vsg/nodes/QuadGroup.h | 6 ++-- include/vsg/nodes/StateGroup.h | 4 +-- include/vsg/nodes/TileDatabase.h | 2 +- include/vsg/nodes/Transform.h | 4 +-- include/vsg/nodes/VertexDraw.h | 2 +- include/vsg/nodes/VertexIndexDraw.h | 2 +- include/vsg/platform/android/Android_Window.h | 2 +- .../BuildAccelerationStructureTraversal.h | 2 +- .../DescriptorAccelerationStructure.h | 2 +- include/vsg/state/ArrayState.h | 16 ++++----- include/vsg/state/BindDescriptorSet.h | 2 +- include/vsg/state/Buffer.h | 2 +- include/vsg/state/BufferInfo.h | 4 +-- include/vsg/state/ColorBlendState.h | 2 +- include/vsg/state/DepthStencilState.h | 2 +- include/vsg/state/Descriptor.h | 2 +- include/vsg/state/DescriptorBuffer.h | 4 +-- include/vsg/state/DescriptorImage.h | 4 +-- include/vsg/state/DescriptorTexelBufferView.h | 2 +- include/vsg/state/DynamicState.h | 2 +- include/vsg/state/Image.h | 4 +-- include/vsg/state/ImageInfo.h | 6 ++-- include/vsg/state/ImageView.h | 4 +-- include/vsg/state/InputAssemblyState.h | 2 +- include/vsg/state/MultisampleState.h | 2 +- include/vsg/state/RasterizationState.h | 2 +- include/vsg/state/ShaderStage.h | 2 +- include/vsg/state/StateCommand.h | 2 +- include/vsg/state/StateSwitch.h | 4 +-- include/vsg/state/TessellationState.h | 2 +- include/vsg/state/VertexInputState.h | 2 +- include/vsg/state/ViewDependentState.h | 12 +++---- include/vsg/state/ViewportState.h | 2 +- include/vsg/state/material.h | 2 +- include/vsg/text/Text.h | 10 +++--- include/vsg/text/TextGroup.h | 12 +++---- include/vsg/text/TextLayout.h | 2 +- include/vsg/threading/Barrier.h | 4 +-- include/vsg/threading/FrameBlock.h | 2 +- include/vsg/threading/Latch.h | 2 +- include/vsg/threading/OperationQueue.h | 4 +-- include/vsg/threading/OperationThreads.h | 2 +- include/vsg/threading/atomics.h | 2 +- include/vsg/ui/ApplicationEvent.h | 2 +- include/vsg/ui/Keyboard.h | 4 +-- include/vsg/ui/PointerEvent.h | 6 ++-- include/vsg/ui/PrintEvents.h | 2 +- include/vsg/ui/RecordEvents.h | 2 +- include/vsg/ui/ShiftEventTime.h | 2 +- include/vsg/ui/TouchEvent.h | 2 +- include/vsg/ui/WindowEvent.h | 2 +- include/vsg/utils/AnimationPath.h | 2 +- include/vsg/utils/Builder.h | 8 ++--- include/vsg/utils/CommandLine.h | 2 +- .../vsg/utils/GraphicsPipelineConfigurator.h | 6 ++-- include/vsg/utils/Intersector.h | 2 +- include/vsg/utils/LineSegmentIntersector.h | 6 ++-- include/vsg/utils/LoadPagedLOD.h | 2 +- include/vsg/utils/ShaderCompiler.h | 4 +-- include/vsg/utils/ShaderSet.h | 16 ++++----- include/vsg/utils/SharedObjects.h | 20 +++++------ include/vsg/vk/Context.h | 4 +-- include/vsg/vk/DescriptorPool.h | 10 +++--- include/vsg/vk/Device.h | 2 +- include/vsg/vk/DeviceFeatures.h | 4 +-- include/vsg/vk/Framebuffer.h | 2 +- include/vsg/vk/Instance.h | 4 +-- include/vsg/vk/MemoryBufferPools.h | 2 +- include/vsg/vk/PhysicalDevice.h | 2 +- include/vsg/vk/RenderPass.h | 6 ++-- include/vsg/vk/ResourceRequirements.h | 2 +- include/vsg/vk/Semaphore.h | 2 +- include/vsg/vk/State.h | 4 +-- include/vsg/vk/SubmitCommands.h | 2 +- include/vsg/vk/Surface.h | 2 +- include/vsg/vk/vk_buffer.h | 2 +- src/vsg/CMakeLists.txt | 2 +- src/vsg/app/CommandGraph.cpp | 2 +- src/vsg/app/CompileTraversal.cpp | 2 +- src/vsg/app/RecordAndSubmitTask.cpp | 4 +-- src/vsg/app/RecordTraversal.cpp | 2 +- src/vsg/app/RenderGraph.cpp | 2 +- src/vsg/app/SecondaryCommandGraph.cpp | 2 +- src/vsg/app/TransferTask.cpp | 2 +- src/vsg/app/View.cpp | 2 +- src/vsg/app/Viewer.cpp | 20 +++++------ src/vsg/app/Window.cpp | 8 ++--- src/vsg/app/WindowTraits.cpp | 2 +- src/vsg/commands/CopyImageViewToWindow.cpp | 4 +-- src/vsg/core/Allocator.cpp | 2 +- src/vsg/core/ConstVisitor.cpp | 2 +- src/vsg/core/Object.cpp | 6 ++-- src/vsg/core/Version.h.in | 2 +- src/vsg/io/DatabasePager.cpp | 6 ++-- src/vsg/io/FileSystem.cpp | 6 ++-- src/vsg/io/convert_utf.cpp | 2 +- src/vsg/io/tile.cpp | 8 ++--- src/vsg/io/write.cpp | 2 +- src/vsg/maths/maths_transform.cpp | 12 +++---- src/vsg/nodes/PagedLOD.cpp | 2 +- src/vsg/platform/android/Android_Window.cpp | 6 ++-- src/vsg/platform/ios/iOS_Window.mm | 2 +- src/vsg/platform/macos/MacOS_Window.mm | 14 ++++---- src/vsg/platform/win32/Win32_Window.cpp | 2 +- src/vsg/platform/xcb/Xcb_Window.cpp | 8 ++--- src/vsg/raytracing/RayTracingPipeline.cpp | 2 +- src/vsg/state/ArrayState.cpp | 2 -- src/vsg/state/Buffer.cpp | 2 +- src/vsg/state/BufferInfo.cpp | 4 +-- src/vsg/state/ComputePipeline.cpp | 2 +- src/vsg/state/DescriptorBuffer.cpp | 2 +- src/vsg/state/DescriptorSet.cpp | 2 +- src/vsg/state/GraphicsPipeline.cpp | 2 +- src/vsg/state/Image.cpp | 4 +-- src/vsg/state/ImageInfo.cpp | 8 ++--- src/vsg/state/ImageView.cpp | 12 +++---- src/vsg/state/Sampler.cpp | 2 +- src/vsg/state/ShaderModule.cpp | 2 +- src/vsg/text/CpuLayoutTechnique.cpp | 2 +- src/vsg/text/GpuLayoutTechnique.cpp | 2 +- src/vsg/ui/Keyboard.cpp | 2 +- src/vsg/ui/PlayEvents.cpp | 2 +- src/vsg/ui/PrintEvents.cpp | 2 +- src/vsg/utils/Builder.cpp | 16 ++++----- .../utils/GraphicsPipelineConfigurator.cpp | 2 +- src/vsg/utils/LineSegmentIntersector.cpp | 16 ++++----- src/vsg/utils/LoadPagedLOD.cpp | 2 +- src/vsg/utils/ShaderSet.cpp | 2 +- src/vsg/utils/SharedObjects.cpp | 2 +- src/vsg/vk/Device.cpp | 6 ++-- src/vsg/vk/DeviceMemory.cpp | 2 +- src/vsg/vk/Swapchain.cpp | 6 ++-- 214 files changed, 494 insertions(+), 496 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cf99ccba..876ea8770 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ vsg_add_target_docs( ${VSG_SOURCE_DIR}/include/vsg ) -# automatically buil_all_h build target to generate the include/vsg/all.h from the headers in the include/vsg/* directories +# build_all_h build target to automatically generate the include/vsg/all.h from the headers in the include/vsg/* directories add_custom_target(build_all_h COMMAND ${CMAKE_COMMAND} -DVSG_SOURCE_DIR=${VSG_SOURCE_DIR} -P ${VSG_SOURCE_DIR}/cmake/build_all_h.cmake ) diff --git a/INSTALL.md b/INSTALL.md index c1bba7673..8958bc103 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -19,7 +19,7 @@ ## Prerequisites * C++17 compliant compiler i.e. g++ 7.3 or later, Clang 6.0 or later, Visual Studio S2017 or later. -* [Vulkan](https://vulkan.lunarg.com/) 1.1 or later. You can use Vulkan (libs and headers) installed from repositories or using VulkanSDK. +* [Vulkan](https://vulkan.lunarg.com/) 1.1 or later. You can use Vulkan (libs and headers) installed from repositories or VulkanSDK. * [CMake](https://www.cmake.org) 3.7 or later. --- @@ -148,7 +148,7 @@ Most of these are standard options which you can look up in CMake and make docum ## Using the VSG within your own projects -The project is currently a prototype that is undergoing continuous development so it isn't recommend to use as base for long term software development. At this point it's available for developers who want to test the bleeding edge and provide feedback on it's fitness for purpose. Following instructions assume your project uses CMake, which at this early stage in the project is the recommended route when using the VSG. +The project is currently a prototype that is undergoing continuous development so it isn't recommended to use as a base for long term software development. At this point it's available for developers who want to test the bleeding edge and provide feedback on its fitness for purpose. The following instructions assume your project uses CMake, which at this early stage in the project is the recommended route when using the VSG. To assist with setting up software to work with the VSG when you install the library a CMake package configuration file will be installed in the lib/cmake/vsg directory. Within your CMake CMakeLists.txt script to find the VSG related dependencies you'll need to add: @@ -174,9 +174,9 @@ For example, a bare minimum CMakeLists.txt file to compile a single file applica ### Using VSG provided cmake macros within your own projects -The build system provides macros that create specific cmake targets to use in their project. Examples include: Setup of common cmake variables, Formatting source code, performing static code analysis, creating API documentation, cleaning up source directories, and removing installed files. Documentation of the available macros (the public ones starting with ```vsg_```) are at https://github.com/vsg-dev/VulkanSceneGraph/blob/master/cmake/vsgMacros.cmake. +The build system provides macros that create specific cmake targets to use in your project. Examples include: Setup of common cmake variables, formatting source code, performing static code analysis, creating API documentation, cleaning up source directories, and removing installed files. Documentation of the available macros (the public ones starting with ```vsg_```) are at https://github.com/vsg-dev/VulkanSceneGraph/blob/master/cmake/vsgMacros.cmake. -For example, a bare minimum CMakeLists.txt file adding the mentioned cmake target would be: +For example, a bare minimum CMakeLists.txt file adding the mentioned cmake targets would be: cmake_minimum_required(VERSION 3.7) find_package(vsg REQUIRED) @@ -227,7 +227,7 @@ Hints for the structure of the template file can be found at https://cmake.org/c ## Detailed instructions for setting up your environment and building for Microsoft Windows -While not the only route to installing Vulkan libs an headers on Windows the most common approach is to use the Vulkan SDK. LunarG provides a convenient installer for the Vulkan SDK and runtime on Windows. +While not the only route to installing Vulkan libs and headers on Windows the most common approach is to use the Vulkan SDK. LunarG provides a convenient installer for the Vulkan SDK and runtime on Windows. [Vulkan Downloads](https://vulkan.lunarg.com/sdk/home#windows) @@ -247,7 +247,7 @@ So now we have the Vulkan SDK installed and findable by CMake so we can go ahead After running CMake open the generated VSG.sln file and build the All target. Once built you can run the install target. If you are using the default CMake install path (in Program Files folder), ensure you have started Visual Studio as administrator otherwise the install will fail. -It's recommended at this point that you add the VSG install path to you CMAKE_PREFIX_PATH, this will allow other CMake projects, like the vsgExamples project to find your VSG installation. CMAKE_PREFIX_PATH can be set as an environment variable on you system. +It's recommended at this point that you add the VSG install path to your CMAKE_PREFIX_PATH, this will allow other CMake projects, like the vsgExamples project to find your VSG installation. CMAKE_PREFIX_PATH can be set as an environment variable on your system. CMAKE_PREFIX_PATH = C:\Program Files\VSG @@ -255,7 +255,7 @@ It's recommended at this point that you add the VSG install path to you CMAKE_PR ## Detailed instructions for setting up your environment and building for Android -This guide is to build VSG for Android, these steps have been completed on macOS but should be almost identical on Linux and similar on Windows. Inorder to build VSG for Android you'll need the following installed on your machine. +This guide describes building the VSG for Android. These steps have been completed on macOS but should be almost identical on Linux and similar on Windows. In order to build VSG for Android you'll need the following installed on your machine. Android NDK 18 CMake 3.13 @@ -264,9 +264,9 @@ The easiest way to get the Android NDK installed is via Android Studio. Follow t [Android Studio](https://developer.android.com/studio/) -If you got to the 'SDK Manager' ensure you have at least Android API level 24 installed, then go to the 'SDK Tools' tab and check the 'NDK' option. Once done click apply and Android Studio should download and install these components for you. +Go to the 'SDK Manager' and ensure you have at least Android API level 24 installed, then go to the 'SDK Tools' tab and check the 'NDK' option. Once done click apply and Android Studio should download and install these components for you. -If you already have Android Studio and or the NDK installed. Still go to the 'SDK Manager' and see if you need to update your NDK to version 18. +If you already have Android Studio and or the NDK installed, still go to the 'SDK Manager' and see if you need to update your NDK to version 18. Take note of the 'Android SDK Location' as you'll need it when running CMake to generate our Android make files. @@ -299,9 +299,9 @@ macOS does not natively support Vulkan. However the excellent MoltenVK library h [Vulkan Downloads](https://vulkan.lunarg.com/sdk/home#mac) -Download the sdk and unpack it. There's no form of installer but you're able to place the root sdk folder anywhere on your machine. The sdk contains detailed instuctions on how to setup MoltenVK to work on your machine as well has how to redistribute your application contained in the /Documentation/getting_started_macos.md file. +Download the sdk and unpack it. There's no form of installer but you're able to place the root sdk folder anywhere on your machine. The sdk contains detailed instuctions on how to setup MoltenVK to work on your machine as well as how to redistribute your application contained in the /Documentation/getting_started_macos.md file. -As with other platforms we need the VULKAN_SDK variable which should point to your downloaded sdk folder. Specifically the macOS subfolder of the sdk. This is needed so CMake can find the sdk. Unique to macOS we also need to set environment variables pointing a few files within the sdk. Again the getting started document in the sdk has detailed information relating to these. A quick cheat sheet is provided here, if you use a .bash_profile file in your user folder you can add the following. +As with other platforms we need the VULKAN_SDK variable which should point to your downloaded sdk folder. Specifically the macOS subfolder of the sdk. This is needed so CMake can find the sdk. Unique to macOS we also need to set environment variables pointing to a few files within the sdk. Again the getting started document in the sdk has detailed information relating to these. A quick cheat sheet is provided here, if you use a .bash_profile file in your user folder you can add the following. export VULKAN_SDK="/path/to/your/vulkansdk/macOS" export VK_LAYER_PATH="$VULKAN_SDK/etc/vulkan/explicit_layer.d" @@ -309,9 +309,9 @@ As with other platforms we need the VULKAN_SDK variable which should point to yo export PATH="$VULKAN_SDK:$VULKAN_SDK/bin:$PATH" export DYLD_LIBRARY_PATH="$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH" -At this point MoltenVK application should be able to run on your machine, as a quick test it's worth running vulkaninfo executable contained within vulkansdk/macOS/bin. If this runs and doesn't produce any errors it's a good indication the sdk is setup correctly. +At this point MoltenVK applications should be able to run on your machine, as a quick test it's worth running vulkaninfo executable contained within vulkansdk/macOS/bin. If this runs and doesn't produce any errors it's a good indication the sdk is setup correctly. -So now we're ready to build VSG. With the SDK installed this is very similar to other platforms. You can simple run the following commands to clone the source and use CMake to generate and Xcode project. +So now we're ready to build VSG. With the SDK installed this is very similar to other platforms. You can simply run the following commands to clone the source and use CMake to generate an Xcode project. git clone https://github.com/vsg-dev/VulkanSceneGraph.git cd VulkanSceneGraph @@ -319,12 +319,12 @@ So now we're ready to build VSG. With the SDK installed this is very similar to Once CMake has finished you can open the generated Xcode project and build the 'install' target. This will build VSG and install the headers and generated library onto your machine. -Again, as with other platforms it's useful to now set your CMAKE_PREFIX_PATH to point to the VSG library we have just installed. If you've installed to the default location you can add the following to you .bash_profile file. +Again, as with other platforms it's useful to now set your CMAKE_PREFIX_PATH to point to the VSG library we have just installed. If you've installed to the default location you can add the following to your .bash_profile file. export CMAKE_PREFIX_PATH="/usr/local/lib/cmake/vsg" - -That's it, we've installed the MoltenVK sdk, built VSG and prepared are machine so other CMake projects can find and use the VSG library. + +That's it, we've installed the MoltenVK sdk, built VSG and prepared our machine so other CMake projects can find and use the VSG library. **Important Note!** -Xcode typically ignores the system environment variables, so when running a VSG application from within Xcode you may run into issues. One solution is to add the environment variables to to the run scheme. This can be done by going to 'Product>Scheme>Edit Scheme>Arguments. Then added the above mentioned environment variables. +Xcode typically ignores the system environment variables, so when running a VSG application from within Xcode you may run into issues. One solution is to add the environment variables to the run scheme. This can be done by going to 'Product>Scheme>Edit Scheme>Arguments. Then add the above mentioned environment variables. diff --git a/README.md b/README.md index 99086761e..7a245e34b 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ ![VulkanSceneGraph](https://raw.githubusercontent.com/vsg-dev/VulkanSceneGraph/master/docs/images/VSGlogo.png) -VulkanSceneGraph (VSG), is a modern, cross platform, high performance scene graph library built upon [Vulkan](https://www.khronos.org/vulkan/) graphics/compute API. The software is written in [C++17](https://en.wikipedia.org/wiki/C%2B%2B17), and follows the [CppCoreGuidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) and [FOSS Best Practices](https://github.com/coreinfrastructure/best-practices-badge/blob/master/doc/criteria.md). The source code is published under the [MIT License](LICENSE.md), with the exception a [vulkan.h](include/vsg/vk/vulkan.h) file, used for Vulkan extensions, which is under [Apache License 2.0](LICENSE.Vulkan-Headers.md). +VulkanSceneGraph (VSG), is a modern, cross platform, high performance scene graph library built upon [Vulkan](https://www.khronos.org/vulkan/) graphics/compute API. The software is written in [C++17](https://en.wikipedia.org/wiki/C%2B%2B17), and follows the [CppCoreGuidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) and [FOSS Best Practices](https://github.com/coreinfrastructure/best-practices-badge/blob/master/doc/criteria.md). The source code is published under the [MIT License](LICENSE.md), with the exception of [vulkan.h](include/vsg/vk/vulkan.h), used for Vulkan extensions, which is under [Apache License 2.0](LICENSE.Vulkan-Headers.md). This repository contains C++ headers and source and CMake build scripts to build the libvsg library. Additional support libraries and examples are provided in separate repositories, links to these are provided below. The software currently builds under Linux (desktops variants through to Jetson & Raspberry Pi), Windows (VisualStudio, MinGW & Cygwin), Android, and macOS & iOS (using [MoltenVk](https://github.com/KhronosGroup/MoltenVK)). ## Links to further information -The [vulkanscenegraph.org website](https://www.vulkanscenegraph.org) provides a detailed list of features, tutorials and reference documentation, while this repository provides the source code and build support for creating the VulkanScenGraph library. Quick links to resources hosted on the website: +The [vulkanscenegraph.org website](https://www.vulkanscenegraph.org) provides a detailed list of features, tutorials and reference documentation, while this repository provides the source code and build support for creating the VulkanSceneGraph library. Quick links to resources hosted on the website: * [Features](https://vsg-dev.github.io/vsg-dev.io/features) - tour of features you'll find in the VulkanSceneGraph and companion projects. -* [Screenshots](https://vsg-dev.github.io/vsg-dev.io/screenshots) - screenshots from VulkanSceneGraph exmples and 3rd party library and applications +* [Screenshots](https://vsg-dev.github.io/vsg-dev.io/screenshots) - screenshots from VulkanSceneGraph examples and 3rd party libraries and applications * [Tutorials](https://vsg-dev.github.io/vsg-dev.io/tutorials) - mulit-part tutorial that takes you from introduction to scene graphs to multi-threading and optimization. * [Documentation](https://vsg-dev.github.io/vsg-dev.io/documentation) - doxygen generated reference documentation and links to 3rd party learning materials * [Discussion](https://github.com/vsg-dev/VulkanSceneGraph/discussions) - Discussion forum hosted on github. -* [Services](https://vsg-dev.github.io/vsg-dev.io/services) - List of companinies connected to the VulkanSceneGraph project that can provide professional services +* [Services](https://vsg-dev.github.io/vsg-dev.io/services) - List of companies connected to the VulkanSceneGraph project that can provide professional services ## Links to companion projects that offer additional features Hosted as part of the [vsg-dev](https://github.com/vsg-dev): -* [vsgXchange](https://github.com/vsg-dev/vsgXchange) reading and writing of 3rd party image and 3d models and HTTP support. +* [vsgXchange](https://github.com/vsg-dev/vsgXchange) reading and writing of 3rd party images and 3d models and HTTP support. * [vsgExamples](https://github.com/vsg-dev/vsgExamples) tests & examples. * [osg2vsg](https://github.com/vsg-dev/osg2vsg) OpenSceneGraph integration library that enables converting of OSG to VSG scene graph and use of OpenSceneGraph loaders. * [vsgImGui](https://github.com/vsg-dev/vsgImGui) ImGui integration enabling UI in graphics window. * [vsgQt](https://github.com/vsg-dev/vsgQt) Qt integration with VulkanSceneGraph. -* [vsgPoints](https://github.com/vsg-dev/vsgPoints) 3d point cloud loading and rendering for VulkanSceneGraph with database paging support and scalability up to billions of ponts. +* [vsgPoints](https://github.com/vsg-dev/vsgPoints) 3d point cloud loading and rendering for VulkanSceneGraph with database paging support and scalability up to billions of points. * [vsgUnity](https://github.com/vsg-dev/vsgUnity) plugin for Unity that provides export to native VulkanSceneGraph binary/ascii format. * [MyFirstVsgApplication](https://github.com/vsg-dev/MyFirstVsgApplication) simple standalone VSG application that can be used as a template for your own applications. * [vsgFramework](https://github.com/vsg-dev/vsgFramework) template project that uses CMake FetchContent to pull in all the main libraries associated with VulkanSceneGraph and dependencies and builds them together. @@ -37,13 +37,13 @@ Community projects: ## Quick Guide to building the VSG ### Prerequisites: -* C++17 compliant compiler i.e.. g++ 7.3 or later, Clang 6.0 or later, Visual Studio S2017 or later. +* C++17 compliant compiler i.e. g++ 7.3 or later, Clang 6.0 or later, Visual Studio S2017 or later. * [Vulkan](https://vulkan.lunarg.com/) 1.1 or later. * [CMake](https://www.cmake.org) 3.7 or later. The above dependency versions are known to work so they've been set as the current minimum, it may be possible to build against older versions. If you find success with older versions let us know and we can update the version info. -Download VulkanSDK from [LunarG](https://vulkan.lunarg.com/sdk/home), unpack into local directory and set VUKAN_SDK environment variable to the include/lib directory within it. For Linux it would typically be along the lines of: +Download VulkanSDK from [LunarG](https://vulkan.lunarg.com/sdk/home), unpack into local directory and set VULKAN_SDK environment variable to the include/lib directory within it. For Linux it would typically be along the lines of: export VULKAN_SDK_VERSION=1.2.162.1 export VULKAN_SDK=${PWD}/VulkanSDK/${VULKAN_SDK_VERSION}/x86_64 @@ -64,4 +64,4 @@ To build and install the static libvsg library (.a/.lib) in source: make -j 8 sudo make install -Full details on how to build of the VSG (Unix/Windows/Android/macOS) can be found in the [INSTALL.md](INSTALL.md) file. +Full details on how to build the VSG (Unix/Windows/Android/macOS) can be found in the [INSTALL.md](INSTALL.md) file. diff --git a/ROADMAP.md b/ROADMAP.md index 6c5130fa5..8be8c7f86 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,9 +1,9 @@ ## Roadmap -Follows are are initially plans for future releases and then going back into time to previously completed milestones. +Follows are initial plans for future releases and then going back into time to previously completed milestones. ### Stable Release Support and Functionality build-out Phase, 2023 onwards (underway) -**Goal: Maintain the VulkanSceneGraph-1.0.x release series and work towards the next stable release VulkanSceneGraph-1.2 - expanding the VulkanScenGraph and companion projects feature sets to address a wider range of uses** +**Goal: Maintain the VulkanSceneGraph-1.0.x release series and work towards the next stable release VulkanSceneGraph-1.2 - expanding the VulkanSceneGraph and companion projects feature sets to address a wider range of uses** Discussion of new features:[New Feature Development RoadMap for future VulkanSceneGraph-1.2 release and beyond](https://github.com/vsg-dev/VulkanSceneGraph/discussions/600) @@ -19,7 +19,7 @@ Discussion of new features:[New Feature Development RoadMap for future VulkanSce #### Future development tasks: -* Support for shadows and environment maps in the Phong and PBR ShaderSets, and helpers functions/classes for creating scene graphs that render shadow maps. +* Support for shadows and environment maps in the Phong and PBR ShaderSets, and helper functions/classes for creating scene graphs that render shadow maps. * Character animation/skinning in standard.vert shaders used by Phong and ShaderSets? * Rewrite RayTracing classes to modernize them and bring them more inline with other core VSG classes. * Acceleration structures for CPU based geometry operations i.e. KdTree or similar to speed up intersection testing etc. @@ -50,7 +50,7 @@ Using the prototyping work as a guide implement the final scene graph library wi * Support for RTX Mesh shaders and ray tracing. * Scene graph level multi-bin support with bin sorting. * Support for Khronos ray tracing. -* Memory allocator with support with grouping associated types +* Memory allocator with support for grouping associated types * Positional state support to enable easier support of lighting, shadows, texture projection. * Matrix decomposition * Port to iOS diff --git a/cmake/vsgMacros.cmake b/cmake/vsgMacros.cmake index 0edca6b2e..698310fa6 100644 --- a/cmake/vsgMacros.cmake +++ b/cmake/vsgMacros.cmake @@ -426,7 +426,7 @@ macro(vsg_check_min_vulkan_header_version _min_version) file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ") string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}") list(LENGTH VulkanHeaderVersion2 _len) - # versions >= 1.2.175 adds an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2' + # versions >= 1.2.175 add an additional number in front e.g. '0, 1, 2' instead of '1, 2' if(_len EQUAL 3) list(REMOVE_AT VulkanHeaderVersion2 0) endif() diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index df3f2de07..70b7e5e5a 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,7 +1,7 @@ # How to contribute Developers can help contribute to the VSG through testing, reporting issues, bug fixing, feature development and creation of tutorials and documentation. -## Report an bug +## Report a bug Please use the Issue tracker on github. We provide two templates, a bug report template and a feature request template to help guide what type of information is useful to us. @@ -15,7 +15,7 @@ If you wish to make a feature request, this can be done via our github Issue tra ## Feature development -If you have refinement of existing features or added new feature please a make pull requests. +If you have refined existing features or added new features please a make pull request. ## In source documentation @@ -23,4 +23,4 @@ In source documentation can be provided in the form of markdown (.MD) files to b ## 3rd Party tutorials, documentation, libraries and program -If you have written documentation, tutorials, libraries or programs and wish to inform developers about then please considering adding details about them to the docs/3rdParty files and generate a pull request. +If you have written documentation, tutorials, libraries or programs and wish to inform developers then please consider adding details about them to the docs/3rdParty files and generating a pull request. diff --git a/include/vsg/app/Camera.h b/include/vsg/app/Camera.h index 0c33c1f02..728c749ae 100644 --- a/include/vsg/app/Camera.h +++ b/include/vsg/app/Camera.h @@ -20,8 +20,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Camera class provides the and projection and view matrices, and viewport settings that control the what a View looks at in a scene. - /// Typically assign to a vsg::View, but can also be placed in the scene graph for cases where applications want to track an in scene camera. + /// Camera class provides the projection and view matrices, and viewport settings that control what a View looks at in a scene. + /// Typically assigned to a vsg::View, but can also be placed in the scene graph for cases where applications want to track an in scene camera /// or to specify defined views within the scene, such as places of interest. class VSG_DECLSPEC Camera : public Inherit { @@ -43,7 +43,7 @@ namespace vsg }; VSG_type_name(vsg::Camera); - /// FindCameras is visitor that traversals a scene graph to collect the Cameras found within it. + /// FindCameras is a visitor that traverses a scene graph to collect the Cameras found within it. class VSG_DECLSPEC FindCameras : public Inherit { public: diff --git a/include/vsg/app/CommandGraph.h b/include/vsg/app/CommandGraph.h index d3383df90..a8bf8ad55 100644 --- a/include/vsg/app/CommandGraph.h +++ b/include/vsg/app/CommandGraph.h @@ -22,7 +22,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// CommandGraph is a group node that sits at the top of the scene graph and manages the recording of it's subgraph to Vulkan command buffers. + /// CommandGraph is a group node that sits at the top of the scene graph and manages the recording of its subgraph to Vulkan command buffers. class VSG_DECLSPEC CommandGraph : public Inherit { public: diff --git a/include/vsg/app/CompileManager.h b/include/vsg/app/CompileManager.h index 0a5f00521..13b385003 100644 --- a/include/vsg/app/CompileManager.h +++ b/include/vsg/app/CompileManager.h @@ -37,7 +37,7 @@ namespace vsg bool requiresViewerUpdate() const; }; - /// ComppileManager is a helper class that compiles subgraphs for the window/framebuffer associated with the CompileManager. + /// CompileManager is a helper class that compiles subgraphs for the windows/framebuffers associated with the CompileManager. class VSG_DECLSPEC CompileManager : public Inherit { public: diff --git a/include/vsg/app/CompileTraversal.h b/include/vsg/app/CompileTraversal.h index 46ab86921..7bbad8965 100644 --- a/include/vsg/app/CompileTraversal.h +++ b/include/vsg/app/CompileTraversal.h @@ -28,7 +28,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// CompileTraversal traverses a scene graph invoke all the StateCommand/Command::compile(..) methods to create all Vulkan objects, allocated GPU memory and transfer data to GPU. + /// CompileTraversal traverses a scene graph and invokes all the StateCommand/Command::compile(..) methods to create all Vulkan objects, allocate GPU memory and transfer data to GPU. class VSG_DECLSPEC CompileTraversal : public Inherit { public: @@ -38,7 +38,7 @@ namespace vsg explicit CompileTraversal(Window& window, ref_ptr viewport = {}, const ResourceRequirements& resourceRequirements = {}); explicit CompileTraversal(const Viewer& viewer, const ResourceRequirements& resourceRequirements = {}); - /// specification of the queue to uses + /// specification of the queue to use VkQueueFlags queueFlags = VK_QUEUE_GRAPHICS_BIT; uint32_t queueFamilyIndex = 1; @@ -63,7 +63,7 @@ namespace vsg virtual bool record(); virtual void waitForCompletion(); - /// convenience method that compiles a object/subgraph + /// convenience method that compiles an object/subgraph template void compile(T object, bool wait = true) { diff --git a/include/vsg/app/EllipsoidModel.h b/include/vsg/app/EllipsoidModel.h index 06c72bccb..7129c539b 100644 --- a/include/vsg/app/EllipsoidModel.h +++ b/include/vsg/app/EllipsoidModel.h @@ -22,7 +22,7 @@ namespace vsg const double WGS_84_RADIUS_EQUATOR = 6378137.0; const double WGS_84_RADIUS_POLAR = 6356752.3142; - /// EllipsoidModel provides a ellipsoid definition of celastral body and helper methods for computing positions/transforms on that ellipsoid. + /// EllipsoidModel provides an ellipsoid definition of a celestrial body and helper methods for computing positions/transforms on that ellipsoid. /// Defaults to WGS_84 ellipsoid model of Earth. class VSG_DECLSPEC EllipsoidModel : public Inherit { diff --git a/include/vsg/app/ProjectionMatrix.h b/include/vsg/app/ProjectionMatrix.h index 0b256330e..c87e5c2d8 100644 --- a/include/vsg/app/ProjectionMatrix.h +++ b/include/vsg/app/ProjectionMatrix.h @@ -19,7 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// ProjectionMatrix is a base class for specifying the Camera projection matrix and it's inverse. + /// ProjectionMatrix is a base class for specifying the Camera projection matrix and its inverse. class VSG_DECLSPEC ProjectionMatrix : public Inherit { public: @@ -36,7 +36,7 @@ namespace vsg }; VSG_type_name(vsg::ProjectionMatrix); - /// Perspective is a ProjectionMatrix that implements gluPerspective model for setting projection matrix. + /// Perspective is a ProjectionMatrix that implements the gluPerspective model for setting the projection matrix. class VSG_DECLSPEC Perspective : public Inherit { public: @@ -73,7 +73,7 @@ namespace vsg }; VSG_type_name(vsg::Perspective); - /// Orthographic is a ProjectionMatrix that implements glOtho model for setting projection matrix. + /// Orthographic is a ProjectionMatrix that implements the glOrtho model for setting the projection matrix. class Orthographic : public Inherit { public: @@ -116,7 +116,7 @@ namespace vsg }; VSG_type_name(vsg::Orthographic); - /// RelativeViewMatrix is a ProjectionMatrix that decorates another ProjectionMatrix and pre-multiplies it's transform matrix to give a relative projection matrix. + /// RelativeProjection is a ProjectionMatrix that decorates another ProjectionMatrix and pre-multiplies its transform matrix to give a relative projection matrix. class RelativeProjection : public Inherit { public: @@ -143,8 +143,8 @@ namespace vsg }; VSG_type_name(vsg::RelativeProjection); - /// EllipsoidPerspective is a ProjectionMatrix that implements gluPerspective model for setting projection matrix, - /// with automatic clamping of the near/far to an ellispoidModel, typically used for rendering whole earth models. + /// EllipsoidPerspective is a ProjectionMatrix that implements the gluPerspective model for setting the projection matrix, + /// with automatic clamping of the near/far values to an ellipsoidModel, typically used for rendering whole earth models. class EllipsoidPerspective : public Inherit { public: diff --git a/include/vsg/app/RecordAndSubmitTask.h b/include/vsg/app/RecordAndSubmitTask.h index 9578dadb4..159a8f948 100644 --- a/include/vsg/app/RecordAndSubmitTask.h +++ b/include/vsg/app/RecordAndSubmitTask.h @@ -22,7 +22,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// RecordAndSubmitTask manages the recording of it's list of CommanGraph to CommandBuffer which are then submitted to associated vulkan Queue. + /// RecordAndSubmitTask manages the recording of its list of CommandGraph to CommandBuffer which are then submitted to the associated vulkan Queue. class VSG_DECLSPEC RecordAndSubmitTask : public Inherit { public: @@ -48,7 +48,7 @@ namespace vsg /// return the fence index value for relativeFrameIndex where 0 is current frame, 1 is previous frame etc. size_t index(size_t relativeFrameIndex = 0) const; - /// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) return the previous frame's Fence etc. + /// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) returns the previous frame's Fence etc. Fence* fence(size_t relativeFrameIndex = 0); ref_ptr queue; @@ -64,7 +64,7 @@ namespace vsg using RecordAndSubmitTasks = std::vector>; - /// update RecordAndSubmitTask data structures to match the needs of newly compile subgraph + /// update RecordAndSubmitTask data structures to match the needs of newly compiled subgraphs extern VSG_DECLSPEC void updateTasks(RecordAndSubmitTasks& tasks, ref_ptr compileManager, const CompileResult& compileResult); } // namespace vsg diff --git a/include/vsg/app/RecordTraversal.h b/include/vsg/app/RecordTraversal.h index 000c261c5..c0e9410f4 100644 --- a/include/vsg/app/RecordTraversal.h +++ b/include/vsg/app/RecordTraversal.h @@ -54,7 +54,7 @@ namespace vsg VSG_type_name(vsg::RecordTraversal); - /// RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to record them to Vulkan command buffer + /// RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to record them to a Vulkan command buffer class VSG_DECLSPEC RecordTraversal : public Object { public: @@ -75,13 +75,13 @@ namespace vsg Mask traversalMask = MASK_ALL; Mask overrideMask = MASK_OFF; - /// get the current State object used to track state and projection/modelview matrices for current subgraph being traversed + /// get the current State object used to track state and projection/modelview matrices for the current subgraph being traversed State* getState() { return _state; } - /// get the current CommandBuffer for current subgraph being traversed + /// get the current CommandBuffer for the current subgraph being traversed CommandBuffer* getCommandBuffer(); - /// get the current DeviceID for current subgraph being traversed + /// get the current DeviceID for the current subgraph being traversed uint32_t deviceID() const; void setFrameStamp(FrameStamp* fs); diff --git a/include/vsg/app/RenderGraph.h b/include/vsg/app/RenderGraph.h index 8e32436e7..b72c68ae1 100644 --- a/include/vsg/app/RenderGraph.h +++ b/include/vsg/app/RenderGraph.h @@ -21,9 +21,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// RenderGraph encapsulates the vkCmdRenderPass/vkCmdEndRenderPass functionality. - /// Members variables of the RenderGraph map to the settings of the VkRenderPassBeginInfo. - /// During the RecordTraversal children of RenderGraph are visited within vkCmdRenderPass/vkCmdEndRenderPass pair. + /// RenderGraph encapsulates the vkCmdBeginRenderPass/vkCmdEndRenderPass functionality. + /// Member variables of the RenderGraph map to the settings of the VkRenderPassBeginInfo. + /// During the RecordTraversal children of RenderGraph are visited within the vkCmdBeginRenderPass/vkCmdEndRenderPass pair. class VSG_DECLSPEC RenderGraph : public Inherit { public: @@ -44,31 +44,31 @@ namespace vsg /// RenderPass to use passed to the vkCmdBeginRenderPass, if renderPass is set it takes precedence, if not then either obtained from which of the framebuffer or window are active RenderPass* getRenderPass(); - /// Get the Exten2D of the attached Framebuffer or Window. + /// Get the Extent2D of the attached Framebuffer or Window. VkExtent2D getExtent() const; - /// ReandingArea settings for VkRenderPassBeginInfo.renderArea passed to the vkCmdBeginRenderPass, usually maps the ViewportState's scissor + /// RenderArea settings for VkRenderPassBeginInfo.renderArea passed to the vkCmdBeginRenderPass, usually matches the ViewportState's scissor VkRect2D renderArea; /// RenderPass to use passed to the vkCmdBeginRenderPass in place of the framebuffer's or window's renderPass. renderPass must be compatible with the render pass used to create the window or framebuffer. ref_ptr renderPass; - /// Buffer clearing settings for vkRrenderPassInfo.clearValueCount & vkRenderPassInfo.pClearValues passed to the vkCmdBeginRenderPass + /// Buffer clearing settings for VkRenderPassBeginInfo.clearValueCount & VkRenderPassBeginInfo.pClearValues passed to the vkCmdBeginRenderPass using ClearValues = std::vector; ClearValues clearValues; // initialize window colour and depth/stencil - /// initialize cleaValues with the cleaColor or cleaDpethStencil based on the attachments set up in the associated RenderPass. + /// initialize clearValues with the clearColor and/or clearDepthStencil based on the attachments set up in the associated RenderPass. /// call after a framebuffer or window has been assigned to the RenderGraph. void setClearValues(VkClearColorValue clearColor = {{0.2f, 0.2f, 0.4f, 1.0f}}, VkClearDepthStencilValue clearDepthStencil = {0.0f, 0}); - /// Subpass contents stetting passed to vkCmdBeginRenderPass + /// Subpass contents setting passed to vkCmdBeginRenderPass VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE; /// Callback used to automatically update viewports, scissors, renderArea and clears when the window is resized. - /// By default is null so no resize handling is done. + /// By default resize handling is done. ref_ptr windowResizeHandler; - /// invoke the WindowResizeHandler, called automatically when window dimension change is detected. + /// invoke the WindowResizeHandler, called automatically when a window dimension change is detected. void resized(); /// window extent at previous frame, used to track window resizes diff --git a/include/vsg/app/SecondaryCommandGraph.h b/include/vsg/app/SecondaryCommandGraph.h index b1a3cf3c9..ca2bc1b4f 100644 --- a/include/vsg/app/SecondaryCommandGraph.h +++ b/include/vsg/app/SecondaryCommandGraph.h @@ -50,7 +50,7 @@ namespace vsg using SecondaryCommandGraphs = std::vector>; - /// convenience function that sets up secondaryCommandGraph to render the specified scene graph from the specified Camera view + /// convenience function that sets up SecondaryCommandGraph to render the specified scene graph from the specified Camera view extern VSG_DECLSPEC ref_ptr createSecondaryCommandGraphForView(ref_ptr window, ref_ptr camera, ref_ptr scenegraph, uint32_t subpass, bool assignHeadlight = true); } // namespace vsg diff --git a/include/vsg/app/Trackball.h b/include/vsg/app/Trackball.h index 841ce8faf..226cfa449 100644 --- a/include/vsg/app/Trackball.h +++ b/include/vsg/app/Trackball.h @@ -116,7 +116,7 @@ namespace vsg /// Key that moves the view upward KeySymbol moveUpKey = KEY_Up; - /// Key that moves the view downard + /// Key that moves the view downward KeySymbol moveDownKey = KEY_Down; /// Button mask value used to enable panning of the view, defaults to left mouse button @@ -131,7 +131,7 @@ namespace vsg /// Button mask value used used for touch events ButtonMask touchMappedToButtonMask = BUTTON_MASK_1; - /// Scale for control how rapidly the view zooms in/out. Positive value zooms in when mouse moved downwards + /// Scale for controlling how rapidly the view zooms in/out. Positive value zooms in when mouse moves downwards double zoomScale = 1.0; /// Toggle on/off whether the view should continue moving when the mouse buttons are released while the mouse is in motion. diff --git a/include/vsg/app/TransferTask.h b/include/vsg/app/TransferTask.h index fafc01cff..f9aa3b5df 100644 --- a/include/vsg/app/TransferTask.h +++ b/include/vsg/app/TransferTask.h @@ -21,7 +21,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// TransferTask manages a collection of dynamically updated vsg::Data associated with GPU memory associated vsg::BufferInfo and vsg::ImageInfo. + /// TransferTask manages a collection of dynamically updated vsg::Data associated with GPU memory of vsg::BufferInfo and vsg::ImageInfo. /// During the viewer.compile(..) traversal the collection of dynamic data that has dataVariance of DYNAMIC_DATA* is assigned to the appropriate TransferTask /// and then each new frame that collection of data is checked to see if the modification count has changed, if it has that data is copied to the associated BufferInfo/ImageInfo. /// vsg::Data that are orphaned so the TransferTask has the only remaining reference to them are automatically removed. @@ -30,7 +30,7 @@ namespace vsg public: explicit TransferTask(Device* in_device, uint32_t numBuffers = 3); - /// transfer any vsg::Data entries, that have been updated, to have the associated GPU memory. + /// transfer any vsg::Data entries that have been updated to the associated GPU memory. virtual VkResult transferDynamicData(); virtual bool containsDataToTransfer() const; @@ -45,7 +45,7 @@ namespace vsg /// return the fence index value for relativeFrameIndex where 0 is current frame, 1 is previous frame etc. size_t index(size_t relativeFrameIndex = 0) const; - /// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) return the previous frame's Fence etc. + /// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) returns the previous frame's Fence etc. Fence* fence(size_t relativeFrameIndex = 0); void assign(const ResourceRequirements::DynamicData& dynamicData); diff --git a/include/vsg/app/View.h b/include/vsg/app/View.h index 67aa19e16..d1c4b97a0 100644 --- a/include/vsg/app/View.h +++ b/include/vsg/app/View.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// View class is Group class that pairs a Camera that defines the view with a subgraph that defines the scene that is being viewed/rendered + /// View is a Group class that pairs a Camera that defines the view with a subgraph that defines the scene that is being viewed/rendered class VSG_DECLSPEC View : public Inherit { public: diff --git a/include/vsg/app/ViewMatrix.h b/include/vsg/app/ViewMatrix.h index ddc76ec81..91dddab79 100644 --- a/include/vsg/app/ViewMatrix.h +++ b/include/vsg/app/ViewMatrix.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// ViewMatrix is a base class for specifying the Camera view matrix and it's inverse. + /// ViewMatrix is a base class for specifying the Camera view matrix and its inverse. class VSG_DECLSPEC ViewMatrix : public Inherit { public: @@ -31,7 +31,7 @@ namespace vsg }; VSG_type_name(vsg::ViewMatrix); - /// LookAt is a ViewMatrix that implements gluLookAt model for specify the view matrix. + /// LookAt is a ViewMatrix that implements the gluLookAt model for specifying the view matrix. class VSG_DECLSPEC LookAt : public Inherit { public: @@ -93,7 +93,7 @@ namespace vsg }; VSG_type_name(vsg::LookAt); - /// RelativeViewMatrix is a ViewMatrix that decorates another ViewMatrix and pre-multiplies it's transform matrix to give a relative view matrix. + /// RelativeViewMatrix is a ViewMatrix that decorates another ViewMatrix and pre-multiplies its transform matrix to give a relative view matrix. class RelativeViewMatrix : public Inherit { public: @@ -116,7 +116,7 @@ namespace vsg /// TrackingViewMatrix is a ViewMatrix that tracks an object in the scene graph. /// The view matrix is computed by accumulating the transform matrix encountered - /// along a objectPath and then pre-multiplying this by specified matrix. + /// along an objectPath and then pre-multiplying this by the specified matrix. class VSG_DECLSPEC TrackingViewMatrix : public Inherit { public: diff --git a/include/vsg/app/Viewer.h b/include/vsg/app/Viewer.h index 370599887..a4044a148 100644 --- a/include/vsg/app/Viewer.h +++ b/include/vsg/app/Viewer.h @@ -70,7 +70,7 @@ namespace vsg void addEventHandlers(EventHandlers&& eventHandlers) { _eventHandlers.splice(_eventHandlers.end(), eventHandlers); } - /// get the const list of EventHandlers + /// get the list of EventHandlers EventHandlers& getEventHandlers() { return _eventHandlers; } /// get the const list of EventHandlers @@ -85,15 +85,15 @@ namespace vsg updateOperations->add(op, runBehavior); } - /// compile manager provides thread safe support for compiling subgraph + /// compile manager provides thread safe support for compiling subgraphs ref_ptr compileManager; /// convenience method for advancing to the next frame. /// Check active status, return false if viewer no longer active. - /// lf still active poll for pending events and place them in the Events list and advance to the next frame, update generate FrameStamp to signify the advancement to a new frame and return true. + /// lf still active, poll for pending events and place them in the Events list and advance to the next frame, generate updated FrameStamp to signify the advancement to a new frame and return true. virtual bool advanceToNextFrame(); - /// pass the Events into the any register EventHandlers + /// pass the Events into any registered EventHandlers virtual void handleEvents(); virtual void compile(ref_ptr hints = {}); @@ -104,14 +104,14 @@ namespace vsg /// timeout is in nanoseconds. virtual VkResult waitForFences(size_t relativeFrameIndex, uint64_t timeout); - // Manage the work to do each frame using RecordAndSubmitTasks. those that need to present results to be wired up to respective Presentation object + // Manage the work to do each frame using RecordAndSubmitTasks. Those that need to present results need to be wired up to respective Presentation objects. RecordAndSubmitTasks recordAndSubmitTasks; // Manage the presentation of rendering using Presentation objects using Presentations = std::vector>; Presentations presentations; - /// Create a RecordAndSubmitTasks and Presentation objects configured to manage specified commandGraphs and assign it to the viewer. + /// Create RecordAndSubmitTask and Presentation objects configured to manage specified commandGraphs and assign them to the viewer. /// Replace any prexisting setup. virtual void assignRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs); @@ -152,7 +152,7 @@ namespace vsg }; VSG_type_name(vsg::Viewer); - /// update Viewer data structures to match the needs of newly compiled subgraph + /// update Viewer data structures to match the needs of newly compiled subgraphs extern VSG_DECLSPEC void updateViewer(Viewer& viewer, const CompileResult& compileResult); } // namespace vsg diff --git a/include/vsg/app/Window.h b/include/vsg/app/Window.h index f7ac9049a..b87c71b0d 100644 --- a/include/vsg/app/Window.h +++ b/include/vsg/app/Window.h @@ -25,8 +25,8 @@ namespace vsg { /// Window base class provides a cross platform window - /// The Android_Window, iOS_Window, MacOS_Window, Xcb_Window and Win32_Window classes from Window provide - /// the platform specific implementations of Window that are create by Window::create(traits). + /// The Android_Window, iOS_Window, MacOS_Window, Xcb_Window and Win32_Window classes derived from Window provide + /// the platform specific implementations of Window that are created by Window::create(traits). class VSG_DECLSPEC Window : public Inherit { public: @@ -43,7 +43,7 @@ namespace vsg virtual bool visible() const { return valid(); } /// Release the window as it's owned by a 3rd party windowing object. - /// Resets the window handle and invalidating the window, preventing Window deletion or closing from deleting the window resource. + /// Resets the window handle and invalidates the window, preventing Window deletion or closing from deleting the window resource. virtual void releaseWindow() {} /// Release the connection as it's owned by a 3rd party windowing object. @@ -53,7 +53,7 @@ namespace vsg /// events buffered since the last pollEvents. UIEvents bufferedEvents; - /// get the list of events since the last poolEvents() call by splicing bufferEvents with polled windowing events. + /// get the list of events since the last pollEvents() call by splicing bufferEvents with polled windowing events. virtual bool pollEvents(UIEvents& events); virtual void resize() {} @@ -112,7 +112,7 @@ namespace vsg /// call vkAquireNextImageKHR to find the next imageIndex of the swapchain images/framebuffers VkResult acquireNextImage(uint64_t timeout = std::numeric_limits::max()); - /// get the image index for specified relative frame index, a 0 value is the current frame being rendered, 1 is the previous frame, 2 is the previous frame that. + /// get the image index for specified relative frame index, a 0 value is the current frame being rendered, 1 is the previous frame, 2 is the frame before that. size_t imageIndex(size_t relativeFrameIndex = 0) const { return relativeFrameIndex < _indices.size() ? _indices[relativeFrameIndex] : _indices.size(); } bool debugLayersEnabled() const { return _traits->debugLayer; } diff --git a/include/vsg/app/WindowAdapter.h b/include/vsg/app/WindowAdapter.h index 6d8b2e237..8433695e7 100644 --- a/include/vsg/app/WindowAdapter.h +++ b/include/vsg/app/WindowAdapter.h @@ -16,10 +16,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Class from adapting 3rd party Windowing implementations to a form usable as a vsg::Window - /// Note, the VulkanSceneGraph provides it's own cross platform Windowing support, WindowAdapter + /// Class for adapting 3rd party Windowing implementations to a form usable as a vsg::Window + /// Note, the VulkanSceneGraph provides its own cross platform Windowing support, WindowAdapter /// is only required when 3rd party windowing is used. - /// The vsgQt project provides an example of WindowAdapter used to adapt Qt window with Vulkan + /// The vsgQt project provides an example of a WindowAdapter used to adapt Qt windows with Vulkan /// support for use with VSG applications. class VSG_DECLSPEC WindowAdapter : public Inherit { diff --git a/include/vsg/app/WindowResizeHandler.h b/include/vsg/app/WindowResizeHandler.h index 8e4aa6147..4a707c939 100644 --- a/include/vsg/app/WindowResizeHandler.h +++ b/include/vsg/app/WindowResizeHandler.h @@ -40,7 +40,7 @@ namespace vsg }; VSG_type_name(vsg::UpdateGraphicsPipelines); - /// WindowResizeHandler resize calls for updating viewport/scissor and attachments to fit with new window dimensions. + /// WindowResizeHandler class for updating viewport/scissor and attachments to fit with new window dimensions. class VSG_DECLSPEC WindowResizeHandler : public Inherit { public: @@ -61,7 +61,7 @@ namespace vsg void scale_rect(VkRect2D& rect); - /// return true if the object visited + /// return true if the object was visited bool visit(const Object* object, uint32_t index = 0); void apply(BindGraphicsPipeline& bindPipeline) override; diff --git a/include/vsg/commands/BindIndexBuffer.h b/include/vsg/commands/BindIndexBuffer.h index 4ba2fdcab..42e94a44c 100644 --- a/include/vsg/commands/BindIndexBuffer.h +++ b/include/vsg/commands/BindIndexBuffer.h @@ -23,7 +23,7 @@ namespace vsg /** Compute the VkIndexType from Data source's value size.*/ extern VSG_DECLSPEC VkIndexType computeIndexType(const Data* indices); - /// BindIndexBuffer command encapsulates vkBindIndexBuffer call and associated settings. + /// BindIndexBuffer command encapsulates vkCmdBindIndexBuffer call and associated settings. class VSG_DECLSPEC BindIndexBuffer : public Inherit { public: diff --git a/include/vsg/commands/BindVertexBuffers.h b/include/vsg/commands/BindVertexBuffers.h index 74dd0ba25..69908920f 100644 --- a/include/vsg/commands/BindVertexBuffers.h +++ b/include/vsg/commands/BindVertexBuffers.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// BindVertexBuffers command encapsulates vkBindVertexBuffers call and associated settings. + /// BindVertexBuffers command encapsulates vkCmdBindVertexBuffers call and associated settings. class VSG_DECLSPEC BindVertexBuffers : public Inherit { public: diff --git a/include/vsg/commands/ClearAttachments.h b/include/vsg/commands/ClearAttachments.h index f680aef96..109153af7 100644 --- a/include/vsg/commands/ClearAttachments.h +++ b/include/vsg/commands/ClearAttachments.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// ClearAttachments command encapsulates vkCmdCopyAttachments functionality and associated settings. + /// ClearAttachments command encapsulates vkCmdClearAttachments functionality and associated settings. class VSG_DECLSPEC ClearAttachments : public Inherit { public: diff --git a/include/vsg/commands/Command.h b/include/vsg/commands/Command.h index c94b83a13..257a7bdb2 100644 --- a/include/vsg/commands/Command.h +++ b/include/vsg/commands/Command.h @@ -18,7 +18,7 @@ namespace vsg { class CommandBuffer; - /// Command base class from encapsualting vkCmd* calls and associated settings. + /// Command base class for encapsulating vkCmd* calls and associated settings. class VSG_DECLSPEC Command : public Inherit { public: diff --git a/include/vsg/commands/Commands.h b/include/vsg/commands/Commands.h index 95f48614a..9ecf037f4 100644 --- a/include/vsg/commands/Commands.h +++ b/include/vsg/commands/Commands.h @@ -23,8 +23,8 @@ namespace vsg { /// Commands is a command that acts as a container for other commands. - /// vsg::Commands is a functionally equivalent to use vsg::Group but is faster thanks to lowering CPU overhead in applying - /// the state stack prior to vsg::Command call. + /// vsg::Commands is functionally equivalent to vsg::Group but is faster thanks to lower CPU overhead in applying + /// the state stack prior to vsg::Command calls. class VSG_DECLSPEC Commands : public Inherit { public: diff --git a/include/vsg/commands/CopyAndReleaseBuffer.h b/include/vsg/commands/CopyAndReleaseBuffer.h index 6437cea9a..a2359de6d 100644 --- a/include/vsg/commands/CopyAndReleaseBuffer.h +++ b/include/vsg/commands/CopyAndReleaseBuffer.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Deprecated - use vsg::Data dataVariance and Data.dirty() to signal vsg::TransferData to transfer data. + /// Deprecated - use vsg::Data dataVariance and Data::dirty() to signal vsg::TransferTask to transfer data. class VSG_DECLSPEC CopyAndReleaseBuffer : public Inherit { public: @@ -28,7 +28,7 @@ namespace vsg void add(ref_ptr src, ref_ptr dest); - /// MemoryBufferPools used for allocation staging buffer used by the copy(ref_ptr, BufferInfo) method. Users should assign a MemoryBufferPools with appropriate settings. + /// MemoryBufferPools used for allocation of staging buffer used by the copy(ref_ptr, BufferInfo) method. Users should assign MemoryBufferPools with appropriate settings. ref_ptr stagingMemoryBufferPools; void copy(ref_ptr data, ref_ptr dest); diff --git a/include/vsg/commands/CopyAndReleaseImage.h b/include/vsg/commands/CopyAndReleaseImage.h index 9e245ec3b..b7a28a037 100644 --- a/include/vsg/commands/CopyAndReleaseImage.h +++ b/include/vsg/commands/CopyAndReleaseImage.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Deprecated - use vsg::Data dataVariance and Data.dirty() to signal vsg::TransferData to transfer data. + /// Deprecated - use vsg::Data dataVariance and Data::dirty() to signal vsg::TransferTask to transfer data. class VSG_DECLSPEC CopyAndReleaseImage : public Inherit { public: @@ -49,7 +49,7 @@ namespace vsg void add(ref_ptr src, ref_ptr dest); void add(ref_ptr src, ref_ptr dest, uint32_t numMipMapLevels); - /// MemoryBufferPools used for allocation staging buffer used by the copy(ref_ptr, ImageInfo) method. Users should assign a MemoryBufferPools with appropriate settings. + /// MemoryBufferPools used for allocation of staging buffer used by the copy(ref_ptr, ImageInfo) method. Users should assign MemoryBufferPools with appropriate settings. ref_ptr stagingMemoryBufferPools; /// copy data into a staging buffer and then use copy command to transfer this to the GPU image specified by ImageInfo diff --git a/include/vsg/commands/Dispatch.h b/include/vsg/commands/Dispatch.h index bc0543b32..c600f31b4 100644 --- a/include/vsg/commands/Dispatch.h +++ b/include/vsg/commands/Dispatch.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /** Dispatch command encapsulates vkCmdDispatch, used for dispatching a Compute command.*/ + /** Dispatch command encapsulates vkCmdDispatch, used for dispatching a Compute pipeline.*/ class VSG_DECLSPEC Dispatch : public Inherit { public: diff --git a/include/vsg/commands/Event.h b/include/vsg/commands/Event.h index 69a626637..92fe0ce9d 100644 --- a/include/vsg/commands/Event.h +++ b/include/vsg/commands/Event.h @@ -61,7 +61,7 @@ namespace vsg }; VSG_type_name(vsg::SetEvent); - /// Command class encapsulating vkCmdReetEvent + /// Command class encapsulating vkCmdResetEvent class VSG_DECLSPEC ResetEvent : public Inherit { public: diff --git a/include/vsg/commands/ExecuteCommands.h b/include/vsg/commands/ExecuteCommands.h index 6bb010eb7..76ce6f34b 100644 --- a/include/vsg/commands/ExecuteCommands.h +++ b/include/vsg/commands/ExecuteCommands.h @@ -18,19 +18,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Encapsulation of vkCmdExecuteCommands with thread safe integration with secondary CommandGraph that provide the secondary CommandBuffer + /// Encapsulation of vkCmdExecuteCommands with thread safe integration with SecondaryCommandGraph that provides the secondary CommandBuffer class VSG_DECLSPEC ExecuteCommands : public Inherit { public: ExecuteCommands(); - /// connect a SecodaryCommmandGraph that will provide the CommandBuffer each frame + /// connect a SecondaryCommmandGraph that will provide the CommandBuffer each frame void connect(ref_ptr commandGraph); /// clean the internal cache of CommandBuffer and reset the Latch used to signal when all the connected CommandGraph have completed the recording of their CommandBuffer void reset(); - /// called by secondary CommandGraph to pass on the completed CommandBuffer that the CommandGraph recorded. + /// called by SecondaryCommandGraph to pass on the completed CommandBuffer that was recorded. void completed(const SecondaryCommandGraph& commandGraph, ref_ptr commandBuffer); /// call vkCmdExecuteCommands with all the CommandBuffer that have been recorded with this ExecuteCommands diff --git a/include/vsg/commands/SetDepthBias.h b/include/vsg/commands/SetDepthBias.h index aadfbefd7..092a4ea46 100644 --- a/include/vsg/commands/SetDepthBias.h +++ b/include/vsg/commands/SetDepthBias.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// SetDepthBias command encapsulates vkCmdDepthBias functionality, associated with dynamic updating a GraphicsPipeline's RasterizationState.depthBias* values. + /// SetDepthBias command encapsulates vkCmdSetDepthBias functionality, associated with dynamic updating of a GraphicsPipeline's RasterizationState::depthBias* values. class VSG_DECLSPEC SetDepthBias : public Inherit { public: diff --git a/include/vsg/commands/SetLineWidth.h b/include/vsg/commands/SetLineWidth.h index c6cc33b3d..5831fc773 100644 --- a/include/vsg/commands/SetLineWidth.h +++ b/include/vsg/commands/SetLineWidth.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// SetLineWidth command encapsulates vkCmdLineWidth functionality, associated with dynamic updating a GraphicsPipeline's RasterizationState.lineWidth + /// SetLineWidth command encapsulates vkCmdSetLineWidth functionality, associated with dynamic updating of a GraphicsPipeline's RasterizationState::lineWidth class VSG_DECLSPEC SetLineWidth : public Inherit { public: diff --git a/include/vsg/commands/SetScissor.h b/include/vsg/commands/SetScissor.h index 7c9aabecc..90c487319 100644 --- a/include/vsg/commands/SetScissor.h +++ b/include/vsg/commands/SetScissor.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// SetScissor command encapsulates of vkCmdSetScissor functionality, associated with dynamic updating a GraphicsPipeline's ViewportState + /// SetScissor command encapsulates vkCmdSetScissor functionality, associated with dynamic updating of a GraphicsPipeline's ViewportState class VSG_DECLSPEC SetScissor : public Inherit { public: diff --git a/include/vsg/commands/SetViewport.h b/include/vsg/commands/SetViewport.h index d80ace1ff..eca4d88e9 100644 --- a/include/vsg/commands/SetViewport.h +++ b/include/vsg/commands/SetViewport.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// SetViewport command encapsulates vkCmdSetViewport call, associated with dynamic updating a GraphicsPipeline's ViewportState + /// SetViewport command encapsulates vkCmdSetViewport call, associated with dynamic updating of a GraphicsPipeline's ViewportState class VSG_DECLSPEC SetViewport : public Inherit { public: diff --git a/include/vsg/core/Allocator.h b/include/vsg/core/Allocator.h index 596f974c4..7c34cf6e4 100644 --- a/include/vsg/core/Allocator.h +++ b/include/vsg/core/Allocator.h @@ -47,16 +47,16 @@ namespace vsg /// Allocator singleton static std::unique_ptr& instance(); - /// allocate from the pool of memory blocks, or allocate from a new memory bock + /// allocate from the pool of memory blocks, or allocate from a new memory block virtual void* allocate(std::size_t size, AllocatorAffinity allocatorAffinity = ALLOCATOR_AFFINITY_OBJECTS); - /// deallocate returning data to pool. + /// deallocate, returning data to pool. virtual bool deallocate(void* ptr, std::size_t size); /// delete any MemoryBlock that are empty virtual size_t deleteEmptyMemoryBlocks(); - /// return the total available size amount allocated MemoryBlocks + /// return the total available size of allocated MemoryBlocks virtual size_t totalAvailableSize() const; /// return the total reserved size of allocated MemoryBlocks @@ -65,7 +65,7 @@ namespace vsg /// return the total memory size of allocated MemoryBlocks virtual size_t totalMemorySize() const; - /// report stats about block of memory allocated. + /// report stats about blocks of memory allocated. virtual void report(std::ostream& out) const; AllocatorType allocatorType = ALLOCATOR_TYPE_VSG_ALLOCATOR; // use MemoryBlocks by default diff --git a/include/vsg/core/Array.h b/include/vsg/core/Array.h index 1fb84d442..dfcf058ae 100644 --- a/include/vsg/core/Array.h +++ b/include/vsg/core/Array.h @@ -156,7 +156,7 @@ namespace vsg { size_t new_total_size = computeValueCountIncludingMipmaps(width_size, 1, 1, properties.maxNumMipmaps); - if (_data) // if data already may be able to reuse it + if (_data) // if data exists already may be able to reuse it { if (original_total_size != new_total_size) // if existing data is a different size delete old, and create new { @@ -267,7 +267,7 @@ namespace vsg dirty(); } - // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will no result in the data being deleted. + // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will not result in the data being deleted. // when the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. void* dataRelease() override { diff --git a/include/vsg/core/Array2D.h b/include/vsg/core/Array2D.h index b82a36ebc..0fc6fc77a 100644 --- a/include/vsg/core/Array2D.h +++ b/include/vsg/core/Array2D.h @@ -129,7 +129,7 @@ namespace vsg { size_t new_size = computeValueCountIncludingMipmaps(w, h, 1, properties.maxNumMipmaps); - if (_data) // if data already may be able to reuse it + if (_data) // if data exists already may be able to reuse it { if (original_size != new_size) // if existing data is a different size delete old, and create new { @@ -247,7 +247,7 @@ namespace vsg dirty(); } - // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will no result in the data being deleted. + // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will not result in the data being deleted. // when the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. void* dataRelease() override { diff --git a/include/vsg/core/Array3D.h b/include/vsg/core/Array3D.h index 6f847f99c..047c03278 100644 --- a/include/vsg/core/Array3D.h +++ b/include/vsg/core/Array3D.h @@ -138,7 +138,7 @@ namespace vsg { size_t new_size = computeValueCountIncludingMipmaps(w, h, d, properties.maxNumMipmaps); - if (_data) // if data already may be able to reuse it + if (_data) // if data exists already may be able to reuse it { if (original_size != new_size) // if existing data is a different size delete old, and create new { @@ -263,7 +263,7 @@ namespace vsg dirty(); } - // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will no result in the data being deleted. + // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will not result in the data being deleted. // when the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. void* dataRelease() override { diff --git a/include/vsg/core/ConstVisitor.h b/include/vsg/core/ConstVisitor.h index deaed89af..421f85caa 100644 --- a/include/vsg/core/ConstVisitor.h +++ b/include/vsg/core/ConstVisitor.h @@ -24,7 +24,7 @@ namespace vsg class Objects; class External; - // forward declare nodes classes + // forward declare node classes class Node; class Commands; class Group; @@ -48,7 +48,7 @@ namespace vsg class PointLight; class SpotLight; - // forward declare vulkan classes + // forward declare text classes class Text; class TextGroup; class TextTechnique; diff --git a/include/vsg/core/Data.h b/include/vsg/core/Data.h index 1c6a3194c..033ad278d 100644 --- a/include/vsg/core/Data.h +++ b/include/vsg/core/Data.h @@ -55,7 +55,7 @@ namespace vsg enum DataVariance : uint8_t { - STATIC_DATA = 0, /** treat data as if doesn't not change .*/ + STATIC_DATA = 0, /** treat data as if it doesn't change .*/ STATIC_DATA_UNREF_AFTER_TRANSFER = 1, /** unref this vsg::Data after the data has been transferred to the GPU memory .*/ DYNAMIC_DATA = 2, /** data is updated prior to the record traversal and will need transferring to GPU memory.*/ DYNAMIC_DATA_TRANSFER_AFTER_RECORD = 3 /** data is updated during the record traversal and will need transferring to GPU memory.*/ @@ -104,7 +104,7 @@ namespace vsg value_type* operator->() { return reinterpret_cast(ptr); } }; - /// Data base class for abstracting data such a values, vertices, images etc. + /// Data base class for abstracting data such as values, vertices, images etc. /// Main subclasses are vsg::Value, vsg::Array, vsg::Array2D and vsg::Array3D. class VSG_DECLSPEC Data : public Object { @@ -127,7 +127,7 @@ namespace vsg uint8_t blockDepth = 1; uint8_t origin = TOP_LEFT; /// Hint for setting up texture coordinates, bit 0 x/width axis, bit 1 y/height axis, bit 2 z/depth axis. Vulkan origin for images is top left, which is denoted as 0 here. int8_t imageViewType = -1; /// -1 signifies undefined VkImageViewType, if value >=0 then value should be treated as valid VkImageViewType. - DataVariance dataVariance = STATIC_DATA; /// hint as how the data values may change during the lifetime of the vsg::Data. + DataVariance dataVariance = STATIC_DATA; /// hint as to how the data values may change during the lifetime of the vsg::Data. AllocatorType allocatorType = ALLOCATOR_TYPE_VSG_ALLOCATOR; int compare(const Properties& rhs) const; @@ -207,7 +207,7 @@ namespace vsg return false; } - /// return true if Data's ModifiedCount is different than the specified ModifiedCount + /// return true if Data's ModifiedCount is different from the specified ModifiedCount bool differentModifiedCount(const ModifiedCount& mc) const { return _modifiedCount != mc; } protected: @@ -223,11 +223,11 @@ namespace vsg /// deprecated: use data->properties = properties instead. void setLayout(Layout layout) { - VkFormat previous_format = properties.format; // temporary hack to keep applications that call setFormat(..) before setProperties(..) working + VkFormat previous_format = properties.format; // temporary hack to keep applications that call setFormat(..) before setLayout(..) working uint32_t previous_stride = properties.stride; properties = layout; if (properties.format == 0 && previous_format != 0) properties.format = previous_format; // temporary hack to keep existing applications working - if (properties.stride == 0 && previous_stride != 0) properties.stride = previous_stride; // make sure the layout as a valid stride. + if (properties.stride == 0 && previous_stride != 0) properties.stride = previous_stride; // make sure the layout has a valid stride. } /// deprecated: use data->properties Layout& getLayout() { return properties; } diff --git a/include/vsg/core/Exception.h b/include/vsg/core/Exception.h index 1f4006f96..6e40a17cb 100644 --- a/include/vsg/core/Exception.h +++ b/include/vsg/core/Exception.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Exception object that can be thrown from VSG code, such as failed Vulkan calls where the result value will the VkResult value + /// Exception object that can be thrown from VSG code, such as failed Vulkan calls where the result value will be the VkResult value /// returned from failed Vulkan call. struct Exception { diff --git a/include/vsg/core/External.h b/include/vsg/core/External.h index 627e2d482..47a8aa623 100644 --- a/include/vsg/core/External.h +++ b/include/vsg/core/External.h @@ -21,9 +21,9 @@ namespace vsg { /// External provides a means to loading objects from external files, such as shaders, textures or models - /// To use set up the External object with all the pairs of [filename, object] that should be managed externally - /// then assign the External object, as use value, to root node of the scene graph that you wish to use external objects with - /// so that when serializing the External object is initialized and external objects are loaded before they are + /// To use, set up the External object with all the pairs of [filename, object] that should be managed externally, + /// then assign the External object, as a value, to the root node of the scene graph that you wish to use external objects with + /// so that when serializing, the External object is initialized and external objects are loaded before they are /// needed by the rest of the subgraph i.e. /// auto external = vsg::External::create("mytexture.png", texture); /// scene->setObject("external", external); // scene uses the texture object somewhere within it. @@ -50,7 +50,7 @@ namespace vsg void read(Input& input) override; void write(Output& output) const override; - /// custom readwriter/writer options + /// custom reader/writer options ref_ptr options; /// list of path/object pairs diff --git a/include/vsg/core/MemorySlots.h b/include/vsg/core/MemorySlots.h index 12d57bac6..268047870 100644 --- a/include/vsg/core/MemorySlots.h +++ b/include/vsg/core/MemorySlots.h @@ -22,7 +22,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Mask for hint what checks/reporting to do when using MemorySlots within Allocator/Buffer/DeviceMemory. + /// Hint for what checks/reporting to do when using MemorySlots within Allocator/Buffer/DeviceMemory. enum MemoryTracking { MEMORY_TRACKING_NO_CHECKS = 0, @@ -31,7 +31,7 @@ namespace vsg MEMORY_TRACKING_DEFAULT = MEMORY_TRACKING_NO_CHECKS }; - /** class used internally by vsg::Allocator, vsg::DeviceMemory and vsg::Buffer to manage allocation of within a block of CPU or GPU memory.*/ + /** class used internally by vsg::Allocator, vsg::DeviceMemory and vsg::Buffer to manage suballocation within a block of CPU or GPU memory.*/ class VSG_DECLSPEC MemorySlots { public: diff --git a/include/vsg/core/Visitor.h b/include/vsg/core/Visitor.h index 75fb160d8..fa72c8fe8 100644 --- a/include/vsg/core/Visitor.h +++ b/include/vsg/core/Visitor.h @@ -24,7 +24,7 @@ namespace vsg class Objects; class External; - // forward declare nodes classes + // forward declare node classes class Node; class Commands; class Group; @@ -48,7 +48,7 @@ namespace vsg class PointLight; class SpotLight; - // forward declare vulkan classes + // forward declare text classes class Text; class TextGroup; class TextTechnique; diff --git a/include/vsg/core/observer_ptr.h b/include/vsg/core/observer_ptr.h index 3895e21aa..32b7e7bed 100644 --- a/include/vsg/core/observer_ptr.h +++ b/include/vsg/core/observer_ptr.h @@ -118,10 +118,10 @@ namespace vsg explicit operator bool() const noexcept { return valid(); } - /// convert observer_ptr into a ref_ptr so that Object that pointed to can be safely accessed. + /// convert observer_ptr into a ref_ptr so that Object pointed to can be safely accessed. vsg::ref_ptr ref_ptr() const { return vsg::ref_ptr(*this); } - /// convert observer_ptr into a ref_ptr so that Object that pointed to can be safely accessed. + /// convert observer_ptr into a ref_ptr so that Object pointed to can be safely accessed. template operator vsg::ref_ptr() const { diff --git a/include/vsg/core/ref_ptr.h b/include/vsg/core/ref_ptr.h index fdd4bfd26..3b72f4e78 100644 --- a/include/vsg/core/ref_ptr.h +++ b/include/vsg/core/ref_ptr.h @@ -81,7 +81,7 @@ namespace vsg if (_ptr) _ptr->ref(); - // unref the original pointer after ref in case the old pointer object a parent of the new pointers object + // unref the original pointer after ref in case the old pointer object is a parent of the new pointer's object if (temp_ptr) temp_ptr->unref(); return *this; @@ -97,7 +97,7 @@ namespace vsg if (_ptr) _ptr->ref(); - // unref the original pointer after ref in case the old pointer object a parent of the new pointers object + // unref the original pointer after ref in case the old pointer object is a parent of the new pointer's object if (temp_ptr) temp_ptr->unref(); return *this; @@ -114,7 +114,7 @@ namespace vsg if (_ptr) _ptr->ref(); - // unref the original pointer after ref in case the old pointer object a parent of the new pointers object + // unref the original pointer after ref in case the old pointer object is a parent of the new pointer's object if (temp_ptr) temp_ptr->unref(); return *this; @@ -157,7 +157,7 @@ namespace vsg explicit operator bool() const noexcept { return valid(); } - // potentially dangerous automatic type conversion, could cause dangling pointer if ref_ptr<> assigned to C pointer, if ref_ptr<> destruction cause an object delete. + // potentially dangerous automatic type conversion, could cause dangling pointer if ref_ptr<> assigned to C pointer and ref_ptr<> destruction causes an object delete. operator T*() const noexcept { return _ptr; } void operator[](int) const = delete; diff --git a/include/vsg/io/AsciiInput.h b/include/vsg/io/AsciiInput.h index 4b6a15afa..3783c496e 100644 --- a/include/vsg/io/AsciiInput.h +++ b/include/vsg/io/AsciiInput.h @@ -98,7 +98,7 @@ namespace vsg /// read one or more strings void read(size_t num, std::wstring* value) override; - /// read one or more strings + /// read one or more paths void read(size_t num, Path* value) override; /// read object diff --git a/include/vsg/io/BinaryOutput.h b/include/vsg/io/BinaryOutput.h index 4f6155c07..bddc380d9 100644 --- a/include/vsg/io/BinaryOutput.h +++ b/include/vsg/io/BinaryOutput.h @@ -27,10 +27,10 @@ namespace vsg public: explicit BinaryOutput(std::ostream& output, ref_ptr in_options = {}); - /// write property name an non op for binary + /// write property name is a non op for binary void writePropertyName(const char*) override {} - /// write end of line a non op for binary + /// write end of line is a non op for binary void writeEndOfLine() override {} template diff --git a/include/vsg/io/DatabasePager.h b/include/vsg/io/DatabasePager.h index 629e90a80..fb669843f 100644 --- a/include/vsg/io/DatabasePager.h +++ b/include/vsg/io/DatabasePager.h @@ -105,7 +105,7 @@ namespace vsg ref_ptr culledPagedLODs; - /// for systems for smaller GPU memory limits you may need to reduce the targetMaxNumPagedLODWithHighResSubgraphs to keep memory usage within available limits. + /// for systems with smaller GPU memory limits you may need to reduce the targetMaxNumPagedLODWithHighResSubgraphs to keep memory usage within available limits. uint32_t targetMaxNumPagedLODWithHighResSubgraphs = 1500; std::mutex pendingPagedLODMutex; diff --git a/include/vsg/io/FileSystem.h b/include/vsg/io/FileSystem.h index db80c8491..8bfb62c7f 100644 --- a/include/vsg/io/FileSystem.h +++ b/include/vsg/io/FileSystem.h @@ -27,11 +27,11 @@ namespace vsg /// get the specified environmental variable. extern VSG_DECLSPEC std::string getEnv(const char* env_var); - /// parse the specified environmental variable using platorm specific delimiter, returning list of Paths + /// parse the specified environmental variable using platform specific delimiter, returning list of Paths /// delimiter used is ; under Windows, and : on all other platforms. extern VSG_DECLSPEC Paths getEnvPaths(const char* env_var); - /// parsing multiple environmental variables, parsing them to return a list of Paths. + /// parse multiple environmental variables, merging them and return a list of Paths. template Paths getEnvPaths(const char* env_var, Args... args) { @@ -44,14 +44,14 @@ namespace vsg /// return file type, see include/vsg/io/Path.h for FileType enum, extern VSG_DECLSPEC FileType fileType(const Path& path); - /// return true if a specified file/path exist on system. + /// return true if a specified file/path exists on system. extern VSG_DECLSPEC bool fileExists(const Path& path); /// return the full filename path if specified filename can be found in the list of paths. extern VSG_DECLSPEC Path findFile(const Path& filename, const Paths& paths); /// return the full filename path if specified filename can be found in the options->paths list. - /// If options is null and the filename can be found using it's existing path that filename is return, otherwise empty Path{} is returned. + /// If options is null and the filename can be found using its existing path that filename is returned, otherwise empty Path{} is returned. extern VSG_DECLSPEC Path findFile(const Path& filename, const Options* options); /// make a directory, return true if path already exists or full path has been created successfully, return false on failure. @@ -63,7 +63,7 @@ namespace vsg /// returns the path/filename of the currently executed program. extern VSG_DECLSPEC Path executableFilePath(); - /// Open a file using a the C style fopen() adapted with work with the vsg::Path. + /// Open a file using the C style fopen() adapted to work with the vsg::Path. extern VSG_DECLSPEC FILE* fopen(const Path& path, const char* mode); } // namespace vsg diff --git a/include/vsg/io/Input.h b/include/vsg/io/Input.h index b69c463be..f9cdc26d4 100644 --- a/include/vsg/io/Input.h +++ b/include/vsg/io/Input.h @@ -38,7 +38,7 @@ namespace vsg // forward declare class Options; - /// Base class that provides a means of read a range of data types to an input stream. + /// Base class that provides a means of reading a range of data types from an input stream. /// Used by vsg::Object::read(Input&) implementations across the VSG to provide native serialization from binary/ascii files class VSG_DECLSPEC Input { @@ -226,7 +226,7 @@ namespace vsg return v; } - /// read a value as a type, then cast it another type + /// read a value as a type, then cast it to another type template void readValue(const char* propertyName, T& value) { diff --git a/include/vsg/io/Logger.h b/include/vsg/io/Logger.h index 6ea815ce1..e07b603d5 100644 --- a/include/vsg/io/Logger.h +++ b/include/vsg/io/Logger.h @@ -283,27 +283,27 @@ namespace vsg Logger::instance()->warn_stream(print); } - /// write warn message to the current vsg::Logger::instance(). + /// write error message to the current vsg::Logger::instance(). template void error(Args&&... args) { Logger::instance()->error(args...); } - /// thread safe access to stream for writing warn output. + /// thread safe access to stream for writing error output. inline void error_stream(Logger::PrintToStreamFunction print) { Logger::instance()->error_stream(print); } - /// write warn message to the current vsg::Logger::instance(). + /// write fatal message to the current vsg::Logger::instance(). template void fatal(Args&&... args) { Logger::instance()->fatal(args...); } - /// thread safe access to stream for writing warn output. + /// thread safe access to stream for writing fatal output. inline void fatal_stream(Logger::PrintToStreamFunction print) { Logger::instance()->fatal_stream(print); @@ -316,13 +316,13 @@ namespace vsg Logger::instance()->log(msg_level, args...); } - /// thread safe access to stream for writing warn output for specified Logger level. + /// thread safe access to stream for writing output for specified Logger level. inline void log_stream(Logger::Level msg_level, Logger::PrintToStreamFunction print) { Logger::instance()->log_stream(msg_level, print); } - /// default Logger that sends debug and info messages to std:cout, and warn and error messages to std::cert + /// default Logger that sends debug and info messages to std:cout, and warn and error messages to std::cerr class VSG_DECLSPEC StdLogger : public Inherit { public: diff --git a/include/vsg/io/ObjectFactory.h b/include/vsg/io/ObjectFactory.h index 9877ec7e4..ab8ec2dbf 100644 --- a/include/vsg/io/ObjectFactory.h +++ b/include/vsg/io/ObjectFactory.h @@ -21,7 +21,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Singleton factory class to provides means for creating instances of VSG objects given the namespace::class name + /// Singleton factory class to provide means for creating instances of VSG objects given the namespace::class name /// Used by the VSG ReaderWriter to create objects serialized from files/streams/memory. class VSG_DECLSPEC ObjectFactory : public vsg::Object { @@ -51,7 +51,7 @@ namespace vsg CreateMap _createMap; }; - // Helper template class for registering the ability to create a Object of specified T on demand. + // Helper template class for registering the ability to create an Object of specified T on demand. template struct RegisterWithObjectFactoryProxy { diff --git a/include/vsg/io/Options.h b/include/vsg/io/Options.h index 810b829d0..55dcd3bfe 100644 --- a/include/vsg/io/Options.h +++ b/include/vsg/io/Options.h @@ -61,8 +61,8 @@ namespace vsg /// Hint to use when searching for Paths with vsg::findFile(filename, options); enum FindFileHint { - CHECK_ORIGINAL_FILENAME_EXISTS_FIRST, /// check the filename exists with it's original path before trying to find it in Options::paths. - CHECK_ORIGINAL_FILENAME_EXISTS_LAST, /// check the filename exists with it's original path after failing to find it in Options::paths. + CHECK_ORIGINAL_FILENAME_EXISTS_FIRST, /// check the filename exists with its original path before trying to find it in Options::paths. + CHECK_ORIGINAL_FILENAME_EXISTS_LAST, /// check the filename exists with its original path after failing to find it in Options::paths. ONLY_CHECK_PATHS /// only check the filename exists in the Options::paths }; FindFileHint checkFilenameHint = CHECK_ORIGINAL_FILENAME_EXISTS_FIRST; @@ -83,7 +83,7 @@ namespace vsg /// Coordinate convention to assume for specified lower case file formats extensions std::map formatCoordinateConventions; - /// User defined ShaderSet map, loaders should check the available ShaderSet used the name of the type ShaderSet. + /// User defined ShaderSet map, loaders should check the available ShaderSet using the name of the type of ShaderSet. /// Standard names are : /// "pbr" will substitute for vsg::createPhysicsBasedRenderingShaderSet() /// "phong" will substitute for vsg::createPhongShaderSet() diff --git a/include/vsg/io/Output.h b/include/vsg/io/Output.h index f8b6d6c18..3232ff6f2 100644 --- a/include/vsg/io/Output.h +++ b/include/vsg/io/Output.h @@ -187,7 +187,7 @@ namespace vsg write(object); } - /// write a value casting it specified type i.e. output.write("Value", value); + /// write a value casting it to specified type i.e. output.write("Value", value); template void writeValue(const char* propertyName, T value) { diff --git a/include/vsg/io/Path.h b/include/vsg/io/Path.h index 581e41bd0..1e652c7a2 100644 --- a/include/vsg/io/Path.h +++ b/include/vsg/io/Path.h @@ -26,7 +26,7 @@ namespace vsg DIRECTORY }; - /// Class for managing paths/filename with full support for wide and single wide path strings. + /// Class for managing paths/filenames with full support for wide and single width path strings. /// Similar in role and features to std::filesystem::path, but is able to work on older compilers. class VSG_DECLSPEC Path { @@ -202,7 +202,7 @@ namespace vsg return path.concat(rhs); } - /// join two paths with a path separator between + /// join two paths with a path separator in between inline Path operator/(const Path& lhs, const Path& rhs) { Path path(lhs); @@ -215,20 +215,20 @@ namespace vsg /// return path stripped of the filename or final path component. extern VSG_DECLSPEC Path filePath(const Path& path); - /// return file extension include the . prefix, i.e. vsg::fileExtension("file.vsgt") returns .vsgt + /// return file extension including the . prefix, i.e. vsg::fileExtension("file.vsgt") returns .vsgt extern VSG_DECLSPEC Path fileExtension(const Path& path); - /// return lower case file extension include the . prefix, i.e. vsg::fileExtension("file.VSGT") returns .vsgt + /// return lower case file extension including the . prefix, i.e. vsg::fileExtension("file.VSGT") returns .vsgt /// By default prunes extras such as REST strings at the end of the extensions, uses ? as the deliminator for REST additions i.e. ".jpeg?g=42" becomes ".jpeg" extern VSG_DECLSPEC Path lowerCaseFileExtension(const Path& path, bool pruneExtras = true); - /// return the filename stripped of any paths and extensions, i.e vsg::simpleFilname("path/file.vsgb") returns file + /// return the filename stripped of any paths and extensions, i.e vsg::simpleFilename("path/file.vsgb") returns file extern VSG_DECLSPEC Path simpleFilename(const Path& path); /// return true if the path equals ., .. or has a trailing \.. \.., /.. or /.... extern VSG_DECLSPEC bool trailingRelativePath(const Path& path); - /// return the path minus the extension, i.e. vsg::removeExtension("path/file.png") return path/file + /// return the path minus the extension, i.e. vsg::removeExtension("path/file.png") returns path/file extern VSG_DECLSPEC Path removeExtension(const Path& path); } // namespace vsg diff --git a/include/vsg/io/ReaderWriter.h b/include/vsg/io/ReaderWriter.h index 63ed3172d..600a48523 100644 --- a/include/vsg/io/ReaderWriter.h +++ b/include/vsg/io/ReaderWriter.h @@ -30,7 +30,7 @@ namespace vsg }; VSG_type_name(vsg::ReadError); - /// Base class from providing support for reading and/or writing various file formats and IO protocols + /// Base class for providing support for reading and/or writing various file formats and IO protocols class VSG_DECLSPEC ReaderWriter : public Inherit { public: @@ -100,7 +100,7 @@ namespace vsg }; VSG_type_name(vsg::ReaderWriter); - /// Class for managing a list of ReaderWriter, providing a single read/write call to invoke each RaderWriter in turn until success + /// Class for managing a list of ReaderWriter, providing a single read/write call to invoke each ReaderWriter in turn until success class VSG_DECLSPEC CompositeReaderWriter : public Inherit { public: diff --git a/include/vsg/io/mem_stream.h b/include/vsg/io/mem_stream.h index 34e8974d2..4c10cbf12 100644 --- a/include/vsg/io/mem_stream.h +++ b/include/vsg/io/mem_stream.h @@ -21,7 +21,7 @@ namespace vsg { /// Input stream that enables reading from a read only block of memory - /// Like std::string_view the memory referenced by the mem_stream has been kept in memory for the duration of the mem_stream existence. + /// Like std::string_view the memory referenced by the mem_stream has to be kept in memory for the duration of the mem_stream existence. class VSG_DECLSPEC mem_stream : public std::istream { public: diff --git a/include/vsg/io/stream.h b/include/vsg/io/stream.h index 8cbf22a6d..65106b1c2 100644 --- a/include/vsg/io/stream.h +++ b/include/vsg/io/stream.h @@ -165,7 +165,7 @@ namespace vsg return input; } - /// output stream support for vsg::t_box + /// output stream support for vsg::t_sphere template std::ostream& operator<<(std::ostream& output, const vsg::t_sphere& sp) { @@ -173,7 +173,7 @@ namespace vsg return output; } - /// input stream support for vsg::t_box + /// input stream support for vsg::t_sphere template std::istream& operator>>(std::istream& input, vsg::t_sphere& sp) { diff --git a/include/vsg/io/tile.h b/include/vsg/io/tile.h index b22f89b3c..3f4824f9d 100644 --- a/include/vsg/io/tile.h +++ b/include/vsg/io/tile.h @@ -21,7 +21,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// tile reader that is used by th vsg::TileDatabase node to implement the reading of external tiles + /// tile reader that is used by the vsg::TileDatabase node to implement the reading of external tiles class VSG_DECLSPEC tile : public Inherit { public: diff --git a/include/vsg/maths/box.h b/include/vsg/maths/box.h index 1e3d9a24b..46d47a999 100644 --- a/include/vsg/maths/box.h +++ b/include/vsg/maths/box.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// t_box template class that represent a axis aligned bounding box + /// t_box template class that represents an axis aligned bounding box template struct t_box { diff --git a/include/vsg/maths/plane.h b/include/vsg/maths/plane.h index 708cefcd4..de9345246 100644 --- a/include/vsg/maths/plane.h +++ b/include/vsg/maths/plane.h @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ -// we can't implement the anonymous union/structs combination without causing warnings, so disabled them for just this header +// we can't implement the anonymous union/structs combination without causing warnings, so disable them for just this header #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" @@ -151,7 +151,7 @@ namespace vsg return dot(pl.n, normal_type(v)) + pl.p; } - /** return true if bounding sphere is wholly or partially intersects with convex polytope defined by a list of planes with normals pointing inwards towards center of the polytope. */ + /** return true if bounding sphere wholly or partially intersects with convex polytope defined by a list of planes with normals pointing inwards towards center of the polytope. */ template constexpr bool intersect(PlaneItr first, PlaneItr last, const t_sphere& s) { diff --git a/include/vsg/maths/quat.h b/include/vsg/maths/quat.h index d03e90401..eff18f1a0 100644 --- a/include/vsg/maths/quat.h +++ b/include/vsg/maths/quat.h @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ -// we can't implement the anonymous union/structs combination without causing warnings, so disabled them for just this header +// we can't implement the anonymous union/structs combination without causing warnings, so disable them for just this header #include @@ -29,7 +29,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// t_quat template class that a represents quaternion + /// t_quat template class that represents a quaternion template struct t_quat { @@ -292,7 +292,7 @@ namespace vsg } else { - // quaternion's are very close so just linearly interpolate + // quaternions are very close so just linearly interpolate return (from * (one - r)) + (to * r); } } diff --git a/include/vsg/maths/sphere.h b/include/vsg/maths/sphere.h index f90448507..acc0054aa 100644 --- a/include/vsg/maths/sphere.h +++ b/include/vsg/maths/sphere.h @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ -// we can't implement the anonymous union/structs combination without causing warnings, so disabled them for just this header +// we can't implement the anonymous union/structs combination without causing warnings, so disable them for just this header #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" diff --git a/include/vsg/maths/transform.h b/include/vsg/maths/transform.h index f11a17ce5..9e5fe03d8 100644 --- a/include/vsg/maths/transform.h +++ b/include/vsg/maths/transform.h @@ -53,7 +53,7 @@ namespace vsg 0, 0, 0, 1); } - /// create a 4x4 matrix that represents the rotation by a radian angle around an vec3 axis + /// create a 4x4 matrix that represents the rotation by a radian angle around a vec3 axis template t_mat4 rotate(T angle_radians, const t_vec3& v) { @@ -123,9 +123,9 @@ namespace vsg m[0][3], m[1][3], m[2][3], m[3][3]); } - /// create a 4x4 matrix for an Reverse depth perspective matrix, + /// create a 4x4 matrix for a Reverse depth perspective matrix, /// Reverse depth convention: 1 to 0 depth range. Y NDC coordinates are inverted in Vulkan. - /// For best precision we record setting up Windows with windowTraits->depthFormat = VK_FORMAT_D32_SFLOAT; + /// For best precision we recommend setting up windows with windowTraits->depthFormat = VK_FORMAT_D32_SFLOAT; /// Background reading : https://developer.nvidia.com/content/depth-precision-visualized //. https://vincent-p.github.io/posts/vulkan_perspective_matrix/ template @@ -139,7 +139,7 @@ namespace vsg 0, 0, (zFar * zNear) * r, 0); } - /// create a 4x4 matrix for an Reverse depth perspective matrix, convention: 1 to 0 depth range. Y NDC coordinates are inverted in Vulkan. + /// create a 4x4 matrix for a Reverse depth perspective matrix, convention: 1 to 0 depth range. Y NDC coordinates are inverted in Vulkan. template constexpr t_mat4 perspective(T left, T right, T bottom, T top, T zNear, T zFar) { @@ -195,10 +195,10 @@ namespace vsg /// invert the top left 3x3 portion of a double 4x4 matrix. extern VSG_DECLSPEC dmat3 inverse_3x3(const dmat4& m); - /// fast float matrix inversion that use assumes the matrix is composed of only scales, rotations and translations forming a 4x3 matrix. + /// fast float matrix inversion that assumes the matrix is composed of only scales, rotations and translations forming a 4x3 matrix. extern VSG_DECLSPEC mat4 inverse_4x3(const mat4& m); - /// fast double matrix inversion that use assumes the matrix is composed of only scales, rotations and translations forming a 4x3 matrix. + /// fast double matrix inversion that assumes the matrix is composed of only scales, rotations and translations forming a 4x3 matrix. extern VSG_DECLSPEC dmat4 inverse_4x3(const dmat4& m); /// general purpose 4x4 float matrix inversion. diff --git a/include/vsg/maths/vec2.h b/include/vsg/maths/vec2.h index ad39a0397..d797c1bc9 100644 --- a/include/vsg/maths/vec2.h +++ b/include/vsg/maths/vec2.h @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ -// we can't implement the anonymous union/structs combination without causing warnings, so disabled them for just this header +// we can't implement the anonymous union/structs combination without causing warnings, so disable them for just this header #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" @@ -31,7 +31,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// t_vec2 template class that a represents a 2D vector + /// t_vec2 template class that represents a 2D vector template struct t_vec2 { @@ -241,7 +241,7 @@ namespace vsg return lhs[0] * rhs[0] + lhs[1] * rhs[1]; } - /// cross product of a vec2 can be thought of cross product of vec3's with the z value of 0.0/vec3's in the xy plane. + /// cross product of a vec2 can be thought of as cross product of vec3's with the z value of 0.0/vec3's in the xy plane. /// The returned value is the length of the resulting vec3 cross product, and can be treated as the signed area of the parallelogram, negative if rhs is clockwise from lhs when looking down on xy plane. template constexpr T cross(const t_vec2& lhs, const t_vec2& rhs) diff --git a/include/vsg/maths/vec3.h b/include/vsg/maths/vec3.h index d6161d18a..aede3da74 100644 --- a/include/vsg/maths/vec3.h +++ b/include/vsg/maths/vec3.h @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ -// we can't implement the anonymous union/structs combination without causing warnings, so disabled them for just this header +// we can't implement the anonymous union/structs combination without causing warnings, so disable them for just this header #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" @@ -28,7 +28,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// t_vec3 template class that a represents a 3D vector + /// t_vec3 template class that represents a 3D vector template struct t_vec3 { diff --git a/include/vsg/maths/vec4.h b/include/vsg/maths/vec4.h index 837e561d4..b93eb37ab 100644 --- a/include/vsg/maths/vec4.h +++ b/include/vsg/maths/vec4.h @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ -// we can't implement the anonymous union/structs combination without causing warnings, so disabled them for just this header +// we can't implement the anonymous union/structs combination without causing warnings, so disable them for just this header #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" @@ -28,7 +28,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// t_vec4 template class that a represents a 4D vector + /// t_vec4 template class that represents a 4D vector template struct t_vec4 { diff --git a/include/vsg/nodes/AbsoluteTransform.h b/include/vsg/nodes/AbsoluteTransform.h index 24e2e5b08..d6791202e 100644 --- a/include/vsg/nodes/AbsoluteTransform.h +++ b/include/vsg/nodes/AbsoluteTransform.h @@ -17,9 +17,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// MatrixTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs in absolute coordinate frame. + /// AbsoluteTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs in absolute coordinate frame. /// During the RecordTraversal the matrix is directly pushed to the State::modelviewMatrixStack stack without the normal multiplication. - /// After the subgraphs is traversed the matrix is popped from the State::modelviewMatrixStack. + /// After the subgraph is traversed the matrix is popped from the State::modelviewMatrixStack. class VSG_DECLSPEC AbsoluteTransform : public Inherit { public: diff --git a/include/vsg/nodes/Bin.h b/include/vsg/nodes/Bin.h index 693010f54..12ea6a593 100644 --- a/include/vsg/nodes/Bin.h +++ b/include/vsg/nodes/Bin.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Bin node is used internally by RecoredTraversal/View to collect and then sort command nodes assigned the bin, + /// Bin node is used internally by RecordTraversal/View to collect and then sort command nodes assigned to the bin, /// then recorded to the command buffer in the sorted order. class VSG_DECLSPEC Bin : public Inherit { diff --git a/include/vsg/nodes/Compilable.h b/include/vsg/nodes/Compilable.h index c32c41ff0..e6b2da0c9 100644 --- a/include/vsg/nodes/Compilable.h +++ b/include/vsg/nodes/Compilable.h @@ -18,7 +18,7 @@ namespace vsg { class Context; - /// Base class from encapsualting nodes that have Vulkan objects associated with them that will need compiled during the compile traversal + /// Base class for encapsulating nodes that have Vulkan objects associated with them that will need compiling during the compile traversal class VSG_DECLSPEC Compilable : public Inherit { public: diff --git a/include/vsg/nodes/CullNode.h b/include/vsg/nodes/CullNode.h index 9f0435035..b6df80f74 100644 --- a/include/vsg/nodes/CullNode.h +++ b/include/vsg/nodes/CullNode.h @@ -20,7 +20,7 @@ namespace vsg /// CullNode that enables view frustum culling on a single child node. /// A valid node must always be assigned to a CullNode before it's used, - /// for performance reasons there are no internal checks made when accessing the child.*/ + /// for performance reasons there are no internal checks made when accessing the child. class VSG_DECLSPEC CullNode : public Inherit { public: diff --git a/include/vsg/nodes/DepthSorted.h b/include/vsg/nodes/DepthSorted.h index 2d6111a8b..4e5bdc48a 100644 --- a/include/vsg/nodes/DepthSorted.h +++ b/include/vsg/nodes/DepthSorted.h @@ -18,9 +18,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DepthSorted node is used to control which bin to place the subgraph in placed in. - /// During the RecordTraversak the nodes bound sphere is tested against the view frustum - /// and if within the subgraph is traversed, with the children being in specified bin. + /// DepthSorted node is used to control which bin to place the subgraph in. + /// During the RecordTraversal the node's bound sphere is tested against the view frustum + /// and if within, the subgraph is traversed, with the children being in specified bin. /// Typically used for decorating translucent objects that should be sorted back to front to /// ensure correct blending. class VSG_DECLSPEC DepthSorted : public Inherit diff --git a/include/vsg/nodes/Geometry.h b/include/vsg/nodes/Geometry.h index 9bd869de4..633c673c0 100644 --- a/include/vsg/nodes/Geometry.h +++ b/include/vsg/nodes/Geometry.h @@ -19,7 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Geometry node is class that provides vertex arrays, optional index array and a list of draw commands + /// Geometry node is a class that provides vertex arrays, optional index array and a list of draw commands /// that are recorded to command buffer during RecordTraversal. Provides a lower CPU overhead /// compared to the equivalent functionality of adding individual commands: /// auto group = vsg::Commands::create(); diff --git a/include/vsg/nodes/LOD.h b/include/vsg/nodes/LOD.h index 65ccee88e..1267e14cc 100644 --- a/include/vsg/nodes/LOD.h +++ b/include/vsg/nodes/LOD.h @@ -23,11 +23,11 @@ namespace vsg { /** Level of Detail Node, - * Children should be ordered with the highest resolution Child first, thought to lowest resolution LOD child last. + * Children should be ordered with the highest resolution child first, through to lowest resolution LOD child last. * The Child struct stores the visibleHeightRatio and child that it's associated with. - * During culling tHe visibleHeightRatio is used as a ratio of screen height that Bound sphere occupies on screen needs to be at least in order for the associated child to be traversed. - * Once on child passes this test no more children are checked, so that no more than on child will ever being traversed in a record traversal. - * If no Child pass the visible height test then none of the LOD's children will be visible. + * During culling the visibleHeightRatio is used as a minimum ratio of screen height that a bounding sphere needs to occupy in order for the associated child to be traversed. + * Once one child passes this test no more children are checked, so that no more than one child will ever be traversed in a record traversal. + * If no child passes the visible height test then none of the LOD's children will be visible. * During the record traversals the Bound sphere is also checked against the view frustum so that LOD's also enable view frustum culling for subgraphs so there is no need for a separate CullNode/CullGroup to decorate it. */ class VSG_DECLSPEC LOD : public Inherit { diff --git a/include/vsg/nodes/Light.h b/include/vsg/nodes/Light.h index 54b8344a5..b0065dcf5 100644 --- a/include/vsg/nodes/Light.h +++ b/include/vsg/nodes/Light.h @@ -18,8 +18,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Light node a base class for different light types - AmbientLight, DirectionalLight, PointLight and SpotLight. - /// Used to by the RecordTraversal to represent a light source that is placed in the LightData uniform used by the shaders when implementing lighting. + /// Light is a base node class for different light types - AmbientLight, DirectionalLight, PointLight and SpotLight. + /// Used by the RecordTraversal to represent a light source that is placed in the LightData uniform used by the shaders when implementing lighting. /// Provides name, color and intensity settings common to all Light types. class VSG_DECLSPEC Light : public Inherit { @@ -48,7 +48,7 @@ namespace vsg }; VSG_type_name(vsg::AmbientLight); - /// DirectionalLight represents a directional light source - used for light sources that are treated as if at infinity, like sun/moon. + /// DirectionalLight represents a directional light source - used for light sources that are treated as if at infinite distance, like sun/moon. class VSG_DECLSPEC DirectionalLight : public Inherit { public: @@ -93,7 +93,7 @@ namespace vsg }; VSG_type_name(vsg::SpotLight); - /// convenience method for creating a subgraph that creates a headlight illumination using a white AmibientLight and DirectionalLight with intensity of 0.1 and 0.9 respectively. + /// convenience method for creating a subgraph with a headlight illumination using a white AmbientLight and DirectionalLight with intensity of 0.1 and 0.9 respectively. extern VSG_DECLSPEC ref_ptr createHeadlight(); } // namespace vsg diff --git a/include/vsg/nodes/MatrixTransform.h b/include/vsg/nodes/MatrixTransform.h index c95dd8129..c2c9d8da8 100644 --- a/include/vsg/nodes/MatrixTransform.h +++ b/include/vsg/nodes/MatrixTransform.h @@ -19,7 +19,7 @@ namespace vsg /// MatrixTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs. /// During the RecordTraversal the matrix is multiplied by the modelview matrix and pushed to the State::modelviewMatrixStack stack. - /// the subgraphs is traversed the multiplied matrix is popped from the State::modelviewMatrixStack. + /// When the subgraph has been traversed the multiplied matrix is popped from the State::modelviewMatrixStack. class VSG_DECLSPEC MatrixTransform : public Inherit { public: diff --git a/include/vsg/nodes/PagedLOD.h b/include/vsg/nodes/PagedLOD.h index f13ef8f18..cd23d2c32 100644 --- a/include/vsg/nodes/PagedLOD.h +++ b/include/vsg/nodes/PagedLOD.h @@ -26,11 +26,11 @@ namespace vsg class PagedLODList; /** Level of Detail Node, - * Children should be ordered with the highest resolution PagedLODChild first, thought to lowest resolution PagedLOD child last. + * Children should be ordered with the highest resolution PagedLODChild first, through to lowest resolution PagedLODChild last. * The PagedLODChild struct stores the visibleHeightRatio and child that it's associated with. - * During culling tHe visibleHeightRatio is used as a ratio of screen height that Bound sphere occupies on screen needs to be at least in order for the associated child to be traversed. - * Once on child passes this test no more children are checked, so that no more than on child will ever being traversed in a record traversal. - * If no PagedLODChild pass the visible height test then none of the PagedLOD's children will be visible. + * During culling the visibleHeightRatio is used as a minimum ratio of screen height that a bounding sphere needs to occupy in order for the associated child to be traversed. + * Once one child passes this test no more children are checked, so that no more than one child will ever be traversed in a record traversal. + * If no PagedLODChild passes the visible height test then none of the PagedLOD's children will be visible. * During the record traversals the Bound sphere is also checked against the view frustum so that PagedLOD's also enable view frustum culling for subgraphs so there is no need for a separate CullNode/CullGroup to decorate it. */ class VSG_DECLSPEC PagedLOD : public Inherit { diff --git a/include/vsg/nodes/QuadGroup.h b/include/vsg/nodes/QuadGroup.h index abb56fd36..86b3594c5 100644 --- a/include/vsg/nodes/QuadGroup.h +++ b/include/vsg/nodes/QuadGroup.h @@ -22,9 +22,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// QuadGroup is a specialist group node that manages a 4 children, designed to keep minimize the CPU overhead of traversing quad trees. - /// The number of children is fixed and all children are assumed to set before traversal of the scene graph, failure to set up correctly - /// will lead to memory faults, this is deliberate choice as any checks for pointer validity will incur CPU overhead. + /// QuadGroup is a specialized group node that manages 4 children, designed to minimize the CPU overhead of traversing quad trees. + /// The number of children is fixed and all children are assumed to be set before traversal of the scene graph, failure to set up correctly + /// will lead to memory faults, this is a deliberate choice as any checks for pointer validity will incur CPU overhead. class VSG_DECLSPEC QuadGroup : public Inherit { public: diff --git a/include/vsg/nodes/StateGroup.h b/include/vsg/nodes/StateGroup.h index 5d16f018d..b85b833da 100644 --- a/include/vsg/nodes/StateGroup.h +++ b/include/vsg/nodes/StateGroup.h @@ -24,8 +24,8 @@ namespace vsg // forward declare class CommandBuffer; - /// StateGroup is a Group node that manages a list of StateCommands that are use during the RecordTraversal for applying state to subgraph - /// When the RecordTraversal encounters a The StateGroup the StateGroup::stateCommands are pushed to the appropriate vsg::State stacks + /// StateGroup is a Group node that manages a list of StateCommands that are used during the RecordTraversal for applying state to subgraphs + /// When the RecordTraversal encounters the StateGroup its StateGroup::stateCommands are pushed to the appropriate vsg::State stacks /// and when a Command is encountered during the RecordTraversal the current head of these State stacks are applied. After traversing /// the StateGroup's subgraph the StateGroup::stateCommands are popped from the vsg::State stacks. class VSG_DECLSPEC StateGroup : public Inherit diff --git a/include/vsg/nodes/TileDatabase.h b/include/vsg/nodes/TileDatabase.h index 8855d795a..bbf4e1df0 100644 --- a/include/vsg/nodes/TileDatabase.h +++ b/include/vsg/nodes/TileDatabase.h @@ -80,7 +80,7 @@ namespace vsg }; VSG_type_name(vsg::TileDatabase); - /// convenience function for getting the part of string that enclosed between a start_match and end_match string + /// convenience function for getting the part of a string enclosed between a start_match and end_match string extern VSG_DECLSPEC std::string_view find_field(const std::string& source, const std::string_view& start_match, const std::string_view& end_match); /// convenience function for replacing all instances of a match string with the replacement string. diff --git a/include/vsg/nodes/Transform.h b/include/vsg/nodes/Transform.h index 9ecd0babd..b14a5be72 100644 --- a/include/vsg/nodes/Transform.h +++ b/include/vsg/nodes/Transform.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Transform node is a pure virtual base class for positioning/scaling/rotation subgraphs. + /// Transform node is a pure virtual base class for positioning/scaling/rotating subgraphs. class VSG_DECLSPEC Transform : public Inherit { public: @@ -33,7 +33,7 @@ namespace vsg void read(Input& input) override; void write(Output& output) const override; - /// Return the transform matrix, multiplying local transform matrix against the matrix passed into the transform(,,) method. + /// Return the transform matrix, multiplying local transform matrix against the matrix passed into the transform(..) method. /// Typically one pre multiplies local transform against the matrix passed in, which during a RecordTraversal will be the previous modelview matrix inherited from above. virtual dmat4 transform(const dmat4& mv) const = 0; diff --git a/include/vsg/nodes/VertexDraw.h b/include/vsg/nodes/VertexDraw.h index b602ab095..cf498eba8 100644 --- a/include/vsg/nodes/VertexDraw.h +++ b/include/vsg/nodes/VertexDraw.h @@ -20,7 +20,7 @@ namespace vsg { /** VertexDraw provides a lightweight way of binding vertex arrays and then issuing a vkCmdDrawIndexed command. - * Higher performance equivalent to use of individual vsg::BindVertexBuffers and vsg::DrawIndex commands.*/ + * Higher performance equivalent to use of individual vsg::BindVertexBuffers and vsg::Draw commands.*/ class VSG_DECLSPEC VertexDraw : public Inherit { public: diff --git a/include/vsg/nodes/VertexIndexDraw.h b/include/vsg/nodes/VertexIndexDraw.h index cdaaae539..2f723f718 100644 --- a/include/vsg/nodes/VertexIndexDraw.h +++ b/include/vsg/nodes/VertexIndexDraw.h @@ -20,7 +20,7 @@ namespace vsg { /** VertexIndexDraw provides a lightweight way of binding vertex arrays, indices and then issuing a vkCmdDrawIndexed command. - * Higher performance equivalent to use of individual vsg::BindVertexBuffers, vsg::BVindIndexBuffer and vsg::DrawIndex commands.*/ + * Higher performance equivalent to use of individual vsg::BindVertexBuffers, vsg::BindIndexBuffer and vsg::DrawIndexed commands.*/ class VSG_DECLSPEC VertexIndexDraw : public Inherit { public: diff --git a/include/vsg/platform/android/Android_Window.h b/include/vsg/platform/android/Android_Window.h index 5de2aa1eb..76abc4042 100644 --- a/include/vsg/platform/android/Android_Window.h +++ b/include/vsg/platform/android/Android_Window.h @@ -23,7 +23,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsgAndroid { - /// KeyboardMap maps Andriod keyboard events to vsg::KeySymbol + /// KeyboardMap maps Android keyboard events to vsg::KeySymbol class KeyboardMap : public vsg::Object { public: diff --git a/include/vsg/raytracing/BuildAccelerationStructureTraversal.h b/include/vsg/raytracing/BuildAccelerationStructureTraversal.h index e9cb24eb4..2b1b05b7a 100644 --- a/include/vsg/raytracing/BuildAccelerationStructureTraversal.h +++ b/include/vsg/raytracing/BuildAccelerationStructureTraversal.h @@ -28,7 +28,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// BuildAccelerationStructureTraversal is helper class for traversal of a scene graph to required acceleration structures. + /// BuildAccelerationStructureTraversal is a helper class for traversal of a scene graph to build required acceleration structures. class VSG_DECLSPEC BuildAccelerationStructureTraversal : public Visitor { public: diff --git a/include/vsg/raytracing/DescriptorAccelerationStructure.h b/include/vsg/raytracing/DescriptorAccelerationStructure.h index 6fce91d02..467106ef9 100644 --- a/include/vsg/raytracing/DescriptorAccelerationStructure.h +++ b/include/vsg/raytracing/DescriptorAccelerationStructure.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DescriptorAccelerationStructure descriptor encapsulates of VkAccelerationStructure. + /// DescriptorAccelerationStructure encapsulates descriptors of type VkAccelerationStructure. class VSG_DECLSPEC DescriptorAccelerationStructure : public Inherit { public: diff --git a/include/vsg/state/ArrayState.h b/include/vsg/state/ArrayState.h index 3369f80fe..41e7de071 100644 --- a/include/vsg/state/ArrayState.h +++ b/include/vsg/state/ArrayState.h @@ -22,8 +22,8 @@ namespace vsg { /// ArrayState base class provides a mechanism for CPU mapping of array data that is processed in novel ways on the GPU. - /// Assigned to StategGroup that are associated GraphicsPipline that use vertex shaders with novel vertex processing, - /// and used during traversal such as ComputeTraversal and IntersectionTraversal. + /// Assigned to StateGroup with an associated GraphicsPipeline that uses vertex shaders with novel vertex processing, + /// and used during traversals such as ComputeBounds and Intersector. class VSG_DECLSPEC ArrayState : public Inherit { public: @@ -89,9 +89,9 @@ namespace vsg }; VSG_type_name(vsg::ArrayState); - /// NullArrayState provides a mechanism for geometry in a subgraph to be ignored by traversals that use ArrayState such as ComputeBounds/Intersection/LineSegmentIntersector + /// NullArrayState provides a mechanism for geometry in a subgraph to be ignored by traversals that use ArrayState such as ComputeBounds/Intersector/LineSegmentIntersector /// this is useful for subgraphs that have custom shaders that move the final rendered geometry to a different place that would be naively interpreted by a straight forward vec3Array vertex array in local coordinates. - /// To disable the handling of geometry in a subgraph simple assign a NullArrayState to the StateGroup::prototypeArrayState, i.e. + /// To disable the handling of geometry in a subgraph simply assign a NullArrayState to the StateGroup::prototypeArrayState, i.e. /// stateGroup->prototypeArrayState = vsg::NullArrayState::create(); class VSG_DECLSPEC NullArrayState : public Inherit { @@ -109,7 +109,7 @@ namespace vsg }; VSG_type_name(vsg::NullArrayState); - /// PositionArrayState is ArrayState subclass for mapping vertex array data for instanced geometries. + /// PositionArrayState is an ArrayState subclass for mapping vertex array data for instanced geometries. class VSG_DECLSPEC PositionArrayState : public Inherit { public: @@ -130,7 +130,7 @@ namespace vsg }; VSG_type_name(vsg::PositionArrayState); - /// DisplacementMapArrayState is ArrayState subclass for mapping vertex array data for displacement mapped geometries. + /// DisplacementMapArrayState is an ArrayState subclass for mapping vertex array data for displacement mapped geometries. class VSG_DECLSPEC DisplacementMapArrayState : public Inherit { public: @@ -164,7 +164,7 @@ namespace vsg }; VSG_type_name(vsg::DisplacementMapArrayState); - /// PositionAndDisplacementMapArrayState is ArrayState subclass for mapping vertex array data for instanced, displacement mapped geometries. + /// PositionAndDisplacementMapArrayState is an ArrayState subclass for mapping vertex array data for instanced, displacement mapped geometries. class VSG_DECLSPEC PositionAndDisplacementMapArrayState : public Inherit { public: @@ -183,7 +183,7 @@ namespace vsg }; VSG_type_name(vsg::PositionAndDisplacementMapArrayState); - /// BillboardArrayState is ArrayState subclass for mapping vertex array data for billboard instanced geometries. + /// BillboardArrayState is an ArrayState subclass for mapping vertex array data for billboard instanced geometries. class VSG_DECLSPEC BillboardArrayState : public Inherit { public: diff --git a/include/vsg/state/BindDescriptorSet.h b/include/vsg/state/BindDescriptorSet.h index 2faaadc82..0d6f999d5 100644 --- a/include/vsg/state/BindDescriptorSet.h +++ b/include/vsg/state/BindDescriptorSet.h @@ -85,7 +85,7 @@ namespace vsg VSG_type_name(vsg::BindDescriptorSets); /// BindDescriptorSet state command encapsulates vkCmdBindDescriptorSets call and associated settings for a single DescriptorSet. - /// Functionality the same as assigning a single DescriptorSet to a BindDescriptorSets but has slightly lower memory footprint and CPU overhead. + /// Functionally the same as assigning a single DescriptorSet to a BindDescriptorSets but has slightly lower memory footprint and CPU overhead. class VSG_DECLSPEC BindDescriptorSet : public Inherit { public: diff --git a/include/vsg/state/Buffer.h b/include/vsg/state/Buffer.h index 17fc2529a..9a4a3815d 100644 --- a/include/vsg/state/Buffer.h +++ b/include/vsg/state/Buffer.h @@ -21,7 +21,7 @@ namespace vsg class Context; /// Buffer encapsulates VkBuffer and VkBufferCreateInfo settings used to set it up. - /// Buffer is used map blocks of DeviceMemory for use with BufferInfo associated DescriptorBuffer/BufferView/Vertex/Index arrays. + /// Buffer maps blocks of DeviceMemory for use with BufferInfo typically associated with DescriptorBuffer/BufferView/Vertex/Index arrays. class VSG_DECLSPEC Buffer : public Inherit { public: diff --git a/include/vsg/state/BufferInfo.h b/include/vsg/state/BufferInfo.h index 933aac641..1d16fe7bf 100644 --- a/include/vsg/state/BufferInfo.h +++ b/include/vsg/state/BufferInfo.h @@ -41,7 +41,7 @@ namespace vsg /// Requires associated buffer memory to be host visible, for non host visible buffers you must use a staging buffer void copyDataToBuffer(); - /// Copy data to the VkBuffer associated with the a specified Device + /// Copy data to the VkBuffer associated with the specified Device /// Requires associated buffer memory to be host visible, for non host visible buffers you must use a staging buffer void copyDataToBuffer(uint32_t deviceID); @@ -59,7 +59,7 @@ namespace vsg return data && data->differentModifiedCount(copiedModifiedCounts[deviceID]); } - /// return true if the BufferInfo's data has been modified and should be copied to the buffer, and sync the moificationCounts + /// return true if the BufferInfo's data has been modified and should be copied to the buffer, and sync the modification counts bool syncModifiedCounts(uint32_t deviceID) { return data && data->getModifiedCount(copiedModifiedCounts[deviceID]); diff --git a/include/vsg/state/ColorBlendState.h b/include/vsg/state/ColorBlendState.h index 7ad0bbc3a..d608f3f44 100644 --- a/include/vsg/state/ColorBlendState.h +++ b/include/vsg/state/ColorBlendState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// ColorBlendState encapsulates to VkPipelineColorBlendStateCreateInfo settings passed when setting up GraphicsPipeline + /// ColorBlendState encapsulates VkPipelineColorBlendStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC ColorBlendState : public Inherit { public: diff --git a/include/vsg/state/DepthStencilState.h b/include/vsg/state/DepthStencilState.h index 86300ebb6..aa0f25299 100644 --- a/include/vsg/state/DepthStencilState.h +++ b/include/vsg/state/DepthStencilState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DepthStencilState encapsulates to VkPipelineDepthStencilStateCreateInfo settings passed when setting up GraphicsPipeline + /// DepthStencilState encapsulates VkPipelineDepthStencilStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC DepthStencilState : public Inherit { public: diff --git a/include/vsg/state/Descriptor.h b/include/vsg/state/Descriptor.h index f6d142218..26fc07c70 100644 --- a/include/vsg/state/Descriptor.h +++ b/include/vsg/state/Descriptor.h @@ -20,7 +20,7 @@ namespace vsg class Context; /// Descriptor base class for descriptor DescriptorBuffer/DescriptorImage/DescriptorTexelBufferView classes. - /// Descriptors are assigned BindDescriptorState state commands. + /// Descriptors are assigned to BindDescriptorSet state commands. /// Provides VkWriteDescriptorSet settings that are required for all types of descriptors. class VSG_DECLSPEC Descriptor : public Inherit { diff --git a/include/vsg/state/DescriptorBuffer.h b/include/vsg/state/DescriptorBuffer.h index eba044d59..4a0c85c12 100644 --- a/include/vsg/state/DescriptorBuffer.h +++ b/include/vsg/state/DescriptorBuffer.h @@ -18,8 +18,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DescriptorBuffer is Descriptor class that encapsulates bufferInfoList used to set VkWriteDescriptorSet.pBufferInfo settings - /// DescriptorBuffer is means for passing uniforms to shaders. + /// DescriptorBuffer is a Descriptor class that encapsulates the bufferInfoList used to set VkWriteDescriptorSet::pBufferInfo settings + /// DescriptorBuffer is a means for passing uniforms to shaders. class VSG_DECLSPEC DescriptorBuffer : public Inherit { public: diff --git a/include/vsg/state/DescriptorImage.h b/include/vsg/state/DescriptorImage.h index c9aea7043..d80322997 100644 --- a/include/vsg/state/DescriptorImage.h +++ b/include/vsg/state/DescriptorImage.h @@ -18,8 +18,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DescriptorImage is Descriptor class that encapsulates imageInfoList used to set VkWriteDescriptorSet.pImageInfo settings - /// DescriptorImage is means for passing textures to shaders. + /// DescriptorImage is a Descriptor class that encapsulates the imageInfoList used to set VkWriteDescriptorSet::pImageInfo settings + /// DescriptorImage is a means for passing textures to shaders. class VSG_DECLSPEC DescriptorImage : public Inherit { public: diff --git a/include/vsg/state/DescriptorTexelBufferView.h b/include/vsg/state/DescriptorTexelBufferView.h index 8995a2012..fb7e0b2ac 100644 --- a/include/vsg/state/DescriptorTexelBufferView.h +++ b/include/vsg/state/DescriptorTexelBufferView.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DescriptorTexelBufferView is Descriptor class that encapsulates texelBufferViews used to set VkWriteDescriptorSet.pTexelBufferViews + /// DescriptorTexelBufferView is a Descriptor class that encapsulates texelBufferViews used to set VkWriteDescriptorSet::pTexelBufferViews class VSG_DECLSPEC DescriptorTexelBufferView : public Inherit { public: diff --git a/include/vsg/state/DynamicState.h b/include/vsg/state/DynamicState.h index 45db7d85b..4017f1954 100644 --- a/include/vsg/state/DynamicState.h +++ b/include/vsg/state/DynamicState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DynamicState encapsulates to VkPipelineDynamicStateCreateInfo settings passed when setting up GraphicsPipeline + /// DynamicState encapsulates VkPipelineDynamicStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC DynamicState : public Inherit { public: diff --git a/include/vsg/state/Image.h b/include/vsg/state/Image.h index 3dc8581ec..6c8961c7a 100644 --- a/include/vsg/state/Image.h +++ b/include/vsg/state/Image.h @@ -20,11 +20,11 @@ namespace vsg // forward declare class Context; - /// Image class encapsulates VkImage and VkImageCreateInfo settings used to it up. + /// Image class encapsulates VkImage and VkImageCreateInfo settings used to set it up. class VSG_DECLSPEC Image : public Inherit { public: - /// create a vsg::Image with optional CreateInfo, delay VkUmage creation to compile + /// create a vsg::Image, optional Data is used to initialize createInfo, delay VkImage creation to compile Image(ref_ptr in_data = {}); /// create a vsg::Image wrapper for specified VkImage diff --git a/include/vsg/state/ImageInfo.h b/include/vsg/state/ImageInfo.h index b70d023f8..4cef2eb7a 100644 --- a/include/vsg/state/ImageInfo.h +++ b/include/vsg/state/ImageInfo.h @@ -68,7 +68,7 @@ namespace vsg return data && data->differentModifiedCount(copiedModifiedCounts[deviceID]); } - /// return true if the ImageInfo's data has been modified and should be copied to the buffer, and sync the moificationCounts + /// return true if the ImageInfo's data has been modified and should be copied to the buffer, and sync the modification counts bool syncModifiedCounts(uint32_t deviceID) { if (!imageView || !imageView->image) return false; @@ -85,7 +85,7 @@ namespace vsg using ImageInfoList = std::vector>; - /// format traits hints that can be used when initialize image data + /// format traits hints that can be used when initializing image data struct FormatTraits { int size = 0; @@ -108,7 +108,7 @@ namespace vsg } }; - /// return the traits suitable for specified VkFDormat. + /// return the traits suitable for specified VkFormat. extern VSG_DECLSPEC FormatTraits getFormatTraits(VkFormat format, bool default_one = true); /// return the number of mip map levels specified by Data/Sampler. diff --git a/include/vsg/state/ImageView.h b/include/vsg/state/ImageView.h index 226fbc8bb..ac43702cc 100644 --- a/include/vsg/state/ImageView.h +++ b/include/vsg/state/ImageView.h @@ -61,10 +61,10 @@ namespace vsg using ImageViews = std::vector>; - /// convenience function that create an ImageView and allocates device memory and an Image for it. For device memory allocation the Context's DeviceMemoryPools are utilized. + /// convenience function that creates an ImageView and allocates device memory and an Image for it. For device memory allocation the Context's deviceMemoryBufferPools are utilized. extern VSG_DECLSPEC ref_ptr createImageView(Context& context, ref_ptr image, VkImageAspectFlags aspectFlags); - /// convenience function that create an ImageView and allocates device memory and an Image for it. + /// convenience function that creates an ImageView and allocates device memory and an Image for it. extern VSG_DECLSPEC ref_ptr createImageView(Device* device, ref_ptr image, VkImageAspectFlags aspectFlags); /// convenience function that uploads staging buffer data to device including mipmaps. diff --git a/include/vsg/state/InputAssemblyState.h b/include/vsg/state/InputAssemblyState.h index 6121cea84..6f2c068bd 100644 --- a/include/vsg/state/InputAssemblyState.h +++ b/include/vsg/state/InputAssemblyState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// InputAssemblyState encapsulates to VkPipelineInputAssemblyStateCreateInfo settings passed when setting up GraphicsPipeline + /// InputAssemblyState encapsulates VkPipelineInputAssemblyStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC InputAssemblyState : public Inherit { public: diff --git a/include/vsg/state/MultisampleState.h b/include/vsg/state/MultisampleState.h index 75751c62e..51beb6a65 100644 --- a/include/vsg/state/MultisampleState.h +++ b/include/vsg/state/MultisampleState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// MultisampleState encapsulates to VkPipelineMultisampleStateCreateInfo settings passed when setting up GraphicsPipeline + /// MultisampleState encapsulates VkPipelineMultisampleStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC MultisampleState : public Inherit { public: diff --git a/include/vsg/state/RasterizationState.h b/include/vsg/state/RasterizationState.h index 297f85d1d..d2efe7aa1 100644 --- a/include/vsg/state/RasterizationState.h +++ b/include/vsg/state/RasterizationState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// RasterizationState encapsulates to VkPipelineRasterizationStateCreateInfo settings passed when setting up GraphicsPipeline + /// RasterizationState encapsulates VkPipelineRasterizationStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC RasterizationState : public Inherit { public: diff --git a/include/vsg/state/ShaderStage.h b/include/vsg/state/ShaderStage.h index 277d4ab96..d2e55b836 100644 --- a/include/vsg/state/ShaderStage.h +++ b/include/vsg/state/ShaderStage.h @@ -19,7 +19,7 @@ namespace vsg // forward declare class Context; - /// ShaderStage encapsulates to VkPipelineShaderStageCreateInfo settings passed when setting up GraphicsPipeline + /// ShaderStage encapsulates VkPipelineShaderStageCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC ShaderStage : public Inherit { public: diff --git a/include/vsg/state/StateCommand.h b/include/vsg/state/StateCommand.h index 12559f48f..9a6080789 100644 --- a/include/vsg/state/StateCommand.h +++ b/include/vsg/state/StateCommand.h @@ -18,7 +18,7 @@ namespace vsg { /// Base class for Vulkan commands associated with state, such as binding graphics pipelines and descriptors sets (textures and uniforms). - /// StateCommands can be attached directly as nodes in the scene graph, or more typically assigned to StateGroup node to enable push/popping of state. + /// StateCommands can be attached directly as nodes in the scene graph, or more typically assigned to StateGroup nodes to enable push/popping of state. class VSG_DECLSPEC StateCommand : public Inherit { public: diff --git a/include/vsg/state/StateSwitch.h b/include/vsg/state/StateSwitch.h index c69fa5299..e0e4dc75d 100644 --- a/include/vsg/state/StateSwitch.h +++ b/include/vsg/state/StateSwitch.h @@ -16,8 +16,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// StateSwitch is a StateCommand that provides support, during the RecordTraveral, for applying StateCommand children based on pass a mask. - /// Can be used for enable state for specific View's were the StateSwitch child masks are matched the View mask. + /// StateSwitch is a StateCommand that provides support, during the RecordTraveral, for applying StateCommand children based on passing a mask. + /// Can be used to enable state for specific Views where the StateSwitch child masks are matched with the View mask. class VSG_DECLSPEC StateSwitch : public Inherit { public: diff --git a/include/vsg/state/TessellationState.h b/include/vsg/state/TessellationState.h index 4e3145908..9d2ee812c 100644 --- a/include/vsg/state/TessellationState.h +++ b/include/vsg/state/TessellationState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// TessellationState encapsulates to VkPipelineTessellationStateCreateInfo settings passed when setting up GraphicsPipeline + /// TessellationState encapsulates VkPipelineTessellationStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC TessellationState : public Inherit { public: diff --git a/include/vsg/state/VertexInputState.h b/include/vsg/state/VertexInputState.h index f3cb16b85..ff74e2f25 100644 --- a/include/vsg/state/VertexInputState.h +++ b/include/vsg/state/VertexInputState.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// VertexInputState encapsulates to VkPipelineVertexInputStateCreateInfo settings passed when setting up GraphicsPipeline + /// VertexInputState encapsulates VkPipelineVertexInputStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC VertexInputState : public Inherit { public: diff --git a/include/vsg/state/ViewDependentState.h b/include/vsg/state/ViewDependentState.h index 09a1e17e9..f04a4cc86 100644 --- a/include/vsg/state/ViewDependentState.h +++ b/include/vsg/state/ViewDependentState.h @@ -20,7 +20,7 @@ namespace vsg { /// ViewDescriptorSetLayout is a proxy class that uses the ViewDependentState's descriptorSetLayout as the DescriptorSetLayout to use. - /// Used in pipelines that wish to utilize in the light and other view dependent data provided by the View::ViewDependentState. + /// Used in pipelines that wish to utilize lights and other view dependent data provided by the View::viewDependentState. /// Use in combination with the BindViewDescriptorSet. class VSG_DECLSPEC ViewDescriptorSetLayout : public Inherit { @@ -41,8 +41,8 @@ namespace vsg }; VSG_type_name(vsg::ViewDescriptorSetLayout); - /// BindViewDescriptorSets is proxy class that binds the View::ViewDependentState's descriptorSet - /// Used for pass light and other view dependent state to the GPU. + /// BindViewDescriptorSets is a proxy class that binds the View::viewDependentState's descriptorSet + /// Used for passing lights and other view dependent state to the GPU. /// Use in conjunction with a pipeline configured with vsg::ViewDescriptorSetLayout. class VSG_DECLSPEC BindViewDescriptorSets : public Inherit { @@ -87,12 +87,12 @@ namespace vsg VSG_type_name(vsg::BindViewDescriptorSets); /// ViewDependentState to manage lighting, clip planes and texture projection - /// By default assigned to the vsg::View, for standard usage you can don't need to create or modify the ViewDependentState - /// If you wish to override the standard lighting support provided by ViewDependentState you and subclass + /// By default assigned to the vsg::View, for standard usage you don't need to create or modify the ViewDependentState + /// If you wish to override the standard lighting support provided by ViewDependentState you can subclass it. /// /// To leverage the state that the ViewDependentState provides you need to set up the graphics pipelines with the vsg::ViewDescriptorSetLayout, /// and add a vsg::BindViewDescriptorSet to a StateGroup. You don't need to explicitly add these if you have created your scene graph using - /// vsg::Builder created or used loaders like vsgXchange::Assimp. + /// vsg::Builder or used loaders like vsgXchange::Assimp. class VSG_DECLSPEC ViewDependentState : public Inherit { public: diff --git a/include/vsg/state/ViewportState.h b/include/vsg/state/ViewportState.h index 4b0bdbeab..1d6a8991a 100644 --- a/include/vsg/state/ViewportState.h +++ b/include/vsg/state/ViewportState.h @@ -19,7 +19,7 @@ namespace vsg using Viewports = std::vector; using Scissors = std::vector; - /// ViewportState encapsulates to VkPipelineViewportStateCreateInfo settings passed when setting up GraphicsPipeline + /// ViewportState encapsulates VkPipelineViewportStateCreateInfo settings passed when setting up GraphicsPipeline class VSG_DECLSPEC ViewportState : public Inherit { public: diff --git a/include/vsg/state/material.h b/include/vsg/state/material.h index 1c51e7625..d4669108d 100644 --- a/include/vsg/state/material.h +++ b/include/vsg/state/material.h @@ -90,7 +90,7 @@ namespace vsg VSG_value(PhongMaterialValue, PhongMaterial); VSG_array(PhongMaterialArray, PhongMaterial); - /// PbrMaterial struct for passing material settings, suitable for phong lighting model, as uniform value to fragment shader + /// PbrMaterial struct for passing material settings, suitable for PBR lighting model, as uniform value to fragment shader /// Used in conjunction with vsg::createPhysicsBasedRenderingShaderSet(). struct PbrMaterial { diff --git a/include/vsg/text/Text.h b/include/vsg/text/Text.h index 2a390f7b4..27b0184be 100644 --- a/include/vsg/text/Text.h +++ b/include/vsg/text/Text.h @@ -21,10 +21,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /** Text node provides high quality text rendering using signed distance field glyph texture atlas. - * Text does not provide view frustum culling or level of detail, but you can add this if require - * it by decorating the Text with a CullNode/LOD and after TextGroup::setup() is called to initialize - * the rendering component you can use the TextGroup->technique->extents() value to help set the + /** Text node provides high quality text rendering using a signed distance field glyph texture atlas. + * Text does not provide view frustum culling or level of detail, but you can add this if required + * by decorating the Text with a CullNode/LOD and after TextGroup::setup() is called to initialize + * the rendering component, you can use the TextGroup->technique->extents() value to help set the * CullNode/LOD.bounds value.*/ class VSG_DECLSPEC Text : public Inherit { @@ -57,7 +57,7 @@ namespace vsg }; VSG_type_name(vsg::Text); - /// create a ShaderSet used for both CpuALayutTechnique and GpuALayutTechnique or return the Options::shaderSet["text"] entry if available. + /// create a ShaderSet used for both CpuLayoutTechnique and GpuLayoutTechnique or return the Options::shaderSet["text"] entry if available. extern VSG_DECLSPEC ref_ptr createTextShaderSet(ref_ptr options = {}); /// convenience class for counting the number of text glyphs diff --git a/include/vsg/text/TextGroup.h b/include/vsg/text/TextGroup.h index 8a2916fe5..d29dcf72d 100644 --- a/include/vsg/text/TextGroup.h +++ b/include/vsg/text/TextGroup.h @@ -16,12 +16,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /** TextGroup node provides high performance rendering of large numbers of text labels batched rendering of Text. - * In order to achieve batching all Text children of TextGroup node use the same Font, ShaderSet and TextTechnique - * provided by the TextGroup node, any local Text entries for these are discarded. The individual Text's are - * positioned by their local TextLayout.TextGroup does not provide view frustum culling or level of detail, but you - * can add this if require it by decorating the TextGroup with a CullNode/LOD and after TextGroup::setup() is called - * to initialize the rendering component you can use the TextGroup->technique->extents() value to help set the + /** TextGroup node provides high performance rendering of large numbers of text labels, i.e. batched rendering of Text. + * In order to achieve batching all Text children of a TextGroup node use the same Font, ShaderSet and TextTechnique + * provided by the TextGroup node, any local Text entries for these are discarded. The individual Texts are + * positioned by their local TextLayout. TextGroup does not provide view frustum culling or level of detail, but you + * can add this if required by decorating the TextGroup with a CullNode/LOD and after TextGroup::setup() is called + * to initialize the rendering component, you can use the TextGroup->technique->extents() value to help set the * CullNode/LOD.bounds value.*/ class VSG_DECLSPEC TextGroup : public vsg::Inherit { diff --git a/include/vsg/text/TextLayout.h b/include/vsg/text/TextLayout.h index 4dc05a37c..ea611baee 100644 --- a/include/vsg/text/TextLayout.h +++ b/include/vsg/text/TextLayout.h @@ -26,7 +26,7 @@ namespace vsg vec4 outlineColors[4]; float outlineWidths[4]; vec3 normal; - vec4 centerAndAutoScaleDistance; // only used by when billboarding + vec4 centerAndAutoScaleDistance; // only used when billboarding }; using TextQuads = std::vector; diff --git a/include/vsg/threading/Barrier.h b/include/vsg/threading/Barrier.h index 9ddee6eff..10f655e79 100644 --- a/include/vsg/threading/Barrier.h +++ b/include/vsg/threading/Barrier.h @@ -19,7 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Barrier provides a means for synchronization multiple threads that all release together once specified number of threads joined the Barrier. + /// Barrier provides a means for synchronizing multiple threads that all release together once specified number of threads joined the Barrier. class Barrier : public Inherit { public: @@ -31,7 +31,7 @@ namespace vsg Barrier(const Barrier&) = delete; Barrier& operator=(const Barrier&) = delete; - /// increment the arrived count and release the barrier if count matches number of threads to arrive otherwise waiting for the arrived count to match the number if threads to arrive + /// increment the arrived count and release the barrier if count matches number of threads to arrive otherwise wait for the arrived count to match the number of threads to arrive void arrive_and_wait() { std::unique_lock lock(_mutex); diff --git a/include/vsg/threading/FrameBlock.h b/include/vsg/threading/FrameBlock.h index a1e21193a..fc277a593 100644 --- a/include/vsg/threading/FrameBlock.h +++ b/include/vsg/threading/FrameBlock.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// FrameBlock provides mechanism for synchronization threads that are waiting on the start of new frame, + /// FrameBlock provides a mechanism for synchronizing threads that are waiting on the start of a new frame. class FrameBlock : public Inherit { public: diff --git a/include/vsg/threading/Latch.h b/include/vsg/threading/Latch.h index cd3106f44..328d36d48 100644 --- a/include/vsg/threading/Latch.h +++ b/include/vsg/threading/Latch.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Latch provides a means for synchronization multiple threads that waits for the latch count to be decremented to zero. + /// Latch provides a means for synchronizing multiple threads that waits for the latch count to be decremented to zero. class Latch : public Inherit { public: diff --git a/include/vsg/threading/OperationQueue.h b/include/vsg/threading/OperationQueue.h index 6242d537a..a3dc2a41a 100644 --- a/include/vsg/threading/OperationQueue.h +++ b/include/vsg/threading/OperationQueue.h @@ -102,14 +102,14 @@ namespace vsg std::unique_lock lock(_mutex); - // wait to the conditional variable signals that an operation has been added + // wait until the conditional variable signals that an operation has been added while (_queue.empty() && _status->active()) { // debug("Waiting on condition variable"); _cv.wait_for(lock, waitDuration); } - // if the threads we are associated with should no longer running go for a quick exit and return nothing. + // if the threads we are associated with should no longer be running go for a quick exit and return nothing. if (_status->cancel()) { return {}; diff --git a/include/vsg/threading/OperationThreads.h b/include/vsg/threading/OperationThreads.h index 909526fd9..23e977451 100644 --- a/include/vsg/threading/OperationThreads.h +++ b/include/vsg/threading/OperationThreads.h @@ -21,7 +21,7 @@ namespace vsg /// OperationThreads provides a collection of std::threads that share a single OperationQueue. /// Each thread polls the queue for vsg::Operation to process, when one is available it's removed - /// from the queue and it's Operation::run() method. + /// from the queue and its Operation::run() method is called. class VSG_DECLSPEC OperationThreads : public Inherit { public: diff --git a/include/vsg/threading/atomics.h b/include/vsg/threading/atomics.h index c8a71ea55..38fb96b04 100644 --- a/include/vsg/threading/atomics.h +++ b/include/vsg/threading/atomics.h @@ -41,7 +41,7 @@ namespace vsg while (!reference.compare_exchange_weak(original_value, original_value * t)) {} }; - /// Convenience template function that modifies an atomic if it's value matches the from value, and sets it to, otherwise trues fales without modifying the atomic. + /// Convenience template function that modifies an atomic if its value matches the from value, setting it to the to value, otherwise returns false without modifying the atomic. template bool compare_exchange(std::atomic& reference, T from, T to) { diff --git a/include/vsg/ui/ApplicationEvent.h b/include/vsg/ui/ApplicationEvent.h index 21cc3978d..951042482 100644 --- a/include/vsg/ui/ApplicationEvent.h +++ b/include/vsg/ui/ApplicationEvent.h @@ -19,7 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// TerminateEvent represents a application terminate event. + /// TerminateEvent represents an application termination event. class TerminateEvent : public Inherit { public: diff --git a/include/vsg/ui/Keyboard.h b/include/vsg/ui/Keyboard.h index 34dede145..0cab89f17 100644 --- a/include/vsg/ui/Keyboard.h +++ b/include/vsg/ui/Keyboard.h @@ -40,8 +40,8 @@ namespace vsg /// return true if key is currently pressed bool pressed(KeySymbol key, bool ignore_handled_keys = true) const; - /// return a pair of times, the first is the time, in seconds, since the key was first pressed and the second is the time, in secnds, since it was released. - /// if the key hasn't been pressed then then first value will be < 0.0, if the key is still pressed then the second value will be 0.0. + /// return a pair of times, the first is the time, in seconds, since the key was first pressed and the second is the time, in seconds, since it was released. + /// if the key hasn't been pressed then then the first value will be < 0.0, if the key is still pressed then the second value will be 0.0. std::pair times(KeySymbol key, bool ignore_handled_keys = true) const; }; VSG_type_name(vsg::Keyboard); diff --git a/include/vsg/ui/PointerEvent.h b/include/vsg/ui/PointerEvent.h index dad765490..9be5a9bad 100644 --- a/include/vsg/ui/PointerEvent.h +++ b/include/vsg/ui/PointerEvent.h @@ -50,7 +50,7 @@ namespace vsg }; VSG_type_name(vsg::PointerEvent); - /// ButtonPressEvent represent a button press event. + /// ButtonPressEvent represents a button press event. class VSG_DECLSPEC ButtonPressEvent : public Inherit { public: @@ -67,7 +67,7 @@ namespace vsg }; VSG_type_name(vsg::ButtonPressEvent); - /// ButtonReleaseEvent represent a button release event. + /// ButtonReleaseEvent represents a button release event. class VSG_DECLSPEC ButtonReleaseEvent : public Inherit { public: @@ -84,7 +84,7 @@ namespace vsg }; VSG_type_name(vsg::ButtonReleaseEvent); - /// MoveEvent represent a button move event. + /// MoveEvent represents a pointer move event. class MoveEvent : public Inherit { public: diff --git a/include/vsg/ui/PrintEvents.h b/include/vsg/ui/PrintEvents.h index 8a092c9f4..3d3e00f2e 100644 --- a/include/vsg/ui/PrintEvents.h +++ b/include/vsg/ui/PrintEvents.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// PrintEvents prints ui event settings to stream, using for tracking/debugging event handling in applications. + /// PrintEvents prints ui event settings to stream, used for tracking/debugging event handling in applications. class VSG_DECLSPEC PrintEvents : public Inherit { public: diff --git a/include/vsg/ui/RecordEvents.h b/include/vsg/ui/RecordEvents.h index 55b53f9c7..e7e52d8ab 100644 --- a/include/vsg/ui/RecordEvents.h +++ b/include/vsg/ui/RecordEvents.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// RecordEvents is a event recording class that can be assigned to a viewer as an event handler. + /// RecordEvents is an event recording class that can be assigned to a viewer as an event handler. /// Can be used in conjunction with vsg::PlayEvents to replay recorded events. /// See vsginput example to see how it's used. class VSG_DECLSPEC RecordEvents : public vsg::Inherit diff --git a/include/vsg/ui/ShiftEventTime.h b/include/vsg/ui/ShiftEventTime.h index bc7e86866..7063cefe3 100644 --- a/include/vsg/ui/ShiftEventTime.h +++ b/include/vsg/ui/ShiftEventTime.h @@ -20,7 +20,7 @@ namespace vsg { /// ShiftEventTime is a visitor for modifying the UIEvent::time values by a specified delta. - /// Use by PlayEvents to replace recorded events with a different time point. + /// Used by PlayEvents to replace recorded events with a different time point. class VSG_DECLSPEC ShiftEventTime : public vsg::Inherit { public: diff --git a/include/vsg/ui/TouchEvent.h b/include/vsg/ui/TouchEvent.h index fa2736597..01b19c28b 100644 --- a/include/vsg/ui/TouchEvent.h +++ b/include/vsg/ui/TouchEvent.h @@ -19,7 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// TouchEvent is a base class touch events. + /// TouchEvent is a base class for touch events. class VSG_DECLSPEC TouchEvent : public Inherit { public: diff --git a/include/vsg/ui/WindowEvent.h b/include/vsg/ui/WindowEvent.h index a05df43cf..b500cb8ea 100644 --- a/include/vsg/ui/WindowEvent.h +++ b/include/vsg/ui/WindowEvent.h @@ -59,7 +59,7 @@ namespace vsg }; VSG_type_name(vsg::ExposeWindowEvent); - /// ExposeWindowEvent represents a window configure event - such as changes to the size of the window. + /// ConfigureWindowEvent represents a window configure event - such as changes to the size of the window. class VSG_DECLSPEC ConfigureWindowEvent : public Inherit { public: diff --git a/include/vsg/utils/AnimationPath.h b/include/vsg/utils/AnimationPath.h index 0db842ca6..9ba538bd6 100644 --- a/include/vsg/utils/AnimationPath.h +++ b/include/vsg/utils/AnimationPath.h @@ -59,7 +59,7 @@ namespace vsg VSG_type_name(vsg::AnimationPath); /// AnimationPathHandler event handler animates Camera or MatrixTransform along an AnimationPath. - /// To automatically update attach the AnimationPathHandler to the viewer using Viewer::addEventHandler(). + /// To automatically update, attach the AnimationPathHandler to the viewer using Viewer::addEventHandler(). class VSG_DECLSPEC AnimationPathHandler : public Inherit { public: diff --git a/include/vsg/utils/Builder.h b/include/vsg/utils/Builder.h index 962a6ee2c..391632045 100644 --- a/include/vsg/utils/Builder.h +++ b/include/vsg/utils/Builder.h @@ -30,8 +30,8 @@ namespace vsg bool greyscale = false; /// greyscale image bool wireframe = false; bool instance_colors_vec4 = true; - bool instance_positions_vec3 = false; // user must assign GeometyInfo.position with vec3Array containing positions - bool billboard = false; // user must assign GeometyInfo.position with vec4Array containing position_scaleDistance, overrides instance_positions_vec3 setting + bool instance_positions_vec3 = false; // user must assign GeometryInfo::positions with vec3Array containing positions + bool billboard = false; // user must assign GeometryInfo::positions with vec4Array containing position_scaleDistance, overrides instance_positions_vec3 setting ref_ptr image; ref_ptr displacementMap; @@ -75,7 +75,7 @@ namespace vsg dz.set(0.0f, 0.0f, sp.radius * 2.0f); } - /// when using geometry instancing use vec3Array with vec3{x,y,z} and for billboard use vec4Array with vec4{x,y,z,scaleDistance} + /// when using geometry instancing use vec3Array with vec3{x,y,z} and for billboards use vec4Array with vec4{x,y,z,scaleDistance} ref_ptr positions; ref_ptr colors; @@ -92,7 +92,7 @@ namespace vsg /// Builder class that creates subgraphs that can render primitive geometries. /// Supported shapes are Box, Capsule, Cone, Cylinder, Disk, Quad, Sphere and HeightField. - /// Uses GeometryInfo and StateInfo to guide the geometry position/size and rendering state. + /// Uses GeometryInfo and StateInfo to guide the geometry's position/size and rendering state. class VSG_DECLSPEC Builder : public Inherit { public: diff --git a/include/vsg/utils/CommandLine.h b/include/vsg/utils/CommandLine.h index 150ae3cd6..370b2d851 100644 --- a/include/vsg/utils/CommandLine.h +++ b/include/vsg/utils/CommandLine.h @@ -38,7 +38,7 @@ namespace vsg // forward declare class Options; - /// CommandLine provides a convenient way parse command line arguments. + /// CommandLine provides a convenient way to parse command line arguments. /// Almost all examples in vsgExamples use vsg::CommandLine so look to them for a usage guide. class VSG_DECLSPEC CommandLine { diff --git a/include/vsg/utils/GraphicsPipelineConfigurator.h b/include/vsg/utils/GraphicsPipelineConfigurator.h index 91a19d426..313634590 100644 --- a/include/vsg/utils/GraphicsPipelineConfigurator.h +++ b/include/vsg/utils/GraphicsPipelineConfigurator.h @@ -96,11 +96,11 @@ namespace vsg ref_ptr depthStencilState; ref_ptr dynamicState; ref_ptr inputAssemblyState; - ref_ptr multisampleState; // typically leave unset as compile traversal with provide MultisampleState + ref_ptr multisampleState; // typically leave unset as compile traversal will provide MultisampleState ref_ptr rasterizationState; ref_ptr tessellationState; ref_ptr vertexInputState; // set by assignArray(..) methods. - ref_ptr viewportState; // typically leave unset as compile traversal with provide ViewportState + ref_ptr viewportState; // typically leave unset as compile traversal will provide ViewportState uint32_t subpass = 0; uint32_t baseAttributeBinding = 0; @@ -135,7 +135,7 @@ namespace vsg }; VSG_type_name(vsg::GraphicsPipelineConfigurator); - /// provide for backwards compatibility + /// provided for backwards compatibility using GraphicsPipelineConfig = GraphicsPipelineConfigurator; using DescriptorConfig = DescriptorConfigurator; diff --git a/include/vsg/utils/Intersector.h b/include/vsg/utils/Intersector.h index 9159b7aa5..d1fdf2255 100644 --- a/include/vsg/utils/Intersector.h +++ b/include/vsg/utils/Intersector.h @@ -62,7 +62,7 @@ namespace vsg virtual void popTransform() = 0; - /// check for intersection intersects with sphere + /// check for intersection with sphere virtual bool intersects(const dsphere& sphere) = 0; /// intersect with a vkCmdDraw primitive diff --git a/include/vsg/utils/LineSegmentIntersector.h b/include/vsg/utils/LineSegmentIntersector.h index 7fff85316..48ecd70a9 100644 --- a/include/vsg/utils/LineSegmentIntersector.h +++ b/include/vsg/utils/LineSegmentIntersector.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// IndexRatio is a pair of index and ratio used specify the baricentric coords of primitives that have been intersected. + /// IndexRatio is a pair of index and ratio used to specify the baricentric coords of primitives that have been intersected. struct IndexRatio { uint32_t index; @@ -27,7 +27,7 @@ namespace vsg using IndexRatios = std::vector; - /// LineSegmentIntersector is a Intersector subclass that provides support for computing intersections between a line segment and geometry in the scene graph. + /// LineSegmentIntersector is an Intersector subclass that provides support for computing intersections between a line segment and geometry in the scene graph. class VSG_DECLSPEC LineSegmentIntersector : public Inherit { public: @@ -62,7 +62,7 @@ namespace vsg void pushTransform(const Transform& transform) override; void popTransform() override; - /// check for intersection intersects with sphere + /// check for intersection with sphere bool intersects(const dsphere& bs) override; bool intersectDraw(uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount) override; diff --git a/include/vsg/utils/LoadPagedLOD.h b/include/vsg/utils/LoadPagedLOD.h index 152ad53cd..6af27574a 100644 --- a/include/vsg/utils/LoadPagedLOD.h +++ b/include/vsg/utils/LoadPagedLOD.h @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - //** Traverse the scene graph loading any PLOD that are required for a camera view.*/ + // Traverse the scene graph loading any PLOD that are required for a camera view. class VSG_DECLSPEC LoadPagedLOD : public vsg::Visitor { public: diff --git a/include/vsg/utils/ShaderCompiler.h b/include/vsg/utils/ShaderCompiler.h index 38a8b21b7..fd623ebc6 100644 --- a/include/vsg/utils/ShaderCompiler.h +++ b/include/vsg/utils/ShaderCompiler.h @@ -9,8 +9,8 @@ namespace vsg /// ShaderCompiler integrates with GLSLang to provide shader compilation from GLSL shaders to SPIRV shaders usable by Vulkan. /// To be able to compile GLSL the VulkanSceneGraph has to be compiled against GLSLang, you can check whether shader compilation - /// is supported via the VSG_SUPPORTS_ShaderCompiler #define provided in include/core/Version.h, if the value 1 then shader compilation - /// is support. You can also check the ShaderCompile::supported() method. + /// is supported via the VSG_SUPPORTS_ShaderCompiler #define provided in include/core/Version.h, if the value is 1 then shader compilation + /// is supported. You can also check the ShaderCompiler::supported() method. class VSG_DECLSPEC ShaderCompiler : public Inherit { public: diff --git a/include/vsg/utils/ShaderSet.h b/include/vsg/utils/ShaderSet.h index 04de004c9..725a427f6 100644 --- a/include/vsg/utils/ShaderSet.h +++ b/include/vsg/utils/ShaderSet.h @@ -88,7 +88,7 @@ namespace vsg }; VSG_type_name(vsg::CustomDescriptorSetBinding); - /// Custom state binding class for providing the DescriptorSetLayout and StateCommaand required to pass view depedent data, lights/shaders etc., to shaders + /// Custom state binding class for providing the DescriptorSetLayout and StateCommand required to pass view dependent data, lights/shadows etc., to shaders struct VSG_DECLSPEC ViewDependentStateBinding : public Inherit { ViewDependentStateBinding(uint32_t in_set = 0); @@ -105,14 +105,14 @@ namespace vsg }; VSG_type_name(vsg::ViewDependentStateBinding); - /// ShaderSet provides collection of shader related settings to provide a form of shader introspection. + /// ShaderSet provides a collection of shader related settings to provide a form of shader introspection. class VSG_DECLSPEC ShaderSet : public Inherit { public: ShaderSet(); explicit ShaderSet(const ShaderStages& in_stages, ref_ptr in_hints = {}); - /// base ShaderStages that other variants as based on. + /// base ShaderStages that other variants are based on. ShaderStages stages; std::vector attributeBindings; @@ -127,7 +127,7 @@ namespace vsg /// variants of the rootShaderModule compiled for different combinations of ShaderCompileSettings std::map, ShaderStages, DereferenceLess> variants; - /// mutex used be getShaderStages(..) so ensure the variants map can be used from multiple threads. + /// mutex used by getShaderStages(..) to ensure the variants map can be used from multiple threads. std::mutex mutex; /// add an attribute binding, Not thread safe, should only be called when initially setting up the ShaderSet @@ -136,7 +136,7 @@ namespace vsg /// add an uniform binding. Not thread safe, should only be called when initially setting up the ShaderSet void addUniformBinding(std::string name, std::string define, uint32_t set, uint32_t binding, VkDescriptorType descriptorType, uint32_t descriptorCount, VkShaderStageFlags stageFlags, ref_ptr data); - /// add an uniform binding. Not thread safe, should only be called when initially setting up the ShaderSet + /// add a push constant range. Not thread safe, should only be called when initially setting up the ShaderSet void addPushConstantRange(std::string name, std::string define, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size); /// get the AttributeBinding associated with name @@ -157,16 +157,16 @@ namespace vsg /// get the ShaderStages variant that uses specified ShaderCompileSettings. ShaderStages getShaderStages(ref_ptr scs = {}); - /// return the range of set numbers encompassed UniformBindings + /// return the range of set numbers encompassing UniformBindings std::pair descriptorSetRange() const; - /// create the descritor set layout. + /// create the descriptor set layout. virtual ref_ptr createDescriptorSetLayout(const std::set& defines, uint32_t set) const; /// create the pipeline layout for all descriptor sets enabled by specified defines or required by default. inline ref_ptr createPipelineLayout(const std::set& defines) { return createPipelineLayout(defines, descriptorSetRange()); } - /// create pipeline layout for specified range {minimum_set, maxiumum_set+1> of descriptor sets that are enabled by specified defines or required by default. + /// create pipeline layout for specified range of descriptor sets that are enabled by specified defines or required by default. /// /// Note: the underlying Vulkan call vkCreatePipelineLayout assumes that the array of /// descriptor sets starts with set 0. Therefore the minimum_set argument should be 0 unless diff --git a/include/vsg/utils/SharedObjects.h b/include/vsg/utils/SharedObjects.h index a0dd2be79..e06693a91 100644 --- a/include/vsg/utils/SharedObjects.h +++ b/include/vsg/utils/SharedObjects.h @@ -27,7 +27,7 @@ namespace vsg // forward declare class SuitableForSharing; - /// class for facilitating the share of instances of objects that have the same properties. + /// class for facilitating the sharing of instances of objects that have the same properties. class VSG_DECLSPEC SharedObjects : public Inherit { public: @@ -45,19 +45,19 @@ namespace vsg template void share(C& container); - /// visitor that checks a loaded object, and it's children whether it is suitable for sharing in SharedObjects + /// visitor that checks a loaded object and its children for suitability for sharing in SharedObjects ref_ptr suitableForSharing; /// set of lower case file extensions for file types that should not be included in this SharedObjects std::set excludedExtensions; - /// return true if the filename is of a type suitable for inclusion this SharedObjects + /// return true if the filename is of a type suitable for inclusion in this SharedObjects virtual bool suitable(const Path& filename) const; /// check for an entry associated with filename. virtual bool contains(const Path& filename, ref_ptr options = {}) const; - /// add entry that matches filename and option. + /// add entry that matches filename and options. virtual void add(ref_ptr object, const Path& filename, ref_ptr options = {}); /// remove entry associated with filename. @@ -66,7 +66,7 @@ namespace vsg /// clear all the internal structures leaving no Objects cached. void clear(); - // clear all the singly referenced objects + // clear all the singularly referenced objects void prune(); /// write out stats of objects held, types of objects and their reference counts @@ -81,7 +81,7 @@ namespace vsg }; VSG_type_name(vsg::SharedObjects); - /// Helper class for support sharing of objects loaded from files. + /// Helper class for sharing of objects loaded from files. class VSG_DECLSPEC LoadedObject : public Inherit { public: @@ -99,11 +99,11 @@ namespace vsg VSG_type_name(vsg::LoadedObject); /// Helper class for deciding whether sharing is permitted for this type - required to avoid circular references - /// If an object that is put forward to be shared via the SharedObjects container then it can't contain any references to vsg::Options & associated SharedOjbjects + /// If an object is put forward to be shared via the SharedObjects container then it can't contain any references to vsg::Options & associated SharedObjects /// otherwise a circular reference can be created that prevents all the objects in the circular reference chain from being deleted. Such objects must - /// be prevent from inclusion in the SharedObejcts. An example of class not suitable is vsg::PagedLOD as it has an options member. If your subclasses are - /// like PagedLOD and might create a circular reference when using with SharedOjbects then you should subclass from SuitableForSharing and add support - /// for your class and when instances are found set the suitableForSharing flag to false, and then assign this to the SharedOjbects container so that + /// be prevented from inclusion in the SharedObejcts. An example of a class not suitable is vsg::PagedLOD as it has an options member. If your subclasses are + /// like PagedLOD and might create a circular reference when using with SharedObjects then you should subclass from SuitableForSharing and add support + /// for your class and when instances are found set the suitableForSharing flag to false, and then assign this to the SharedObjects container so that /// it can make sure it's not treated as suitable for inclusions. class VSG_DECLSPEC SuitableForSharing : public Inherit { diff --git a/include/vsg/vk/Context.h b/include/vsg/vk/Context.h index 0c0f89e40..dd02ac43b 100644 --- a/include/vsg/vk/Context.h +++ b/include/vsg/vk/Context.h @@ -37,7 +37,7 @@ namespace vsg class View; class ViewDependentState; - /// Helper command for settings up RayTracing structures. + /// Helper command for setting up RayTracing structures. class VSG_DECLSPEC BuildAccelerationStructureCommand : public Inherit { public: @@ -79,7 +79,7 @@ namespace vsg uint32_t viewID = 0; ViewDependentState* viewDependentState = nullptr; - /// get existing ShaderCompile or create a new one when GLSLang is supported + /// get existing ShaderCompiler or create a new one when GLSLang is supported ShaderCompiler* getOrCreateShaderCompiler(); ref_ptr getOrCreateCommandBuffer(); diff --git a/include/vsg/vk/DescriptorPool.h b/include/vsg/vk/DescriptorPool.h index 3d772aafb..92d4675f0 100644 --- a/include/vsg/vk/DescriptorPool.h +++ b/include/vsg/vk/DescriptorPool.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DesctiporPool encapsulates management of VkDescriptorPool + /// DescriptorPool encapsulates management of VkDescriptorPool class VSG_DECLSPEC DescriptorPool : public Inherit { public: @@ -32,15 +32,15 @@ namespace vsg /// allocate or reuse available DescriptorSet::Implementation - called automatically when compiling DescriptorSet ref_ptr allocateDescriptorSet(DescriptorSetLayout* descriptorSetLayout); - /// free DescriptorSet::Implementation for reuse - called automatically be destruction of DescriptorSet or release of it's Vulkan resources. + /// free DescriptorSet::Implementation for reuse - called automatically by destruction of DescriptorSet or release of its Vulkan resources. void freeDescriptorSet(ref_ptr dsi); /// get the stats of the available DescriptorSets/Descriptors bool getAvailability(uint32_t& maxSets, DescriptorPoolSizes& descriptorPoolSizes) const; - /// mutex used to ensure thead safe access of DesciptorPool resources. - /// Locked automatically by allocatoeDecstiproSet(..), freeDescriptorSet(), getAvailability() and DescriptorSet:::Implementation - /// to ensure thread safe operation. Normal VulkanSceneGraph usage will not require users to lock this mutex so threat as an internal implementation detail. + /// mutex used to ensure thread safe access of DescriptorPool resources. + /// Locked automatically by allocateDescriptorSet(..), freeDescriptorSet(), getAvailability() and DescriptorSet:::Implementation + /// to ensure thread safe operation. Normal VulkanSceneGraph usage will not require users to lock this mutex so treat as an internal implementation detail. mutable std::mutex mutex; protected: diff --git a/include/vsg/vk/Device.h b/include/vsg/vk/Device.h index 16064bdc0..8273cd9a4 100644 --- a/include/vsg/vk/Device.h +++ b/include/vsg/vk/Device.h @@ -32,7 +32,7 @@ namespace vsg using QueueSettings = std::vector; - /// Device encapsulate vkDeivce, a logical handle to the PhysicalDevice with capabilities specified during construction. + /// Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified during construction. class VSG_DECLSPEC Device : public Inherit { public: diff --git a/include/vsg/vk/DeviceFeatures.h b/include/vsg/vk/DeviceFeatures.h index ed9f0baac..925bd2500 100644 --- a/include/vsg/vk/DeviceFeatures.h +++ b/include/vsg/vk/DeviceFeatures.h @@ -18,8 +18,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// DeviceFeatures is a container class for setting up Vulkan features structures to be passed in vsg::Device creation. - /// Automatically deletes associated created feature structures on destructions. + /// DeviceFeatures is a container class for setting up Vulkan feature structures to be passed in vsg::Device creation. + /// Automatically deletes associated created feature structures on destruction. class VSG_DECLSPEC DeviceFeatures : public Inherit { public: diff --git a/include/vsg/vk/Framebuffer.h b/include/vsg/vk/Framebuffer.h index cfdd05172..f9daca028 100644 --- a/include/vsg/vk/Framebuffer.h +++ b/include/vsg/vk/Framebuffer.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Framebuffer encapsulates vkFramebuffer used a rendering target associated with Window or for render to texture + /// Framebuffer encapsulates VkFramebuffer, used as a rendering target associated with a Window or for render to texture class VSG_DECLSPEC Framebuffer : public Inherit { public: diff --git a/include/vsg/vk/Instance.h b/include/vsg/vk/Instance.h index 75c09883a..2b8fce3c6 100644 --- a/include/vsg/vk/Instance.h +++ b/include/vsg/vk/Instance.h @@ -37,13 +37,13 @@ namespace vsg /// return names of layers that are supported from the desired list. extern VSG_DECLSPEC Names validateInstancelayerNames(const Names& names); - /// Instance encapsulate the vkInstance. + /// Instance encapsulates the VkInstance. class VSG_DECLSPEC Instance : public Inherit { public: Instance(Names instanceExtensions, Names layers, uint32_t vulkanApiVersion = VK_API_VERSION_1_0, AllocationCallbacks* allocator = nullptr); - /// Vulkan apiVersion used when creating the VkInstaance + /// Vulkan apiVersion used when creating the VkInstance const uint32_t apiVersion = VK_API_VERSION_1_0; operator VkInstance() const { return _instance; } diff --git a/include/vsg/vk/MemoryBufferPools.h b/include/vsg/vk/MemoryBufferPools.h index 7b293c526..329672a4f 100644 --- a/include/vsg/vk/MemoryBufferPools.h +++ b/include/vsg/vk/MemoryBufferPools.h @@ -23,7 +23,7 @@ namespace vsg { /// MemoryBufferPools manages a pool of vsg::DeviceMemory and vsg::Buffer that use them. - /// Methods are providing for getting Buffer from the pool, sharing memory to make better use of device memory. + /// Methods are provided for getting Buffer from the pool, sharing memory to make better use of device memory. class VSG_DECLSPEC MemoryBufferPools : public Inherit { public: diff --git a/include/vsg/vk/PhysicalDevice.h b/include/vsg/vk/PhysicalDevice.h index 1dbef8b05..36fbb7e12 100644 --- a/include/vsg/vk/PhysicalDevice.h +++ b/include/vsg/vk/PhysicalDevice.h @@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { /// PhysicalDevice encapsulates VkPhysicalDevice - /// Maps to a Vulkan capable physical device, like a dedicated graphics car or integrated GPU. + /// Maps to a Vulkan capable physical device, like a dedicated graphics card or integrated GPU. class VSG_DECLSPEC PhysicalDevice : public Inherit { public: diff --git a/include/vsg/vk/RenderPass.h b/include/vsg/vk/RenderPass.h index c52522824..dd9af0cbb 100644 --- a/include/vsg/vk/RenderPass.h +++ b/include/vsg/vk/RenderPass.h @@ -74,7 +74,7 @@ namespace vsg /// multiview support requires Vulkan 1.2 or later. uint32_t viewMask = 0; - /// maps to VkSubpassDescriptionDepthStencilResolve, requires Vulkan 1.2 or later. + /// maps to VkSubpassDescriptionDepthStencilResolve, requires Vulkan 1.2 or later or an extension. VkResolveModeFlagBits depthResolveMode = VK_RESOLVE_MODE_NONE; VkResolveModeFlagBits stencilResolveMode = VK_RESOLVE_MODE_NONE; std::vector depthStencilResolveAttachments; @@ -102,8 +102,8 @@ namespace vsg const Dependencies dependencies; const CorrelatedViewMasks correlatedViewMasks; - /// Maximum VkAttachmentDescription.samples value of the assigned attachments. - /// Used for be deciding if multisampling is required and the value to use when setting up the GraphicsPipeline's vsg::MultisampleState + /// Maximum VkAttachmentDescription::samples value of the assigned attachments. + /// Used for deciding if multisampling is required and the value to use when setting up the GraphicsPipeline's vsg::MultisampleState const VkSampleCountFlagBits maxSamples; protected: diff --git a/include/vsg/vk/ResourceRequirements.h b/include/vsg/vk/ResourceRequirements.h index c8de509fd..3c27c5438 100644 --- a/include/vsg/vk/ResourceRequirements.h +++ b/include/vsg/vk/ResourceRequirements.h @@ -25,7 +25,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// ResourceRequirements provides a container for various Vulkan resource requirements that be used to help guide allocation of resources. + /// ResourceRequirements provides a container for various Vulkan resource requirements that can be used to help guide allocation of resources. class VSG_DECLSPEC ResourceRequirements { public: diff --git a/include/vsg/vk/Semaphore.h b/include/vsg/vk/Semaphore.h index 1f79432a3..14ce5438c 100644 --- a/include/vsg/vk/Semaphore.h +++ b/include/vsg/vk/Semaphore.h @@ -16,7 +16,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// Semaphore encapsulates VkSemaphore that is used to synchronize completion of vulkan commands with start of other vulkan command submissions. + /// Semaphore encapsulates VkSemaphore that is used to synchronize completion of vulkan commands with the start of other vulkan command submissions. class VSG_DECLSPEC Semaphore : public Inherit { public: diff --git a/include/vsg/vk/State.h b/include/vsg/vk/State.h index cef0fcb45..4961bc4f8 100644 --- a/include/vsg/vk/State.h +++ b/include/vsg/vk/State.h @@ -71,7 +71,7 @@ namespace vsg } }; - /// MatrixStack used internally by vsg::State to manage stack of project or modelview matrices + /// MatrixStack used internally by vsg::State to manage stack of projection or modelview matrices class MatrixStack { public: @@ -223,7 +223,7 @@ namespace vsg } }; - /// vsg::State used by vsg::RecordTraversal to manage state stacks, projection, modelview matrix and frustum stacks. + /// vsg::State is used by vsg::RecordTraversal to manage state stacks, projection and modelview matrices and frustum stacks. class State : public Inherit { public: diff --git a/include/vsg/vk/SubmitCommands.h b/include/vsg/vk/SubmitCommands.h index d66c84a6d..87a27d084 100644 --- a/include/vsg/vk/SubmitCommands.h +++ b/include/vsg/vk/SubmitCommands.h @@ -55,7 +55,7 @@ namespace vsg } } - /// convenience template function for submitting Vulkan commands to a queue and wait for completion. + /// convenience template function for submitting Vulkan commands to a queue and waiting for completion. template void submitCommandsToQueue(CommandPool* commandPool, Queue* queue, F function) { diff --git a/include/vsg/vk/Surface.h b/include/vsg/vk/Surface.h index 8826fb6c1..61455b58b 100644 --- a/include/vsg/vk/Surface.h +++ b/include/vsg/vk/Surface.h @@ -29,7 +29,7 @@ namespace vsg Instance* getInstance() { return _instance; } const Instance* getInstance() const { return _instance; } - /// Release the VkSurfaceKHR so it's no longer managed this vsg::Surface object, caller/3rd party libs are subsequently responsible for deletion of the VkSurfaceKHR. + /// Release the VkSurfaceKHR so it's no longer managed by this vsg::Surface object, caller/3rd party libs are subsequently responsible for deletion of the VkSurfaceKHR. /// This method should only be called when adapting the VulkanSceneGraph to work with 3rd party Vulkan creation, /// in normal usage this method should not be called as the VkSurfaceKHR will be cleaned up safely and automatically in the destructor when the vsg::Surface is deleted. void release() diff --git a/include/vsg/vk/vk_buffer.h b/include/vsg/vk/vk_buffer.h index bf4042ce6..5877fb71e 100644 --- a/include/vsg/vk/vk_buffer.h +++ b/include/vsg/vk/vk_buffer.h @@ -22,7 +22,7 @@ namespace vsg #if VSG_MAX_DEVICES <= 1 - /// vk_buffer that manages a single logical device support. + /// vk_buffer that manages a single logical device supported. template struct vk_buffer { diff --git a/src/vsg/CMakeLists.txt b/src/vsg/CMakeLists.txt index dbe8cf838..e26b82e3c 100644 --- a/src/vsg/CMakeLists.txt +++ b/src/vsg/CMakeLists.txt @@ -322,7 +322,7 @@ if(MSVC) SET_OUTPUT_DIR_PROPERTY(vsg "") - option(ENABLE_MP_FLAG "Turning on this option will add the multi-processor flag in MSVC for VSG and it's included projects" ON) + option(ENABLE_MP_FLAG "Turning on this option will add the multi-processor flag in MSVC for VSG and its included projects" ON) if(ENABLE_MP_FLAG) target_compile_options(vsg PRIVATE "/MP") diff --git a/src/vsg/app/CommandGraph.cpp b/src/vsg/app/CommandGraph.cpp index 2776714f0..c4ff88f8c 100644 --- a/src/vsg/app/CommandGraph.cpp +++ b/src/vsg/app/CommandGraph.cpp @@ -98,7 +98,7 @@ void CommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_ptrview.ref_ptr(); if (context_view && context_view.get() != &view) continue; diff --git a/src/vsg/app/RecordAndSubmitTask.cpp b/src/vsg/app/RecordAndSubmitTask.cpp index 1f3aba273..a52d68796 100644 --- a/src/vsg/app/RecordAndSubmitTask.cpp +++ b/src/vsg/app/RecordAndSubmitTask.cpp @@ -68,7 +68,7 @@ size_t RecordAndSubmitTask::index(size_t relativeFrameIndex) const return relativeFrameIndex < _indices.size() ? _indices[relativeFrameIndex] : _indices.size(); } -/// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) return the previous frame's Fence etc. +/// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) returns the previous frame's Fence etc. Fence* RecordAndSubmitTask::fence(size_t relativeFrameIndex) { size_t i = index(relativeFrameIndex); @@ -254,7 +254,7 @@ void vsg::updateTasks(RecordAndSubmitTasks& tasks, ref_ptr compi } } - /// handle any need Bin needs + /// handle any new Bin needs for (auto& [const_view, binDetails] : compileResult.views) { auto view = const_cast(const_view); diff --git a/src/vsg/app/RecordTraversal.cpp b/src/vsg/app/RecordTraversal.cpp index 828e3140c..f7a4821c7 100644 --- a/src/vsg/app/RecordTraversal.cpp +++ b/src/vsg/app/RecordTraversal.cpp @@ -213,7 +213,7 @@ void RecordTraversal::apply(const PagedLOD& plod) auto previousRequestCount = plod.requestCount.fetch_add(1); if (previousRequestCount == 0) { - // we are first request so tell the databasePager about it + // we are the first request so tell the databasePager about it _databasePager->request(ref_ptr(const_cast(&plod))); } else diff --git a/src/vsg/app/RenderGraph.cpp b/src/vsg/app/RenderGraph.cpp index 59b24902f..dfb9a797d 100644 --- a/src/vsg/app/RenderGraph.cpp +++ b/src/vsg/app/RenderGraph.cpp @@ -142,7 +142,7 @@ void RenderGraph::accept(RecordTraversal& recordTraversal) const VkCommandBuffer vk_commandBuffer = *(recordTraversal.getState()->_commandBuffer); vkCmdBeginRenderPass(vk_commandBuffer, &renderPassInfo, contents); - // traverse the command buffer to place the commands into the command buffer. + // traverse the subgraph to place commands into the command buffer. traverse(recordTraversal); vkCmdEndRenderPass(vk_commandBuffer); diff --git a/src/vsg/app/SecondaryCommandGraph.cpp b/src/vsg/app/SecondaryCommandGraph.cpp index fee16314c..ee9acea89 100644 --- a/src/vsg/app/SecondaryCommandGraph.cpp +++ b/src/vsg/app/SecondaryCommandGraph.cpp @@ -104,7 +104,7 @@ void SecondaryCommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_p // or select index when maps to a dormant CommandBuffer VkCommandBuffer vk_commandBuffer = *commandBuffer; - // need to set up the command + // need to set up the command buffer // if we are nested within a CommandBuffer already then use VkCommandBufferInheritanceInfo VkCommandBufferBeginInfo beginInfo = {}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; diff --git a/src/vsg/app/TransferTask.cpp b/src/vsg/app/TransferTask.cpp index 65f497e5f..547ae2991 100644 --- a/src/vsg/app/TransferTask.cpp +++ b/src/vsg/app/TransferTask.cpp @@ -62,7 +62,7 @@ size_t TransferTask::index(size_t relativeFrameIndex) const return relativeFrameIndex < _indices.size() ? _indices[relativeFrameIndex] : _indices.size(); } -/// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) return the previous frame's Fence etc. +/// fence() and fence(0) return the Fence for the frame currently being rendered, fence(1) returns the previous frame's Fence etc. Fence* TransferTask::fence(size_t relativeFrameIndex) { size_t i = index(relativeFrameIndex); diff --git a/src/vsg/app/View.cpp b/src/vsg/app/View.cpp index 74708206d..6e17e1417 100644 --- a/src/vsg/app/View.cpp +++ b/src/vsg/app/View.cpp @@ -16,7 +16,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI using namespace vsg; -// thread safe container for managing the deviceID for each vsg;:View +// thread safe container for managing the deviceID for each vsg::View static std::mutex s_ViewCountMutex; static std::vector s_ActiveViews; diff --git a/src/vsg/app/Viewer.cpp b/src/vsg/app/Viewer.cpp index dacc9396b..e883cc204 100644 --- a/src/vsg/app/Viewer.cpp +++ b/src/vsg/app/Viewer.cpp @@ -80,7 +80,7 @@ void Viewer::removeWindow(ref_ptr window) _windows.erase(itr); - // create a a new list of ComnandGraphs not associated with removed window + // create a new list of CommandGraphs not associated with removed window CommandGraphs commandGraphs; for (auto& task : recordAndSubmitTasks) { @@ -115,7 +115,7 @@ bool Viewer::active() const if (!viewerIsActive) { - // don't exit mainloop while the any devices are still active + // don't exit mainloop while any devices are still active deviceWaitIdle(); return false; } @@ -254,7 +254,7 @@ void Viewer::compile(ref_ptr hints) vsg::ref_ptr compile; }; - // find which devices are available and the resources required for then, + // find which devices are available and the resources required for them using DeviceResourceMap = std::map, DeviceResources>; DeviceResourceMap deviceResourceMap; for (auto& task : recordAndSubmitTasks) @@ -348,7 +348,7 @@ void Viewer::compile(ref_ptr hints) } } - // assign dynamic data to transfer trask + // assign dynamic data to transfer tasks for (auto& task : recordAndSubmitTasks) { auto& deviceResource = deviceResourceMap[task->device]; @@ -488,7 +488,7 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr } else { - // with don't have a presentFamily so this set of commandGraphs aren't associated with a window + // we don't have a presentFamily so this set of commandGraphs aren't associated with a window // set up Submission with CommandBuffer and signals auto recordAndSubmitTask = vsg::RecordAndSubmitTask::create(device, numBuffers); recordAndSubmitTask->commandGraphs = commandGraphs; @@ -518,7 +518,7 @@ void Viewer::addRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs) // add the new CommandGraphs combinedCommandGraphs.insert(combinedCommandGraphs.end(), commandGraphs.begin(), commandGraphs.end()); - // assign the combined CommanGraphs + // assign the combined CommandGraphs assignRecordAndSubmitTaskAndPresentation(combinedCommandGraphs); } @@ -618,7 +618,7 @@ void Viewer::setupThreading() data->recordCompletedBarrier->arrive_and_wait(); - // primary thread finishes the task, submitting all the command buffers recorded by the primary and all secondary threads to it's queue + // primary thread finishes the task, submitting all the command buffers recorded by the primary and all secondary threads to its queue CommandBuffers localRecordedCommandBuffers; for (const auto& commandBuffers : data->orderedRecordedCommandBuffers) localRecordedCommandBuffers.insert(localRecordedCommandBuffers.end(), commandBuffers.begin(), commandBuffers.end()); @@ -724,9 +724,9 @@ void Viewer::recordAndSubmit() #if 1 if (_threading) #else - // follows is a workaround for an odd "Possible data race during write of size 1" warning that valgrind tool=helgrind reports - // on the first call to vkBeginCommandBuffer despite them being done on independent command buffers. This could well be a driver bug or a false position. - // if you want to quiet this warning then change the #if above to #if 0 as render the first three frames single threaded avoids the warning. + // The following is a workaround for an odd "Possible data race during write of size 1" warning that valgrind tool=helgrind reports + // on the first call to vkBeginCommandBuffer despite them being done on independent command buffers. This could well be a driver bug or a false positive. + // If you want to quieten this warning then change the #if above to #if 0 as rendering the first three frames single threaded avoids the warning. if (_threading && _frameStamp->frameCount > 2) #endif { diff --git a/src/vsg/app/Window.cpp b/src/vsg/app/Window.cpp index 878162457..0a3b19545 100644 --- a/src/vsg/app/Window.cpp +++ b/src/vsg/app/Window.cpp @@ -262,7 +262,7 @@ void Window::buildSwapchain() { if (_swapchain) { - // make sure all operations on the device have stopped before we go deleting associated resources + // make sure all operations on the device have stopped before we go on deleting associated resources vkDeviceWaitIdle(*_device); // clean up previous swap chain before we begin creating a new one. @@ -276,7 +276,7 @@ void Window::buildSwapchain() _multisampleImageView.reset(); } - // is width and height even required here as the surface appear to control it. + // is width and height even required here as the surface appears to control it? _swapchain = Swapchain::create(_physicalDevice, _device, _surface, _extent2D.width, _extent2D.height, _traits->swapchainPreferences, _swapchain); // pass back the extents used by the swap chain. @@ -430,7 +430,7 @@ VkResult Window::acquireNextImage(uint64_t timeout) if (!_availableSemaphore) _availableSemaphore = vsg::Semaphore::create(_device, _traits->imageAvailableSemaphoreWaitFlag); - // check the dimensions of the swapchain and window extents are consistent, if nit return a VK_ERROR_OUT_OF_DATE_KHR; + // check the dimensions of the swapchain and window extents are consistent, if not return a VK_ERROR_OUT_OF_DATE_KHR if (_swapchain->getExtent() != _extent2D) return VK_ERROR_OUT_OF_DATE_KHR; uint32_t imageIndex; @@ -438,7 +438,7 @@ VkResult Window::acquireNextImage(uint64_t timeout) if (result == VK_SUCCESS) { - // the acquired image's semaphore must be available now so make it the new _availableSemaphore and set it's entry to the one to use of the next frame by swapping ref_ptr<>'s + // the acquired image's semaphore must be available now so make it the new _availableSemaphore and set its entry to the one to use for the next frame by swapping ref_ptr<>'s _availableSemaphore.swap(_frames[imageIndex].imageAvailableSemaphore); // shift up previous frame indices diff --git a/src/vsg/app/WindowTraits.cpp b/src/vsg/app/WindowTraits.cpp index 32ac1527b..fc6f809a7 100644 --- a/src/vsg/app/WindowTraits.cpp +++ b/src/vsg/app/WindowTraits.cpp @@ -87,7 +87,7 @@ void WindowTraits::defaults() vkEnumerateInstanceVersion(&vulkanVersion); #endif - // vsg::DeviceFeatures use instance extension + // vsg::DeviceFeatures uses the instance extension instanceExtensionNames.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); // provide anisotropic filtering as standard. diff --git a/src/vsg/commands/CopyImageViewToWindow.cpp b/src/vsg/commands/CopyImageViewToWindow.cpp index 6dd436b48..8a217f282 100644 --- a/src/vsg/commands/CopyImageViewToWindow.cpp +++ b/src/vsg/commands/CopyImageViewToWindow.cpp @@ -35,7 +35,7 @@ void CopyImageViewToWindow::record(CommandBuffer& commandBuffer) const imageView->image, VkImageSubresourceRange{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}); - auto ibm_transitionStorageImageToReadSrc = vsg::ImageMemoryBarrier::create( + auto imb_transitionStorageImageToReadSrc = vsg::ImageMemoryBarrier::create( 0, VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, @@ -46,7 +46,7 @@ void CopyImageViewToWindow::record(CommandBuffer& commandBuffer) const VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, imb_transitionSwapChainToWriteDest, - ibm_transitionStorageImageToReadSrc); + imb_transitionStorageImageToReadSrc); pb_transitionStorageImageToReadSrc->record(commandBuffer); diff --git a/src/vsg/core/Allocator.cpp b/src/vsg/core/Allocator.cpp index 509cc8d40..0cd863ec0 100644 --- a/src/vsg/core/Allocator.cpp +++ b/src/vsg/core/Allocator.cpp @@ -103,7 +103,7 @@ void* Allocator::allocate(std::size_t size, AllocatorAffinity allocatorAffinity) return std::malloc(size); } - // create an MemoryBlocks entry if one doesn't already exist + // create a MemoryBlocks entry if one doesn't already exist if (allocatorAffinity > allocatorMemoryBlocks.size()) { if (memoryTracking & MEMORY_TRACKING_REPORT_ACTIONS) diff --git a/src/vsg/core/ConstVisitor.cpp b/src/vsg/core/ConstVisitor.cpp index b3b32cc9f..647e12119 100644 --- a/src/vsg/core/ConstVisitor.cpp +++ b/src/vsg/core/ConstVisitor.cpp @@ -633,7 +633,7 @@ void ConstVisitor::apply(const TextLayout& value) //////////////////////////////////////////////////////////////////////////////// // -// Vulkan Object +// Vulkan Objects // void ConstVisitor::apply(const BufferInfo& value) { diff --git a/src/vsg/core/Object.cpp b/src/vsg/core/Object.cpp index a46ad81fa..4418cf6de 100644 --- a/src/vsg/core/Object.cpp +++ b/src/vsg/core/Object.cpp @@ -34,7 +34,7 @@ Object::Object(const Object& rhs) : { if (rhs._auxiliary && rhs._auxiliary->getConnectedObject() == &rhs) { - // the rhs's rhs._auxiliary is uniquely attached to it, so we need to create our own and copy it's ObjectMap across + // the rhs's auxiliary is uniquely attached to it, so we need to create our own and copy its ObjectMap across auto& userObjects = getOrCreateAuxiliary()->userObjects; userObjects = rhs._auxiliary->userObjects; } @@ -48,7 +48,7 @@ Object& Object::operator=(const Object& rhs) if (rhs._auxiliary) { - // the rhs's rhs._auxiliary is uniquely attached to it, so we need to create our own and copy it's ObjectMap across + // the rhs's auxiliary is uniquely attached to it, so we need to create our own and copy its ObjectMap across auto& userObjects = getOrCreateAuxiliary()->userObjects; userObjects = rhs._auxiliary->userObjects; } @@ -129,7 +129,7 @@ void Object::write(Output& output) const { if (_auxiliary) { - // we have a unique auxiliary, need to write out it's ObjectMap entries + // we have a unique auxiliary, need to write out its ObjectMap entries auto& userObjects = _auxiliary->userObjects; output.writeValue("userObjects", userObjects.size()); for (auto& entry : userObjects) diff --git a/src/vsg/core/Version.h.in b/src/vsg/core/Version.h.in index c5ec11deb..1a341c944 100644 --- a/src/vsg/core/Version.h.in +++ b/src/vsg/core/Version.h.in @@ -49,7 +49,7 @@ extern "C" extern VSG_DECLSPEC const char* vsgGetSOVersionString(); /// return 0 if the linked VSG was built as static library (default), 1 if the linked VSG library was built as shared/dynamic library. - /// When building against a shared libraryTo ensure the correct selection of VSG_DECLSPEC (provided in vsg/core/Export.h) one must compile with the define VSG_SHARED_LIBRARY + /// When building against a shared library, to ensure the correct selection of VSG_DECLSPEC (provided in vsg/core/Export.h) one must compile with the define VSG_SHARED_LIBRARY extern VSG_DECLSPEC int vsgBuiltAsSharedLibrary(); #ifdef __cplusplus diff --git a/src/vsg/io/DatabasePager.cpp b/src/vsg/io/DatabasePager.cpp index 41b55ea10..d9f991f54 100644 --- a/src/vsg/io/DatabasePager.cpp +++ b/src/vsg/io/DatabasePager.cpp @@ -56,14 +56,14 @@ ref_ptr DatabaseQueue::take_when_available() std::chrono::duration waitDuration = std::chrono::milliseconds(100); std::unique_lock lock(_mutex); - // wait to the conditional variable signals that an operation has been added + // wait until the conditional variable signals that an operation has been added while (_queue.empty() && _status->active()) { // debug(" Waiting on condition variable B size = ", _queue.size()); _cv.wait_for(lock, waitDuration); } - // if the threads we are associated with should no longer running go for a quick exit and return nothing. + // if the threads we are associated with should no longer be running go for a quick exit and return nothing. if (_queue.empty() || _status->cancel()) { // debug("DatabaseQueue::take_when_available() C empty"); @@ -207,7 +207,7 @@ void DatabasePager::request(ref_ptr plod) { if (compare_exchange(plod->requestStatus, PagedLOD::NoRequest, PagedLOD::ReadRequest)) { - // debug("DatabasePager::request(", plod.get(), ") adding to requeQueue ", plod->filename, ", ", plod->priority, " plod=", plod.get()); + // debug("DatabasePager::request(", plod.get(), ") adding to requestQueue ", plod->filename, ", ", plod->priority, " plod=", plod.get()); _requestQueue->add(plod); } else diff --git a/src/vsg/io/FileSystem.cpp b/src/vsg/io/FileSystem.cpp index 8c3e47ede..a1d609464 100644 --- a/src/vsg/io/FileSystem.cpp +++ b/src/vsg/io/FileSystem.cpp @@ -167,7 +167,7 @@ Path vsg::findFile(const Path& filename, const Options* options) // if appropriate use the filename directly if it exists. if (options->checkFilenameHint == Options::CHECK_ORIGINAL_FILENAME_EXISTS_FIRST && fileExists(filename)) return filename; - // search for the file if the in the specific paths. + // search for the file in the options specific paths. if (auto path = findFile(filename, options->paths)) return path; // if appropriate use the filename directly if it exists. @@ -197,7 +197,7 @@ bool vsg::makeDirectory(const Path& path) if (directory_to_create.size() == 2 && directory_to_create[1] == ':') { - // ignore a C: style drive prefixes + // ignore C: style drive prefixes continue; } @@ -209,7 +209,7 @@ bool vsg::makeDirectory(const Path& path) { if (errno != EEXIST) { - // quietly ignore a mkdir on a file that already exists as this can happen safely during a filling in a filecache. + // quietly ignore a mkdir on a file that already exists as this can happen safely during filling in a filecache. debug("mkdir(", directory_to_create, ") failed. errno = ", errno); } return false; diff --git a/src/vsg/io/convert_utf.cpp b/src/vsg/io/convert_utf.cpp index 0fffd0c89..038d8b6fc 100644 --- a/src/vsg/io/convert_utf.cpp +++ b/src/vsg/io/convert_utf.cpp @@ -17,7 +17,7 @@ using namespace vsg; //////////////////////////////////////////////////////////////////////////////////////////////////// // -// copy between UTF9 <-> UF16 +// copy between UTF8 <-> UTF16 // // https://en.wikipedia.org/wiki/UTF-8 // https://en.wikipedia.org/wiki/UTF-16 diff --git a/src/vsg/io/tile.cpp b/src/vsg/io/tile.cpp index bb080175e..426c93950 100644 --- a/src/vsg/io/tile.cpp +++ b/src/vsg/io/tile.cpp @@ -164,7 +164,7 @@ vsg::ref_ptr tile::read_root(vsg::ref_ptr optio auto plod = vsg::PagedLOD::create(); plod->bound = bound; - plod->children[0] = vsg::PagedLOD::Child{0.25, {}}; // external child visible when it's bound occupies more than 1/4 of the height of the window + plod->children[0] = vsg::PagedLOD::Child{0.25, {}}; // external child visible when its bound occupies more than 1/4 of the height of the window plod->children[1] = vsg::PagedLOD::Child{0.0, tile_node}; // visible always plod->filename = vsg::make_string(x, " ", y, " 0.tile"); plod->options = Options::create_if(options, *options); @@ -192,7 +192,7 @@ vsg::ref_ptr tile::read_root(vsg::ref_ptr optio group->accept(collectResourceRequirements); group->setObject("ResourceHints", collectResourceRequirements.createResourceHints(tileMultiplier)); - // assign the EllipsoidModel so that the overall geometry of the database can be used as guide for clipping and navigation. + // assign the EllipsoidModel so that the overall geometry of the database can be used as a guide for clipping and navigation. group->setObject("EllipsoidModel", settings->ellipsoidModel); return group; @@ -253,7 +253,7 @@ vsg::ref_ptr tile::read_subtile(uint32_t x, uint32_t y, uint32_t lo { auto plod = vsg::PagedLOD::create(); plod->bound = bound; - plod->children[0] = vsg::PagedLOD::Child{settings->lodTransitionScreenHeightRatio, {}}; // external child visible when it's bound occupies more than 1/4 of the height of the window + plod->children[0] = vsg::PagedLOD::Child{settings->lodTransitionScreenHeightRatio, {}}; // external child visible when its bound occupies more than 1/4 of the height of the window plod->children[1] = vsg::PagedLOD::Child{0.0, tile_node}; // visible always plod->filename = vsg::make_string(tileID.local_x, " ", tileID.local_y, " ", local_lod, ".tile"); plod->options = Options::create_if(options, *options); @@ -507,7 +507,7 @@ vsg::ref_ptr tile::createTextureQuad(const vsg::dbox& tile_extents, v {1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f}}); // VK_FORMAT_R32G32B32_SFLOAT, VK_VERTEX_INPUT_RATE_VERTEX, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, VK_SHARING_MODE_EXCLUSIVE - uint8_t origin = textureData->properties.origin; // in Vulkan the origin is by default top left. + uint8_t origin = textureData->properties.origin; // in Vulkan the origin is top left by default. float left = 0.0f; float right = 1.0f; float top = (origin == vsg::TOP_LEFT) ? 0.0f : 1.0f; diff --git a/src/vsg/io/write.cpp b/src/vsg/io/write.cpp index ea18fa76d..9e8bc552a 100644 --- a/src/vsg/io/write.cpp +++ b/src/vsg/io/write.cpp @@ -23,7 +23,7 @@ bool vsg::write(ref_ptr object, const Path& filename, ref_ptrsharedObjects && options->sharedObjects->contains(filename, options)) return true; if (!options->readerWriters.empty()) diff --git a/src/vsg/maths/maths_transform.cpp b/src/vsg/maths/maths_transform.cpp index debbe2e60..6faf68af5 100644 --- a/src/vsg/maths/maths_transform.cpp +++ b/src/vsg/maths/maths_transform.cpp @@ -203,7 +203,7 @@ dmat4 vsg::inverse(const dmat4& m) /////////////////////////////////////////////////////////////////////////////////////////////////// // -// compute determinate of a matrix +// compute determinant of a matrix // template T t_determinant(const t_mat4& m) @@ -317,14 +317,14 @@ t_sphere t_computeFrustumBound(const t_mat4& m) // TODO : depth range should probably be 0 to 1 for Vulkan, rather than -1 to 1 for OpenGL. // - // compute the a2 the radius squared of the near plane relative to the near planes mid point + // compute a2, the radius squared of the near plane relative to the near planes mid point vec_type near_center = inv_m * vec_type(0.0, 0.0, -1.0); value_type a2 = length2(inv_m * vec_type(-1.0, -1.0, -1.0) - near_center); update_radius2(a2, near_center, inv_m * vec_type(1.0, -1.0, -1.0)); update_radius2(a2, near_center, inv_m * vec_type(1.0, 1.0, -1.0)); update_radius2(a2, near_center, inv_m * vec_type(-1.0, 1.0, -1.0)); - // compute the b2 the radius squared of the far plane relative to the far planes mid point + // compute b2, the radius squared of the far plane relative to the far planes mid point vec_type far_center = inv_m * vec_type(0.0, 0.0, 1.0); value_type b2 = length2(inv_m * vec_type(-1.0, -1.0, 1.0) - far_center); update_radius2(b2, far_center, inv_m * vec_type(1.0, -1.0, 1.0)); @@ -381,7 +381,7 @@ bool vsg::transform(CoordinateConvention source, CoordinateConvention destinatio 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0); } - else // destination most be Z_UP + else // destination must be Z_UP { matrix.set(0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -398,7 +398,7 @@ bool vsg::transform(CoordinateConvention source, CoordinateConvention destinatio 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0); } - else // destination most be Z_UP + else // destination must be Z_UP { matrix.set(1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, @@ -415,7 +415,7 @@ bool vsg::transform(CoordinateConvention source, CoordinateConvention destinatio 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0); } - else // destination most be Y_UP + else // destination must be Y_UP { matrix.set(1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, diff --git a/src/vsg/nodes/PagedLOD.cpp b/src/vsg/nodes/PagedLOD.cpp index 2c2f9d602..69a518192 100644 --- a/src/vsg/nodes/PagedLOD.cpp +++ b/src/vsg/nodes/PagedLOD.cpp @@ -45,7 +45,7 @@ int PagedLOD::compare(const Object& rhs_object) const if ((result = compare_value(bound, rhs.bound)) != 0) return result; - // compre the children vector + // compare the children vector auto rhs_itr = rhs.children.begin(); for (auto lhs_itr = children.begin(); lhs_itr != children.end(); ++lhs_itr, ++rhs_itr) { diff --git a/src/vsg/platform/android/Android_Window.cpp b/src/vsg/platform/android/Android_Window.cpp index 97de17331..8b50a34fb 100644 --- a/src/vsg/platform/android/Android_Window.cpp +++ b/src/vsg/platform/android/Android_Window.cpp @@ -55,7 +55,7 @@ namespace vsgAndroid auto result = vkCreateAndroidSurfaceKHR(*instance, &surfaceCreateInfo, _instance->getAllocationCallbacks(), &_surface); if (result != VK_SUCCESS) { - throw Exception{"Failed to created AndroidSurface.", result}; + throw Exception{"Failed to create AndroidSurface.", result}; } } }; @@ -255,7 +255,7 @@ KeyboardMap::KeyboardMap() /* * Auxiliary Functions; note the duplicate definitions for left and right - * function keys; Sun keyboards and a few other manufactures have such + * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ @@ -339,7 +339,7 @@ Android_Window::Android_Window(vsg::ref_ptr traits) : _window = nativeWindow; } - // we could get the width height from the window? + // we could get the width and height from the window? uint32_t finalWidth = traits->width; uint32_t finalHeight = traits->height; diff --git a/src/vsg/platform/ios/iOS_Window.mm b/src/vsg/platform/ios/iOS_Window.mm index 675d3eaa1..b3e7902b9 100644 --- a/src/vsg/platform/ios/iOS_Window.mm +++ b/src/vsg/platform/ios/iOS_Window.mm @@ -527,7 +527,7 @@ - (void)mouseMoved:(UIEvent *)event /* * Auxiliary Functions; note the duplicate definitions for left and right - * function keys; Sun keyboards and a few other manufactures have such + * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ diff --git a/src/vsg/platform/macos/MacOS_Window.mm b/src/vsg/platform/macos/MacOS_Window.mm index 69c375b9c..5feb42608 100644 --- a/src/vsg/platform/macos/MacOS_Window.mm +++ b/src/vsg/platform/macos/MacOS_Window.mm @@ -26,7 +26,7 @@ #import #import -// this a carbon header, we should try to avoid +// this is a carbon header, we should try to avoid it #import using namespace vsg; @@ -456,7 +456,7 @@ void createApplicationMenus(void) KeyboardMap::KeyboardMap() { - // An explanation of mapping from uppercase to lowercase + // An explanation of mapping from uppercase to lowercase: // The map _vk2vsg represents mapping from MacOS produced keycode // of the key that was physically pressed to the vsg character // that is produced when the key is pressed and no modifiers are active. @@ -588,9 +588,9 @@ void createApplicationMenus(void) _lastFlags = modifierFlags; // this must come after the xor. // The below code could likely be accomplished with just bit masks but the if statements are clearer. - // Work out any mod keys such as ctrl, alt, shift etc. are pressed + // Work out if any mod keys such as ctrl, alt, shift etc. are pressed // There must be a way to differentiate between left and right modifier keys on Mac - // But for now I do not know how do do so. Hence for all modifier keys the "left" key is chosen. + // But for now I do not know how to do so. Hence for all modifier keys the "left" key is chosen. if (changedFlags & NSEventModifierFlagOption) { if (modifierFlags & NSEventModifierFlagOption) @@ -680,7 +680,7 @@ void createApplicationMenus(void) keySymbol = itr->second; modifiedKeySymbol = keySymbol; - // Work out any mod keys such as ctrl, alt, shift etc. are pressed + // Work out if any mod keys such as ctrl, alt, shift etc. are pressed uint16_t modifierMask = 0; if (modifierFlags & NSEventModifierFlagOption) modifierMask |= vsg::KeyModifier::MODKEY_Alt; if (modifierFlags & NSEventModifierFlagControl) modifierMask |= vsg::KeyModifier::MODKEY_Control; @@ -776,7 +776,7 @@ void createApplicationMenus(void) auto devicePixelScale = _traits->hdpi ? [_window backingScaleFactor] : 1.0f; [_metalLayer setContentsScale:devicePixelScale]; - // we could get the width height from the window? + // we could get the width and height from the window? uint32_t finalwidth = traits->width * devicePixelScale; uint32_t finalheight = traits->height * devicePixelScale; @@ -920,7 +920,7 @@ void createApplicationMenus(void) // keyboard events case NSEventTypeFlagsChanged: { - // This event type is triggered when ever a ctrl, alt etc keys are pressed. + // This event type is triggered whenever ctrl, alt etc keys are pressed. // Not sure why this is not just a KeyUp or KeyDown event. // both the modified and unmodified symbols for ctrl, alt, option, etc are the same // no modifiers for the modifiers themselves. diff --git a/src/vsg/platform/win32/Win32_Window.cpp b/src/vsg/platform/win32/Win32_Window.cpp index f25f598de..d8e5ea3ac 100644 --- a/src/vsg/platform/win32/Win32_Window.cpp +++ b/src/vsg/platform/win32/Win32_Window.cpp @@ -434,7 +434,7 @@ Win32_Window::Win32_Window(vsg::ref_ptr traits) : SetFocus(_window); } - // get client rect to find final width height of the view + // get client rect to find final width and height of the view RECT clientRect; ::GetClientRect(_window, &clientRect); diff --git a/src/vsg/platform/xcb/Xcb_Window.cpp b/src/vsg/platform/xcb/Xcb_Window.cpp index 466e5729f..076b53406 100644 --- a/src/vsg/platform/xcb/Xcb_Window.cpp +++ b/src/vsg/platform/xcb/Xcb_Window.cpp @@ -320,7 +320,7 @@ Xcb_Window::Xcb_Window(vsg::ref_ptr traits) : // close connection if (openConnection) xcb_disconnect(_connection); - throw Exception{"Failed to created Window, unable able to establish xcb connection.", VK_ERROR_INVALID_EXTERNAL_HANDLE}; + throw Exception{"Failed to create Window, unable to establish xcb connection.", VK_ERROR_INVALID_EXTERNAL_HANDLE}; } // get the screen @@ -490,7 +490,7 @@ Xcb_Window::Xcb_Window(vsg::ref_ptr traits) : xcb_flush(_connection); - // sleep to give the window manage time to do any repositing and resizing + // sleep to give the window manager time to do any repositioning and resizing std::this_thread::sleep_for(std::chrono::milliseconds(10)); // get the dimensions of the final window. @@ -630,7 +630,7 @@ bool Xcb_Window::pollEvents(UIEvents& events) case (XCB_CONFIGURE_NOTIFY): { auto configure = reinterpret_cast(event); - // Xcb configure events x,y values can be behave differently on different window managers so use getWindowGeometry(..) to avoid inconsistencies + // Xcb configure events x,y values can behave differently on different window managers so use getWindowGeometry(..) to avoid inconsistencies int32_t x = configure->x; int32_t y = configure->y; uint32_t width = configure->width; @@ -706,7 +706,7 @@ bool Xcb_Window::pollEvents(UIEvents& events) if (button_press->same_screen) { - // X11/Xvb treat scroll wheel up/down as button 4 and 5 so handle these as such + // X11/Xcb treat scroll wheel up/down as button 4 and 5 so handle these as such if (button_press->detail == 4) { bufferedEvents.emplace_back(vsg::ScrollWheelEvent::create(this, event_time, vsg::vec3(0.0f, 1.0f, 0.0f))); diff --git a/src/vsg/raytracing/RayTracingPipeline.cpp b/src/vsg/raytracing/RayTracingPipeline.cpp index d428bbb6c..dc57b6710 100644 --- a/src/vsg/raytracing/RayTracingPipeline.cpp +++ b/src/vsg/raytracing/RayTracingPipeline.cpp @@ -204,7 +204,7 @@ RayTracingPipeline::Implementation::Implementation(Context& context, RayTracingP } else { - throw Exception{"Error: vsg::Pipeline::createGraphics(...) failed to create VkPipeline.", result}; + throw Exception{"Error: vsg::RayTracingPipeline failed to create VkPipeline.", result}; } } diff --git a/src/vsg/state/ArrayState.cpp b/src/vsg/state/ArrayState.cpp index af9b4a66b..7aed0c7de 100644 --- a/src/vsg/state/ArrayState.cpp +++ b/src/vsg/state/ArrayState.cpp @@ -460,8 +460,6 @@ void BillboardArrayState::apply(const VertexInputState& vas) getAttributeDetails(vas, position_attribute_location, positionAttribute); } -#include - ref_ptr BillboardArrayState::vertexArray(uint32_t instanceIndex) { struct GetValue : public ConstVisitor diff --git a/src/vsg/state/Buffer.cpp b/src/vsg/state/Buffer.cpp index 50e98a1aa..95c6416b7 100644 --- a/src/vsg/state/Buffer.cpp +++ b/src/vsg/state/Buffer.cpp @@ -107,7 +107,7 @@ bool Buffer::compile(Device* device) if (VkResult result = vkCreateBuffer(*device, &bufferInfo, device->getAllocationCallbacks(), &vd.buffer); result != VK_SUCCESS) { - throw Exception{"Error: Failed to create vkBuffer.", result}; + throw Exception{"Error: Failed to create VkBuffer.", result}; } return true; diff --git a/src/vsg/state/BufferInfo.cpp b/src/vsg/state/BufferInfo.cpp index b0d230913..9f71181a2 100644 --- a/src/vsg/state/BufferInfo.cpp +++ b/src/vsg/state/BufferInfo.cpp @@ -99,10 +99,10 @@ void BufferInfo::copyDataToBuffer(uint32_t deviceID) { warn("BufferInfo::copyDataToBuffer() cannot copy data. DeviceMemory does not support direct memory mapping."); + // you can use dynamic data updates provided by vsg::TransferTask or alternatively, you can implement the following steps: // 1. allocate staging buffer // 2. copy to staging buffer // 3. transfer from staging buffer to device local buffer - use CopyAndReleaseBuffer - return; } @@ -110,7 +110,7 @@ void BufferInfo::copyDataToBuffer(uint32_t deviceID) VkResult result = dm->map(offset, range, 0, &buffer_data); if (result != 0) { - warn("BufferInfo::copyDataToBuffer() cannot copy data. VkMapMemory(..) failed with result = ", result); + warn("BufferInfo::copyDataToBuffer() cannot copy data. vkMapMemory(..) failed with result = ", result); return; } diff --git a/src/vsg/state/ComputePipeline.cpp b/src/vsg/state/ComputePipeline.cpp index c8cd98d5f..830963f37 100644 --- a/src/vsg/state/ComputePipeline.cpp +++ b/src/vsg/state/ComputePipeline.cpp @@ -110,7 +110,7 @@ ComputePipeline::Implementation::Implementation(Context& context, Device* device if (VkResult result = vkCreateComputePipelines(*device, VK_NULL_HANDLE, 1, &pipelineInfo, _device->getAllocationCallbacks(), &_pipeline); result != VK_SUCCESS) { - throw Exception{"Error: vsg::Pipeline::createCompute(...) failed to create VkPipeline.", result}; + throw Exception{"Error: vsg::ComputePipeline failed to create VkPipeline.", result}; } } diff --git a/src/vsg/state/DescriptorBuffer.cpp b/src/vsg/state/DescriptorBuffer.cpp index 02eab7002..2352d34b3 100644 --- a/src/vsg/state/DescriptorBuffer.cpp +++ b/src/vsg/state/DescriptorBuffer.cpp @@ -161,7 +161,7 @@ void DescriptorBuffer::compile(Context& context) } else { - warn("DescriptorBuffer::compile(..) unable to allocate bufferInfo with within associated Buffer."); + warn("DescriptorBuffer::compile(..) unable to allocate bufferInfo within associated Buffer."); } } } diff --git a/src/vsg/state/DescriptorSet.cpp b/src/vsg/state/DescriptorSet.cpp index c4f3bd86a..b92d543a0 100644 --- a/src/vsg/state/DescriptorSet.cpp +++ b/src/vsg/state/DescriptorSet.cpp @@ -128,7 +128,7 @@ DescriptorSet::Implementation::~Implementation() void DescriptorSet::Implementation::assign(Context& context, const Descriptors& in_descriptors) { - // should we doing anything about previous _descriptor that may have been assigned? + // should we do anything about previous _descriptors that may have been assigned? _descriptors = in_descriptors; if (_descriptors.empty()) return; diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 6de94c653..3c9f6ba6c 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -190,7 +190,7 @@ GraphicsPipeline::Implementation::Implementation(Context& context, Device* devic if (result != VK_SUCCESS) { - throw Exception{"Error: vsg::Pipeline::createGraphics(...) failed to create VkPipeline.", result}; + throw Exception{"Error: vsg::GraphicsPipeline failed to create VkPipeline.", result}; } } diff --git a/src/vsg/state/Image.cpp b/src/vsg/state/Image.cpp index 7b6195d80..193e1f968 100644 --- a/src/vsg/state/Image.cpp +++ b/src/vsg/state/Image.cpp @@ -203,7 +203,7 @@ void Image::compile(Device* device) if (VkResult result = vkCreateImage(*vd.device, &info, vd.device->getAllocationCallbacks(), &vd.image); result != VK_SUCCESS) { - throw Exception{"Error: Failed to create vkImage.", result}; + throw Exception{"Error: Failed to create VkImage.", result}; } } @@ -221,7 +221,7 @@ void Image::compile(Context& context) if (!deviceMemory) { - throw Exception{"Error: allocate memory to reserve slot.", VK_ERROR_OUT_OF_DEVICE_MEMORY}; + throw Exception{"Error: Image failed to reserve slot from deviceMemoryBufferPools.", VK_ERROR_OUT_OF_DEVICE_MEMORY}; } vd.requiresDataCopy = data.valid(); diff --git a/src/vsg/state/ImageInfo.cpp b/src/vsg/state/ImageInfo.cpp index f309c7733..6b9938b39 100644 --- a/src/vsg/state/ImageInfo.cpp +++ b/src/vsg/state/ImageInfo.cpp @@ -96,7 +96,7 @@ uint32_t vsg::computeNumMipMapLevels(const Data* data, const Sampler* sampler) uint32_t mipLevels = 1; if (sampler) { - // clamp the mipLevels so that its no larger than what the data dimensions support + // clamp the mipLevels so that it's no larger than what the data dimensions support uint32_t maxDimension = std::max({data->width(), data->height(), data->depth()}); if (sampler->maxLod == VK_LOD_CLAMP_NONE) { @@ -145,9 +145,9 @@ void ImageInfo::computeNumMipMapLevels() auto mipLevels = vsg::computeNumMipMapLevels(data, sampler); const auto& mipmapOffsets = image->data->computeMipmapOffsets(); - bool generatMipmaps = (mipLevels > 1) && (mipmapOffsets.size() <= 1); + bool generateMipmaps = (mipLevels > 1) && (mipmapOffsets.size() <= 1); - if (generatMipmaps) + if (generateMipmaps) { // check that the data isn't compressed. const auto& properties = data->properties; @@ -161,6 +161,6 @@ void ImageInfo::computeNumMipMapLevels() image->mipLevels = mipLevels; imageView->subresourceRange.levelCount = mipLevels; - if (generatMipmaps) image->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + if (generateMipmaps) image->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } } diff --git a/src/vsg/state/ImageView.cpp b/src/vsg/state/ImageView.cpp index bf3ca6df6..398becabf 100644 --- a/src/vsg/state/ImageView.cpp +++ b/src/vsg/state/ImageView.cpp @@ -136,7 +136,7 @@ void ImageView::compile(Device* device) if (VkResult result = vkCreateImageView(*vd.device, &info, vd.device->getAllocationCallbacks(), &vd.imageView); result != VK_SUCCESS) { - throw Exception{"Error: Failed to create vkImageView.", result}; + throw Exception{"Error: Failed to create VkImageView.", result}; } } @@ -165,7 +165,7 @@ void ImageView::compile(Context& context) if (VkResult result = vkCreateImageView(*vd.device, &info, vd.device->getAllocationCallbacks(), &vd.imageView); result != VK_SUCCESS) { - throw Exception{"Error: Failed to create vkImageView.", result}; + throw Exception{"Error: Failed to create VkImageView.", result}; } } @@ -241,11 +241,11 @@ void vsg::transferImageData(ref_ptr imageView, VkImageLayout targetIm const auto valueSize = properties.stride; // data->valueSize(); bool useDataMipmaps = (mipLevels > 1) && (mipmapOffsets.size() > 1); - bool generatMipmaps = (mipLevels > 1) && (mipmapOffsets.size() <= 1); + bool generateMipmaps = (mipLevels > 1) && (mipmapOffsets.size() <= 1); auto vk_textureImage = textureImage->vk(device->deviceID); - if (generatMipmaps) + if (generateMipmaps) { VkFormatProperties props; vkGetPhysicalDeviceFormatProperties(*(device->getPhysicalDevice()), properties.format, &props); @@ -253,7 +253,7 @@ void vsg::transferImageData(ref_ptr imageView, VkImageLayout targetIm if (!isBlitPossible) { - generatMipmaps = false; + generateMipmaps = false; } } @@ -341,7 +341,7 @@ void vsg::transferImageData(ref_ptr imageView, VkImageLayout targetIm vkCmdCopyBufferToImage(commandBuffer, stagingBuffer->vk(device->deviceID), vk_textureImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, static_cast(regions.size()), regions.data()); - if (generatMipmaps) + if (generateMipmaps) { VkImageMemoryBarrier barrier = {}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; diff --git a/src/vsg/state/Sampler.cpp b/src/vsg/state/Sampler.cpp index a7be00d0f..8340ad968 100644 --- a/src/vsg/state/Sampler.cpp +++ b/src/vsg/state/Sampler.cpp @@ -108,7 +108,7 @@ Sampler::Implementation::Implementation(Device* device, const VkSamplerCreateInf { if (VkResult result = vkCreateSampler(*device, &createSamplerInfo, _device->getAllocationCallbacks(), &_sampler); result != VK_SUCCESS) { - throw Exception{"Error: Failed to create vkSampler.", result}; + throw Exception{"Error: Failed to create VkSampler.", result}; } } diff --git a/src/vsg/state/ShaderModule.cpp b/src/vsg/state/ShaderModule.cpp index 84e4114cf..abbed6e4d 100644 --- a/src/vsg/state/ShaderModule.cpp +++ b/src/vsg/state/ShaderModule.cpp @@ -132,7 +132,7 @@ void ShaderModule::write(Output& output) const output.writeObject("hints", hints); output.write("source", source); output.writeValue("code", code.size()); - output.writePropertyName(""); // convenient way of forcing an indent to the appropriate column when writing out to ascii, doesn't require a matching matchPropertyName() in ShaderModel::read(..). + output.writePropertyName(""); // convenient way of forcing an indent to the appropriate column when writing out to ascii, doesn't require a matching readPropertyName() in ShaderModule::read(..). output.write(code.size(), code.data()); output.writeEndOfLine(); } diff --git a/src/vsg/text/CpuLayoutTechnique.cpp b/src/vsg/text/CpuLayoutTechnique.cpp index 035769b2a..b017f8115 100644 --- a/src/vsg/text/CpuLayoutTechnique.cpp +++ b/src/vsg/text/CpuLayoutTechnique.cpp @@ -231,7 +231,7 @@ ref_ptr CpuLayoutTechnique::createRenderingSubgraph(ref_ptr sha else drawIndexed->indexCount = static_cast(quads.size() * 6); - // create StateGroup as the root of the scene/command graph to hold the GraphicsProgram, and binding of Descriptors to decorate the whole graph + // create StateGroup as the root of the scene/command graph to hold the GraphicsPipeline, and binding of Descriptors to decorate the whole graph if (!stategroup) { stategroup = StateGroup::create(); diff --git a/src/vsg/text/GpuLayoutTechnique.cpp b/src/vsg/text/GpuLayoutTechnique.cpp index c0eb7ade4..2471b3e6c 100644 --- a/src/vsg/text/GpuLayoutTechnique.cpp +++ b/src/vsg/text/GpuLayoutTechnique.cpp @@ -192,7 +192,7 @@ void GpuLayoutTechnique::setup(Text* text, uint32_t minimumAllocation, ref_ptr stateGroup = scenegraph.cast(); - // create StateGroup as the root of the scene/command graph to hold the GraphicsProgram, and binding of Descriptors to decorate the whole graph + // create StateGroup as the root of the scene/command graph to hold the GraphicsPipeline, and binding of Descriptors to decorate the whole graph if (!stateGroup) { stateGroup = StateGroup::create(); diff --git a/src/vsg/ui/Keyboard.cpp b/src/vsg/ui/Keyboard.cpp index 24a42e1a7..e15a11702 100644 --- a/src/vsg/ui/Keyboard.cpp +++ b/src/vsg/ui/Keyboard.cpp @@ -18,7 +18,7 @@ using namespace vsg; void Keyboard::apply(KeyPressEvent& keyPress) { - //std::cout<<"Keyboard::apply(KeyReleaseEvent& keyRelease)"< ShaderSet::getSuitableArrayState(const std::set { // not all defines are relevant to the provided ArrayState // so check each one against the entries in the definesArrayState - // are relevant to the final matching. + // relevant to the final matching. std::set relevant_defines; for (auto& define : defines) { diff --git a/src/vsg/utils/SharedObjects.cpp b/src/vsg/utils/SharedObjects.cpp index c108f411b..9d1be53e9 100644 --- a/src/vsg/utils/SharedObjects.cpp +++ b/src/vsg/utils/SharedObjects.cpp @@ -98,7 +98,7 @@ void SharedObjects::prune() } _defaults.clear(); - // prune SharedObjects that don't have an external references (referenceCount != 1) + // prune SharedObjects that don't have external references (referenceCount == 1) bool prunedObjects = false; do { diff --git a/src/vsg/vk/Device.cpp b/src/vsg/vk/Device.cpp index 42aef9569..b2b7792df 100644 --- a/src/vsg/vk/Device.cpp +++ b/src/vsg/vk/Device.cpp @@ -72,7 +72,7 @@ Device::Device(PhysicalDevice* physicalDevice, const QueueSettings& queueSetting { if (queueSetting.queueFamilyIndex < 0) continue; - // check to see if the queueFamilyIndex has already been referenced or us unique + // check to see if the queueFamilyIndex has already been referenced or is unique bool unique = true; for (auto& existingInfo : queueCreateInfos) { @@ -95,7 +95,7 @@ Device::Device(PhysicalDevice* physicalDevice, const QueueSettings& queueSetting if (queueCreateInfo.queueCount > supportedQueueCount) { queueCreateInfo.queueCount = supportedQueueCount; - debug("Device::Device() creation failed to create request queueCount."); + debug("Device::Device() creation failed to create requested queueCount."); } } else @@ -137,7 +137,7 @@ Device::Device(PhysicalDevice* physicalDevice, const QueueSettings& queueSetting throw Exception{"Error: vsg::Device::create(...) failed to create logical device.", result}; } - // allocated the requested queues + // allocate the requested queues for (auto queueInfo : queueCreateInfos) { for (uint32_t queueIndex = 0; queueIndex < queueInfo.queueCount; ++queueIndex) diff --git a/src/vsg/vk/DeviceMemory.cpp b/src/vsg/vk/DeviceMemory.cpp index f6f75ce19..d8438ff95 100644 --- a/src/vsg/vk/DeviceMemory.cpp +++ b/src/vsg/vk/DeviceMemory.cpp @@ -43,7 +43,7 @@ DeviceMemory::DeviceMemory(Device* device, const VkMemoryRequirements& memRequir } if (i >= memProperties.memoryTypeCount) { - throw Exception{"Error: vsg::DeviceMemory::create(...) failed to create DeviceMemory, not usage memory type found.", VK_ERROR_FORMAT_NOT_SUPPORTED}; + throw Exception{"Error: vsg::DeviceMemory::create(...) failed to create DeviceMemory, no usable memory type found.", VK_ERROR_FORMAT_NOT_SUPPORTED}; } uint32_t memoryTypeIndex = i; diff --git a/src/vsg/vk/Swapchain.cpp b/src/vsg/vk/Swapchain.cpp index 46d8264ad..d5c5821fc 100644 --- a/src/vsg/vk/Swapchain.cpp +++ b/src/vsg/vk/Swapchain.cpp @@ -104,7 +104,7 @@ VkPresentModeKHR vsg::selectSwapPresentMode(const SwapChainSupportDetails& detai if (availablePresentMode == preferredPresentMode) return availablePresentMode; } - // requested presetnMode not available so fallback for checking of VK_PRESENT_MODE_MAILBOX_KHR available + // requested presentMode not available so fallback to checking if VK_PRESENT_MODE_MAILBOX_KHR available for (auto availablePresentMode : details.presentModes) { if (availablePresentMode == VK_PRESENT_MODE_MAILBOX_KHR) return availablePresentMode; @@ -132,7 +132,7 @@ VkPresentModeKHR vsg::selectSwapPresentMode(const SwapChainSupportDetails& detai // namespace vsg { - // helper class that disabled the automatic clear up of the swap chain image as the swap chain itself manages it's lifetime + // helper class that disables the automatic clean up of the swap chain image as the swap chain itself manages its lifetime class SwapchainImage : public Inherit { public: @@ -171,7 +171,7 @@ Swapchain::Swapchain(PhysicalDevice* physicalDevice, Device* device, Surface* su uint32_t imageCount = std::max(preferences.imageCount, details.capabilities.minImageCount); // Vulkan spec requires minImageCount to be 1 or greater if (details.capabilities.maxImageCount > 0) imageCount = std::min(imageCount, details.capabilities.maxImageCount); // Vulkan spec specifies 0 as being unlimited number of images - // apply the selected settings back to preferences to calling code can determine the active settings. + // apply the selected settings back to preferences so calling code can determine the active settings. preferences.imageCount = imageCount; preferences.presentMode = presentMode; preferences.surfaceFormat = surfaceFormat; From 5dcb64f8db2bd87061aa4c0818d18e4cf688ba75 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Aug 2023 16:04:06 +0100 Subject: [PATCH 03/48] Added assignment of DatabasePager to new RecordAndSubmitTasks if one has previously been assigned --- src/vsg/app/Viewer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vsg/app/Viewer.cpp b/src/vsg/app/Viewer.cpp index ab22351c9..89f4314b0 100644 --- a/src/vsg/app/Viewer.cpp +++ b/src/vsg/app/Viewer.cpp @@ -396,6 +396,17 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr bool needToStartThreading = _threading; if (_threading) stopThreading(); + // if a DatabasePager is already assigned re-assign + ref_ptr databasePager; + for (auto& task : recordAndSubmitTasks) + { + if (task->databasePager) + { + databasePager = task->databasePager; + break; + } + } + presentations.clear(); recordAndSubmitTasks.clear(); @@ -494,6 +505,7 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr // set up Submission with CommandBuffer and signals auto recordAndSubmitTask = vsg::RecordAndSubmitTask::create(device, numBuffers); recordAndSubmitTask->commandGraphs = commandGraphs; + recordAndSubmitTask->databasePager = databasePager; recordAndSubmitTask->signalSemaphores.emplace_back(renderFinishedSemaphore); recordAndSubmitTask->windows = windows; recordAndSubmitTask->queue = mainQueue; @@ -514,6 +526,7 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr // set up Submission with CommandBuffer and signals auto recordAndSubmitTask = vsg::RecordAndSubmitTask::create(device, numBuffers); recordAndSubmitTask->commandGraphs = commandGraphs; + recordAndSubmitTask->databasePager = databasePager; recordAndSubmitTask->queue = mainQueue; recordAndSubmitTasks.emplace_back(recordAndSubmitTask); From fa0f2bbbd9de447caa1c5b40947f8b2ae65935c5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 8 Aug 2023 17:49:07 +0100 Subject: [PATCH 04/48] Fixed naming --- include/vsg/state/GraphicsPipeline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vsg/state/GraphicsPipeline.h b/include/vsg/state/GraphicsPipeline.h index 20a91a8f9..3f32670d0 100644 --- a/include/vsg/state/GraphicsPipeline.h +++ b/include/vsg/state/GraphicsPipeline.h @@ -49,7 +49,7 @@ namespace vsg GraphicsPipeline(PipelineLayout* pipelineLayout, const ShaderStages& shaderStages, const GraphicsPipelineStates& pipelineStates, uint32_t subpass = 0); - VkPipeline vk(uint32_t deviceID) const { return _implementation[deviceID]->_pipeline; } + VkPipeline vk(uint32_t viewID) const { return _implementation[viewID]->_pipeline; } /// VkGraphicsPipelineCreateInfo settings ShaderStages stages; From 9692766730682ba5c49235147e0eb62e961c33ad Mon Sep 17 00:00:00 2001 From: siystar Date: Fri, 11 Aug 2023 20:01:24 +0200 Subject: [PATCH 05/48] [ADDED] ClearColorImage and ClearDepthStencilImage --- include/vsg/all.h | 1 + include/vsg/commands/ClearImage.h | 51 +++++++++++++++++++++++++++++++ include/vsg/core/ConstVisitor.h | 4 +++ include/vsg/core/Visitor.h | 4 +++ src/vsg/CMakeLists.txt | 1 + src/vsg/commands/ClearImage.cpp | 33 ++++++++++++++++++++ src/vsg/core/ConstVisitor.cpp | 8 +++++ src/vsg/core/Visitor.cpp | 8 +++++ 8 files changed, 110 insertions(+) create mode 100644 include/vsg/commands/ClearImage.h create mode 100644 src/vsg/commands/ClearImage.cpp diff --git a/include/vsg/all.h b/include/vsg/all.h index 989cf6a31..0946043d8 100644 --- a/include/vsg/all.h +++ b/include/vsg/all.h @@ -83,6 +83,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #include #include #include +#include #include #include #include diff --git a/include/vsg/commands/ClearImage.h b/include/vsg/commands/ClearImage.h new file mode 100644 index 000000000..84d4ec46b --- /dev/null +++ b/include/vsg/commands/ClearImage.h @@ -0,0 +1,51 @@ +#pragma once + +/* + +Copyright(c) 2019 Thomas Hogarth + +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 the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + */ + +#include +#include + +namespace vsg +{ + + /// ClearColorImage command encapsulates vkCmdClearColorImage functionality and associated settings. + class VSG_DECLSPEC ClearColorImage : public Inherit + { + public: + using Ranges = std::vector; + + vsg::ref_ptr image; + VkImageLayout imageLayout; // imageLayout must be VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL + VkClearColorValue color; + Ranges ranges; + + void record(CommandBuffer& commandBuffer) const override; + }; + VSG_type_name(vsg::ClearColorImage); + + /// ClearDepthStencilImage command encapsulates vkCmdClearDepthStencilImage functionality and associated settings. + class VSG_DECLSPEC ClearDepthStencilImage : public Inherit + { + public: + using Ranges = std::vector; + + vsg::ref_ptr image; + VkImageLayout imageLayout; // imageLayout must be VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL + VkClearDepthStencilValue depthStencil; + Ranges ranges; + + void record(CommandBuffer& commandBuffer) const override; + }; + VSG_type_name(vsg::ClearDepthStencilImage); + +} // namespace vsg diff --git a/include/vsg/core/ConstVisitor.h b/include/vsg/core/ConstVisitor.h index deaed89af..12372d41f 100644 --- a/include/vsg/core/ConstVisitor.h +++ b/include/vsg/core/ConstVisitor.h @@ -91,6 +91,8 @@ namespace vsg class DynamicState; class ResourceHints; class ClearAttachments; + class ClearColorImage; + class ClearDepthStencilImage; class QueryPool; class ResetQueryPool; class BeginQuery; @@ -341,6 +343,8 @@ namespace vsg virtual void apply(const Draw&); virtual void apply(const DrawIndexed&); virtual void apply(const ClearAttachments&); + virtual void apply(const ClearColorImage&); + virtual void apply(const ClearDepthStencilImage&); virtual void apply(const QueryPool&); virtual void apply(const ResetQueryPool&); virtual void apply(const BeginQuery&); diff --git a/include/vsg/core/Visitor.h b/include/vsg/core/Visitor.h index 75fb160d8..95f4ffabb 100644 --- a/include/vsg/core/Visitor.h +++ b/include/vsg/core/Visitor.h @@ -91,6 +91,8 @@ namespace vsg class DynamicState; class ResourceHints; class ClearAttachments; + class ClearColorImage; + class ClearDepthStencilImage; class QueryPool; class ResetQueryPool; class BeginQuery; @@ -341,6 +343,8 @@ namespace vsg virtual void apply(Draw&); virtual void apply(DrawIndexed&); virtual void apply(ClearAttachments&); + virtual void apply(ClearColorImage&); + virtual void apply(ClearDepthStencilImage&); virtual void apply(QueryPool&); virtual void apply(ResetQueryPool&); virtual void apply(BeginQuery&); diff --git a/src/vsg/CMakeLists.txt b/src/vsg/CMakeLists.txt index dbe8cf838..53a6dd956 100644 --- a/src/vsg/CMakeLists.txt +++ b/src/vsg/CMakeLists.txt @@ -52,6 +52,7 @@ set(SOURCES commands/CopyAndReleaseBuffer.cpp commands/CopyAndReleaseImage.cpp commands/ClearAttachments.cpp + commands/ClearImage.cpp commands/PipelineBarrier.cpp commands/Event.cpp commands/NextSubPass.cpp diff --git a/src/vsg/commands/ClearImage.cpp b/src/vsg/commands/ClearImage.cpp new file mode 100644 index 000000000..ee114c08d --- /dev/null +++ b/src/vsg/commands/ClearImage.cpp @@ -0,0 +1,33 @@ +/* + +Copyright(c) 2018 Robert Osfield + +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 the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + */ + +#include +#include +#include + +using namespace vsg; + +void ClearColorImage::record(CommandBuffer& commandBuffer) const +{ + vkCmdClearColorImage(commandBuffer, + image->vk(commandBuffer.deviceID), + imageLayout, &color, + static_cast(ranges.size()), ranges.data()); +} + +void ClearDepthStencilImage::record(CommandBuffer& commandBuffer) const +{ + vkCmdClearDepthStencilImage(commandBuffer, + image->vk(commandBuffer.deviceID), + imageLayout, &depthStencil, + static_cast(ranges.size()), ranges.data()); +} diff --git a/src/vsg/core/ConstVisitor.cpp b/src/vsg/core/ConstVisitor.cpp index b3b32cc9f..b67e16794 100644 --- a/src/vsg/core/ConstVisitor.cpp +++ b/src/vsg/core/ConstVisitor.cpp @@ -775,6 +775,14 @@ void ConstVisitor::apply(const ClearAttachments& value) { apply(static_cast(value)); } +void ConstVisitor::apply(const ClearColorImage& value) +{ + apply(static_cast(value)); +} +void ConstVisitor::apply(const ClearDepthStencilImage& value) +{ + apply(static_cast(value)); +} void ConstVisitor::apply(const QueryPool& value) { apply(static_cast(value)); diff --git a/src/vsg/core/Visitor.cpp b/src/vsg/core/Visitor.cpp index 8077fda63..455f79a38 100644 --- a/src/vsg/core/Visitor.cpp +++ b/src/vsg/core/Visitor.cpp @@ -775,6 +775,14 @@ void Visitor::apply(ClearAttachments& value) { apply(static_cast(value)); } +void Visitor::apply(ClearColorImage& value) +{ + apply(static_cast(value)); +} +void Visitor::apply(ClearDepthStencilImage& value) +{ + apply(static_cast(value)); +} void Visitor::apply(QueryPool& value) { apply(static_cast(value)); From 3fc457554861af0202c225e6991ad80c1c9917fe Mon Sep 17 00:00:00 2001 From: siystar Date: Sat, 12 Aug 2023 12:03:13 +0200 Subject: [PATCH 06/48] [FIXED] infinite loop on VK_ERROR_DEVICE_LOST --- src/vsg/app/Viewer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vsg/app/Viewer.cpp b/src/vsg/app/Viewer.cpp index dacc9396b..c814896ac 100644 --- a/src/vsg/app/Viewer.cpp +++ b/src/vsg/app/Viewer.cpp @@ -189,7 +189,6 @@ bool Viewer::acquireNextFrame() while ((result = window->acquireNextImage()) != VK_SUCCESS) { if (result == VK_ERROR_SURFACE_LOST_KHR || - result == VK_ERROR_DEVICE_LOST || result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT || result == VK_SUBOPTIMAL_KHR) @@ -197,6 +196,13 @@ bool Viewer::acquireNextFrame() // force a rebuild of the Swapchain by calling Window::resize(); window->resize(); } + else if (result == VK_ERROR_DEVICE_LOST) + { + // a lost device can only be recovered by opening a new VkDevice, and success is not guaranteed. + // not currently implemented, so exit main loop. + warn("window->acquireNextImage() VkResult = VK_ERROR_DEVICE_LOST. Device loss can indicate invalid Vulkan API usage or driver/hardware issues."); + break + } else { warn("window->acquireNextImage() VkResult = ", result); From 141590f85b0bbd0a183bbac4c92c3e6ea8b126e0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 12 Aug 2023 22:38:11 +0100 Subject: [PATCH 07/48] Build fix --- src/vsg/app/Viewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vsg/app/Viewer.cpp b/src/vsg/app/Viewer.cpp index 14ed4afc2..019e85104 100644 --- a/src/vsg/app/Viewer.cpp +++ b/src/vsg/app/Viewer.cpp @@ -201,7 +201,7 @@ bool Viewer::acquireNextFrame() // a lost device can only be recovered by opening a new VkDevice, and success is not guaranteed. // not currently implemented, so exit main loop. warn("window->acquireNextImage() VkResult = VK_ERROR_DEVICE_LOST. Device loss can indicate invalid Vulkan API usage or driver/hardware issues."); - break + break; } else { From f903b1e2f3b0090dd074c624cc95713bb250a21b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Aug 2023 09:25:43 +0100 Subject: [PATCH 08/48] Initial cut of build_ShaderSets target for updating built-in ShaderSets. Currently assumes location of glTF-Sample-Model and availabiliyt of vsgshaderssets. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dba548147..217169c90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,9 +117,20 @@ vsg_add_target_docs( # build_all_h build target to automatically generate the include/vsg/all.h from the headers in the include/vsg/* directories add_custom_target(build_all_h COMMAND ${CMAKE_COMMAND} -DVSG_SOURCE_DIR=${VSG_SOURCE_DIR} -P ${VSG_SOURCE_DIR}/cmake/build_all_h.cmake + COMMENT "update all.h to include all the include/vsg/*/*.h" ) set_target_properties(build_all_h PROPERTIES FOLDER "VulkanSceneGraph") +# build_ShaderSets target automatically rebuilds the various built-in ShaderSets. +add_custom_target(build_ShaderSets + COMMAND find ~/Data/glTF-Sample-Models/2.0 -name "*.glb" -o -name "*.gltf" | xargs vsgshaderset --pbr -o src/vsg/utils/shaders/pbr_ShaderSet.cpp --binary + COMMAND vsgshaderset --phong -v \"\" -v "VSG_BILLBOARD" -v "VSG_DIFFUSE_MAP" -v "VSG_BILLBOARD VSG_DIFFUSE_MAP" -o src/vsg/utils/shaders/phong_ShaderSet.cpp --binary + COMMAND vsgshaderset --flat -v \"\" -v "VSG_BILLBOARD" -v "VSG_DIFFUSE_MAP" -v "VSG_BILLBOARD VSG_DIFFUSE_MAP" -o src/vsg/utils/shaders/flat_ShaderSet.cpp --binary + COMMAND vsgshaderset --text -v "CPU_LAYOUT" -v "CPU_LAYOUT BILLBOARD" -v "GPU_LAYOUT" -v "GPU_LAYOUT BILLBOARD" -o src/vsg/text/shaders/text_ShaderSet.cpp --binary + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "update built-in ShaderSets" +) + vsg_add_option_maintainer( PREFIX v RCLEVEL ${VSG_RELEASE_CANDIDATE} From 8a94fa9d720e745400e6b2b3cb9db5ba7efa3dbc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Aug 2023 09:26:58 +0100 Subject: [PATCH 09/48] Updated built-in ShaderSets --- src/vsg/utils/shaders/flat_ShaderSet.cpp | 6 +++--- src/vsg/utils/shaders/pbr_ShaderSet.cpp | 6 +++--- src/vsg/utils/shaders/phong_ShaderSet.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vsg/utils/shaders/flat_ShaderSet.cpp b/src/vsg/utils/shaders/flat_ShaderSet.cpp index 7aa906513..615586f7c 100644 --- a/src/vsg/utils/shaders/flat_ShaderSet.cpp +++ b/src/vsg/utils/shaders/flat_ShaderSet.cpp @@ -120,7 +120,7 @@ static const uint8_t data[] = { 110, 115, 105, 111, 110, 32, 71, 76, 95, 65, 82, 66, 95, 115, 101, 112, 97, 114, 97, 116, 101, 95, 115, 104, 97, 100, 101, 114, 95, 111, 98, 106, 101, 99, 116, 115, 32, 58, 32, 101, 110, 97, 98, 108, 101, 10, 35, 112, 114, 97, 103, 109, 97, 32, 105, 109, 112, 111, 114, 116, 95, 100, 101, 102, 105, 110, 101, 115, 32, 40, 86, 83, 71, 95, 80, 79, 73, 78, 84, 95, 83, 80, 82, 73, 84, 69, 44, 32, 86, 83, 71, 95, 68, 73, 70, 70, -85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, +85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 41, 10, 10, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 108, 97, 121, 111, 117, 116, 40, 98, 105, 110, 100, 105, 110, 103, 32, 61, 32, 48, 41, 32, 117, 110, 105, 102, 111, 114, 109, 32, 115, 97, 109, 112, 108, 101, 114, 50, 68, 32, 100, 105, 102, 102, 117, 115, 101, 77, 97, 112, 59, 10, 35, 101, 110, 100, 105, 102, 10, 10, 108, 97, 121, 111, 117, 116, 40, 108, 111, 99, @@ -141,7 +141,7 @@ static const uint8_t data[] = { 105, 102, 10, 10, 32, 32, 32, 32, 118, 101, 99, 52, 32, 100, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 32, 61, 32, 118, 101, 114, 116, 101, 120, 67, 111, 108, 111, 114, 32, 42, 32, 109, 97, 116, 101, 114, 105, 97, 108, 46, 100, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 59, 10, 10, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 32, 32, 32, 32, 35, 105, 102, -100, 101, 102, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 32, 32, +100, 101, 102, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 32, 32, 32, 32, 32, 32, 32, 32, 102, 108, 111, 97, 116, 32, 118, 32, 61, 32, 116, 101, 120, 116, 117, 114, 101, 40, 100, 105, 102, 102, 117, 115, 101, 77, 97, 112, 44, 32, 116, 101, 120, 67, 111, 111, 114, 100, 48, 46, 115, 116, 41, 46, 115, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 100, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 32, 42, 61, 32, 118, 101, 99, 52, 40, 118, 44, 32, 118, 44, 32, 118, 44, 32, 49, 46, 48, 41, 59, @@ -194,7 +194,7 @@ static const uint8_t data[] = { 77, 65, 80, 17, 0, 0, 0, 30, 0, 0, 0, 118, 115, 103, 58, 58, 68, 105, 115, 112, 108, 97, 99, 101, 109, 101, 110, 116, 77, 97, 112, 65, 114, 114, 97, 121, 83, 116, 97, 116, 101, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 86, 83, 71, 95, 66, 73, 76, 76, 66, 79, 65, 82, 68, 18, 0, 0, 0, 24, 0, 0, 0, 118, 115, 103, 58, 58, 66, 105, 108, 108, 98, 111, 97, 114, 100, 65, 114, 114, 97, 121, 83, 116, 97, -116, 101, 0, 0, 0, 0, 2, 0, 0, 0, 25, 0, 0, 0, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, +116, 101, 0, 0, 0, 0, 2, 0, 0, 0, 25, 0, 0, 0, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 16, 0, 0, 0, 86, 83, 71, 95, 80, 79, 73, 78, 84, 95, 83, 80, 82, 73, 84, 69, 0, 0, 0, 0, 4, 0, 0, 0, 19, 0, 0, 0, 26, 0, 0, 0, 118, 115, 103, 58, 58, 83, 104, 97, 100, 101, 114, 67, 111, 109, 112, 105, 108, 101, 83, 101, 116, 116, 105, 110, 103, 115, 0, 0, 64, 0, 100, 0, 0, 0, 0, 0, 0, 0, 194, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, diff --git a/src/vsg/utils/shaders/pbr_ShaderSet.cpp b/src/vsg/utils/shaders/pbr_ShaderSet.cpp index 6bebd5ff6..51657f7c3 100644 --- a/src/vsg/utils/shaders/pbr_ShaderSet.cpp +++ b/src/vsg/utils/shaders/pbr_ShaderSet.cpp @@ -120,7 +120,7 @@ static const uint8_t data[] = { 110, 115, 105, 111, 110, 32, 71, 76, 95, 65, 82, 66, 95, 115, 101, 112, 97, 114, 97, 116, 101, 95, 115, 104, 97, 100, 101, 114, 95, 111, 98, 106, 101, 99, 116, 115, 32, 58, 32, 101, 110, 97, 98, 108, 101, 10, 35, 112, 114, 97, 103, 109, 97, 32, 105, 109, 112, 111, 114, 116, 95, 100, 101, 102, 105, 110, 101, 115, 32, 40, 86, 83, 71, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, -65, 67, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 69, 77, 73, 83, 83, 73, 86, 69, 95, 77, +67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 69, 77, 73, 83, 83, 73, 86, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 76, 73, 71, 72, 84, 77, 65, 80, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 78, 79, 82, 77, 65, 76, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 77, 69, 84, 65, 76, 76, 82, 79, 85, 71, 72, 78, 69, 83, 83, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 83, 80, 69, 67, 85, 76, 65, 82, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 84, 87, 79, 95, 83, 73, 68, 69, 68, 95, 76, @@ -500,7 +500,7 @@ static const uint8_t data[] = { 101, 67, 111, 108, 111, 114, 59, 10, 10, 32, 32, 32, 32, 102, 108, 111, 97, 116, 32, 97, 109, 98, 105, 101, 110, 116, 79, 99, 99, 108, 117, 115, 105, 111, 110, 32, 61, 32, 49, 46, 48, 59, 10, 10, 32, 32, 32, 32, 118, 101, 99, 51, 32, 102, 48, 32, 61, 32, 118, 101, 99, 51, 40, 48, 46, 48, 52, 41, 59, 10, 10, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 32, 32, -32, 32, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, +32, 32, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 32, 32, 32, 32, 32, 32, 32, 32, 102, 108, 111, 97, 116, 32, 118, 32, 61, 32, 116, 101, 120, 116, 117, 114, 101, 40, 100, 105, 102, 102, 117, 115, 101, 77, 97, 112, 44, 32, 116, 101, 120, 67, 111, 111, 114, 100, 48, 46, 115, 116, 41, 46, 115, 32, 42, 32, 112, 98, 114, 46, 98, 97, 115, 101, 67, 111, 108, 111, 114, 70, 97, 99, 116, 111, 114, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 98, 97, 115, 101, 67, 111, 108, 111, @@ -787,7 +787,7 @@ static const uint8_t data[] = { 78, 84, 95, 77, 65, 80, 23, 0, 0, 0, 30, 0, 0, 0, 118, 115, 103, 58, 58, 68, 105, 115, 112, 108, 97, 99, 101, 109, 101, 110, 116, 77, 97, 112, 65, 114, 114, 97, 121, 83, 116, 97, 116, 101, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 86, 83, 71, 95, 66, 73, 76, 76, 66, 79, 65, 82, 68, 24, 0, 0, 0, 24, 0, 0, 0, 118, 115, 103, 58, 58, 66, 105, 108, 108, 98, 111, 97, 114, 100, 65, 114, 114, 97, 121, -83, 116, 97, 116, 101, 0, 0, 0, 0, 3, 0, 0, 0, 25, 0, 0, 0, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, +83, 116, 97, 116, 101, 0, 0, 0, 0, 3, 0, 0, 0, 25, 0, 0, 0, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 22, 0, 0, 0, 86, 83, 71, 95, 84, 87, 79, 95, 83, 73, 68, 69, 68, 95, 76, 73, 71, 72, 84, 73, 78, 71, 22, 0, 0, 0, 86, 83, 71, 95, 87, 79, 82, 75, 70, 76, 79, 87, 95, 83, 80, 69, 67, 71, 76, 79, 83, 83, 0, 0, 0, 0, 32, 0, 0, 0, 25, 0, 0, 0, 26, 0, 0, 0, 118, 115, 103, 58, 58, 83, 104, 97, 100, 101, 114, 67, 111, 109, 112, 105, 108, 101, diff --git a/src/vsg/utils/shaders/phong_ShaderSet.cpp b/src/vsg/utils/shaders/phong_ShaderSet.cpp index 90c197f38..9dc990541 100644 --- a/src/vsg/utils/shaders/phong_ShaderSet.cpp +++ b/src/vsg/utils/shaders/phong_ShaderSet.cpp @@ -120,7 +120,7 @@ static const uint8_t data[] = { 110, 115, 105, 111, 110, 32, 71, 76, 95, 65, 82, 66, 95, 115, 101, 112, 97, 114, 97, 116, 101, 95, 115, 104, 97, 100, 101, 114, 95, 111, 98, 106, 101, 99, 116, 115, 32, 58, 32, 101, 110, 97, 98, 108, 101, 10, 35, 112, 114, 97, 103, 109, 97, 32, 105, 109, 112, 111, 114, 116, 95, 100, 101, 102, 105, 110, 101, 115, 32, 40, 86, 83, 71, 95, 80, 79, 73, 78, 84, 95, 83, 80, 82, 73, 84, 69, 44, 32, 86, 83, 71, 95, 68, 73, 70, 70, -85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, +85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 69, 77, 73, 83, 83, 73, 86, 69, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 76, 73, 71, 72, 84, 77, 65, 80, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 78, 79, 82, 77, 65, 76, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 83, 80, 69, 67, 85, 76, 65, 82, 95, 77, 65, 80, 44, 32, 86, 83, 71, 95, 84, 87, 79, 95, 83, 73, 68, 69, 68, 95, 76, 73, 71, 72, 84, 73, 78, 71, @@ -206,7 +206,7 @@ static const uint8_t data[] = { 100, 46, 120, 121, 59, 10, 35, 101, 110, 100, 105, 102, 10, 10, 32, 32, 32, 32, 118, 101, 99, 52, 32, 100, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 32, 61, 32, 118, 101, 114, 116, 101, 120, 67, 111, 108, 111, 114, 32, 42, 32, 109, 97, 116, 101, 114, 105, 97, 108, 46, 100, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 59, 10, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, -80, 10, 32, 32, 32, 32, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, 85, +80, 10, 32, 32, 32, 32, 35, 105, 102, 100, 101, 102, 32, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 10, 32, 32, 32, 32, 32, 32, 32, 32, 102, 108, 111, 97, 116, 32, 118, 32, 61, 32, 116, 101, 120, 116, 117, 114, 101, 40, 100, 105, 102, 102, 117, 115, 101, 77, 97, 112, 44, 32, 116, 101, 120, 67, 111, 111, 114, 100, 48, 46, 115, 116, 41, 46, 115, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 100, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 32, 42, 61, 32, 118, 101, 99, 52, 40, 118, 44, 32, 118, 44, @@ -431,7 +431,7 @@ static const uint8_t data[] = { 0, 0, 0, 30, 0, 0, 0, 118, 115, 103, 58, 58, 68, 105, 115, 112, 108, 97, 99, 101, 109, 101, 110, 116, 77, 97, 112, 65, 114, 114, 97, 121, 83, 116, 97, 116, 101, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 86, 83, 71, 95, 66, 73, 76, 76, 66, 79, 65, 82, 68, 22, 0, 0, 0, 24, 0, 0, 0, 118, 115, 103, 58, 58, 66, 105, 108, 108, 98, 111, 97, 114, 100, 65, 114, 114, 97, 121, 83, 116, 97, 116, 101, 0, 0, -0, 0, 3, 0, 0, 0, 25, 0, 0, 0, 86, 83, 71, 95, 71, 82, 69, 89, 83, 65, 67, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, +0, 0, 3, 0, 0, 0, 25, 0, 0, 0, 86, 83, 71, 95, 71, 82, 69, 89, 83, 67, 65, 76, 69, 95, 68, 73, 70, 70, 85, 83, 69, 95, 77, 65, 80, 16, 0, 0, 0, 86, 83, 71, 95, 80, 79, 73, 78, 84, 95, 83, 80, 82, 73, 84, 69, 22, 0, 0, 0, 86, 83, 71, 95, 84, 87, 79, 95, 83, 73, 68, 69, 68, 95, 76, 73, 71, 72, 84, 73, 78, 71, 0, 0, 0, 0, 4, 0, 0, 0, 23, 0, 0, 0, 26, 0, 0, 0, 118, 115, 103, 58, 58, 83, 104, 97, 100, 101, 114, 67, 111, 109, 112, 105, 108, 101, 83, 101, 116, 116, 105, 110, 103, 115, 0, 0, 64, 0, 100, From 0e8e5cf180fdb17b71d17e619e4c55dfcd1e97ea Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:45:34 +0200 Subject: [PATCH 10/48] Typos, slightly edited documentation --- include/vsg/app/Viewer.h | 2 +- include/vsg/core/Array2D.h | 4 ++-- include/vsg/core/Array3D.h | 4 ++-- include/vsg/core/Object.h | 4 ++-- include/vsg/io/Input.h | 2 +- include/vsg/nodes/AbsoluteTransform.h | 2 +- include/vsg/nodes/Light.h | 2 +- include/vsg/nodes/MatrixTransform.h | 2 +- include/vsg/nodes/TileDatabase.h | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/vsg/app/Viewer.h b/include/vsg/app/Viewer.h index a4044a148..075158cad 100644 --- a/include/vsg/app/Viewer.h +++ b/include/vsg/app/Viewer.h @@ -90,7 +90,7 @@ namespace vsg /// convenience method for advancing to the next frame. /// Check active status, return false if viewer no longer active. - /// lf still active, poll for pending events and place them in the Events list and advance to the next frame, generate updated FrameStamp to signify the advancement to a new frame and return true. + /// if still active, poll for pending events and place them in the Events list and advance to the next frame, generate updated FrameStamp to signify the advancement to a new frame and return true. virtual bool advanceToNextFrame(); /// pass the Events into any registered EventHandlers diff --git a/include/vsg/core/Array2D.h b/include/vsg/core/Array2D.h index 0fc6fc77a..d8d6e3185 100644 --- a/include/vsg/core/Array2D.h +++ b/include/vsg/core/Array2D.h @@ -247,8 +247,8 @@ namespace vsg dirty(); } - // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will not result in the data being deleted. - // when the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. + // release the data so that ownership can be passed on, the local data pointer and size is set to 0 so that destruction of Array will not result in the data being deleted. + // if the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. void* dataRelease() override { if (!_storage) diff --git a/include/vsg/core/Array3D.h b/include/vsg/core/Array3D.h index 047c03278..647d4e1de 100644 --- a/include/vsg/core/Array3D.h +++ b/include/vsg/core/Array3D.h @@ -263,8 +263,8 @@ namespace vsg dirty(); } - // release the data so that ownership can be passed on, the local data pointer and size is set to 0 and destruction of Array will not result in the data being deleted. - // when the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. + // release the data so that ownership can be passed on, the local data pointer and size is set to 0 so that destruction of Array will not result in the data being deleted. + // if the data is stored in a separate vsg::Data object then return nullptr and do not attempt to release data. void* dataRelease() override { if (!_storage) diff --git a/include/vsg/core/Object.h b/include/vsg/core/Object.h index 0d5f7448a..9b50c7843 100644 --- a/include/vsg/core/Object.h +++ b/include/vsg/core/Object.h @@ -102,7 +102,7 @@ namespace vsg template void setValue(const std::string& key, const T& value); - /// specialization of setValue to handle passing c strings + /// specialization of setValue to handle passing C strings void setValue(const std::string& key, const char* value) { setValue(key, value ? std::string(value) : std::string()); } /// get specified value type, return false if value associated with key is not assigned or is not the correct type @@ -136,7 +136,7 @@ namespace vsg template ref_ptr getRefObject(const std::string& key) { return getRefObject(key).cast(); } - /// get ref_ptr of specified type associated with key, return nullptr if no object associated with key has been assigned + /// get ref_ptr of specified type associated with key, return nullptr if no object associated with key has been assigned template const ref_ptr getRefObject(const std::string& key) const { return getRefObject(key).cast(); } diff --git a/include/vsg/io/Input.h b/include/vsg/io/Input.h index f9cdc26d4..cdc5f303f 100644 --- a/include/vsg/io/Input.h +++ b/include/vsg/io/Input.h @@ -110,7 +110,7 @@ namespace vsg void read(size_t num, plane* value) { read(num * value->size(), value->data()); } void read(size_t num, dplane* value) { read(num * value->size(), value->data()); } - /// treat non standard type as raw data, + /// treat non standard type as raw data template void read(size_t num, T* value) { diff --git a/include/vsg/nodes/AbsoluteTransform.h b/include/vsg/nodes/AbsoluteTransform.h index d6791202e..8986643a0 100644 --- a/include/vsg/nodes/AbsoluteTransform.h +++ b/include/vsg/nodes/AbsoluteTransform.h @@ -19,7 +19,7 @@ namespace vsg /// AbsoluteTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs in absolute coordinate frame. /// During the RecordTraversal the matrix is directly pushed to the State::modelviewMatrixStack stack without the normal multiplication. - /// After the subgraph is traversed the matrix is popped from the State::modelviewMatrixStack. + /// After the subgraph is traversed the matrix is popped from the State::modelviewMatrixStack stack. class VSG_DECLSPEC AbsoluteTransform : public Inherit { public: diff --git a/include/vsg/nodes/Light.h b/include/vsg/nodes/Light.h index b0065dcf5..fc8670459 100644 --- a/include/vsg/nodes/Light.h +++ b/include/vsg/nodes/Light.h @@ -76,7 +76,7 @@ namespace vsg }; VSG_type_name(vsg::PointLight); - /// SpotLight represents a local point light source which intensity varies as a spot light. + /// SpotLight represents a local point light source whose intensity varies as a spot light. class VSG_DECLSPEC SpotLight : public Inherit { public: diff --git a/include/vsg/nodes/MatrixTransform.h b/include/vsg/nodes/MatrixTransform.h index c2c9d8da8..5e728a1ba 100644 --- a/include/vsg/nodes/MatrixTransform.h +++ b/include/vsg/nodes/MatrixTransform.h @@ -19,7 +19,7 @@ namespace vsg /// MatrixTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs. /// During the RecordTraversal the matrix is multiplied by the modelview matrix and pushed to the State::modelviewMatrixStack stack. - /// When the subgraph has been traversed the multiplied matrix is popped from the State::modelviewMatrixStack. + /// When the subgraph has been traversed the multiplied matrix is popped from the State::modelviewMatrixStack stack. class VSG_DECLSPEC MatrixTransform : public Inherit { public: diff --git a/include/vsg/nodes/TileDatabase.h b/include/vsg/nodes/TileDatabase.h index bbf4e1df0..2be774b40 100644 --- a/include/vsg/nodes/TileDatabase.h +++ b/include/vsg/nodes/TileDatabase.h @@ -23,7 +23,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace vsg { - /// TileDatabaseSettings provides the settings used by vsg::TileDatabase & vsg::tile ReaderWriter to guide paging in image, DEM tiles from disk/http/. + /// TileDatabaseSettings provides the settings used by vsg::TileDatabase and vsg::tile ReaderWriter to guide paging in image, DEM tiles from disk/http/. class VSG_DECLSPEC TileDatabaseSettings : public Inherit { public: From 30ee60284b0b3dcde978f9e1900381634f7632ea Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:31:21 +0200 Subject: [PATCH 11/48] Updated outdated function description (light intensity was adjusted in 23cfa6e13b9f28c0fd7cd62df8feaa8d18f8a477) --- include/vsg/nodes/Light.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vsg/nodes/Light.h b/include/vsg/nodes/Light.h index b0065dcf5..00f32e68e 100644 --- a/include/vsg/nodes/Light.h +++ b/include/vsg/nodes/Light.h @@ -93,7 +93,7 @@ namespace vsg }; VSG_type_name(vsg::SpotLight); - /// convenience method for creating a subgraph with a headlight illumination using a white AmbientLight and DirectionalLight with intensity of 0.1 and 0.9 respectively. + /// convenience method for creating a subgraph with a headlight illumination using a white AmbientLight and DirectionalLight with intensity of 0.05 and 0.95 respectively. extern VSG_DECLSPEC ref_ptr createHeadlight(); } // namespace vsg From 064662b02869bdccfb775162c909af01f9d75bce Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:11:05 +0200 Subject: [PATCH 12/48] Properly implemented vsg::getDirectoryContents on the Windows platform --- src/vsg/io/FileSystem.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vsg/io/FileSystem.cpp b/src/vsg/io/FileSystem.cpp index a1d609464..45c83fe08 100644 --- a/src/vsg/io/FileSystem.cpp +++ b/src/vsg/io/FileSystem.cpp @@ -292,17 +292,17 @@ FILE* vsg::fopen(const Path& path, const char* mode) // Microsoft API for reading directories Paths vsg::getDirectoryContents(const Path& directoryName) { - LPDWORD strLength = 0; - PWSTR linkName = nullptr; + WIN32_FIND_DATAW ffd; - auto handle = FindFirstFileNameW(directoryName.c_str(), 0, strLength, linkName); + auto searchFolder = directoryName / "*"; + auto handle = FindFirstFileW(searchFolder.c_str(), &ffd); if (handle == INVALID_HANDLE_VALUE) return {}; Paths paths; do { - paths.push_back(linkName); - } while (FindNextFileNameW(handle, strLength, linkName)); + paths.push_back(ffd.cFileName); + } while (FindNextFileW(handle, &ffd) != 0); FindClose(handle); From 0c6d64537f7f37ec15572f6d95b373514c6410f9 Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:52:00 +0200 Subject: [PATCH 13/48] Fixed up reference to structure member --- include/vsg/nodes/LOD.h | 4 ++-- include/vsg/nodes/PagedLOD.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/vsg/nodes/LOD.h b/include/vsg/nodes/LOD.h index 1267e14cc..356675988 100644 --- a/include/vsg/nodes/LOD.h +++ b/include/vsg/nodes/LOD.h @@ -24,8 +24,8 @@ namespace vsg /** Level of Detail Node, * Children should be ordered with the highest resolution child first, through to lowest resolution LOD child last. - * The Child struct stores the visibleHeightRatio and child that it's associated with. - * During culling the visibleHeightRatio is used as a minimum ratio of screen height that a bounding sphere needs to occupy in order for the associated child to be traversed. + * The Child struct stores the minimumScreenHeightRatio and child that it's associated with. + * During culling the minimumScreenHeightRatio is used as a minimum ratio of screen height that a bounding sphere needs to occupy in order for the associated child to be traversed. * Once one child passes this test no more children are checked, so that no more than one child will ever be traversed in a record traversal. * If no child passes the visible height test then none of the LOD's children will be visible. * During the record traversals the Bound sphere is also checked against the view frustum so that LOD's also enable view frustum culling for subgraphs so there is no need for a separate CullNode/CullGroup to decorate it. */ diff --git a/include/vsg/nodes/PagedLOD.h b/include/vsg/nodes/PagedLOD.h index cd23d2c32..37159e53b 100644 --- a/include/vsg/nodes/PagedLOD.h +++ b/include/vsg/nodes/PagedLOD.h @@ -27,8 +27,8 @@ namespace vsg /** Level of Detail Node, * Children should be ordered with the highest resolution PagedLODChild first, through to lowest resolution PagedLODChild last. - * The PagedLODChild struct stores the visibleHeightRatio and child that it's associated with. - * During culling the visibleHeightRatio is used as a minimum ratio of screen height that a bounding sphere needs to occupy in order for the associated child to be traversed. + * The PagedLODChild struct stores the minimumScreenHeightRatio and child that it's associated with. + * During culling the minimumScreenHeightRatio is used as a minimum ratio of screen height that a bounding sphere needs to occupy in order for the associated child to be traversed. * Once one child passes this test no more children are checked, so that no more than one child will ever be traversed in a record traversal. * If no PagedLODChild passes the visible height test then none of the PagedLOD's children will be visible. * During the record traversals the Bound sphere is also checked against the view frustum so that PagedLOD's also enable view frustum culling for subgraphs so there is no need for a separate CullNode/CullGroup to decorate it. */ From 1bfabd814cd32ce98b5d541e7c7579e76f2a9181 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Aug 2023 15:30:51 +0100 Subject: [PATCH 14/48] Removed unused member --- include/vsg/state/GraphicsPipeline.h | 1 - src/vsg/state/GraphicsPipeline.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/include/vsg/state/GraphicsPipeline.h b/include/vsg/state/GraphicsPipeline.h index 3f32670d0..e5ff245fd 100644 --- a/include/vsg/state/GraphicsPipeline.h +++ b/include/vsg/state/GraphicsPipeline.h @@ -55,7 +55,6 @@ namespace vsg ShaderStages stages; GraphicsPipelineStates pipelineStates; ref_ptr layout; - ref_ptr renderPass; uint32_t subpass; int compare(const Object& rhs_object) const override; diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 3c9f6ba6c..592f51134 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -76,7 +76,6 @@ int GraphicsPipeline::compare(const Object& rhs_object) const if ((result = compare_pointer_container(stages, rhs.stages))) return result; if ((result = compare_pointer_container(pipelineStates, rhs.pipelineStates))) return result; if ((result = compare_pointer(layout, rhs.layout))) return result; - if ((result = compare_pointer(renderPass, rhs.renderPass))) return result; return compare_value(subpass, rhs.subpass); } From 6992f255efa641147ed45a975bea99dcbdd10ed2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Aug 2023 17:58:54 +0100 Subject: [PATCH 15/48] Added mask to GraphicsPipeline and ShaderStage --- CMakeLists.txt | 4 ++-- include/vsg/state/GraphicsPipeline.h | 7 +++++++ include/vsg/state/InputAssemblyState.h | 1 + include/vsg/state/MultisampleState.h | 1 - include/vsg/state/ShaderStage.h | 3 +++ src/vsg/state/ColorBlendState.cpp | 6 +++--- src/vsg/state/DepthStencilState.cpp | 6 +++--- src/vsg/state/DynamicState.cpp | 6 +++--- src/vsg/state/GraphicsPipeline.cpp | 29 ++++++++++++++++++++++++++ src/vsg/state/InputAssemblyState.cpp | 15 +++++++++++-- src/vsg/state/MultisampleState.cpp | 6 +++--- src/vsg/state/RasterizationState.cpp | 6 +++--- src/vsg/state/ShaderStage.cpp | 11 ++++++++++ src/vsg/state/TessellationState.cpp | 6 +++--- src/vsg/state/VertexInputState.cpp | 6 +++--- src/vsg/state/ViewportState.cpp | 6 +++--- 16 files changed, 90 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 217169c90..2b3006561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.7) project(vsg - VERSION 1.0.8 + VERSION 1.0.9 DESCRIPTION "VulkanSceneGraph library" LANGUAGES CXX ) set(VSG_SOVERSION 14) -SET(VSG_RELEASE_CANDIDATE 0) +SET(VSG_RELEASE_CANDIDATE 1) set(Vulkan_MIN_VERSION 1.1.70.0) set(VSG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Root source directory of VulkanSceneGraph.") diff --git a/include/vsg/state/GraphicsPipeline.h b/include/vsg/state/GraphicsPipeline.h index e5ff245fd..2d4a78019 100644 --- a/include/vsg/state/GraphicsPipeline.h +++ b/include/vsg/state/GraphicsPipeline.h @@ -30,6 +30,13 @@ namespace vsg public: GraphicsPipelineState() {} + /// apply GraphicsPipelineState when (mask & view.mask) is non zero + Mask mask = MASK_ALL; + + int compare(const Object& rhs) const override; + void read(Input& input) override; + void write(Output& output) const override; + virtual void apply(Context& context, VkGraphicsPipelineCreateInfo& pipelineInfo) const = 0; protected: diff --git a/include/vsg/state/InputAssemblyState.h b/include/vsg/state/InputAssemblyState.h index 6f2c068bd..428d50ed6 100644 --- a/include/vsg/state/InputAssemblyState.h +++ b/include/vsg/state/InputAssemblyState.h @@ -29,6 +29,7 @@ namespace vsg VkPrimitiveTopology topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; VkBool32 primitiveRestartEnable = VK_FALSE; + int compare(const Object& rhs) const override; void read(Input& input) override; void write(Output& output) const override; void apply(Context& context, VkGraphicsPipelineCreateInfo& pipelineInfo) const override; diff --git a/include/vsg/state/MultisampleState.h b/include/vsg/state/MultisampleState.h index 51beb6a65..ce826a9ad 100644 --- a/include/vsg/state/MultisampleState.h +++ b/include/vsg/state/MultisampleState.h @@ -33,7 +33,6 @@ namespace vsg VkBool32 alphaToOneEnable = VK_FALSE; int compare(const Object& rhs) const override; - void read(Input& input) override; void write(Output& output) const override; void apply(Context& context, VkGraphicsPipelineCreateInfo& pipelineInfo) const override; diff --git a/include/vsg/state/ShaderStage.h b/include/vsg/state/ShaderStage.h index d2e55b836..1197983e4 100644 --- a/include/vsg/state/ShaderStage.h +++ b/include/vsg/state/ShaderStage.h @@ -31,6 +31,9 @@ namespace vsg using SpecializationConstants = std::map>; + /// apply ShaderStage when (mask & view.mask) is non zero + Mask mask = MASK_ALL; + /// Vulkan VkPipelineShaderStageCreateInfo settings VkPipelineShaderStageCreateFlags flags = 0; VkShaderStageFlagBits stage = {}; diff --git a/src/vsg/state/ColorBlendState.cpp b/src/vsg/state/ColorBlendState.cpp index 2b00bfe5c..ccf0f0150 100644 --- a/src/vsg/state/ColorBlendState.cpp +++ b/src/vsg/state/ColorBlendState.cpp @@ -52,7 +52,7 @@ ColorBlendState::~ColorBlendState() int ColorBlendState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -64,7 +64,7 @@ int ColorBlendState::compare(const Object& rhs_object) const void ColorBlendState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); input.readValue("logicOp", logicOp); input.readValue("logicOpEnable", logicOpEnable); @@ -91,7 +91,7 @@ void ColorBlendState::read(Input& input) void ColorBlendState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("logicOp", logicOp); output.writeValue("logicOpEnable", logicOpEnable); diff --git a/src/vsg/state/DepthStencilState.cpp b/src/vsg/state/DepthStencilState.cpp index c5f774a94..f5f66b963 100644 --- a/src/vsg/state/DepthStencilState.cpp +++ b/src/vsg/state/DepthStencilState.cpp @@ -41,7 +41,7 @@ DepthStencilState::~DepthStencilState() int DepthStencilState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -50,7 +50,7 @@ int DepthStencilState::compare(const Object& rhs_object) const void DepthStencilState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); input.readValue("depthTestEnable", depthTestEnable); input.readValue("depthWriteEnable", depthWriteEnable); @@ -80,7 +80,7 @@ void DepthStencilState::read(Input& input) void DepthStencilState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("depthTestEnable", depthTestEnable); output.writeValue("depthWriteEnable", depthWriteEnable); diff --git a/src/vsg/state/DynamicState.cpp b/src/vsg/state/DynamicState.cpp index c3f2710eb..690371bed 100644 --- a/src/vsg/state/DynamicState.cpp +++ b/src/vsg/state/DynamicState.cpp @@ -33,7 +33,7 @@ DynamicState::~DynamicState() int DynamicState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -42,7 +42,7 @@ int DynamicState::compare(const Object& rhs_object) const void DynamicState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); dynamicStates.resize(input.readValue("NumDynamicStates")); for (auto& dynamicState : dynamicStates) @@ -53,7 +53,7 @@ void DynamicState::read(Input& input) void DynamicState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("NumDynamicStates", dynamicStates.size()); for (auto& dynamicState : dynamicStates) diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 592f51134..00c996fda 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -24,6 +24,35 @@ using namespace vsg; // // GraphicsPipelineState // +int GraphicsPipelineState::compare(const Object& rhs_object) const +{ + int result = Object::compare(rhs_object); + if (result != 0) return result; + + auto& rhs = static_cast(rhs_object); + return compare_value(mask, rhs.mask); +} + +void GraphicsPipelineState::read(Input& input) +{ + Object::read(input); + + if (input.version_greater_equal(1, 0, 9)) + { + input.read("mask", mask); + } +} + +void GraphicsPipelineState::write(Output& output) const +{ + Object::write(output); + + if (output.version_greater_equal(1, 0, 9)) + { + output.write("mask", mask); + } +} + void vsg::mergeGraphicsPipelineStates(GraphicsPipelineStates& dest_PipelineStates, ref_ptr src_PipelineState) { // replace any entries in the dest_PipelineStates that have the same type as src_PipelineState diff --git a/src/vsg/state/InputAssemblyState.cpp b/src/vsg/state/InputAssemblyState.cpp index 623689a4d..d5d497a34 100644 --- a/src/vsg/state/InputAssemblyState.cpp +++ b/src/vsg/state/InputAssemblyState.cpp @@ -37,9 +37,20 @@ InputAssemblyState::~InputAssemblyState() { } +int InputAssemblyState::compare(const Object& rhs_object) const +{ + int result = GraphicsPipelineState::compare(rhs_object); + if (result != 0) return result; + + auto& rhs = static_cast(rhs_object); + + if ((result = compare_value(topology, rhs.topology))) return result; + return compare_value(primitiveRestartEnable, rhs.primitiveRestartEnable); +} + void InputAssemblyState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); input.readValue("topology", topology); primitiveRestartEnable = input.readValue("primitiveRestartEnable") != 0; @@ -47,7 +58,7 @@ void InputAssemblyState::read(Input& input) void InputAssemblyState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("topology", topology); output.writeValue("primitiveRestartEnable", primitiveRestartEnable ? 1 : 0); diff --git a/src/vsg/state/MultisampleState.cpp b/src/vsg/state/MultisampleState.cpp index 57ea03897..75ac542af 100644 --- a/src/vsg/state/MultisampleState.cpp +++ b/src/vsg/state/MultisampleState.cpp @@ -39,7 +39,7 @@ MultisampleState::~MultisampleState() int MultisampleState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -54,7 +54,7 @@ int MultisampleState::compare(const Object& rhs_object) const void MultisampleState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); input.readValue("rasterizationSamples", rasterizationSamples); input.readValue("sampleShadingEnable", sampleShadingEnable); @@ -76,7 +76,7 @@ void MultisampleState::read(Input& input) void MultisampleState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("rasterizationSamples", rasterizationSamples); output.writeValue("sampleShadingEnable", sampleShadingEnable); diff --git a/src/vsg/state/RasterizationState.cpp b/src/vsg/state/RasterizationState.cpp index 34a19c96f..cd41ca22d 100644 --- a/src/vsg/state/RasterizationState.cpp +++ b/src/vsg/state/RasterizationState.cpp @@ -42,7 +42,7 @@ RasterizationState::~RasterizationState() int RasterizationState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -51,7 +51,7 @@ int RasterizationState::compare(const Object& rhs_object) const void RasterizationState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); input.readValue("depthClampEnable", depthClampEnable); input.readValue("rasterizerDiscardEnable", rasterizerDiscardEnable); @@ -67,7 +67,7 @@ void RasterizationState::read(Input& input) void RasterizationState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("depthClampEnable", depthClampEnable); output.writeValue("rasterizerDiscardEnable", rasterizerDiscardEnable); diff --git a/src/vsg/state/ShaderStage.cpp b/src/vsg/state/ShaderStage.cpp index 60b5488f6..85e59b3dc 100644 --- a/src/vsg/state/ShaderStage.cpp +++ b/src/vsg/state/ShaderStage.cpp @@ -118,6 +118,11 @@ void ShaderStage::read(Input& input) { Object::read(input); + if (input.version_greater_equal(1, 0, 9)) + { + input.read("mask", mask); + } + input.readValue("stage", stage); input.read("entryPointName", entryPointName); input.readObject("module", module); @@ -135,6 +140,11 @@ void ShaderStage::write(Output& output) const { Object::write(output); + if (output.version_greater_equal(1, 0, 9)) + { + output.write("mask", mask); + } + output.writeValue("stage", stage); output.write("entryPointName", entryPointName); output.writeObject("module", module); @@ -145,6 +155,7 @@ void ShaderStage::write(Output& output) const output.writeValue("id", id); output.writeObject("data", data); } + } void ShaderStage::apply(Context& context, VkPipelineShaderStageCreateInfo& stageInfo) const diff --git a/src/vsg/state/TessellationState.cpp b/src/vsg/state/TessellationState.cpp index 4fac49005..9d99fecfd 100644 --- a/src/vsg/state/TessellationState.cpp +++ b/src/vsg/state/TessellationState.cpp @@ -34,7 +34,7 @@ TessellationState::~TessellationState() int TessellationState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -43,14 +43,14 @@ int TessellationState::compare(const Object& rhs_object) const void TessellationState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); input.read("patchControlPoints", patchControlPoints); } void TessellationState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.write("patchControlPoints", patchControlPoints); } diff --git a/src/vsg/state/VertexInputState.cpp b/src/vsg/state/VertexInputState.cpp index 3d8d5aba0..77ebe67fb 100644 --- a/src/vsg/state/VertexInputState.cpp +++ b/src/vsg/state/VertexInputState.cpp @@ -40,7 +40,7 @@ VertexInputState::~VertexInputState() int VertexInputState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -51,7 +51,7 @@ int VertexInputState::compare(const Object& rhs_object) const void VertexInputState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); vertexBindingDescriptions.resize(input.readValue("NumBindings")); for (auto& binding : vertexBindingDescriptions) @@ -73,7 +73,7 @@ void VertexInputState::read(Input& input) void VertexInputState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("NumBindings", vertexBindingDescriptions.size()); for (auto& binding : vertexBindingDescriptions) diff --git a/src/vsg/state/ViewportState.cpp b/src/vsg/state/ViewportState.cpp index 135559103..c96eef9cd 100644 --- a/src/vsg/state/ViewportState.cpp +++ b/src/vsg/state/ViewportState.cpp @@ -44,7 +44,7 @@ ViewportState::~ViewportState() int ViewportState::compare(const Object& rhs_object) const { - int result = Object::compare(rhs_object); + int result = GraphicsPipelineState::compare(rhs_object); if (result != 0) return result; auto& rhs = static_cast(rhs_object); @@ -73,7 +73,7 @@ void ViewportState::set(int32_t x, int32_t y, uint32_t width, uint32_t height) void ViewportState::read(Input& input) { - Object::read(input); + GraphicsPipelineState::read(input); viewports.resize(input.readValue("viewports")); for (auto& viewport : viewports) @@ -98,7 +98,7 @@ void ViewportState::read(Input& input) void ViewportState::write(Output& output) const { - Object::write(output); + GraphicsPipelineState::write(output); output.writeValue("viewports", viewports.size()); for (auto& viewport : viewports) From e29a84e52300b60e41f8045db468e0a2b7fd9797 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Aug 2023 18:28:14 +0100 Subject: [PATCH 16/48] Added check between Context/View.mask and SHaderStage/GraphicsPipelineStates. --- include/vsg/vk/Context.h | 1 + src/vsg/app/CompileTraversal.cpp | 18 ++++++++++++------ src/vsg/state/GraphicsPipeline.cpp | 22 +++++++++++++++------- src/vsg/vk/Context.cpp | 1 + 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/include/vsg/vk/Context.h b/include/vsg/vk/Context.h index dd02ac43b..5963dd481 100644 --- a/include/vsg/vk/Context.h +++ b/include/vsg/vk/Context.h @@ -77,6 +77,7 @@ namespace vsg observer_ptr view; uint32_t viewID = 0; + Mask mask = MASK_ALL; ViewDependentState* viewDependentState = nullptr; /// get existing ShaderCompiler or create a new one when GLSLang is supported diff --git a/src/vsg/app/CompileTraversal.cpp b/src/vsg/app/CompileTraversal.cpp index 0ef2063fe..37359b9f8 100644 --- a/src/vsg/app/CompileTraversal.cpp +++ b/src/vsg/app/CompileTraversal.cpp @@ -312,13 +312,17 @@ void CompileTraversal::apply(View& view) auto context_view = context->view.ref_ptr(); if (context_view && context_view.get() != &view) continue; + // save previous states + auto previous_viewID = context->viewID; + auto previous_mask = context->mask; + auto previous_overridePipelineStates = context->overridePipelineStates; + auto previous_defaultPipelineStates = context->defaultPipelineStates; + context->viewID = view.viewID; + context->mask = view.mask; context->viewDependentState = view.viewDependentState.get(); if (view.viewDependentState) view.viewDependentState->compile(*context); - // save previous pipeline states - auto previousOverridePipelineStates = context->overridePipelineStates; - auto previousDefaultPipelineStates = context->defaultPipelineStates; // assign view specific pipeline states if (view.camera && view.camera->viewportState) mergeGraphicsPipelineStates(context->defaultPipelineStates, view.camera->viewportState); @@ -326,9 +330,11 @@ void CompileTraversal::apply(View& view) view.traverse(*this); - // restore previous pipeline states - context->defaultPipelineStates = previousDefaultPipelineStates; - context->overridePipelineStates = previousOverridePipelineStates; + // restore previous states + context->viewID = previous_viewID; + context->mask = previous_mask; + context->defaultPipelineStates = previous_defaultPipelineStates; + context->overridePipelineStates = previous_overridePipelineStates; } } diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 00c996fda..1d26eab6c 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -196,20 +196,28 @@ GraphicsPipeline::Implementation::Implementation(Context& context, Device* devic pipelineInfo.pNext = nullptr; auto shaderStageCreateInfo = context.scratchMemory->allocate(shaderStages.size()); - for (size_t i = 0; i < shaderStages.size(); ++i) + uint32_t i = 0; + for(auto& shaderStage : shaderStages) { - const ShaderStage* shaderStage = shaderStages[i]; - shaderStageCreateInfo[i].flags = 0; - shaderStageCreateInfo[i].pNext = nullptr; - shaderStage->apply(context, shaderStageCreateInfo[i]); + // check if ShaderStage is appropriate to assign to stageInfo + if ((context.mask & shaderStage->mask) != 0) + { + shaderStageCreateInfo[i].flags = 0; + shaderStageCreateInfo[i].pNext = nullptr; + shaderStage->apply(context, shaderStageCreateInfo[i]); + ++i; + } } - pipelineInfo.stageCount = static_cast(shaderStages.size()); + pipelineInfo.stageCount = i; pipelineInfo.pStages = shaderStageCreateInfo; for (auto pipelineState : pipelineStates) { - pipelineState->apply(context, pipelineInfo); + if ((context.mask & pipelineState->mask) != 0) + { + pipelineState->apply(context, pipelineInfo); + } } VkResult result = vkCreateGraphicsPipelines(*device, VK_NULL_HANDLE, 1, &pipelineInfo, _device->getAllocationCallbacks(), &_pipeline); diff --git a/src/vsg/vk/Context.cpp b/src/vsg/vk/Context.cpp index ce735a7d9..f2c2b6663 100644 --- a/src/vsg/vk/Context.cpp +++ b/src/vsg/vk/Context.cpp @@ -106,6 +106,7 @@ Context::Context(const Context& context) : device(context.device), view(context.view), viewID(context.viewID), + mask(context.mask), viewDependentState(context.viewDependentState), minimum_maxSets(context.minimum_maxSets), minimum_descriptorPoolSizes(context.minimum_descriptorPoolSizes), From 84653c40c3d2f576bfff2e2bcf15467ac837a6bb Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 15 Aug 2023 11:05:34 +0100 Subject: [PATCH 17/48] Added mask checks to GraphicsPipelineStates merging --- include/vsg/state/GraphicsPipeline.h | 4 ++-- src/vsg/app/CompileTraversal.cpp | 14 +++++++------- src/vsg/state/GraphicsPipeline.cpp | 22 ++++++++++++++++------ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/include/vsg/state/GraphicsPipeline.h b/include/vsg/state/GraphicsPipeline.h index 2d4a78019..086d5a354 100644 --- a/include/vsg/state/GraphicsPipeline.h +++ b/include/vsg/state/GraphicsPipeline.h @@ -45,8 +45,8 @@ namespace vsg VSG_type_name(vsg::GraphicsPipelineState); using GraphicsPipelineStates = std::vector>; - extern VSG_DECLSPEC void mergeGraphicsPipelineStates(GraphicsPipelineStates& dest_PipelineStates, ref_ptr src_PipelineState); - extern VSG_DECLSPEC void mergeGraphicsPipelineStates(GraphicsPipelineStates& dest_PipelineStates, const GraphicsPipelineStates& src_PipelineStates); + extern VSG_DECLSPEC void mergeGraphicsPipelineStates(Mask mask, GraphicsPipelineStates& dest_PipelineStates, ref_ptr src_PipelineState); + extern VSG_DECLSPEC void mergeGraphicsPipelineStates(Mask mask, GraphicsPipelineStates& dest_PipelineStates, const GraphicsPipelineStates& src_PipelineStates); /// GraphicsPipeline encapsulates graphics VkPipeline and the VkGraphicsPipelineCreateInfo settings used to set it up. class VSG_DECLSPEC GraphicsPipeline : public Inherit diff --git a/src/vsg/app/CompileTraversal.cpp b/src/vsg/app/CompileTraversal.cpp index 37359b9f8..d6c096ef2 100644 --- a/src/vsg/app/CompileTraversal.cpp +++ b/src/vsg/app/CompileTraversal.cpp @@ -243,11 +243,11 @@ void CompileTraversal::apply(CommandGraph& commandGraph) auto previousDefaultPipelineStates = context->defaultPipelineStates; auto previousOverridePipelineStates = context->overridePipelineStates; - mergeGraphicsPipelineStates(context->defaultPipelineStates, ViewportState::create(renderArea)); + mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderArea)); if (samples != VK_SAMPLE_COUNT_1_BIT) { - mergeGraphicsPipelineStates(context->overridePipelineStates, MultisampleState::create(samples)); + mergeGraphicsPipelineStates(context->mask, context->overridePipelineStates, MultisampleState::create(samples)); } commandGraph.traverse(*this); @@ -284,16 +284,16 @@ void CompileTraversal::apply(RenderGraph& renderGraph) if (renderGraph.window) { - mergeGraphicsPipelineStates(context->defaultPipelineStates, ViewportState::create(renderGraph.window->extent2D())); + mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderGraph.window->extent2D())); } else if (renderGraph.framebuffer) { - mergeGraphicsPipelineStates(context->defaultPipelineStates, ViewportState::create(renderGraph.framebuffer->extent2D())); + mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderGraph.framebuffer->extent2D())); } if (context->renderPass && context->renderPass->maxSamples != VK_SAMPLE_COUNT_1_BIT) { - mergeGraphicsPipelineStates(context->overridePipelineStates, MultisampleState::create(context->renderPass->maxSamples)); + mergeGraphicsPipelineStates(context->mask, context->overridePipelineStates, MultisampleState::create(context->renderPass->maxSamples)); } renderGraph.traverse(*this); @@ -325,8 +325,8 @@ void CompileTraversal::apply(View& view) // assign view specific pipeline states - if (view.camera && view.camera->viewportState) mergeGraphicsPipelineStates(context->defaultPipelineStates, view.camera->viewportState); - mergeGraphicsPipelineStates(context->overridePipelineStates, view.overridePipelineStates); + if (view.camera && view.camera->viewportState) mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, view.camera->viewportState); + mergeGraphicsPipelineStates(context->mask, context->overridePipelineStates, view.overridePipelineStates); view.traverse(*this); diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 1d26eab6c..0c91944d7 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -53,8 +53,10 @@ void GraphicsPipelineState::write(Output& output) const } } -void vsg::mergeGraphicsPipelineStates(GraphicsPipelineStates& dest_PipelineStates, ref_ptr src_PipelineState) +void vsg::mergeGraphicsPipelineStates(Mask mask, GraphicsPipelineStates& dest_PipelineStates, ref_ptr src_PipelineState) { + if ((mask & src_PipelineState->mask) == 0) return; + // replace any entries in the dest_PipelineStates that have the same type as src_PipelineState for (auto& original_pipelineState : dest_PipelineStates) { @@ -67,11 +69,11 @@ void vsg::mergeGraphicsPipelineStates(GraphicsPipelineStates& dest_PipelineState dest_PipelineStates.push_back(src_PipelineState); } -void vsg::mergeGraphicsPipelineStates(GraphicsPipelineStates& dest_PipelineStates, const GraphicsPipelineStates& src_PipelineStates) +void vsg::mergeGraphicsPipelineStates(Mask mask, GraphicsPipelineStates& dest_PipelineStates, const GraphicsPipelineStates& src_PipelineStates) { for (auto& src_PipelineState : src_PipelineStates) { - mergeGraphicsPipelineStates(dest_PipelineStates, src_PipelineState); + mergeGraphicsPipelineStates(mask, dest_PipelineStates, src_PipelineState); } } @@ -172,9 +174,11 @@ void GraphicsPipeline::compile(Context& context) shaderStage->compile(context); } - GraphicsPipelineStates combined_pipelineStates = context.defaultPipelineStates; - mergeGraphicsPipelineStates(combined_pipelineStates, pipelineStates); - mergeGraphicsPipelineStates(combined_pipelineStates, context.overridePipelineStates); + GraphicsPipelineStates combined_pipelineStates; + combined_pipelineStates.reserve(context.defaultPipelineStates.size() + pipelineStates.size() + context.overridePipelineStates.size()); + mergeGraphicsPipelineStates(context.mask, combined_pipelineStates, context.defaultPipelineStates); + mergeGraphicsPipelineStates(context.mask, combined_pipelineStates, pipelineStates); + mergeGraphicsPipelineStates(context.mask, combined_pipelineStates, context.overridePipelineStates); _implementation[viewID] = GraphicsPipeline::Implementation::create(context, context.device, context.renderPass, layout, stages, combined_pipelineStates, subpass); } @@ -212,12 +216,18 @@ GraphicsPipeline::Implementation::Implementation(Context& context, Device* devic pipelineInfo.stageCount = i; pipelineInfo.pStages = shaderStageCreateInfo; + info("GraphicsPipeline::Implementation::Implementation() context.viewID = ", context.viewID, ", context.mask = ", context.mask, ", pipelineStates.size() = ", pipelineStates.size()); for (auto pipelineState : pipelineStates) { if ((context.mask & pipelineState->mask) != 0) { + info(" enabled ", pipelineState, ", mask = ", pipelineState->mask); pipelineState->apply(context, pipelineInfo); } + else + { + info(" not enabled ", pipelineState, ", mask = ", pipelineState->mask); + } } VkResult result = vkCreateGraphicsPipelines(*device, VK_NULL_HANDLE, 1, &pipelineInfo, _device->getAllocationCallbacks(), &_pipeline); From b45b04e4ceaaa3f9e3bf445dacb23127aa6d2254 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 15 Aug 2023 12:03:33 +0100 Subject: [PATCH 18/48] Removed debug messages --- src/vsg/state/GraphicsPipeline.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 0c91944d7..028691be9 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -216,18 +216,9 @@ GraphicsPipeline::Implementation::Implementation(Context& context, Device* devic pipelineInfo.stageCount = i; pipelineInfo.pStages = shaderStageCreateInfo; - info("GraphicsPipeline::Implementation::Implementation() context.viewID = ", context.viewID, ", context.mask = ", context.mask, ", pipelineStates.size() = ", pipelineStates.size()); for (auto pipelineState : pipelineStates) { - if ((context.mask & pipelineState->mask) != 0) - { - info(" enabled ", pipelineState, ", mask = ", pipelineState->mask); - pipelineState->apply(context, pipelineInfo); - } - else - { - info(" not enabled ", pipelineState, ", mask = ", pipelineState->mask); - } + pipelineState->apply(context, pipelineInfo); } VkResult result = vkCreateGraphicsPipelines(*device, VK_NULL_HANDLE, 1, &pipelineInfo, _device->getAllocationCallbacks(), &_pipeline); From 9ff2eaef5e11ed1d8c8bb6aea7c7d106244812af Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 15 Aug 2023 15:38:35 +0100 Subject: [PATCH 19/48] Fxed warning --- src/vsg/state/MultisampleState.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vsg/state/MultisampleState.cpp b/src/vsg/state/MultisampleState.cpp index 75ac542af..f56eeae0a 100644 --- a/src/vsg/state/MultisampleState.cpp +++ b/src/vsg/state/MultisampleState.cpp @@ -65,9 +65,9 @@ void MultisampleState::read(Input& input) else sampleMasks.resize(input.readValue("NumSampleMask")); - for (auto& mask : sampleMasks) + for (auto& value : sampleMasks) { - input.readValue("value", mask); + input.readValue("value", value); } input.readValue("alphaToCoverageEnable", alphaToCoverageEnable); @@ -87,9 +87,9 @@ void MultisampleState::write(Output& output) const else output.writeValue("NumSampleMask", sampleMasks.size()); - for (auto& mask : sampleMasks) + for (auto& value : sampleMasks) { - output.writeValue("value", mask); + output.writeValue("value", value); } output.writeValue("alphaToCoverageEnable", alphaToCoverageEnable); From e0b3285ae2ec5ee5df606c21604db715c10e7d30 Mon Sep 17 00:00:00 2001 From: siystar Date: Tue, 15 Aug 2023 16:58:59 +0200 Subject: [PATCH 20/48] [UPDATED] ImageView to use VK_REMAINING_MIP_LEVELS --- src/vsg/state/ImageInfo.cpp | 1 - src/vsg/state/ImageView.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vsg/state/ImageInfo.cpp b/src/vsg/state/ImageInfo.cpp index 6b9938b39..a04dedf86 100644 --- a/src/vsg/state/ImageInfo.cpp +++ b/src/vsg/state/ImageInfo.cpp @@ -159,7 +159,6 @@ void ImageInfo::computeNumMipMapLevels() } image->mipLevels = mipLevels; - imageView->subresourceRange.levelCount = mipLevels; if (generateMipmaps) image->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } diff --git a/src/vsg/state/ImageView.cpp b/src/vsg/state/ImageView.cpp index 398becabf..46cb0eb4e 100644 --- a/src/vsg/state/ImageView.cpp +++ b/src/vsg/state/ImageView.cpp @@ -62,7 +62,7 @@ ImageView::ImageView(ref_ptr in_image) : format = image->format; subresourceRange.aspectMask = computeAspectFlagsForFormat(image->format); subresourceRange.baseMipLevel = 0; - subresourceRange.levelCount = image->mipLevels; + subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; subresourceRange.baseArrayLayer = 0; subresourceRange.layerCount = image->arrayLayers; } @@ -86,7 +86,7 @@ ImageView::ImageView(ref_ptr in_image, VkImageAspectFlags aspectFlags) : format = image->format; subresourceRange.aspectMask = aspectFlags; subresourceRange.baseMipLevel = 0; - subresourceRange.levelCount = image->mipLevels; + subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; subresourceRange.baseArrayLayer = 0; subresourceRange.layerCount = image->arrayLayers; } From 90ad807150dc86438b7208e727d1c25304963285 Mon Sep 17 00:00:00 2001 From: siystar Date: Tue, 15 Aug 2023 16:59:07 +0200 Subject: [PATCH 21/48] [FIXED] VK_LOD_CLAMP_NONE off-by-one error --- src/vsg/state/ImageInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vsg/state/ImageInfo.cpp b/src/vsg/state/ImageInfo.cpp index 6b9938b39..86c7981b6 100644 --- a/src/vsg/state/ImageInfo.cpp +++ b/src/vsg/state/ImageInfo.cpp @@ -100,7 +100,7 @@ uint32_t vsg::computeNumMipMapLevels(const Data* data, const Sampler* sampler) uint32_t maxDimension = std::max({data->width(), data->height(), data->depth()}); if (sampler->maxLod == VK_LOD_CLAMP_NONE) { - while ((1u << (mipLevels - 1)) < maxDimension) + while ((1u << mipLevels) <= maxDimension) { ++mipLevels; } From e1e5ea2991649bef6b077df1b629aa9049fa2661 Mon Sep 17 00:00:00 2001 From: siystar Date: Tue, 15 Aug 2023 17:26:27 +0200 Subject: [PATCH 22/48] [FIXED] VSG_GREYSCALE_DIFFUSE_MAP spelling in Builder.cpp --- src/vsg/utils/Builder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vsg/utils/Builder.cpp b/src/vsg/utils/Builder.cpp index 3f8c08237..872ba8e79 100644 --- a/src/vsg/utils/Builder.cpp +++ b/src/vsg/utils/Builder.cpp @@ -67,7 +67,7 @@ ref_ptr Builder::createStateGroup(const StateInfo& stateInfo) graphicsPipelineConfig->assignTexture("diffuseMap", stateInfo.image, sampler); - if (stateInfo.greyscale) defines.insert("VSG_GREYSACLE_DIFFUSE_MAP"); + if (stateInfo.greyscale) defines.insert("VSG_GREYSCALE_DIFFUSE_MAP"); } if (stateInfo.displacementMap) From ca48360a0b2cc33289cd4a6df5ab487cf40830fd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 15 Aug 2023 16:46:54 +0100 Subject: [PATCH 23/48] Added copy constructor. --- include/vsg/state/GraphicsPipeline.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/vsg/state/GraphicsPipeline.h b/include/vsg/state/GraphicsPipeline.h index 086d5a354..5b0e4a2bb 100644 --- a/include/vsg/state/GraphicsPipeline.h +++ b/include/vsg/state/GraphicsPipeline.h @@ -29,6 +29,7 @@ namespace vsg { public: GraphicsPipelineState() {} + GraphicsPipelineState(const GraphicsPipelineState& gp) : Inherit(), mask(gp.mask) {} /// apply GraphicsPipelineState when (mask & view.mask) is non zero Mask mask = MASK_ALL; From cdb83a65847def4d34099d64676611a2c297d49e Mon Sep 17 00:00:00 2001 From: Vulkan made easy Date: Tue, 15 Aug 2023 16:58:41 +0100 Subject: [PATCH 24/48] Standardized captizliation --- include/vsg/app/Viewer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vsg/app/Viewer.h b/include/vsg/app/Viewer.h index 075158cad..978d418db 100644 --- a/include/vsg/app/Viewer.h +++ b/include/vsg/app/Viewer.h @@ -88,9 +88,9 @@ namespace vsg /// compile manager provides thread safe support for compiling subgraphs ref_ptr compileManager; - /// convenience method for advancing to the next frame. + /// Convenience method for advancing to the next frame. /// Check active status, return false if viewer no longer active. - /// if still active, poll for pending events and place them in the Events list and advance to the next frame, generate updated FrameStamp to signify the advancement to a new frame and return true. + /// If still active, poll for pending events and place them in the Events list and advance to the next frame, generate updated FrameStamp to signify the advancement to a new frame and return true. virtual bool advanceToNextFrame(); /// pass the Events into any registered EventHandlers From d0232f936a948cc7a543806760512a2d02baedca Mon Sep 17 00:00:00 2001 From: Vulkan made easy Date: Tue, 15 Aug 2023 16:59:35 +0100 Subject: [PATCH 25/48] Removed superluous word. --- include/vsg/nodes/AbsoluteTransform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vsg/nodes/AbsoluteTransform.h b/include/vsg/nodes/AbsoluteTransform.h index 8986643a0..d6791202e 100644 --- a/include/vsg/nodes/AbsoluteTransform.h +++ b/include/vsg/nodes/AbsoluteTransform.h @@ -19,7 +19,7 @@ namespace vsg /// AbsoluteTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs in absolute coordinate frame. /// During the RecordTraversal the matrix is directly pushed to the State::modelviewMatrixStack stack without the normal multiplication. - /// After the subgraph is traversed the matrix is popped from the State::modelviewMatrixStack stack. + /// After the subgraph is traversed the matrix is popped from the State::modelviewMatrixStack. class VSG_DECLSPEC AbsoluteTransform : public Inherit { public: From 432076fdde0e3f681d16a636a3aa7a0b6fe205f6 Mon Sep 17 00:00:00 2001 From: Vulkan made easy Date: Tue, 15 Aug 2023 17:00:08 +0100 Subject: [PATCH 26/48] Removed superluous word. --- include/vsg/nodes/MatrixTransform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vsg/nodes/MatrixTransform.h b/include/vsg/nodes/MatrixTransform.h index 5e728a1ba..c2c9d8da8 100644 --- a/include/vsg/nodes/MatrixTransform.h +++ b/include/vsg/nodes/MatrixTransform.h @@ -19,7 +19,7 @@ namespace vsg /// MatrixTransform is a transform node that provides a 4x4 matrix that is used to position subgraphs. /// During the RecordTraversal the matrix is multiplied by the modelview matrix and pushed to the State::modelviewMatrixStack stack. - /// When the subgraph has been traversed the multiplied matrix is popped from the State::modelviewMatrixStack stack. + /// When the subgraph has been traversed the multiplied matrix is popped from the State::modelviewMatrixStack. class VSG_DECLSPEC MatrixTransform : public Inherit { public: From 593a90aad6b325fdbe9abc2e01a413649bfb41a4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 16 Aug 2023 13:46:21 +0100 Subject: [PATCH 27/48] Refined the support for GraphicsPipelineMask --- .../vsg/utils/GraphicsPipelineConfigurator.h | 17 +-- src/vsg/text/CpuLayoutTechnique.cpp | 20 --- src/vsg/text/GpuLayoutTechnique.cpp | 29 +--- src/vsg/utils/Builder.cpp | 29 +++- .../utils/GraphicsPipelineConfigurator.cpp | 140 +++++++++++------- 5 files changed, 119 insertions(+), 116 deletions(-) diff --git a/include/vsg/utils/GraphicsPipelineConfigurator.h b/include/vsg/utils/GraphicsPipelineConfigurator.h index 313634590..5f280f3e1 100644 --- a/include/vsg/utils/GraphicsPipelineConfigurator.h +++ b/include/vsg/utils/GraphicsPipelineConfigurator.h @@ -91,16 +91,11 @@ namespace vsg public: GraphicsPipelineConfigurator(ref_ptr in_shaderSet = {}); + void traverse(Visitor& visitor) override; + void traverse(ConstVisitor& visitor) const override; + // inputs to setup of GraphicsPipeline, the default sets are taken from any provided by ShaderSet::defaultGraphicsPipelineStates - ref_ptr colorBlendState; - ref_ptr depthStencilState; - ref_ptr dynamicState; - ref_ptr inputAssemblyState; - ref_ptr multisampleState; // typically leave unset as compile traversal will provide MultisampleState - ref_ptr rasterizationState; - ref_ptr tessellationState; - ref_ptr vertexInputState; // set by assignArray(..) methods. - ref_ptr viewportState; // typically leave unset as compile traversal will provide ViewportState + GraphicsPipelineStates pipelineStates; uint32_t subpass = 0; uint32_t baseAttributeBinding = 0; @@ -132,6 +127,10 @@ namespace vsg ref_ptr layout; ref_ptr graphicsPipeline; ref_ptr bindGraphicsPipeline; + + protected: + + void _assignShaderSetSettings(); }; VSG_type_name(vsg::GraphicsPipelineConfigurator); diff --git a/src/vsg/text/CpuLayoutTechnique.cpp b/src/vsg/text/CpuLayoutTechnique.cpp index b017f8115..743ee339d 100644 --- a/src/vsg/text/CpuLayoutTechnique.cpp +++ b/src/vsg/text/CpuLayoutTechnique.cpp @@ -270,26 +270,6 @@ ref_ptr CpuLayoutTechnique::createRenderingSubgraph(ref_ptr sha config->assignTexture("textureAtlas", font->atlas, sampler); - // disable face culling so text can be seen from both sides - config->rasterizationState->cullMode = VK_CULL_MODE_NONE; - - // set alpha blending - VkPipelineColorBlendAttachmentState colorBlendAttachment = {}; - colorBlendAttachment.blendEnable = VK_TRUE; - colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | - VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | - VK_COLOR_COMPONENT_A_BIT; - - colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA; - colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD; - colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; - colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD; - - config->colorBlendState->attachments = {colorBlendAttachment}; - if (sharedObjects) sharedObjects->share(config, [](auto gpc) { gpc->init(); }); else diff --git a/src/vsg/text/GpuLayoutTechnique.cpp b/src/vsg/text/GpuLayoutTechnique.cpp index 2471b3e6c..8eb9d13ef 100644 --- a/src/vsg/text/GpuLayoutTechnique.cpp +++ b/src/vsg/text/GpuLayoutTechnique.cpp @@ -251,28 +251,13 @@ void GpuLayoutTechnique::setup(Text* text, uint32_t minimumAllocation, ref_ptrassignUniform("textLayout", layoutValue); config->assignUniform("text", textArray); - // disable face culling so text can be seen from both sides - config->rasterizationState->cullMode = VK_CULL_MODE_NONE; - - // set topology of primitive - config->inputAssemblyState->topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; - - // set alpha blending - VkPipelineColorBlendAttachmentState colorBlendAttachment = {}; - colorBlendAttachment.blendEnable = VK_TRUE; - colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | - VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | - VK_COLOR_COMPONENT_A_BIT; - - colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA; - colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD; - colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; - colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD; - - config->colorBlendState->attachments = {colorBlendAttachment}; + // Set the InputAssemblyState.topology + struct SetPipelineStates : public Visitor + { + void apply(Object& object) { object.traverse(*this); } + void apply(InputAssemblyState& ias) { ias.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; } + }; + vsg::visit(config); if (sharedObjects) sharedObjects->share(config, [](auto gpc) { gpc->init(); }); diff --git a/src/vsg/utils/Builder.cpp b/src/vsg/utils/Builder.cpp index 872ba8e79..d9c867ab0 100644 --- a/src/vsg/utils/Builder.cpp +++ b/src/vsg/utils/Builder.cpp @@ -106,18 +106,31 @@ ref_ptr Builder::createStateGroup(const StateInfo& stateInfo) graphicsPipelineConfig->enableArray("vsg_position", VK_VERTEX_INPUT_RATE_INSTANCE, 12); } - if (stateInfo.two_sided) + struct SetPipelineStates : public Visitor { - graphicsPipelineConfig->rasterizationState->cullMode = VK_CULL_MODE_NONE; - defines.insert("VSG_TWO_SIDED_LIGHTING"); - } + const StateInfo& si; + SetPipelineStates(const StateInfo& in) : si(in) {} - graphicsPipelineConfig->colorBlendState->attachments = ColorBlendState::ColorBlendAttachments{ - {stateInfo.blending, VK_BLEND_FACTOR_SRC_ALPHA, VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, VK_BLEND_OP_ADD, VK_BLEND_FACTOR_SRC_ALPHA, VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, VK_BLEND_OP_SUBTRACT, VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT}}; + void apply(Object& object) { object.traverse(*this); } + void apply(RasterizationState& rs) { if (si.two_sided) rs.cullMode = VK_CULL_MODE_NONE; } + void apply(InputAssemblyState& ias) { if (si.wireframe) ias.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; } + void apply(ColorBlendState& cbs) + { + if (si.blending) + { + for(auto& attachment : cbs.attachments) + { + attachment.blendEnable = si.blending; + } + } + } + } sps(stateInfo); - if (stateInfo.wireframe) + graphicsPipelineConfig->accept(sps); + + if (stateInfo.two_sided) { - graphicsPipelineConfig->inputAssemblyState->topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; + defines.insert("VSG_TWO_SIDED_LIGHTING"); } // if required initialize GraphicsPipeline/Layout etc. diff --git a/src/vsg/utils/GraphicsPipelineConfigurator.cpp b/src/vsg/utils/GraphicsPipelineConfigurator.cpp index a917f6832..5c6963972 100644 --- a/src/vsg/utils/GraphicsPipelineConfigurator.cpp +++ b/src/vsg/utils/GraphicsPipelineConfigurator.cpp @@ -25,15 +25,26 @@ struct AssignGraphicsPipelineStates : public vsg::Visitor explicit AssignGraphicsPipelineStates(vsg::GraphicsPipelineConfigurator* in_config) : config(in_config) {} - void apply(vsg::ColorBlendState& cbs) override { config->colorBlendState = ColorBlendState::create(cbs); } - void apply(vsg::DepthStencilState& mss) override { config->depthStencilState = DepthStencilState::create(mss); } - void apply(vsg::DynamicState& mss) override { config->dynamicState = DynamicState::create(mss); } - void apply(vsg::InputAssemblyState& ias) override { config->inputAssemblyState = InputAssemblyState::create(ias); } - void apply(vsg::MultisampleState& mss) override { config->multisampleState = MultisampleState::create(mss); } - void apply(vsg::RasterizationState& rs) override { config->rasterizationState = RasterizationState::create(rs); } - void apply(vsg::TessellationState& rs) override { config->tessellationState = TessellationState::create(rs); } - void apply(vsg::VertexInputState& ias) override { config->vertexInputState = VertexInputState::create(ias); } - void apply(vsg::ViewportState& ias) override { config->viewportState = ViewportState::create(ias); } + ref_ptr colorBlendState; + ref_ptr depthStencilState; + ref_ptr dynamicState; + ref_ptr inputAssemblyState; + ref_ptr multisampleState; + ref_ptr rasterizationState; + ref_ptr tessellationState; + ref_ptr vertexInputState; + ref_ptr viewportState; + + void apply(vsg::Object& object) override { object.traverse(*this); } + void apply(vsg::ColorBlendState& cbs) override { colorBlendState = ColorBlendState::create(cbs); config->pipelineStates.push_back(colorBlendState); } + void apply(vsg::DepthStencilState& mss) override { depthStencilState = DepthStencilState::create(mss); config->pipelineStates.push_back(depthStencilState); } + void apply(vsg::DynamicState& mss) override { dynamicState = DynamicState::create(mss); config->pipelineStates.push_back(dynamicState); } + void apply(vsg::InputAssemblyState& ias) override { inputAssemblyState = InputAssemblyState::create(ias); config->pipelineStates.push_back(inputAssemblyState); } + void apply(vsg::MultisampleState& mss) override { multisampleState = MultisampleState::create(mss); config->pipelineStates.push_back(multisampleState); } + void apply(vsg::RasterizationState& rs) override { rasterizationState = RasterizationState::create(rs); config->pipelineStates.push_back(rasterizationState); } + void apply(vsg::TessellationState& rs) override { tessellationState = TessellationState::create(rs); config->pipelineStates.push_back(tessellationState); } + void apply(vsg::VertexInputState& ias) override { vertexInputState = VertexInputState::create(ias); config->pipelineStates.push_back(vertexInputState); } + void apply(vsg::ViewportState& ias) override { viewportState = ViewportState::create(ias); config->pipelineStates.push_back(viewportState); } }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -262,49 +273,87 @@ bool ArrayConfigurator::assignArray(const std::string& name, VkVertexInputRate v // GraphicsPipelineConfigurator::GraphicsPipelineConfigurator(ref_ptr in_shaderSet) : shaderSet(in_shaderSet) +{ + _assignShaderSetSettings(); +} + +void GraphicsPipelineConfigurator::_assignShaderSetSettings() { // apply defaults - auto& graphicsPipelineStates = shaderSet->defaultGraphicsPipelineStates; - if (!graphicsPipelineStates.empty()) + AssignGraphicsPipelineStates agps(this); + for(auto& pipelineState : shaderSet->defaultGraphicsPipelineStates) { - AssignGraphicsPipelineStates agps(this); - for (auto& gps : graphicsPipelineStates) - { - gps->accept(agps); - } + pipelineState->accept(agps); } - if (!vertexInputState) vertexInputState = VertexInputState::create(); - if (!inputAssemblyState) inputAssemblyState = vsg::InputAssemblyState::create(); - if (!rasterizationState) rasterizationState = vsg::RasterizationState::create(); - if (!colorBlendState) colorBlendState = vsg::ColorBlendState::create(); - if (!multisampleState) multisampleState = vsg::MultisampleState::create(); - if (!depthStencilState) depthStencilState = vsg::DepthStencilState::create(); + if (!agps.vertexInputState) pipelineStates.push_back(VertexInputState::create()); + if (!agps.inputAssemblyState) pipelineStates.push_back(vsg::InputAssemblyState::create()); + if (!agps.rasterizationState) pipelineStates.push_back(vsg::RasterizationState::create()); + if (!agps.colorBlendState) pipelineStates.push_back(vsg::ColorBlendState::create()); + if (!agps.multisampleState) pipelineStates.push_back(vsg::MultisampleState::create()); + if (!agps.depthStencilState) pipelineStates.push_back(vsg::DepthStencilState::create()); shaderHints = shaderSet->defaultShaderHints ? vsg::ShaderCompileSettings::create(*shaderSet->defaultShaderHints) : vsg::ShaderCompileSettings::create(); } +void GraphicsPipelineConfigurator::traverse(Visitor& visitor) +{ + for(auto& ps : pipelineStates) ps->accept(visitor); + if (shaderSet) shaderSet->accept(visitor); + if (shaderHints) shaderHints->accept(visitor); + if (descriptorConfigurator) descriptorConfigurator->accept(visitor); +} + +void GraphicsPipelineConfigurator::traverse(ConstVisitor& visitor) const +{ + for(auto& ps : pipelineStates) ps->accept(visitor); + if (shaderSet) shaderSet->accept(visitor); + if (shaderHints) shaderHints->accept(visitor); + if (descriptorConfigurator) descriptorConfigurator->accept(visitor); +} + void GraphicsPipelineConfigurator::reset() { - vertexInputState->vertexAttributeDescriptions.clear(); - vertexInputState->vertexBindingDescriptions.clear(); + pipelineStates.clear(); shaderHints->defines.clear(); + if (descriptorConfigurator) descriptorConfigurator->reset(); - descriptorConfigurator = {}; - - // if (descriptorConfigurator) descriptorConfigurator->reset(); + _assignShaderSetSettings(); } +struct SetPipelineStates : public Visitor +{ + uint32_t base = 0; + const AttributeBinding& binding; + VkVertexInputRate vir; + uint32_t stride; + VkFormat format; + + SetPipelineStates(uint32_t in_base, const AttributeBinding& in_binding, VkVertexInputRate in_vir, uint32_t in_stride, VkFormat in_format) : + base(in_base), + binding(in_binding), + vir(in_vir), + stride(in_stride), + format(in_format) {} + + void apply(Object& object) override { object.traverse(*this); } + void apply(VertexInputState& vis) override + { + uint32_t bindingIndex = base + static_cast(vis.vertexAttributeDescriptions.size()); + vis.vertexAttributeDescriptions.push_back(VkVertexInputAttributeDescription{binding.location, bindingIndex, (format != VK_FORMAT_UNDEFINED) ? format : binding.format, 0}); + vis.vertexBindingDescriptions.push_back(VkVertexInputBindingDescription{bindingIndex, stride, vir}); + } +}; + bool GraphicsPipelineConfigurator::enableArray(const std::string& name, VkVertexInputRate vertexInputRate, uint32_t stride, VkFormat format) { auto& attributeBinding = shaderSet->getAttributeBinding(name); if (attributeBinding) { - // set up bindings - uint32_t bindingIndex = baseAttributeBinding + static_cast(vertexInputState->vertexAttributeDescriptions.size()); if (!attributeBinding.define.empty()) shaderHints->defines.insert(attributeBinding.define); - vertexInputState->vertexAttributeDescriptions.push_back(VkVertexInputAttributeDescription{attributeBinding.location, bindingIndex, (format != VK_FORMAT_UNDEFINED) ? format : attributeBinding.format, 0}); - vertexInputState->vertexBindingDescriptions.push_back(VkVertexInputBindingDescription{bindingIndex, stride, vertexInputRate}); + + SetPipelineStates setVertexAttributeState(baseAttributeBinding, attributeBinding, vertexInputRate, stride, format) ; + accept(setVertexAttributeState); return true; } return false; @@ -329,11 +378,8 @@ bool GraphicsPipelineConfigurator::assignArray(DataList& arrays, const std::stri { VkFormat format = array ? array->properties.format : VK_FORMAT_UNDEFINED; - // set up bindings - uint32_t bindingIndex = baseAttributeBinding + static_cast(arrays.size()); - if (!attributeBinding.define.empty()) shaderHints->defines.insert(attributeBinding.define); - vertexInputState->vertexAttributeDescriptions.push_back(VkVertexInputAttributeDescription{attributeBinding.location, bindingIndex, (format != VK_FORMAT_UNDEFINED) ? format : attributeBinding.format, 0}); - vertexInputState->vertexBindingDescriptions.push_back(VkVertexInputBindingDescription{bindingIndex, array->properties.stride, vertexInputRate}); + SetPipelineStates setVertexAttributeState(baseAttributeBinding, attributeBinding, vertexInputRate, array->properties.stride, format) ; + accept(setVertexAttributeState); arrays.push_back(array); return true; @@ -360,15 +406,7 @@ int GraphicsPipelineConfigurator::compare(const Object& rhs_object) const auto& rhs = static_cast(rhs_object); - if ((result = compare_pointer(colorBlendState, rhs.colorBlendState))) return result; - if ((result = compare_pointer(depthStencilState, rhs.depthStencilState))) return result; - if ((result = compare_pointer(dynamicState, rhs.dynamicState))) return result; - if ((result = compare_pointer(inputAssemblyState, rhs.inputAssemblyState))) return result; - if ((result = compare_pointer(multisampleState, rhs.multisampleState))) return result; - if ((result = compare_pointer(rasterizationState, rhs.rasterizationState))) return result; - if ((result = compare_pointer(tessellationState, rhs.tessellationState))) return result; - if ((result = compare_pointer(vertexInputState, rhs.vertexInputState))) return result; - if ((result = compare_pointer(viewportState, rhs.viewportState))) return result; + if ((result = compare_pointer_container(pipelineStates, rhs.pipelineStates))) return result; if ((result = compare_value(subpass, rhs.subpass))) return result; if ((result = compare_value(baseAttributeBinding, rhs.baseAttributeBinding))) return result; @@ -405,18 +443,6 @@ void GraphicsPipelineConfigurator::init() } layout = vsg::PipelineLayout::create(desriptorSetLayouts, pushConstantRanges); - - GraphicsPipelineStates pipelineStates; - if (colorBlendState) pipelineStates.push_back(colorBlendState); - if (depthStencilState) pipelineStates.push_back(depthStencilState); - if (dynamicState) pipelineStates.push_back(dynamicState); - if (inputAssemblyState) pipelineStates.push_back(inputAssemblyState); - if (multisampleState) pipelineStates.push_back(multisampleState); - if (rasterizationState) pipelineStates.push_back(rasterizationState); - if (tessellationState) pipelineStates.push_back(tessellationState); - if (vertexInputState) pipelineStates.push_back(vertexInputState); - if (viewportState) pipelineStates.push_back(viewportState); - graphicsPipeline = GraphicsPipeline::create(layout, shaderSet->getShaderStages(shaderHints), pipelineStates, subpass); bindGraphicsPipeline = vsg::BindGraphicsPipeline::create(graphicsPipeline); } From 596cbfe95c0f14ae045921d0c921c7aa68b8862f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 16 Aug 2023 16:53:41 +0100 Subject: [PATCH 28/48] Added ColorBlendState::configureAttachments(bool) method ti standardize set up of blending. --- include/vsg/state/ColorBlendState.h | 3 +++ src/vsg/state/ColorBlendState.cpp | 28 ++++++++++++++++++++++++++++ src/vsg/utils/Builder.cpp | 11 +---------- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/include/vsg/state/ColorBlendState.h b/include/vsg/state/ColorBlendState.h index d608f3f44..648bb6432 100644 --- a/include/vsg/state/ColorBlendState.h +++ b/include/vsg/state/ColorBlendState.h @@ -33,6 +33,9 @@ namespace vsg ColorBlendAttachments attachments; float blendConstants[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + /// configure the attachments, if blendEnable is true then set up standard src_alpha, dest_one_minus_alpha blending otherwise disable blending. + virtual void configureAttachments(bool blendEnable); + int compare(const Object& rhs) const override; void read(Input& input) override; diff --git a/src/vsg/state/ColorBlendState.cpp b/src/vsg/state/ColorBlendState.cpp index ccf0f0150..a8adf2181 100644 --- a/src/vsg/state/ColorBlendState.cpp +++ b/src/vsg/state/ColorBlendState.cpp @@ -50,6 +50,34 @@ ColorBlendState::~ColorBlendState() { } + +void ColorBlendState::configureAttachments(bool blendEnable) +{ + for(auto& attachment : attachments) + { + if (blendEnable) + { + attachment.blendEnable = VK_TRUE; + attachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA; + attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + attachment.colorBlendOp = VK_BLEND_OP_ADD; + attachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA; + attachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; + attachment.alphaBlendOp = VK_BLEND_OP_ADD; + } + else + { + attachment.blendEnable = VK_FALSE; + attachment.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO; + attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO; + attachment.colorBlendOp = VK_BLEND_OP_ADD; + attachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; + attachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; + attachment.alphaBlendOp = VK_BLEND_OP_ADD; + } + } +} + int ColorBlendState::compare(const Object& rhs_object) const { int result = GraphicsPipelineState::compare(rhs_object); diff --git a/src/vsg/utils/Builder.cpp b/src/vsg/utils/Builder.cpp index d9c867ab0..b7e693103 100644 --- a/src/vsg/utils/Builder.cpp +++ b/src/vsg/utils/Builder.cpp @@ -114,16 +114,7 @@ ref_ptr Builder::createStateGroup(const StateInfo& stateInfo) void apply(Object& object) { object.traverse(*this); } void apply(RasterizationState& rs) { if (si.two_sided) rs.cullMode = VK_CULL_MODE_NONE; } void apply(InputAssemblyState& ias) { if (si.wireframe) ias.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; } - void apply(ColorBlendState& cbs) - { - if (si.blending) - { - for(auto& attachment : cbs.attachments) - { - attachment.blendEnable = si.blending; - } - } - } + void apply(ColorBlendState& cbs) { cbs.configureAttachments(si.blending); } } sps(stateInfo); graphicsPipelineConfig->accept(sps); From bf259c926a1aa83bb2df3a89a834070efe1a9d89 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 16 Aug 2023 16:57:04 +0100 Subject: [PATCH 29/48] Refined comment --- include/vsg/state/ColorBlendState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vsg/state/ColorBlendState.h b/include/vsg/state/ColorBlendState.h index 648bb6432..a950d1481 100644 --- a/include/vsg/state/ColorBlendState.h +++ b/include/vsg/state/ColorBlendState.h @@ -33,7 +33,7 @@ namespace vsg ColorBlendAttachments attachments; float blendConstants[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - /// configure the attachments, if blendEnable is true then set up standard src_alpha, dest_one_minus_alpha blending otherwise disable blending. + /// configure the assingned attachments, if blendEnable is true then set up standard src_alpha, dest_one_minus_alpha blending otherwise disable blending. virtual void configureAttachments(bool blendEnable); int compare(const Object& rhs) const override; From a2bbfcf7747e115483ebbf17a3ee5f2e9c481a8d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 16 Aug 2023 16:57:43 +0100 Subject: [PATCH 30/48] Ran clang-format --- include/vsg/state/GraphicsPipeline.h | 3 +- .../vsg/utils/GraphicsPipelineConfigurator.h | 1 - src/vsg/app/CompileTraversal.cpp | 1 - src/vsg/commands/ClearImage.cpp | 12 ++-- src/vsg/state/ColorBlendState.cpp | 3 +- src/vsg/state/GraphicsPipeline.cpp | 2 +- src/vsg/state/ShaderStage.cpp | 1 - src/vsg/utils/Builder.cpp | 13 +++- .../utils/GraphicsPipelineConfigurator.cpp | 64 +++++++++++++++---- 9 files changed, 70 insertions(+), 30 deletions(-) diff --git a/include/vsg/state/GraphicsPipeline.h b/include/vsg/state/GraphicsPipeline.h index 5b0e4a2bb..f9323e1e1 100644 --- a/include/vsg/state/GraphicsPipeline.h +++ b/include/vsg/state/GraphicsPipeline.h @@ -29,7 +29,8 @@ namespace vsg { public: GraphicsPipelineState() {} - GraphicsPipelineState(const GraphicsPipelineState& gp) : Inherit(), mask(gp.mask) {} + GraphicsPipelineState(const GraphicsPipelineState& gp) : + Inherit(), mask(gp.mask) {} /// apply GraphicsPipelineState when (mask & view.mask) is non zero Mask mask = MASK_ALL; diff --git a/include/vsg/utils/GraphicsPipelineConfigurator.h b/include/vsg/utils/GraphicsPipelineConfigurator.h index 5f280f3e1..bd2d20847 100644 --- a/include/vsg/utils/GraphicsPipelineConfigurator.h +++ b/include/vsg/utils/GraphicsPipelineConfigurator.h @@ -129,7 +129,6 @@ namespace vsg ref_ptr bindGraphicsPipeline; protected: - void _assignShaderSetSettings(); }; VSG_type_name(vsg::GraphicsPipelineConfigurator); diff --git a/src/vsg/app/CompileTraversal.cpp b/src/vsg/app/CompileTraversal.cpp index d6c096ef2..8d847d92e 100644 --- a/src/vsg/app/CompileTraversal.cpp +++ b/src/vsg/app/CompileTraversal.cpp @@ -323,7 +323,6 @@ void CompileTraversal::apply(View& view) context->viewDependentState = view.viewDependentState.get(); if (view.viewDependentState) view.viewDependentState->compile(*context); - // assign view specific pipeline states if (view.camera && view.camera->viewportState) mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, view.camera->viewportState); mergeGraphicsPipelineStates(context->mask, context->overridePipelineStates, view.overridePipelineStates); diff --git a/src/vsg/commands/ClearImage.cpp b/src/vsg/commands/ClearImage.cpp index ee114c08d..6cf6d2522 100644 --- a/src/vsg/commands/ClearImage.cpp +++ b/src/vsg/commands/ClearImage.cpp @@ -19,15 +19,15 @@ using namespace vsg; void ClearColorImage::record(CommandBuffer& commandBuffer) const { vkCmdClearColorImage(commandBuffer, - image->vk(commandBuffer.deviceID), - imageLayout, &color, - static_cast(ranges.size()), ranges.data()); + image->vk(commandBuffer.deviceID), + imageLayout, &color, + static_cast(ranges.size()), ranges.data()); } void ClearDepthStencilImage::record(CommandBuffer& commandBuffer) const { vkCmdClearDepthStencilImage(commandBuffer, - image->vk(commandBuffer.deviceID), - imageLayout, &depthStencil, - static_cast(ranges.size()), ranges.data()); + image->vk(commandBuffer.deviceID), + imageLayout, &depthStencil, + static_cast(ranges.size()), ranges.data()); } diff --git a/src/vsg/state/ColorBlendState.cpp b/src/vsg/state/ColorBlendState.cpp index a8adf2181..7248f0968 100644 --- a/src/vsg/state/ColorBlendState.cpp +++ b/src/vsg/state/ColorBlendState.cpp @@ -50,10 +50,9 @@ ColorBlendState::~ColorBlendState() { } - void ColorBlendState::configureAttachments(bool blendEnable) { - for(auto& attachment : attachments) + for (auto& attachment : attachments) { if (blendEnable) { diff --git a/src/vsg/state/GraphicsPipeline.cpp b/src/vsg/state/GraphicsPipeline.cpp index 028691be9..5e7e4870a 100644 --- a/src/vsg/state/GraphicsPipeline.cpp +++ b/src/vsg/state/GraphicsPipeline.cpp @@ -201,7 +201,7 @@ GraphicsPipeline::Implementation::Implementation(Context& context, Device* devic auto shaderStageCreateInfo = context.scratchMemory->allocate(shaderStages.size()); uint32_t i = 0; - for(auto& shaderStage : shaderStages) + for (auto& shaderStage : shaderStages) { // check if ShaderStage is appropriate to assign to stageInfo if ((context.mask & shaderStage->mask) != 0) diff --git a/src/vsg/state/ShaderStage.cpp b/src/vsg/state/ShaderStage.cpp index 85e59b3dc..c9fdd356b 100644 --- a/src/vsg/state/ShaderStage.cpp +++ b/src/vsg/state/ShaderStage.cpp @@ -155,7 +155,6 @@ void ShaderStage::write(Output& output) const output.writeValue("id", id); output.writeObject("data", data); } - } void ShaderStage::apply(Context& context, VkPipelineShaderStageCreateInfo& stageInfo) const diff --git a/src/vsg/utils/Builder.cpp b/src/vsg/utils/Builder.cpp index b7e693103..559925570 100644 --- a/src/vsg/utils/Builder.cpp +++ b/src/vsg/utils/Builder.cpp @@ -109,11 +109,18 @@ ref_ptr Builder::createStateGroup(const StateInfo& stateInfo) struct SetPipelineStates : public Visitor { const StateInfo& si; - SetPipelineStates(const StateInfo& in) : si(in) {} + SetPipelineStates(const StateInfo& in) : + si(in) {} void apply(Object& object) { object.traverse(*this); } - void apply(RasterizationState& rs) { if (si.two_sided) rs.cullMode = VK_CULL_MODE_NONE; } - void apply(InputAssemblyState& ias) { if (si.wireframe) ias.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; } + void apply(RasterizationState& rs) + { + if (si.two_sided) rs.cullMode = VK_CULL_MODE_NONE; + } + void apply(InputAssemblyState& ias) + { + if (si.wireframe) ias.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; + } void apply(ColorBlendState& cbs) { cbs.configureAttachments(si.blending); } } sps(stateInfo); diff --git a/src/vsg/utils/GraphicsPipelineConfigurator.cpp b/src/vsg/utils/GraphicsPipelineConfigurator.cpp index 5c6963972..4623426cf 100644 --- a/src/vsg/utils/GraphicsPipelineConfigurator.cpp +++ b/src/vsg/utils/GraphicsPipelineConfigurator.cpp @@ -36,15 +36,51 @@ struct AssignGraphicsPipelineStates : public vsg::Visitor ref_ptr viewportState; void apply(vsg::Object& object) override { object.traverse(*this); } - void apply(vsg::ColorBlendState& cbs) override { colorBlendState = ColorBlendState::create(cbs); config->pipelineStates.push_back(colorBlendState); } - void apply(vsg::DepthStencilState& mss) override { depthStencilState = DepthStencilState::create(mss); config->pipelineStates.push_back(depthStencilState); } - void apply(vsg::DynamicState& mss) override { dynamicState = DynamicState::create(mss); config->pipelineStates.push_back(dynamicState); } - void apply(vsg::InputAssemblyState& ias) override { inputAssemblyState = InputAssemblyState::create(ias); config->pipelineStates.push_back(inputAssemblyState); } - void apply(vsg::MultisampleState& mss) override { multisampleState = MultisampleState::create(mss); config->pipelineStates.push_back(multisampleState); } - void apply(vsg::RasterizationState& rs) override { rasterizationState = RasterizationState::create(rs); config->pipelineStates.push_back(rasterizationState); } - void apply(vsg::TessellationState& rs) override { tessellationState = TessellationState::create(rs); config->pipelineStates.push_back(tessellationState); } - void apply(vsg::VertexInputState& ias) override { vertexInputState = VertexInputState::create(ias); config->pipelineStates.push_back(vertexInputState); } - void apply(vsg::ViewportState& ias) override { viewportState = ViewportState::create(ias); config->pipelineStates.push_back(viewportState); } + void apply(vsg::ColorBlendState& cbs) override + { + colorBlendState = ColorBlendState::create(cbs); + config->pipelineStates.push_back(colorBlendState); + } + void apply(vsg::DepthStencilState& mss) override + { + depthStencilState = DepthStencilState::create(mss); + config->pipelineStates.push_back(depthStencilState); + } + void apply(vsg::DynamicState& mss) override + { + dynamicState = DynamicState::create(mss); + config->pipelineStates.push_back(dynamicState); + } + void apply(vsg::InputAssemblyState& ias) override + { + inputAssemblyState = InputAssemblyState::create(ias); + config->pipelineStates.push_back(inputAssemblyState); + } + void apply(vsg::MultisampleState& mss) override + { + multisampleState = MultisampleState::create(mss); + config->pipelineStates.push_back(multisampleState); + } + void apply(vsg::RasterizationState& rs) override + { + rasterizationState = RasterizationState::create(rs); + config->pipelineStates.push_back(rasterizationState); + } + void apply(vsg::TessellationState& rs) override + { + tessellationState = TessellationState::create(rs); + config->pipelineStates.push_back(tessellationState); + } + void apply(vsg::VertexInputState& ias) override + { + vertexInputState = VertexInputState::create(ias); + config->pipelineStates.push_back(vertexInputState); + } + void apply(vsg::ViewportState& ias) override + { + viewportState = ViewportState::create(ias); + config->pipelineStates.push_back(viewportState); + } }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -281,7 +317,7 @@ void GraphicsPipelineConfigurator::_assignShaderSetSettings() { // apply defaults AssignGraphicsPipelineStates agps(this); - for(auto& pipelineState : shaderSet->defaultGraphicsPipelineStates) + for (auto& pipelineState : shaderSet->defaultGraphicsPipelineStates) { pipelineState->accept(agps); } @@ -298,7 +334,7 @@ void GraphicsPipelineConfigurator::_assignShaderSetSettings() void GraphicsPipelineConfigurator::traverse(Visitor& visitor) { - for(auto& ps : pipelineStates) ps->accept(visitor); + for (auto& ps : pipelineStates) ps->accept(visitor); if (shaderSet) shaderSet->accept(visitor); if (shaderHints) shaderHints->accept(visitor); if (descriptorConfigurator) descriptorConfigurator->accept(visitor); @@ -306,7 +342,7 @@ void GraphicsPipelineConfigurator::traverse(Visitor& visitor) void GraphicsPipelineConfigurator::traverse(ConstVisitor& visitor) const { - for(auto& ps : pipelineStates) ps->accept(visitor); + for (auto& ps : pipelineStates) ps->accept(visitor); if (shaderSet) shaderSet->accept(visitor); if (shaderHints) shaderHints->accept(visitor); if (descriptorConfigurator) descriptorConfigurator->accept(visitor); @@ -352,7 +388,7 @@ bool GraphicsPipelineConfigurator::enableArray(const std::string& name, VkVertex { if (!attributeBinding.define.empty()) shaderHints->defines.insert(attributeBinding.define); - SetPipelineStates setVertexAttributeState(baseAttributeBinding, attributeBinding, vertexInputRate, stride, format) ; + SetPipelineStates setVertexAttributeState(baseAttributeBinding, attributeBinding, vertexInputRate, stride, format); accept(setVertexAttributeState); return true; } @@ -378,7 +414,7 @@ bool GraphicsPipelineConfigurator::assignArray(DataList& arrays, const std::stri { VkFormat format = array ? array->properties.format : VK_FORMAT_UNDEFINED; - SetPipelineStates setVertexAttributeState(baseAttributeBinding, attributeBinding, vertexInputRate, array->properties.stride, format) ; + SetPipelineStates setVertexAttributeState(baseAttributeBinding, attributeBinding, vertexInputRate, array->properties.stride, format); accept(setVertexAttributeState); arrays.push_back(array); From 0fe145eb7fdf94a5fc3e38ed64511665d92e2540 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 18 Aug 2023 10:06:00 +0100 Subject: [PATCH 31/48] Standardized checks againt null text, layout and font --- src/vsg/text/CpuLayoutTechnique.cpp | 2 +- src/vsg/text/GpuLayoutTechnique.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vsg/text/CpuLayoutTechnique.cpp b/src/vsg/text/CpuLayoutTechnique.cpp index 743ee339d..85e1c6eef 100644 --- a/src/vsg/text/CpuLayoutTechnique.cpp +++ b/src/vsg/text/CpuLayoutTechnique.cpp @@ -42,7 +42,7 @@ void CpuLayoutTechnique::setup(Text* text, uint32_t minimumAllocation, ref_ptrlayout; auto shaderSet = text->shaderSet ? text->shaderSet : createTextShaderSet(options); - textExtents = layout->extents(text->text, *(text->font)); + textExtents = layout->extents(text->text, *font); auto num_quads = vsg::visit(text->text).count; diff --git a/src/vsg/text/GpuLayoutTechnique.cpp b/src/vsg/text/GpuLayoutTechnique.cpp index 8eb9d13ef..881139e95 100644 --- a/src/vsg/text/GpuLayoutTechnique.cpp +++ b/src/vsg/text/GpuLayoutTechnique.cpp @@ -44,8 +44,9 @@ void assignValue(T& dest, const T& src, bool& updated) void GpuLayoutTechnique::setup(Text* text, uint32_t minimumAllocation, ref_ptr options) { - auto layout = text->layout; - if (!layout) return; + if (!text || !(text->text) || !text->font || !text->layout) return; + + auto& layout = text->layout; textExtents = layout->extents(text->text, *(text->font)); From 8ac1186ca83a4a4b3ac85b5942709de8c7265a0e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 18 Aug 2023 17:34:53 +0100 Subject: [PATCH 32/48] Implemented support for CommandGraph::submitOrder and CommandGraph nesting. --- include/vsg/app/CommandGraph.h | 3 +- include/vsg/app/RecordAndSubmitTask.h | 4 +-- include/vsg/app/RecordTraversal.h | 10 ++++-- include/vsg/app/SecondaryCommandGraph.h | 2 +- include/vsg/vk/CommandBuffer.h | 15 ++++++++ src/vsg/app/CommandGraph.cpp | 7 ++-- src/vsg/app/RecordAndSubmitTask.cpp | 12 ++++--- src/vsg/app/RecordTraversal.cpp | 19 ++++++++++ src/vsg/app/SecondaryCommandGraph.cpp | 7 ++-- src/vsg/app/Viewer.cpp | 26 ++++++-------- src/vsg/vk/CommandBuffer.cpp | 47 +++++++++++++++++++++++++ 11 files changed, 120 insertions(+), 32 deletions(-) diff --git a/include/vsg/app/CommandGraph.h b/include/vsg/app/CommandGraph.h index a8bf8ad55..57b1f062a 100644 --- a/include/vsg/app/CommandGraph.h +++ b/include/vsg/app/CommandGraph.h @@ -39,12 +39,13 @@ namespace vsg int queueFamily = -1; int presentFamily = -1; uint32_t maxSlot = 2; + int submitOrder = 0; ref_ptr recordTraversal; virtual VkCommandBufferLevel level() const; virtual void reset(); - virtual void record(CommandBuffers& recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}); + virtual void record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}); protected: virtual ~CommandGraph(); diff --git a/include/vsg/app/RecordAndSubmitTask.h b/include/vsg/app/RecordAndSubmitTask.h index 159a8f948..13697ffae 100644 --- a/include/vsg/app/RecordAndSubmitTask.h +++ b/include/vsg/app/RecordAndSubmitTask.h @@ -31,8 +31,8 @@ namespace vsg virtual VkResult submit(ref_ptr frameStamp = {}); virtual VkResult start(); - virtual VkResult record(CommandBuffers& recordedCommandBuffers, ref_ptr frameStamp); - virtual VkResult finish(CommandBuffers& recordedCommandBuffers); + virtual VkResult record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp); + virtual VkResult finish(ref_ptr recordedCommandBuffers); ref_ptr device; Windows windows; diff --git a/include/vsg/app/RecordTraversal.h b/include/vsg/app/RecordTraversal.h index c0e9410f4..6680cd0c6 100644 --- a/include/vsg/app/RecordTraversal.h +++ b/include/vsg/app/RecordTraversal.h @@ -51,6 +51,8 @@ namespace vsg class DirectionalLight; class PointLight; class SpotLight; + class CommandGraph; + class CommandBufferMap; VSG_type_name(vsg::RecordTraversal); @@ -75,6 +77,9 @@ namespace vsg Mask traversalMask = MASK_ALL; Mask overrideMask = MASK_OFF; + /// Container for CommandBuffers that have been recorded in currrent frame + ref_ptr recordedCommandBuffers; + /// get the current State object used to track state and projection/modelview matrices for the current subgraph being traversed State* getState() { return _state; } @@ -120,6 +125,7 @@ namespace vsg // Viewer level nodes void apply(const View& view); + void apply(const CommandGraph& commandGraph); // clear the bins to record a new frame. void clearBins(); @@ -127,11 +133,11 @@ namespace vsg protected: virtual ~RecordTraversal(); - FrameStamp* _frameStamp = nullptr; + ref_ptr _frameStamp; State* _state = nullptr; // used to handle loading of PagedLOD external children. - DatabasePager* _databasePager = nullptr; + ref_ptr _databasePager; CulledPagedLODs* _culledPagedLODs = nullptr; int32_t _minimumBinNumber = 0; diff --git a/include/vsg/app/SecondaryCommandGraph.h b/include/vsg/app/SecondaryCommandGraph.h index ca2bc1b4f..c099c4486 100644 --- a/include/vsg/app/SecondaryCommandGraph.h +++ b/include/vsg/app/SecondaryCommandGraph.h @@ -34,7 +34,7 @@ namespace vsg VkCommandBufferLevel level() const override; void reset() override; - void record(CommandBuffers& recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}) override; + void record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}) override; protected: virtual ~SecondaryCommandGraph(); diff --git a/include/vsg/vk/CommandBuffer.h b/include/vsg/vk/CommandBuffer.h index f5291597c..5b9646c85 100644 --- a/include/vsg/vk/CommandBuffer.h +++ b/include/vsg/vk/CommandBuffer.h @@ -82,4 +82,19 @@ namespace vsg using CommandBuffers = std::vector>; + /// Thread safe container class + class CommandBufferMap : public Inherit + { + public: + void clear(); + void add(int order, ref_ptr commandGraph); + bool empty() const; + CommandBuffers buffers() const; + + protected: + virtual ~CommandBufferMap(); + mutable std::mutex _mutex; + std::map _commandBuffers; + }; + } // namespace vsg diff --git a/src/vsg/app/CommandGraph.cpp b/src/vsg/app/CommandGraph.cpp index c4ff88f8c..e2fc7c8ca 100644 --- a/src/vsg/app/CommandGraph.cpp +++ b/src/vsg/app/CommandGraph.cpp @@ -50,7 +50,7 @@ void CommandGraph::reset() { } -void CommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) +void CommandGraph::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) { if (window && !window->visible()) { @@ -67,6 +67,7 @@ void CommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_ptrgetState()->stateStacks.resize(maxSlot + 1); } + recordTraversal->recordedCommandBuffers = recordedCommandBuffers; recordTraversal->setFrameStamp(frameStamp); recordTraversal->setDatabasePager(databasePager); recordTraversal->clearBins(); @@ -112,11 +113,11 @@ void CommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_ptrsetProjectionAndViewMatrix(camera->projectionMatrix->transform(), camera->viewMatrix->transform()); } - accept(*recordTraversal); + traverse(*recordTraversal); vkEndCommandBuffer(vk_commandBuffer); - recordedCommandBuffers.push_back(commandBuffer); + recordedCommandBuffers->add(submitOrder, commandBuffer); } ref_ptr vsg::createCommandGraphForView(ref_ptr window, ref_ptr camera, ref_ptr scenegraph, VkSubpassContents contents, bool assignHeadlight) diff --git a/src/vsg/app/RecordAndSubmitTask.cpp b/src/vsg/app/RecordAndSubmitTask.cpp index a52d68796..ceeac2edd 100644 --- a/src/vsg/app/RecordAndSubmitTask.cpp +++ b/src/vsg/app/RecordAndSubmitTask.cpp @@ -77,7 +77,8 @@ Fence* RecordAndSubmitTask::fence(size_t relativeFrameIndex) VkResult RecordAndSubmitTask::submit(ref_ptr frameStamp) { - CommandBuffers recordedCommandBuffers; + auto recordedCommandBuffers = CommandBufferMap::create(); + if (VkResult result = start(); result != VK_SUCCESS) return result; if (earlyTransferTask) @@ -106,7 +107,7 @@ VkResult RecordAndSubmitTask::start() return VK_SUCCESS; } -VkResult RecordAndSubmitTask::record(CommandBuffers& recordedCommandBuffers, ref_ptr frameStamp) +VkResult RecordAndSubmitTask::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp) { for (auto& commandGraph : commandGraphs) { @@ -116,14 +117,14 @@ VkResult RecordAndSubmitTask::record(CommandBuffers& recordedCommandBuffers, ref return VK_SUCCESS; } -VkResult RecordAndSubmitTask::finish(CommandBuffers& recordedCommandBuffers) +VkResult RecordAndSubmitTask::finish(ref_ptr recordedCommandBuffers) { if (lateTransferTask) { if (VkResult result = lateTransferTask->transferDynamicData(); result != VK_SUCCESS) return result; } - if (recordedCommandBuffers.empty()) + if (recordedCommandBuffers->empty()) { // nothing to do so return early std::this_thread::sleep_for(std::chrono::milliseconds(16)); // sleep for 1/60th of a second @@ -139,7 +140,8 @@ VkResult RecordAndSubmitTask::finish(CommandBuffers& recordedCommandBuffers) auto current_fence = fence(); // convert VSG CommandBuffer to Vulkan handles and add to the Fence's list of dependent CommandBuffers - for (auto& commandBuffer : recordedCommandBuffers) + auto buffers = recordedCommandBuffers->buffers(); + for (auto& commandBuffer : buffers) { if (commandBuffer->level() == VK_COMMAND_BUFFER_LEVEL_PRIMARY) vk_commandBuffers.push_back(*commandBuffer); diff --git a/src/vsg/app/RecordTraversal.cpp b/src/vsg/app/RecordTraversal.cpp index f7a4821c7..5d2b88e9b 100644 --- a/src/vsg/app/RecordTraversal.cpp +++ b/src/vsg/app/RecordTraversal.cpp @@ -11,6 +11,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ #include +#include #include #include #include @@ -477,3 +478,21 @@ void RecordTraversal::apply(const View& view) _state->_commandBuffer->traversalMask = cached_traversalMask; _viewDependentState = cached_viewDependentState; } + +void RecordTraversal::apply(const CommandGraph& commandGraph) +{ + if (recordedCommandBuffers) + { + info("RecordTraversal::apply(const CommandGraph& commandGraph) NESTED ", &commandGraph); + + auto cg = const_cast(&commandGraph); + + cg->record(recordedCommandBuffers, _frameStamp, _databasePager); + cg->traverse(*this); + } + else + { + commandGraph.traverse(*this); + } + +} diff --git a/src/vsg/app/SecondaryCommandGraph.cpp b/src/vsg/app/SecondaryCommandGraph.cpp index ee9acea89..63378d558 100644 --- a/src/vsg/app/SecondaryCommandGraph.cpp +++ b/src/vsg/app/SecondaryCommandGraph.cpp @@ -56,7 +56,7 @@ void SecondaryCommandGraph::_disconnect(ExecuteCommands* ec) if (itr != _executeCommands.end()) _executeCommands.erase(itr); } -void SecondaryCommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) +void SecondaryCommandGraph::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) { if (window && !window->visible()) { @@ -73,6 +73,7 @@ void SecondaryCommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_p recordTraversal->getState()->stateStacks.resize(maxSlot + 1); } + recordTraversal->recordedCommandBuffers = recordedCommandBuffers; recordTraversal->setFrameStamp(frameStamp); recordTraversal->setDatabasePager(databasePager); recordTraversal->clearBins(); @@ -140,7 +141,7 @@ void SecondaryCommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_p recordTraversal->setProjectionAndViewMatrix(camera->projectionMatrix->transform(), camera->viewMatrix->transform()); } - accept(*recordTraversal); + traverse(*recordTraversal); vkEndCommandBuffer(vk_commandBuffer); @@ -150,7 +151,7 @@ void SecondaryCommandGraph::record(CommandBuffers& recordedCommandBuffers, ref_p ec->completed(*this, commandBuffer); } - recordedCommandBuffers.push_back(commandBuffer); + recordedCommandBuffers->add(submitOrder, commandBuffer); } ref_ptr vsg::createSecondaryCommandGraphForView(ref_ptr window, ref_ptr camera, ref_ptr scenegraph, uint32_t subpass, bool assignHeadlight) diff --git a/src/vsg/app/Viewer.cpp b/src/vsg/app/Viewer.cpp index 019e85104..6b133a37d 100644 --- a/src/vsg/app/Viewer.cpp +++ b/src/vsg/app/Viewer.cpp @@ -615,14 +615,14 @@ void Viewer::setupThreading() // we have multiple CommandGraphs in a single Task so set up a thread per CommandGraph struct SharedData : public Inherit { - SharedData(ref_ptr in_task, ref_ptr in_frameBlock, ref_ptr in_submissionCompleted, uint32_t numThreads, size_t numCommandGraphs) : + SharedData(ref_ptr in_task, ref_ptr in_frameBlock, ref_ptr in_submissionCompleted, uint32_t numThreads) : task(in_task), frameBlock(in_frameBlock), submissionCompletedBarrier(in_submissionCompleted) { + recordedCommandBuffers = CommandBufferMap::create(); recordStartBarrier = Barrier::create(numThreads); recordCompletedBarrier = Barrier::create(numThreads); - orderedRecordedCommandBuffers.resize(numCommandGraphs); } // shared between all threads @@ -631,8 +631,7 @@ void Viewer::setupThreading() ref_ptr submissionCompletedBarrier; // shared between threads associated with each task - std::vector orderedRecordedCommandBuffers; - + ref_ptr recordedCommandBuffers; ref_ptr recordStartBarrier; ref_ptr recordCompletedBarrier; }; @@ -640,7 +639,7 @@ void Viewer::setupThreading() uint32_t numThreads = static_cast(task->commandGraphs.size()); if (task->earlyTransferTask) ++numThreads; - ref_ptr sharedData = SharedData::create(task, _frameBlock, _submissionCompleted, numThreads, task->commandGraphs.size()); + ref_ptr sharedData = SharedData::create(task, _frameBlock, _submissionCompleted, numThreads); auto run_primary = [](ref_ptr data, ref_ptr commandGraph) { auto frameStamp = data->frameBlock->initial_value; @@ -655,23 +654,20 @@ void Viewer::setupThreading() //vsg::info("run_primary"); - commandGraph->record(data->orderedRecordedCommandBuffers.front(), frameStamp, data->task->databasePager); + commandGraph->record(data->recordedCommandBuffers, frameStamp, data->task->databasePager); data->recordCompletedBarrier->arrive_and_wait(); // primary thread finishes the task, submitting all the command buffers recorded by the primary and all secondary threads to its queue - CommandBuffers localRecordedCommandBuffers; - for (const auto& commandBuffers : data->orderedRecordedCommandBuffers) - localRecordedCommandBuffers.insert(localRecordedCommandBuffers.end(), commandBuffers.begin(), commandBuffers.end()); - data->task->finish(localRecordedCommandBuffers); - for (auto& commandBuffers : data->orderedRecordedCommandBuffers) - commandBuffers.clear(); + data->task->finish(data->recordedCommandBuffers); + + data->recordedCommandBuffers->clear(); data->submissionCompletedBarrier->arrive_and_wait(); } }; - auto run_secondary = [](ref_ptr data, ref_ptr commandGraph, uint32_t commandGraphIndex) { + auto run_secondary = [](ref_ptr data, ref_ptr commandGraph) { auto frameStamp = data->frameBlock->initial_value; // wait for this frame to be signaled @@ -679,7 +675,7 @@ void Viewer::setupThreading() { data->recordStartBarrier->arrive_and_wait(); - commandGraph->record(data->orderedRecordedCommandBuffers[commandGraphIndex], frameStamp, data->task->databasePager); + commandGraph->record(data->recordedCommandBuffers, frameStamp, data->task->databasePager); data->recordCompletedBarrier->arrive_and_wait(); } @@ -706,7 +702,7 @@ void Viewer::setupThreading() if (i == 0) threads.emplace_back(run_primary, sharedData, task->commandGraphs[i]); else - threads.emplace_back(run_secondary, sharedData, task->commandGraphs[i], i); + threads.emplace_back(run_secondary, sharedData, task->commandGraphs[i]); } if (task->earlyTransferTask) diff --git a/src/vsg/vk/CommandBuffer.cpp b/src/vsg/vk/CommandBuffer.cpp index f7e8d8c0b..4c18acc85 100644 --- a/src/vsg/vk/CommandBuffer.cpp +++ b/src/vsg/vk/CommandBuffer.cpp @@ -17,6 +17,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI using namespace vsg; +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// CommandBuffer +// CommandBuffer::CommandBuffer(CommandPool* commandPool, VkCommandBuffer commandBuffer, VkCommandBufferLevel level) : deviceID(commandPool->getDevice()->deviceID), scratchMemory(ScratchMemory::create(4096)), @@ -44,3 +48,46 @@ void CommandBuffer::reset() _commandPool->reset(); } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// CommandBufferMap +// +CommandBufferMap::~CommandBufferMap() +{ +} + +void CommandBufferMap::clear() +{ + std::scoped_lock lock(_mutex); + _commandBuffers.clear(); +} + +void CommandBufferMap::add(int submitOder, ref_ptr commandBuffer) +{ + std::scoped_lock lock(_mutex); + _commandBuffers[submitOder].push_back(commandBuffer); +} + +bool CommandBufferMap::empty() const +{ + std::scoped_lock lock(_mutex); + return _commandBuffers.empty(); +} + +CommandBuffers CommandBufferMap::buffers() const +{ + std::scoped_lock lock(_mutex); + + if (_commandBuffers.empty()) return {}; + if (_commandBuffers.size()==1) return _commandBuffers.begin()->second; + + CommandBuffers buffers; + for(auto itr = _commandBuffers.begin(); itr != _commandBuffers.end(); ++itr) + { + auto& cbs = itr->second; + buffers.insert(buffers.end(), cbs.begin(), cbs.end()); + } + + return buffers; +} From b226f9512bfadcc329b286e5adaa50066ec18719 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 18 Aug 2023 18:07:55 +0100 Subject: [PATCH 33/48] Removed debug message --- src/vsg/app/RecordTraversal.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/vsg/app/RecordTraversal.cpp b/src/vsg/app/RecordTraversal.cpp index 5d2b88e9b..8c79bc690 100644 --- a/src/vsg/app/RecordTraversal.cpp +++ b/src/vsg/app/RecordTraversal.cpp @@ -483,10 +483,7 @@ void RecordTraversal::apply(const CommandGraph& commandGraph) { if (recordedCommandBuffers) { - info("RecordTraversal::apply(const CommandGraph& commandGraph) NESTED ", &commandGraph); - auto cg = const_cast(&commandGraph); - cg->record(recordedCommandBuffers, _frameStamp, _databasePager); cg->traverse(*this); } From d6fdff6e78219fc8d0b66f0f8d091b5b49182ffa Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 19 Aug 2023 17:17:58 +0100 Subject: [PATCH 34/48] Replaced CommandBufferMap with RecordedCommandBuffers class that better handles the ordering of nested hierachies. --- include/vsg/app/CommandGraph.h | 2 +- include/vsg/app/RecordAndSubmitTask.h | 4 +-- include/vsg/app/RecordTraversal.h | 4 +-- include/vsg/app/SecondaryCommandGraph.h | 2 +- include/vsg/vk/CommandBuffer.h | 13 ++++++-- src/vsg/app/CommandGraph.cpp | 2 +- src/vsg/app/RecordAndSubmitTask.cpp | 6 ++-- src/vsg/app/RecordTraversal.cpp | 1 - src/vsg/app/SecondaryCommandGraph.cpp | 2 +- src/vsg/app/Viewer.cpp | 4 +-- src/vsg/vk/CommandBuffer.cpp | 42 ++++++++++++++++++------- 11 files changed, 53 insertions(+), 29 deletions(-) diff --git a/include/vsg/app/CommandGraph.h b/include/vsg/app/CommandGraph.h index 57b1f062a..7de5e1eeb 100644 --- a/include/vsg/app/CommandGraph.h +++ b/include/vsg/app/CommandGraph.h @@ -45,7 +45,7 @@ namespace vsg virtual VkCommandBufferLevel level() const; virtual void reset(); - virtual void record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}); + virtual void record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}); protected: virtual ~CommandGraph(); diff --git a/include/vsg/app/RecordAndSubmitTask.h b/include/vsg/app/RecordAndSubmitTask.h index 13697ffae..abb419d88 100644 --- a/include/vsg/app/RecordAndSubmitTask.h +++ b/include/vsg/app/RecordAndSubmitTask.h @@ -31,8 +31,8 @@ namespace vsg virtual VkResult submit(ref_ptr frameStamp = {}); virtual VkResult start(); - virtual VkResult record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp); - virtual VkResult finish(ref_ptr recordedCommandBuffers); + virtual VkResult record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp); + virtual VkResult finish(ref_ptr recordedCommandBuffers); ref_ptr device; Windows windows; diff --git a/include/vsg/app/RecordTraversal.h b/include/vsg/app/RecordTraversal.h index 6680cd0c6..ec4cee09f 100644 --- a/include/vsg/app/RecordTraversal.h +++ b/include/vsg/app/RecordTraversal.h @@ -52,7 +52,7 @@ namespace vsg class PointLight; class SpotLight; class CommandGraph; - class CommandBufferMap; + class RecordedCommandBuffers; VSG_type_name(vsg::RecordTraversal); @@ -78,7 +78,7 @@ namespace vsg Mask overrideMask = MASK_OFF; /// Container for CommandBuffers that have been recorded in currrent frame - ref_ptr recordedCommandBuffers; + ref_ptr recordedCommandBuffers; /// get the current State object used to track state and projection/modelview matrices for the current subgraph being traversed State* getState() { return _state; } diff --git a/include/vsg/app/SecondaryCommandGraph.h b/include/vsg/app/SecondaryCommandGraph.h index c099c4486..389381b7d 100644 --- a/include/vsg/app/SecondaryCommandGraph.h +++ b/include/vsg/app/SecondaryCommandGraph.h @@ -34,7 +34,7 @@ namespace vsg VkCommandBufferLevel level() const override; void reset() override; - void record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}) override; + void record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp = {}, ref_ptr databasePager = {}) override; protected: virtual ~SecondaryCommandGraph(); diff --git a/include/vsg/vk/CommandBuffer.h b/include/vsg/vk/CommandBuffer.h index 5b9646c85..feb4e2c77 100644 --- a/include/vsg/vk/CommandBuffer.h +++ b/include/vsg/vk/CommandBuffer.h @@ -83,18 +83,25 @@ namespace vsg using CommandBuffers = std::vector>; /// Thread safe container class - class CommandBufferMap : public Inherit + class RecordedCommandBuffers : public Inherit { public: + + ref_ptr getOrCreateRecordedCommandBuffers(int submitOrder); + void clear(); void add(int order, ref_ptr commandGraph); bool empty() const; + CommandBuffers buffers() const; protected: - virtual ~CommandBufferMap(); + virtual ~RecordedCommandBuffers(); mutable std::mutex _mutex; - std::map _commandBuffers; + std::map> _orderedCommandBuffers; + CommandBuffers _commandBuffers; }; + VSG_type_name(vsg::RecordedCommandBuffers); + } // namespace vsg diff --git a/src/vsg/app/CommandGraph.cpp b/src/vsg/app/CommandGraph.cpp index e2fc7c8ca..34ac78316 100644 --- a/src/vsg/app/CommandGraph.cpp +++ b/src/vsg/app/CommandGraph.cpp @@ -50,7 +50,7 @@ void CommandGraph::reset() { } -void CommandGraph::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) +void CommandGraph::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) { if (window && !window->visible()) { diff --git a/src/vsg/app/RecordAndSubmitTask.cpp b/src/vsg/app/RecordAndSubmitTask.cpp index ceeac2edd..18e5acf5a 100644 --- a/src/vsg/app/RecordAndSubmitTask.cpp +++ b/src/vsg/app/RecordAndSubmitTask.cpp @@ -77,7 +77,7 @@ Fence* RecordAndSubmitTask::fence(size_t relativeFrameIndex) VkResult RecordAndSubmitTask::submit(ref_ptr frameStamp) { - auto recordedCommandBuffers = CommandBufferMap::create(); + auto recordedCommandBuffers = RecordedCommandBuffers::create(); if (VkResult result = start(); result != VK_SUCCESS) return result; @@ -107,7 +107,7 @@ VkResult RecordAndSubmitTask::start() return VK_SUCCESS; } -VkResult RecordAndSubmitTask::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp) +VkResult RecordAndSubmitTask::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp) { for (auto& commandGraph : commandGraphs) { @@ -117,7 +117,7 @@ VkResult RecordAndSubmitTask::record(ref_ptr recordedCommandBu return VK_SUCCESS; } -VkResult RecordAndSubmitTask::finish(ref_ptr recordedCommandBuffers) +VkResult RecordAndSubmitTask::finish(ref_ptr recordedCommandBuffers) { if (lateTransferTask) { diff --git a/src/vsg/app/RecordTraversal.cpp b/src/vsg/app/RecordTraversal.cpp index 8c79bc690..b04f939ab 100644 --- a/src/vsg/app/RecordTraversal.cpp +++ b/src/vsg/app/RecordTraversal.cpp @@ -485,7 +485,6 @@ void RecordTraversal::apply(const CommandGraph& commandGraph) { auto cg = const_cast(&commandGraph); cg->record(recordedCommandBuffers, _frameStamp, _databasePager); - cg->traverse(*this); } else { diff --git a/src/vsg/app/SecondaryCommandGraph.cpp b/src/vsg/app/SecondaryCommandGraph.cpp index 63378d558..2613922bf 100644 --- a/src/vsg/app/SecondaryCommandGraph.cpp +++ b/src/vsg/app/SecondaryCommandGraph.cpp @@ -56,7 +56,7 @@ void SecondaryCommandGraph::_disconnect(ExecuteCommands* ec) if (itr != _executeCommands.end()) _executeCommands.erase(itr); } -void SecondaryCommandGraph::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) +void SecondaryCommandGraph::record(ref_ptr recordedCommandBuffers, ref_ptr frameStamp, ref_ptr databasePager) { if (window && !window->visible()) { diff --git a/src/vsg/app/Viewer.cpp b/src/vsg/app/Viewer.cpp index 6b133a37d..4e273d01f 100644 --- a/src/vsg/app/Viewer.cpp +++ b/src/vsg/app/Viewer.cpp @@ -620,7 +620,7 @@ void Viewer::setupThreading() frameBlock(in_frameBlock), submissionCompletedBarrier(in_submissionCompleted) { - recordedCommandBuffers = CommandBufferMap::create(); + recordedCommandBuffers = RecordedCommandBuffers::create(); recordStartBarrier = Barrier::create(numThreads); recordCompletedBarrier = Barrier::create(numThreads); } @@ -631,7 +631,7 @@ void Viewer::setupThreading() ref_ptr submissionCompletedBarrier; // shared between threads associated with each task - ref_ptr recordedCommandBuffers; + ref_ptr recordedCommandBuffers; ref_ptr recordStartBarrier; ref_ptr recordCompletedBarrier; }; diff --git a/src/vsg/vk/CommandBuffer.cpp b/src/vsg/vk/CommandBuffer.cpp index 4c18acc85..4e0b58c66 100644 --- a/src/vsg/vk/CommandBuffer.cpp +++ b/src/vsg/vk/CommandBuffer.cpp @@ -51,42 +51,60 @@ void CommandBuffer::reset() //////////////////////////////////////////////////////////////////////////////////////////////////// // -// CommandBufferMap +// RecordedCommandBuffers // -CommandBufferMap::~CommandBufferMap() +RecordedCommandBuffers::~RecordedCommandBuffers() { } -void CommandBufferMap::clear() +void RecordedCommandBuffers::clear() { std::scoped_lock lock(_mutex); + _orderedCommandBuffers.clear(); _commandBuffers.clear(); } -void CommandBufferMap::add(int submitOder, ref_ptr commandBuffer) +ref_ptr RecordedCommandBuffers::getOrCreateRecordedCommandBuffers(int submitOrder) +{ + auto& scb = _orderedCommandBuffers[submitOrder]; + if (!scb) scb = RecordedCommandBuffers::create(); + return scb; +} + +void RecordedCommandBuffers::add(int submitOrder, ref_ptr commandBuffer) { std::scoped_lock lock(_mutex); - _commandBuffers[submitOder].push_back(commandBuffer); + if (submitOrder == 0) _commandBuffers.push_back(commandBuffer); + else getOrCreateRecordedCommandBuffers(submitOrder)->_commandBuffers.push_back(commandBuffer); } -bool CommandBufferMap::empty() const +bool RecordedCommandBuffers::empty() const { std::scoped_lock lock(_mutex); return _commandBuffers.empty(); } -CommandBuffers CommandBufferMap::buffers() const +CommandBuffers RecordedCommandBuffers::buffers() const { std::scoped_lock lock(_mutex); - if (_commandBuffers.empty()) return {}; - if (_commandBuffers.size()==1) return _commandBuffers.begin()->second; + if (_orderedCommandBuffers.empty()) return _commandBuffers; + + auto mid_itr = _orderedCommandBuffers.lower_bound(0); CommandBuffers buffers; - for(auto itr = _commandBuffers.begin(); itr != _commandBuffers.end(); ++itr) + for(auto itr = _orderedCommandBuffers.begin(); itr != mid_itr; ++itr) + { + auto nested_buffers = itr->second->buffers(); + buffers.insert(buffers.end(), nested_buffers.begin(), nested_buffers.end()); + } + + buffers.insert(buffers.end(), _commandBuffers.begin(), _commandBuffers.end()); + + for(auto itr = mid_itr; itr != _orderedCommandBuffers.end(); ++itr) { - auto& cbs = itr->second; - buffers.insert(buffers.end(), cbs.begin(), cbs.end()); + auto nested_buffers = itr->second->buffers(); + buffers.insert(buffers.end(), nested_buffers.begin(), nested_buffers.end()); } return buffers; From 3f7915b5d53a3d5a6dc9ae2c1102fdfa2fccf6af Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 20 Aug 2023 17:34:23 +0100 Subject: [PATCH 35/48] Added missing initializers --- include/vsg/ui/PointerEvent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vsg/ui/PointerEvent.h b/include/vsg/ui/PointerEvent.h index 9be5a9bad..68dadbf1f 100644 --- a/include/vsg/ui/PointerEvent.h +++ b/include/vsg/ui/PointerEvent.h @@ -43,7 +43,7 @@ namespace vsg int32_t x = 0; int32_t y = 0; - ButtonMask mask = {}; + ButtonMask mask = BUTTON_MASK_OFF; void read(Input& input) override; void write(Output& output) const override; @@ -77,7 +77,7 @@ namespace vsg Inherit(in_window, in_time, in_x, in_y, in_buttonMask), button(in_button) {} - uint32_t button; + uint32_t button = 0; void read(Input& input) override; void write(Output& output) const override; From 3a678a664f784a06212ad336cd4f700e0a01d15e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 20 Aug 2023 18:14:55 +0100 Subject: [PATCH 36/48] Removed misleading comments --- include/vsg/ui/PointerEvent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vsg/ui/PointerEvent.h b/include/vsg/ui/PointerEvent.h index 68dadbf1f..1a9678a4e 100644 --- a/include/vsg/ui/PointerEvent.h +++ b/include/vsg/ui/PointerEvent.h @@ -25,8 +25,8 @@ namespace vsg BUTTON_MASK_1 = 256, BUTTON_MASK_2 = 512, BUTTON_MASK_3 = 1024, - BUTTON_MASK_4 = 2048, /// mouse wheel up - BUTTON_MASK_5 = 4096 /// mouse wheel down + BUTTON_MASK_4 = 2048, + BUTTON_MASK_5 = 4096 }; /// PointerEvent is a base class for mouse pointer events From efb55cf7b43ead936dd0d6800010f4d009078b28 Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Sun, 20 Aug 2023 18:15:40 +0100 Subject: [PATCH 37/48] Added support for XBUTTTON's 1 and 2. --- include/vsg/platform/win32/Win32_Window.h | 36 +++++++++++++++++++---- src/vsg/platform/win32/Win32_Window.cpp | 11 ++++--- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/include/vsg/platform/win32/Win32_Window.h b/include/vsg/platform/win32/Win32_Window.h index 4c85766ee..cccc5a6d1 100644 --- a/include/vsg/platform/win32/Win32_Window.h +++ b/include/vsg/platform/win32/Win32_Window.h @@ -119,16 +119,40 @@ namespace vsgWin32 return static_cast(mask); } - inline uint32_t getButtonDownEventDetail(UINT buttonMsg) + inline uint32_t getButtonDownEventDetail(UINT buttonMsg, WORD wParamHi) { - return buttonMsg == WM_LBUTTONDOWN ? 1 : (buttonMsg == WM_MBUTTONDOWN ? 2 : buttonMsg == WM_RBUTTONDOWN ? 3 - : (buttonMsg == WM_XBUTTONDOWN ? 4 : 0)); // need to determine x1, x2 + switch (buttonMsg) + { + case WM_LBUTTONDOWN: return 1; + case WM_MBUTTONDOWN: return 2; + case WM_RBUTTONDOWN: return 3; + case WM_XBUTTONDOWN: + if (wParamHi == XBUTTON1) + return 4; + else if (wParamHi == XBUTTON2) + return 5; + else return 0; + default: + return 0; + } } - inline uint32_t getButtonUpEventDetail(UINT buttonMsg) + inline uint32_t getButtonUpEventDetail(UINT buttonMsg, WORD wParamHi) { - return buttonMsg == WM_LBUTTONUP ? 1 : (buttonMsg == WM_MBUTTONUP ? 2 : buttonMsg == WM_RBUTTONUP ? 3 - : (buttonMsg == WM_XBUTTONUP ? 4 : 0)); + switch (buttonMsg) + { + case WM_LBUTTONUP: return 1; + case WM_MBUTTONUP: return 2; + case WM_RBUTTONUP: return 3; + case WM_XBUTTONUP: + if (wParamHi == XBUTTON1) + return 4; + else if (wParamHi == XBUTTON2) + return 5; + else return 0; + default: + return 0; + } } /// Win32_Window implements Win32 specific window creation, event handling and vulkan Surface setup. diff --git a/src/vsg/platform/win32/Win32_Window.cpp b/src/vsg/platform/win32/Win32_Window.cpp index d8e5ea3ac..445eca7dc 100644 --- a/src/vsg/platform/win32/Win32_Window.cpp +++ b/src/vsg/platform/win32/Win32_Window.cpp @@ -566,24 +566,27 @@ LRESULT Win32_Window::handleWin32Messages(UINT msg, WPARAM wParam, LPARAM lParam case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: + case WM_XBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_MBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: { + case WM_RBUTTONDBLCLK: + case WM_XBUTTONDBLCLK: { int32_t mx = GET_X_LPARAM(lParam); int32_t my = GET_Y_LPARAM(lParam); - bufferedEvents.emplace_back(vsg::ButtonPressEvent::create(this, event_time, mx, my, getButtonMask(wParam), getButtonDownEventDetail(msg))); + bufferedEvents.emplace_back(vsg::ButtonPressEvent::create(this, event_time, mx, my, getButtonMask(wParam), getButtonDownEventDetail(msg, HIWORD(wParam)))); //::SetCapture(_window); } break; case WM_LBUTTONUP: case WM_MBUTTONUP: - case WM_RBUTTONUP: { + case WM_RBUTTONUP: + case WM_XBUTTONUP: { int32_t mx = GET_X_LPARAM(lParam); int32_t my = GET_Y_LPARAM(lParam); - bufferedEvents.emplace_back(vsg::ButtonReleaseEvent::create(this, event_time, mx, my, getButtonMask(wParam), getButtonUpEventDetail(msg))); + bufferedEvents.emplace_back(vsg::ButtonReleaseEvent::create(this, event_time, mx, my, getButtonMask(wParam), getButtonUpEventDetail(msg, HIWORD(wParam)))); //::ReleaseCapture(); // should only release once all mouse buttons are released ?? break; From 1d8c7d3fa00fc163ed4645eaf2f505108bde22dc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 20 Aug 2023 20:19:42 +0100 Subject: [PATCH 38/48] Added remapping of the 8 & 9 buttons to 4 and 5 to be consistent with Window XButtons --- src/vsg/platform/xcb/Xcb_Window.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/vsg/platform/xcb/Xcb_Window.cpp b/src/vsg/platform/xcb/Xcb_Window.cpp index 076b53406..bc581516b 100644 --- a/src/vsg/platform/xcb/Xcb_Window.cpp +++ b/src/vsg/platform/xcb/Xcb_Window.cpp @@ -702,10 +702,10 @@ bool Xcb_Window::pollEvents(UIEvents& events) case (XCB_BUTTON_PRESS): { auto button_press = reinterpret_cast(event); - vsg::clock::time_point event_time = _first_xcb_time_point + std::chrono::milliseconds(button_press->time - _first_xcb_timestamp); - if (button_press->same_screen) { + vsg::clock::time_point event_time = _first_xcb_time_point + std::chrono::milliseconds(button_press->time - _first_xcb_timestamp); + // X11/Xcb treat scroll wheel up/down as button 4 and 5 so handle these as such if (button_press->detail == 4) { @@ -717,9 +717,15 @@ bool Xcb_Window::pollEvents(UIEvents& events) } else { - uint16_t pressedButtonMask = 1 << (7 + button_press->detail); + uint16_t button = button_press->detail; + + // remap 8, 9 tp 4 and 5 to be consistent with Windows treatment of the XButtons + if (button==8) button = 4; + if (button==9) button = 5; + + uint16_t pressedButtonMask = BUTTON_MASK_1 << (button-1); uint16_t newButtonMask = maskButtons(button_press->state) | pressedButtonMask; - bufferedEvents.emplace_back(vsg::ButtonPressEvent::create(this, event_time, button_press->event_x, button_press->event_y, vsg::ButtonMask(newButtonMask), button_press->detail)); + bufferedEvents.emplace_back(vsg::ButtonPressEvent::create(this, event_time, button_press->event_x, button_press->event_y, vsg::ButtonMask(newButtonMask), button)); } } @@ -732,9 +738,16 @@ bool Xcb_Window::pollEvents(UIEvents& events) if (button_release->same_screen && button_release->detail != 4 && button_release->detail != 5) { vsg::clock::time_point event_time = _first_xcb_time_point + std::chrono::milliseconds(button_release->time - _first_xcb_timestamp); - uint16_t releasedButtonMask = 1 << (7 + button_release->detail); + + uint16_t button = button_release->detail; + + // remap 8, 9 tp 4 and 5 to be consistent with Windows treatment of the XButtons + if (button==8) button = 4; + if (button==9) button = 5; + + uint16_t releasedButtonMask = BUTTON_MASK_1 << (button-1); uint16_t newButtonMask = maskButtons(button_release->state) & ~releasedButtonMask; - bufferedEvents.emplace_back(vsg::ButtonReleaseEvent::create(this, event_time, button_release->event_x, button_release->event_y, vsg::ButtonMask(newButtonMask), button_release->detail)); + bufferedEvents.emplace_back(vsg::ButtonReleaseEvent::create(this, event_time, button_release->event_x, button_release->event_y, vsg::ButtonMask(newButtonMask), button)); } break; From 1a5f0c9420685e9e69ddb64a53cc19b25ffe6708 Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Mon, 21 Aug 2023 09:43:54 +0200 Subject: [PATCH 39/48] [FIXED] typos --- src/vsg/platform/xcb/Xcb_Window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vsg/platform/xcb/Xcb_Window.cpp b/src/vsg/platform/xcb/Xcb_Window.cpp index bc581516b..44dae69d7 100644 --- a/src/vsg/platform/xcb/Xcb_Window.cpp +++ b/src/vsg/platform/xcb/Xcb_Window.cpp @@ -719,7 +719,7 @@ bool Xcb_Window::pollEvents(UIEvents& events) { uint16_t button = button_press->detail; - // remap 8, 9 tp 4 and 5 to be consistent with Windows treatment of the XButtons + // remap 8, 9 to 4 and 5 to be consistent with Windows treatment of the XButtons if (button==8) button = 4; if (button==9) button = 5; @@ -741,7 +741,7 @@ bool Xcb_Window::pollEvents(UIEvents& events) uint16_t button = button_release->detail; - // remap 8, 9 tp 4 and 5 to be consistent with Windows treatment of the XButtons + // remap 8, 9 to 4 and 5 to be consistent with Windows treatment of the XButtons if (button==8) button = 4; if (button==9) button = 5; From 1e5639c3d18ae71fb3394dd2aff190308857bf59 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 Aug 2023 12:01:11 +0100 Subject: [PATCH 40/48] Rand clang-format --- include/vsg/platform/win32/Win32_Window.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/vsg/platform/win32/Win32_Window.h b/include/vsg/platform/win32/Win32_Window.h index cccc5a6d1..e0cc9a601 100644 --- a/include/vsg/platform/win32/Win32_Window.h +++ b/include/vsg/platform/win32/Win32_Window.h @@ -131,7 +131,8 @@ namespace vsgWin32 return 4; else if (wParamHi == XBUTTON2) return 5; - else return 0; + else + return 0; default: return 0; } @@ -145,11 +146,12 @@ namespace vsgWin32 case WM_MBUTTONUP: return 2; case WM_RBUTTONUP: return 3; case WM_XBUTTONUP: - if (wParamHi == XBUTTON1) + if (wParamHi == XBUTTON1) return 4; else if (wParamHi == XBUTTON2) return 5; - else return 0; + else + return 0; default: return 0; } From 4ebe362d515a28236d6db62eddcc021d18beead1 Mon Sep 17 00:00:00 2001 From: siystar Date: Mon, 21 Aug 2023 16:50:43 +0200 Subject: [PATCH 41/48] [FIXED] duplicate entries in VkDescriptorPoolSizes --- src/vsg/vk/Context.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vsg/vk/Context.cpp b/src/vsg/vk/Context.cpp index f2c2b6663..692cfdabd 100644 --- a/src/vsg/vk/Context.cpp +++ b/src/vsg/vk/Context.cpp @@ -167,9 +167,10 @@ void Context::getDescriptorPoolSizesToUse(uint32_t& maxSets, DescriptorPoolSizes auto itr = descriptorPoolSizes.begin(); for (; itr != descriptorPoolSizes.end(); ++itr) { - if (itr->type == minimum_type && minimum_descriptorCount > itr->descriptorCount) + if (itr->type == minimum_type) { - itr->descriptorCount = minimum_descriptorCount; + if (minimum_descriptorCount > itr->descriptorCount) + itr->descriptorCount = minimum_descriptorCount; break; } } From 5fdf6e910a9b9a74cf4721d96acfa1e26e55d6c5 Mon Sep 17 00:00:00 2001 From: siystar Date: Mon, 21 Aug 2023 16:50:48 +0200 Subject: [PATCH 42/48] [FIXED] counting of duplicate entries in _availableDescriptorPoolSizes --- src/vsg/vk/DescriptorPool.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/vsg/vk/DescriptorPool.cpp b/src/vsg/vk/DescriptorPool.cpp index 0aaf51b68..75d285722 100644 --- a/src/vsg/vk/DescriptorPool.cpp +++ b/src/vsg/vk/DescriptorPool.cpp @@ -79,34 +79,26 @@ ref_ptr DescriptorPool::allocateDescriptorSet(Des DescriptorPoolSizes descriptorPoolSizes; descriptorSetLayout->getDescriptorPoolSizes(descriptorPoolSizes); - size_t matches = 0; + auto newDescriptorPoolSizes = _availableDescriptorPoolSizes; for (auto& [type, descriptorCount] : descriptorPoolSizes) { - for (auto& [availableType, availableCount] : _availableDescriptorPoolSizes) + size_t foundDescriptorCount = 0; + for (auto& [availableType, availableCount] : newDescriptorPoolSizes) { if (availableType == type) { - if (availableCount >= descriptorCount) ++matches; - } - } - } - - if (matches < descriptorPoolSizes.size()) - { - return {}; - } - - for (auto& [type, descriptorCount] : descriptorPoolSizes) - { - for (auto& [availableType, availableCount] : _availableDescriptorPoolSizes) - { - if (availableType == type) - { - availableCount -= descriptorCount; + uint32_t descriptorsToConsume = descriptorCount - foundDescriptorCount; + if (descriptorsToConsume > availableCount) + descriptorsToConsume = availableCount; + foundDescriptorCount += descriptorsToConsume; + availableCount -= descriptorsToConsume; } } + if (foundDescriptorCount < descriptorCount) + return {}; } + _availableDescriptorPoolSizes.swap(newDescriptorPoolSizes); --_availableDescriptorSet; auto dsi = DescriptorSet::Implementation::create(this, descriptorSetLayout); From 388e52f4bb90626a7889dec9b0546c6bb0a8cc9a Mon Sep 17 00:00:00 2001 From: Chris Djali Date: Tue, 22 Aug 2023 14:38:35 +0100 Subject: [PATCH 43/48] Fix typo and elaborate Windows instructions --- INSTALL.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 8958bc103..03594d067 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -243,9 +243,16 @@ So now we have the Vulkan SDK installed and findable by CMake so we can go ahead mkdir build & cd build cmake .. -G "Visual Studio 15 2017 Win64" cmake .. -G "Visual Studio 16 2019" -A x64 - cmake .. -G "Visual Studio 19 2022" -A x64 + cmake .. -G "Visual Studio 17 2022" -A x64 -After running CMake open the generated VSG.sln file and build the All target. Once built you can run the install target. If you are using the default CMake install path (in Program Files folder), ensure you have started Visual Studio as administrator otherwise the install will fail. +After running CMake open the generated VSG.sln file and build the All target. Different build configs can be selected from the dropdown at the top of the window. Once built you can run the install target. If you are using the default CMake install path (in Program Files folder), ensure you have started Visual Studio as administrator otherwise the install will fail. + +Alternatively, you can build from the command line with + + cmake --build . + cmake --install . + +As above, you must be running from an elevated shell to install to Program Files, but unlike via the VS GUI, can append `--prefix Path\To\Another\Directory` to the install command to specify another directory. Different build configs can be specified by appending the `config` argument (e.g. `--config RelWithDebInfo`) to the above commands and rerunning them. It's recommended at this point that you add the VSG install path to your CMAKE_PREFIX_PATH, this will allow other CMake projects, like the vsgExamples project to find your VSG installation. CMAKE_PREFIX_PATH can be set as an environment variable on your system. From 19cbd4229812cf5b8cc0e7ba4c1240460cb4ae1c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Aug 2023 17:09:28 +0100 Subject: [PATCH 44/48] Fixed RecordedCommandBuffers::empty() --- src/vsg/vk/CommandBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vsg/vk/CommandBuffer.cpp b/src/vsg/vk/CommandBuffer.cpp index 4e0b58c66..41c8521a6 100644 --- a/src/vsg/vk/CommandBuffer.cpp +++ b/src/vsg/vk/CommandBuffer.cpp @@ -81,7 +81,7 @@ void RecordedCommandBuffers::add(int submitOrder, ref_ptr co bool RecordedCommandBuffers::empty() const { std::scoped_lock lock(_mutex); - return _commandBuffers.empty(); + return _commandBuffers.empty() && _orderedCommandBuffers.empty(); } CommandBuffers RecordedCommandBuffers::buffers() const From 03714921b55807f03f7c9fb1def54f5c2c8b6945 Mon Sep 17 00:00:00 2001 From: echolumj Date: Wed, 23 Aug 2023 14:05:00 +0800 Subject: [PATCH 45/48] test-lmj --- src/vsg/vk/DescriptorPool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vsg/vk/DescriptorPool.cpp b/src/vsg/vk/DescriptorPool.cpp index 75d285722..0ab7f7276 100644 --- a/src/vsg/vk/DescriptorPool.cpp +++ b/src/vsg/vk/DescriptorPool.cpp @@ -136,7 +136,7 @@ bool DescriptorPool::getAvailability(uint32_t& maxSets, DescriptorPoolSizes& des break; } } - if (itr != descriptorPoolSizes.end()) + if (itr == descriptorPoolSizes.end()) { descriptorPoolSizes.push_back(VkDescriptorPoolSize{availableType, availableCount}); } From e01e9284fc43c158f835945914b7b7254996cf96 Mon Sep 17 00:00:00 2001 From: LeeRiva <76054616+LeeRiva@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:56:42 +0200 Subject: [PATCH 46/48] [FIX] on the Windows platform, modifier keys (Shift/Alt/Ctrl) will are now properly reported as being pressed if a non-modifier key was pressed or released. This fixes issue #919 --- include/vsg/platform/win32/Win32_Window.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/vsg/platform/win32/Win32_Window.h b/include/vsg/platform/win32/Win32_Window.h index e0cc9a601..e4cbbfdc7 100644 --- a/include/vsg/platform/win32/Win32_Window.h +++ b/include/vsg/platform/win32/Win32_Window.h @@ -88,6 +88,15 @@ namespace vsgWin32 if (keyState[VK_CAPITAL] & 0x01) modifierMask |= vsg::KeyModifier::MODKEY_CapsLock; if (keyState[VK_NUMLOCK] & 0x01) modifierMask |= vsg::KeyModifier::MODKEY_NumLock; + // Check if the modifier keys are down (these are non-toggle keys, so the high-order bit is relevant!) + // again, vsg only has a side-independent modifier + if (keyState[VK_LSHIFT] & 0x80) modifierMask |= vsg::KeyModifier::MODKEY_Shift; + if (keyState[VK_LSHIFT] & 0x80) modifierMask |= vsg::KeyModifier::MODKEY_Shift; + if (keyState[VK_LCONTROL] & 0x80) modifierMask |= vsg::KeyModifier::MODKEY_Control; + if (keyState[VK_RCONTROL] & 0x80) modifierMask |= vsg::KeyModifier::MODKEY_Control; + if (keyState[VK_LMENU] & 0x80) modifierMask |= vsg::KeyModifier::MODKEY_Alt; + if (keyState[VK_LMENU] & 0x80) modifierMask |= vsg::KeyModifier::MODKEY_Alt; + // This is the final keyModifier keyModifier = static_cast(modifierMask); From 82fa88326fcd8632a3f1ec7b0395a1f0468bb29b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 23 Aug 2023 16:14:32 +0100 Subject: [PATCH 47/48] Added check for availableCount > 0 to avoid adding emptry entries. --- src/vsg/vk/DescriptorPool.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/vsg/vk/DescriptorPool.cpp b/src/vsg/vk/DescriptorPool.cpp index 0ab7f7276..f83492a72 100644 --- a/src/vsg/vk/DescriptorPool.cpp +++ b/src/vsg/vk/DescriptorPool.cpp @@ -127,18 +127,24 @@ bool DescriptorPool::getAvailability(uint32_t& maxSets, DescriptorPoolSizes& des for (auto& [availableType, availableCount] : _availableDescriptorPoolSizes) { - auto itr = descriptorPoolSizes.begin(); - for (; itr != descriptorPoolSizes.end(); ++itr) + if (availableCount > 0) { - if (itr->type == availableType) + // increment any entries that are already in the descriptorPoolSizes vector + auto itr = descriptorPoolSizes.begin(); + for (; itr != descriptorPoolSizes.end(); ++itr) { - itr->descriptorCount += availableCount; - break; + if (itr->type == availableType) + { + itr->descriptorCount += availableCount; + break; + } + } + + // if none matched add a new entry + if (itr == descriptorPoolSizes.end()) + { + descriptorPoolSizes.push_back(VkDescriptorPoolSize{availableType, availableCount}); } - } - if (itr == descriptorPoolSizes.end()) - { - descriptorPoolSizes.push_back(VkDescriptorPoolSize{availableType, availableCount}); } } From f28c4d23a44b6eecf4c2ee8090e831a239743be5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 24 Aug 2023 11:34:07 +0100 Subject: [PATCH 48/48] Decoupled the stats console output from the animation path updating --- include/vsg/utils/AnimationPath.h | 6 +++-- src/vsg/utils/AnimationPath.cpp | 40 ++++++++++++++++--------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/vsg/utils/AnimationPath.h b/include/vsg/utils/AnimationPath.h index 9ba538bd6..391ec0f16 100644 --- a/include/vsg/utils/AnimationPath.h +++ b/include/vsg/utils/AnimationPath.h @@ -68,10 +68,12 @@ namespace vsg ref_ptr object; ref_ptr path; KeySymbol resetKey = KEY_Space; - clock::time_point start_point; - unsigned int frameCount = 0; + clock::time_point startPoint; double time = 0.0; + bool printFrameStatsToConsole = false; + clock::time_point statsStartPoint; + double frameCount = 0.0; void apply(Camera& camera) override; void apply(MatrixTransform& transform) override; diff --git a/src/vsg/utils/AnimationPath.cpp b/src/vsg/utils/AnimationPath.cpp index 6451edaf7..efafd848d 100644 --- a/src/vsg/utils/AnimationPath.cpp +++ b/src/vsg/utils/AnimationPath.cpp @@ -111,7 +111,8 @@ void AnimationPath::write(Output& output) const AnimationPathHandler::AnimationPathHandler(ref_ptr in_object, ref_ptr in_path, clock::time_point in_start_point) : object(in_object), path(in_path), - start_point(in_start_point) + startPoint(in_start_point), + statsStartPoint(in_start_point) { } @@ -133,33 +134,34 @@ void AnimationPathHandler::apply(KeyPressEvent& keyPress) { if (keyPress.keyBase == resetKey) { + // reset main animation time back to start + startPoint = keyPress.time; + time = 0.0; + + // reset stats time back to start + statsStartPoint = startPoint; frameCount = 0; } } void AnimationPathHandler::apply(FrameEvent& frame) { - if (frameCount == 0) - { - start_point = frame.frameStamp->time; - } + // update the main animation time and apply it to the attached object (Camera or Transform) + time = std::chrono::duration(frame.time - startPoint).count(); + if (object) object->accept(*this); - time = std::chrono::duration(frame.frameStamp->time - start_point).count(); - if (time > path->period()) + if (printFrameStatsToConsole) { - if (printFrameStatsToConsole) + double statsTime = std::chrono::duration(frame.time - statsStartPoint).count(); + ++frameCount; + if (statsTime > path->period()) { - double average_framerate = double(frameCount) / time; - vsg::info("Period complete numFrames=", frameCount, ", average frame rate = ", average_framerate); - } + double averageFramerate = static_cast(frameCount) / statsTime; + vsg::info("Animation path complete: duration = ", statsTime, ", frame count = ", frameCount, ", average frame rate = ", averageFramerate); - // reset time back to start - start_point = frame.frameStamp->time; - time = 0.0; - frameCount = 0; + // reset stats time back to start + statsStartPoint = frame.time; + frameCount = 0; + } } - - if (object) object->accept(*this); - - ++frameCount; }