summaryrefslogtreecommitdiffstats
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/audio_server.h2
-rw-r--r--servers/display_server.cpp2
-rw-r--r--servers/display_server.h2
-rw-r--r--servers/display_server_headless.h2
-rw-r--r--servers/rendering/shader_compiler.cpp7
-rw-r--r--servers/rendering/shader_language.cpp19
-rw-r--r--servers/rendering/shader_language.h75
7 files changed, 62 insertions, 47 deletions
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 84c091e320..fd6cdb451e 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -329,7 +329,7 @@ private:
friend class AudioDriver;
void _driver_process(int p_frames, int32_t *p_buffer);
- LocalVector<Ref<AudioStreamPlayback>> sample_playback_list;
+ LocalVector<Ref<AudioSamplePlayback>> sample_playback_list;
protected:
static void _bind_methods();
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index d362a4073a..5451057645 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -570,7 +570,7 @@ int DisplayServer::get_screen_from_rect(const Rect2 &p_rect) const {
return pos_screen;
}
-DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect) {
+DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect, bool p_exclusive, WindowID p_transient_parent) {
ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server.");
}
diff --git a/servers/display_server.h b/servers/display_server.h
index 8c7e92fdc3..d0fe76faff 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -396,7 +396,7 @@ public:
WINDOW_FLAG_MOUSE_PASSTHROUGH_BIT = (1 << WINDOW_FLAG_MOUSE_PASSTHROUGH),
};
- virtual WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i());
+ virtual WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i(), bool p_exclusive = false, WindowID p_transient_parent = INVALID_WINDOW_ID);
virtual void show_window(WindowID p_id);
virtual void delete_sub_window(WindowID p_id);
diff --git a/servers/display_server_headless.h b/servers/display_server_headless.h
index 60422c16cc..a5277479ca 100644
--- a/servers/display_server_headless.h
+++ b/servers/display_server_headless.h
@@ -85,7 +85,7 @@ public:
Vector<DisplayServer::WindowID> get_window_list() const override { return Vector<DisplayServer::WindowID>(); }
- WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i()) override { return 0; }
+ WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i(), bool p_exclusive = false, WindowID p_transient_parent = INVALID_WINDOW_ID) override { return 0; }
void show_window(WindowID p_id) override {}
void delete_sub_window(WindowID p_id) override {}
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp
index a4ee33ecc0..2542f2eed7 100644
--- a/servers/rendering/shader_compiler.cpp
+++ b/servers/rendering/shader_compiler.cpp
@@ -1286,6 +1286,13 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
break;
}
if (function->arguments[j].tex_argument_check) {
+ if (function->arguments[j].tex_hint == ShaderLanguage::ShaderNode::Uniform::HINT_SCREEN_TEXTURE) {
+ is_screen_texture = true;
+ } else if (function->arguments[j].tex_hint == ShaderLanguage::ShaderNode::Uniform::HINT_DEPTH_TEXTURE) {
+ is_depth_texture = true;
+ } else if (function->arguments[j].tex_hint == ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL_ROUGHNESS_TEXTURE) {
+ is_normal_roughness_texture = true;
+ }
sampler_name = _get_sampler_name(function->arguments[j].tex_argument_filter, function->arguments[j].tex_argument_repeat);
found = true;
break;
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 745dcf5392..10c1158d95 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -4761,7 +4761,7 @@ bool ShaderLanguage::_validate_assign(Node *p_node, const FunctionInfo &p_functi
return false;
}
-bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(const StringName &p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat) {
+bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(const StringName &p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat, ShaderNode::Uniform::Hint p_hint) {
for (int i = 0; i < shader->vfunctions.size(); i++) {
if (shader->vfunctions[i].name == p_name) {
ERR_FAIL_INDEX_V(p_argument, shader->vfunctions[i].function->arguments.size(), false);
@@ -4770,20 +4770,21 @@ bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(const Str
_set_error(vformat(RTR("Sampler argument %d of function '%s' called more than once using both built-ins and uniform textures, this is not supported (use either one or the other)."), p_argument, String(p_name)));
return false;
} else if (arg->tex_argument_check) {
- //was checked, verify that filter and repeat are the same
- if (arg->tex_argument_filter == p_filter && arg->tex_argument_repeat == p_repeat) {
+ // Was checked, verify that filter, repeat, and hint are the same.
+ if (arg->tex_argument_filter == p_filter && arg->tex_argument_repeat == p_repeat && arg->tex_hint == p_hint) {
return true;
} else {
- _set_error(vformat(RTR("Sampler argument %d of function '%s' called more than once using textures that differ in either filter or repeat setting."), p_argument, String(p_name)));
+ _set_error(vformat(RTR("Sampler argument %d of function '%s' called more than once using textures that differ in either filter, repeat, or texture hint setting."), p_argument, String(p_name)));
return false;
}
} else {
arg->tex_argument_check = true;
arg->tex_argument_filter = p_filter;
arg->tex_argument_repeat = p_repeat;
+ arg->tex_hint = p_hint;
for (KeyValue<StringName, HashSet<int>> &E : arg->tex_argument_connect) {
for (const int &F : E.value) {
- if (!_propagate_function_call_sampler_uniform_settings(E.key, F, p_filter, p_repeat)) {
+ if (!_propagate_function_call_sampler_uniform_settings(E.key, F, p_filter, p_repeat, p_hint)) {
return false;
}
}
@@ -5583,7 +5584,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
//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, u->hint)) {
return nullptr;
}
} else if (p_function_info.built_ins.has(varname)) {
@@ -7411,6 +7412,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
return ERR_PARSE_ERROR;
}
tk = _get_token();
+ } else {
+ _set_expected_error("(");
+ return ERR_PARSE_ERROR;
}
}
} else {
@@ -9520,6 +9524,9 @@ Error ShaderLanguage::_parse_shader(const HashMap<StringName, FunctionInfo> &p_f
_set_error(RTR("Array size mismatch."));
return ERR_PARSE_ERROR;
}
+ } else {
+ _set_expected_error("(");
+ return ERR_PARSE_ERROR;
}
array_size = constant.array_size;
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h
index bc0aa0558a..40f524ec9d 100644
--- a/servers/rendering/shader_language.h
+++ b/servers/rendering/shader_language.h
@@ -578,42 +578,6 @@ public:
Node(NODE_TYPE_STRUCT) {}
};
- struct FunctionNode : public Node {
- struct Argument {
- ArgumentQualifier qualifier;
- StringName name;
- DataType type;
- StringName struct_name;
- DataPrecision precision;
- //for passing textures as arguments
- bool tex_argument_check;
- TextureFilter tex_argument_filter;
- TextureRepeat tex_argument_repeat;
- bool tex_builtin_check;
- StringName tex_builtin;
- bool is_const;
- int array_size;
-
- HashMap<StringName, HashSet<int>> tex_argument_connect;
- };
-
- StringName name;
- DataType return_type = TYPE_VOID;
- StringName return_struct_name;
- DataPrecision return_precision = PRECISION_DEFAULT;
- int return_array_size = 0;
- Vector<Argument> arguments;
- BlockNode *body = nullptr;
- bool can_discard = false;
-
- virtual DataType get_datatype() const override { return return_type; }
- virtual String get_datatype_name() const override { return String(return_struct_name); }
- virtual int get_array_size() const override { return return_array_size; }
-
- FunctionNode() :
- Node(NODE_TYPE_FUNCTION) {}
- };
-
struct ShaderNode : public Node {
struct Constant {
StringName name;
@@ -722,6 +686,43 @@ public:
Node(NODE_TYPE_SHADER) {}
};
+ struct FunctionNode : public Node {
+ struct Argument {
+ ArgumentQualifier qualifier;
+ StringName name;
+ DataType type;
+ StringName struct_name;
+ DataPrecision precision;
+ //for passing textures as arguments
+ bool tex_argument_check;
+ TextureFilter tex_argument_filter;
+ TextureRepeat tex_argument_repeat;
+ bool tex_builtin_check;
+ StringName tex_builtin;
+ ShaderNode::Uniform::Hint tex_hint;
+ bool is_const;
+ int array_size;
+
+ HashMap<StringName, HashSet<int>> tex_argument_connect;
+ };
+
+ StringName name;
+ DataType return_type = TYPE_VOID;
+ StringName return_struct_name;
+ DataPrecision return_precision = PRECISION_DEFAULT;
+ int return_array_size = 0;
+ Vector<Argument> arguments;
+ BlockNode *body = nullptr;
+ bool can_discard = false;
+
+ virtual DataType get_datatype() const override { return return_type; }
+ virtual String get_datatype_name() const override { return String(return_struct_name); }
+ virtual int get_array_size() const override { return return_array_size; }
+
+ FunctionNode() :
+ Node(NODE_TYPE_FUNCTION) {}
+ };
+
struct UniformOrderComparator {
_FORCE_INLINE_ bool operator()(const Pair<StringName, int> &A, const Pair<StringName, int> &B) const {
return A.second < B.second;
@@ -1122,7 +1123,7 @@ private:
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 _propagate_function_call_sampler_uniform_settings(const StringName &p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat);
+ bool _propagate_function_call_sampler_uniform_settings(const StringName &p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat, ShaderNode::Uniform::Hint p_hint);
bool _propagate_function_call_sampler_builtin_reference(const StringName &p_name, int p_argument, const StringName &p_builtin);
bool _validate_varying_assign(ShaderNode::Varying &p_varying, String *r_message);
bool _check_node_constness(const Node *p_node) const;