diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics/area_sw.cpp | 3 | ||||
-rw-r--r-- | servers/physics_2d/area_2d_sw.cpp | 3 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 2 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 43 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 10 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 10 | ||||
-rw-r--r-- | servers/visual_server.cpp | 2 | ||||
-rw-r--r-- | servers/visual_server.h | 4 |
9 files changed, 70 insertions, 9 deletions
diff --git a/servers/physics/area_sw.cpp b/servers/physics/area_sw.cpp index f9f7f67a1e..398849edb8 100644 --- a/servers/physics/area_sw.cpp +++ b/servers/physics/area_sw.cpp @@ -46,6 +46,9 @@ AreaSW::BodyKey::BodyKey(AreaSW *p_body, uint32_t p_body_shape, uint32_t p_area_ } void AreaSW::_shapes_changed() { + + if (!moved_list.in_list() && get_space()) + get_space()->area_add_to_moved_list(&moved_list); } void AreaSW::set_transform(const Transform &p_transform) { diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp index 110e94d22e..6f09041af8 100644 --- a/servers/physics_2d/area_2d_sw.cpp +++ b/servers/physics_2d/area_2d_sw.cpp @@ -46,6 +46,9 @@ Area2DSW::BodyKey::BodyKey(Area2DSW *p_body, uint32_t p_body_shape, uint32_t p_a } void Area2DSW::_shapes_changed() { + + if (!moved_list.in_list() && get_space()) + get_space()->area_add_to_moved_list(&moved_list); } void Area2DSW::set_transform(const Transform2D &p_transform) { diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 74741a946c..0008b809b7 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -588,6 +588,8 @@ public: virtual int get_captured_render_info(VS::RenderInfo p_info) = 0; virtual int get_render_info(VS::RenderInfo p_info) = 0; + virtual String get_video_adapter_name() const = 0; + virtual String get_video_adapter_vendor() const = 0; static RasterizerStorage *base_singleton; RasterizerStorage(); diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 45084b60a2..2b61d72f6a 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -571,8 +571,10 @@ ShaderLanguage::Token ShaderLanguage::_get_token() { CharType last_char = str[str.length() - 1]; if (hexa_found) { - //hex integers eg."0xFF" or "0x12AB", etc - NOT supported yet - return _make_token(TK_ERROR, "Invalid (hexadecimal) numeric constant - Not supported"); + //integer(hex) + if (str.size() > 11 || !str.is_valid_hex_number(true)) { // > 0xFFFFFFFF + return _make_token(TK_ERROR, "Invalid (hexadecimal) numeric constant"); + } } else if (period_found || exponent_found || float_suffix_found) { //floats if (period_found) { @@ -621,7 +623,11 @@ ShaderLanguage::Token ShaderLanguage::_get_token() { else tk.type = TK_INT_CONSTANT; - tk.constant = str.to_double(); //won't work with hex + if (hexa_found) { + tk.constant = (double)str.hex_to_int64(true); + } else { + tk.constant = str.to_double(); + } tk.line = tk_line; return tk; @@ -2054,7 +2060,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { //sub-functions //array - { "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, false }, + { "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, true }, { NULL, TYPE_VOID, { TYPE_VOID }, TAG_GLOBAL, false } @@ -3882,6 +3888,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui if (tk.type == TK_BRACKET_OPEN) { bool unknown_size = false; + if (VisualServer::get_singleton()->is_low_end() && is_const) { + _set_error("Local const arrays are supported only on high-end platform!"); + return ERR_PARSE_ERROR; + } + ArrayDeclarationNode *node = alloc_node<ArrayDeclarationNode>(); node->datatype = type; node->precision = precision; @@ -3917,6 +3928,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui tk = _get_token(); if (tk.type == TK_OP_ASSIGN) { + + if (VisualServer::get_singleton()->is_low_end()) { + _set_error("Array initialization is supported only on high-end platform!"); + return ERR_PARSE_ERROR; + } + tk = _get_token(); if (tk.type != TK_CURLY_BRACKET_OPEN) { @@ -4536,8 +4553,13 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui } p_block->statements.push_back(flow); - if (p_block->block_type == BlockNode::BLOCK_TYPE_CASE || p_block->block_type == BlockNode::BLOCK_TYPE_DEFAULT) { - return OK; + + BlockNode *block = p_block; + while (block) { + if (block->block_type == BlockNode::BLOCK_TYPE_CASE || block->block_type == BlockNode::BLOCK_TYPE_DEFAULT) { + return OK; + } + block = block->parent_block; } } else if (tk.type == TK_CF_DISCARD) { @@ -4585,8 +4607,13 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui } p_block->statements.push_back(flow); - if (p_block->block_type == BlockNode::BLOCK_TYPE_CASE || p_block->block_type == BlockNode::BLOCK_TYPE_DEFAULT) { - return OK; + + BlockNode *block = p_block; + while (block) { + if (block->block_type == BlockNode::BLOCK_TYPE_CASE || block->block_type == BlockNode::BLOCK_TYPE_DEFAULT) { + return OK; + } + block = block->parent_block; } } else if (tk.type == TK_CF_CONTINUE) { diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 4d680667cb..23736b5e63 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -153,6 +153,16 @@ int VisualServerRaster::get_render_info(RenderInfo p_info) { return VSG::storage->get_render_info(p_info); } +String VisualServerRaster::get_video_adapter_name() const { + + return VSG::storage->get_video_adapter_name(); +} + +String VisualServerRaster::get_video_adapter_vendor() const { + + return VSG::storage->get_video_adapter_vendor(); +} + /* TESTING */ void VisualServerRaster::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) { diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 54c46b1812..1a1e86833e 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -680,6 +680,8 @@ public: /* STATUS INFORMATION */ virtual int get_render_info(RenderInfo p_info); + virtual String get_video_adapter_name() const; + virtual String get_video_adapter_vendor() const; virtual RID get_test_cube(); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index f5875f4fad..b8f433d006 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -101,7 +101,7 @@ public: FUNC2(texture_set_path, RID, const String &) FUNC1RC(String, texture_get_path, RID) FUNC1(texture_set_shrink_all_x2_on_set_data, bool) - FUNC1(texture_debug_usage, List<TextureInfo> *) + FUNC1S(texture_debug_usage, List<TextureInfo> *) FUNC1(textures_keep_original, bool) @@ -602,6 +602,14 @@ public: return visual_server->get_render_info(p_info); } + virtual String get_video_adapter_name() const { + return visual_server->get_video_adapter_name(); + } + + virtual String get_video_adapter_vendor() const { + return visual_server->get_video_adapter_vendor(); + } + FUNC4(set_boot_image, const Ref<Image> &, const Color &, bool, bool) FUNC1(set_default_clear_color, const Color &) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 1f72848b15..b9b492e758 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -2032,6 +2032,8 @@ void VisualServer::_bind_methods() { ClassDB::bind_method(D_METHOD("init"), &VisualServer::init); ClassDB::bind_method(D_METHOD("finish"), &VisualServer::finish); ClassDB::bind_method(D_METHOD("get_render_info", "info"), &VisualServer::get_render_info); + ClassDB::bind_method(D_METHOD("get_video_adapter_name"), &VisualServer::get_video_adapter_name); + ClassDB::bind_method(D_METHOD("get_video_adapter_vendor"), &VisualServer::get_video_adapter_vendor); #ifndef _3D_DISABLED ClassDB::bind_method(D_METHOD("make_sphere_mesh", "latitudes", "longitudes", "radius"), &VisualServer::make_sphere_mesh); diff --git a/servers/visual_server.h b/servers/visual_server.h index 9aeee731b3..6f0659357c 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -335,12 +335,14 @@ public: MULTIMESH_COLOR_NONE, MULTIMESH_COLOR_8BIT, MULTIMESH_COLOR_FLOAT, + MULTIMESH_COLOR_MAX, }; enum MultimeshCustomDataFormat { MULTIMESH_CUSTOM_DATA_NONE, MULTIMESH_CUSTOM_DATA_8BIT, MULTIMESH_CUSTOM_DATA_FLOAT, + MULTIMESH_CUSTOM_DATA_MAX, }; virtual void multimesh_allocate(RID p_multimesh, int p_instances, MultimeshTransformFormat p_transform_format, MultimeshColorFormat p_color_format, MultimeshCustomDataFormat p_data_format = MULTIMESH_CUSTOM_DATA_NONE) = 0; @@ -1017,6 +1019,8 @@ public: }; virtual int get_render_info(RenderInfo p_info) = 0; + virtual String get_video_adapter_name() const = 0; + virtual String get_video_adapter_vendor() const = 0; /* Materials for 2D on 3D */ |