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
2 changes: 1 addition & 1 deletion dist/spector.bundle.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion documentation/changeLogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
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.33
* Add [Offscreen canvas support](https://github.com/BabylonJS/Spector.js/pull/345)
* Add [Texture Storei Information](https://github.com/BabylonJS/Spector.js/issues/80)
* Add [MCP Support](https://github.com/BabylonJS/Spector.js/pull/345)
* Add [Offscreen canvas support](https://github.com/BabylonJS/Spector.js/pull/343)
* Add [Typescript typings](https://github.com/BabylonJS/Spector.js/pull/339)
* Migrate [MVX to React](https://github.com/BabylonJS/Spector.js/pull/338)
Expand Down
27 changes: 14 additions & 13 deletions package-lock.json

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

22 changes: 22 additions & 0 deletions src/backend/recorders/baseRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { WebGlConstants, WebGlConstantsByValue } from "../types/webglConstants";
import { FunctionCallbacks, IFunctionInformation } from "../types/functionInformation";
import { ICapture } from "../../shared/capture/capture";
import { WebGlObjects } from "../webGlObjects/baseWebGlObject";
import { IPixelStoreState } from "./texture2DRecorder";

export interface IRecorder {
registerCallbacks(onFunctionCallbacks: FunctionCallbacks): void;
Expand Down Expand Up @@ -220,4 +221,25 @@ export abstract class BaseRecorder<T extends WebGLObject> implements IRecorder {
const bytesPerElements = BaseRecorder.byteSizePerInternalFormat[internalFormat];
return bytesPerElements || 4;
}

protected readPixelStoreState(): IPixelStoreState {
const gl = this.options.context;
const state: IPixelStoreState = {
UNPACK_FLIP_Y_WEBGL: gl.getParameter(WebGlConstants.UNPACK_FLIP_Y_WEBGL.value),
UNPACK_PREMULTIPLY_ALPHA_WEBGL: gl.getParameter(WebGlConstants.UNPACK_PREMULTIPLY_ALPHA_WEBGL.value),
UNPACK_COLORSPACE_CONVERSION_WEBGL: gl.getParameter(WebGlConstants.UNPACK_COLORSPACE_CONVERSION_WEBGL.value),
UNPACK_ALIGNMENT: gl.getParameter(WebGlConstants.UNPACK_ALIGNMENT.value),
};

// Add WebGL2-only parameters if available
if (gl instanceof WebGL2RenderingContext) {
state.UNPACK_ROW_LENGTH = gl.getParameter(WebGlConstants.UNPACK_ROW_LENGTH.value);
state.UNPACK_IMAGE_HEIGHT = gl.getParameter(WebGlConstants.UNPACK_IMAGE_HEIGHT.value);
state.UNPACK_SKIP_PIXELS = gl.getParameter(WebGlConstants.UNPACK_SKIP_PIXELS.value);
state.UNPACK_SKIP_ROWS = gl.getParameter(WebGlConstants.UNPACK_SKIP_ROWS.value);
state.UNPACK_SKIP_IMAGES = gl.getParameter(WebGlConstants.UNPACK_SKIP_IMAGES.value);
}

return state;
}
}
17 changes: 17 additions & 0 deletions src/backend/recorders/texture2DRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ import { WebGlConstants } from "../types/webglConstants";

import { IFunctionInformation } from "../types/functionInformation";

export interface IPixelStoreState {
UNPACK_FLIP_Y_WEBGL?: boolean;
UNPACK_PREMULTIPLY_ALPHA_WEBGL?: boolean;
UNPACK_COLORSPACE_CONVERSION_WEBGL?: number;
UNPACK_ALIGNMENT?: number;
/** WebGL2 only */
UNPACK_ROW_LENGTH?: number;
UNPACK_IMAGE_HEIGHT?: number;
UNPACK_SKIP_PIXELS?: number;
UNPACK_SKIP_ROWS?: number;
UNPACK_SKIP_IMAGES?: number;
}

export interface ITextureRecorderData {
target: string;
internalFormat: number;
Expand All @@ -14,6 +27,7 @@ export interface ITextureRecorderData {
type?: number;
depth?: number;
isCompressed: boolean;
pixelStoreState?: IPixelStoreState;
}

export class Texture2DRecorder extends BaseRecorder<WebGLTexture> {
Expand Down Expand Up @@ -67,6 +81,9 @@ export class Texture2DRecorder extends BaseRecorder<WebGLTexture> {
return 0;
}

// Snapshot pixelStorei state at upload time
customData.pixelStoreState = this.readPixelStoreState();

const previousLength = (instance as any).__SPECTOR_Object_CustomData ? (instance as any).__SPECTOR_Object_CustomData.length : 0;
if (customData.isCompressed) {
// Compressed textures are worth the size of their data.
Expand Down
3 changes: 3 additions & 0 deletions src/backend/recorders/texture3DRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export class Texture3DRecorder extends BaseRecorder<WebGLTexture> {
return 0;
}

// Snapshot pixelStorei state at upload time
customData.pixelStoreState = this.readPixelStoreState();

const previousLength = (instance as any).__SPECTOR_Object_CustomData ? (instance as any).__SPECTOR_Object_CustomData.length : 0;
if (customData.isCompressed) {
// Compressed textures are worth the size of their data.
Expand Down
Loading