daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
shannon.woods@transgaming.com | b73964e | 2013-01-25 21:49:14 +0000 | [diff] [blame] | 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | #ifndef _COMPILER_INTERFACE_INCLUDED_ |
| 7 | #define _COMPILER_INTERFACE_INCLUDED_ |
| 8 | |
Geoff Lang | 31f0dc0 | 2013-10-08 13:29:13 -0400 | [diff] [blame] | 9 | #if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC) |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 10 | #if defined(_WIN32) || defined(_WIN64) |
| 11 | |
Geoff Lang | 31f0dc0 | 2013-10-08 13:29:13 -0400 | [diff] [blame] | 12 | #if defined(ANGLE_TRANSLATOR_IMPLEMENTATION) |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 13 | #define COMPILER_EXPORT __declspec(dllexport) |
| 14 | #else |
| 15 | #define COMPILER_EXPORT __declspec(dllimport) |
Geoff Lang | 31f0dc0 | 2013-10-08 13:29:13 -0400 | [diff] [blame] | 16 | #endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION) |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 17 | |
Geoff Lang | 31f0dc0 | 2013-10-08 13:29:13 -0400 | [diff] [blame] | 18 | #else // defined(_WIN32) || defined(_WIN64) |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 19 | #define COMPILER_EXPORT __attribute__((visibility("default"))) |
| 20 | #endif |
| 21 | |
Geoff Lang | 31f0dc0 | 2013-10-08 13:29:13 -0400 | [diff] [blame] | 22 | #else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC) |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 23 | #define COMPILER_EXPORT |
| 24 | #endif |
| 25 | |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 26 | #include "KHR/khrplatform.h" |
shannon.woods@transgaming.com | d64b3da | 2013-02-28 23:19:26 +0000 | [diff] [blame] | 27 | #include <stddef.h> |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 28 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 29 | // |
| 30 | // This is the platform independent interface between an OGL driver |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 31 | // and the shading language compiler. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 32 | // |
| 33 | |
| 34 | #ifdef __cplusplus |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 35 | extern "C" { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 36 | #endif |
alokp@chromium.org | 2fa7369 | 2010-09-28 17:20:39 +0000 | [diff] [blame] | 37 | |
| 38 | // Version number for shader translation API. |
Nicolas Capens | 344e714 | 2013-06-24 15:39:21 -0400 | [diff] [blame] | 39 | // It is incremented every time the API changes. |
Jamie Madill | 68fe74a | 2014-05-27 12:56:01 -0400 | [diff] [blame] | 40 | #define ANGLE_SH_VERSION 125 |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 41 | |
| 42 | // |
| 43 | // The names of the following enums have been derived by replacing GL prefix |
| 44 | // with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH. |
| 45 | // The enum values are also equal to the values of their GL counterpart. This |
| 46 | // is done to make it easier for applications to use the shader library. |
| 47 | // |
| 48 | typedef enum { |
| 49 | SH_FRAGMENT_SHADER = 0x8B30, |
| 50 | SH_VERTEX_SHADER = 0x8B31 |
| 51 | } ShShaderType; |
| 52 | |
| 53 | typedef enum { |
| 54 | SH_GLES2_SPEC = 0x8B40, |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 55 | SH_WEBGL_SPEC = 0x8B41, |
| 56 | |
| 57 | // The CSS Shaders spec is a subset of the WebGL spec. |
| 58 | // |
| 59 | // In both CSS vertex and fragment shaders, ANGLE: |
| 60 | // (1) Reserves the "css_" prefix. |
| 61 | // (2) Renames the main function to css_main. |
| 62 | // (3) Disables the gl_MaxDrawBuffers built-in. |
| 63 | // |
| 64 | // In CSS fragment shaders, ANGLE: |
| 65 | // (1) Disables the gl_FragColor built-in. |
| 66 | // (2) Disables the gl_FragData built-in. |
| 67 | // (3) Enables the css_MixColor built-in. |
| 68 | // (4) Enables the css_ColorMatrix built-in. |
| 69 | // |
| 70 | // After passing a CSS shader through ANGLE, the browser is expected to append |
| 71 | // a new main function to it. |
| 72 | // This new main function will call the css_main function. |
| 73 | // It may also perform additional operations like varying assignment, texture |
| 74 | // access, and gl_FragColor assignment in order to implement the CSS Shaders |
| 75 | // blend modes. |
| 76 | // |
| 77 | SH_CSS_SHADERS_SPEC = 0x8B42 |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 78 | } ShShaderSpec; |
| 79 | |
| 80 | typedef enum { |
shannon.woods@transgaming.com | b73964e | 2013-01-25 21:49:14 +0000 | [diff] [blame] | 81 | SH_ESSL_OUTPUT = 0x8B45, |
| 82 | SH_GLSL_OUTPUT = 0x8B46, |
shannon.woods@transgaming.com | 8204334 | 2013-01-25 21:49:34 +0000 | [diff] [blame] | 83 | SH_HLSL_OUTPUT = 0x8B47, |
shannon.woods@transgaming.com | b73964e | 2013-01-25 21:49:14 +0000 | [diff] [blame] | 84 | SH_HLSL9_OUTPUT = 0x8B47, |
| 85 | SH_HLSL11_OUTPUT = 0x8B48 |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 86 | } ShShaderOutput; |
| 87 | |
| 88 | typedef enum { |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 89 | SH_NONE = 0, |
| 90 | SH_INT = 0x1404, |
shannonwoods@chromium.org | 6b70991 | 2013-05-30 00:20:04 +0000 | [diff] [blame] | 91 | SH_UNSIGNED_INT = 0x1405, |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 92 | SH_FLOAT = 0x1406, |
| 93 | SH_FLOAT_VEC2 = 0x8B50, |
| 94 | SH_FLOAT_VEC3 = 0x8B51, |
| 95 | SH_FLOAT_VEC4 = 0x8B52, |
| 96 | SH_INT_VEC2 = 0x8B53, |
| 97 | SH_INT_VEC3 = 0x8B54, |
| 98 | SH_INT_VEC4 = 0x8B55, |
shannonwoods@chromium.org | 6b70991 | 2013-05-30 00:20:04 +0000 | [diff] [blame] | 99 | SH_UNSIGNED_INT_VEC2 = 0x8DC6, |
| 100 | SH_UNSIGNED_INT_VEC3 = 0x8DC7, |
| 101 | SH_UNSIGNED_INT_VEC4 = 0x8DC8, |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 102 | SH_BOOL = 0x8B56, |
| 103 | SH_BOOL_VEC2 = 0x8B57, |
| 104 | SH_BOOL_VEC3 = 0x8B58, |
| 105 | SH_BOOL_VEC4 = 0x8B59, |
| 106 | SH_FLOAT_MAT2 = 0x8B5A, |
| 107 | SH_FLOAT_MAT3 = 0x8B5B, |
| 108 | SH_FLOAT_MAT4 = 0x8B5C, |
shannonwoods@chromium.org | 8da034c | 2013-05-30 00:19:15 +0000 | [diff] [blame] | 109 | SH_FLOAT_MAT2x3 = 0x8B65, |
| 110 | SH_FLOAT_MAT2x4 = 0x8B66, |
| 111 | SH_FLOAT_MAT3x2 = 0x8B67, |
| 112 | SH_FLOAT_MAT3x4 = 0x8B68, |
| 113 | SH_FLOAT_MAT4x2 = 0x8B69, |
| 114 | SH_FLOAT_MAT4x3 = 0x8B6A, |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 115 | SH_SAMPLER_2D = 0x8B5E, |
Nicolas Capens | da07535 | 2013-06-24 16:02:56 -0400 | [diff] [blame] | 116 | SH_SAMPLER_3D = 0x8B5F, |
kbr@chromium.org | 205fef3 | 2011-11-22 20:50:02 +0000 | [diff] [blame] | 117 | SH_SAMPLER_CUBE = 0x8B60, |
apatrick@chromium.org | 6575602 | 2012-01-17 21:45:38 +0000 | [diff] [blame] | 118 | SH_SAMPLER_2D_RECT_ARB = 0x8B63, |
Nicolas Capens | 344e714 | 2013-06-24 15:39:21 -0400 | [diff] [blame] | 119 | SH_SAMPLER_EXTERNAL_OES = 0x8D66, |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 120 | SH_SAMPLER_2D_ARRAY = 0x8DC1, |
Nicolas Capens | 344e714 | 2013-06-24 15:39:21 -0400 | [diff] [blame] | 121 | SH_INT_SAMPLER_2D = 0x8DCA, |
Nicolas Capens | da07535 | 2013-06-24 16:02:56 -0400 | [diff] [blame] | 122 | SH_INT_SAMPLER_3D = 0x8DCB, |
Nicolas Capens | 344e714 | 2013-06-24 15:39:21 -0400 | [diff] [blame] | 123 | SH_INT_SAMPLER_CUBE = 0x8DCC, |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 124 | SH_INT_SAMPLER_2D_ARRAY = 0x8DCF, |
Nicolas Capens | 2ffe0bb | 2013-06-24 15:56:19 -0400 | [diff] [blame] | 125 | SH_UNSIGNED_INT_SAMPLER_2D = 0x8DD2, |
Nicolas Capens | da07535 | 2013-06-24 16:02:56 -0400 | [diff] [blame] | 126 | SH_UNSIGNED_INT_SAMPLER_3D = 0x8DD3, |
Nicolas Capens | 2ffe0bb | 2013-06-24 15:56:19 -0400 | [diff] [blame] | 127 | SH_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4, |
Nicolas Capens | 2a1d8a3 | 2013-07-18 11:49:40 -0400 | [diff] [blame] | 128 | SH_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7, |
| 129 | SH_SAMPLER_2D_SHADOW = 0x8B62, |
| 130 | SH_SAMPLER_CUBE_SHADOW = 0x8DC5, |
| 131 | SH_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4 |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 132 | } ShDataType; |
| 133 | |
| 134 | typedef enum { |
Zhenyao Mo | fa3c346 | 2013-09-23 14:57:04 -0400 | [diff] [blame] | 135 | SH_PRECISION_HIGHP = 0x5001, |
| 136 | SH_PRECISION_MEDIUMP = 0x5002, |
| 137 | SH_PRECISION_LOWP = 0x5003, |
| 138 | SH_PRECISION_UNDEFINED = 0 |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 139 | } ShPrecisionType; |
| 140 | |
| 141 | typedef enum { |
Jamie Madill | 47fdd13 | 2013-08-30 13:21:04 -0400 | [diff] [blame] | 142 | SH_INFO_LOG_LENGTH = 0x8B84, |
| 143 | SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH |
| 144 | SH_ACTIVE_UNIFORMS = 0x8B86, |
| 145 | SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87, |
| 146 | SH_ACTIVE_ATTRIBUTES = 0x8B89, |
| 147 | SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A, |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 148 | SH_VARYINGS = 0x8BBB, |
| 149 | SH_VARYING_MAX_LENGTH = 0x8BBC, |
Jamie Madill | 47fdd13 | 2013-08-30 13:21:04 -0400 | [diff] [blame] | 150 | SH_MAPPED_NAME_MAX_LENGTH = 0x6000, |
| 151 | SH_NAME_MAX_LENGTH = 0x6001, |
| 152 | SH_HASHED_NAME_MAX_LENGTH = 0x6002, |
| 153 | SH_HASHED_NAMES_COUNT = 0x6003, |
| 154 | SH_ACTIVE_UNIFORMS_ARRAY = 0x6004, |
| 155 | SH_SHADER_VERSION = 0x6005, |
| 156 | SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006, |
| 157 | SH_ACTIVE_OUTPUT_VARIABLES_ARRAY = 0x6007, |
| 158 | SH_ACTIVE_ATTRIBUTES_ARRAY = 0x6008, |
| 159 | SH_ACTIVE_VARYINGS_ARRAY = 0x6009, |
Jamie Madill | 68fe74a | 2014-05-27 12:56:01 -0400 | [diff] [blame] | 160 | SH_RESOURCES_STRING_LENGTH = 0x600A, |
| 161 | SH_OUTPUT_TYPE = 0x600B |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 162 | } ShShaderInfo; |
| 163 | |
| 164 | // Compile options. |
| 165 | typedef enum { |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 166 | SH_VALIDATE = 0, |
| 167 | SH_VALIDATE_LOOP_INDEXING = 0x0001, |
| 168 | SH_INTERMEDIATE_TREE = 0x0002, |
| 169 | SH_OBJECT_CODE = 0x0004, |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 170 | SH_VARIABLES = 0x0008, |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 171 | SH_LINE_DIRECTIVES = 0x0010, |
| 172 | SH_SOURCE_PATH = 0x0020, |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 173 | SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040, |
Zhenyao Mo | 550c600 | 2014-02-26 15:40:48 -0800 | [diff] [blame] | 174 | // If a sampler array index happens to be a loop index, |
| 175 | // 1) if its type is integer, unroll the loop. |
| 176 | // 2) if its type is float, fail the shader compile. |
| 177 | // This is to work around a mac driver bug. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 178 | SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080, |
zmo@google.com | 32e9731 | 2011-08-24 01:03:11 +0000 | [diff] [blame] | 179 | |
| 180 | // This is needed only as a workaround for certain OpenGL driver bugs. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 181 | SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100, |
maxvujovic@gmail.com | 66ebd01 | 2012-05-30 22:18:11 +0000 | [diff] [blame] | 182 | |
| 183 | // This is an experimental flag to enforce restrictions that aim to prevent |
| 184 | // timing attacks. |
| 185 | // It generates compilation errors for shaders that could expose sensitive |
| 186 | // texture information via the timing channel. |
| 187 | // To use this flag, you must compile the shader under the WebGL spec |
| 188 | // (using the SH_WEBGL_SPEC flag). |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 189 | SH_TIMING_RESTRICTIONS = 0x0200, |
Zhenyao Mo | 550c600 | 2014-02-26 15:40:48 -0800 | [diff] [blame] | 190 | |
maxvujovic@gmail.com | 66ebd01 | 2012-05-30 22:18:11 +0000 | [diff] [blame] | 191 | // This flag prints the dependency graph that is used to enforce timing |
| 192 | // restrictions on fragment shaders. |
| 193 | // This flag only has an effect if all of the following are true: |
| 194 | // - The shader spec is SH_WEBGL_SPEC. |
| 195 | // - The compile options contain the SH_TIMING_RESTRICTIONS flag. |
| 196 | // - The shader type is SH_FRAGMENT_SHADER. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 197 | SH_DEPENDENCY_GRAPH = 0x0400, |
gman@chromium.org | 8d80479 | 2012-10-17 21:33:48 +0000 | [diff] [blame] | 198 | |
| 199 | // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions. |
Zhenyao Mo | a15f3e8 | 2013-09-23 14:57:08 -0400 | [diff] [blame] | 200 | // This flag only enforces (and can only enforce) the packing |
| 201 | // restrictions for uniform variables in both vertex and fragment |
| 202 | // shaders. ShCheckVariablesWithinPackingLimits() lets embedders |
| 203 | // enforce the packing restrictions for varying variables during |
| 204 | // program link time. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 205 | SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800, |
daniel@transgaming.com | 4167cc9 | 2013-01-11 04:11:53 +0000 | [diff] [blame] | 206 | |
| 207 | // This flag ensures all indirect (expression-based) array indexing |
| 208 | // is clamped to the bounds of the array. This ensures, for example, |
| 209 | // that you cannot read off the end of a uniform, whether an array |
shannon.woods@transgaming.com | 1d432bb | 2013-01-25 21:57:28 +0000 | [diff] [blame] | 210 | // vec234, or mat234 type. The ShArrayIndexClampingStrategy enum, |
| 211 | // specified in the ShBuiltInResources when constructing the |
| 212 | // compiler, selects the strategy for the clamping implementation. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 213 | SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000, |
Jamie Madill | eb1a010 | 2013-07-08 13:31:38 -0400 | [diff] [blame] | 214 | |
| 215 | // This flag limits the complexity of an expression. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 216 | SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000, |
Jamie Madill | eb1a010 | 2013-07-08 13:31:38 -0400 | [diff] [blame] | 217 | |
| 218 | // This flag limits the depth of the call stack. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 219 | SH_LIMIT_CALL_STACK_DEPTH = 0x4000, |
Zhenyao Mo | ac44cd2 | 2013-09-23 14:57:09 -0400 | [diff] [blame] | 220 | |
Zhenyao Mo | 4a667fe | 2014-02-11 12:35:01 -0800 | [diff] [blame] | 221 | // This flag initializes gl_Position to vec4(0,0,0,0) at the |
| 222 | // beginning of the vertex shader's main(), and has no effect in the |
Zhenyao Mo | ac44cd2 | 2013-09-23 14:57:09 -0400 | [diff] [blame] | 223 | // fragment shader. It is intended as a workaround for drivers which |
| 224 | // incorrectly fail to link programs if gl_Position is not written. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 225 | SH_INIT_GL_POSITION = 0x8000, |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 226 | |
| 227 | // This flag replaces |
| 228 | // "a && b" with "a ? b : false", |
| 229 | // "a || b" with "a ? true : b". |
| 230 | // This is to work around a MacOSX driver bug that |b| is executed |
| 231 | // independent of |a|'s value. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 232 | SH_UNFOLD_SHORT_CIRCUIT = 0x10000, |
Zhenyao Mo | 4a667fe | 2014-02-11 12:35:01 -0800 | [diff] [blame] | 233 | |
| 234 | // This flag initializes varyings without static use in vertex shader |
| 235 | // at the beginning of main(), and has no effects in the fragment shader. |
| 236 | // It is intended as a workaround for drivers which incorrectly optimize |
| 237 | // out such varyings and cause a link failure. |
Zhenyao Mo | 3cdfcce | 2014-03-07 13:00:08 -0800 | [diff] [blame] | 238 | SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000, |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 239 | } ShCompileOptions; |
alokp@chromium.org | 2fa7369 | 2010-09-28 17:20:39 +0000 | [diff] [blame] | 240 | |
shannon.woods@transgaming.com | 1d432bb | 2013-01-25 21:57:28 +0000 | [diff] [blame] | 241 | // Defines alternate strategies for implementing array index clamping. |
| 242 | typedef enum { |
| 243 | // Use the clamp intrinsic for array index clamping. |
| 244 | SH_CLAMP_WITH_CLAMP_INTRINSIC = 1, |
| 245 | |
| 246 | // Use a user-defined function for array index clamping. |
| 247 | SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION |
| 248 | } ShArrayIndexClampingStrategy; |
| 249 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 250 | // |
| 251 | // Driver must call this first, once, before doing any other |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 252 | // compiler operations. |
alokp@chromium.org | b399934 | 2010-08-12 19:46:23 +0000 | [diff] [blame] | 253 | // If the function succeeds, the return value is nonzero, else zero. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 254 | // |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 255 | COMPILER_EXPORT int ShInitialize(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 256 | // |
| 257 | // Driver should call this at shutdown. |
alokp@chromium.org | b399934 | 2010-08-12 19:46:23 +0000 | [diff] [blame] | 258 | // If the function succeeds, the return value is nonzero, else zero. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 259 | // |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 260 | COMPILER_EXPORT int ShFinalize(); |
alokp@chromium.org | 29cd91a | 2010-07-16 19:30:45 +0000 | [diff] [blame] | 261 | |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 262 | // The 64 bits hash function. The first parameter is the input string; the |
| 263 | // second parameter is the string length. |
shannon.woods@transgaming.com | d64b3da | 2013-02-28 23:19:26 +0000 | [diff] [blame] | 264 | typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t); |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 265 | |
alokp@chromium.org | 29cd91a | 2010-07-16 19:30:45 +0000 | [diff] [blame] | 266 | // |
alokp@chromium.org | 94a86ad | 2010-08-25 20:02:11 +0000 | [diff] [blame] | 267 | // Implementation dependent built-in resources (constants and extensions). |
| 268 | // The names for these resources has been obtained by stripping gl_/GL_. |
| 269 | // |
| 270 | typedef struct |
| 271 | { |
| 272 | // Constants. |
| 273 | int MaxVertexAttribs; |
| 274 | int MaxVertexUniformVectors; |
| 275 | int MaxVaryingVectors; |
| 276 | int MaxVertexTextureImageUnits; |
| 277 | int MaxCombinedTextureImageUnits; |
| 278 | int MaxTextureImageUnits; |
| 279 | int MaxFragmentUniformVectors; |
| 280 | int MaxDrawBuffers; |
| 281 | |
| 282 | // Extensions. |
| 283 | // Set to 1 to enable the extension, else 0. |
| 284 | int OES_standard_derivatives; |
zmo@google.com | 09c323a | 2011-08-12 18:22:25 +0000 | [diff] [blame] | 285 | int OES_EGL_image_external; |
kbr@chromium.org | 205fef3 | 2011-11-22 20:50:02 +0000 | [diff] [blame] | 286 | int ARB_texture_rectangle; |
shannon.woods@transgaming.com | 550cd09 | 2013-02-28 23:19:54 +0000 | [diff] [blame] | 287 | int EXT_draw_buffers; |
Jamie Madill | 2aeb26a | 2013-07-08 14:02:55 -0400 | [diff] [blame] | 288 | int EXT_frag_depth; |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 289 | int EXT_shader_texture_lod; |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 290 | |
shannon.woods%transgaming.com@gtempaccount.com | cbb6b6a | 2013-04-13 03:27:47 +0000 | [diff] [blame] | 291 | // Set to 1 if highp precision is supported in the fragment language. |
| 292 | // Default is 0. |
| 293 | int FragmentPrecisionHigh; |
| 294 | |
shannonwoods@chromium.org | 74b86cf | 2013-05-30 00:02:58 +0000 | [diff] [blame] | 295 | // GLSL ES 3.0 constants. |
| 296 | int MaxVertexOutputVectors; |
| 297 | int MaxFragmentInputVectors; |
| 298 | int MinProgramTexelOffset; |
| 299 | int MaxProgramTexelOffset; |
| 300 | |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 301 | // Name Hashing. |
| 302 | // Set a 64 bit hash function to enable user-defined name hashing. |
| 303 | // Default is NULL. |
| 304 | ShHashFunction64 HashFunction; |
shannon.woods@transgaming.com | 1d432bb | 2013-01-25 21:57:28 +0000 | [diff] [blame] | 305 | |
| 306 | // Selects a strategy to use when implementing array index clamping. |
| 307 | // Default is SH_CLAMP_WITH_CLAMP_INTRINSIC. |
| 308 | ShArrayIndexClampingStrategy ArrayIndexClampingStrategy; |
Jamie Madill | eb1a010 | 2013-07-08 13:31:38 -0400 | [diff] [blame] | 309 | |
| 310 | // The maximum complexity an expression can be. |
| 311 | int MaxExpressionComplexity; |
| 312 | |
| 313 | // The maximum depth a call stack can be. |
| 314 | int MaxCallStackDepth; |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 315 | } ShBuiltInResources; |
alokp@chromium.org | 94a86ad | 2010-08-25 20:02:11 +0000 | [diff] [blame] | 316 | |
| 317 | // |
| 318 | // Initialize built-in resources with minimum expected values. |
| 319 | // |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 320 | COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources); |
alokp@chromium.org | 94a86ad | 2010-08-25 20:02:11 +0000 | [diff] [blame] | 321 | |
| 322 | // |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 323 | // ShHandle held by but opaque to the driver. It is allocated, |
Shannon Woods | 2d76e5f | 2014-05-16 17:46:41 -0400 | [diff] [blame] | 324 | // managed, and de-allocated by the compiler. Its contents |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 325 | // are defined by and used by the compiler. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 326 | // |
| 327 | // If handle creation fails, 0 will be returned. |
| 328 | // |
| 329 | typedef void* ShHandle; |
| 330 | |
| 331 | // |
Shannon Woods | 2d76e5f | 2014-05-16 17:46:41 -0400 | [diff] [blame] | 332 | // Returns the a concatenated list of the items in ShBuiltInResources as a string. |
| 333 | // This function must be updated whenever ShBuiltInResources is changed. |
| 334 | // Parameters: |
| 335 | // handle: Specifies the handle of the compiler to be used. |
| 336 | // outStringLen: Specifies the size of the buffer, in number of characters. The size |
| 337 | // of the buffer required to store the resources string can be obtained |
| 338 | // by calling ShGetInfo with SH_RESOURCES_STRING_LENGTH. |
| 339 | // outStr: Returns a null-terminated string representing all the built-in resources. |
| 340 | COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outStr); |
| 341 | |
| 342 | // |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 343 | // Driver calls these to create and destroy compiler objects. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 344 | // |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 345 | // Returns the handle of constructed compiler, null if the requested compiler is |
| 346 | // not supported. |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 347 | // Parameters: |
| 348 | // type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER. |
| 349 | // spec: Specifies the language spec the compiler must conform to - |
| 350 | // SH_GLES2_SPEC or SH_WEBGL_SPEC. |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 351 | // output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT, |
shannon.woods@transgaming.com | 8204334 | 2013-01-25 21:49:34 +0000 | [diff] [blame] | 352 | // SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 353 | // resources: Specifies the built-in resources. |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 354 | COMPILER_EXPORT ShHandle ShConstructCompiler( |
| 355 | ShShaderType type, |
| 356 | ShShaderSpec spec, |
| 357 | ShShaderOutput output, |
| 358 | const ShBuiltInResources* resources); |
| 359 | COMPILER_EXPORT void ShDestruct(ShHandle handle); |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 360 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 361 | // |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 362 | // Compiles the given shader source. |
| 363 | // If the function succeeds, the return value is nonzero, else zero. |
| 364 | // Parameters: |
| 365 | // handle: Specifies the handle of compiler to be used. |
| 366 | // shaderStrings: Specifies an array of pointers to null-terminated strings |
| 367 | // containing the shader source code. |
| 368 | // numStrings: Specifies the number of elements in shaderStrings array. |
| 369 | // compileOptions: A mask containing the following parameters: |
alokp@chromium.org | 1f29954 | 2010-11-12 15:50:23 +0000 | [diff] [blame] | 370 | // SH_VALIDATE: Validates shader to ensure that it conforms to the spec |
| 371 | // specified during compiler construction. |
alokp@chromium.org | b59a778 | 2010-11-24 18:38:33 +0000 | [diff] [blame] | 372 | // SH_VALIDATE_LOOP_INDEXING: Validates loop and indexing in the shader to |
| 373 | // ensure that they do not exceed the minimum |
| 374 | // functionality mandated in GLSL 1.0 spec, |
| 375 | // Appendix A, Section 4 and 5. |
| 376 | // There is no need to specify this parameter when |
| 377 | // compiling for WebGL - it is implied. |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 378 | // SH_INTERMEDIATE_TREE: Writes intermediate tree to info log. |
| 379 | // Can be queried by calling ShGetInfoLog(). |
| 380 | // SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader. |
| 381 | // Can be queried by calling ShGetObjectCode(). |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 382 | // SH_VARIABLES: Extracts attributes, uniforms, and varyings. |
| 383 | // Can be queried by calling ShGetVariableInfo(). |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 384 | // |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 385 | COMPILER_EXPORT int ShCompile( |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 386 | const ShHandle handle, |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 387 | const char* const shaderStrings[], |
shannon.woods@transgaming.com | d64b3da | 2013-02-28 23:19:26 +0000 | [diff] [blame] | 388 | size_t numStrings, |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 389 | int compileOptions |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 390 | ); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 391 | |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 392 | // Returns a parameter from a compiled shader. |
| 393 | // Parameters: |
| 394 | // handle: Specifies the compiler |
| 395 | // pname: Specifies the parameter to query. |
| 396 | // The following parameters are defined: |
| 397 | // SH_INFO_LOG_LENGTH: the number of characters in the information log |
| 398 | // including the null termination character. |
| 399 | // SH_OBJECT_CODE_LENGTH: the number of characters in the object code |
| 400 | // including the null termination character. |
| 401 | // SH_ACTIVE_ATTRIBUTES: the number of active attribute variables. |
| 402 | // SH_ACTIVE_ATTRIBUTE_MAX_LENGTH: the length of the longest active attribute |
| 403 | // variable name including the null |
| 404 | // termination character. |
| 405 | // SH_ACTIVE_UNIFORMS: the number of active uniform variables. |
| 406 | // SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform |
| 407 | // variable name including the null |
| 408 | // termination character. |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 409 | // SH_VARYINGS: the number of varying variables. |
| 410 | // SH_VARYING_MAX_LENGTH: the length of the longest varying variable name |
| 411 | // including the null termination character. |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 412 | // SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including |
| 413 | // the null termination character. |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 414 | // SH_NAME_MAX_LENGTH: the max length of a user-defined name including the |
| 415 | // null termination character. |
| 416 | // SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the |
| 417 | // null termination character. |
| 418 | // SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile. |
shannon.woods%transgaming.com@gtempaccount.com | 0bbed38 | 2013-04-13 03:38:07 +0000 | [diff] [blame] | 419 | // SH_SHADER_VERSION: the version of the shader language |
Jamie Madill | 68fe74a | 2014-05-27 12:56:01 -0400 | [diff] [blame] | 420 | // SH_OUTPUT_TYPE: the currently set language output type |
shannon.woods@transgaming.com | d64b3da | 2013-02-28 23:19:26 +0000 | [diff] [blame] | 421 | // |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 422 | // params: Requested parameter |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 423 | COMPILER_EXPORT void ShGetInfo(const ShHandle handle, |
| 424 | ShShaderInfo pname, |
shannon.woods@transgaming.com | d64b3da | 2013-02-28 23:19:26 +0000 | [diff] [blame] | 425 | size_t* params); |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 426 | |
| 427 | // Returns nul-terminated information log for a compiled shader. |
| 428 | // Parameters: |
| 429 | // handle: Specifies the compiler |
| 430 | // infoLog: Specifies an array of characters that is used to return |
| 431 | // the information log. It is assumed that infoLog has enough memory |
| 432 | // to accomodate the information log. The size of the buffer required |
| 433 | // to store the returned information log can be obtained by calling |
| 434 | // ShGetInfo with SH_INFO_LOG_LENGTH. |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 435 | COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog); |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 436 | |
| 437 | // Returns null-terminated object code for a compiled shader. |
| 438 | // Parameters: |
| 439 | // handle: Specifies the compiler |
| 440 | // infoLog: Specifies an array of characters that is used to return |
| 441 | // the object code. It is assumed that infoLog has enough memory to |
| 442 | // accomodate the object code. The size of the buffer required to |
| 443 | // store the returned object code can be obtained by calling |
| 444 | // ShGetInfo with SH_OBJECT_CODE_LENGTH. |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 445 | COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode); |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 446 | |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 447 | // Returns information about a shader variable. |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 448 | // Parameters: |
| 449 | // handle: Specifies the compiler |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 450 | // variableType: Specifies the variable type; options include |
| 451 | // SH_ACTIVE_ATTRIBUTES, SH_ACTIVE_UNIFORMS, SH_VARYINGS. |
| 452 | // index: Specifies the index of the variable to be queried. |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 453 | // length: Returns the number of characters actually written in the string |
| 454 | // indicated by name (excluding the null terminator) if a value other |
| 455 | // than NULL is passed. |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 456 | // size: Returns the size of the variable. |
| 457 | // type: Returns the data type of the variable. |
| 458 | // precision: Returns the precision of the variable. |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 459 | // staticUse: Returns 1 if the variable is accessed in a statement after |
| 460 | // pre-processing, whether or not run-time flow of control will |
| 461 | // cause that statement to be executed. |
| 462 | // Returns 0 otherwise. |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 463 | // name: Returns a null terminated string containing the name of the |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 464 | // variable. It is assumed that name has enough memory to accormodate |
| 465 | // the variable name. The size of the buffer required to store the |
| 466 | // variable name can be obtained by calling ShGetInfo with |
| 467 | // SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_ACTIVE_UNIFORM_MAX_LENGTH, |
| 468 | // SH_VARYING_MAX_LENGTH. |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 469 | // mappedName: Returns a null terminated string containing the mapped name of |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 470 | // the variable, It is assumed that mappedName has enough memory |
| 471 | // (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care about the |
| 472 | // mapped name. If the name is not mapped, then name and mappedName |
| 473 | // are the same. |
| 474 | COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle, |
| 475 | ShShaderInfo variableType, |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 476 | int index, |
shannon.woods@transgaming.com | d64b3da | 2013-02-28 23:19:26 +0000 | [diff] [blame] | 477 | size_t* length, |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 478 | int* size, |
| 479 | ShDataType* type, |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 480 | ShPrecisionType* precision, |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 481 | int* staticUse, |
apatrick@chromium.org | 22eab92 | 2011-10-21 01:16:42 +0000 | [diff] [blame] | 482 | char* name, |
| 483 | char* mappedName); |
alokp@chromium.org | 7beea40 | 2010-09-15 21:18:34 +0000 | [diff] [blame] | 484 | |
daniel@transgaming.com | c23f461 | 2012-11-28 19:42:57 +0000 | [diff] [blame] | 485 | // Returns information about a name hashing entry from the latest compile. |
| 486 | // Parameters: |
| 487 | // handle: Specifies the compiler |
| 488 | // index: Specifies the index of the name hashing entry to be queried. |
| 489 | // name: Returns a null terminated string containing the user defined name. |
| 490 | // It is assumed that name has enough memory to accomodate the name. |
| 491 | // The size of the buffer required to store the user defined name can |
| 492 | // be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH. |
| 493 | // hashedName: Returns a null terminated string containing the hashed name of |
| 494 | // the uniform variable, It is assumed that hashedName has enough |
| 495 | // memory to accomodate the name. The size of the buffer required |
| 496 | // to store the name can be obtained by calling ShGetInfo with |
| 497 | // SH_HASHED_NAME_MAX_LENGTH. |
| 498 | COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle, |
| 499 | int index, |
| 500 | char* name, |
| 501 | char* hashedName); |
| 502 | |
daniel@transgaming.com | 043da13 | 2012-12-20 21:12:22 +0000 | [diff] [blame] | 503 | // Returns a parameter from a compiled shader. |
| 504 | // Parameters: |
| 505 | // handle: Specifies the compiler |
| 506 | // pname: Specifies the parameter to query. |
| 507 | // The following parameters are defined: |
| 508 | // SH_ACTIVE_UNIFORMS_ARRAY: an STL vector of active uniforms. Valid only for |
| 509 | // HLSL output. |
| 510 | // params: Requested parameter |
| 511 | COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle, |
| 512 | ShShaderInfo pname, |
| 513 | void** params); |
| 514 | |
Zhenyao Mo | a15f3e8 | 2013-09-23 14:57:08 -0400 | [diff] [blame] | 515 | typedef struct |
| 516 | { |
| 517 | ShDataType type; |
| 518 | int size; |
| 519 | } ShVariableInfo; |
| 520 | |
| 521 | // Returns 1 if the passed in variables pack in maxVectors following |
| 522 | // the packing rules from the GLSL 1.017 spec, Appendix A, section 7. |
| 523 | // Returns 0 otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS |
| 524 | // flag above. |
| 525 | // Parameters: |
| 526 | // maxVectors: the available rows of registers. |
| 527 | // varInfoArray: an array of variable info (types and sizes). |
| 528 | // varInfoArraySize: the size of the variable array. |
| 529 | COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits( |
| 530 | int maxVectors, |
| 531 | ShVariableInfo* varInfoArray, |
| 532 | size_t varInfoArraySize); |
| 533 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 534 | #ifdef __cplusplus |
alokp@chromium.org | 774d706 | 2010-07-21 18:55:45 +0000 | [diff] [blame] | 535 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 536 | #endif |
| 537 | |
| 538 | #endif // _COMPILER_INTERFACE_INCLUDED_ |