diff options
Diffstat (limited to 'src/3rdparty/angle/include/GLSLANG/ShaderLang.h')
-rw-r--r-- | src/3rdparty/angle/include/GLSLANG/ShaderLang.h | 146 |
1 files changed, 88 insertions, 58 deletions
diff --git a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h index 9912939b95..4b69fb1fb0 100644 --- a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h +++ b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h @@ -31,24 +31,19 @@ // and the shading language compiler. // +namespace sh +{ +// GLenum alias +typedef unsigned int GLenum; +} + #ifdef __cplusplus extern "C" { #endif // Version number for shader translation API. -// It is incremented everytime the API changes. -#define ANGLE_SH_VERSION 112 - -// -// The names of the following enums have been derived by replacing GL prefix -// with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH. -// The enum values are also equal to the values of their GL counterpart. This -// is done to make it easier for applications to use the shader library. -// -typedef enum { - SH_FRAGMENT_SHADER = 0x8B30, - SH_VERTEX_SHADER = 0x8B31 -} ShShaderType; +// It is incremented every time the API changes. +#define ANGLE_SH_VERSION 128 typedef enum { SH_GLES2_SPEC = 0x8B40, @@ -86,29 +81,6 @@ typedef enum { } ShShaderOutput; typedef enum { - SH_NONE = 0, - SH_INT = 0x1404, - SH_FLOAT = 0x1406, - SH_FLOAT_VEC2 = 0x8B50, - SH_FLOAT_VEC3 = 0x8B51, - SH_FLOAT_VEC4 = 0x8B52, - SH_INT_VEC2 = 0x8B53, - SH_INT_VEC3 = 0x8B54, - SH_INT_VEC4 = 0x8B55, - SH_BOOL = 0x8B56, - SH_BOOL_VEC2 = 0x8B57, - SH_BOOL_VEC3 = 0x8B58, - SH_BOOL_VEC4 = 0x8B59, - SH_FLOAT_MAT2 = 0x8B5A, - SH_FLOAT_MAT3 = 0x8B5B, - SH_FLOAT_MAT4 = 0x8B5C, - SH_SAMPLER_2D = 0x8B5E, - SH_SAMPLER_CUBE = 0x8B60, - SH_SAMPLER_2D_RECT_ARB = 0x8B63, - SH_SAMPLER_EXTERNAL_OES = 0x8D66 -} ShDataType; - -typedef enum { SH_PRECISION_HIGHP = 0x5001, SH_PRECISION_MEDIUMP = 0x5002, SH_PRECISION_LOWP = 0x5003, @@ -116,19 +88,26 @@ typedef enum { } ShPrecisionType; typedef enum { - SH_INFO_LOG_LENGTH = 0x8B84, - SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH - SH_ACTIVE_UNIFORMS = 0x8B86, - SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87, - SH_ACTIVE_ATTRIBUTES = 0x8B89, - SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A, - SH_VARYINGS = 0x8BBB, - SH_VARYING_MAX_LENGTH = 0x8BBC, - SH_MAPPED_NAME_MAX_LENGTH = 0x6000, - SH_NAME_MAX_LENGTH = 0x6001, - SH_HASHED_NAME_MAX_LENGTH = 0x6002, - SH_HASHED_NAMES_COUNT = 0x6003, - SH_ACTIVE_UNIFORMS_ARRAY = 0x6004 + SH_INFO_LOG_LENGTH = 0x8B84, + SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH + SH_ACTIVE_UNIFORMS = 0x8B86, + SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87, + SH_ACTIVE_ATTRIBUTES = 0x8B89, + SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A, + SH_VARYINGS = 0x8BBB, + SH_VARYING_MAX_LENGTH = 0x8BBC, + SH_MAPPED_NAME_MAX_LENGTH = 0x6000, + SH_NAME_MAX_LENGTH = 0x6001, + SH_HASHED_NAME_MAX_LENGTH = 0x6002, + SH_HASHED_NAMES_COUNT = 0x6003, + SH_ACTIVE_UNIFORMS_ARRAY = 0x6004, + SH_SHADER_VERSION = 0x6005, + SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006, + SH_ACTIVE_OUTPUT_VARIABLES_ARRAY = 0x6007, + SH_ACTIVE_ATTRIBUTES_ARRAY = 0x6008, + SH_ACTIVE_VARYINGS_ARRAY = 0x6009, + SH_RESOURCES_STRING_LENGTH = 0x600A, + SH_OUTPUT_TYPE = 0x600B } ShShaderInfo; // Compile options. @@ -140,13 +119,17 @@ typedef enum { SH_VARIABLES = 0x0008, SH_LINE_DIRECTIVES = 0x0010, SH_SOURCE_PATH = 0x0020, - SH_MAP_LONG_VARIABLE_NAMES = 0x0040, - SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080, + SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040, + // If a sampler array index happens to be a loop index, + // 1) if its type is integer, unroll the loop. + // 2) if its type is float, fail the shader compile. + // This is to work around a mac driver bug. + SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080, // This is needed only as a workaround for certain OpenGL driver bugs. SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100, - // This is an experimental flag to enforce restrictions that aim to prevent + // This is an experimental flag to enforce restrictions that aim to prevent // timing attacks. // It generates compilation errors for shaders that could expose sensitive // texture information via the timing channel. @@ -159,7 +142,7 @@ typedef enum { // This flag only has an effect if all of the following are true: // - The shader spec is SH_WEBGL_SPEC. // - The compile options contain the SH_TIMING_RESTRICTIONS flag. - // - The shader type is SH_FRAGMENT_SHADER. + // - The shader type is GL_FRAGMENT_SHADER. SH_DEPENDENCY_GRAPH = 0x0400, // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions. @@ -202,6 +185,10 @@ typedef enum { // It is intended as a workaround for drivers which incorrectly optimize // out such varyings and cause a link failure. SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000, + + // This flag scalarizes vec/ivec/bvec/mat constructor args. + // It is intended as a workaround for Linux/Mac driver bugs. + SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000, } ShCompileOptions; // Defines alternate strategies for implementing array index clamping. @@ -252,11 +239,18 @@ typedef struct int ARB_texture_rectangle; int EXT_draw_buffers; int EXT_frag_depth; + int EXT_shader_texture_lod; // Set to 1 if highp precision is supported in the fragment language. // Default is 0. int FragmentPrecisionHigh; + // GLSL ES 3.0 constants. + int MaxVertexOutputVectors; + int MaxFragmentInputVectors; + int MinProgramTexelOffset; + int MaxProgramTexelOffset; + // Name Hashing. // Set a 64 bit hash function to enable user-defined name hashing. // Default is NULL. @@ -280,7 +274,7 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources); // // ShHandle held by but opaque to the driver. It is allocated, -// managed, and de-allocated by the compiler. It's contents +// managed, and de-allocated by the compiler. Its contents // are defined by and used by the compiler. // // If handle creation fails, 0 will be returned. @@ -288,19 +282,30 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources); typedef void* ShHandle; // +// Returns the a concatenated list of the items in ShBuiltInResources as a string. +// This function must be updated whenever ShBuiltInResources is changed. +// Parameters: +// handle: Specifies the handle of the compiler to be used. +// outStringLen: Specifies the size of the buffer, in number of characters. The size +// of the buffer required to store the resources string can be obtained +// by calling ShGetInfo with SH_RESOURCES_STRING_LENGTH. +// outStr: Returns a null-terminated string representing all the built-in resources. +COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outStr); + +// // Driver calls these to create and destroy compiler objects. // // Returns the handle of constructed compiler, null if the requested compiler is // not supported. // Parameters: -// type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER. +// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER. // spec: Specifies the language spec the compiler must conform to - // SH_GLES2_SPEC or SH_WEBGL_SPEC. // output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT, // SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. // resources: Specifies the built-in resources. COMPILER_EXPORT ShHandle ShConstructCompiler( - ShShaderType type, + sh::GLenum type, ShShaderSpec spec, ShShaderOutput output, const ShBuiltInResources* resources); @@ -364,6 +369,8 @@ COMPILER_EXPORT int ShCompile( // SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the // null termination character. // SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile. +// SH_SHADER_VERSION: the version of the shader language +// SH_OUTPUT_TYPE: the currently set language output type // // params: Requested parameter COMPILER_EXPORT void ShGetInfo(const ShHandle handle, @@ -422,7 +429,7 @@ COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle, int index, size_t* length, int* size, - ShDataType* type, + sh::GLenum* type, ShPrecisionType* precision, int* staticUse, char* name, @@ -460,7 +467,7 @@ COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle, typedef struct { - ShDataType type; + sh::GLenum type; int size; } ShVariableInfo; @@ -477,6 +484,29 @@ COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits( ShVariableInfo* varInfoArray, size_t varInfoArraySize); +// Gives the compiler-assigned register for an interface block. +// The method writes the value to the output variable "indexOut". +// Returns true if it found a valid interface block, false otherwise. +// Parameters: +// handle: Specifies the compiler +// interfaceBlockName: Specifies the interface block +// indexOut: output variable that stores the assigned register +COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle, + const char *interfaceBlockName, + unsigned int *indexOut); + +// Gives the compiler-assigned register for uniforms in the default +// interface block. +// The method writes the value to the output variable "indexOut". +// Returns true if it found a valid default uniform, false otherwise. +// Parameters: +// handle: Specifies the compiler +// interfaceBlockName: Specifies the uniform +// indexOut: output variable that stores the assigned register +COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle, + const char *uniformName, + unsigned int *indexOut); + #ifdef __cplusplus } #endif |