diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js index 68a643b164a41d..d862977cce6842 100644 --- a/src/renderers/webgl/WebGLProgram.js +++ b/src/renderers/webgl/WebGLProgram.js @@ -27,28 +27,27 @@ function handleSource( string, errorLine ) { function getEncodingComponents( colorSpace ) { - let gamutMapping = ''; + const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace ); + const encodingPrimaries = ColorManagement.getPrimaries( colorSpace ); - if ( colorSpace !== NoColorSpace ) { + let gamutMapping; - const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace ); - const encodingPrimaries = colorSpace === NoColorSpace ? '' : ColorManagement.getPrimaries( colorSpace ); + if ( workingPrimaries === encodingPrimaries ) { - if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) { + gamutMapping = ''; - gamutMapping = 'P3ToRec709'; + } else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) { - } else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) { + gamutMapping = 'P3ToRec709'; - gamutMapping = 'Rec709ToP3'; + } else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) { - } + gamutMapping = 'Rec709ToP3'; } switch ( colorSpace ) { - case NoColorSpace: case LinearSRGBColorSpace: case LinearDisplayP3ColorSpace: return [ gamutMapping, 'LinearTransferOETF' ];