@@ -39,15 +39,16 @@ float readDepth(const in vec2 uv) {
3939 * Returns the index of the most representative depth in the 2x2 neighborhood.
4040 */
4141
42- int findBestDepth(const in highp float samples[4 ]) {
42+ int findBestDepth(const in float samples[4 ]) {
4343
4444 // Calculate the centroid.
4545 float c = (samples[0 ] + samples[1 ] + samples[2 ] + samples[3 ]) * 0.25 ;
4646
47- highp float distances[] = float [4 ](
48- abs (c - samples[0 ]), abs (c - samples[1 ]),
49- abs (c - samples[2 ]), abs (c - samples[3 ])
50- );
47+ float distances[4 ];
48+ distances[0 ] = abs (c - samples[0 ]);
49+ distances[1 ] = abs (c - samples[1 ]);
50+ distances[2 ] = abs (c - samples[2 ]);
51+ distances[3 ] = abs (c - samples[3 ]);
5152
5253 float maxDistance = max (
5354 max (distances[0 ], distances[1 ]),
@@ -116,27 +117,30 @@ int findBestDepth(const in highp float samples[4]) {
116117void main() {
117118
118119 // Gather depth samples in a 2x2 neighborhood.
119- highp float d[] = float [4 ](
120- readDepth(vUv0), readDepth(vUv1),
121- readDepth(vUv2), readDepth(vUv3)
122- );
120+ float d[4 ];
121+ d[0 ] = readDepth(vUv0);
122+ d[1 ] = readDepth(vUv1);
123+ d[2 ] = readDepth(vUv2);
124+ d[3 ] = readDepth(vUv3);
123125
124126 int index = findBestDepth(d);
125127
126128 #ifdef DOWNSAMPLE_NORMALS
127129
128130 // Gather all corresponding normals to avoid dependent texel fetches.
129- highp vec3 n[] = vec3 [4 ](
130- texture2D (normalBuffer, vUv0).rgb, texture2D (normalBuffer, vUv1).rgb,
131- texture2D (normalBuffer, vUv2).rgb, texture2D (normalBuffer, vUv3).rgb
132- );
131+ vec3 n[4 ];
132+ n[0 ] = texture2D (normalBuffer, vUv0).rgb;
133+ n[1 ] = texture2D (normalBuffer, vUv1).rgb;
134+ n[2 ] = texture2D (normalBuffer, vUv2).rgb;
135+ n[3 ] = texture2D (normalBuffer, vUv3).rgb;
133136
134137 #else
135138
136- highp vec3 n[] = vec3 [4 ](
137- vec3 (0.0 ), vec3 (0.0 ),
138- vec3 (0.0 ), vec3 (0.0 )
139- );
139+ vec3 n[4 ];
140+ n[0 ] = vec3 (0.0 );
141+ n[1 ] = vec3 (0.0 );
142+ n[2 ] = vec3 (0.0 );
143+ n[3 ] = vec3 (0.0 );
140144
141145 #endif
142146
0 commit comments