|
@@ -1,7 +1,7 @@
|
|
|
import { WebGLUniforms } from './WebGLUniforms.js';
|
|
|
import { WebGLShader } from './WebGLShader.js';
|
|
|
import { ShaderChunk } from '../shaders/ShaderChunk.js';
|
|
|
-import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding } from '../../constants.js';
|
|
|
+import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding, GLSL3 } from '../../constants.js';
|
|
|
|
|
|
let programIdCount = 0;
|
|
|
|
|
@@ -667,11 +667,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
vertexShader = unrollLoops( vertexShader );
|
|
|
fragmentShader = unrollLoops( fragmentShader );
|
|
|
|
|
|
- if ( ( parameters.glslVersion === null || parameters.glslVersion === undefined ) &&
|
|
|
- parameters.isWebGL2 && ! parameters.isRawShaderMaterial ) {
|
|
|
+ if ( parameters.isWebGL2 && ! parameters.isRawShaderMaterial ) {
|
|
|
|
|
|
- // Automated GLSL 3.0 conversion. The shader chunks of standard shaders (eg MeshStandardMaterial) require GLSL 3.0 features within WebGL2.
|
|
|
- // Apply these conversions if no glslVersion is specified.
|
|
|
+ // overwrite GLSL version for built-in materials
|
|
|
|
|
|
versionString = '#version 300 es\n';
|
|
|
|
|
@@ -683,8 +681,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
prefixFragment = [
|
|
|
'#define varying in',
|
|
|
- 'out highp vec4 pc_fragColor;',
|
|
|
- '#define gl_FragColor pc_fragColor',
|
|
|
+ ( parameters.glslVersion === GLSL3 ) ? '' : 'out highp vec4 pc_fragColor;',
|
|
|
+ ( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
|
'#define gl_FragDepthEXT gl_FragDepth',
|
|
|
'#define texture2D texture',
|
|
|
'#define textureCube texture',
|