Skip to content

Commit

Permalink
Updated builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Feb 23, 2025
1 parent bcae459 commit 16a1dd0
Show file tree
Hide file tree
Showing 9 changed files with 14,100 additions and 636 deletions.
7,230 changes: 6,957 additions & 273 deletions build/three.cjs

Large diffs are not rendered by default.

7,222 changes: 6,951 additions & 271 deletions build/three.core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/three.core.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -12890,7 +12890,10 @@ class WebXRManager extends EventDispatcher {
format: RGBAFormat,
type: UnsignedByteType,
colorSpace: renderer.outputColorSpace,
stencilBuffer: attributes.stencil
stencilBuffer: attributes.stencil,
resolveDepthBuffer: ( glBaseLayer.ignoreDepthValues === false ),
resolveStencilBuffer: ( glBaseLayer.ignoreDepthValues === false )

}
);

Expand Down Expand Up @@ -12933,7 +12936,8 @@ class WebXRManager extends EventDispatcher {
stencilBuffer: attributes.stencil,
colorSpace: renderer.outputColorSpace,
samples: attributes.antialias ? 4 : 0,
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false ),
resolveStencilBuffer: ( glProjLayer.ignoreDepthValues === false )
} );

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

Large diffs are not rendered by default.

134 changes: 91 additions & 43 deletions build/three.webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -20634,7 +20634,6 @@ const _outputDirection = /*@__PURE__*/ vec3( _direction.x, _direction.y, _direct
* Paper: Fast, Accurate Image-Based Lighting:
* {@link https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view}
*/

class PMREMGenerator {

constructor( renderer ) {
Expand Down Expand Up @@ -47929,7 +47928,9 @@ class XRManager extends EventDispatcher {
type: UnsignedByteType,
colorSpace: renderer.outputColorSpace,
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
stencilBuffer: renderer.stencil
stencilBuffer: renderer.stencil,
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false ),
resolveStencilBuffer: ( glProjLayer.ignoreDepthValues === false ),
} );

this._xrRenderTarget.hasExternalTextures = true;
Expand Down Expand Up @@ -47961,7 +47962,9 @@ class XRManager extends EventDispatcher {
format: RGBAFormat,
type: UnsignedByteType,
colorSpace: renderer.outputColorSpace,
stencilBuffer: renderer.stencil
stencilBuffer: renderer.stencil,
resolveDepthBuffer: ( glBaseLayer.ignoreDepthValues === false ),
resolveStencilBuffer: ( glBaseLayer.ignoreDepthValues === false ),
}
);

Expand Down Expand Up @@ -54814,6 +54817,9 @@ class WebGLState {
this.currentLineWidth = null;
this.currentClippingPlanes = 0;

this.currentVAO = null;
this.currentIndex = null;

this.currentBoundFramebuffers = {};
this.currentDrawbuffers = new WeakMap();

Expand Down Expand Up @@ -55582,6 +55588,53 @@ class WebGLState {

}

/**
* Sets the vertex state by binding the given VAO and element buffer.
*
* @param {WebGLVertexArrayObject} vao - The VAO.
* @param {WebGLBuffer} indexBuffer - The index buffer.
* @return {boolean} Whether a vertex state has been changed or not.
*/
setVertexState( vao, indexBuffer = null ) {

const gl = this.gl;

if ( this.currentVAO !== vao || this.currentIndex !== indexBuffer ) {

gl.bindVertexArray( vao );

if ( indexBuffer !== null ) {

gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, indexBuffer );

}

this.currentVAO = vao;
this.currentIndex = indexBuffer;

return true;

}

return false;

}

/**
* Resets the vertex array state by resetting the VAO and element buffer.
*/
resetVertexState() {

const gl = this.gl;

gl.bindVertexArray( null );
gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, null );

this.currentVAO = null;
this.currentIndex = null;

}

// framebuffer


Expand Down Expand Up @@ -58472,6 +58525,8 @@ class WebGLBackend extends Backend {
const renderContextData = this.get( renderContext );
const previousContext = renderContextData.previousContext;

state.resetVertexState();

const occlusionQueryCount = renderContext.occlusionQueryCount;

if ( occlusionQueryCount > 0 ) {
Expand Down Expand Up @@ -58765,7 +58820,15 @@ class WebGLBackend extends Backend {

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

gl.clearBufferfv( gl.COLOR, i, [ clearColor.r, clearColor.g, clearColor.b, clearColor.a ] );
if ( i === 0 ) {

gl.clearBufferfv( gl.COLOR, i, [ clearColor.r, clearColor.g, clearColor.b, clearColor.a ] );

} else {

gl.clearBufferfv( gl.COLOR, i, [ 0, 0, 0, 1 ] );

}

}

Expand Down Expand Up @@ -58828,17 +58891,17 @@ class WebGLBackend extends Backend {

const { programGPU, transformBuffers, attributes } = this.get( pipeline );

const vaoKey = this._getVaoKey( null, attributes );
const vaoKey = this._getVaoKey( attributes );

const vaoGPU = this.vaoCache[ vaoKey ];

if ( vaoGPU === undefined ) {

this._createVao( null, attributes );
this._createVao( attributes );

} else {

gl.bindVertexArray( vaoGPU );
state.setVertexState( vaoGPU );

}

Expand Down Expand Up @@ -58936,23 +58999,23 @@ class WebGLBackend extends Backend {

state.useProgram( programGPU );

//
// vertex state

const renderObjectData = this.get( renderObject );

let vaoGPU = renderObjectData.staticVao;

if ( vaoGPU === undefined || renderObjectData.geometryId !== renderObject.geometry.id ) {

const vaoKey = this._getVaoKey( renderObject.getIndex(), renderObject.getAttributes() );
const vaoKey = this._getVaoKey( renderObject.getAttributes() );

vaoGPU = this.vaoCache[ vaoKey ];

if ( vaoGPU === undefined ) {

let staticVao;

( { vaoGPU, staticVao } = this._createVao( renderObject.getIndex(), renderObject.getAttributes() ) );
( { vaoGPU, staticVao } = this._createVao( renderObject.getAttributes() ) );

if ( staticVao ) {

Expand All @@ -58965,11 +59028,10 @@ class WebGLBackend extends Backend {

}

gl.bindVertexArray( vaoGPU );

//

const index = renderObject.getIndex();
const indexGPU = ( index !== null ) ? this.get( index ).bufferGPU : null;

state.setVertexState( vaoGPU, indexGPU );

//

Expand Down Expand Up @@ -59141,10 +59203,6 @@ class WebGLBackend extends Backend {

}

//

gl.bindVertexArray( null );

}

/**
Expand Down Expand Up @@ -60123,22 +60181,13 @@ class WebGLBackend extends Backend {
* Computes the VAO key for the given index and attributes.
*
* @private
* @param {?BufferAttribute} index - The index. `null` for non-indexed geometries.
* @param {Array<BufferAttribute>} attributes - An array of buffer attributes.
* @return {string} The VAO key.
*/
_getVaoKey( index, attributes ) {
_getVaoKey( attributes ) {

let key = '';

if ( index !== null ) {

const indexData = this.get( index );

key += ':' + indexData.id;

}

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

const attributeData = this.get( attributes[ i ] );
Expand All @@ -60155,11 +60204,10 @@ class WebGLBackend extends Backend {
* Creates a VAO from the index and attributes.
*
* @private
* @param {?BufferAttribute} index - The index. `null` for non-indexed geometries.
* @param {Array<BufferAttribute>} attributes - An array of buffer attributes.
* @return {Object} The VAO data.
*/
_createVao( index, attributes ) {
_createVao( attributes ) {

const { gl } = this;

Expand All @@ -60170,16 +60218,6 @@ class WebGLBackend extends Backend {

gl.bindVertexArray( vaoGPU );

if ( index !== null ) {

const indexData = this.get( index );

gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, indexData.bufferGPU );

key += ':' + indexData.id;

}

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

const attribute = attributes[ i ];
Expand Down Expand Up @@ -67603,13 +67641,23 @@ class WebGPUBackend extends Backend {

}

// only apply the user-defined clearValue to the first color attachment like in beginRender()

let clearValue = { r: 0, g: 0, b: 0, a: 1 };

if ( i === 0 && colorAttachmentsConfig.clearValue ) {

clearValue = colorAttachmentsConfig.clearValue;

}

colorAttachments.push( {
view,
depthSlice: sliceIndex,
resolveTarget,
loadOp: GPULoadOp.Load,
storeOp: GPUStoreOp.Store,
...colorAttachmentsConfig
loadOp: colorAttachmentsConfig.loadOP || GPULoadOp.Load,
storeOp: colorAttachmentsConfig.storeOP || GPUStoreOp.Store,
clearValue: clearValue
} );

}
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 16a1dd0

Please sign in to comment.