WIP: eevee-next-world-irradiance #108304

Closed
Jeroen Bakker wants to merge 79 commits from Jeroen-Bakker:eevee-next-world-irradiance into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 8 additions and 8 deletions
Showing only changes of commit 487ab2073b - Show all commits

View File

@ -39,7 +39,8 @@ void IrradianceCache::init()
int atlas_row_count = divide_ceil_u(atlas_byte_size, row_byte_size);
atlas_extent.y *= atlas_row_count;
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_SHADER_READ;
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_SHADER_READ |
GPU_TEXTURE_USAGE_ATTACHMENT;
do_full_update_ = irradiance_atlas_tx_.ensure_3d(GPU_RGBA16F, atlas_extent, usage);
if (do_full_update_) {
@ -505,7 +506,7 @@ void IrradianceBake::surfels_create(const Object &probe_object)
(2 * inst_.sampling.sample_count());
eGPUTextureUsage texture_usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE |
GPU_TEXTURE_USAGE_HOST_READ;
GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
/* 32bit float is needed here otherwise we loose too much energy from rounding error during the
* accumulation when the sample count is above 500. */
@ -706,7 +707,8 @@ void IrradianceBake::read_surfels(LightProbeGridCacheFrame *cache_frame)
{
if (!ELEM(inst_.debug_mode,
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_NORMAL,
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE)) {
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE))
{
return;
}

View File

@ -58,9 +58,6 @@ class LightBake {
/** Baking instance. Created and freed in the worker thread. */
Instance *instance_ = nullptr;
/** Light Cache being baked. Create in worker thread and pass ownership to original scene on
* first `update()` call. */
::LightCache *light_cache_ = nullptr;
/** Manager used for command submission. Created and freed in the worker thread. */
draw::Manager *manager_ = nullptr;
@ -216,20 +213,21 @@ class LightBake {
void context_disable()
{
GPU_render_end();
if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) {
/* Reuse main draw context. */
DRW_opengl_context_disable();
GPU_render_end();
GPU_context_main_unlock();
}
else if (gl_context_ == nullptr) {
/* Main thread case. */
DRW_opengl_context_disable();
GPU_render_end();
}
else {
/* Worker thread case. */
DRW_gpu_render_context_disable(gpu_context_);
GPU_render_end();
DRW_opengl_render_context_disable(gl_context_);
}
}