Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy 0.9.30 #301

Merged
merged 12 commits into from
Feb 1, 2024
27 changes: 14 additions & 13 deletions dist/spector.bundle.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion documentation/changeLogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ Please, find below the per release summary of the contribution added to the proj
* Fix [Multidraw spy](https://github.com/BabylonJS/Spector.js/issues/253)
* Fix [Preprocessor beautify](https://github.com/BabylonJS/Spector.js/pull/272)
* Fix [Float buffer capture](https://github.com/BabylonJS/Spector.js/pull/276)
* Add [Beautifier Toggle](https://github.com/BabylonJS/Spector.js/pull/282)
* Add [GLSL Beautifier Toggle](https://github.com/BabylonJS/Spector.js/pull/282)
* Add [GLSL Prepocessor Toggle](https://github.com/BabylonJS/Spector.js/pull/295)
* Fix [BaseVertexBaseInstance Capture](https://github.com/BabylonJS/Spector.js/pull/284)
* Fix [XR spy on firefox](https://github.com/BabylonJS/Spector.js/pull/285)
* Fix [Frame Buffer visual state](https://github.com/BabylonJS/Spector.js/pull/292)

## v0.9.29
* Add [WebXR tracking capabilities](https://github.com/BabylonJS/Spector.js/pull/257)
Expand Down
27 changes: 14 additions & 13 deletions extensions/spector.bundle.func.js

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions extensions/spector.bundle.js

Large diffs are not rendered by default.

66 changes: 46 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"build": "run-s build:tslint build:bundle build:copybuild:copy:bundle build:concatBundleFunc -n",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@shaderfrog/glsl-parser": "^2.0.1"
},
"devDependencies": {
"@types/webxr": "^0.5.1",
"concat-cli": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/drawArrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrawArrays extends BaseCommand {
protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawArrays"));
stringified.push(args[1]);
stringified.push(args[1] + " indices");
stringified.push(args[2]);

return stringified;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/drawElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrawElements extends BaseCommand {
protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawElements"));
stringified.push(args[1]);
stringified.push(args[1] + " indices");
stringified.push(WebGlConstants.stringifyWebGlConstant(args[2], "drawElements"));
stringified.push(args[3]);

Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/drawElementsInstanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrawElementsInstanced extends BaseCommand {
protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawElementsInstanced"));
stringified.push(args[1]);
stringified.push(args[1] + " indices");
stringified.push(WebGlConstants.stringifyWebGlConstant(args[2], "drawElementsInstanced"));
stringified.push(args[3]);
stringified.push(args[4]);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/drawElementsInstancedAngle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrawElementsInstancedAngle extends BaseCommand {
protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawElementsInstancedANGLE"));
stringified.push(args[1]);
stringified.push(args[1] + " indices");
stringified.push(WebGlConstants.stringifyWebGlConstant(args[2], "drawElementsInstancedANGLE"));
stringified.push(args[3]);
stringified.push(args[4]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrawElementsInstancedBaseVertexBaseInstanceWEBGL extends BaseComman
protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawElementsInstanced"));
stringified.push(args[1]);
stringified.push(args[1] + " indices");
stringified.push(WebGlConstants.stringifyWebGlConstant(args[2], "drawElementsInstanced"));
stringified.push(args[3]);
stringified.push(args[4]);
Expand Down
4 changes: 3 additions & 1 deletion src/backend/states/context/visualState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ export class VisualState extends BaseState {
const info = storage.__SPECTOR_Object_CustomData as ITextureRecorderData;
width = info.width;
height = info.height;
textureType = info.type;
if (info.type !== undefined) {
textureType = info.type;
}
knownAsTextureArray = info.target === WebGlConstants.TEXTURE_2D_ARRAY.name;
if (!ReadPixelsHelper.isSupportedCombination(info.type, info.format, info.internalFormat)) {
return;
Expand Down
5 changes: 5 additions & 0 deletions src/embeddedFrontend/resultView/resultView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ export class ResultView {
state.beautify = (sourceCodeState.sender as HTMLInputElement).checked;
this.mvx.updateState(this.sourceCodeComponentStateId, state);
});
this.sourceCodeComponent.onPreprocessChanged.add((sourceCodeState) => {
const state = this.mvx.getGenericState<ISourceCodeState>(this.sourceCodeComponentStateId);
state.preprocessed = (sourceCodeState.sender as HTMLInputElement).checked;
this.mvx.updateState(this.sourceCodeComponentStateId, state);
});


this.updateViewState();
Expand Down
32 changes: 27 additions & 5 deletions src/embeddedFrontend/resultView/sourceCode/sourceCodeComponent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import preprocess from "@shaderfrog/glsl-parser/preprocessor"; // tslint:disable-line:no-submodule-imports
import { BaseComponent, IStateEvent } from "../../mvx/baseComponent";
import { ISourceCodeChangeEvent } from "../resultView";
import { Logger } from "../../../shared/utils/logger";

export interface ISourceCodeState extends ISourceCodeChangeEvent {
nameVertex: string;
Expand All @@ -8,6 +10,7 @@ export interface ISourceCodeState extends ISourceCodeChangeEvent {
translated: boolean;
editable: boolean;
beautify: boolean;
preprocessed: boolean;
}

// Declare Ace types here.
Expand Down Expand Up @@ -43,6 +46,7 @@ export class SourceCodeComponent extends BaseComponent<ISourceCodeState> {
public onSourceCodeCloseClicked: IStateEvent<ISourceCodeState>;
public onSourceCodeChanged: IStateEvent<ISourceCodeState>;
public onBeautifyChanged: IStateEvent<ISourceCodeState>;
public onPreprocessChanged: IStateEvent<ISourceCodeState>;

private editor: IAceEditor;

Expand All @@ -55,6 +59,7 @@ export class SourceCodeComponent extends BaseComponent<ISourceCodeState> {
this.onSourceCodeCloseClicked = this.createEvent("onSourceCodeCloseClicked");
this.onSourceCodeChanged = this.createEvent("onSourceCodeChanged");
this.onBeautifyChanged = this.createEvent("onBeautifyChanged");
this.onPreprocessChanged = this.createEvent("onPreprocessChanged");
}

public showError(errorMessage: string) {
Expand Down Expand Up @@ -86,33 +91,50 @@ export class SourceCodeComponent extends BaseComponent<ISourceCodeState> {
public render(state: ISourceCodeState, stateId: number): Element {
const source = state.fragment ? state.sourceFragment : state.sourceVertex;
let originalShader: string;
let preprocessed = state.preprocessed;

// tslint:disable-next-line:prefer-conditional-expression
if (state.translated) {
originalShader = state.fragment ? state.translatedSourceFragment : state.translatedSourceVertex;
preprocessed = false;
}
else {
originalShader = source ?? "";
}

const displayedShader = state.beautify ? this._indentIfdef(this._beautify(originalShader)) : originalShader;
let displayedShader = originalShader;
if (preprocessed) {
try {
displayedShader = preprocess(displayedShader, {
preserveComments: false,
stopOnError: true
});
} catch (e) {
Logger.error("shader preprocess failed", e);
}
}

if (state.beautify) {
displayedShader = this._indentIfdef(this._beautify(displayedShader));
}

const htmlString = this.htmlTemplate`
<div class="sourceCodeComponentContainer">
<div class="sourceCodeMenuComponentContainer">
<ul class="sourceCodeMenuComponent">
$${ state.translatedSourceVertex ? this.htmlTemplate`<li><a class="${!state.fragment && state.translated ? "active" : ""}" href="#" role="button" commandName="onTranslatedVertexSourceClicked">Translated Vertex</a></li>` : "" }
$${ state.translatedSourceFragment ? this.htmlTemplate`<li><a class="${state.fragment && state.translated ? "active" : ""}" href="#" role="button" commandName="onTranslatedFragmentSourceClicked">Translated Fragment</a></li>` : "" }
$${state.translatedSourceVertex ? this.htmlTemplate`<li><a class="${!state.fragment && state.translated ? "active" : ""}" href="#" role="button" commandName="onTranslatedVertexSourceClicked">Translated Vertex</a></li>` : ""}
$${state.translatedSourceFragment ? this.htmlTemplate`<li><a class="${state.fragment && state.translated ? "active" : ""}" href="#" role="button" commandName="onTranslatedFragmentSourceClicked">Translated Fragment</a></li>` : ""}
<li><a class="${!state.fragment && !state.translated ? "active" : ""}" href="#" role="button" commandName="onVertexSourceClicked">Vertex</a></li>
<li><a class="${state.fragment && !state.translated ? "active" : ""}" href="#" role="button" commandName="onFragmentSourceClicked">Fragment</a></li>
<li><a href="#" role="button" commandName="onSourceCodeCloseClicked">Close</a></li>
</ul>
</div>
$${
this.htmlTemplate`<div class="sourceCodeComponent">${displayedShader}</div>`
$${this.htmlTemplate`<div class="sourceCodeComponent">${displayedShader}</div>`
}
<div class="sourceCodeMenuComponentFooter">
<p>
<label><input type="checkbox" commandName="onBeautifyChanged" ${state.beautify ? "checked" : ""} /> Beautify</label>
<label><input type="checkbox" commandName="onPreprocessChanged" ${state.preprocessed ? "checked" : ""} /> Preprocess</label>
</p>
</div>
</div>`;
Expand Down
Loading