Skip to content

Commit

Permalink
TextureUtils: Add forceContextLoss() to decompress(). (#27136)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Nov 7, 2023
1 parent d5bd248 commit b8e78a3
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions examples/jsm/utils/TextureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ export function decompress( texture, maxTextureSize = Infinity, renderer = null
if ( ! fullscreenQuadMaterial ) fullscreenQuadMaterial = new ShaderMaterial( {
uniforms: { blitTexture: new Uniform( texture ) },
vertexShader: `
varying vec2 vUv;
void main(){
vUv = uv;
gl_Position = vec4(position.xy * 1.0,0.,.999999);
}`,
varying vec2 vUv;
void main(){
vUv = uv;
gl_Position = vec4(position.xy * 1.0,0.,.999999);
}`,
fragmentShader: `
uniform sampler2D blitTexture;
varying vec2 vUv;
void main(){
gl_FragColor = vec4(vUv.xy, 0, 1);
#ifdef IS_SRGB
gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );
#else
gl_FragColor = texture2D( blitTexture, vUv);
#endif
}`
uniform sampler2D blitTexture;
varying vec2 vUv;
void main(){
gl_FragColor = vec4(vUv.xy, 0, 1);
#ifdef IS_SRGB
gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );
#else
gl_FragColor = texture2D( blitTexture, vUv);
#endif
}`
} );

fullscreenQuadMaterial.uniforms.blitTexture.value = texture;
Expand Down Expand Up @@ -76,6 +76,7 @@ export function decompress( texture, maxTextureSize = Infinity, renderer = null

if ( _renderer ) {

_renderer.forceContextLoss();
_renderer.dispose();
_renderer = null;

Expand Down

0 comments on commit b8e78a3

Please sign in to comment.