summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/variant/variant_call.cpp27
-rw-r--r--core/variant/variant_internal.h22
-rw-r--r--core/variant/variant_setget.cpp106
-rw-r--r--doc/classes/RenderingServer.xml3
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--modules/webm/doc_classes/VideoStreamWebm.xml1
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp5
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp28
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.h1
9 files changed, 74 insertions, 121 deletions
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index f6fe642493..13514b7b9f 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -42,27 +42,6 @@
typedef void (*VariantFunc)(Variant &r_ret, Variant &p_self, const Variant **p_args);
typedef void (*VariantConstructFunc)(Variant &r_ret, const Variant **p_args);
-template <class T>
-struct TypeAdjust {
- _FORCE_INLINE_ static void adjust(Variant *r_ret) {
- VariantTypeChanger<typename GetSimpleTypeT<T>::type_t>::change(r_ret);
- }
-};
-
-template <> //do nothing for variant
-struct TypeAdjust<Variant> {
- _FORCE_INLINE_ static void adjust(Variant *r_ret) {
- }
-};
-
-template <> //do nothing for variant
-struct TypeAdjust<Object *> {
- _FORCE_INLINE_ static void adjust(Variant *r_ret) {
- VariantInternal::clear(r_ret);
- *r_ret = (Object *)nullptr;
- }
-};
-
template <class R, class T, class... P>
static _FORCE_INLINE_ void vc_method_call(R (T::*method)(P...), Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) {
call_with_variant_args_ret_dv(VariantGetInternalPtr<T>::get_ptr(base), method, p_args, p_argcount, r_ret, r_error, p_defvals);
@@ -124,12 +103,12 @@ static _FORCE_INLINE_ void vc_ptrcall(void (T::*method)(P...) const, void *p_bas
template <class R, class T, class... P>
static _FORCE_INLINE_ void vc_change_return_type(R (T::*method)(P...), Variant *v) {
- TypeAdjust<R>::adjust(v);
+ VariantTypeAdjust<R>::adjust(v);
}
template <class R, class T, class... P>
static _FORCE_INLINE_ void vc_change_return_type(R (T::*method)(P...) const, Variant *v) {
- TypeAdjust<R>::adjust(v);
+ VariantTypeAdjust<R>::adjust(v);
}
template <class T, class... P>
@@ -144,7 +123,7 @@ static _FORCE_INLINE_ void vc_change_return_type(void (T::*method)(P...) const,
template <class R, class... P>
static _FORCE_INLINE_ void vc_change_return_type(R (*method)(P...), Variant *v) {
- TypeAdjust<R>::adjust(v);
+ VariantTypeAdjust<R>::adjust(v);
}
template <class R, class T, class... P>
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index 3ac7f32dec..3c3be44ef7 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -1128,4 +1128,26 @@ struct VariantTypeChanger {
}
};
+template <class T>
+struct VariantTypeAdjust {
+ _FORCE_INLINE_ static void adjust(Variant *r_ret) {
+ VariantTypeChanger<typename GetSimpleTypeT<T>::type_t>::change(r_ret);
+ }
+};
+
+template <>
+struct VariantTypeAdjust<Variant> {
+ _FORCE_INLINE_ static void adjust(Variant *r_ret) {
+ // Do nothing for variant.
+ }
+};
+
+template <>
+struct VariantTypeAdjust<Object *> {
+ _FORCE_INLINE_ static void adjust(Variant *r_ret) {
+ VariantInternal::clear(r_ret);
+ *r_ret = (Object *)nullptr;
+ }
+};
+
#endif // VARIANT_INTERNAL_H
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index 05fe2b80d9..f6a2c11830 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -41,9 +41,7 @@
#define SETGET_STRUCT(m_base_type, m_member_type, m_member) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
} \
static void ptr_get(const void *base, void *member) { \
@@ -71,9 +69,7 @@
#define SETGET_NUMBER_STRUCT(m_base_type, m_member_type, m_member) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \
} \
static void ptr_get(const void *base, void *member) { \
@@ -104,9 +100,7 @@
#define SETGET_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
} \
static void ptr_get(const void *base, void *member) { \
@@ -134,9 +128,7 @@
#define SETGET_NUMBER_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \
} \
static void ptr_get(const void *base, void *member) { \
@@ -167,9 +159,7 @@
#define SETGET_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
} \
static void ptr_get(const void *base, void *member) { \
@@ -197,9 +187,7 @@
#define SETGET_NUMBER_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \
} \
static void ptr_get(const void *base, void *member) { \
@@ -230,9 +218,7 @@
#define SETGET_STRUCT_FUNC_INDEX(m_base_type, m_member_type, m_member, m_setter, m_getter, m_index) \
struct VariantSetGet_##m_base_type##_##m_member { \
static void get(const Variant *base, Variant *member) { \
- *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(m_index); \
- } \
- static void validated_get(const Variant *base, Variant *member) { \
+ VariantTypeAdjust<m_member_type>::adjust(member); \
*VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(m_index); \
} \
static void ptr_get(const void *base, void *member) { \
@@ -340,7 +326,7 @@ static void register_member(Variant::Type p_type, const StringName &p_member) {
sgi.ptr_setter = T::ptr_set;
sgi.getter = T::get;
- sgi.validated_getter = T::validated_get;
+ sgi.validated_getter = T::get;
sgi.ptr_getter = T::ptr_get;
sgi.member_type = T::get_type();
@@ -605,18 +591,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
oob = true; \
return; \
} \
- *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
- oob = false; \
- } \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
- if (index < 0) { \
- index += size; \
- } \
- if (index < 0 || index >= size) { \
- oob = true; \
- return; \
- } \
+ VariantTypeAdjust<m_elem_type>::adjust(value); \
*VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
oob = false; \
} \
@@ -682,18 +657,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
oob = true; \
return; \
} \
- *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
- oob = false; \
- } \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
- if (index < 0) { \
- index += size; \
- } \
- if (index < 0 || index >= size) { \
- oob = true; \
- return; \
- } \
+ VariantTypeAdjust<m_elem_type>::adjust(value); \
*VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
oob = false; \
} \
@@ -760,14 +724,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
oob = true; \
return; \
} \
- *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
- oob = false; \
- } \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- if (index < 0 || index >= m_max) { \
- oob = true; \
- return; \
- } \
+ VariantTypeAdjust<m_elem_type>::adjust(value); \
*VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
oob = false; \
} \
@@ -822,14 +779,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
oob = true; \
return; \
} \
- *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))m_accessor[index]; \
- oob = false; \
- } \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- if (index < 0 || index >= m_max) { \
- oob = true; \
- return; \
- } \
+ VariantTypeAdjust<m_elem_type>::adjust(value); \
*VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))m_accessor[index]; \
oob = false; \
} \
@@ -878,14 +828,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
oob = true; \
return; \
} \
- *value = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_get(index); \
- oob = false; \
- } \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- if (index < 0 || index >= m_max) { \
- oob = true; \
- return; \
- } \
+ VariantTypeAdjust<m_elem_type>::adjust(value); \
*VariantGetInternalPtr<m_elem_type>::get_ptr(value) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_get(index); \
oob = false; \
} \
@@ -941,18 +884,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
*value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
oob = false; \
} \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \
- if (index < 0) { \
- index += size; \
- } \
- if (index < 0 || index >= size) { \
- oob = true; \
- return; \
- } \
- *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \
- oob = false; \
- } \
static void ptr_get(const void *base, int64_t index, void *member) { \
/* avoid ptrconvert for performance*/ \
const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
@@ -1010,15 +941,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
*value = *ptr; \
oob = false; \
} \
- static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \
- const Variant *ptr = VariantGetInternalPtr<m_base_type>::get_ptr(base)->getptr(index); \
- if (!ptr) { \
- oob = true; \
- return; \
- } \
- *value = *ptr; \
- oob = false; \
- } \
static void ptr_get(const void *base, int64_t index, void *member) { \
/* avoid ptrconvert for performance*/ \
const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \
@@ -1094,7 +1016,7 @@ static void register_indexed_member(Variant::Type p_type) {
sgi.ptr_setter = T::ptr_set;
sgi.getter = T::get;
- sgi.validated_getter = T::validated_get;
+ sgi.validated_getter = T::get;
sgi.ptr_getter = T::ptr_get;
sgi.index_type = T::get_index_type();
diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index 5830a8452c..22a9925d4b 100644
--- a/doc/classes/RenderingServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -3365,7 +3365,8 @@
Objects are displayed with only light information.
</constant>
<constant name="VIEWPORT_DEBUG_DRAW_OVERDRAW" value="3" enum="ViewportDebugDraw">
- Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw means you are wasting performance on drawing pixels that are being hidden behind others.
+ Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw (represented by brighter colors) means you are wasting performance on drawing pixels that are being hidden behind others.
+ [b]Note:[/b] When using this debug draw mode, custom shaders will be ignored. This means vertex displacement won't be visible anymore.
</constant>
<constant name="VIEWPORT_DEBUG_DRAW_WIREFRAME" value="4" enum="ViewportDebugDraw">
Debug draw draws objects in wireframe.
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 976afd8e8e..9fcb5fff35 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -6821,7 +6821,7 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_CTRL | KEY_F2);
ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_CTRL | KEY_F3);
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_CTRL | KEY_F4);
- ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_MASK_SHIFT | KEY_F1);
+ ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F1);
#endif
ED_SHORTCUT("editor/editor_next", TTR("Open the next Editor"));
ED_SHORTCUT("editor/editor_prev", TTR("Open the previous Editor"));
diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml
index 2edbc08cc8..f3e13ba31a 100644
--- a/modules/webm/doc_classes/VideoStreamWebm.xml
+++ b/modules/webm/doc_classes/VideoStreamWebm.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
[VideoStream] resource handling the [url=https://www.webmproject.org/]WebM[/url] video format with [code].webm[/code] extension. Both the VP8 and VP9 codecs are supported. The VP8 and VP9 codecs are more efficient than [VideoStreamTheora], but they require more CPU resources to decode (especially VP9). Both the VP8 and VP9 codecs are decoded on the CPU.
+ [b]Note:[/b] Alpha channel (also known as transparency) is not supported. The video will always appear to have a black background, even if it originally contains an alpha channel.
[b]Note:[/b] There are known bugs and performance issues with WebM video playback in Godot. If you run into problems, try using the Ogg Theora format instead: [VideoStreamTheora]
</description>
<tutorials>
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index da2b00b7a7..12fcc6fbb9 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -351,8 +351,7 @@ void RasterizerSceneRD::sdfgi_update(RID p_render_buffers, RID p_environment, co
RD::TextureFormat tf_probe_average = tf_probes;
tf_probe_average.format = RD::DATA_FORMAT_R32G32B32A32_SINT; //signed integer because SH are signed
- tf_probe_average.type = RD::TEXTURE_TYPE_2D_ARRAY;
- tf_probe_average.array_layers = 1;
+ tf_probe_average.type = RD::TEXTURE_TYPE_2D;
sdfgi->lightprobe_history_scroll = RD::get_singleton()->texture_create(tf_probe_history, RD::TextureView());
sdfgi->lightprobe_average_scroll = RD::get_singleton()->texture_create(tf_probe_average, RD::TextureView());
@@ -8218,7 +8217,7 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 0;
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_3D_WHITE));
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_CUBEMAP_WHITE));
uniforms.push_back(u);
}
{
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 847d73fe51..5fd8003f8f 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -7755,6 +7755,34 @@ RasterizerStorageRD::RasterizerStorageRD() {
}
}
+ { //create default cubemap white array
+
+ RD::TextureFormat tformat;
+ tformat.format = RD::DATA_FORMAT_R8G8B8A8_UNORM;
+ tformat.width = 4;
+ tformat.height = 4;
+ tformat.array_layers = 6;
+ tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT;
+ tformat.type = RD::TEXTURE_TYPE_CUBE;
+
+ Vector<uint8_t> pv;
+ pv.resize(16 * 4);
+ for (int i = 0; i < 16; i++) {
+ pv.set(i * 4 + 0, 255);
+ pv.set(i * 4 + 1, 255);
+ pv.set(i * 4 + 2, 255);
+ pv.set(i * 4 + 3, 255);
+ }
+
+ {
+ Vector<Vector<uint8_t>> vpv;
+ for (int i = 0; i < 6; i++) {
+ vpv.push_back(pv);
+ }
+ default_rd_textures[DEFAULT_RD_TEXTURE_CUBEMAP_WHITE] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv);
+ }
+ }
+
{ //create default 3D
RD::TextureFormat tformat;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
index 05cb1b4a73..b7ad931149 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
@@ -155,6 +155,7 @@ public:
DEFAULT_RD_TEXTURE_MULTIMESH_BUFFER,
DEFAULT_RD_TEXTURE_CUBEMAP_BLACK,
DEFAULT_RD_TEXTURE_CUBEMAP_ARRAY_BLACK,
+ DEFAULT_RD_TEXTURE_CUBEMAP_WHITE,
DEFAULT_RD_TEXTURE_3D_WHITE,
DEFAULT_RD_TEXTURE_2D_ARRAY_WHITE,
DEFAULT_RD_TEXTURE_2D_UINT,