HLSL: Add location offsets per resource type
This PR adds the ability to offset sampler, texture, and UBO bindings from provided base bindings, and to auto-number bindings that are not provided with explicit register numbers. The mechanism works as follows: - Offsets may be given on the command line for all stages, or individually for one or more single stages, in which case the offset will be auto-selected according to the stage being compiled. There is also an API to set them. The new command line options are --shift-sampler-binding, --shift-texture-binding, and --shift-UBO-binding. - Uniforms which are not given explicit bindings in the source code are auto-numbered if and only if they are in live code as determined by the algorithm used to build the reflection database, and the --auto-map-bindings option is given. This auto-numbering avoids using any binding slots which were explicitly provided in the code, whether or not that explicit use was live. E.g, "uniform Texture1D foo : register(t3);" with --shift-texture-binding 10 will reserve binding 13, whether or not foo is used in live code. - Shorter synonyms for the command line options are available. See the --help output. The testing infrastructure is slightly extended to allow use of the binding offset API, and two new tests spv.register.(no)autoassign.frag are added for comparing the resulting SPIR-V.
This commit is contained in:
parent
a1e2d4952e
commit
7f7c2ed780
13 changed files with 1191 additions and 10 deletions
|
|
@ -141,7 +141,11 @@ public:
|
|||
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
||||
pixelCenterInteger(false), originUpperLeft(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), depthReplacing(false), blendEquations(0),
|
||||
multiStream(false), xfbMode(false)
|
||||
multiStream(false), xfbMode(false),
|
||||
shiftSamplerBinding(0),
|
||||
shiftTextureBinding(0),
|
||||
shiftUboBinding(0),
|
||||
autoMapBindings(false)
|
||||
{
|
||||
localSize[0] = 1;
|
||||
localSize[1] = 1;
|
||||
|
|
@ -163,6 +167,16 @@ public:
|
|||
void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
|
||||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
|
||||
void setShiftSamplerBinding(unsigned int shift) { shiftSamplerBinding = shift; }
|
||||
unsigned int getShiftSamplerBinding() const { return shiftSamplerBinding; }
|
||||
void setShiftTextureBinding(unsigned int shift) { shiftTextureBinding = shift; }
|
||||
unsigned int getShiftTextureBinding() const { return shiftTextureBinding; }
|
||||
void setShiftUboBinding(unsigned int shift) { shiftUboBinding = shift; }
|
||||
unsigned int getShiftUboBinding() const { return shiftUboBinding; }
|
||||
void setAutoMapBindings(bool map) { autoMapBindings = map; }
|
||||
bool getAutoMapBindings() const { return autoMapBindings; }
|
||||
|
||||
void setVersion(int v) { version = v; }
|
||||
int getVersion() const { return version; }
|
||||
void setProfile(EProfile p) { profile = p; }
|
||||
|
|
@ -367,6 +381,11 @@ protected:
|
|||
EShSource source; // source language, known a bit later
|
||||
std::string entryPointName;
|
||||
std::string entryPointMangledName;
|
||||
unsigned int shiftSamplerBinding;
|
||||
unsigned int shiftTextureBinding;
|
||||
unsigned int shiftUboBinding;
|
||||
bool autoMapBindings;
|
||||
|
||||
EProfile profile;
|
||||
int version;
|
||||
SpvVersion spvVersion;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue