Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/objects/BatchedMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ class BatchedMesh extends Mesh {
this._multiDrawCounts = new Int32Array( maxInstanceCount );
this._multiDrawStarts = new Int32Array( maxInstanceCount );
this._multiDrawCount = 0;
this._multiDrawInstances = null;

// Local matrix per geometry by using data texture
this._matricesTexture = null;
Expand Down
36 changes: 13 additions & 23 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { WebGLUtils } from './webgl/WebGLUtils.js';
import { WebXRManager } from './webxr/WebXRManager.js';
import { WebGLMaterials } from './webgl/WebGLMaterials.js';
import { WebGLUniformsGroups } from './webgl/WebGLUniformsGroups.js';
import { createCanvasElement, probeAsync, warnOnce, error, warn, log } from '../utils.js';
import { createCanvasElement, probeAsync, error, warn, log } from '../utils.js';
import { ColorManagement } from '../math/ColorManagement.js';
import { getDFGLUT } from './shaders/DFGLUTData.js';

Expand Down Expand Up @@ -1292,33 +1292,23 @@ class WebGLRenderer {

if ( object.isBatchedMesh ) {

if ( object._multiDrawInstances !== null ) {
if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {

// @deprecated, r174
warnOnce( 'WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
const starts = object._multiDrawStarts;
const counts = object._multiDrawCounts;
const drawCount = object._multiDrawCount;
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
const uniforms = properties.get( material ).currentProgram.getUniforms();
for ( let i = 0; i < drawCount; i ++ ) {

} else {

if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {

const starts = object._multiDrawStarts;
const counts = object._multiDrawCounts;
const drawCount = object._multiDrawCount;
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
const uniforms = properties.get( material ).currentProgram.getUniforms();
for ( let i = 0; i < drawCount; i ++ ) {

uniforms.setValue( _gl, '_gl_DrawID', i );
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );

}
uniforms.setValue( _gl, '_gl_DrawID', i );
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );

} else {
}

renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
} else {

}
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );

}

Expand Down
8 changes: 1 addition & 7 deletions src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,7 @@ class WebGLBackend extends Backend {

if ( object.isBatchedMesh ) {

if ( object._multiDrawInstances !== null ) {

// @deprecated, r174
warnOnce( 'WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );

} else if ( ! this.hasFeature( 'WEBGL_multi_draw' ) ) {
if ( this.hasFeature( 'WEBGL_multi_draw' ) === false ) {

warnOnce( 'WebGLBackend: WEBGL_multi_draw not supported.' );

Expand Down
41 changes: 0 additions & 41 deletions src/renderers/webgl-fallback/WebGLBufferRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,47 +91,6 @@ class WebGLBufferRenderer {

}

renderMultiDrawInstances( starts, counts, drawCount, primcount ) {

const { extensions, mode, object, info } = this;

if ( drawCount === 0 ) return;

const extension = extensions.get( 'WEBGL_multi_draw' );

if ( extension === null ) {

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

this.renderInstances( starts[ i ], counts[ i ], primcount[ i ] );

}

} else {

if ( this.index !== 0 ) {

extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, this.type, starts, 0, primcount, 0, drawCount );

} else {

extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );

}

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

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

}

info.update( object, elementCount, 1 );

}

}

//

}
Expand Down
32 changes: 0 additions & 32 deletions src/renderers/webgl/WebGLBufferRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,44 +44,12 @@ function WebGLBufferRenderer( gl, extensions, info ) {

}

function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {

if ( drawCount === 0 ) return;

const extension = extensions.get( 'WEBGL_multi_draw' );

if ( extension === null ) {

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

renderInstances( starts[ i ], counts[ i ], primcount[ i ] );

}

} else {

extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );

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

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

}

info.update( elementCount, mode, 1 );

}

}

//

this.setMode = setMode;
this.render = render;
this.renderInstances = renderInstances;
this.renderMultiDraw = renderMultiDraw;
this.renderMultiDrawInstances = renderMultiDrawInstances;

}

Expand Down
32 changes: 0 additions & 32 deletions src/renderers/webgl/WebGLIndexedBufferRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,45 +54,13 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {

}

function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {

if ( drawCount === 0 ) return;

const extension = extensions.get( 'WEBGL_multi_draw' );

if ( extension === null ) {

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

renderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );

}

} else {

extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );

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

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

}

info.update( elementCount, mode, 1 );

}

}

//

this.setMode = setMode;
this.setIndex = setIndex;
this.render = render;
this.renderInstances = renderInstances;
this.renderMultiDraw = renderMultiDraw;
this.renderMultiDrawInstances = renderMultiDrawInstances;

}

Expand Down
12 changes: 2 additions & 10 deletions src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import WebGPUTextureUtils from './utils/WebGPUTextureUtils.js';

import { WebGPUCoordinateSystem, TimestampQuery, REVISION, HalfFloatType, Compatibility } from '../../constants.js';
import WebGPUTimestampQueryPool from './utils/WebGPUTimestampQueryPool.js';
import { warnOnce, error } from '../../utils.js';
import { error } from '../../utils.js';

const _clearValue = { r: 0, g: 0, b: 0, a: 1 };

Expand Down Expand Up @@ -1597,14 +1597,6 @@ class WebGPUBackend extends Backend {
const starts = object._multiDrawStarts;
const counts = object._multiDrawCounts;
const drawCount = object._multiDrawCount;
const drawInstances = object._multiDrawInstances;

if ( drawInstances !== null ) {

// @deprecated, r174
warnOnce( 'WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );

}

let bytesPerElement = ( hasIndex === true ) ? index.array.BYTES_PER_ELEMENT : 1;

Expand All @@ -1616,7 +1608,7 @@ class WebGPUBackend extends Backend {

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

const count = drawInstances ? drawInstances[ i ] : 1;
const count = 1;
const firstInstance = count > 1 ? 0 : i;

if ( hasIndex === true ) {
Expand Down
Loading