Skip to content

Commit 2d78642

Browse files
committed
Pipelines now populate their own uniforms
1 parent dd1757a commit 2d78642

6 files changed

Lines changed: 13 additions & 65 deletions

File tree

src/renderer/webgl/pipelines/BitmapMaskPipeline.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ var BitmapMaskPipeline = new Class({
6060
type: WEBGL_CONST.FLOAT
6161
}
6262
]);
63-
config.uniforms = GetFastValue(config, 'uniforms', [
64-
'uResolution',
65-
'uMainSampler',
66-
'uMaskSampler',
67-
'uInvertMaskAlpha'
68-
]);
6963

7064
WebGLPipeline.call(this, config);
7165
},

src/renderer/webgl/pipelines/GraphicsPipeline.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ var GraphicsPipeline = new Class({
5555
config.attributes = GetFastValue(config, 'attributes', [
5656
{
5757
name: 'inPosition',
58-
size: 2,
59-
type: WEBGL_CONST.FLOAT
58+
size: 2
6059
},
6160
{
6261
name: 'inColor',
@@ -65,9 +64,6 @@ var GraphicsPipeline = new Class({
6564
normalized: true
6665
}
6766
]);
68-
config.uniforms = GetFastValue(config, 'uniforms', [
69-
'uProjectionMatrix'
70-
]);
7167

7268
WebGLPipeline.call(this, config);
7369

src/renderer/webgl/pipelines/MultiPipeline.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,17 @@ var MultiPipeline = new Class({
8181
config.attributes = GetFastValue(config, 'attributes', [
8282
{
8383
name: 'inPosition',
84-
size: 2,
85-
type: WEBGL_CONST.FLOAT
84+
size: 2
8685
},
8786
{
8887
name: 'inTexCoord',
89-
size: 2,
90-
type: WEBGL_CONST.FLOAT
88+
size: 2
9189
},
9290
{
93-
name: 'inTexId',
94-
size: 1,
95-
type: WEBGL_CONST.FLOAT
91+
name: 'inTexId'
9692
},
9793
{
98-
name: 'inTintEffect',
99-
size: 1,
100-
type: WEBGL_CONST.FLOAT
94+
name: 'inTintEffect'
10195
},
10296
{
10397
name: 'inTint',
@@ -106,10 +100,6 @@ var MultiPipeline = new Class({
106100
normalized: true
107101
}
108102
]);
109-
config.uniforms = GetFastValue(config, 'uniforms', [
110-
'uProjectionMatrix',
111-
'uMainSampler'
112-
]);
113103

114104
WebGLPipeline.call(this, config);
115105

src/renderer/webgl/pipelines/PointLightPipeline.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ var PointLightPipeline = new Class({
2020
{
2121
config.vertShader = GetFastValue(config, 'vertShader', PointLightShaderSourceVS);
2222
config.fragShader = GetFastValue(config, 'fragShader', PointLightShaderSourceFS);
23-
config.uniforms = GetFastValue(config, 'uniforms', [
24-
'uProjectionMatrix',
25-
'uResolution'
26-
]);
2723
config.attributes = GetFastValue(config, 'attributes', [
2824
{
2925
name: 'inPosition',

src/renderer/webgl/pipelines/PostFXPipeline.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ var ColorMatrix = require('../../../display/ColorMatrix');
99
var GetFastValue = require('../../../utils/object/GetFastValue');
1010
var ShaderSourceFS = require('../shaders/PostFX-frag.js');
1111
var ShaderSourceVS = require('../shaders/Quad-vert.js');
12-
var WEBGL_CONST = require('../const');
1312
var WebGLPipeline = require('../WebGLPipeline');
1413

1514
/**
@@ -47,19 +46,14 @@ var PostFXPipeline = new Class({
4746
config.renderTarget = GetFastValue(config, 'renderTarget', 1);
4847
config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS);
4948
config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS);
50-
config.uniforms = GetFastValue(config, 'uniforms', [
51-
'uMainSampler'
52-
]);
5349
config.attributes = GetFastValue(config, 'attributes', [
5450
{
5551
name: 'inPosition',
56-
size: 2,
57-
type: WEBGL_CONST.FLOAT
52+
size: 2
5853
},
5954
{
6055
name: 'inTexCoord',
61-
size: 2,
62-
type: WEBGL_CONST.FLOAT
56+
size: 2
6357
}
6458
]);
6559
config.batchSize = 1;

src/renderer/webgl/pipelines/UtilityPipeline.js

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ var CopyFS = require('../shaders/Copy-frag.js');
1212
var GetFastValue = require('../../../utils/object/GetFastValue');
1313
var LinearBlendFS = require('../shaders/LinearBlend-frag.js');
1414
var QuadVS = require('../shaders/Quad-vert.js');
15-
var WEBGL_CONST = require('../const');
1615
var WebGLPipeline = require('../WebGLPipeline');
1716

1817
/**
@@ -77,51 +76,30 @@ var UtilityPipeline = new Class({
7776
config.shaders = GetFastValue(config, 'shaders', [
7877
{
7978
name: 'Copy',
80-
fragShader: CopyFS,
81-
uniforms: [
82-
'uMainSampler',
83-
'uBrightness'
84-
]
79+
fragShader: CopyFS
8580
},
8681
{
8782
name: 'AddBlend',
88-
fragShader: AddBlendFS,
89-
uniforms: [
90-
'uMainSampler1',
91-
'uMainSampler2',
92-
'uStrength'
93-
]
83+
fragShader: AddBlendFS
9484
},
9585
{
9686
name: 'LinearBlend',
97-
fragShader: LinearBlendFS,
98-
uniforms: [
99-
'uMainSampler1',
100-
'uMainSampler2',
101-
'uStrength'
102-
]
87+
fragShader: LinearBlendFS
10388
},
10489
{
10590
name: 'ColorMatrix',
106-
fragShader: ColorMatrixFS,
107-
uniforms: [
108-
'uMainSampler',
109-
'uColorMatrix',
110-
'uAlpha'
111-
]
91+
fragShader: ColorMatrixFS
11292
}
11393
]);
11494

11595
config.attributes = GetFastValue(config, 'attributes', [
11696
{
11797
name: 'inPosition',
118-
size: 2,
119-
type: WEBGL_CONST.FLOAT
98+
size: 2
12099
},
121100
{
122101
name: 'inTexCoord',
123-
size: 2,
124-
type: WEBGL_CONST.FLOAT
102+
size: 2
125103
}
126104
]);
127105

0 commit comments

Comments
 (0)