Cleanup: EEVEE-Next: Rename LookUpTable to Precompute

This commit is contained in:
Clément Foucault 2023-09-03 14:37:05 +02:00
parent ad71a04de0
commit 760aa0e917
5 changed files with 16 additions and 17 deletions

@ -150,7 +150,7 @@ set(SRC
engines/eevee_next/eevee_lightcache.cc engines/eevee_next/eevee_lightcache.cc
engines/eevee_next/eevee_lightprobe.cc engines/eevee_next/eevee_lightprobe.cc
engines/eevee_next/eevee_lookdev.cc engines/eevee_next/eevee_lookdev.cc
engines/eevee_next/eevee_lut.cc engines/eevee_next/eevee_precompute.cc
engines/eevee_next/eevee_material.cc engines/eevee_next/eevee_material.cc
engines/eevee_next/eevee_motion_blur.cc engines/eevee_next/eevee_motion_blur.cc
engines/eevee_next/eevee_pipeline.cc engines/eevee_next/eevee_pipeline.cc
@ -282,7 +282,6 @@ set(SRC
engines/compositor/compositor_engine.h engines/compositor/compositor_engine.h
engines/eevee/eevee_engine.h engines/eevee/eevee_engine.h
engines/eevee/eevee_lightcache.h engines/eevee/eevee_lightcache.h
engines/eevee/eevee_lut.h
engines/eevee/eevee_private.h engines/eevee/eevee_private.h
engines/eevee/engine_eevee_shared_defines.h engines/eevee/engine_eevee_shared_defines.h
engines/eevee_next/eevee_ambient_occlusion.hh engines/eevee_next/eevee_ambient_occlusion.hh
@ -299,7 +298,7 @@ set(SRC
engines/eevee_next/eevee_lightcache.hh engines/eevee_next/eevee_lightcache.hh
engines/eevee_next/eevee_lightprobe.hh engines/eevee_next/eevee_lightprobe.hh
engines/eevee_next/eevee_lookdev.hh engines/eevee_next/eevee_lookdev.hh
engines/eevee_next/eevee_lut.hh engines/eevee_next/eevee_precompute.hh
engines/eevee_next/eevee_material.hh engines/eevee_next/eevee_material.hh
engines/eevee_next/eevee_motion_blur.hh engines/eevee_next/eevee_motion_blur.hh
engines/eevee_next/eevee_pipeline.hh engines/eevee_next/eevee_pipeline.hh

@ -8,23 +8,23 @@
* LUT generation module. * LUT generation module.
*/ */
#include "eevee_lut.hh" #include "eevee_precompute.hh"
namespace blender::eevee { namespace blender::eevee {
LookUpTable::LookUpTable(draw::Manager &manager, LookUpTableType table_type, int3 table_extent) Precompute::Precompute(draw::Manager &manager, PrecomputeType type, int3 table_extent)
{ {
table_extent_ = table_extent; table_extent_ = table_extent;
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_HOST_READ; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_HOST_READ;
Texture table_tx = {"LUT Precompute"}; Texture table_tx = {"Precompute"};
table_tx.ensure_3d(GPU_RGBA32F, table_extent, usage); table_tx.ensure_3d(GPU_RGBA32F, table_extent, usage);
GPUShader *shader = GPU_shader_create_from_info_name("eevee_lut"); GPUShader *shader = GPU_shader_create_from_info_name("eevee_lut");
PassSimple lut_ps = {"LUT Precompute"}; PassSimple lut_ps = {"Precompute"};
lut_ps.shader_set(shader); lut_ps.shader_set(shader);
lut_ps.push_constant("table_type", int(table_type)); lut_ps.push_constant("table_type", int(type));
lut_ps.push_constant("table_extent", table_extent); lut_ps.push_constant("table_extent", table_extent);
lut_ps.bind_image("table_img", table_tx); lut_ps.bind_image("table_img", table_tx);
lut_ps.dispatch(math::divide_ceil(table_extent, int3(int2(LUT_WORKGROUP_SIZE), 1))); lut_ps.dispatch(math::divide_ceil(table_extent, int3(int2(LUT_WORKGROUP_SIZE), 1)));
@ -37,7 +37,7 @@ LookUpTable::LookUpTable(draw::Manager &manager, LookUpTableType table_type, int
GPU_shader_free(shader); GPU_shader_free(shader);
} }
LookUpTable::~LookUpTable() Precompute::~Precompute()
{ {
MEM_SAFE_FREE(raw_data_); MEM_SAFE_FREE(raw_data_);
} }

@ -21,16 +21,16 @@ namespace blender::eevee {
/** /**
* Create a look-up table of the specified type using GPU compute. * Create a look-up table of the specified type using GPU compute.
* Not to be used at runtime in final release. * Not to be used at runtime in final release.
* Usage example: `LookUpTable(manager, LUT_GGX_BRDF_SPLIT_SUM, {64, 64, 1}).data<float2>()` * Usage example: `Precompute(manager, LUT_GGX_BRDF_SPLIT_SUM, {64, 64, 1}).data<float2>()`
*/ */
class LookUpTable { class Precompute {
private: private:
int3 table_extent_; int3 table_extent_;
float4 *raw_data_ = nullptr; float4 *raw_data_ = nullptr;
public: public:
LookUpTable(draw::Manager &manager, LookUpTableType table_type, int3 table_extent); Precompute(draw::Manager &manager, PrecomputeType type, int3 table_extent);
~LookUpTable(); ~Precompute();
/* Cast each pixel data to type `T`. */ /* Cast each pixel data to type `T`. */
template<typename T> Vector<T> data() template<typename T> Vector<T> data()

@ -86,7 +86,7 @@ enum eDebugMode : uint32_t {
/** \name Look-Up Table Generation /** \name Look-Up Table Generation
* \{ */ * \{ */
enum LookUpTableType : uint32_t { enum PrecomputeType : uint32_t {
LUT_GGX_BRDF_SPLIT_SUM = 0u, LUT_GGX_BRDF_SPLIT_SUM = 0u,
LUT_GGX_BTDF_SPLIT_SUM = 1u, LUT_GGX_BTDF_SPLIT_SUM = 1u,
}; };

@ -16,7 +16,7 @@
#include "draw_shader.h" #include "draw_shader.h"
#include "draw_testing.hh" #include "draw_testing.hh"
#include "engines/eevee_next/eevee_instance.hh" #include "engines/eevee_next/eevee_instance.hh"
#include "engines/eevee_next/eevee_lut.hh" #include "engines/eevee_next/eevee_precompute.hh"
namespace blender::draw { namespace blender::draw {
@ -1448,8 +1448,8 @@ static void test_eevee_lut_gen()
Manager manager; Manager manager;
/* Check if LUT generation matches the header version. */ /* Check if LUT generation matches the header version. */
auto bsdf_ggx_gen = LookUpTable(manager, LUT_GGX_BRDF_SPLIT_SUM, {64, 64, 1}).data<float2>(); auto bsdf_ggx_gen = Precompute(manager, LUT_GGX_BRDF_SPLIT_SUM, {64, 64, 1}).data<float2>();
auto btdf_ggx_gen = LookUpTable(manager, LUT_GGX_BTDF_SPLIT_SUM, {64, 64, 16}).data<float2>(); auto btdf_ggx_gen = Precompute(manager, LUT_GGX_BTDF_SPLIT_SUM, {64, 64, 16}).data<float2>();
Span<float2> bsdf_ggx_lut(reinterpret_cast<const float2 *>(bsdf_split_sum_ggx), 64 * 64); Span<float2> bsdf_ggx_lut(reinterpret_cast<const float2 *>(bsdf_split_sum_ggx), 64 * 64);
Span<float2> btdf_ggx_lut(reinterpret_cast<const float2 *>(btdf_split_sum_ggx), 64 * 64 * 16); Span<float2> btdf_ggx_lut(reinterpret_cast<const float2 *>(btdf_split_sum_ggx), 64 * 64 * 16);