Skip to content

Commit

Permalink
Updated builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Oct 3, 2024
1 parent 612cca4 commit 1e352b6
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 117 deletions.
19 changes: 6 additions & 13 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,8 @@ ColorManagement.define( {
toXYZ: LINEAR_REC709_TO_XYZ,
fromXYZ: XYZ_TO_LINEAR_REC709,
luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,
workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace }
workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace },
outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }
},

[ SRGBColorSpace ]: {
Expand Down Expand Up @@ -15860,15 +15861,11 @@ function WebGLBufferRenderer( gl, extensions, info ) {
let elementCount = 0;
for ( let i = 0; i < drawCount; i ++ ) {

elementCount += counts[ i ];
elementCount += counts[ i ] * primcount[ i ];

}

for ( let i = 0; i < primcount.length; i ++ ) {

info.update( elementCount, mode, primcount[ i ] );

}
info.update( elementCount, mode, 1 );

}

Expand Down Expand Up @@ -17810,15 +17807,11 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
let elementCount = 0;
for ( let i = 0; i < drawCount; i ++ ) {

elementCount += counts[ i ];
elementCount += counts[ i ] * primcount[ i ];

}

for ( let i = 0; i < primcount.length; i ++ ) {

info.update( elementCount, mode, primcount[ i ] );

}
info.update( elementCount, mode, 1 );

}

Expand Down
19 changes: 6 additions & 13 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,8 @@ ColorManagement.define( {
toXYZ: LINEAR_REC709_TO_XYZ,
fromXYZ: XYZ_TO_LINEAR_REC709,
luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,
workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace }
workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace },
outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }
},

[ SRGBColorSpace ]: {
Expand Down Expand Up @@ -15858,15 +15859,11 @@ function WebGLBufferRenderer( gl, extensions, info ) {
let elementCount = 0;
for ( let i = 0; i < drawCount; i ++ ) {

elementCount += counts[ i ];
elementCount += counts[ i ] * primcount[ i ];

}

for ( let i = 0; i < primcount.length; i ++ ) {

info.update( elementCount, mode, primcount[ i ] );

}
info.update( elementCount, mode, 1 );

}

Expand Down Expand Up @@ -17808,15 +17805,11 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
let elementCount = 0;
for ( let i = 0; i < drawCount; i ++ ) {

elementCount += counts[ i ];
elementCount += counts[ i ] * primcount[ i ];

}

for ( let i = 0; i < primcount.length; i ++ ) {

info.update( elementCount, mode, primcount[ i ] );

}
info.update( elementCount, mode, 1 );

}

Expand Down
2 changes: 1 addition & 1 deletion build/three.module.min.js

Large diffs are not rendered by default.

160 changes: 116 additions & 44 deletions build/three.webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,8 @@ ColorManagement.define( {
toXYZ: LINEAR_REC709_TO_XYZ,
fromXYZ: XYZ_TO_LINEAR_REC709,
luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,
workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace }
workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace },
outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }
},

[ SRGBColorSpace ]: {
Expand Down Expand Up @@ -59100,10 +59101,9 @@ const hue = /*@__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => {

} );

const _luminanceCoefficients = /*@__PURE__*/ new Vector3();
const luminance = (
color,
luminanceCoefficients = vec3( ... ColorManagement.getLuminanceCoefficients( _luminanceCoefficients ) )
luminanceCoefficients = vec3( ColorManagement.getLuminanceCoefficients( new Vector3() ) )
) => dot( color, luminanceCoefficients );

const threshold = ( color, threshold ) => mix( vec3( 0.0 ), color, luminance( color ).sub( threshold ).max( 0 ) );
Expand Down Expand Up @@ -62175,9 +62175,11 @@ class Textures extends DataMap {
const mipHeight = size.height >> activeMipmapLevel;

let depthTexture = renderTarget.depthTexture || depthTextureMips[ activeMipmapLevel ];
const useDepthTexture = renderTarget.depthBuffer === true || renderTarget.stencilBuffer === true;

let textureNeedsUpdate = false;

if ( depthTexture === undefined ) {
if ( depthTexture === undefined && useDepthTexture ) {

depthTexture = new DepthTexture();
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat;
Expand All @@ -62192,25 +62194,34 @@ class Textures extends DataMap {
if ( renderTargetData.width !== size.width || size.height !== renderTargetData.height ) {

textureNeedsUpdate = true;
depthTexture.needsUpdate = true;

depthTexture.image.width = mipWidth;
depthTexture.image.height = mipHeight;
if ( depthTexture ) {

depthTexture.needsUpdate = true;
depthTexture.image.width = mipWidth;
depthTexture.image.height = mipHeight;

}

}

renderTargetData.width = size.width;
renderTargetData.height = size.height;
renderTargetData.textures = textures;
renderTargetData.depthTexture = depthTexture;
renderTargetData.depthTexture = depthTexture || null;
renderTargetData.depth = renderTarget.depthBuffer;
renderTargetData.stencil = renderTarget.stencilBuffer;
renderTargetData.renderTarget = renderTarget;

if ( renderTargetData.sampleCount !== sampleCount ) {

textureNeedsUpdate = true;
depthTexture.needsUpdate = true;

if ( depthTexture ) {

depthTexture.needsUpdate = true;

}

renderTargetData.sampleCount = sampleCount;

Expand All @@ -62230,7 +62241,11 @@ class Textures extends DataMap {

}

this.updateTexture( depthTexture, options );
if ( depthTexture ) {

this.updateTexture( depthTexture, options );

}

// dispose handler

Expand All @@ -62250,7 +62265,11 @@ class Textures extends DataMap {

}

this._destroyTexture( depthTexture );
if ( depthTexture ) {

this._destroyTexture( depthTexture );

}

this.delete( renderTarget );

Expand Down Expand Up @@ -62621,15 +62640,25 @@ class Background extends DataMap {

if ( renderer.autoClear === true || forceClear === true ) {

_clearColor.multiplyScalar( _clearColor.a );

const clearColorValue = renderContext.clearColorValue;

clearColorValue.r = _clearColor.r;
clearColorValue.g = _clearColor.g;
clearColorValue.b = _clearColor.b;
clearColorValue.a = _clearColor.a;

// premultiply alpha

if ( renderer.backend.isWebGLBackend === true || renderer.alpha === true ) {

clearColorValue.r *= clearColorValue.a;
clearColorValue.g *= clearColorValue.a;
clearColorValue.b *= clearColorValue.a;

}

//

renderContext.depthClearValue = renderer._clearDepth;
renderContext.stencilClearValue = renderer._clearStencil;

Expand Down Expand Up @@ -69183,18 +69212,13 @@ class WebGLBufferRenderer {
}

let elementCount = 0;

for ( let i = 0; i < drawCount; i ++ ) {

elementCount += counts[ i ];
elementCount += counts[ i ] * primcount[ i ];

}

for ( let i = 0; i < primcount.length; i ++ ) {

info.update( object, elementCount, mode, primcount[ i ] );

}
info.update( object, elementCount, mode, 1 );

}

Expand Down Expand Up @@ -69623,9 +69647,17 @@ class WebGLBackend extends Backend {

if ( descriptor === null ) {

const clearColor = this.getClearColor();

// premultiply alpha

clearColor.r *= clearColor.a;
clearColor.g *= clearColor.a;
clearColor.b *= clearColor.a;

descriptor = {
textures: null,
clearColorValue: this.getClearColor()
clearColorValue: clearColor
};

}
Expand All @@ -69640,13 +69672,23 @@ class WebGLBackend extends Backend {

if ( clear !== 0 ) {

const clearColor = descriptor.clearColorValue || this.getClearColor();
let clearColor;

// premultiply alpha
if ( descriptor.clearColorValue ) {

clearColor.r *= clearColor.a;
clearColor.g *= clearColor.a;
clearColor.b *= clearColor.a;
clearColor = descriptor.clearColorValue;

} else {

clearColor = this.getClearColor();

// premultiply alpha

clearColor.r *= clearColor.a;
clearColor.g *= clearColor.a;
clearColor.b *= clearColor.a;

}

if ( depth ) this.state.setDepthMask( true );

Expand Down Expand Up @@ -74792,15 +74834,6 @@ class WebGPUPipelineUtils {
vertex: Object.assign( {}, vertexModule, { buffers: vertexBuffers } ),
fragment: Object.assign( {}, fragmentModule, { targets } ),
primitive: primitiveState,
depthStencil: {
format: depthStencilFormat,
depthWriteEnabled: material.depthWrite,
depthCompare: depthCompare,
stencilFront: stencilFront,
stencilBack: {}, // three.js does not provide an API to configure the back function (gl.stencilFuncSeparate() was never used)
stencilReadMask: material.stencilFuncMask,
stencilWriteMask: material.stencilWriteMask
},
multisample: {
count: sampleCount,
alphaToCoverageEnabled: material.alphaToCoverage && sampleCount > 1
Expand All @@ -74810,6 +74843,35 @@ class WebGPUPipelineUtils {
} )
};


const depthStencil = {};
const renderDepth = renderObject.context.depth;
const renderStencil = renderObject.context.stencil;

if ( renderDepth === true || renderStencil === true ) {

if ( renderDepth === true ) {

depthStencil.format = depthStencilFormat;
depthStencil.depthWriteEnabled = material.depthWrite;
depthStencil.depthCompare = depthCompare;

}

if ( renderStencil === true ) {

depthStencil.stencilFront = stencilFront;
depthStencil.stencilBack = {}; // three.js does not provide an API to configure the back function (gl.stencilFuncSeparate() was never used)
depthStencil.stencilReadMask = material.stencilFuncMask;
depthStencil.stencilWriteMask = material.stencilWriteMask;

}

pipelineDescriptor.depthStencil = depthStencil;

}


if ( promises === null ) {

pipelineData.pipeline = device.createRenderPipeline( pipelineDescriptor );
Expand Down Expand Up @@ -75435,11 +75497,16 @@ class WebGPUBackend extends Backend {
colorAttachments: [ {
view: null
} ],
depthStencilAttachment: {
view: this.textureUtils.getDepthBuffer( renderer.depth, renderer.stencil ).createView()
}
};

if ( this.renderer.depth === true || this.renderer.stencil === true ) {

descriptor.depthStencilAttachment = {
view: this.textureUtils.getDepthBuffer( renderer.depth, renderer.stencil ).createView()
};

}

const colorAttachment = descriptor.colorAttachments[ 0 ];

if ( this.renderer.samples > 0 ) {
Expand Down Expand Up @@ -75547,17 +75614,22 @@ class WebGPUBackend extends Backend {

}

const depthTextureData = this.get( renderContext.depthTexture );

const depthStencilAttachment = {
view: depthTextureData.texture.createView()
};

descriptor = {
colorAttachments,
depthStencilAttachment
};

if ( renderContext.depth ) {

const depthTextureData = this.get( renderContext.depthTexture );

const depthStencilAttachment = {
view: depthTextureData.texture.createView()
};
descriptor.depthStencilAttachment = depthStencilAttachment;

}

descriptors[ cacheKey ] = descriptor;

renderTargetData.width = renderTarget.width;
Expand Down
2 changes: 1 addition & 1 deletion build/three.webgpu.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 1e352b6

Please sign in to comment.