diff options
author | Jason Fielder <jason_apple> | 2022-03-30 20:47:59 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2022-04-11 01:31:50 +0300 |
commit | cca66623ee1b1adeb93d53dbaa981799c01b3820 (patch) | |
tree | 9a2c73d8f17fd7f0eb42c1dcd75bccb93368abfc /source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl | |
parent | c42330c6ebb03c15a0f0f71a3863e59d17f75ec0 (diff) |
Metal: GLSL Shader compatibility 5
MSL does not have an implicit global scope, this is emulated via macro's adding an indirection for uniforms, attributes, shader stage inputs and outputs such as:
#define roughness shaderinst->roughness.
Variables in GLSL which exist within uniform blocks can be directly referenced via the global scope, unlike standard C++. This means that variable name pollution occurs if subsequent local variables in the code use the same name, resulting in compilation errors.
A number of these conflicting names have been renamed to ensure unique naming and no further scope pollution.
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D14452
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl b/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl index cdc716db7a4..3edf0e31799 100644 --- a/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl +++ b/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl @@ -7,13 +7,13 @@ uniform vec4 WorldClipPlanes[6]; # define _world_clip_planes_calc_clip_distance(wpos, _clipplanes) \ { \ - vec4 pos = vec4(wpos, 1.0); \ - gl_ClipDistance[0] = dot(_clipplanes[0], pos); \ - gl_ClipDistance[1] = dot(_clipplanes[1], pos); \ - gl_ClipDistance[2] = dot(_clipplanes[2], pos); \ - gl_ClipDistance[3] = dot(_clipplanes[3], pos); \ - gl_ClipDistance[4] = dot(_clipplanes[4], pos); \ - gl_ClipDistance[5] = dot(_clipplanes[5], pos); \ + vec4 _pos = vec4(wpos, 1.0); \ + gl_ClipDistance[0] = dot(_clipplanes[0], _pos); \ + gl_ClipDistance[1] = dot(_clipplanes[1], _pos); \ + gl_ClipDistance[2] = dot(_clipplanes[2], _pos); \ + gl_ClipDistance[3] = dot(_clipplanes[3], _pos); \ + gl_ClipDistance[4] = dot(_clipplanes[4], _pos); \ + gl_ClipDistance[5] = dot(_clipplanes[5], _pos); \ } /* When all shaders are builtin shaders are migrated this could be applied directly. */ |