diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-05-02 10:22:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-05-02 10:35:45 +0300 |
commit | 8ece0816d9ddf25c4fc695bf244ed2e261433ee2 (patch) | |
tree | 087bf6a6a1890609801bb71aecd100856c7ea44a /source/blender/draw/engines/eevee_next/eevee_shader_shared.hh | |
parent | f0f44fd92f1684552ee0275d14bb6dd72405c8fd (diff) |
EEVEE: Rewrite: Implement nodetree support with every geometry types
This commit introduce back support for all geometry types and all nodetree support.
Only the forward shading pipeline is implemented for now.
Vertex Displacement is automatically enabled for now.
Lighting & Shading is placeholder.
Related Task: T93220
# Conflicts:
# source/blender/draw/engines/eevee_next/eevee_engine.cc
# source/blender/gpu/CMakeLists.txt
Diffstat (limited to 'source/blender/draw/engines/eevee_next/eevee_shader_shared.hh')
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_shader_shared.hh | 86 |
1 files changed, 86 insertions, 0 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 new file mode 100644 index 00000000000..2c539339952 --- /dev/null +++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh @@ -0,0 +1,86 @@ + +/** + * Shared structures, enums & defines between C++ and GLSL. + * Can also include some math functions but they need to be simple enough to be valid in both + * language. + */ + +#ifndef USE_GPU_SHADER_CREATE_INFO +# pragma once + +# include "BLI_memory_utils.hh" +# include "DRW_gpu_wrapper.hh" + +// # include "eevee_defines.hh" + +# include "GPU_shader_shared.h" + +namespace blender::eevee { + +using draw::Framebuffer; +using draw::Texture; +using draw::TextureFromPool; + +#endif + +#define UBO_MIN_MAX_SUPPORTED_SIZE 1 << 14 + +/* -------------------------------------------------------------------- */ +/** \name Raytracing + * \{ */ + +enum eClosureBits : uint32_t { + /** NOTE: Theses are used as stencil bits. So we are limited to 8bits. */ + CLOSURE_DIFFUSE = (1u << 0u), + CLOSURE_SSS = (1u << 1u), + CLOSURE_REFLECTION = (1u << 2u), + CLOSURE_REFRACTION = (1u << 3u), + /* Non-stencil bits. */ + CLOSURE_TRANSPARENCY = (1u << 8u), + CLOSURE_EMISSION = (1u << 9u), + CLOSURE_HOLDOUT = (1u << 10u), + CLOSURE_VOLUME = (1u << 11u), + CLOSURE_AMBIENT_OCCLUSION = (1u << 12u), +}; + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Utility Texture + * \{ */ + +#define UTIL_TEX_SIZE 64 +#define UTIL_BTDF_LAYER_COUNT 16 +/* Scale and bias to avoid interpolation of the border pixel. + * Remap UVs to the border pixels centers. */ +#define UTIL_TEX_UV_SCALE ((UTIL_TEX_SIZE - 1.0f) / UTIL_TEX_SIZE) +#define UTIL_TEX_UV_BIAS (0.5f / UTIL_TEX_SIZE) + +#define UTIL_BLUE_NOISE_LAYER 0 +#define UTIL_LTC_MAT_LAYER 1 +#define UTIL_LTC_MAG_LAYER 2 +#define UTIL_BSDF_LAYER 2 +#define UTIL_BTDF_LAYER 3 +#define UTIL_DISK_INTEGRAL_LAYER 3 +#define UTIL_DISK_INTEGRAL_COMP 2 + +#ifndef __cplusplus +/* Fetch texel. Wrapping if above range. */ +float4 utility_tx_fetch(sampler2DArray util_tx, float2 texel, float layer) +{ + return texelFetch(util_tx, int3(int2(texel) % UTIL_TEX_SIZE, layer), 0); +} + +/* Sample at uv position. Filtered & Wrapping enabled. */ +float4 utility_tx_sample(sampler2DArray util_tx, float2 uv, float layer) +{ + return textureLod(util_tx, float3(uv, layer), 0.0); +} +#endif + +/** \} */ + +#ifdef __cplusplus + +} // namespace blender::eevee +#endif |