diff options
author | Jason Fielder <jason_apple> | 2022-03-30 20:47:59 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-03-30 20:53:22 +0300 |
commit | 49bc640b76c77a19e523cd1843585a0c6b21e82f (patch) | |
tree | c3446aaa594ac467a76a2e5af5dd86ba886b4aba /source/blender/draw/engines/eevee | |
parent | 7c9e128bbfb37d70799f8867d93992ee3f522242 (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/draw/engines/eevee')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightprobes.c | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lightprobe_filter_glossy_frag.glsl | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 7029d015b22..219c44de9dc 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -204,7 +204,7 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1); DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1); - DRW_shgroup_uniform_float(grp, "roughness", &pinfo->roughness, 1); + DRW_shgroup_uniform_float(grp, "probe_roughness", &pinfo->roughness, 1); DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1); DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1); DRW_shgroup_uniform_float(grp, "texelSize", &pinfo->texel_size, 1); diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_filter_glossy_frag.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_filter_glossy_frag.glsl index a5d11f52a1d..af2982b30c0 100644 --- a/source/blender/draw/engines/eevee/shaders/lightprobe_filter_glossy_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lightprobe_filter_glossy_frag.glsl @@ -4,7 +4,7 @@ #pragma BLENDER_REQUIRE(common_math_geom_lib.glsl) uniform samplerCube probeHdr; -uniform float roughness; +uniform float probe_roughness; uniform float texelSize; uniform float lodFactor; uniform float lodMax; @@ -51,7 +51,7 @@ void main() float pdf; /* Microfacet normal */ - vec3 H = sample_ggx(Xi, roughness, V, N, T, B, pdf); + vec3 H = sample_ggx(Xi, probe_roughness, V, N, T, B, pdf); vec3 L = -reflect(V, H); float NL = dot(N, L); |