Skip to content

Commit

Permalink
Fix #180 elements array buffer in capture
Browse files Browse the repository at this point in the history
  • Loading branch information
sebavan committed Feb 11, 2021
1 parent 9a64c72 commit 650e04b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/spector.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions documentation/changeLogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Please, find below the per release summary of the contribution added to the project per version. Each of the listed versions is having its corresponding tag in the repo.

## v0.9.22
* Display [elementArrayBuffer in capture state](https://github.com/BabylonJS/Spector.js/issues/180)

## v0.9.19 && v0.9.20 && v0.9.21
* Add Support for [translated shaders](https://github.com/BabylonJS/Spector.js/issues/175) in the extension.
Expand Down
2 changes: 1 addition & 1 deletion extensions/spector.bundle.func.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion extensions/spector.bundle.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/backend/states/baseState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export abstract class BaseState {
protected currentState: State;
protected quickCapture: boolean;
protected fullCapture: boolean;
protected lastCommandName: string;

private readonly changeCommandsByState: { [key: string]: string[] };
private readonly consumeCommands: string[];
Expand Down Expand Up @@ -129,6 +130,7 @@ export abstract class BaseState {
}

protected isValidConsumeCommand(command: ICommandCapture): boolean {
this.lastCommandName = command?.name;
return true;
}

Expand Down
8 changes: 8 additions & 0 deletions src/backend/states/drawCalls/drawCallState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ export class DrawCallState extends BaseState {

this.currentState.shaders = programCapture.shaders;

if (this.lastCommandName?.indexOf("Elements") >= 0) {
const elementArrayBuffer = this.context.getParameter(this.context.ELEMENT_ARRAY_BUFFER_BINDING);
if (elementArrayBuffer) {
this.currentState.elementArray = {};
this.currentState.elementArray.arrayBuffer = this.getSpectorData(elementArrayBuffer);
}
}

const attributes = this.context.getProgramParameter(program, WebGlConstants.ACTIVE_ATTRIBUTES.value);
this.currentState.attributes = [];
for (let i = 0; i < attributes; i++) {
Expand Down

0 comments on commit 650e04b

Please sign in to comment.