summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorTechnoPorg <jonah.janzen@gmail.com>2021-08-12 20:45:44 -0600
committerTechnoPorg <jonah.janzen@gmail.com>2021-08-17 09:08:56 -0600
commitb097e7f510779a73b189a75a343e105a7c42b6ef (patch)
tree54f3e7be4f96d583a66bf5ea6eab27dea9aacb1c /servers/rendering
parent72cb4529375de4e3c7511cb7be4ffe8e0103d8ca (diff)
Vulkan: Fix CanvasItem::use_parent_material
The "Use Parent Material" option now does something when enabled on a CanvasItem. As before, it's not just limited to a node's direct parent but can move up the tree until it finds a material. Also corrected a typo in rendering_device_vulkan.h that didn't merit its own commit.
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index f8aefdb29c..bd06f54816 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -1078,7 +1078,7 @@ void RendererCanvasRenderRD::_render_items(RID p_to_render_target, int p_item_co
}
}
- RID material = ci->material;
+ RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material;
if (material.is_null() && ci->canvas_group != nullptr) {
material = default_canvas_group_material;
@@ -1346,8 +1346,10 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
}
}
- if (ci->material.is_valid()) {
- MaterialData *md = (MaterialData *)storage->material_get_data(ci->material, RendererStorageRD::SHADER_TYPE_2D);
+ RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material;
+
+ if (material.is_valid()) {
+ MaterialData *md = (MaterialData *)storage->material_get_data(material, RendererStorageRD::SHADER_TYPE_2D);
if (md && md->shader_data->valid) {
if (md->shader_data->uses_screen_texture && canvas_group_owner == nullptr) {
if (!material_screen_texture_found) {
@@ -1367,7 +1369,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
if (!RD::get_singleton()->uniform_set_is_valid(md->uniform_set)) {
// uniform set may be gone because a dependency was erased. In this case, it will happen
// if a texture is deleted, so just re-create it.
- storage->material_force_update_textures(ci->material, RendererStorageRD::SHADER_TYPE_2D);
+ storage->material_force_update_textures(material, RendererStorageRD::SHADER_TYPE_2D);
}
}
}