diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-09-02 12:33:33 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-09-02 12:33:33 +0300 |
commit | c8ac1280bb7e69bffadff4cf8c8f71f9c0ec6616 (patch) | |
tree | a5722d52babe321d8577f9d8e2b8c2e44fcdcf67 | |
parent | 0a85288462def15bf8fedb04aaa6872a2c4dfd33 (diff) |
EEVEE-Next: Move weight layer indexes to shader shared.
Upcoming cryptomatte patch would need access to these defines. So moving
them from film_lib to shader shared. We cannot include the film_lib as
it requires images/textures to be bound that we don't need.
At the same time fixes incorrect casing (`lAYER` => `LAYER`).
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_shader_shared.hh | 5 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh index a0829bc49aa..73c090386c9 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh +++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh @@ -194,6 +194,11 @@ BLI_STATIC_ASSERT_ALIGN(CameraData, 16) #define FILM_PRECOMP_SAMPLE_MAX 16 +enum eFilmWeightLayerIndex : uint32_t { + FILM_WEIGHT_LAYER_ACCUMULATION = 0u, + FILM_WEIGHT_LAYER_DISTANCE = 1u, +}; + struct FilmSample { int2 texel; float weight; diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl index 964c078036b..087efa9100d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl @@ -164,9 +164,6 @@ void film_sample_accum_combined(FilmSample samp, inout vec4 accum, inout float w /** \name Load/Store Data * \{ */ -#define WEIGHT_lAYER_ACCUMULATION 0 -#define WEIGHT_lAYER_DISTANCE 1 - /* Returns the distance used to store nearest interpolation data. */ float film_distance_load(ivec2 texel) { @@ -176,7 +173,7 @@ float film_distance_load(ivec2 texel) if (!film_buf.use_history || film_buf.use_reprojection) { return 1.0e16; } - return imageLoad(in_weight_img, ivec3(texel, WEIGHT_lAYER_DISTANCE)).x; + return imageLoad(in_weight_img, ivec3(texel, FILM_WEIGHT_LAYER_DISTANCE)).x; } float film_weight_load(ivec2 texel) @@ -187,7 +184,7 @@ float film_weight_load(ivec2 texel) if (!film_buf.use_history || film_buf.use_reprojection) { return 0.0; } - return imageLoad(in_weight_img, ivec3(texel, WEIGHT_lAYER_ACCUMULATION)).x; + return imageLoad(in_weight_img, ivec3(texel, FILM_WEIGHT_LAYER_ACCUMULATION)).x; } /* Returns motion in pixel space to retrieve the pixel history. */ @@ -550,12 +547,12 @@ void film_store_depth(ivec2 texel_film, float value, out float out_depth) void film_store_distance(ivec2 texel, float value) { - imageStore(out_weight_img, ivec3(texel, WEIGHT_lAYER_DISTANCE), vec4(value)); + imageStore(out_weight_img, ivec3(texel, FILM_WEIGHT_LAYER_DISTANCE), vec4(value)); } void film_store_weight(ivec2 texel, float value) { - imageStore(out_weight_img, ivec3(texel, WEIGHT_lAYER_ACCUMULATION), vec4(value)); + imageStore(out_weight_img, ivec3(texel, FILM_WEIGHT_LAYER_ACCUMULATION), vec4(value)); } float film_display_depth_ammend(ivec2 texel, float depth) |