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.
This commit is contained in:
parent
72cb452937
commit
b097e7f510
2 changed files with 7 additions and 5 deletions
|
@ -812,7 +812,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
|
||||||
// When using split command lists, this is
|
// When using split command lists, this is
|
||||||
// implemented internally using secondary command
|
// implemented internally using secondary command
|
||||||
// buffers. As they can be created in threads,
|
// buffers. As they can be created in threads,
|
||||||
// each needs it's own command pool.
|
// each needs its own command pool.
|
||||||
|
|
||||||
struct SplitDrawListAllocator {
|
struct SplitDrawListAllocator {
|
||||||
VkCommandPool command_pool = VK_NULL_HANDLE;
|
VkCommandPool command_pool = VK_NULL_HANDLE;
|
||||||
|
|
|
@ -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) {
|
if (material.is_null() && ci->canvas_group != nullptr) {
|
||||||
material = default_canvas_group_material;
|
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()) {
|
RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material;
|
||||||
MaterialData *md = (MaterialData *)storage->material_get_data(ci->material, RendererStorageRD::SHADER_TYPE_2D);
|
|
||||||
|
if (material.is_valid()) {
|
||||||
|
MaterialData *md = (MaterialData *)storage->material_get_data(material, RendererStorageRD::SHADER_TYPE_2D);
|
||||||
if (md && md->shader_data->valid) {
|
if (md && md->shader_data->valid) {
|
||||||
if (md->shader_data->uses_screen_texture && canvas_group_owner == nullptr) {
|
if (md->shader_data->uses_screen_texture && canvas_group_owner == nullptr) {
|
||||||
if (!material_screen_texture_found) {
|
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)) {
|
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
|
// 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.
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue