EEVEE Next: Volumes #107176

Merged
Miguel Pozo merged 126 commits from pragma37/blender:pull-eevee-next-volumes into main 2023-08-04 16:47:22 +02:00
4 changed files with 20 additions and 15 deletions
Showing only changes of commit 8a9039c4e7 - Show all commits

View File

@ -51,7 +51,7 @@
namespace blender::eevee {
pragma37 marked this conversation as resolved Outdated

Document functions that returns bool. Even more so when the function name is not explict.

Reminder that function documentation should be in header files.

Document functions that returns bool. Even more so when the function name is not explict. Reminder that function documentation should be in header files.
void Volumes::bind_common_buffers(PassMain &ps)
void Volumes::bind_common_buffers(PassSimple &ps)
{
pragma37 marked this conversation as resolved Outdated

This functino should be better documented.

This functino should be better documented.
ps.bind_ubo(VOLUMES_BUF_SLOT, data_);
#if 0
@ -251,7 +251,7 @@ void Volumes::begin_sync()
}
}
PassMain::Sub &ps = world_ps_.sub("World Volume");
PassSimple::Sub &ps = world_ps_.sub("World Volume");
if (mat) {
ps.shader_set(GPU_material_get_shader(mat));
if (volume_sub_pass(ps, nullptr, nullptr, mat)) {
@ -265,7 +265,10 @@ void Volumes::begin_sync()
/* If no world or volume material is present just clear the buffer with this drawcall */
ps.shader_set(inst_.shaders.static_shader_get(VOLUME_CLEAR));
}
std::cout << data_.tex_size << std::endl;
ps.draw_procedural(GPU_PRIM_TRIS, 1, data_.tex_size.z);
enabled_ = true;
}
void Volumes::sync_object(Object *ob, ObjectHandle & /*ob_handle*/, ResourceHandle /*res_handle*/)
@ -303,7 +306,7 @@ void Volumes::sync_object(Object *ob, ObjectHandle & /*ob_handle*/, ResourceHand
return;
}
PassMain::Sub &ps = material_pass.sub_pass->sub(ob->id.name);
PassSimple::Sub &ps = material_pass.sub_pass->sub(ob->id.name);
if (volume_sub_pass(ps, inst_.scene, ob, material_pass.gpumat)) {
/* TODO (Miguel Pozo): Is any equivalent required here?
* DRW_shgroup_add_material_resources(grp, mat); */
@ -359,6 +362,8 @@ void Volumes::end_sync()
dummy_scatter_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, scatter);
dummy_transmit_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, transmit);
return;
#if 0
/* TODO */
scatter_tx_ = dummy_scatter_tx_;

View File

@ -44,14 +44,14 @@ class Volumes {
struct GPUTexture *volume_transmit;
#endif
/* EEVEE_PassList */
PassMain world_ps_ = {"Volumes.World"};
PassMain objects_ps_ = {"Volumes.Objects"};
PassMain scatter_ps_ = {"Volumes.Scatter"};
PassMain integration_ps_ = {"Volumes.Integration"};
PassMain resolve_ps_ = {"Volumes.Resolve"};
PassMain accum_ps_ = {"Volumes.Accum"};
PassSimple world_ps_ = {"Volumes.World"};
PassSimple objects_ps_ = {"Volumes.Objects"};
PassSimple scatter_ps_ = {"Volumes.Scatter"};
PassSimple integration_ps_ = {"Volumes.Integration"};
PassSimple resolve_ps_ = {"Volumes.Resolve"};
PassSimple accum_ps_ = {"Volumes.Accum"};
void bind_common_buffers(PassMain &ps);
void bind_common_buffers(PassSimple &ps);
public:
Volumes(Instance &inst) : inst_(inst){};

View File

@ -12,6 +12,6 @@
namespace blender::draw {
bool volume_sub_pass(PassMain::Sub &ps, Scene *scene, Object *ob, GPUMaterial *gpu_material);
bool volume_sub_pass(PassSimple::Sub &ps, Scene *scene, Object *ob, GPUMaterial *gpu_material);
pragma37 marked this conversation as resolved Outdated

Document functions that returns bool. Even more so when the function name is not explict.

Document functions that returns bool. Even more so when the function name is not explict.
pragma37 marked this conversation as resolved Outdated

I think it is better to create the subpass and return a pointer (or nullptr if nothing to draw). It is clearer what is the inputs and outputs.

I think it is better to create the subpass and return a pointer (or nullptr if nothing to draw). It is clearer what is the inputs and outputs.
} // namespace blender::draw

View File

@ -281,7 +281,7 @@ DRWShadingGroup *DRW_shgroup_volume_create_sub(Scene *scene,
namespace blender::draw {
static bool volume_world_grids_init(PassMain::Sub &ps,
static bool volume_world_grids_init(PassSimple::Sub &ps,
ListBaseWrapper<GPUMaterialAttribute> &attrs)
{
for (const GPUMaterialAttribute *attr : attrs) {
@ -291,7 +291,7 @@ static bool volume_world_grids_init(PassMain::Sub &ps,
return true;
}
static bool volume_object_grids_init(PassMain::Sub &ps,
static bool volume_object_grids_init(PassSimple::Sub &ps,
Object *ob,
ListBaseWrapper<GPUMaterialAttribute> &attrs)
{
@ -347,7 +347,7 @@ static bool volume_object_grids_init(PassMain::Sub &ps,
return true;
}
static bool drw_volume_object_mesh_init(PassMain::Sub &ps,
static bool drw_volume_object_mesh_init(PassSimple::Sub &ps,
Scene *scene,
Object *ob,
ListBaseWrapper<GPUMaterialAttribute> &attrs)
@ -421,7 +421,7 @@ static bool drw_volume_object_mesh_init(PassMain::Sub &ps,
return true;
}
bool volume_sub_pass(PassMain::Sub &ps, Scene *scene, Object *ob, GPUMaterial *gpu_material)
bool volume_sub_pass(PassSimple::Sub &ps, Scene *scene, Object *ob, GPUMaterial *gpu_material)
{
ListBase attr_list = GPU_material_attributes(gpu_material);
ListBaseWrapper<GPUMaterialAttribute> attrs(attr_list);