Infrastructure: Non-functional: Move to rich description of environment.
This is for input languages, client APIs, code to generate, etc.
This commit is contained in:
parent
4fbb8cb45e
commit
4be4aebdcd
6 changed files with 191 additions and 34 deletions
|
|
@ -110,7 +110,44 @@ typedef enum {
|
|||
EShSourceNone,
|
||||
EShSourceGlsl,
|
||||
EShSourceHlsl,
|
||||
} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead
|
||||
} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead
|
||||
|
||||
typedef enum {
|
||||
EShClientNone,
|
||||
EShClientVulkan,
|
||||
EShClientOpenGL,
|
||||
} EShClient;
|
||||
|
||||
typedef enum {
|
||||
EShTargetNone,
|
||||
EshTargetSpv,
|
||||
} EShTargetLanguage;
|
||||
|
||||
struct TInputLanguage {
|
||||
EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone
|
||||
EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone
|
||||
EShClient dialect;
|
||||
int dialectVersion; // version of client's language definition, not the client (when not EShClientNone)
|
||||
};
|
||||
|
||||
struct TClient {
|
||||
EShClient client;
|
||||
int version; // version of client itself (not the client's input dialect)
|
||||
};
|
||||
|
||||
struct TTarget {
|
||||
EShTargetLanguage language;
|
||||
unsigned int version; // the version to target, if SPIR-V, defined by "word 1" of the SPIR-V binary header
|
||||
};
|
||||
|
||||
// All source/client/target versions and settings.
|
||||
// Can override previous methods of setting, when items are set here.
|
||||
// Expected to grow, as more are added, rather than growing parameter lists.
|
||||
struct TEnvironment {
|
||||
TInputLanguage input; // definition of the input language
|
||||
TClient client; // what client is the overall compilation being done for?
|
||||
TTarget target; // what to generate
|
||||
};
|
||||
|
||||
const char* StageName(EShLanguage);
|
||||
|
||||
|
|
@ -324,6 +361,25 @@ public:
|
|||
void setNoStorageFormat(bool useUnknownFormat);
|
||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
|
||||
|
||||
// For setting up the environment (initialized in the constructor):
|
||||
void setEnvInput(EShSource lang, EShLanguage stage, EShClient client, int version)
|
||||
{
|
||||
environment.input.languageFamily = lang;
|
||||
environment.input.stage = stage;
|
||||
environment.input.dialect = client;
|
||||
environment.input.dialectVersion = version;
|
||||
}
|
||||
void setEnvClient(EShClient client, int version)
|
||||
{
|
||||
environment.client.client = client;
|
||||
environment.client.version = version;
|
||||
}
|
||||
void setEnvTarget(EShTargetLanguage lang, unsigned int version)
|
||||
{
|
||||
environment.target.language = lang;
|
||||
environment.target.version = version;
|
||||
}
|
||||
|
||||
// Interface to #include handlers.
|
||||
//
|
||||
// To support #include, a client of Glslang does the following:
|
||||
|
|
@ -463,6 +519,8 @@ protected:
|
|||
// a function in the source string can be renamed FROM this TO the name given in setEntryPoint.
|
||||
std::string sourceEntryPointName;
|
||||
|
||||
TEnvironment environment;
|
||||
|
||||
friend class TProgram;
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue