-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renamed "Uniform" to "DescriptorBuffer" #956
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,7 @@ void DescriptorConfigurator::reset() | |
|
||
bool DescriptorConfigurator::enableTexture(const std::string& name) | ||
{ | ||
if (auto& textureBinding = shaderSet->getBufferBinding(name)) | ||
if (auto& textureBinding = shaderSet->getDescriptorBinding(name)) | ||
{ | ||
assigned.insert(name); | ||
|
||
|
@@ -118,7 +118,7 @@ bool DescriptorConfigurator::enableTexture(const std::string& name) | |
|
||
bool DescriptorConfigurator::assignTexture(const std::string& name, ref_ptr<Data> textureData, ref_ptr<Sampler> sampler, uint32_t dstArrayElement) | ||
{ | ||
if (auto& textureBinding = shaderSet->getBufferBinding(name)) | ||
if (auto& textureBinding = shaderSet->getDescriptorBinding(name)) | ||
{ | ||
assigned.insert(name); | ||
|
||
|
@@ -135,7 +135,7 @@ bool DescriptorConfigurator::assignTexture(const std::string& name, ref_ptr<Data | |
|
||
bool DescriptorConfigurator::assignTexture(const std::string& name, const ImageInfoList& imageInfoList, uint32_t dstArrayElement) | ||
{ | ||
if (auto& textureBinding = shaderSet->getBufferBinding(name)) | ||
if (auto& textureBinding = shaderSet->getDescriptorBinding(name)) | ||
{ | ||
assigned.insert(name); | ||
|
||
|
@@ -151,7 +151,7 @@ bool DescriptorConfigurator::assignTexture(const std::string& name, const ImageI | |
|
||
bool DescriptorConfigurator::enableBuffer(const std::string& name) | ||
theodoregoetz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
if (auto& bufferBinding = shaderSet->getBufferBinding(name)) | ||
if (auto& bufferBinding = shaderSet->getDescriptorBinding(name)) | ||
{ | ||
assigned.insert(name); | ||
|
||
|
@@ -176,7 +176,7 @@ bool DescriptorConfigurator::enableUniform(const std::string& name) | |
|
||
bool DescriptorConfigurator::assignBuffer(const std::string& name, ref_ptr<Data> data, uint32_t dstArrayElement) | ||
{ | ||
if (auto& bufferBinding = shaderSet->getBufferBinding(name)) | ||
if (auto& bufferBinding = shaderSet->getDescriptorBinding(name)) | ||
{ | ||
assigned.insert(name); | ||
|
||
|
@@ -200,7 +200,7 @@ bool DescriptorConfigurator::assignUniform(const std::string& name, ref_ptr<Data | |
|
||
bool DescriptorConfigurator::assignBuffer(const std::string& name, const BufferInfoList& bufferInfoList, uint32_t dstArrayElement) | ||
theodoregoetz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
if (auto& bufferBinding = shaderSet->getBufferBinding(name)) | ||
if (auto& bufferBinding = shaderSet->getDescriptorBinding(name)) | ||
{ | ||
assigned.insert(name); | ||
|
||
|
@@ -248,14 +248,14 @@ bool DescriptorConfigurator::assignDefaults() | |
bool assignedDefault = false; | ||
if (shaderSet) | ||
{ | ||
for (auto& bufferBinding : shaderSet->bufferBindings) | ||
for (auto& descriptorBinding : shaderSet->descriptorBindings) | ||
{ | ||
if (bufferBinding.define.empty() && assigned.count(bufferBinding.name) == 0) | ||
if (descriptorBinding.define.empty() && assigned.count(descriptorBinding.name) == 0) | ||
{ | ||
bool set_matched = false; | ||
for (auto& cds : shaderSet->customDescriptorSetBindings) | ||
{ | ||
if (cds->set == bufferBinding.set) | ||
if (cds->set == descriptorBinding.set) | ||
{ | ||
set_matched = true; | ||
break; | ||
|
@@ -264,7 +264,7 @@ bool DescriptorConfigurator::assignDefaults() | |
if (!set_matched) | ||
{ | ||
bool isTexture = false; | ||
switch (bufferBinding.descriptorType) | ||
switch (descriptorBinding.descriptorType) | ||
{ | ||
case (VK_DESCRIPTOR_TYPE_SAMPLER): | ||
case (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER): | ||
|
@@ -278,16 +278,16 @@ bool DescriptorConfigurator::assignDefaults() | |
|
||
if (isTexture) | ||
{ | ||
assignDescriptor(bufferBinding.set, bufferBinding.binding, bufferBinding.descriptorType, bufferBinding.descriptorCount, bufferBinding.stageFlags, | ||
DescriptorImage::create(Sampler::create(), bufferBinding.data, bufferBinding.binding, 0, bufferBinding.descriptorType)); | ||
assignDescriptor(descriptorBinding.set, descriptorBinding.binding, descriptorBinding.descriptorType, descriptorBinding.descriptorCount, descriptorBinding.stageFlags, | ||
DescriptorImage::create(Sampler::create(), descriptorBinding.data, descriptorBinding.binding, 0, descriptorBinding.descriptorType)); | ||
} | ||
else | ||
{ | ||
assignDescriptor(bufferBinding.set, bufferBinding.binding, bufferBinding.descriptorType, bufferBinding.descriptorCount, bufferBinding.stageFlags, | ||
DescriptorBuffer::create(bufferBinding.data, bufferBinding.binding, 0, bufferBinding.descriptorType)); | ||
assignDescriptor(descriptorBinding.set, descriptorBinding.binding, descriptorBinding.descriptorType, descriptorBinding.descriptorCount, descriptorBinding.stageFlags, | ||
DescriptorBuffer::create(descriptorBinding.data, descriptorBinding.binding, 0, descriptorBinding.descriptorType)); | ||
} | ||
|
||
assigned.insert(bufferBinding.name); | ||
assigned.insert(descriptorBinding.name); | ||
assignedDefault = true; | ||
} | ||
} | ||
|
@@ -471,8 +471,8 @@ bool GraphicsPipelineConfigurator::assignBuffer(const std::string& name, ref_ptr | |
/// deprecated. use GraphicsPipelineConfigurator::assignBuffer() instead | ||
bool GraphicsPipelineConfigurator::assignUniform(const std::string& name, ref_ptr<Data> data) | ||
{ | ||
warn("GraphicsPipelineConfigurator::enableUniform() has been deprecated." | ||
" use GraphicsPipelineConfigurator::enableBuffer() instead."); | ||
warn("GraphicsPipelineConfigurator::assignUniform() has been deprecated." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the warning redundant if we are using the [[deprecated]] compiler hint? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly. I don't know how this attribute and how VSG's logging plays with release and debug. I figured you might have some opinion on which is best. I can take this out if you think it best. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once this PR is settled a bit further I'll merge this PR as a branch and then do testing with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for deprecations, I believe it best to be obnoxious about it. Otherwise it's easier to ignore. |
||
" use GraphicsPipelineConfigurator::assignBuffer() instead."); | ||
return assignBuffer(name, data); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be enableDescriptor()?
W.r.t [[deprecated]], do you know whether doxygen can handle it in a sensible way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no.
GraphicsPipelineConfigurator::enableBuffer()
is still good in my opinion. see my previous comment posted at the same time as yours just now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think enableBuffer() is more confusing that the original enableUniform(). Buffer has a distinct mean in VSG and Vulkan, it refers to a whole buffer not a subset that is can be as a uniform and storage.
enableDescriptor() is more generic than enableTexture()/enableUniform() but it does at least still map to DescriptorBuffer/DescriptorImage. If we want to replace enableUniform()/enableTexture() then it would probably be best as enableDescriptorBuffer()/enableDescriptorImage().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I came to nearly the same conclusion but decided at the time that shorter method names would be better. Note that the word "descriptor" shows up twice in
DescriptorConfigurator::enableDescriptorBuffer()
so why not just make itDescriptorConfigurator::enableBuffer()
?But really I could have gone either way.
DescriptorConfigurator::enableDescriptorBuffer()
is not too bad in length.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I want to keep this PR to the uniform/storage issue and follow-up with a rename for the texture/image methods right after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just DescriptorConfigurator::enable(..) then?
Though, as we'll need to keep it consistent with the GraphicsPipelineConfigurator API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can stand the slight inconsistency for this PR, I'd like to make this change first, keeping it as is at the moment (
enableDescriptorBuffer()
, etc) and come back with another PR to renameenableTexture()
toenableDescriptorImage()
. This is because the down-stream changes are many and separating this out keeps it all straight in my head.