Add per-descriptor-set IO mapping shift values.
This PR adds the ability to provide per-descriptor-set IO mapping shift
values. If a particular binding does not land into a per-set value,
then it falls back to the prior behavior (global shifts per resource class).
Because there were already 6 copies of many different methods and internal
variables and functions, and this PR would have added 6 more, a new API is
introduced to cut down on replication and present a cleaner interface.
For the global (non-set-specific) API, the old entry points still exist
for backward compatibility, but are phrased internally in terms of the
following.
// Resource type for IO resolver
enum TResourceType {
EResSampler,
EResTexture,
EResImage,
EResUbo,
EResSsbo,
EResUav,
EResCount
};
Methods on TShader:
void setShiftBinding(TResourceType res, unsigned int base);
void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base);
The first method replaces the 6 prior entry points of various spellings, which
exist now in depreciated form. The second provides per-resource-set functionality.
Both accept an enum from the list above.
From the command line, the existing options can accept either a single shift value as
before, or a series of 1 or more [set offset] pairs. Both can be provided, as in:
... --stb 20 --stb 2 25 3 30 ...
which will use the offset 20 for anything except descriptor set 2 (which uses 25) and
3 (which uses 30).
This commit is contained in:
parent
7d67c6cbc2
commit
08a14422c1
9 changed files with 523 additions and 159 deletions
|
|
@ -1661,20 +1661,30 @@ void TShader::addProcesses(const std::vector<std::string>& p)
|
|||
intermediate->addProcesses(p);
|
||||
}
|
||||
|
||||
// Set binding base for given resource type
|
||||
void TShader::setShiftBinding(TResourceType res, unsigned int base) {
|
||||
intermediate->setShiftBinding(res, base);
|
||||
}
|
||||
|
||||
// Set binding base for given resource type for a given binding set.
|
||||
void TShader::setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base) {
|
||||
intermediate->setShiftBindingForSet(res, set, base);
|
||||
}
|
||||
|
||||
// Set binding base for sampler types
|
||||
void TShader::setShiftSamplerBinding(unsigned int base) { intermediate->setShiftSamplerBinding(base); }
|
||||
void TShader::setShiftSamplerBinding(unsigned int base) { setShiftBinding(EResSampler, base); }
|
||||
// Set binding base for texture types (SRV)
|
||||
void TShader::setShiftTextureBinding(unsigned int base) { intermediate->setShiftTextureBinding(base); }
|
||||
void TShader::setShiftTextureBinding(unsigned int base) { setShiftBinding(EResTexture, base); }
|
||||
// Set binding base for image types
|
||||
void TShader::setShiftImageBinding(unsigned int base) { intermediate->setShiftImageBinding(base); }
|
||||
void TShader::setShiftImageBinding(unsigned int base) { setShiftBinding(EResImage, base); }
|
||||
// Set binding base for uniform buffer objects (CBV)
|
||||
void TShader::setShiftUboBinding(unsigned int base) { intermediate->setShiftUboBinding(base); }
|
||||
void TShader::setShiftUboBinding(unsigned int base) { setShiftBinding(EResUbo, base); }
|
||||
// Synonym for setShiftUboBinding, to match HLSL language.
|
||||
void TShader::setShiftCbufferBinding(unsigned int base) { intermediate->setShiftUboBinding(base); }
|
||||
void TShader::setShiftCbufferBinding(unsigned int base) { setShiftBinding(EResUbo, base); }
|
||||
// Set binding base for UAV (unordered access view)
|
||||
void TShader::setShiftUavBinding(unsigned int base) { intermediate->setShiftUavBinding(base); }
|
||||
void TShader::setShiftUavBinding(unsigned int base) { setShiftBinding(EResUav, base); }
|
||||
// Set binding base for SSBOs
|
||||
void TShader::setShiftSsboBinding(unsigned int base) { intermediate->setShiftSsboBinding(base); }
|
||||
void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSsbo, base); }
|
||||
// Enables binding automapping using TIoMapper
|
||||
void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); }
|
||||
// Fragile: currently within one stage: simple auto-assignment of location
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue