WIP: eevee-next-world-irradiance #108304
|
@ -39,7 +39,8 @@ void IrradianceCache::init()
|
||||||
int atlas_row_count = divide_ceil_u(atlas_byte_size, row_byte_size);
|
int atlas_row_count = divide_ceil_u(atlas_byte_size, row_byte_size);
|
||||||
atlas_extent.y *= atlas_row_count;
|
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);
|
do_full_update_ = irradiance_atlas_tx_.ensure_3d(GPU_RGBA16F, atlas_extent, usage);
|
||||||
|
|
||||||
if (do_full_update_) {
|
if (do_full_update_) {
|
||||||
|
@ -505,7 +506,7 @@ void IrradianceBake::surfels_create(const Object &probe_object)
|
||||||
(2 * inst_.sampling.sample_count());
|
(2 * inst_.sampling.sample_count());
|
||||||
|
|
||||||
eGPUTextureUsage texture_usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE |
|
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
|
/* 32bit float is needed here otherwise we loose too much energy from rounding error during the
|
||||||
* accumulation when the sample count is above 500. */
|
* accumulation when the sample count is above 500. */
|
||||||
|
@ -706,7 +707,8 @@ void IrradianceBake::read_surfels(LightProbeGridCacheFrame *cache_frame)
|
||||||
{
|
{
|
||||||
if (!ELEM(inst_.debug_mode,
|
if (!ELEM(inst_.debug_mode,
|
||||||
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_NORMAL,
|
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_NORMAL,
|
||||||
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE)) {
|
eDebugMode::DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,6 @@ class LightBake {
|
||||||
|
|
||||||
/** Baking instance. Created and freed in the worker thread. */
|
/** Baking instance. Created and freed in the worker thread. */
|
||||||
Instance *instance_ = nullptr;
|
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. */
|
/** Manager used for command submission. Created and freed in the worker thread. */
|
||||||
draw::Manager *manager_ = nullptr;
|
draw::Manager *manager_ = nullptr;
|
||||||
|
|
||||||
|
@ -216,20 +213,21 @@ class LightBake {
|
||||||
|
|
||||||
void context_disable()
|
void context_disable()
|
||||||
{
|
{
|
||||||
GPU_render_end();
|
|
||||||
|
|
||||||
if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) {
|
if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) {
|
||||||
/* Reuse main draw context. */
|
/* Reuse main draw context. */
|
||||||
DRW_opengl_context_disable();
|
DRW_opengl_context_disable();
|
||||||
|
GPU_render_end();
|
||||||
GPU_context_main_unlock();
|
GPU_context_main_unlock();
|
||||||
}
|
}
|
||||||
else if (gl_context_ == nullptr) {
|
else if (gl_context_ == nullptr) {
|
||||||
/* Main thread case. */
|
/* Main thread case. */
|
||||||
DRW_opengl_context_disable();
|
DRW_opengl_context_disable();
|
||||||
|
GPU_render_end();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Worker thread case. */
|
/* Worker thread case. */
|
||||||
DRW_gpu_render_context_disable(gpu_context_);
|
DRW_gpu_render_context_disable(gpu_context_);
|
||||||
|
GPU_render_end();
|
||||||
DRW_opengl_render_context_disable(gl_context_);
|
DRW_opengl_render_context_disable(gl_context_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue