Skip to content
Merged
4 changes: 2 additions & 2 deletions build/build_all_h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ macro(BUILD_ALL_H)
file(GLOB COMMANDS_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include include/vsg/commands/*.h )
file(GLOB STATE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include include/vsg/state/*.h )
file(GLOB TEXT_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include include/vsg/text/*.h )
file(GLOB RAYTRACING_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include include/vsg/raytracing/*.h )
file(GLOB RTX_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include include/vsg/rtx/*.h )

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/build/header_license_preamble.txt ALL_H_CONTENTS)
APPEND_INCLUDES(ALL_H_CONTENTS CORE_HEADERS "// Core header files\n")
Expand All @@ -42,7 +42,7 @@ macro(BUILD_ALL_H)
APPEND_INCLUDES(ALL_H_CONTENTS UTILS_HEADERS "// Utility header files\n")
APPEND_INCLUDES(ALL_H_CONTENTS INTROSPECTION_HEADERS "// Introspection header files\n")
APPEND_INCLUDES(ALL_H_CONTENTS TEXT_HEADERS "// Text header files\n")
APPEND_INCLUDES(ALL_H_CONTENTS RAYTRACING_HEADERS "// Raytracing header files\n")
APPEND_INCLUDES(ALL_H_CONTENTS RTX_HEADERS "// RTX mesh and ray tracing header files\n")

file(WRITE include/vsg/all.h ${ALL_H_CONTENTS})

Expand Down
2 changes: 1 addition & 1 deletion include/vsg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The headers that provide the library classes and definitions are organized in su
## Scene graphs nodes
* [include/vsg/nodes](nodes/) - Scene graph node classes
* [include/vsg/text](text/) - Scene graph node classes that provide high quality Text support
* [include/vsg/raytracing](raytracing/) - Raytracing related scene graph classes
* [include/vsg/rtx](rtx/) - RTX Raytracing and mesh shader related scene graph classes

## Application level
* [include/vsg/traversals](traversals/) - Graph traversals
Expand Down
24 changes: 14 additions & 10 deletions include/vsg/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/text/TextLayout.h>
#include <vsg/text/TextTechnique.h>

// Raytracing header files
#include <vsg/raytracing/AccelerationGeometry.h>
#include <vsg/raytracing/AccelerationStructure.h>
#include <vsg/raytracing/BottomLevelAccelerationStructure.h>
#include <vsg/raytracing/BuildAccelerationStructureTraversal.h>
#include <vsg/raytracing/DescriptorAccelerationStructure.h>
#include <vsg/raytracing/RayTracingPipeline.h>
#include <vsg/raytracing/RayTracingShaderGroup.h>
#include <vsg/raytracing/TopLevelAccelerationStructure.h>
#include <vsg/raytracing/TraceRays.h>
// RTX mesh and ray tracing header files
#include <vsg/rtx/AccelerationGeometry.h>
#include <vsg/rtx/AccelerationStructure.h>
#include <vsg/rtx/BottomLevelAccelerationStructure.h>
#include <vsg/rtx/BuildAccelerationStructureTraversal.h>
#include <vsg/rtx/DescriptorAccelerationStructure.h>
#include <vsg/rtx/DrawMeshTasks.h>
#include <vsg/rtx/DrawMeshTasksIndirect.h>
#include <vsg/rtx/DrawMeshTasksIndirectCommand.h>
#include <vsg/rtx/DrawMeshTasksIndirectCount.h>
#include <vsg/rtx/RayTracingPipeline.h>
#include <vsg/rtx/RayTracingShaderGroup.h>
#include <vsg/rtx/TopLevelAccelerationStructure.h>
#include <vsg/rtx/TraceRays.h>
10 changes: 10 additions & 0 deletions include/vsg/core/ConstVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ namespace vsg
class ResourceHints;
class ClearAttachments;

// forward declare rtx classes
class DrawMeshTasks;
class DrawMeshTasksIndirect;
class DrawMeshTasksIndirectCount;

// forward declare ui events classes
class UIEvent;
class WindowEvent;
Expand Down Expand Up @@ -255,6 +260,11 @@ namespace vsg
virtual void apply(const DrawIndexed&);
virtual void apply(const ClearAttachments&);

// rtx classes
virtual void apply(const DrawMeshTasks&);
virtual void apply(const DrawMeshTasksIndirect&);
virtual void apply(const DrawMeshTasksIndirectCount&);

// ui events
virtual void apply(const UIEvent&);
virtual void apply(const WindowEvent&);
Expand Down
10 changes: 10 additions & 0 deletions include/vsg/core/Visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ namespace vsg
class ResourceHints;
class ClearAttachments;

// forward declare rtx classes
class DrawMeshTasks;
class DrawMeshTasksIndirect;
class DrawMeshTasksIndirectCount;

// forward declare ui events classes
class UIEvent;
class WindowEvent;
Expand Down Expand Up @@ -255,6 +260,11 @@ namespace vsg
virtual void apply(DrawIndexed&);
virtual void apply(ClearAttachments&);

// rtx classes
virtual void apply(DrawMeshTasks&);
virtual void apply(DrawMeshTasksIndirect&);
virtual void apply(DrawMeshTasksIndirectCount&);

// ui events
virtual void apply(UIEvent&);
virtual void apply(WindowEvent&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

</editor-fold> */

#include <vsg/raytracing/AccelerationGeometry.h>
#include <vsg/raytracing/AccelerationStructure.h>
#include <vsg/rtx/AccelerationGeometry.h>
#include <vsg/rtx/AccelerationStructure.h>

namespace vsg
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/nodes/MatrixTransform.h>
#include <vsg/nodes/VertexIndexDraw.h>

#include <vsg/raytracing/AccelerationStructure.h>
#include <vsg/raytracing/BottomLevelAccelerationStructure.h>
#include <vsg/raytracing/TopLevelAccelerationStructure.h>
#include <vsg/rtx/AccelerationStructure.h>
#include <vsg/rtx/BottomLevelAccelerationStructure.h>
#include <vsg/rtx/TopLevelAccelerationStructure.h>

namespace vsg
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

</editor-fold> */

#include <vsg/raytracing/AccelerationStructure.h>
#include <vsg/rtx/AccelerationStructure.h>
#include <vsg/state/Descriptor.h>

namespace vsg
Expand Down
37 changes: 37 additions & 0 deletions include/vsg/rtx/DrawMeshTasks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

/* <editor-fold desc="MIT License">

Copyright(c) 2019 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.

</editor-fold> */

#include <vsg/commands/Command.h>

namespace vsg
{

class VSG_DECLSPEC DrawMeshTasks : public Inherit<Command, DrawMeshTasks>
{
public:
DrawMeshTasks();

DrawMeshTasks(uint32_t in_taskCount, uint32_t in_firstTask);

void read(Input& input) override;
void write(Output& output) const override;

void record(CommandBuffer& commandBuffer) const override;

uint32_t taskCount = 0;
uint32_t firstTask = 0;
};
VSG_type_name(vsg::DrawMeshTasks);

} // namespace vsg
48 changes: 48 additions & 0 deletions include/vsg/rtx/DrawMeshTasksIndirect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#pragma once

/* <editor-fold desc="MIT License">

Copyright(c) 2019 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.

</editor-fold> */

#include <vsg/commands/Command.h>
#include <vsg/state/BufferInfo.h>

namespace vsg
{

class VSG_DECLSPEC DrawMeshTasksIndirect : public Inherit<Command, DrawMeshTasksIndirect>
{
public:
DrawMeshTasksIndirect();

DrawMeshTasksIndirect(ref_ptr<Data> data, uint32_t in_drawCount, uint32_t in_stride) :
buffer(data),
drawCount(in_drawCount),
stride(in_stride) {}

DrawMeshTasksIndirect(ref_ptr<Buffer> in_buffer, VkDeviceSize in_offset, uint32_t in_drawCount, uint32_t in_stride) :
buffer(in_buffer, in_offset, in_drawCount * in_stride),
drawCount(in_drawCount),
stride(in_stride) {}

void read(Input& input) override;
void write(Output& output) const override;

void compile(Context& context) override;
void record(CommandBuffer& commandBuffer) const override;

BufferInfo buffer;
uint32_t drawCount = 0;
uint32_t stride = 0;
};
VSG_type_name(vsg::DrawMeshTasksIndirect);

} // namespace vsg
45 changes: 45 additions & 0 deletions include/vsg/rtx/DrawMeshTasksIndirectCommand.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#pragma once

/* <editor-fold desc="MIT License">

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.

</editor-fold> */

#include <vsg/commands/Command.h>
#include <vsg/state/BufferInfo.h>
#include <vsg/vk/CommandBuffer.h>

namespace vsg
{
/// Equivalent to VkDrawMeshTasksIndirectCommandNV that adds read/write support
struct DrawMeshTasksIndirectCommand
{
uint32_t taskCount;
uint32_t firstTask;

void read(vsg::Input& input)
{
input.read("taskCount", taskCount);
input.read("firstTask", firstTask);
}

void write(vsg::Output& output) const
{
output.write("taskCount", taskCount);
output.write("firstTask", firstTask);
}
};

template<>
constexpr bool has_read_write<DrawMeshTasksIndirectCommand>() { return true; }

VSG_array(DrawMeshTasksIndirectCommandArray, DrawMeshTasksIndirectCommand);

} // namespace vsg
45 changes: 45 additions & 0 deletions include/vsg/rtx/DrawMeshTasksIndirectCount.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#pragma once

/* <editor-fold desc="MIT License">

Copyright(c) 2019 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.

</editor-fold> */

#include <vsg/commands/Command.h>
#include <vsg/state/BufferInfo.h>

namespace vsg
{

class VSG_DECLSPEC DrawMeshTasksIndirectCount : public Inherit<Command, DrawMeshTasksIndirectCount>
{
public:
DrawMeshTasksIndirectCount();

DrawMeshTasksIndirectCount(ref_ptr<Data> in_bufferData, ref_ptr<Data> in_countBufferData, uint32_t in_maxDrawCount, uint32_t in_stride) :
buffer(in_bufferData),
countBuffer(in_countBufferData),
maxDrawCount(in_maxDrawCount),
stride(in_stride) {}

void read(Input& input) override;
void write(Output& output) const override;

void compile(Context& context) override;
void record(CommandBuffer& commandBuffer) const override;

BufferInfo buffer;
BufferInfo countBuffer;
uint32_t maxDrawCount = 0;
uint32_t stride = 0;
};
VSG_type_name(vsg::DrawMeshTasksIndirectCount);

} // namespace vsg
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
* [RayTracingPipeline.h](RayTracingPipeline.h) -
* [RayTracingShaderGroup.h](RayTracingShaderGroup.h) -
* [TopLevelAccelerationStructure.h](TopLevelAccelerationStructure.h) -
* [TraceRays.h](TraceRays.h) -
* [TraceRays.h](TraceRays.h) - encapsulation of vkCmdTraceRaysNV

* [DrawMeshTasks.h](DrawMeshTasks.h) - encapsulation of vkCmdDrawMeshTasksNV
* [DrawMeshTasksIndirect.h](DrawMeshTasksIndirect.h) -encapsulation of vkCmdDrawMeshTasksIndirectNV
* [DrawMeshTasksIndirectCount.h](DrawMeshTasksIndirectCount.h) - encapsulation of vkCmdDrawMeshTasksIndirectCountNV
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

</editor-fold> */

#include <vsg/raytracing/RayTracingShaderGroup.h>
#include <vsg/rtx/RayTracingShaderGroup.h>
#include <vsg/state/PipelineLayout.h>
#include <vsg/state/ShaderStage.h>
#include <vsg/state/StateCommand.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

#include <vsg/core/Array.h>
#include <vsg/core/Value.h>
#include <vsg/raytracing/AccelerationStructure.h>
#include <vsg/raytracing/BottomLevelAccelerationStructure.h>
#include <vsg/rtx/AccelerationStructure.h>
#include <vsg/rtx/BottomLevelAccelerationStructure.h>

namespace vsg
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
</editor-fold> */

#include <vsg/commands/Command.h>
#include <vsg/raytracing/RayTracingShaderGroup.h>
#include <vsg/rtx/RayTracingShaderGroup.h>

namespace vsg
{
Expand Down
2 changes: 1 addition & 1 deletion include/vsg/vk/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace vsg
ref_ptr<MemoryBufferPools> deviceMemoryBufferPools;
ref_ptr<MemoryBufferPools> stagingMemoryBufferPools;

// raytracing
// RTX ray tracing
VkDeviceSize scratchBufferSize;
std::vector<ref_ptr<BuildAccelerationStructureCommand>> buildAccelerationStructureCommands;
};
Expand Down
23 changes: 14 additions & 9 deletions include/vsg/vk/Extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,20 @@ namespace vsg
Extensions(Device* device);

// VK_NV_ray_tracing
PFN_vkCreateAccelerationStructureNV vkCreateAccelerationStructureNV;
PFN_vkDestroyAccelerationStructureNV vkDestroyAccelerationStructureNV;
PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV;
PFN_vkGetAccelerationStructureHandleNV vkGetAccelerationStructureHandleNV;
PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV;
PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV;
PFN_vkCreateRayTracingPipelinesNV vkCreateRayTracingPipelinesNV;
PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV;
PFN_vkCmdTraceRaysNV vkCmdTraceRaysNV;
PFN_vkCreateAccelerationStructureNV vkCreateAccelerationStructureNV = nullptr;
PFN_vkDestroyAccelerationStructureNV vkDestroyAccelerationStructureNV = nullptr;
PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV = nullptr;
PFN_vkGetAccelerationStructureHandleNV vkGetAccelerationStructureHandleNV = nullptr;
PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV = nullptr;
PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV = nullptr;
PFN_vkCreateRayTracingPipelinesNV vkCreateRayTracingPipelinesNV = nullptr;
PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV = nullptr;
PFN_vkCmdTraceRaysNV vkCmdTraceRaysNV = nullptr;

// VK_NV_mesh_shader
PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV = nullptr;
PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV = nullptr;
PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV = nullptr;
};

} // namespace vsg
Loading