Skip to content

Commit

Permalink
Renamed methods to to enable/assignDescriptor(..) to better reflect V…
Browse files Browse the repository at this point in the history
…ulkan naming and ShaderSet methods, deprecated enable/assignUniform(..) methods.

Replaced deprecated methods.
  • Loading branch information
robertosfield committed Sep 7, 2023
1 parent 77b059a commit 9a090fb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
27 changes: 21 additions & 6 deletions include/vsg/utils/GraphicsPipelineConfigurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ namespace vsg
bool two_sided = false;

bool enableTexture(const std::string& name);
bool enableUniform(const std::string& name);

bool assignTexture(const std::string& name, ref_ptr<Data> textureData = {}, ref_ptr<Sampler> sampler = {}, uint32_t dstArrayElement = 0);
bool assignTexture(const std::string& name, const ImageInfoList& imageInfoList, uint32_t dstArrayElement = 0);

bool assignUniform(const std::string& name, ref_ptr<Data> data = {}, uint32_t dstArrayElement = 0);
bool assignUniform(const std::string& name, const BufferInfoList& bufferInfoList, uint32_t dstArrayElement = 0);
bool enableDescriptor(const std::string& name);
bool assignDescriptor(const std::string& name, ref_ptr<Data> data = {}, uint32_t dstArrayElement = 0);
bool assignDescriptor(const std::string& name, const BufferInfoList& bufferInfoList, uint32_t dstArrayElement = 0);

[[deprecated("use enableDescriptor(..)")]]
bool enableUniform(const std::string& name) { return enableDescriptor(name); }

[[deprecated("use assignDescriptor(..)")]]
bool assignUniform(const std::string& name, ref_ptr<Data> data = {}, uint32_t dstArrayElement = 0) { return assignDescriptor(name, data, dstArrayElement); }

[[deprecated("use assignDescriptor(..)")]]
bool assignUniform(const std::string& name, const BufferInfoList& bufferInfoList, uint32_t dstArrayElement = 0) { return assignDescriptor(name, bufferInfoList, dstArrayElement); }


bool assignDescriptor(uint32_t set, uint32_t binding, VkDescriptorType descriptorType, uint32_t descriptorCount, VkShaderStageFlags stageFlags, ref_ptr<Descriptor> descriptor);

Expand Down Expand Up @@ -104,12 +113,18 @@ namespace vsg
void reset();

bool enableArray(const std::string& name, VkVertexInputRate vertexInputRate, uint32_t stride, VkFormat format = VK_FORMAT_UNDEFINED);
bool enableDescriptor(const std::string& name);
bool enableTexture(const std::string& name);
bool enableUniform(const std::string& name);

bool assignArray(DataList& arrays, const std::string& name, VkVertexInputRate vertexInputRate, ref_ptr<Data> array);
bool assignDescriptor(const std::string& name, ref_ptr<Data> data = {});
bool assignTexture(const std::string& name, ref_ptr<Data> textureData = {}, ref_ptr<Sampler> sampler = {});
bool assignUniform(const std::string& name, ref_ptr<Data> data = {});

[[deprecated("use enableDescriptor(..)")]]
bool enableUniform(const std::string& name) { return enableDescriptor(name); }

[[deprecated("use assignDescriptor(..)")]]
bool assignUniform(const std::string& name, ref_ptr<Data> data = {}) { return assignDescriptor(name, data); }

// setup by assign calls
ref_ptr<ShaderCompileSettings> shaderHints;
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/io/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void tile::init(vsg::ref_ptr<const vsg::Options> options)
_graphicsPipelineConfig->enableTexture("displacementMap");
}
#endif
_graphicsPipelineConfig->enableUniform("material");
_graphicsPipelineConfig->enableDescriptor("material");

_graphicsPipelineConfig->enableArray("vsg_Vertex", VK_VERTEX_INPUT_RATE_VERTEX, 12, VK_FORMAT_R32G32B32_SFLOAT);
_graphicsPipelineConfig->enableArray("vsg_Normal", VK_VERTEX_INPUT_RATE_VERTEX, 12, VK_FORMAT_R32G32B32_SFLOAT);
Expand Down
4 changes: 2 additions & 2 deletions src/vsg/text/GpuLayoutTechnique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ void GpuLayoutTechnique::setup(Text* text, uint32_t minimumAllocation, ref_ptr<c
config->assignTexture("textureAtlas", text->font->atlas, sampler);
config->assignTexture("glyphMetrics", glyphMetricsProxy, glyphMetricSampler);

config->assignUniform("textLayout", layoutValue);
config->assignUniform("text", textArray);
config->assignDescriptor("textLayout", layoutValue);
config->assignDescriptor("text", textArray);

// Set the InputAssemblyState.topology
struct SetPipelineStates : public Visitor
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/utils/Builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ref_ptr<StateGroup> Builder::createStateGroup(const StateInfo& stateInfo)
{
ref_ptr<Data> mat = materialBinding.data;
if (!mat) mat = vsg::PhongMaterialValue::create();
graphicsPipelineConfig->assignUniform("material", mat);
graphicsPipelineConfig->assignDescriptor("material", mat);
}

graphicsPipelineConfig->enableArray("vsg_Vertex", VK_VERTEX_INPUT_RATE_VERTEX, 12);
Expand Down
14 changes: 7 additions & 7 deletions src/vsg/utils/GraphicsPipelineConfigurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool DescriptorConfigurator::assignTexture(const std::string& name, const ImageI
return false;
}

bool DescriptorConfigurator::enableUniform(const std::string& name)
bool DescriptorConfigurator::enableDescriptor(const std::string& name)
{
if (auto& descriptorBinding = shaderSet->getDescriptorBinding(name))
{
Expand All @@ -165,7 +165,7 @@ bool DescriptorConfigurator::enableUniform(const std::string& name)
return false;
}

bool DescriptorConfigurator::assignUniform(const std::string& name, ref_ptr<Data> data, uint32_t dstArrayElement)
bool DescriptorConfigurator::assignDescriptor(const std::string& name, ref_ptr<Data> data, uint32_t dstArrayElement)
{
if (auto& descriptorBinding = shaderSet->getDescriptorBinding(name))
{
Expand All @@ -181,7 +181,7 @@ bool DescriptorConfigurator::assignUniform(const std::string& name, ref_ptr<Data
return false;
}

bool DescriptorConfigurator::assignUniform(const std::string& name, const BufferInfoList& bufferInfoList, uint32_t dstArrayElement)
bool DescriptorConfigurator::assignDescriptor(const std::string& name, const BufferInfoList& bufferInfoList, uint32_t dstArrayElement)
{
if (auto& descriptorBinding = shaderSet->getDescriptorBinding(name))
{
Expand Down Expand Up @@ -401,10 +401,10 @@ bool GraphicsPipelineConfigurator::enableTexture(const std::string& name)
return descriptorConfigurator->enableTexture(name);
}

bool GraphicsPipelineConfigurator::enableUniform(const std::string& name)
bool GraphicsPipelineConfigurator::enableDescriptor(const std::string& name)
{
if (!descriptorConfigurator) descriptorConfigurator = DescriptorConfigurator::create(shaderSet);
return descriptorConfigurator->enableUniform(name);
return descriptorConfigurator->enableDescriptor(name);
}

bool GraphicsPipelineConfigurator::assignArray(DataList& arrays, const std::string& name, VkVertexInputRate vertexInputRate, ref_ptr<Data> array)
Expand All @@ -429,10 +429,10 @@ bool GraphicsPipelineConfigurator::assignTexture(const std::string& name, ref_pt
return descriptorConfigurator->assignTexture(name, textureData, sampler);
}

bool GraphicsPipelineConfigurator::assignUniform(const std::string& name, ref_ptr<Data> data)
bool GraphicsPipelineConfigurator::assignDescriptor(const std::string& name, ref_ptr<Data> data)
{
if (!descriptorConfigurator) descriptorConfigurator = DescriptorConfigurator::create(shaderSet);
return descriptorConfigurator->assignUniform(name, data);
return descriptorConfigurator->assignDescriptor(name, data);
}

int GraphicsPipelineConfigurator::compare(const Object& rhs_object) const
Expand Down

0 comments on commit 9a090fb

Please sign in to comment.