Forbid passing multiview sampler to the custom function in shaders
This commit is contained in:
parent
6cde3fac32
commit
94831c7209
@ -198,7 +198,11 @@ void RasterizerGLES3::finalize() {
|
|||||||
memdelete(config);
|
memdelete(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RasterizerGLES3 *RasterizerGLES3::singleton = nullptr;
|
||||||
|
|
||||||
RasterizerGLES3::RasterizerGLES3() {
|
RasterizerGLES3::RasterizerGLES3() {
|
||||||
|
singleton = this;
|
||||||
|
|
||||||
#ifdef GLAD_ENABLED
|
#ifdef GLAD_ENABLED
|
||||||
if (!gladLoaderLoadGL()) {
|
if (!gladLoaderLoadGL()) {
|
||||||
ERR_PRINT("Error initializing GLAD");
|
ERR_PRINT("Error initializing GLAD");
|
||||||
|
@ -67,6 +67,7 @@ protected:
|
|||||||
GLES3::CopyEffects *copy_effects = nullptr;
|
GLES3::CopyEffects *copy_effects = nullptr;
|
||||||
RasterizerCanvasGLES3 *canvas = nullptr;
|
RasterizerCanvasGLES3 *canvas = nullptr;
|
||||||
RasterizerSceneGLES3 *scene = 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);
|
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_frame_delta_time() const { return delta; }
|
||||||
_ALWAYS_INLINE_ double get_total_time() const { return time_total; }
|
_ALWAYS_INLINE_ double get_total_time() const { return time_total; }
|
||||||
|
|
||||||
|
static RasterizerGLES3 *get_singleton() { return singleton; }
|
||||||
RasterizerGLES3();
|
RasterizerGLES3();
|
||||||
~RasterizerGLES3();
|
~RasterizerGLES3();
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "texture_storage.h"
|
#include "texture_storage.h"
|
||||||
|
|
||||||
#include "drivers/gles3/rasterizer_canvas_gles3.h"
|
#include "drivers/gles3/rasterizer_canvas_gles3.h"
|
||||||
|
#include "drivers/gles3/rasterizer_gles3.h"
|
||||||
|
|
||||||
using namespace GLES3;
|
using namespace GLES3;
|
||||||
|
|
||||||
@ -1721,7 +1722,7 @@ MaterialStorage::MaterialStorage() {
|
|||||||
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
|
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
|
||||||
actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
|
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";
|
actions.global_buffer_array_variable = "global_shader_uniforms";
|
||||||
|
|
||||||
shaders.compiler_scene.initialize(actions);
|
shaders.compiler_scene.initialize(actions);
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "servers/xr_server.h"
|
#include "servers/xr_server.h"
|
||||||
|
|
||||||
|
RendererCompositor *RendererCompositor::singleton = nullptr;
|
||||||
|
|
||||||
RendererCompositor *(*RendererCompositor::_create_func)() = nullptr;
|
RendererCompositor *(*RendererCompositor::_create_func)() = nullptr;
|
||||||
bool RendererCompositor::low_end = false;
|
bool RendererCompositor::low_end = false;
|
||||||
|
|
||||||
@ -47,6 +49,8 @@ bool RendererCompositor::is_xr_enabled() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RendererCompositor::RendererCompositor() {
|
RendererCompositor::RendererCompositor() {
|
||||||
|
singleton = this;
|
||||||
|
|
||||||
if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {
|
if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {
|
||||||
xr_enabled = GLOBAL_GET("xr/shaders/enabled");
|
xr_enabled = GLOBAL_GET("xr/shaders/enabled");
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,6 +70,7 @@ struct BlitToScreen {
|
|||||||
class RendererCompositor {
|
class RendererCompositor {
|
||||||
private:
|
private:
|
||||||
bool xr_enabled = false;
|
bool xr_enabled = false;
|
||||||
|
static RendererCompositor *singleton;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static RendererCompositor *(*_create_func)();
|
static RendererCompositor *(*_create_func)();
|
||||||
@ -107,6 +108,7 @@ public:
|
|||||||
static bool is_low_end() { return low_end; };
|
static bool is_low_end() { return low_end; };
|
||||||
virtual bool is_xr_enabled() const;
|
virtual bool is_xr_enabled() const;
|
||||||
|
|
||||||
|
static RendererCompositor *get_singleton() { return singleton; }
|
||||||
RendererCompositor();
|
RendererCompositor();
|
||||||
virtual ~RendererCompositor() {}
|
virtual ~RendererCompositor() {}
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
|
|||||||
|
|
||||||
copy_to_fb.shader.initialize(copy_modes);
|
copy_to_fb.shader.initialize(copy_modes);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
copy_to_fb.shader.set_variant_enabled(COPY_TO_FB_MULTIVIEW, false);
|
copy_to_fb.shader.set_variant_enabled(COPY_TO_FB_MULTIVIEW, false);
|
||||||
copy_to_fb.shader.set_variant_enabled(COPY_TO_FB_MULTIVIEW_WITH_DEPTH, false);
|
copy_to_fb.shader.set_variant_enabled(COPY_TO_FB_MULTIVIEW_WITH_DEPTH, false);
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
|
|||||||
|
|
||||||
specular_merge.shader.initialize(specular_modes);
|
specular_merge.shader.initialize(specular_modes);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_ADD_MULTIVIEW, false);
|
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_ADD_MULTIVIEW, false);
|
||||||
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_SSR_MULTIVIEW, false);
|
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_SSR_MULTIVIEW, false);
|
||||||
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_ADDITIVE_ADD_MULTIVIEW, false);
|
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_ADDITIVE_ADD_MULTIVIEW, false);
|
||||||
|
@ -56,7 +56,7 @@ ToneMapper::ToneMapper() {
|
|||||||
|
|
||||||
tonemap.shader.initialize(tonemap_modes);
|
tonemap.shader.initialize(tonemap_modes);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
tonemap.shader.set_variant_enabled(TONEMAP_MODE_NORMAL_MULTIVIEW, false);
|
tonemap.shader.set_variant_enabled(TONEMAP_MODE_NORMAL_MULTIVIEW, false);
|
||||||
tonemap.shader.set_variant_enabled(TONEMAP_MODE_BICUBIC_GLOW_FILTER_MULTIVIEW, false);
|
tonemap.shader.set_variant_enabled(TONEMAP_MODE_BICUBIC_GLOW_FILTER_MULTIVIEW, false);
|
||||||
tonemap.shader.set_variant_enabled(TONEMAP_MODE_1D_LUT_MULTIVIEW, false);
|
tonemap.shader.set_variant_enabled(TONEMAP_MODE_1D_LUT_MULTIVIEW, false);
|
||||||
|
@ -44,7 +44,7 @@ VRS::VRS() {
|
|||||||
|
|
||||||
vrs_shader.shader.initialize(vrs_modes);
|
vrs_shader.shader.initialize(vrs_modes);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
vrs_shader.shader.set_variant_enabled(VRS_MULTIVIEW, false);
|
vrs_shader.shader.set_variant_enabled(VRS_MULTIVIEW, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
|
|||||||
int mipmaps = p_mipmaps;
|
int mipmaps = p_mipmaps;
|
||||||
uint32_t w = p_size, h = p_size;
|
uint32_t w = p_size, h = p_size;
|
||||||
|
|
||||||
EffectsRD *effects = RendererCompositorRD::singleton->get_effects();
|
EffectsRD *effects = RendererCompositorRD::get_singleton()->get_effects();
|
||||||
ERR_FAIL_NULL_MSG(effects, "Effects haven't been initialized");
|
ERR_FAIL_NULL_MSG(effects, "Effects haven't been initialized");
|
||||||
bool prefer_raster_effects = effects->get_prefer_raster_effects();
|
bool prefer_raster_effects = effects->get_prefer_raster_effects();
|
||||||
|
|
||||||
@ -756,7 +756,7 @@ void SkyRD::init() {
|
|||||||
|
|
||||||
sky_shader.shader.initialize(sky_modes, defines);
|
sky_shader.shader.initialize(sky_modes, defines);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
sky_shader.shader.set_variant_enabled(SKY_VERSION_BACKGROUND_MULTIVIEW, false);
|
sky_shader.shader.set_variant_enabled(SKY_VERSION_BACKGROUND_MULTIVIEW, false);
|
||||||
sky_shader.shader.set_variant_enabled(SKY_VERSION_HALF_RES_MULTIVIEW, false);
|
sky_shader.shader.set_variant_enabled(SKY_VERSION_HALF_RES_MULTIVIEW, false);
|
||||||
sky_shader.shader.set_variant_enabled(SKY_VERSION_QUARTER_RES_MULTIVIEW, false);
|
sky_shader.shader.set_variant_enabled(SKY_VERSION_QUARTER_RES_MULTIVIEW, false);
|
||||||
|
@ -504,7 +504,7 @@ void SceneShaderForwardClustered::init(const String p_defines) {
|
|||||||
|
|
||||||
shader.initialize(shader_versions, p_defines);
|
shader.initialize(shader_versions, p_defines);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_MULTIVIEW, false);
|
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_MULTIVIEW, false);
|
||||||
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW, false);
|
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW, false);
|
||||||
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW, false);
|
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW, false);
|
||||||
@ -730,7 +730,7 @@ void SceneShaderForwardClustered::init(const String p_defines) {
|
|||||||
actions.global_buffer_array_variable = "global_shader_uniforms.data";
|
actions.global_buffer_array_variable = "global_shader_uniforms.data";
|
||||||
actions.instance_uniform_index_variable = "instances.data[instance_index_interp].instance_uniforms_ofs";
|
actions.instance_uniform_index_variable = "instances.data[instance_index_interp].instance_uniforms_ofs";
|
||||||
|
|
||||||
actions.check_multiview_samplers = true; // make sure we check sampling multiview textures
|
actions.check_multiview_samplers = RendererCompositorRD::get_singleton()->is_xr_enabled(); // Make sure we check sampling multiview textures.
|
||||||
|
|
||||||
compiler.initialize(actions);
|
compiler.initialize(actions);
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
|
|||||||
|
|
||||||
shader.initialize(shader_versions, p_defines);
|
shader.initialize(shader_versions, p_defines);
|
||||||
|
|
||||||
if (!RendererCompositorRD::singleton->is_xr_enabled()) {
|
if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
|
||||||
shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_MULTIVIEW, false);
|
shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_MULTIVIEW, false);
|
||||||
shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW, false);
|
shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW, false);
|
||||||
shader.set_variant_enabled(SHADER_VERSION_SHADOW_PASS_MULTIVIEW, false);
|
shader.set_variant_enabled(SHADER_VERSION_SHADOW_PASS_MULTIVIEW, false);
|
||||||
@ -610,7 +610,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
|
|||||||
actions.instance_uniform_index_variable = "draw_call.instance_uniforms_ofs";
|
actions.instance_uniform_index_variable = "draw_call.instance_uniforms_ofs";
|
||||||
|
|
||||||
actions.apply_luminance_multiplier = true; // apply luminance multiplier to screen texture
|
actions.apply_luminance_multiplier = true; // apply luminance multiplier to screen texture
|
||||||
actions.check_multiview_samplers = true; // make sure we check sampling multiview textures
|
actions.check_multiview_samplers = RendererCompositorRD::get_singleton()->is_xr_enabled(); // Make sure we check sampling multiview textures.
|
||||||
|
|
||||||
compiler.initialize(actions);
|
compiler.initialize(actions);
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
|
|||||||
} break;
|
} break;
|
||||||
case Item::Command::TYPE_ANIMATION_SLICE: {
|
case Item::Command::TYPE_ANIMATION_SLICE: {
|
||||||
const Item::CommandAnimationSlice *as = static_cast<const Item::CommandAnimationSlice *>(c);
|
const Item::CommandAnimationSlice *as = static_cast<const Item::CommandAnimationSlice *>(c);
|
||||||
double current_time = RendererCompositorRD::singleton->get_total_time();
|
double current_time = RendererCompositorRD::get_singleton()->get_total_time();
|
||||||
double local_time = Math::fposmod(current_time - as->offset, as->animation_length);
|
double local_time = Math::fposmod(current_time - as->offset, as->animation_length);
|
||||||
skipping = !(local_time >= as->slice_begin && local_time < as->slice_end);
|
skipping = !(local_time >= as->slice_begin && local_time < as->slice_end);
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ protected:
|
|||||||
double delta = 0.0;
|
double delta = 0.0;
|
||||||
|
|
||||||
static uint64_t frame;
|
static uint64_t frame;
|
||||||
|
static RendererCompositorRD *singleton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RendererUtilities *get_utilities() { return utilities; };
|
RendererUtilities *get_utilities() { return utilities; };
|
||||||
@ -145,7 +146,7 @@ public:
|
|||||||
low_end = false;
|
low_end = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RendererCompositorRD *singleton;
|
static RendererCompositorRD *get_singleton() { return singleton; }
|
||||||
RendererCompositorRD();
|
RendererCompositorRD();
|
||||||
~RendererCompositorRD();
|
~RendererCompositorRD();
|
||||||
};
|
};
|
||||||
|
@ -774,7 +774,7 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
|
|||||||
|
|
||||||
p_particles->phase = new_phase;
|
p_particles->phase = new_phase;
|
||||||
|
|
||||||
frame_params.time = RendererCompositorRD::singleton->get_total_time();
|
frame_params.time = RendererCompositorRD::get_singleton()->get_total_time();
|
||||||
frame_params.delta = p_delta * p_particles->speed_scale;
|
frame_params.delta = p_delta * p_particles->speed_scale;
|
||||||
frame_params.random_seed = p_particles->random_seed;
|
frame_params.random_seed = p_particles->random_seed;
|
||||||
frame_params.explosiveness = p_particles->explosiveness;
|
frame_params.explosiveness = p_particles->explosiveness;
|
||||||
@ -1228,7 +1228,7 @@ void ParticlesStorage::particles_set_view_axis(RID p_particles, const Vector3 &p
|
|||||||
RD::get_singleton()->compute_list_dispatch_threads(compute_list, particles->amount, 1, 1);
|
RD::get_singleton()->compute_list_dispatch_threads(compute_list, particles->amount, 1, 1);
|
||||||
|
|
||||||
RD::get_singleton()->compute_list_end();
|
RD::get_singleton()->compute_list_end();
|
||||||
RendererCompositorRD::singleton->get_effects()->sort_buffer(particles->particles_sort_uniform_set, particles->amount);
|
RendererCompositorRD::get_singleton()->get_effects()->sort_buffer(particles->particles_sort_uniform_set, particles->amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (particles->trails_enabled && particles->trail_bind_poses.size() > 1) {
|
if (particles->trails_enabled && particles->trail_bind_poses.size() > 1) {
|
||||||
@ -1341,7 +1341,7 @@ void ParticlesStorage::update_particles() {
|
|||||||
particles->inactive = false;
|
particles->inactive = false;
|
||||||
particles->inactive_time = 0;
|
particles->inactive_time = 0;
|
||||||
} else {
|
} else {
|
||||||
particles->inactive_time += particles->speed_scale * RendererCompositorRD::singleton->get_frame_delta_time();
|
particles->inactive_time += particles->speed_scale * RendererCompositorRD::get_singleton()->get_frame_delta_time();
|
||||||
if (particles->inactive_time > particles->lifetime * 1.2) {
|
if (particles->inactive_time > particles->lifetime * 1.2) {
|
||||||
particles->inactive = true;
|
particles->inactive = true;
|
||||||
continue;
|
continue;
|
||||||
@ -1442,7 +1442,7 @@ void ParticlesStorage::update_particles() {
|
|||||||
frame_time = 1.0 / fixed_fps;
|
frame_time = 1.0 / fixed_fps;
|
||||||
decr = frame_time;
|
decr = frame_time;
|
||||||
}
|
}
|
||||||
double delta = RendererCompositorRD::singleton->get_frame_delta_time();
|
double delta = RendererCompositorRD::get_singleton()->get_frame_delta_time();
|
||||||
if (delta > 0.1) { //avoid recursive stalls if fps goes below 10
|
if (delta > 0.1) { //avoid recursive stalls if fps goes below 10
|
||||||
delta = 0.1;
|
delta = 0.1;
|
||||||
} else if (delta <= 0.0) { //unlikely but..
|
} else if (delta <= 0.0) { //unlikely but..
|
||||||
@ -1461,7 +1461,7 @@ void ParticlesStorage::update_particles() {
|
|||||||
if (zero_time_scale) {
|
if (zero_time_scale) {
|
||||||
_particles_process(particles, 0.0);
|
_particles_process(particles, 0.0);
|
||||||
} else {
|
} else {
|
||||||
_particles_process(particles, RendererCompositorRD::singleton->get_frame_delta_time());
|
_particles_process(particles, RendererCompositorRD::get_singleton()->get_frame_delta_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/templates/local_vector.h"
|
#include "core/templates/local_vector.h"
|
||||||
|
#include "servers/rendering/renderer_compositor.h"
|
||||||
#include "servers/rendering_server.h"
|
#include "servers/rendering_server.h"
|
||||||
#include "shader_types.h"
|
#include "shader_types.h"
|
||||||
|
|
||||||
@ -3055,7 +3056,7 @@ const ShaderLanguage::BuiltinFuncConstArgs ShaderLanguage::builtin_func_const_ar
|
|||||||
|
|
||||||
bool ShaderLanguage::is_const_suffix_lut_initialized = false;
|
bool ShaderLanguage::is_const_suffix_lut_initialized = false;
|
||||||
|
|
||||||
bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str) {
|
bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str, bool *r_is_custom_function) {
|
||||||
ERR_FAIL_COND_V(p_func->op != OP_CALL && p_func->op != OP_CONSTRUCT, false);
|
ERR_FAIL_COND_V(p_func->op != OP_CALL && p_func->op != OP_CONSTRUCT, false);
|
||||||
|
|
||||||
Vector<DataType> args;
|
Vector<DataType> args;
|
||||||
@ -3479,6 +3480,9 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const FunctionI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r_is_custom_function) {
|
||||||
|
*r_is_custom_function = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5251,7 +5255,8 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_validate_function_call(p_block, p_function_info, func, &func->return_cache, &func->struct_name)) {
|
bool is_custom_func = false;
|
||||||
|
if (!_validate_function_call(p_block, p_function_info, func, &func->return_cache, &func->struct_name, &is_custom_func)) {
|
||||||
_set_error(vformat(RTR("No matching function found for: '%s'."), String(funcname->name)));
|
_set_error(vformat(RTR("No matching function found for: '%s'."), String(funcname->name)));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -5391,6 +5396,16 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
|
|||||||
//being sampler, this either comes from a uniform
|
//being sampler, this either comes from a uniform
|
||||||
ShaderNode::Uniform *u = &shader->uniforms[varname];
|
ShaderNode::Uniform *u = &shader->uniforms[varname];
|
||||||
ERR_CONTINUE(u->type != call_function->arguments[i].type); //this should have been validated previously
|
ERR_CONTINUE(u->type != call_function->arguments[i].type); //this should have been validated previously
|
||||||
|
|
||||||
|
if (RendererCompositor::get_singleton()->is_xr_enabled() && is_custom_func) {
|
||||||
|
ShaderNode::Uniform::Hint hint = u->hint;
|
||||||
|
|
||||||
|
if (hint == ShaderNode::Uniform::HINT_DEPTH_TEXTURE || hint == ShaderNode::Uniform::HINT_SCREEN_TEXTURE || hint == ShaderNode::Uniform::HINT_NORMAL_ROUGHNESS_TEXTURE) {
|
||||||
|
_set_error(vformat(RTR("Unable to pass a multiview texture sampler as a parameter to custom function. Consider to sample it in the main function and then pass the vector result to it."), get_uniform_hint_name(hint)));
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//propagate
|
//propagate
|
||||||
if (!_propagate_function_call_sampler_uniform_settings(name, i, u->filter, u->repeat)) {
|
if (!_propagate_function_call_sampler_uniform_settings(name, i, u->filter, u->repeat)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1088,7 +1088,7 @@ private:
|
|||||||
bool _compare_datatypes(DataType p_datatype_a, String p_datatype_name_a, int p_array_size_a, DataType p_datatype_b, String p_datatype_name_b, int p_array_size_b);
|
bool _compare_datatypes(DataType p_datatype_a, String p_datatype_name_a, int p_array_size_a, DataType p_datatype_b, String p_datatype_name_b, int p_array_size_b);
|
||||||
bool _compare_datatypes_in_nodes(Node *a, Node *b);
|
bool _compare_datatypes_in_nodes(Node *a, Node *b);
|
||||||
|
|
||||||
bool _validate_function_call(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str);
|
bool _validate_function_call(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str, bool *r_is_custom_function = nullptr);
|
||||||
bool _parse_function_arguments(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, int *r_complete_arg = nullptr);
|
bool _parse_function_arguments(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, int *r_complete_arg = nullptr);
|
||||||
bool _propagate_function_call_sampler_uniform_settings(StringName p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat);
|
bool _propagate_function_call_sampler_uniform_settings(StringName p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat);
|
||||||
bool _propagate_function_call_sampler_builtin_reference(StringName p_name, int p_argument, const StringName &p_builtin);
|
bool _propagate_function_call_sampler_builtin_reference(StringName p_name, int p_argument, const StringName &p_builtin);
|
||||||
|
Loading…
Reference in New Issue
Block a user