diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-01-21 19:25:10 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-01-22 01:16:59 +0300 |
commit | a507c251b23f2fd6ef7758e443939ce0c5c09e61 (patch) | |
tree | 9fe4e1ac28c23cb52e334cd0ec7b92c83f4ffd5a /source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl | |
parent | 790025c01ed76c06e69e6054f1a718ca57771e28 (diff) |
Eevee: Put all constant uniforms in a global UBO.
This is an optimization / cleanup commit.
The use of a global ubo remove lots of uniform lookups and only transfert data when needed.
Lots of renaming for more consistent codestyle.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl b/source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl index 76d20486d3d..132cc16fcbd 100644 --- a/source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/irradiance_lib.glsl @@ -1,6 +1,5 @@ uniform sampler2DArray irradianceGrid; -uniform int irradianceVisibilitySize; #define IRRADIANCE_LIB @@ -81,8 +80,8 @@ IrradianceData load_irradiance_cell(int cell, vec3 N) float load_visibility_cell(int cell, vec3 L, float dist, float bias, float bleed_bias, float range) { /* Keep in sync with diffuse_filter_probe() */ - ivec2 cell_co = ivec2(irradianceVisibilitySize); - ivec2 cell_per_row_col = textureSize(irradianceGrid, 0).xy / irradianceVisibilitySize; + ivec2 cell_co = ivec2(prbIrradianceVisSize); + ivec2 cell_per_row_col = textureSize(irradianceGrid, 0).xy / prbIrradianceVisSize; cell_co.x *= (cell % cell_per_row_col.x); cell_co.y *= (cell / cell_per_row_col.x) % cell_per_row_col.y; float layer = 1.0 + float((cell / cell_per_row_col.x) / cell_per_row_col.y); @@ -90,8 +89,8 @@ float load_visibility_cell(int cell, vec3 L, float dist, float bias, float bleed vec2 texel_size = 1.0 / vec2(textureSize(irradianceGrid, 0).xy); vec2 co = vec2(cell_co) * texel_size; - vec2 uv = mapping_octahedron(-L, vec2(1.0 / float(irradianceVisibilitySize))); - uv *= vec2(irradianceVisibilitySize) * texel_size; + vec2 uv = mapping_octahedron(-L, vec2(1.0 / float(prbIrradianceVisSize))); + uv *= vec2(prbIrradianceVisSize) * texel_size; vec4 data = texture(irradianceGrid, vec3(co + uv, layer)); |