diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 3 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_gles3.h | 2 | ||||
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 3 | ||||
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 5 |
5 files changed, 14 insertions, 3 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 9c6e6baaec..2f7e68e463 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -224,13 +224,12 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ l = l->next_ptr; ERR_CONTINUE(!clight); } - Transform2D to_light_xform = (p_canvas_transform * l->light_shader_xform).affine_inverse(); Vector2 canvas_light_pos = p_canvas_transform.xform(l->xform.get_origin()); //convert light position to canvas coordinates, as all computation is done in canvas coords to avoid precision loss state.light_uniforms[index].position[0] = canvas_light_pos.x; state.light_uniforms[index].position[1] = canvas_light_pos.y; - _update_transform_2d_to_mat2x4(to_light_xform, state.light_uniforms[index].matrix); + _update_transform_2d_to_mat2x4(l->light_shader_xform.affine_inverse(), state.light_uniforms[index].matrix); _update_transform_2d_to_mat2x4(l->xform_cache.affine_inverse(), state.light_uniforms[index].shadow_matrix); state.light_uniforms[index].height = l->height * (p_canvas_transform.columns[0].length() + p_canvas_transform.columns[1].length()) * 0.5; //approximate height conversion to the canvas size, since all calculations are done in canvas coords to avoid precision loss diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index a9ec48fcd5..7cbce428cb 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -198,7 +198,11 @@ void RasterizerGLES3::finalize() { memdelete(config); } +RasterizerGLES3 *RasterizerGLES3::singleton = nullptr; + RasterizerGLES3::RasterizerGLES3() { + singleton = this; + #ifdef GLAD_ENABLED if (!gladLoaderLoadGL()) { ERR_PRINT("Error initializing GLAD"); diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index 0ba84ce412..e29ccefdbd 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -67,6 +67,7 @@ protected: GLES3::CopyEffects *copy_effects = nullptr; RasterizerCanvasGLES3 *canvas = nullptr; RasterizerSceneGLES3 *scene = nullptr; + static RasterizerGLES3 *singleton; void _blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer, bool p_first = true); @@ -107,6 +108,7 @@ public: _ALWAYS_INLINE_ double get_frame_delta_time() const { return delta; } _ALWAYS_INLINE_ double get_total_time() const { return time_total; } + static RasterizerGLES3 *get_singleton() { return singleton; } RasterizerGLES3(); ~RasterizerGLES3(); }; diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 2c530e3ae6..c585895f4b 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -38,6 +38,7 @@ #include "texture_storage.h" #include "drivers/gles3/rasterizer_canvas_gles3.h" +#include "drivers/gles3/rasterizer_gles3.h" using namespace GLES3; @@ -1721,7 +1722,7 @@ MaterialStorage::MaterialStorage() { actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP; actions.default_repeat = ShaderLanguage::REPEAT_ENABLE; - actions.check_multiview_samplers = true; + actions.check_multiview_samplers = RasterizerGLES3::get_singleton()->is_xr_enabled(); actions.global_buffer_array_variable = "global_shader_uniforms"; shaders.compiler_scene.initialize(actions); diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index b8cea7136d..f185a5cb88 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -101,6 +101,7 @@ VkResult VulkanContext::vkCreateRenderPass2KHR(VkDevice p_device, const VkRender attachments.push_back(att); } + Vector<Vector<VkAttachmentReference>> attachment_references; Vector<VkSubpassDescription> subpasses; for (uint32_t i = 0; i < p_create_info->subpassCount; i++) { // Here we need to do more, again it's just stripping out type and next @@ -124,6 +125,10 @@ VkResult VulkanContext::vkCreateRenderPass2KHR(VkDevice p_device, const VkRender p_create_info->pSubpasses[i].preserveAttachmentCount, /* preserveAttachmentCount */ p_create_info->pSubpasses[i].pPreserveAttachments /* pPreserveAttachments */ }; + attachment_references.push_back(input_attachments); + attachment_references.push_back(color_attachments); + attachment_references.push_back(resolve_attachments); + attachment_references.push_back(depth_attachments); subpasses.push_back(subpass); } |