|
@@ -185,9 +185,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- this._valueCache[uniformName] = value;
|
|
|
-
|
|
|
- this.engine.setInt(this._uniforms[uniformName], value);
|
|
|
+ if (this.engine.setInt(this._uniforms[uniformName], value)) {
|
|
|
+ this._valueCache[uniformName] = value;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -292,7 +292,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setMatrix(uniformName: string, matrix: IMatrixLike): void {
|
|
|
if (this._cacheMatrix(uniformName, matrix)) {
|
|
|
- this.engine.setMatrices(this._uniforms[uniformName], matrix.toArray() as Float32Array);
|
|
|
+ if (!this.engine.setMatrices(this._uniforms[uniformName], matrix.toArray() as Float32Array)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -328,9 +330,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- this._valueCache[uniformName] = value;
|
|
|
-
|
|
|
- this.engine.setFloat(this._uniforms[uniformName], value);
|
|
|
+ if (this.engine.setFloat(this._uniforms[uniformName], value)) {
|
|
|
+ this._valueCache[uniformName] = value;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -340,7 +342,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setVector2(uniformName: string, vector2: IVector2Like): void {
|
|
|
if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {
|
|
|
- this.engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y);
|
|
|
+ if (!this.engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -352,7 +356,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setFloat2(uniformName: string, x: number, y: number): void {
|
|
|
if (this._cacheFloat2(uniformName, x, y)) {
|
|
|
- this.engine.setFloat2(this._uniforms[uniformName], x, y);
|
|
|
+ if (!this.engine.setFloat2(this._uniforms[uniformName], x, y)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -363,7 +369,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setVector3(uniformName: string, vector3: IVector3Like): void {
|
|
|
if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {
|
|
|
- this.engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z);
|
|
|
+ if (!this.engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -376,7 +384,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setFloat3(uniformName: string, x: number, y: number, z: number): void {
|
|
|
if (this._cacheFloat3(uniformName, x, y, z)) {
|
|
|
- this.engine.setFloat3(this._uniforms[uniformName], x, y, z);
|
|
|
+ if (!this.engine.setFloat3(this._uniforms[uniformName], x, y, z)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -387,7 +397,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setVector4(uniformName: string, vector4: IVector4Like): void {
|
|
|
if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {
|
|
|
- this.engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w);
|
|
|
+ if (!this.engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -402,7 +414,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): void {
|
|
|
if (this._cacheFloat4(uniformName, x, y, z, w)) {
|
|
|
- this.engine.setFloat4(this._uniforms[uniformName], x, y, z, w);
|
|
|
+ if (!this.engine.setFloat4(this._uniforms[uniformName], x, y, z, w)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -413,7 +427,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setColor3(uniformName: string, color3: IColor3Like): void {
|
|
|
if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {
|
|
|
- this.engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b);
|
|
|
+ if (!this.engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -425,7 +441,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setColor4(uniformName: string, color3: IColor3Like, alpha: number): void {
|
|
|
if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {
|
|
|
- this.engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha);
|
|
|
+ if (!this.engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -436,7 +454,9 @@ export class WebGLPipelineContext implements IPipelineContext {
|
|
|
*/
|
|
|
public setDirectColor4(uniformName: string, color4: IColor4Like): void {
|
|
|
if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {
|
|
|
- this.engine.setFloat4(this._uniforms[uniformName], color4.r, color4.g, color4.b, color4.a);
|
|
|
+ if (!this.engine.setFloat4(this._uniforms[uniformName], color4.r, color4.g, color4.b, color4.a)) {
|
|
|
+ this._valueCache[uniformName] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|