Viewport Compositor: Allow access to depth pass
This patch allows access to the depth pass in the Viewport Compositor. Since the depth information require full precision, making use of the pass requires the full precision option for now. In the future, this pass will always be stored using full precision regardless of the precision option.
This commit is contained in:
parent
f27aee857b
commit
c5eb420c74
|
@ -161,12 +161,22 @@ class Context : public realtime_compositor::Context {
|
|||
|
||||
GPUTexture *get_input_texture(const Scene *scene, int view_layer, const char *pass_name) override
|
||||
{
|
||||
if ((DEG_get_original_id(const_cast<ID *>(&scene->id)) ==
|
||||
DEG_get_original_id(&DRW_context_state_get()->scene->id)) &&
|
||||
view_layer == 0 && STREQ(pass_name, RE_PASSNAME_COMBINED))
|
||||
if (DEG_get_original_id(const_cast<ID *>(&scene->id)) !=
|
||||
DEG_get_original_id(&DRW_context_state_get()->scene->id))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (view_layer != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (STREQ(pass_name, RE_PASSNAME_COMBINED)) {
|
||||
return get_output_texture();
|
||||
}
|
||||
else if (STREQ(pass_name, RE_PASSNAME_Z)) {
|
||||
return DRW_viewport_texture_list_get()->depth;
|
||||
}
|
||||
else {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue