aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-18 17:40:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-18 17:40:04 -0700
commite7aaa7e6bb1f0518f98717a8158efb7f429a73ee (patch)
treee7e3522d68413eb941911b32faf7c270b344fc22
parent688d5cbb21958a5f27e4ae14f40c5cb6e0eef3f1 (diff)
support null arguments in deleteX
-rw-r--r--src/webGLWorker.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/webGLWorker.js b/src/webGLWorker.js
index 9de90a58..111378e0 100644
--- a/src/webGLWorker.js
+++ b/src/webGLWorker.js
@@ -540,6 +540,7 @@ function WebGLWorker() {
return { id: id, what: 'shader', type: type };
};
this.deleteShader = function(shader) {
+ if (!shader) return;
commandBuffer.push('deleteShader', 1, shader.id);
};
this.shaderSource = function(shader, source) {
@@ -558,6 +559,7 @@ function WebGLWorker() {
return new WebGLProgram(id);
};
this.deleteProgram = function(program) {
+ if (!program) return;
commandBuffer.push('deleteProgram', 1, program.id);
};
this.attachShader = function(program, shader) {
@@ -679,6 +681,7 @@ function WebGLWorker() {
return new WebGLBuffer(id);
};
this.deleteBuffer = function(buffer) {
+ if (!buffer) return;
commandBuffer.push('deleteBuffer', 1, buffer.id);
};
this.bindBuffer = function(target, buffer) {
@@ -731,6 +734,7 @@ function WebGLWorker() {
return new WebGLTexture(id);
};
this.deleteTexture = function(texture) {
+ if (!texture) return;
commandBuffer.push('deleteTexture', 1, texture.id);
texture.id = 0;
};
@@ -813,6 +817,7 @@ function WebGLWorker() {
return new WebGLFramebuffer(id);
};
this.deleteFramebuffer = function(framebuffer) {
+ if (!framebuffer) return;
commandBuffer.push('deleteFramebuffer', 1, framebuffer.id);
};
this.bindFramebuffer = function(target, framebuffer) {
@@ -830,6 +835,7 @@ function WebGLWorker() {
return new WebGLRenderbuffer(id);
};
this.deleteRenderbuffer = function(renderbuffer) {
+ if (!renderbuffer) return;
commandBuffer.push('deleteRenderbuffer', 1, renderbuffer.id);
};
this.bindRenderbuffer = function(target, renderbuffer) {