Eevee-Next: World Reflective Light #108149

Merged
Jeroen Bakker merged 33 commits from Jeroen-Bakker/blender:eevee-next-world-shader into main 2023-06-29 15:25:04 +02:00
6 changed files with 24 additions and 24 deletions
Showing only changes of commit ca0e3110ad - Show all commits

View File

@ -22,7 +22,7 @@ namespace blender::eevee {
* Used to draw background.
* \{ */
void WorldPipeline::sync(GPUMaterial *gpumat)
void BackgroundPipeline::sync(GPUMaterial *gpumat)
{
Manager &manager = *inst_.manager;
RenderBuffers &rbufs = inst_.render_buffers;
@ -49,7 +49,7 @@ void WorldPipeline::sync(GPUMaterial *gpumat)
world_ps_.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
}
void WorldPipeline::render(View &view)
void BackgroundPipeline::render(View &view)
{
inst_.manager->submit(world_ps_, view);
}
@ -60,7 +60,7 @@ void WorldPipeline::render(View &view)
/** \name World Probe Pipeline
* \{ */
void WorldProbePipeline::sync()
void WorldPipeline::sync()
{
for (int face : IndexRange(6)) {
CubemapSide &side = sides_[face];
@ -83,7 +83,7 @@ void WorldProbePipeline::sync()
has_draw_commands_ = false;
}
void WorldProbePipeline::sync(GPUMaterial *gpumat)
void WorldPipeline::sync(GPUMaterial *gpumat)
{
for (int face : IndexRange(6)) {
sync(gpumat, face);
@ -91,7 +91,7 @@ void WorldProbePipeline::sync(GPUMaterial *gpumat)
has_draw_commands_ = true;
}
void WorldProbePipeline::sync(GPUMaterial *gpumat, int face)
void WorldPipeline::sync(GPUMaterial *gpumat, int face)
{
Manager &manager = *inst_.manager;
@ -131,7 +131,7 @@ void WorldProbePipeline::sync(GPUMaterial *gpumat, int face)
pass.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
}
void WorldProbePipeline::render()
void WorldPipeline::render()
{
if (!has_draw_commands_) {
return;
@ -150,7 +150,7 @@ void WorldProbePipeline::render()
}
}
void WorldProbePipeline::CubemapSide::render(Instance &instance)
void WorldPipeline::CubemapSide::render(Instance &instance)
{
instance.manager->submit(cubemap_face_ps, view);
}

View File

@ -23,19 +23,19 @@ namespace blender::eevee {
class Instance;
/* -------------------------------------------------------------------- */
/** \name World Pipeline
/** \name World Background Pipeline
*
* Render world values.
* Render world background values.
* \{ */
class WorldPipeline {
class BackgroundPipeline {
private:
Instance &inst_;
PassSimple world_ps_ = {"World.Background"};
public:
WorldPipeline(Instance &inst) : inst_(inst){};
BackgroundPipeline(Instance &inst) : inst_(inst){};
void sync(GPUMaterial *gpumat);
void render(View &view);
@ -46,10 +46,10 @@ class WorldPipeline {
/* -------------------------------------------------------------------- */
/** \name World Probe Pipeline
*
* Render reflection probe of the world background.
* Renders a single side for the world reflection probe.
* \{ */
class WorldProbePipeline {
class WorldPipeline {
private:
Instance &inst_;
@ -82,7 +82,7 @@ class WorldProbePipeline {
};
public:
WorldProbePipeline(Instance &inst) : inst_(inst){};
WorldPipeline(Instance &inst) : inst_(inst){};
Jeroen-Bakker marked this conversation as resolved Outdated

You shouldn't have 3 sync functions. Kind of related to my other comments: Prefer syncing one view agnostic render pass and always sync it from World::sync().

You shouldn't have 3 `sync` functions. Kind of related to my other comments: Prefer syncing one view agnostic render pass and always sync it from `World::sync()`.
void sync();
void sync(GPUMaterial *gpumat);
@ -338,8 +338,8 @@ class UtilityTexture : public Texture {
class PipelineModule {
public:
Jeroen-Bakker marked this conversation as resolved Outdated

Maybe we could rename this to BackgroundPipeline and use WorldPipeline for world rendering. Could do that in another PR.

Maybe we could rename this to BackgroundPipeline and use WorldPipeline for world rendering. Could do that in another PR.

I did the change in #109495

I did the change in #109495
BackgroundPipeline background;
WorldPipeline world;
WorldProbePipeline world_probe;
DeferredPipeline deferred;
ForwardPipeline forward;
ShadowPipeline shadow;
@ -349,8 +349,8 @@ class PipelineModule {
public:
PipelineModule(Instance &inst)
: world(inst),
world_probe(inst),
: background(inst),
world(inst),
deferred(inst),
forward(inst),
shadow(inst),
@ -361,7 +361,7 @@ class PipelineModule {
deferred.begin_sync();
forward.sync();
shadow.sync();
world_probe.sync();
world.sync();
capture.sync();
}

View File

@ -43,7 +43,7 @@ void ReflectionProbeModule::sync(const ReflectionProbe &cubemap)
{
if (cubemap.type == ReflectionProbe::Type::World) {
GPUMaterial *world_material = instance_.world.get_world_material();
instance_.pipelines.world_probe.sync(world_material);
instance_.pipelines.world.sync(world_material);
Jeroen-Bakker marked this conversation as resolved Outdated

Prefer always syncing it inside World::sync() just like the other world pipeline is doing inst_.pipelines.world.sync(gpumat);.

Prefer always syncing it inside `World::sync()` just like the other world pipeline is doing `inst_.pipelines.world.sync(gpumat);`.
}
else {
BLI_assert_unreachable();

View File

@ -28,7 +28,7 @@ struct Material;
namespace blender::eevee {
class Instance;
class WorldProbePipeline;
class WorldPipeline;
/* -------------------------------------------------------------------- */
/** \name Reflection Probes
@ -84,7 +84,7 @@ class ReflectionProbeModule {
private:
void sync(const ReflectionProbe &cubemap);
friend class WorldProbePipeline;
friend class WorldPipeline;
};
} // namespace blender::eevee

View File

@ -118,8 +118,8 @@ void ShadingView::render()
GPU_framebuffer_bind(combined_fb_);
GPU_framebuffer_clear_color_depth(combined_fb_, clear_color, 1.0f);
inst_.pipelines.world_probe.render();
inst_.pipelines.world.render(render_view_new_);
inst_.pipelines.world.render();
inst_.pipelines.background.render(render_view_new_);
/* TODO(fclem): Move it after the first prepass (and hiz update) once pipeline is stabilized. */
inst_.lights.set_view(render_view_new_, extent_);

View File

@ -108,7 +108,7 @@ void World::sync()
inst_.manager->register_layer_attributes(gpumat);
inst_.pipelines.world.sync(gpumat);
inst_.pipelines.background.sync(gpumat);
}
GPUMaterial *World::get_world_material()