gl-wiretap
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -9,2 +9,3 @@ export interface IGLWiretapOptions { | ||
useTrackablePrimitives?: Boolean; | ||
onReadPixels?: (targetName: string, argumentAsStrings: string[]) => void; | ||
} | ||
@@ -11,0 +12,0 @@ |
15
index.js
@@ -15,2 +15,3 @@ /** | ||
variables = {}, | ||
onReadPixels, | ||
} = options; | ||
@@ -82,6 +83,18 @@ const proxy = new Proxy(gl, { get: listen }); | ||
readPixelsVariableName = targetVariableName; | ||
recording.push(`${indent}${contextName}.readPixels(${arguments[0]}, ${arguments[1]}, ${arguments[2]}, ${arguments[3]}, ${getEntity(arguments[4])}, ${getEntity(arguments[5])}, ${targetVariableName});`); | ||
const argumentAsStrings = [ | ||
arguments[0], | ||
arguments[1], | ||
arguments[2], | ||
arguments[3], | ||
getEntity(arguments[4]), | ||
getEntity(arguments[5]), | ||
targetVariableName | ||
]; | ||
recording.push(`${indent}${contextName}.readPixels(${argumentAsStrings.join(', ')});`); | ||
if (readPixelsFile) { | ||
writePPM(arguments[2], arguments[3]); | ||
} | ||
if (onReadPixels) { | ||
onReadPixels(targetVariableName, argumentAsStrings); | ||
} | ||
return gl.readPixels.apply(gl, arguments); | ||
@@ -88,0 +101,0 @@ case 'drawBuffers': |
{ | ||
"name": "gl-wiretap", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A gl debugger that listens and replays gl (WebGL, WebGL2, and HeadlessGL) gpu commands", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -75,4 +75,5 @@ # gl-wiretap | ||
* throwGetProgramParameter: Boolean - Causes `gl.getProgramParameter()` to throw if there is an error | ||
* onReadPixels: Function(targetName, argumentAsStrings); | ||
## Typescript support | ||
By default, typescript is supported |
18144
368
79