EEVEE-Next: Fix discrepancy between lookdev and forward

They both use the same materials so they need the same
resources.
This commit is contained in:
Clément Foucault
2024-04-16 20:10:07 +02:00
parent 95996737c3
commit 3d59514729
2 changed files with 9 additions and 26 deletions

View File

@@ -17,6 +17,8 @@
#include "eevee_instance.hh"
#include "draw_debug.hh"
namespace blender::eevee {
/* -------------------------------------------------------------------- */
@@ -170,11 +172,6 @@ static int calc_sphere_size(const float viewport_scale)
void LookdevModule::sync()
{
for (Sphere &sphere : spheres_) {
sphere.pass.init();
}
display_ps_.init();
if (!enabled_) {
return;
}
@@ -216,6 +213,7 @@ void LookdevModule::sync_pass(PassSimple &pass,
::Material *mat,
ResourceHandle res_handle)
{
pass.init();
pass.clear_depth(1.0f);
pass.clear_color(float4(0.0, 0.0, 0.0, 1.0));
@@ -226,21 +224,15 @@ void LookdevModule::sync_pass(PassSimple &pass,
mat, mat->nodetree, MAT_PIPE_FORWARD, MAT_GEOM_MESH, MAT_PROBE_NONE);
pass.state_set(state);
pass.material_set(*inst_.manager, gpumat);
pass.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
pass.bind_image("rp_cryptomatte_img", dummy_cryptomatte_tx_);
pass.bind_image("rp_color_img", dummy_aov_color_tx_);
pass.bind_image("rp_value_img", dummy_aov_value_tx_);
pass.bind_image("aov_color_img", dummy_aov_color_tx_);
pass.bind_image("aov_value_img", dummy_aov_value_tx_);
pass.bind_resources(inst_.uniform_data);
pass.bind_resources(inst_.hiz_buffer.front);
pass.bind_resources(inst_.sphere_probes);
pass.bind_resources(inst_.volume_probes);
pass.bind_resources(inst_.lights);
pass.bind_resources(inst_.shadows);
pass.bind_resources(inst_.volume.result);
pass.bind_resources(inst_.cryptomatte);
pass.bind_resources(inst_.sampling);
pass.bind_resources(inst_.hiz_buffer.front);
pass.bind_resources(inst_.volume_probes);
pass.bind_resources(inst_.sphere_probes);
pass.draw(geom, res_handle, 0);
}
@@ -250,6 +242,7 @@ void LookdevModule::sync_display()
const DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS |
DRW_STATE_BLEND_ALPHA;
pass.init();
pass.state_set(state);
pass.shader_set(inst_.shaders.static_shader_get(LOOKDEV_DISPLAY));
pass.push_constant("viewportSize", float2(DRW_viewport_size_get()));

View File

@@ -270,10 +270,7 @@ void ForwardPipeline::sync()
{
/* Common resources. */
/* Textures. */
prepass_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
prepass_ps_.bind_resources(inst_.uniform_data);
prepass_ps_.bind_resources(inst_.velocity);
prepass_ps_.bind_resources(inst_.sampling);
@@ -296,14 +293,7 @@ void ForwardPipeline::sync()
{
/* Common resources. */
/* RenderPasses & AOVs. */
opaque_ps_.bind_image(RBUFS_COLOR_SLOT, &inst_.render_buffers.rp_color_tx);
opaque_ps_.bind_image(RBUFS_VALUE_SLOT, &inst_.render_buffers.rp_value_tx);
/* Cryptomatte. */
opaque_ps_.bind_image(RBUFS_CRYPTOMATTE_SLOT, &inst_.render_buffers.cryptomatte_tx);
/* Textures. */
opaque_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
opaque_ps_.bind_resources(inst_.uniform_data);
opaque_ps_.bind_resources(inst_.lights);
opaque_ps_.bind_resources(inst_.shadows);