Skip to content

Commit a4c7ec9

Browse files
committed
Undo some unnecessary logic for vertex pulling
1 parent 3e8e68d commit a4c7ec9

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

packages/dev/core/src/Engines/WebGPU/webgpuCacheRenderPipeline.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export abstract class WebGPUCacheRenderPipeline {
175175
public readonly mrtTextureArray: InternalTexture[];
176176
public readonly mrtTextureCount: number = 0;
177177

178-
public getRenderPipeline(fillMode: number, effect: Effect, sampleCount: number, textureState = 0, useVertexPulling: boolean = false): GPURenderPipeline {
178+
public getRenderPipeline(fillMode: number, effect: Effect, sampleCount: number, textureState = 0): GPURenderPipeline {
179179
sampleCount = WebGPUTextureHelper.GetSample(sampleCount);
180180

181181
if (this.disabled) {
@@ -196,7 +196,7 @@ export abstract class WebGPUCacheRenderPipeline {
196196
this._setRasterizationState(fillMode, sampleCount);
197197
this._setColorStates();
198198
this._setDepthStencilState();
199-
this._setVertexState(effect, useVertexPulling);
199+
this._setVertexState(effect);
200200
this._setTextureState(textureState);
201201

202202
this.lastStateDirtyLowestIndex = this._stateDirtyLowestIndex;
@@ -777,13 +777,13 @@ export abstract class WebGPUCacheRenderPipeline {
777777
}
778778
}
779779

780-
private _setVertexState(effect: Effect, useVertexPulling: boolean = false): void {
780+
private _setVertexState(effect: Effect): void {
781781
const currStateLen = this._statesLength;
782782
let newNumStates = StatePosition.VertexState;
783783

784784
const webgpuPipelineContext = effect._pipelineContext as WebGPUPipelineContext;
785-
const attributes = useVertexPulling ? [] : webgpuPipelineContext.shaderProcessingContext.attributeNamesFromEffect;
786-
const locations = useVertexPulling ? [] : webgpuPipelineContext.shaderProcessingContext.attributeLocationsFromEffect;
785+
const attributes = webgpuPipelineContext.shaderProcessingContext.attributeNamesFromEffect;
786+
const locations = webgpuPipelineContext.shaderProcessingContext.attributeLocationsFromEffect;
787787

788788
let currentGPUBuffer;
789789
let numVertexBuffers = 0;

packages/dev/core/src/Engines/abstractEngine.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ export abstract class AbstractEngine {
225225
/** @internal */
226226
public _videoTextureSupported: boolean;
227227

228-
/** @internal */
229-
public _useVertexPulling: boolean = false;
230-
231228
protected _compatibilityMode = true;
232229
/** @internal */
233230
public _pointerLockRequested: boolean;

packages/dev/core/src/Engines/webgpuEngine.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
319319

320320
private _commandBuffers: GPUCommandBuffer[] = [null as any, null as any];
321321

322-
private _dummyVertexBuffer: DataBuffer;
323-
324322
// Frame Buffer Life Cycle (recreated for each render target pass)
325323

326324
private _mainRenderPassWrapper: IWebGPURenderPassWrapper = {
@@ -3692,9 +3690,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
36923690

36933691
this._currentMaterialContext.textureState = textureState;
36943692

3695-
// If vertex pulling, get a cached pipeline with empty vertex layout
3696-
// Pass a boolean here to getRenderPipeline that will cause the vertex layout to be empty
3697-
const pipeline = this._cacheRenderPipeline.getRenderPipeline(fillMode, this._currentEffect!, this.currentSampleCount, textureState, this._useVertexPulling);
3693+
const pipeline = this._cacheRenderPipeline.getRenderPipeline(fillMode, this._currentEffect!, this.currentSampleCount, textureState);
36983694
const bindGroups = this._cacheBindGroups.getBindGroups(webgpuPipelineContext, this._currentDrawContext, this._currentMaterialContext);
36993695

37003696
if (!this._snapshotRendering.record) {
@@ -3721,13 +3717,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
37213717
);
37223718
}
37233719

3724-
// If vertex pulling, bind a cached empty vertex buffer
3725-
if (this._useVertexPulling) {
3726-
if (!this._dummyVertexBuffer) {
3727-
this._dummyVertexBuffer = this.createVertexBuffer(new Float32Array(0), false, "DummyVertexPullingBuffer");
3728-
}
3729-
renderPass2.setVertexBuffer(0, this._dummyVertexBuffer.underlyingResource, 0, 0);
3730-
}
37313720
const vertexBuffers = this._cacheRenderPipeline.vertexBuffers;
37323721
for (let index = 0; index < vertexBuffers.length; index++) {
37333722
const vertexBuffer = vertexBuffers[index];

packages/dev/core/src/Meshes/mesh.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,9 +2001,7 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
20012001
engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, this.forcedInstanceCount || instancesCount);
20022002
} else if (this._useVertexPulling) {
20032003
// We're rendering the number of indices in the index buffer but the vertex shader is handling the data itself.
2004-
engine._useVertexPulling = true;
20052004
engine.drawArraysType(fillMode, subMesh.indexStart, subMesh.indexCount, this.forcedInstanceCount || instancesCount);
2006-
engine._useVertexPulling = false;
20072005
} else {
20082006
engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, this.forcedInstanceCount || instancesCount);
20092007
}

0 commit comments

Comments
 (0)