Skip to content

Commit f096de7

Browse files
authored
Shaders: Add name property (#26101)
* Shaders: Add name property * Shaders: Add name property * Handle undefined shader name
1 parent 6733877 commit f096de7

20 files changed

+47
-1
lines changed

examples/jsm/misc/GPUComputationRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ class GPUComputationRenderer {
332332
uniforms = uniforms || {};
333333

334334
const material = new ShaderMaterial( {
335+
name: 'GPUComputationShader',
335336
uniforms: uniforms,
336337
vertexShader: getPassThroughVertexShader(),
337338
fragmentShader: computeFragmentShader

examples/jsm/objects/Reflector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class Reflector extends Mesh {
5454
const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, { samples: multisample, type: HalfFloatType } );
5555

5656
const material = new ShaderMaterial( {
57+
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
5758
uniforms: UniformsUtils.clone( shader.uniforms ),
5859
fragmentShader: shader.fragmentShader,
5960
vertexShader: shader.vertexShader
@@ -201,6 +202,8 @@ class Reflector extends Mesh {
201202

202203
Reflector.ReflectorShader = {
203204

205+
name: 'ReflectorShader',
206+
204207
uniforms: {
205208

206209
'color': {

examples/jsm/postprocessing/BloomPass.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class BloomPass extends Pass {
3030

3131
this.materialCombine = new ShaderMaterial( {
3232

33+
name: CombineShader.name,
3334
uniforms: this.combineUniforms,
3435
vertexShader: CombineShader.vertexShader,
3536
fragmentShader: CombineShader.fragmentShader,
@@ -49,6 +50,7 @@ class BloomPass extends Pass {
4950

5051
this.materialConvolution = new ShaderMaterial( {
5152

53+
name: convolutionShader.name,
5254
uniforms: this.convolutionUniforms,
5355
vertexShader: convolutionShader.vertexShader,
5456
fragmentShader: convolutionShader.fragmentShader,
@@ -127,6 +129,8 @@ class BloomPass extends Pass {
127129

128130
const CombineShader = {
129131

132+
name: 'CombineShader',
133+
130134
uniforms: {
131135

132136
'tDiffuse': { value: null },

examples/jsm/postprocessing/DotScreenPass.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class DotScreenPass extends Pass {
2121

2222
this.material = new ShaderMaterial( {
2323

24+
name: shader.name,
2425
uniforms: this.uniforms,
2526
vertexShader: shader.vertexShader,
2627
fragmentShader: shader.fragmentShader

examples/jsm/postprocessing/FilmPass.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class FilmPass extends Pass {
1717

1818
this.material = new ShaderMaterial( {
1919

20+
name: shader.name,
2021
uniforms: this.uniforms,
2122
vertexShader: shader.vertexShader,
2223
fragmentShader: shader.fragmentShader

examples/jsm/postprocessing/ShaderPass.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ShaderPass extends Pass {
2424

2525
this.material = new ShaderMaterial( {
2626

27+
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
2728
defines: Object.assign( {}, shader.defines ),
2829
uniforms: this.uniforms,
2930
vertexShader: shader.vertexShader,

examples/jsm/shaders/BleachBypassShader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
const BleachBypassShader = {
88

9+
name: 'BleachBypassShader',
10+
911
uniforms: {
1012

1113
'tDiffuse': { value: null },

examples/jsm/shaders/ColorifyShader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88

99
const ColorifyShader = {
1010

11+
name: 'ColorifyShader',
12+
1113
uniforms: {
1214

1315
'tDiffuse': { value: null },

examples/jsm/shaders/ConvolutionShader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99

1010
const ConvolutionShader = {
1111

12+
name: 'ConvolutionShader',
13+
1214
defines: {
1315

1416
'KERNEL_SIZE_FLOAT': '25.0',

examples/jsm/shaders/CopyShader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
const CopyShader = {
66

7+
name: 'CopyShader',
8+
79
uniforms: {
810

911
'tDiffuse': { value: null },

0 commit comments

Comments
 (0)