Skip to content

Commit 8546514

Browse files
committed
Added ShaderSet::geometryHints mask to help prompt scene graph builders to generate particular types of geometry/meshshaders
1 parent 16bdab1 commit 8546514

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.10)
22

33
project(vsg
4-
VERSION 1.1.15
4+
VERSION 1.1.16
55
DESCRIPTION "VulkanSceneGraph library"
66
LANGUAGES CXX
77
)

include/vsg/utils/ShaderSet.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ namespace vsg
128128
GraphicsPipelineStates defaultGraphicsPipelineStates;
129129
std::vector<ref_ptr<CustomDescriptorSetBinding>> customDescriptorSetBindings;
130130

131+
/// Hints mask for scene graph builders for what ShaderSet prefers/requires.
132+
enum GeometryHints : uint32_t
133+
{
134+
NO_PREFERENCE = 0,
135+
GEOMETRY = 1 << 0,
136+
VERTEXDRAW = 1 << 1,
137+
VERTEXINDEXDRAW = 1 << 2,
138+
DRAWMESHTASKS = 1 << 3,
139+
MESHLETS = 1 << 4
140+
};
141+
142+
uint32_t geometryHints = GeometryHints::NO_PREFERENCE;
143+
131144
ref_ptr<ShaderCompileSettings> defaultShaderHints;
132145
/// variants of the rootShaderModule compiled for different combinations of ShaderCompileSettings
133146
std::map<ref_ptr<ShaderCompileSettings>, ShaderStages, DereferenceLess> variants;

src/vsg/utils/ShaderSet.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ int ShaderSet::compare(const Object& rhs_object) const
294294
if ((result = compare_container(pushConstantRanges, rhs.pushConstantRanges))) return result;
295295
if ((result = compare_container(definesArrayStates, rhs.definesArrayStates))) return result;
296296
if ((result = compare_container(optionalDefines, rhs.optionalDefines))) return result;
297-
return compare_pointer_container(defaultGraphicsPipelineStates, rhs.defaultGraphicsPipelineStates);
297+
if ((result = compare_pointer_container(defaultGraphicsPipelineStates, rhs.defaultGraphicsPipelineStates))) return result;
298+
return compare_value(geometryHints, rhs.geometryHints);
298299
}
299300

300301
void ShaderSet::read(Input& input)
@@ -377,6 +378,11 @@ void ShaderSet::read(Input& input)
377378
}
378379
}
379380
}
381+
382+
if (input.version_greater_equal(1, 1, 16))
383+
{
384+
input.readValue<uint32_t>("geometryHints", geometryHints);
385+
}
380386
}
381387

382388
void ShaderSet::write(Output& output) const
@@ -450,6 +456,11 @@ void ShaderSet::write(Output& output) const
450456
output.writeObject("customDescriptorSetBinding", custom);
451457
}
452458
}
459+
460+
if (output.version_greater_equal(1, 1, 16))
461+
{
462+
output.writeValue<uint32_t>("geometryHints", geometryHints);
463+
}
453464
}
454465

455466
ref_ptr<ShaderSet> vsg::createFlatShadedShaderSet(ref_ptr<const Options> options)

0 commit comments

Comments
 (0)