Skip to content

Commit bc1c2bb

Browse files
ycwMugen87
andauthored
Warns for VideoTexture with non-srgb color spaces (#31569)
* warn * fix * Update Textures.js Refine warning. --------- Co-authored-by: Michael Herzog <[email protected]>
1 parent 09eafbe commit bc1c2bb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/renderers/common/Textures.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import DataMap from './DataMap.js';
22

33
import { Vector3 } from '../../math/Vector3.js';
44
import { DepthTexture } from '../../textures/DepthTexture.js';
5-
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType } from '../../constants.js';
5+
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType, SRGBTransfer } from '../../constants.js';
6+
import { ColorManagement } from '../../math/ColorManagement.js';
67

78
const _size = /*@__PURE__*/ new Vector3();
89

@@ -326,6 +327,14 @@ class Textures extends DataMap {
326327

327328
this.info.memory.textures ++;
328329

330+
//
331+
332+
if ( texture.isVideoTexture && ColorManagement.getTransfer( texture.colorSpace ) !== SRGBTransfer ) {
333+
334+
console.warn( 'WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace.' );
335+
336+
}
337+
329338
// dispose
330339

331340
const onDispose = () => {

0 commit comments

Comments
 (0)