Skip to content

Commit

Permalink
Moved additional webgl related members of Shader to WebglShader (#4127)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky authored Mar 16, 2022
1 parent 9d04618 commit 9a0697c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/graphics/shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ class Shader {
* @private
*/
init() {
this.attributes = [];
this.uniforms = [];
this.samplers = [];

this.ready = false;
this.failed = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/webgl/webgl-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -1761,8 +1761,8 @@ class WebglGraphicsDevice extends GraphicsDevice {
const shader = this.shader;
if (!shader)
return;
const samplers = shader.samplers;
const uniforms = shader.uniforms;
const samplers = shader.impl.samplers;
const uniforms = shader.impl.uniforms;

// vertex buffers
if (!keepBuffers) {
Expand Down
10 changes: 7 additions & 3 deletions src/graphics/webgl/webgl-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import { SHADERTAG_MATERIAL, semanticToLocation } from '../constants.js';
class WebglShader {
constructor(shader) {

this.uniforms = [];
this.samplers = [];
this.attributes = [];

this.glProgram = null;
this.glVertexShader = null;
this.glFragmentShader = null;
Expand Down Expand Up @@ -218,7 +222,7 @@ class WebglShader {

shaderInput = new ShaderInput(device, definition.attributes[info.name], device.pcUniformType[info.type], location);

shader.attributes.push(shaderInput);
this.attributes.push(shaderInput);
}

// Query the program for each shader state (GLSL 'uniform')
Expand All @@ -233,9 +237,9 @@ class WebglShader {
if (info.type === gl.SAMPLER_2D || info.type === gl.SAMPLER_CUBE ||
(device.webgl2 && (info.type === gl.SAMPLER_2D_SHADOW || info.type === gl.SAMPLER_CUBE_SHADOW || info.type === gl.SAMPLER_3D))
) {
shader.samplers.push(shaderInput);
this.samplers.push(shaderInput);
} else {
shader.uniforms.push(shaderInput);
this.uniforms.push(shaderInput);
}
}

Expand Down

0 comments on commit 9a0697c

Please sign in to comment.