Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | #ifndef _COMPILER_INTERFACE_INCLUDED_ |
michael@0 | 7 | #define _COMPILER_INTERFACE_INCLUDED_ |
michael@0 | 8 | |
michael@0 | 9 | #if defined(COMPONENT_BUILD) |
michael@0 | 10 | #if defined(_WIN32) || defined(_WIN64) |
michael@0 | 11 | |
michael@0 | 12 | #if defined(COMPILER_IMPLEMENTATION) |
michael@0 | 13 | #define COMPILER_EXPORT __declspec(dllexport) |
michael@0 | 14 | #else |
michael@0 | 15 | #define COMPILER_EXPORT __declspec(dllimport) |
michael@0 | 16 | #endif // defined(COMPILER_IMPLEMENTATION) |
michael@0 | 17 | |
michael@0 | 18 | #else // defined(WIN32) |
michael@0 | 19 | #define COMPILER_EXPORT __attribute__((visibility("default"))) |
michael@0 | 20 | #endif |
michael@0 | 21 | |
michael@0 | 22 | #else // defined(COMPONENT_BUILD) |
michael@0 | 23 | #define COMPILER_EXPORT |
michael@0 | 24 | #endif |
michael@0 | 25 | |
michael@0 | 26 | #include "khrplatform.h" |
michael@0 | 27 | #include <stddef.h> |
michael@0 | 28 | |
michael@0 | 29 | // |
michael@0 | 30 | // This is the platform independent interface between an OGL driver |
michael@0 | 31 | // and the shading language compiler. |
michael@0 | 32 | // |
michael@0 | 33 | |
michael@0 | 34 | #ifdef __cplusplus |
michael@0 | 35 | extern "C" { |
michael@0 | 36 | #endif |
michael@0 | 37 | |
michael@0 | 38 | // Version number for shader translation API. |
michael@0 | 39 | // It is incremented everytime the API changes. |
michael@0 | 40 | #define ANGLE_SH_VERSION 110 |
michael@0 | 41 | |
michael@0 | 42 | // |
michael@0 | 43 | // The names of the following enums have been derived by replacing GL prefix |
michael@0 | 44 | // with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH. |
michael@0 | 45 | // The enum values are also equal to the values of their GL counterpart. This |
michael@0 | 46 | // is done to make it easier for applications to use the shader library. |
michael@0 | 47 | // |
michael@0 | 48 | typedef enum { |
michael@0 | 49 | SH_FRAGMENT_SHADER = 0x8B30, |
michael@0 | 50 | SH_VERTEX_SHADER = 0x8B31 |
michael@0 | 51 | } ShShaderType; |
michael@0 | 52 | |
michael@0 | 53 | typedef enum { |
michael@0 | 54 | SH_GLES2_SPEC = 0x8B40, |
michael@0 | 55 | SH_WEBGL_SPEC = 0x8B41, |
michael@0 | 56 | |
michael@0 | 57 | // The CSS Shaders spec is a subset of the WebGL spec. |
michael@0 | 58 | // |
michael@0 | 59 | // In both CSS vertex and fragment shaders, ANGLE: |
michael@0 | 60 | // (1) Reserves the "css_" prefix. |
michael@0 | 61 | // (2) Renames the main function to css_main. |
michael@0 | 62 | // (3) Disables the gl_MaxDrawBuffers built-in. |
michael@0 | 63 | // |
michael@0 | 64 | // In CSS fragment shaders, ANGLE: |
michael@0 | 65 | // (1) Disables the gl_FragColor built-in. |
michael@0 | 66 | // (2) Disables the gl_FragData built-in. |
michael@0 | 67 | // (3) Enables the css_MixColor built-in. |
michael@0 | 68 | // (4) Enables the css_ColorMatrix built-in. |
michael@0 | 69 | // |
michael@0 | 70 | // After passing a CSS shader through ANGLE, the browser is expected to append |
michael@0 | 71 | // a new main function to it. |
michael@0 | 72 | // This new main function will call the css_main function. |
michael@0 | 73 | // It may also perform additional operations like varying assignment, texture |
michael@0 | 74 | // access, and gl_FragColor assignment in order to implement the CSS Shaders |
michael@0 | 75 | // blend modes. |
michael@0 | 76 | // |
michael@0 | 77 | SH_CSS_SHADERS_SPEC = 0x8B42 |
michael@0 | 78 | } ShShaderSpec; |
michael@0 | 79 | |
michael@0 | 80 | typedef enum { |
michael@0 | 81 | SH_ESSL_OUTPUT = 0x8B45, |
michael@0 | 82 | SH_GLSL_OUTPUT = 0x8B46, |
michael@0 | 83 | SH_HLSL_OUTPUT = 0x8B47, |
michael@0 | 84 | SH_HLSL9_OUTPUT = 0x8B47, |
michael@0 | 85 | SH_HLSL11_OUTPUT = 0x8B48 |
michael@0 | 86 | } ShShaderOutput; |
michael@0 | 87 | |
michael@0 | 88 | typedef enum { |
michael@0 | 89 | SH_NONE = 0, |
michael@0 | 90 | SH_INT = 0x1404, |
michael@0 | 91 | SH_FLOAT = 0x1406, |
michael@0 | 92 | SH_FLOAT_VEC2 = 0x8B50, |
michael@0 | 93 | SH_FLOAT_VEC3 = 0x8B51, |
michael@0 | 94 | SH_FLOAT_VEC4 = 0x8B52, |
michael@0 | 95 | SH_INT_VEC2 = 0x8B53, |
michael@0 | 96 | SH_INT_VEC3 = 0x8B54, |
michael@0 | 97 | SH_INT_VEC4 = 0x8B55, |
michael@0 | 98 | SH_BOOL = 0x8B56, |
michael@0 | 99 | SH_BOOL_VEC2 = 0x8B57, |
michael@0 | 100 | SH_BOOL_VEC3 = 0x8B58, |
michael@0 | 101 | SH_BOOL_VEC4 = 0x8B59, |
michael@0 | 102 | SH_FLOAT_MAT2 = 0x8B5A, |
michael@0 | 103 | SH_FLOAT_MAT3 = 0x8B5B, |
michael@0 | 104 | SH_FLOAT_MAT4 = 0x8B5C, |
michael@0 | 105 | SH_SAMPLER_2D = 0x8B5E, |
michael@0 | 106 | SH_SAMPLER_CUBE = 0x8B60, |
michael@0 | 107 | SH_SAMPLER_2D_RECT_ARB = 0x8B63, |
michael@0 | 108 | SH_SAMPLER_EXTERNAL_OES = 0x8D66 |
michael@0 | 109 | } ShDataType; |
michael@0 | 110 | |
michael@0 | 111 | typedef enum { |
michael@0 | 112 | SH_INFO_LOG_LENGTH = 0x8B84, |
michael@0 | 113 | SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH |
michael@0 | 114 | SH_ACTIVE_UNIFORMS = 0x8B86, |
michael@0 | 115 | SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87, |
michael@0 | 116 | SH_ACTIVE_ATTRIBUTES = 0x8B89, |
michael@0 | 117 | SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A, |
michael@0 | 118 | SH_MAPPED_NAME_MAX_LENGTH = 0x6000, |
michael@0 | 119 | SH_NAME_MAX_LENGTH = 0x6001, |
michael@0 | 120 | SH_HASHED_NAME_MAX_LENGTH = 0x6002, |
michael@0 | 121 | SH_HASHED_NAMES_COUNT = 0x6003, |
michael@0 | 122 | SH_ACTIVE_UNIFORMS_ARRAY = 0x6004 |
michael@0 | 123 | } ShShaderInfo; |
michael@0 | 124 | |
michael@0 | 125 | // Compile options. |
michael@0 | 126 | typedef enum { |
michael@0 | 127 | SH_VALIDATE = 0, |
michael@0 | 128 | SH_VALIDATE_LOOP_INDEXING = 0x0001, |
michael@0 | 129 | SH_INTERMEDIATE_TREE = 0x0002, |
michael@0 | 130 | SH_OBJECT_CODE = 0x0004, |
michael@0 | 131 | SH_ATTRIBUTES_UNIFORMS = 0x0008, |
michael@0 | 132 | SH_LINE_DIRECTIVES = 0x0010, |
michael@0 | 133 | SH_SOURCE_PATH = 0x0020, |
michael@0 | 134 | SH_MAP_LONG_VARIABLE_NAMES = 0x0040, |
michael@0 | 135 | SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080, |
michael@0 | 136 | |
michael@0 | 137 | // This is needed only as a workaround for certain OpenGL driver bugs. |
michael@0 | 138 | SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100, |
michael@0 | 139 | |
michael@0 | 140 | // This is an experimental flag to enforce restrictions that aim to prevent |
michael@0 | 141 | // timing attacks. |
michael@0 | 142 | // It generates compilation errors for shaders that could expose sensitive |
michael@0 | 143 | // texture information via the timing channel. |
michael@0 | 144 | // To use this flag, you must compile the shader under the WebGL spec |
michael@0 | 145 | // (using the SH_WEBGL_SPEC flag). |
michael@0 | 146 | SH_TIMING_RESTRICTIONS = 0x0200, |
michael@0 | 147 | |
michael@0 | 148 | // This flag prints the dependency graph that is used to enforce timing |
michael@0 | 149 | // restrictions on fragment shaders. |
michael@0 | 150 | // This flag only has an effect if all of the following are true: |
michael@0 | 151 | // - The shader spec is SH_WEBGL_SPEC. |
michael@0 | 152 | // - The compile options contain the SH_TIMING_RESTRICTIONS flag. |
michael@0 | 153 | // - The shader type is SH_FRAGMENT_SHADER. |
michael@0 | 154 | SH_DEPENDENCY_GRAPH = 0x0400, |
michael@0 | 155 | |
michael@0 | 156 | // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions. |
michael@0 | 157 | SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800, |
michael@0 | 158 | |
michael@0 | 159 | // This flag ensures all indirect (expression-based) array indexing |
michael@0 | 160 | // is clamped to the bounds of the array. This ensures, for example, |
michael@0 | 161 | // that you cannot read off the end of a uniform, whether an array |
michael@0 | 162 | // vec234, or mat234 type. The ShArrayIndexClampingStrategy enum, |
michael@0 | 163 | // specified in the ShBuiltInResources when constructing the |
michael@0 | 164 | // compiler, selects the strategy for the clamping implementation. |
michael@0 | 165 | SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000, |
michael@0 | 166 | |
michael@0 | 167 | // This flag limits the complexity of an expression. |
michael@0 | 168 | SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000, |
michael@0 | 169 | |
michael@0 | 170 | // This flag limits the depth of the call stack. |
michael@0 | 171 | SH_LIMIT_CALL_STACK_DEPTH = 0x4000, |
michael@0 | 172 | } ShCompileOptions; |
michael@0 | 173 | |
michael@0 | 174 | // Defines alternate strategies for implementing array index clamping. |
michael@0 | 175 | typedef enum { |
michael@0 | 176 | // Use the clamp intrinsic for array index clamping. |
michael@0 | 177 | SH_CLAMP_WITH_CLAMP_INTRINSIC = 1, |
michael@0 | 178 | |
michael@0 | 179 | // Use a user-defined function for array index clamping. |
michael@0 | 180 | SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION |
michael@0 | 181 | } ShArrayIndexClampingStrategy; |
michael@0 | 182 | |
michael@0 | 183 | // |
michael@0 | 184 | // Driver must call this first, once, before doing any other |
michael@0 | 185 | // compiler operations. |
michael@0 | 186 | // If the function succeeds, the return value is nonzero, else zero. |
michael@0 | 187 | // |
michael@0 | 188 | COMPILER_EXPORT int ShInitialize(); |
michael@0 | 189 | // |
michael@0 | 190 | // Driver should call this at shutdown. |
michael@0 | 191 | // If the function succeeds, the return value is nonzero, else zero. |
michael@0 | 192 | // |
michael@0 | 193 | COMPILER_EXPORT int ShFinalize(); |
michael@0 | 194 | |
michael@0 | 195 | // The 64 bits hash function. The first parameter is the input string; the |
michael@0 | 196 | // second parameter is the string length. |
michael@0 | 197 | typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t); |
michael@0 | 198 | |
michael@0 | 199 | // |
michael@0 | 200 | // Implementation dependent built-in resources (constants and extensions). |
michael@0 | 201 | // The names for these resources has been obtained by stripping gl_/GL_. |
michael@0 | 202 | // |
michael@0 | 203 | typedef struct |
michael@0 | 204 | { |
michael@0 | 205 | // Constants. |
michael@0 | 206 | int MaxVertexAttribs; |
michael@0 | 207 | int MaxVertexUniformVectors; |
michael@0 | 208 | int MaxVaryingVectors; |
michael@0 | 209 | int MaxVertexTextureImageUnits; |
michael@0 | 210 | int MaxCombinedTextureImageUnits; |
michael@0 | 211 | int MaxTextureImageUnits; |
michael@0 | 212 | int MaxFragmentUniformVectors; |
michael@0 | 213 | int MaxDrawBuffers; |
michael@0 | 214 | |
michael@0 | 215 | // Extensions. |
michael@0 | 216 | // Set to 1 to enable the extension, else 0. |
michael@0 | 217 | int OES_standard_derivatives; |
michael@0 | 218 | int OES_EGL_image_external; |
michael@0 | 219 | int ARB_texture_rectangle; |
michael@0 | 220 | int EXT_draw_buffers; |
michael@0 | 221 | int EXT_frag_depth; |
michael@0 | 222 | |
michael@0 | 223 | // Set to 1 if highp precision is supported in the fragment language. |
michael@0 | 224 | // Default is 0. |
michael@0 | 225 | int FragmentPrecisionHigh; |
michael@0 | 226 | |
michael@0 | 227 | // Name Hashing. |
michael@0 | 228 | // Set a 64 bit hash function to enable user-defined name hashing. |
michael@0 | 229 | // Default is NULL. |
michael@0 | 230 | ShHashFunction64 HashFunction; |
michael@0 | 231 | |
michael@0 | 232 | // Selects a strategy to use when implementing array index clamping. |
michael@0 | 233 | // Default is SH_CLAMP_WITH_CLAMP_INTRINSIC. |
michael@0 | 234 | ShArrayIndexClampingStrategy ArrayIndexClampingStrategy; |
michael@0 | 235 | |
michael@0 | 236 | // The maximum complexity an expression can be. |
michael@0 | 237 | int MaxExpressionComplexity; |
michael@0 | 238 | |
michael@0 | 239 | // The maximum depth a call stack can be. |
michael@0 | 240 | int MaxCallStackDepth; |
michael@0 | 241 | } ShBuiltInResources; |
michael@0 | 242 | |
michael@0 | 243 | // |
michael@0 | 244 | // Initialize built-in resources with minimum expected values. |
michael@0 | 245 | // |
michael@0 | 246 | COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources); |
michael@0 | 247 | |
michael@0 | 248 | // |
michael@0 | 249 | // ShHandle held by but opaque to the driver. It is allocated, |
michael@0 | 250 | // managed, and de-allocated by the compiler. It's contents |
michael@0 | 251 | // are defined by and used by the compiler. |
michael@0 | 252 | // |
michael@0 | 253 | // If handle creation fails, 0 will be returned. |
michael@0 | 254 | // |
michael@0 | 255 | typedef void* ShHandle; |
michael@0 | 256 | |
michael@0 | 257 | // |
michael@0 | 258 | // Driver calls these to create and destroy compiler objects. |
michael@0 | 259 | // |
michael@0 | 260 | // Returns the handle of constructed compiler, null if the requested compiler is |
michael@0 | 261 | // not supported. |
michael@0 | 262 | // Parameters: |
michael@0 | 263 | // type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER. |
michael@0 | 264 | // spec: Specifies the language spec the compiler must conform to - |
michael@0 | 265 | // SH_GLES2_SPEC or SH_WEBGL_SPEC. |
michael@0 | 266 | // output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT, |
michael@0 | 267 | // SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. |
michael@0 | 268 | // resources: Specifies the built-in resources. |
michael@0 | 269 | COMPILER_EXPORT ShHandle ShConstructCompiler( |
michael@0 | 270 | ShShaderType type, |
michael@0 | 271 | ShShaderSpec spec, |
michael@0 | 272 | ShShaderOutput output, |
michael@0 | 273 | const ShBuiltInResources* resources); |
michael@0 | 274 | COMPILER_EXPORT void ShDestruct(ShHandle handle); |
michael@0 | 275 | |
michael@0 | 276 | // |
michael@0 | 277 | // Compiles the given shader source. |
michael@0 | 278 | // If the function succeeds, the return value is nonzero, else zero. |
michael@0 | 279 | // Parameters: |
michael@0 | 280 | // handle: Specifies the handle of compiler to be used. |
michael@0 | 281 | // shaderStrings: Specifies an array of pointers to null-terminated strings |
michael@0 | 282 | // containing the shader source code. |
michael@0 | 283 | // numStrings: Specifies the number of elements in shaderStrings array. |
michael@0 | 284 | // compileOptions: A mask containing the following parameters: |
michael@0 | 285 | // SH_VALIDATE: Validates shader to ensure that it conforms to the spec |
michael@0 | 286 | // specified during compiler construction. |
michael@0 | 287 | // SH_VALIDATE_LOOP_INDEXING: Validates loop and indexing in the shader to |
michael@0 | 288 | // ensure that they do not exceed the minimum |
michael@0 | 289 | // functionality mandated in GLSL 1.0 spec, |
michael@0 | 290 | // Appendix A, Section 4 and 5. |
michael@0 | 291 | // There is no need to specify this parameter when |
michael@0 | 292 | // compiling for WebGL - it is implied. |
michael@0 | 293 | // SH_INTERMEDIATE_TREE: Writes intermediate tree to info log. |
michael@0 | 294 | // Can be queried by calling ShGetInfoLog(). |
michael@0 | 295 | // SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader. |
michael@0 | 296 | // Can be queried by calling ShGetObjectCode(). |
michael@0 | 297 | // SH_ATTRIBUTES_UNIFORMS: Extracts attributes and uniforms. |
michael@0 | 298 | // Can be queried by calling ShGetActiveAttrib() and |
michael@0 | 299 | // ShGetActiveUniform(). |
michael@0 | 300 | // |
michael@0 | 301 | COMPILER_EXPORT int ShCompile( |
michael@0 | 302 | const ShHandle handle, |
michael@0 | 303 | const char* const shaderStrings[], |
michael@0 | 304 | size_t numStrings, |
michael@0 | 305 | int compileOptions |
michael@0 | 306 | ); |
michael@0 | 307 | |
michael@0 | 308 | // Returns a parameter from a compiled shader. |
michael@0 | 309 | // Parameters: |
michael@0 | 310 | // handle: Specifies the compiler |
michael@0 | 311 | // pname: Specifies the parameter to query. |
michael@0 | 312 | // The following parameters are defined: |
michael@0 | 313 | // SH_INFO_LOG_LENGTH: the number of characters in the information log |
michael@0 | 314 | // including the null termination character. |
michael@0 | 315 | // SH_OBJECT_CODE_LENGTH: the number of characters in the object code |
michael@0 | 316 | // including the null termination character. |
michael@0 | 317 | // SH_ACTIVE_ATTRIBUTES: the number of active attribute variables. |
michael@0 | 318 | // SH_ACTIVE_ATTRIBUTE_MAX_LENGTH: the length of the longest active attribute |
michael@0 | 319 | // variable name including the null |
michael@0 | 320 | // termination character. |
michael@0 | 321 | // SH_ACTIVE_UNIFORMS: the number of active uniform variables. |
michael@0 | 322 | // SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform |
michael@0 | 323 | // variable name including the null |
michael@0 | 324 | // termination character. |
michael@0 | 325 | // SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including |
michael@0 | 326 | // the null termination character. |
michael@0 | 327 | // SH_NAME_MAX_LENGTH: the max length of a user-defined name including the |
michael@0 | 328 | // null termination character. |
michael@0 | 329 | // SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the |
michael@0 | 330 | // null termination character. |
michael@0 | 331 | // SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile. |
michael@0 | 332 | // |
michael@0 | 333 | // params: Requested parameter |
michael@0 | 334 | COMPILER_EXPORT void ShGetInfo(const ShHandle handle, |
michael@0 | 335 | ShShaderInfo pname, |
michael@0 | 336 | size_t* params); |
michael@0 | 337 | |
michael@0 | 338 | // Returns nul-terminated information log for a compiled shader. |
michael@0 | 339 | // Parameters: |
michael@0 | 340 | // handle: Specifies the compiler |
michael@0 | 341 | // infoLog: Specifies an array of characters that is used to return |
michael@0 | 342 | // the information log. It is assumed that infoLog has enough memory |
michael@0 | 343 | // to accomodate the information log. The size of the buffer required |
michael@0 | 344 | // to store the returned information log can be obtained by calling |
michael@0 | 345 | // ShGetInfo with SH_INFO_LOG_LENGTH. |
michael@0 | 346 | COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog); |
michael@0 | 347 | |
michael@0 | 348 | // Returns null-terminated object code for a compiled shader. |
michael@0 | 349 | // Parameters: |
michael@0 | 350 | // handle: Specifies the compiler |
michael@0 | 351 | // infoLog: Specifies an array of characters that is used to return |
michael@0 | 352 | // the object code. It is assumed that infoLog has enough memory to |
michael@0 | 353 | // accomodate the object code. The size of the buffer required to |
michael@0 | 354 | // store the returned object code can be obtained by calling |
michael@0 | 355 | // ShGetInfo with SH_OBJECT_CODE_LENGTH. |
michael@0 | 356 | COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode); |
michael@0 | 357 | |
michael@0 | 358 | // Returns information about an active attribute variable. |
michael@0 | 359 | // Parameters: |
michael@0 | 360 | // handle: Specifies the compiler |
michael@0 | 361 | // index: Specifies the index of the attribute variable to be queried. |
michael@0 | 362 | // length: Returns the number of characters actually written in the string |
michael@0 | 363 | // indicated by name (excluding the null terminator) if a value other |
michael@0 | 364 | // than NULL is passed. |
michael@0 | 365 | // size: Returns the size of the attribute variable. |
michael@0 | 366 | // type: Returns the data type of the attribute variable. |
michael@0 | 367 | // name: Returns a null terminated string containing the name of the |
michael@0 | 368 | // attribute variable. It is assumed that name has enough memory to |
michael@0 | 369 | // accomodate the attribute variable name. The size of the buffer |
michael@0 | 370 | // required to store the attribute variable name can be obtained by |
michael@0 | 371 | // calling ShGetInfo with SH_ACTIVE_ATTRIBUTE_MAX_LENGTH. |
michael@0 | 372 | // mappedName: Returns a null terminated string containing the mapped name of |
michael@0 | 373 | // the attribute variable, It is assumed that mappedName has enough |
michael@0 | 374 | // memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care |
michael@0 | 375 | // about the mapped name. If the name is not mapped, then name and |
michael@0 | 376 | // mappedName are the same. |
michael@0 | 377 | COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle, |
michael@0 | 378 | int index, |
michael@0 | 379 | size_t* length, |
michael@0 | 380 | int* size, |
michael@0 | 381 | ShDataType* type, |
michael@0 | 382 | char* name, |
michael@0 | 383 | char* mappedName); |
michael@0 | 384 | |
michael@0 | 385 | // Returns information about an active uniform variable. |
michael@0 | 386 | // Parameters: |
michael@0 | 387 | // handle: Specifies the compiler |
michael@0 | 388 | // index: Specifies the index of the uniform variable to be queried. |
michael@0 | 389 | // length: Returns the number of characters actually written in the string |
michael@0 | 390 | // indicated by name (excluding the null terminator) if a value |
michael@0 | 391 | // other than NULL is passed. |
michael@0 | 392 | // size: Returns the size of the uniform variable. |
michael@0 | 393 | // type: Returns the data type of the uniform variable. |
michael@0 | 394 | // name: Returns a null terminated string containing the name of the |
michael@0 | 395 | // uniform variable. It is assumed that name has enough memory to |
michael@0 | 396 | // accomodate the uniform variable name. The size of the buffer required |
michael@0 | 397 | // to store the uniform variable name can be obtained by calling |
michael@0 | 398 | // ShGetInfo with SH_ACTIVE_UNIFORMS_MAX_LENGTH. |
michael@0 | 399 | // mappedName: Returns a null terminated string containing the mapped name of |
michael@0 | 400 | // the uniform variable, It is assumed that mappedName has enough |
michael@0 | 401 | // memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care |
michael@0 | 402 | // about the mapped name. If the name is not mapped, then name and |
michael@0 | 403 | // mappedName are the same. |
michael@0 | 404 | COMPILER_EXPORT void ShGetActiveUniform(const ShHandle handle, |
michael@0 | 405 | int index, |
michael@0 | 406 | size_t* length, |
michael@0 | 407 | int* size, |
michael@0 | 408 | ShDataType* type, |
michael@0 | 409 | char* name, |
michael@0 | 410 | char* mappedName); |
michael@0 | 411 | |
michael@0 | 412 | // Returns information about a name hashing entry from the latest compile. |
michael@0 | 413 | // Parameters: |
michael@0 | 414 | // handle: Specifies the compiler |
michael@0 | 415 | // index: Specifies the index of the name hashing entry to be queried. |
michael@0 | 416 | // name: Returns a null terminated string containing the user defined name. |
michael@0 | 417 | // It is assumed that name has enough memory to accomodate the name. |
michael@0 | 418 | // The size of the buffer required to store the user defined name can |
michael@0 | 419 | // be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH. |
michael@0 | 420 | // hashedName: Returns a null terminated string containing the hashed name of |
michael@0 | 421 | // the uniform variable, It is assumed that hashedName has enough |
michael@0 | 422 | // memory to accomodate the name. The size of the buffer required |
michael@0 | 423 | // to store the name can be obtained by calling ShGetInfo with |
michael@0 | 424 | // SH_HASHED_NAME_MAX_LENGTH. |
michael@0 | 425 | COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle, |
michael@0 | 426 | int index, |
michael@0 | 427 | char* name, |
michael@0 | 428 | char* hashedName); |
michael@0 | 429 | |
michael@0 | 430 | // Returns a parameter from a compiled shader. |
michael@0 | 431 | // Parameters: |
michael@0 | 432 | // handle: Specifies the compiler |
michael@0 | 433 | // pname: Specifies the parameter to query. |
michael@0 | 434 | // The following parameters are defined: |
michael@0 | 435 | // SH_ACTIVE_UNIFORMS_ARRAY: an STL vector of active uniforms. Valid only for |
michael@0 | 436 | // HLSL output. |
michael@0 | 437 | // params: Requested parameter |
michael@0 | 438 | COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle, |
michael@0 | 439 | ShShaderInfo pname, |
michael@0 | 440 | void** params); |
michael@0 | 441 | |
michael@0 | 442 | #ifdef __cplusplus |
michael@0 | 443 | } |
michael@0 | 444 | #endif |
michael@0 | 445 | |
michael@0 | 446 | #endif // _COMPILER_INTERFACE_INCLUDED_ |