0031253: Visualization, TKOpenGl - phong shading GLSL compilation fail on Adreno 308
[occt.git] / src / Shaders / Shaders_Declarations_glsl.pxx
CommitLineData
ee5befae 1// This file has been automatically generated from resource file src/Shaders/Declarations.glsl
2
3static const char Shaders_Declarations_glsl[] =
ee5befae 4 "\n"
d95f5ce1 5 "//! @file Declarations.glsl includes definition of common uniform variables in OCCT GLSL programs\n"
daf73ab7 6 "//! @def THE_MAX_LIGHTS\n"
7 "//! Specifies the length of array of lights, which is 8 by default. Defined by Shader Manager.\n"
8 "// #define THE_MAX_LIGHTS 8\n"
9 "\n"
10 "//! @def THE_MAX_CLIP_PLANES\n"
11 "//! Specifies the length of array of clipping planes, which is 8 by default. Defined by Shader Manager.\n"
12 "// #define THE_MAX_CLIP_PLANES 8\n"
ee5befae 13 "\n"
b17e5bae 14 "//! @def THE_NB_FRAG_OUTPUTS\n"
15 "//! Specifies the length of array of Fragment Shader outputs, which is 1 by default. Defined by Shader Manager.\n"
16 "// #define THE_NB_FRAG_OUTPUTS 1\n"
17 "\n"
ee5befae 18 "// compatibility macros\n"
19 "#if (__VERSION__ >= 130)\n"
20 " #define THE_ATTRIBUTE in\n"
21 " #define THE_SHADER_IN in\n"
22 " #define THE_SHADER_OUT out\n"
23 " #define THE_OUT out\n"
ff6665dc 24 " #define occTexture1D texture\n"
ee5befae 25 " #define occTexture2D texture\n"
ff6665dc 26 " #define occTexture3D texture\n"
67312b79 27 " #define occTextureCube texture\n"
28 " #define occTextureCubeLod textureLod\n"
ee5befae 29 "#else\n"
30 " #define THE_ATTRIBUTE attribute\n"
31 " #define THE_SHADER_IN varying\n"
32 " #define THE_SHADER_OUT varying\n"
33 " #define THE_OUT\n"
ff6665dc 34 " #define occTexture1D texture1D\n"
ee5befae 35 " #define occTexture2D texture2D\n"
ff6665dc 36 " #define occTexture3D texture3D\n"
67312b79 37 " #define occTextureCube textureCube\n"
38 " #define occTextureCubeLod textureCubeLod\n"
ee5befae 39 "#endif\n"
40 "\n"
41 "#ifdef GL_ES\n"
67312b79 42 "#if (__VERSION__ >= 300)\n"
43 " #define THE_PREC_ENUM highp // lowp should be enough for enums but triggers driver bugs\n"
44 "#else\n"
45 " #define THE_PREC_ENUM lowp\n"
46 "#endif\n"
ee5befae 47 "#else\n"
48 " #define THE_PREC_ENUM\n"
49 "#endif\n"
50 "\n"
51 "// Vertex attributes\n"
52 "#ifdef VERTEX_SHADER\n"
53 " THE_ATTRIBUTE vec4 occVertex;\n"
54 " THE_ATTRIBUTE vec3 occNormal;\n"
55 " THE_ATTRIBUTE vec4 occTexCoord;\n"
56 " THE_ATTRIBUTE vec4 occVertColor;\n"
8e0a2b19 57 "#elif defined(FRAGMENT_SHADER)\n"
58 " #if (__VERSION__ >= 130)\n"
59 " #ifdef OCC_ENABLE_draw_buffers\n"
b17e5bae 60 " out vec4 occFragColorArray[THE_NB_FRAG_OUTPUTS];\n"
61 " #define occFragColorArrayAlias occFragColorArray\n"
62 " #define occFragColor0 occFragColorArray[0]\n"
8e0a2b19 63 " #else\n"
b17e5bae 64 " out vec4 occFragColor0;\n"
8e0a2b19 65 " #endif\n"
177781da 66 " #else\n"
8e0a2b19 67 " #ifdef OCC_ENABLE_draw_buffers\n"
b17e5bae 68 " #define occFragColorArrayAlias gl_FragData\n"
69 " #define occFragColor0 gl_FragData[0]\n"
8e0a2b19 70 " #else\n"
b17e5bae 71 " #define occFragColor0 gl_FragColor\n"
8e0a2b19 72 " #endif\n"
a1073ae2 73 " #endif\n"
b17e5bae 74 "\n"
75 " #if (THE_NB_FRAG_OUTPUTS >= 2)\n"
76 " #define occFragColor1 occFragColorArrayAlias[1]\n"
77 " #else\n"
78 " vec4 occFragColor1;\n"
79 " #endif\n"
80 " #if (THE_NB_FRAG_OUTPUTS >= 3)\n"
81 " #define occFragColor2 occFragColorArrayAlias[2]\n"
82 " #else\n"
83 " vec4 occFragColor2;\n"
84 " #endif\n"
85 " #if (THE_NB_FRAG_OUTPUTS >= 4)\n"
86 " #define occFragColor3 occFragColorArrayAlias[3]\n"
87 " #else\n"
88 " vec4 occFragColor3;\n"
89 " #endif\n"
90 "\n"
91 " // Built-in outputs notation\n"
92 " #define occFragColor occFragColor0\n"
93 " #define occFragCoverage occFragColor1\n"
94 "\n"
95 " //! Define the main Fragment Shader output - color value.\n"
96 " void occSetFragColor (in vec4 theColor);\n"
ee5befae 97 "#endif\n"
98 "\n"
67312b79 99 "// Pi number definitions\n"
100 "#define PI 3.141592654\n"
101 "#define PI_2 6.283185307\n"
102 "#define PI_DIV_2 1.570796327\n"
103 "#define PI_DIV_3 1.047197551\n"
104 "#define PI_DIV_4 0.785398163\n"
105 "#define INV_PI 0.318309886\n"
106 "#define INV_PI_2 0.159154943\n"
107 "\n"
ee5befae 108 "// Matrix state\n"
109 "uniform mat4 occWorldViewMatrix; //!< World-view matrix\n"
110 "uniform mat4 occProjectionMatrix; //!< Projection matrix\n"
111 "uniform mat4 occModelWorldMatrix; //!< Model-world matrix\n"
112 "\n"
113 "uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix\n"
114 "uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix\n"
115 "uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix\n"
116 "\n"
117 "uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix\n"
118 "uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix\n"
119 "uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix\n"
120 "\n"
121 "uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix\n"
122 "uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix\n"
123 "uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix\n"
124 "\n"
67312b79 125 "#if defined(THE_IS_PBR)\n"
126 "uniform sampler2D occEnvLUT; //!< Environment Lookup Table\n"
127 "uniform sampler2D occDiffIBLMapSHCoeffs; //!< Packed diffuse (irradiance) IBL map's spherical harmonics coefficients\n"
128 "uniform samplerCube occSpecIBLMap; //!< Specular IBL map\n"
129 "uniform int occNbSpecIBLLevels; //!< Number of mipmap levels used in occSpecIBLMap to store different roughness values maps\n"
130 "\n"
131 "vec3 occDiffIBLMap (in vec3 theNormal); //!< Unpacks spherical harmonics coefficients to diffuse IBL map's values\n"
132 "#endif\n"
133 "\n"
565baee6 134 "// light type enumeration (same as Graphic3d_TypeOfLightSource)\n"
ee5befae 135 "const int OccLightType_Direct = 1; //!< directional light source\n"
136 "const int OccLightType_Point = 2; //!< isotropic point light source\n"
137 "const int OccLightType_Spot = 3; //!< spot light source\n"
138 "\n"
139 "// Light sources\n"
140 "uniform vec4 occLightAmbient; //!< Cumulative ambient color\n"
daf73ab7 141 "#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)\n"
ee5befae 142 "uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources\n"
565baee6 143 "\n"
144 "//! Type of light source, int (see OccLightType enum).\n"
9504a30d 145 "#define occLight_Type(theId) occLightSourcesTypes[theId]\n"
565baee6 146 "\n"
9504a30d 147 "//! Specular intensity (equals to diffuse), vec3.\n"
148 "#define occLight_Specular(theId) occLightSources[theId * 4 + 0].rgb\n"
565baee6 149 "\n"
9504a30d 150 "//! Intensity of light source (>= 0), float.\n"
151 "#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a\n"
565baee6 152 "\n"
9504a30d 153 "//! Is light a headlight, bool?\n"
154 "#define occLight_IsHeadlight(theId) (occLightSources[theId * 4 + 1].w > 0.5)\n"
565baee6 155 "\n"
9504a30d 156 "//! Position of specified light source, vec3.\n"
157 "#define occLight_Position(theId) occLightSources[theId * 4 + 1].xyz\n"
158 "\n"
159 "//! Direction of specified spot light source, vec3.\n"
160 "#define occLight_SpotDirection(theId) occLightSources[theId * 4 + 2].xyz\n"
565baee6 161 "\n"
162 "//! Maximum spread angle of the spot light (in radians), float.\n"
163 "#define occLight_SpotCutOff(theId) occLightSources[theId * 4 + 3].z\n"
164 "\n"
165 "//! Attenuation of the spot light intensity (from 0 to 1), float.\n"
166 "#define occLight_SpotExponent(theId) occLightSources[theId * 4 + 3].w\n"
167 "\n"
9504a30d 168 "#if !defined(THE_IS_PBR)\n"
169 "//! Diffuse intensity (equals to Specular), vec3.\n"
170 "#define occLight_Diffuse(theId) occLightSources[theId * 4 + 0].rgb\n"
565baee6 171 "\n"
172 "//! Const attenuation factor of positional light source, float.\n"
173 "#define occLight_ConstAttenuation(theId) occLightSources[theId * 4 + 3].x\n"
174 "\n"
175 "//! Linear attenuation factor of positional light source, float.\n"
176 "#define occLight_LinearAttenuation(theId) occLightSources[theId * 4 + 3].y\n"
daf73ab7 177 "#endif\n"
67312b79 178 "#endif\n"
179 "\n"
72f6dc61 180 "#if defined(THE_IS_PBR)\n"
181 "//! Converts roughness value from range [0, 1] to real value for calculations\n"
67312b79 182 "float occRoughness (in float theNormalizedRoughness);\n"
ee5befae 183 "\n"
72f6dc61 184 "// Front/back material properties accessors\n"
185 "vec4 occPBRMaterial_Color(in bool theIsFront); //!< Base color of PBR material\n"
186 "float occPBRMaterial_Metallic(in bool theIsFront); //!< Metallic coefficient\n"
187 "float occPBRMaterial_NormalizedRoughness(in bool theIsFront); //!< Normalized roughness coefficient\n"
188 "vec3 occPBRMaterial_Emission(in bool theIsFront); //!< Light intensity emitted by material\n"
189 "float occPBRMaterial_IOR(in bool theIsFront); //!< Index of refraction\n"
67312b79 190 "#else\n"
72f6dc61 191 "// Front material properties accessors\n"
192 "vec4 occFrontMaterial_Emission(void); //!< Emission color\n"
193 "vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection\n"
194 "vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection\n"
195 "vec4 occFrontMaterial_Specular(void); //!< Specular reflection\n"
196 "float occFrontMaterial_Shininess(void); //!< Specular exponent\n"
197 "float occFrontMaterial_Transparency(void); //!< Transparency coefficient\n"
ee5befae 198 "\n"
199 "// Back material properties accessors\n"
67312b79 200 "vec4 occBackMaterial_Emission(void); //!< Emission color\n"
201 "vec4 occBackMaterial_Ambient(void); //!< Ambient reflection\n"
202 "vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection\n"
203 "vec4 occBackMaterial_Specular(void); //!< Specular reflection\n"
204 "float occBackMaterial_Shininess(void); //!< Specular exponent\n"
205 "float occBackMaterial_Transparency(void); //!< Transparency coefficient\n"
67312b79 206 "#endif\n"
ee5befae 207 "\n"
737e9a8d 208 "#ifdef THE_HAS_DEFAULT_SAMPLER\n"
72f6dc61 209 "#define occActiveSampler occSampler0 //!< alias for backward compatibility\n"
210 "#define occSamplerBaseColor occSampler0 //!< alias to a base color texture\n"
211 "uniform sampler2D occSampler0; //!< current active sampler;\n"
212 "#endif //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing\n"
213 "\n"
214 "#if defined(THE_HAS_TEXTURE_COLOR)\n"
215 "#define occTextureColor(theMatColor, theTexCoord) (theMatColor * occTexture2D(occSamplerBaseColor, theTexCoord))\n"
216 "#else\n"
217 "#define occTextureColor(theMatColor, theTexCoord) theMatColor\n"
218 "#endif\n"
219 "\n"
220 "#if defined(THE_HAS_TEXTURE_OCCLUSION) && defined(FRAGMENT_SHADER)\n"
221 "uniform sampler2D occSamplerOcclusion; //!< R occlusion texture sampler\n"
222 "#define occTextureOcclusion(theColor, theTexCoord) theColor *= occTexture2D(occSamplerOcclusion, theTexCoord).r;\n"
223 "#else\n"
224 "#define occTextureOcclusion(theColor, theTexCoord)\n"
737e9a8d 225 "#endif\n"
72f6dc61 226 "\n"
227 "#if defined(THE_HAS_TEXTURE_EMISSIVE) && defined(FRAGMENT_SHADER)\n"
228 "uniform sampler2D occSamplerEmissive; //!< RGB emissive texture sampler\n"
229 "#define occTextureEmissive(theMatEmis, theTexCoord) (theMatEmis * occTexture2D(occSamplerEmissive, theTexCoord).rgb)\n"
230 "#else\n"
231 "#define occTextureEmissive(theMatEmis, theTexCoord) theMatEmis\n"
232 "#endif\n"
233 "\n"
234 "#if defined(THE_HAS_TEXTURE_NORMAL) && defined(FRAGMENT_SHADER)\n"
235 "uniform sampler2D occSamplerNormal; //!< XYZ normal texture sampler with W==0 indicating no texture\n"
236 "#define occTextureNormal(theTexCoord) occTexture2D(occSamplerNormal, theTexCoord)\n"
237 "#else\n"
238 "#define occTextureNormal(theTexCoord) vec4(0.0) // no normal map\n"
239 "#endif\n"
240 "\n"
241 "#if defined(THE_HAS_TEXTURE_METALROUGHNESS) && defined(FRAGMENT_SHADER)\n"
242 "uniform sampler2D occSamplerMetallicRoughness; //!< BG metallic-roughness texture sampler\n"
243 "#define occTextureRoughness(theRoug, theTexCoord) (theRoug * occTexture2D(occSamplerMetallicRoughness, theTexCoord).g)\n"
244 "#define occTextureMetallic(theMet, theTexCoord) (theMet * occTexture2D(occSamplerMetallicRoughness, theTexCoord).b)\n"
245 "#else\n"
246 "#define occTextureRoughness(theRoug, theTexCoord) theRoug\n"
247 "#define occTextureMetallic(theMet, theTexCoord) theMet\n"
248 "#endif\n"
249 "\n"
ee5befae 250 "uniform vec4 occColor; //!< color value (in case of disabled lighting)\n"
251 "uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?\n"
252 "uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?\n"
ee5befae 253 "uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n"
254 "uniform float occPointSize; //!< point size\n"
255 "\n"
a1073ae2 256 "//! Parameters of blended order-independent transparency rendering algorithm\n"
257 "uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)\n"
258 "uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment\n"
c40eb6b9 259 "uniform float occAlphaCutoff; //!< alpha test cutoff value\n"
a1073ae2 260 "\n"
ee5befae 261 "//! Parameters of clipping planes\n"
daf73ab7 262 "#if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)\n"
ee5befae 263 "uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];\n"
25c35042 264 "uniform THE_PREC_ENUM int occClipPlaneChains[THE_MAX_CLIP_PLANES]; //! Indicating the number of planes in the Chain\n"
daf73ab7 265 "uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n"
d95f5ce1 266 "#endif\n"
267 "//! @endfile Declarations.glsl\n";