SPV: Give error on not assigning locations to I/O.
Also, provides an option to auto-assign locations. Existing tests use this option, to avoid the error message, however, it is not fully implemented yet.
This commit is contained in:
@@ -90,6 +90,7 @@ enum TOptions {
|
||||
EOptionKeepUncalled = (1 << 22),
|
||||
EOptionHlslOffsets = (1 << 23),
|
||||
EOptionHlslIoMapping = (1 << 24),
|
||||
EOptionAutoMapLocations = (1 << 25),
|
||||
};
|
||||
|
||||
//
|
||||
@@ -386,6 +387,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
lowerword == "hlsl-iomapper" ||
|
||||
lowerword == "hlsl-iomapping") {
|
||||
Options |= EOptionHlslIoMapping;
|
||||
} else if (lowerword == "auto-map-locations" || // synonyms
|
||||
lowerword == "aml") {
|
||||
Options |= EOptionAutoMapLocations;
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
@@ -648,6 +652,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (Options & EOptionAutoMapBindings)
|
||||
shader->setAutoMapBindings(true);
|
||||
|
||||
if (Options & EOptionAutoMapLocations)
|
||||
shader->setAutoMapLocations(true);
|
||||
|
||||
shaders.push_back(shader);
|
||||
|
||||
const int defaultVersion = Options & EOptionDefaultDesktop? 110: 100;
|
||||
@@ -1063,6 +1070,11 @@ void usage()
|
||||
" explicit bindings.\n"
|
||||
" --amb synonym for --auto-map-bindings\n"
|
||||
"\n"
|
||||
" --auto-map-locations automatically locate input/output lacking 'location'\n"
|
||||
" (fragile, not cross stage: recommend explicit\n"
|
||||
" 'location' use in shader)\n"
|
||||
" --aml synonym for --auto-map-locations\n"
|
||||
"\n"
|
||||
" --flatten-uniform-arrays flatten uniform texture & sampler arrays to scalars\n"
|
||||
" --fua synonym for --flatten-uniform-arrays\n"
|
||||
"\n"
|
||||
|
||||
Reference in New Issue
Block a user