Skip to content

Commit 133d7a8

Browse files
committed
Merge pull request godotengine#105286 from Repiteo/core/math-const-shader-fix
Rendering: Fix `Math` constant conversion
2 parents 565f151 + c7e9dc9 commit 133d7a8

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

drivers/gles3/storage/material_storage.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,9 +1143,9 @@ MaterialStorage::MaterialStorage() {
11431143
actions.renames["CANVAS_MATRIX"] = "canvas_transform";
11441144
actions.renames["SCREEN_MATRIX"] = "screen_transform";
11451145
actions.renames["TIME"] = "time";
1146-
actions.renames["PI"] = _MKSTR(Math::PI);
1147-
actions.renames["TAU"] = _MKSTR(Math::TAU);
1148-
actions.renames["E"] = _MKSTR(Math::E);
1146+
actions.renames["PI"] = String::num(Math::PI);
1147+
actions.renames["TAU"] = String::num(Math::TAU);
1148+
actions.renames["E"] = String::num(Math::E);
11491149
actions.renames["AT_LIGHT_PASS"] = "false";
11501150
actions.renames["INSTANCE_CUSTOM"] = "instance_custom";
11511151

@@ -1238,9 +1238,9 @@ MaterialStorage::MaterialStorage() {
12381238

12391239
actions.renames["TIME"] = "scene_data.time";
12401240
actions.renames["EXPOSURE"] = "(1.0 / scene_data.emissive_exposure_normalization)";
1241-
actions.renames["PI"] = _MKSTR(Math::PI);
1242-
actions.renames["TAU"] = _MKSTR(Math::TAU);
1243-
actions.renames["E"] = _MKSTR(Math::E);
1241+
actions.renames["PI"] = String::num(Math::PI);
1242+
actions.renames["TAU"] = String::num(Math::TAU);
1243+
actions.renames["E"] = String::num(Math::E);
12441244
actions.renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
12451245
actions.renames["CLIP_SPACE_FAR"] = "SHADER_SPACE_FAR";
12461246
actions.renames["VIEWPORT_SIZE"] = "scene_data.viewport_size";
@@ -1406,9 +1406,9 @@ MaterialStorage::MaterialStorage() {
14061406
}
14071407
actions.renames["TRANSFORM"] = "xform";
14081408
actions.renames["TIME"] = "time";
1409-
actions.renames["PI"] = _MKSTR(Math::PI);
1410-
actions.renames["TAU"] = _MKSTR(Math::TAU);
1411-
actions.renames["E"] = _MKSTR(Math::E);
1409+
actions.renames["PI"] = String::num(Math::PI);
1410+
actions.renames["TAU"] = String::num(Math::TAU);
1411+
actions.renames["E"] = String::num(Math::E);
14121412
actions.renames["LIFETIME"] = "lifetime";
14131413
actions.renames["DELTA"] = "local_delta";
14141414
actions.renames["NUMBER"] = "particle_number";
@@ -1463,9 +1463,9 @@ MaterialStorage::MaterialStorage() {
14631463
actions.renames["SCREEN_UV"] = "uv";
14641464
actions.renames["TIME"] = "time";
14651465
actions.renames["FRAGCOORD"] = "gl_FragCoord";
1466-
actions.renames["PI"] = _MKSTR(Math::PI);
1467-
actions.renames["TAU"] = _MKSTR(Math::TAU);
1468-
actions.renames["E"] = _MKSTR(Math::E);
1466+
actions.renames["PI"] = String::num(Math::PI);
1467+
actions.renames["TAU"] = String::num(Math::TAU);
1468+
actions.renames["E"] = String::num(Math::E);
14691469
actions.renames["HALF_RES_COLOR"] = "half_res_color";
14701470
actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
14711471
actions.renames["RADIANCE"] = "radiance";

servers/rendering/renderer_rd/environment/fog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ void Fog::init_fog_shader(uint32_t p_max_directional_lights, int p_roughness_lay
205205
ShaderCompiler::DefaultIdentifierActions actions;
206206

207207
actions.renames["TIME"] = "scene_params.time";
208-
actions.renames["PI"] = _MKSTR(Math::PI);
209-
actions.renames["TAU"] = _MKSTR(Math::TAU);
210-
actions.renames["E"] = _MKSTR(Math::E);
208+
actions.renames["PI"] = String::num(Math::PI);
209+
actions.renames["TAU"] = String::num(Math::TAU);
210+
actions.renames["E"] = String::num(Math::E);
211211
actions.renames["WORLD_POSITION"] = "world.xyz";
212212
actions.renames["OBJECT_POSITION"] = "params.position";
213213
actions.renames["UVW"] = "uvw";

servers/rendering/renderer_rd/environment/sky.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,9 @@ void SkyRD::init() {
783783
actions.renames["SCREEN_UV"] = "uv";
784784
actions.renames["FRAGCOORD"] = "gl_FragCoord";
785785
actions.renames["TIME"] = "params.time";
786-
actions.renames["PI"] = _MKSTR(Math::PI);
787-
actions.renames["TAU"] = _MKSTR(Math::TAU);
788-
actions.renames["E"] = _MKSTR(Math::E);
786+
actions.renames["PI"] = String::num(Math::PI);
787+
actions.renames["TAU"] = String::num(Math::TAU);
788+
actions.renames["E"] = String::num(Math::E);
789789
actions.renames["HALF_RES_COLOR"] = "half_res_color";
790790
actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
791791
actions.renames["RADIANCE"] = "radiance";

servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,9 @@ void SceneShaderForwardClustered::init(const String p_defines) {
618618

619619
actions.renames["TIME"] = "global_time";
620620
actions.renames["EXPOSURE"] = "(1.0 / scene_data_block.data.emissive_exposure_normalization)";
621-
actions.renames["PI"] = _MKSTR(Math::PI);
622-
actions.renames["TAU"] = _MKSTR(Math::TAU);
623-
actions.renames["E"] = _MKSTR(Math::E);
621+
actions.renames["PI"] = String::num(Math::PI);
622+
actions.renames["TAU"] = String::num(Math::TAU);
623+
actions.renames["E"] = String::num(Math::E);
624624
actions.renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
625625
actions.renames["CLIP_SPACE_FAR"] = "SHADER_SPACE_FAR";
626626
actions.renames["VIEWPORT_SIZE"] = "read_viewport_size";

servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,9 @@ void SceneShaderForwardMobile::init(const String p_defines) {
552552

553553
actions.renames["TIME"] = "scene_data_block.data.time";
554554
actions.renames["EXPOSURE"] = "(1.0 / scene_data_block.data.emissive_exposure_normalization)";
555-
actions.renames["PI"] = _MKSTR(Math::PI);
556-
actions.renames["TAU"] = _MKSTR(Math::TAU);
557-
actions.renames["E"] = _MKSTR(Math::E);
555+
actions.renames["PI"] = String::num(Math::PI);
556+
actions.renames["TAU"] = String::num(Math::TAU);
557+
actions.renames["E"] = String::num(Math::E);
558558
actions.renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
559559
actions.renames["CLIP_SPACE_FAR"] = "SHADER_SPACE_FAR";
560560
actions.renames["VIEWPORT_SIZE"] = "read_viewport_size";

servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,9 +1773,9 @@ RendererCanvasRenderRD::RendererCanvasRenderRD() {
17731773
actions.renames["CANVAS_MATRIX"] = "canvas_data.canvas_transform";
17741774
actions.renames["SCREEN_MATRIX"] = "canvas_data.screen_transform";
17751775
actions.renames["TIME"] = "canvas_data.time";
1776-
actions.renames["PI"] = _MKSTR(Math::PI);
1777-
actions.renames["TAU"] = _MKSTR(Math::TAU);
1778-
actions.renames["E"] = _MKSTR(Math::E);
1776+
actions.renames["PI"] = String::num(Math::PI);
1777+
actions.renames["TAU"] = String::num(Math::TAU);
1778+
actions.renames["E"] = String::num(Math::E);
17791779
actions.renames["AT_LIGHT_PASS"] = "false";
17801780
actions.renames["INSTANCE_CUSTOM"] = "instance_custom";
17811781

servers/rendering/renderer_rd/storage_rd/particles_storage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ ParticlesStorage::ParticlesStorage() {
8080
}
8181
actions.renames["TRANSFORM"] = "PARTICLE.xform";
8282
actions.renames["TIME"] = "frame_history.data[0].time";
83-
actions.renames["PI"] = _MKSTR(Math::PI);
84-
actions.renames["TAU"] = _MKSTR(Math::TAU);
85-
actions.renames["E"] = _MKSTR(Math::E);
83+
actions.renames["PI"] = String::num(Math::PI);
84+
actions.renames["TAU"] = String::num(Math::TAU);
85+
actions.renames["E"] = String::num(Math::E);
8686
actions.renames["LIFETIME"] = "params.lifetime";
8787
actions.renames["DELTA"] = "local_delta";
8888
actions.renames["NUMBER"] = "particle_number";

0 commit comments

Comments
 (0)