Skip to content

Commit 6296817

Browse files
committed
Merge branch 'master' into fast-intersection-queries
2 parents 5f2c11d + 8e3dc26 commit 6296817

File tree

14 files changed

+102
-22
lines changed

14 files changed

+102
-22
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ if (VSG_SUPPORTS_Windowing)
9898
endif()
9999
endif()
100100

101+
option(VSG_USE_dynamic_cast "Use dynamic_cast in vsg::Object::cast<T>(), 0 for off, 1 for enabled." OFF)
102+
101103
# this line needs to be after the call to setup_build_vars()
102104
configure_file("${VSG_SOURCE_DIR}/src/vsg/core/Version.h.in" "${VSG_VERSION_HEADER}")
103105

include/vsg/core/Array.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
3232
namespace vsg
3333
{
3434
template<typename T>
35-
class Array : public Data
35+
class VSG_DECLSPEC Array : public Data
3636
{
3737
public:
3838
using value_type = T;

include/vsg/core/Array2D.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace vsg
3030
{
3131

3232
template<typename T>
33-
class Array2D : public Data
33+
class VSG_DECLSPEC Array2D : public Data
3434
{
3535
public:
3636
using value_type = T;

include/vsg/core/Array3D.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
3030
namespace vsg
3131
{
3232
template<typename T>
33-
class Array3D : public Data
33+
class VSG_DECLSPEC Array3D : public Data
3434
{
3535
public:
3636
using value_type = T;

include/vsg/core/Export.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
2525
# define VSG_DECLSPEC
2626
# endif
2727
#else
28-
# define VSG_DECLSPEC
28+
# if defined(VSG_SHARED_LIBRARY) || defined(VSG_EXPORTS)
29+
# define VSG_DECLSPEC __attribute__((visibility("default")))
30+
# else
31+
# define VSG_DECLSPEC
32+
# endif
2933
#endif

include/vsg/core/Object.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1818
#include <typeindex>
1919
#include <vector>
2020

21-
#include <vsg/core/Export.h>
21+
#include <vsg/core/Version.h>
2222
#include <vsg/core/ref_ptr.h>
2323
#include <vsg/core/type_name.h>
2424

@@ -85,11 +85,19 @@ namespace vsg
8585
virtual const std::type_info& type_info() const noexcept { return typeid(Object); }
8686
virtual bool is_compatible(const std::type_info& type) const noexcept { return typeid(Object) == type; }
8787

88+
#if VSG_USE_dynamic_cast
89+
template<class T>
90+
T* cast() { return dynamic_cast<T*>(this); }
91+
92+
template<class T>
93+
const T* cast() const { return dynamic_cast<const T*>(this); }
94+
#else
8895
template<class T>
8996
T* cast() { return is_compatible(typeid(T)) ? static_cast<T*>(this) : nullptr; }
9097

9198
template<class T>
9299
const T* cast() const { return is_compatible(typeid(T)) ? static_cast<const T*>(this) : nullptr; }
100+
#endif
93101

94102
/// clone this object using CopyOp's duplicates map to decide whether to clone or to return the original object.
95103
/// The default clone(CopyOp&) implementation simply returns ref_ptr<> to this object rather attempt to clone.

include/vsg/core/Value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
3636
namespace vsg
3737
{
3838
template<typename T>
39-
class Value : public Data
39+
class VSG_DECLSPEC Value : public Data
4040
{
4141
public:
4242
using value_type = T;

include/vsg/state/DescriptorSetLayout.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace vsg
2121
class Context;
2222

2323
using DescriptorSetLayoutBindings = std::vector<VkDescriptorSetLayoutBinding>;
24+
using DescriptorSetLayoutBindingFlags = std::vector<VkDescriptorBindingFlags>;
2425
using DescriptorPoolSizes = std::vector<VkDescriptorPoolSize>;
2526

2627
/// DescriptorSetLayout encapsulates VkDescriptorSetLayout and VkDescriptorSetLayoutCreateInfo settings used to set it up.
@@ -34,9 +35,17 @@ namespace vsg
3435
/// Vulkan VkDescriptorSetLayout handle
3536
virtual VkDescriptorSetLayout vk(uint32_t deviceID) const { return _implementation[deviceID]->_descriptorSetLayout; }
3637

38+
/// VkDescriptorSetLayoutCreateFlags flags
39+
VkDescriptorSetLayoutCreateFlags createFlags = 0;
40+
3741
/// VkDescriptorSetLayoutCreateInfo settings
3842
DescriptorSetLayoutBindings bindings;
3943

44+
/// VkDescriptorSetLayoutBindingFlagsCreateInfo settings
45+
DescriptorSetLayoutBindingFlags bindingFlags;
46+
47+
void addBinding(uint32_t binding, VkDescriptorType descriptorType, uint32_t descriptorCount, VkShaderStageFlags stageFlags, VkDescriptorBindingFlags flags = 0);
48+
4049
/// map the descriptor bindings to the descriptor pool sizes that will be required to represent them.
4150
void getDescriptorPoolSizes(DescriptorPoolSizes& descriptorPoolSizes);
4251

@@ -59,7 +68,7 @@ namespace vsg
5968

6069
struct Implementation : public Inherit<Object, Implementation>
6170
{
62-
Implementation(Device* device, const DescriptorSetLayoutBindings& descriptorSetLayoutBindings);
71+
Implementation(Device* device, VkDescriptorSetLayoutCreateFlags createFlags, const DescriptorSetLayoutBindings& descriptorSetLayoutBindings, const DescriptorSetLayoutBindingFlags& descriptorSetLayoutBindingFlags);
6372

6473
virtual ~Implementation();
6574

include/vsg/utils/ComputeBounds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace vsg
7171
void apply(const uintArray& array) override;
7272

7373
virtual void applyDraw(uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount);
74-
virtual void applyDrawIndexed(uint32_t firstIndex, uint32_t indexCount, uint32_t firstInstance, uint32_t instanceCount);
74+
virtual void applyDrawIndexed(uint32_t firstIndex, uint32_t indexCount, uint32_t firstInstance, uint32_t vertexOffset, uint32_t instanceCount);
7575

7676
void add(const dbox& bb);
7777
void add(const dsphere& bs);

include/vsg/vk/SubmitCommands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace vsg
2929
VkResult result = VK_SUCCESS;
3030

3131
auto commandBuffer = commandPool->allocate();
32-
auto state = State::create(Slots{4,4});
32+
auto state = State::create(Slots{4, 4});
3333
state->connect(commandBuffer);
3434

3535
VkCommandBufferBeginInfo beginInfo = {};

0 commit comments

Comments
 (0)