summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYuri Rubinsky <chaosus89@gmail.com>2023-01-29 12:14:22 +0300
committerYuri Rubinsky <chaosus89@gmail.com>2023-02-21 11:23:17 +0300
commit94831c7209334ea036dec8edbd235b34453083e2 (patch)
treee1756a8f6a6a4e83a1a40b04c778887428518ffa /drivers
parent6cde3fac328e97e66b1c12d386deb25af395e215 (diff)
Forbid passing multiview sampler to the custom function in shaders
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp4
-rw-r--r--drivers/gles3/rasterizer_gles3.h2
-rw-r--r--drivers/gles3/storage/material_storage.cpp3
3 files changed, 8 insertions, 1 deletions
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);