summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/VisualShaderNodeCustom.xml12
-rw-r--r--drivers/vulkan/SCsub8
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp197
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h16
-rw-r--r--platform/iphone/SCsub1
-rw-r--r--platform/iphone/app_delegate.h7
-rw-r--r--platform/iphone/app_delegate.mm16
-rw-r--r--platform/iphone/detect.py14
-rw-r--r--platform/iphone/game_center.mm14
-rw-r--r--platform/iphone/icloud.mm16
-rw-r--r--platform/iphone/in_app_store.mm16
-rw-r--r--platform/iphone/os_iphone.cpp24
-rw-r--r--platform/iphone/os_iphone.h9
-rw-r--r--platform/iphone/vulkan_context_iphone.h48
-rw-r--r--platform/iphone/vulkan_context_iphone.mm56
-rw-r--r--scene/resources/visual_shader.cpp1
16 files changed, 293 insertions, 162 deletions
diff --git a/doc/classes/VisualShaderNodeCustom.xml b/doc/classes/VisualShaderNodeCustom.xml
index 0d1bcc754f..6e6e56dcb0 100644
--- a/doc/classes/VisualShaderNodeCustom.xml
+++ b/doc/classes/VisualShaderNodeCustom.xml
@@ -20,8 +20,8 @@
<return type="String">
</return>
<description>
- Override this method to define the category of the associated custom node in the Visual Shader Editor's members dialog.
- Defining this method is [b]optional[/b]. If not overridden, the node will be filed under the "Custom" category.
+ Override this method to define the path to the associated custom node in the Visual Shader Editor's members dialog. The path may looks like [code]"MyGame/MyFunctions/Noise"[/code].
+ Defining this method is [b]optional[/b]. If not overridden, the node will be filed under the "Addons" category.
</description>
</method>
<method name="_get_code" qualifiers="virtual">
@@ -135,14 +135,6 @@
Defining this method is [b]optional[/b]. If not overridden, no return icon is shown.
</description>
</method>
- <method name="_get_subcategory" qualifiers="virtual">
- <return type="String">
- </return>
- <description>
- Override this method to define the subcategory of the associated custom node in the Visual Shader Editor's members dialog.
- Defining this method is [b]optional[/b]. If not overridden, the node will be filed under the root of the main category (see [method _get_category]).
- </description>
- </method>
<method name="_is_highend" qualifiers="virtual">
<return type="bool">
</return>
diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub
index 2576f68f92..85a5ae8d26 100644
--- a/drivers/vulkan/SCsub
+++ b/drivers/vulkan/SCsub
@@ -49,6 +49,14 @@ if env['builtin_vulkan']:
'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
])
+ elif env['platform'] == "iphone":
+ env_thirdparty.AppendUnique(CPPDEFINES=[
+ 'VK_USE_PLATFORM_IOS_MVK',
+ 'VULKAN_NON_CMAKE_BUILD',
+ 'SYSCONFDIR=\\"%s\\"' % '/etc',
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
+ ])
elif env['platform'] == "x11":
env_thirdparty.AppendUnique(CPPDEFINES=[
'VK_USE_PLATFORM_XLIB_KHR',
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 826af88571..e228f25c62 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -116,7 +116,7 @@ void VisualShaderEditor::clear_custom_types() {
}
}
-void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory, bool p_highend) {
+void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend) {
ERR_FAIL_COND(!p_name.is_valid_identifier());
ERR_FAIL_COND(!p_script.is_valid());
@@ -134,15 +134,15 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script>
ao.return_type = p_return_icon_type;
ao.description = p_description;
ao.category = p_category;
- ao.sub_category = p_subcategory;
ao.highend = p_highend;
ao.is_custom = true;
bool begin = false;
+ String root = p_category.split("/")[0];
for (int i = 0; i < add_options.size(); i++) {
if (add_options[i].is_custom) {
- if (add_options[i].category == p_category) {
+ if (add_options[i].category == root) {
if (!begin) {
begin = true;
}
@@ -239,9 +239,6 @@ void VisualShaderEditor::update_custom_nodes() {
if (ref->has_method("_get_category")) {
category = (String)ref->call("_get_category");
}
- if (category == "") {
- category = "Custom";
- }
String subcategory = "";
if (ref->has_method("_get_subcategory")) {
@@ -258,18 +255,19 @@ void VisualShaderEditor::update_custom_nodes() {
dict["script"] = script;
dict["description"] = description;
dict["return_icon_type"] = return_icon_type;
+
+ category = category.rstrip("/");
+ category = category.lstrip("/");
+ category = "Addons/" + category;
+ if (subcategory != "") {
+ category += "/" + subcategory;
+ }
+
dict["category"] = category;
- dict["subcategory"] = subcategory;
dict["highend"] = highend;
String key;
- key = category;
- key += "/";
- if (subcategory != "") {
- key += subcategory;
- key += "/";
- }
- key += name;
+ key = category + "/" + name;
added[key] = dict;
}
@@ -284,7 +282,7 @@ void VisualShaderEditor::update_custom_nodes() {
const Dictionary &value = (Dictionary)added[key];
- add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"], value["highend"]);
+ add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["highend"]);
}
_update_options_menu();
@@ -299,22 +297,12 @@ void VisualShaderEditor::_update_options_menu() {
node_desc->set_text("");
members_dialog->get_ok()->set_disabled(true);
- String prev_category;
- String prev_sub_category;
-
members->clear();
TreeItem *root = members->create_item();
- TreeItem *category = NULL;
- TreeItem *sub_category = NULL;
String filter = node_filter->get_text().strip_edges();
bool use_filter = !filter.empty();
- Vector<String> categories;
- Vector<String> sub_categories;
-
- int item_count = 0;
- int item_count2 = 0;
bool is_first_item = true;
Color unsupported_color = get_color("error_color", "Editor");
@@ -322,111 +310,92 @@ void VisualShaderEditor::_update_options_menu() {
static bool low_driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name") == "GLES2";
+ Map<String, TreeItem *> folders;
+
int current_func = -1;
if (!visual_shader.is_null()) {
current_func = visual_shader->get_mode();
}
- for (int i = 0; i < add_options.size() + 1; i++) {
+ Vector<AddOption> custom_options;
+ Vector<AddOption> embedded_options;
- if (i == add_options.size()) {
- if (sub_category != NULL && item_count2 == 0) {
- memdelete(sub_category);
- --item_count;
+ for (int i = 0; i < add_options.size(); i++) {
+ if (!use_filter || add_options[i].name.findn(filter) != -1) {
+ if ((add_options[i].func != current_func && add_options[i].func != -1) || !_is_available(add_options[i].mode)) {
+ continue;
}
- if (category != NULL && item_count == 0) {
- memdelete(category);
+ const_cast<AddOption &>(add_options[i]).temp_idx = i; // save valid id
+ if (add_options[i].is_custom) {
+ custom_options.push_back(add_options[i]);
+ } else {
+ embedded_options.push_back(add_options[i]);
}
- break;
}
+ }
+ Vector<AddOption> options;
+ SortArray<AddOption, _OptionComparator> sorter;
+ sorter.sort(custom_options.ptrw(), custom_options.size());
- if (!use_filter || add_options[i].name.findn(filter) != -1) {
-
- if ((add_options[i].func != current_func && add_options[i].func != -1) || !_is_available(add_options[i].mode))
- continue;
+ options.append_array(custom_options);
+ options.append_array(embedded_options);
- if (prev_category != add_options[i].category) {
- if (category != NULL && item_count == 0) {
- memdelete(category);
- }
+ for (int i = 0; i < options.size(); i++) {
+ String path = options[i].category;
+ Vector<String> subfolders = path.split("/");
+ TreeItem *category = NULL;
- item_count = 0;
- prev_sub_category = "";
- category = members->create_item(root);
- category->set_text(0, add_options[i].category);
- category->set_selectable(0, false);
- if (!use_filter)
- category->set_collapsed(true);
- }
-
- if (add_options[i].sub_category != "") {
- if (prev_sub_category != add_options[i].sub_category) {
- if (category != NULL) {
- if (sub_category != NULL && item_count2 == 0) {
- memdelete(sub_category);
- --item_count;
- }
- ++item_count;
- item_count2 = 0;
- sub_category = members->create_item(category);
- sub_category->set_text(0, add_options[i].sub_category);
- sub_category->set_selectable(0, false);
- if (!use_filter)
- sub_category->set_collapsed(true);
- }
- }
- } else {
- sub_category = NULL;
- }
-
- TreeItem *p_category = NULL;
-
- if (sub_category != NULL) {
- p_category = sub_category;
- ++item_count2;
- } else if (category != NULL) {
- p_category = category;
- ++item_count;
- }
-
- if (p_category != NULL) {
- TreeItem *item = members->create_item(p_category);
- if (add_options[i].highend && low_driver)
- item->set_custom_color(0, unsupported_color);
- else if (add_options[i].highend)
- item->set_custom_color(0, supported_color);
- item->set_text(0, add_options[i].name);
- if (is_first_item && use_filter) {
- item->select(0);
- node_desc->set_text(_get_description(i));
- is_first_item = false;
- }
- switch (add_options[i].return_type) {
- case VisualShaderNode::PORT_TYPE_SCALAR:
- item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("float", "EditorIcons"));
- break;
- case VisualShaderNode::PORT_TYPE_VECTOR:
- item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("Vector3", "EditorIcons"));
- break;
- case VisualShaderNode::PORT_TYPE_BOOLEAN:
- item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("bool", "EditorIcons"));
- break;
- case VisualShaderNode::PORT_TYPE_TRANSFORM:
- item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("Transform", "EditorIcons"));
- break;
- case VisualShaderNode::PORT_TYPE_SAMPLER:
- item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("ImageTexture", "EditorIcons"));
- break;
- default:
- break;
+ if (!folders.has(path)) {
+ category = root;
+ String path_temp = "";
+ for (int j = 0; j < subfolders.size(); j++) {
+ path_temp += subfolders[j];
+ if (!folders.has(path_temp)) {
+ category = members->create_item(category);
+ category->set_selectable(0, false);
+ category->set_collapsed(!use_filter);
+ category->set_text(0, subfolders[j]);
+ folders.insert(path_temp, category);
+ } else {
+ category = folders[path_temp];
}
- item->set_meta("id", i);
}
-
- prev_sub_category = add_options[i].sub_category;
- prev_category = add_options[i].category;
+ } else {
+ category = folders[path];
+ }
+
+ TreeItem *item = members->create_item(category);
+ if (options[i].highend && low_driver)
+ item->set_custom_color(0, unsupported_color);
+ else if (options[i].highend)
+ item->set_custom_color(0, supported_color);
+ item->set_text(0, options[i].name);
+ if (is_first_item && use_filter) {
+ item->select(0);
+ node_desc->set_text(options[i].description);
+ is_first_item = false;
+ }
+ switch (options[i].return_type) {
+ case VisualShaderNode::PORT_TYPE_SCALAR:
+ item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("float", "EditorIcons"));
+ break;
+ case VisualShaderNode::PORT_TYPE_VECTOR:
+ item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("Vector3", "EditorIcons"));
+ break;
+ case VisualShaderNode::PORT_TYPE_BOOLEAN:
+ item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("bool", "EditorIcons"));
+ break;
+ case VisualShaderNode::PORT_TYPE_TRANSFORM:
+ item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("Transform", "EditorIcons"));
+ break;
+ case VisualShaderNode::PORT_TYPE_SAMPLER:
+ item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("ImageTexture", "EditorIcons"));
+ break;
+ default:
+ break;
}
+ item->set_meta("id", options[i].temp_idx);
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 150cf16167..8919690ada 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -104,7 +104,6 @@ class VisualShaderEditor : public VBoxContainer {
struct AddOption {
String name;
String category;
- String sub_category;
String type;
String description;
int sub_func;
@@ -116,12 +115,12 @@ class VisualShaderEditor : public VBoxContainer {
float value;
bool highend;
bool is_custom;
+ int temp_idx;
AddOption(const String &p_name = String(), const String &p_category = String(), const String &p_sub_category = String(), const String &p_type = String(), const String &p_description = String(), int p_sub_func = -1, int p_return_type = -1, int p_mode = -1, int p_func = -1, float p_value = -1, bool p_highend = false) {
name = p_name;
type = p_type;
- category = p_category;
- sub_category = p_sub_category;
+ category = p_category + "/" + p_sub_category;
description = p_description;
sub_func = p_sub_func;
return_type = p_return_type;
@@ -135,8 +134,7 @@ class VisualShaderEditor : public VBoxContainer {
AddOption(const String &p_name, const String &p_category, const String &p_sub_category, const String &p_type, const String &p_description, const String &p_sub_func, int p_return_type = -1, int p_mode = -1, int p_func = -1, float p_value = -1, bool p_highend = false) {
name = p_name;
type = p_type;
- category = p_category;
- sub_category = p_sub_category;
+ category = p_category + "/" + p_sub_category;
description = p_description;
sub_func = 0;
sub_func_str = p_sub_func;
@@ -148,6 +146,12 @@ class VisualShaderEditor : public VBoxContainer {
is_custom = false;
}
};
+ struct _OptionComparator {
+
+ _FORCE_INLINE_ bool operator()(const AddOption &a, const AddOption &b) const {
+ return a.category.count("/") > b.category.count("/") || (a.category + "/" + a.name).naturalnocasecmp_to(b.category + "/" + b.name) < 0;
+ }
+ };
Vector<AddOption> add_options;
int texture_node_option_idx;
@@ -265,7 +269,7 @@ public:
static VisualShaderEditor *get_singleton() { return singleton; }
void clear_custom_types();
- void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory, bool p_highend);
+ void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend);
virtual Size2 get_minimum_size() const;
void edit(VisualShader *p_visual_shader);
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index fa1b124561..1f82f51888 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -14,6 +14,7 @@ iphone_lib = [
'in_app_store.mm',
'icloud.mm',
'ios.mm',
+ 'vulkan_context_iphone.mm',
]
env_ios = env.Clone()
diff --git a/platform/iphone/app_delegate.h b/platform/iphone/app_delegate.h
index b4454aab11..6b3b7ad5bc 100644
--- a/platform/iphone/app_delegate.h
+++ b/platform/iphone/app_delegate.h
@@ -28,13 +28,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#if defined(OPENGL_ENABLED)
#import "gl_view.h"
+#endif
#import "view_controller.h"
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
+#if defined(OPENGL_ENABLED)
@interface AppDelegate : NSObject <UIApplicationDelegate, GLViewDelegate> {
+#endif
+#if defined(VULKAN_ENABLED)
+@interface AppDelegate : NSObject <UIApplicationDelegate> {
+#endif
//@property (strong, nonatomic) UIWindow *window;
ViewController *view_controller;
bool is_focus_out;
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 4de321fa04..acc3e5d4e0 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -32,7 +32,9 @@
#include "core/project_settings.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
+#if defined(OPENGL_ENABLED)
#import "gl_view.h"
+#endif
#include "main/main.h"
#include "os_iphone.h"
@@ -412,10 +414,12 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
OS::VideoMode _get_video_mode() {
int backingWidth;
int backingHeight;
+#if defined(OPENGL_ENABLED)
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+#endif
OS::VideoMode vm;
vm.fullscreen = true;
@@ -426,7 +430,7 @@ OS::VideoMode _get_video_mode() {
};
static int frame_count = 0;
-- (void)drawView:(GLView *)view;
+- (void)drawView:(UIView *)view;
{
switch (frame_count) {
@@ -634,6 +638,7 @@ static int frame_count = 0;
return FALSE;
};
+#if defined(OPENGL_ENABLED)
// WARNING: We must *always* create the GLView after we have constructed the
// OS with iphone_main. This allows the GLView to access project settings so
// it can properly initialize the OpenGL context
@@ -642,7 +647,7 @@ static int frame_count = 0;
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
- window.rootViewController = view_controller;
+
_set_keep_screen_on(bool(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true)) ? YES : NO);
glView.useCADisplayLink =
@@ -650,6 +655,13 @@ static int frame_count = 0;
printf("cadisaplylink: %d", glView.useCADisplayLink);
glView.animationInterval = 1.0 / kRenderingFrequency;
[glView startAnimation];
+#endif
+
+#if defined(VULKAN_ENABLED)
+ view_controller = [[ViewController alloc] init];
+#endif
+
+ window.rootViewController = view_controller;
// Show the window
[window makeKeyAndVisible];
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index f646b8b1d5..e01950c1db 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -23,6 +23,7 @@ def get_opts():
return [
('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
('IPHONESDK', 'Path to the iPhone SDK', ''),
+ BoolVariable('use_static_mvk', 'Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)', False),
BoolVariable('game_center', 'Support for game center', True),
BoolVariable('store_kit', 'Support for in-app store', True),
BoolVariable('icloud', 'Support for iCloud', True),
@@ -149,7 +150,7 @@ def configure(env):
'-framework', 'Foundation',
'-framework', 'GameController',
'-framework', 'MediaPlayer',
- '-framework', 'OpenGLES',
+ '-framework', 'Metal',
'-framework', 'QuartzCore',
'-framework', 'Security',
'-framework', 'SystemConfiguration',
@@ -170,11 +171,18 @@ def configure(env):
env.Append(CPPDEFINES=['ICLOUD_ENABLED'])
env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
- '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
'$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
])
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Prepend(CPPPATH=['#platform/iphone'])
- env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'GLES_ENABLED', 'COREAUDIO_ENABLED'])
+ env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'COREAUDIO_ENABLED'])
+
+ env.Append(CPPDEFINES=['VULKAN_ENABLED'])
+ env.Append(LINKFLAGS=['-framework', 'IOSurface'])
+ if (env['use_static_mvk']):
+ env.Append(LINKFLAGS=['-framework', 'MoltenVK'])
+ env['builtin_vulkan'] = False
+ elif not env['builtin_vulkan']:
+ env.Append(LIBS=['vulkan'])
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 696f61f954..14f4b00ea6 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -198,11 +198,11 @@ void GameCenter::request_achievement_descriptions() {
ret["type"] = "achievement_descriptions";
if (error == nil) {
ret["result"] = "ok";
- PoolStringArray names;
- PoolStringArray titles;
- PoolStringArray unachieved_descriptions;
- PoolStringArray achieved_descriptions;
- PoolIntArray maximum_points;
+ PackedStringArray names;
+ PackedStringArray titles;
+ PackedStringArray unachieved_descriptions;
+ PackedStringArray achieved_descriptions;
+ PackedIntArray maximum_points;
Array hidden;
Array replayable;
@@ -253,8 +253,8 @@ void GameCenter::request_achievements() {
ret["type"] = "achievements";
if (error == nil) {
ret["result"] = "ok";
- PoolStringArray names;
- PoolRealArray percentages;
+ PackedStringArray names;
+ PackedRealArray percentages;
for (int i = 0; i < [achievements count]; i++) {
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index f846043dde..251f78f2da 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -80,13 +80,13 @@ Variant nsobject_to_variant(NSObject *object) {
const char *str = [(NSString *)object UTF8String];
return String::utf8(str != NULL ? str : "");
} else if ([object isKindOfClass:[NSData class]]) {
- PoolByteArray ret;
+ PackedByteArray ret;
NSData *data = (NSData *)object;
if ([data length] > 0) {
ret.resize([data length]);
{
- PoolByteArray::Write w = ret.write();
- copymem(w.ptr(), [data bytes], [data length]);
+ // PackedByteArray::Write w = ret.write();
+ copymem((void *)ret.ptr(), [data bytes], [data length]);
}
}
return ret;
@@ -184,10 +184,10 @@ NSObject *variant_to_nsobject(Variant v) {
[result addObject:value];
}
return result;
- } else if (v.get_type() == Variant::POOL_BYTE_ARRAY) {
- PoolByteArray arr = v;
- PoolByteArray::Read r = arr.read();
- NSData *result = [NSData dataWithBytes:r.ptr() length:arr.size()];
+ } else if (v.get_type() == Variant::PACKED_BYTE_ARRAY) {
+ PackedByteArray arr = v;
+ // PackedByteArray::Read r = arr.read();
+ NSData *result = [NSData dataWithBytes:arr.ptr() length:arr.size()];
return result;
}
WARN_PRINT(String("Could not add unsupported type to iCloud: '" + Variant::get_type_name(v.get_type()) + "'").utf8().get_data());
@@ -315,7 +315,7 @@ ICloud::ICloud() {
Dictionary ret;
ret["type"] = "key_value_changed";
- //PoolStringArray result_keys;
+ //PackedStringArray result_keys;
//Array result_values;
Dictionary keyValues;
String reason = "";
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 855ab195b0..842bc44c01 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -85,12 +85,12 @@ void InAppStore::_bind_methods() {
Dictionary ret;
ret["type"] = "product_info";
ret["result"] = "ok";
- PoolStringArray titles;
- PoolStringArray descriptions;
- PoolRealArray prices;
- PoolStringArray ids;
- PoolStringArray localized_prices;
- PoolStringArray currency_codes;
+ PackedStringArray titles;
+ PackedStringArray descriptions;
+ PackedRealArray prices;
+ PackedStringArray ids;
+ PackedStringArray localized_prices;
+ PackedStringArray currency_codes;
for (NSUInteger i = 0; i < [products count]; i++) {
@@ -113,7 +113,7 @@ void InAppStore::_bind_methods() {
ret["localized_prices"] = localized_prices;
ret["currency_codes"] = currency_codes;
- PoolStringArray invalid_ids;
+ PackedStringArray invalid_ids;
for (NSString *ipid in response.invalidProductIdentifiers) {
@@ -133,7 +133,7 @@ Error InAppStore::request_product_info(Variant p_params) {
Dictionary params = p_params;
ERR_FAIL_COND_V(!params.has("product_ids"), ERR_INVALID_PARAMETER);
- PoolStringArray pids = params["product_ids"];
+ PackedStringArray pids = params["product_ids"];
printf("************ request product info! %i\n", pids.size());
NSMutableArray *array = [[[NSMutableArray alloc] initWithCapacity:pids.size()] autorelease];
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 634062f46b..db203ff2b3 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -32,7 +32,16 @@
#include "os_iphone.h"
+#if defined(OPENGL_ENABLED)
#include "drivers/gles2/rasterizer_gles2.h"
+#endif
+
+#if defined(VULKAN_ENABLED)
+#include "servers/visual/rasterizer_rd/rasterizer_rd.h"
+// #import <QuartzCore/CAMetalLayer.h>
+#include <vulkan/vulkan_metal.h>
+#endif
+
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
@@ -101,7 +110,9 @@ int OSIPhone::get_current_video_driver() const {
}
Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+ video_driver_index = p_video_driver;
+#if defined(OPENGL_ENABLED)
bool gl_initialization_error = false;
// FIXME: Add Vulkan support via MoltenVK. Add fallback code back?
@@ -118,19 +129,25 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
"Unable to initialize video driver");
return ERR_UNAVAILABLE;
}
+#endif
- video_driver_index = p_video_driver;
+#if defined(VULKAN_ENABLED)
+ RasterizerRD::make_current();
+#endif
+
+
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
}
-
visual_server->init();
//visual_server->cursor_set_visible(false, 0);
+#if defined(OPENGL_ENABLED)
// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
RasterizerStorageGLES2::system_fbo = gl_view_base_fb;
+#endif
AudioDriverManager::initialize(p_audio_driver);
@@ -437,9 +454,10 @@ bool OSIPhone::can_draw() const {
};
int OSIPhone::set_base_framebuffer(int p_fb) {
-
+#if defined(OPENGL_ENABLED)
// gl_view_base_fb has not been updated yet
RasterizerStorageGLES2::system_fbo = p_fb;
+#endif
return 0;
};
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index d2d96181f5..f42679e754 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -46,6 +46,11 @@
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
+#if defined(VULKAN_ENABLED)
+#include "drivers/vulkan/rendering_device_vulkan.h"
+#include "platform/iphone/vulkan_context_iphone.h"
+#endif
+
class OSIPhone : public OS_Unix {
private:
@@ -74,6 +79,10 @@ private:
MainLoop *main_loop;
+#if defined(VULKAN_ENABLED)
+ VulkanContextIPhone *context_vulkan;
+ RenderingDeviceVulkan *rendering_device_vulkan;
+#endif
VideoMode video_mode;
virtual int get_video_driver_count() const;
diff --git a/platform/iphone/vulkan_context_iphone.h b/platform/iphone/vulkan_context_iphone.h
new file mode 100644
index 0000000000..200057e14d
--- /dev/null
+++ b/platform/iphone/vulkan_context_iphone.h
@@ -0,0 +1,48 @@
+/*************************************************************************/
+/* vulkan_context_osx.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef VULKAN_CONTEXT_IPHONE_H
+#define VULKAN_CONTEXT_IPHONE_H
+
+#include "drivers/vulkan/vulkan_context.h"
+// #import <UIKit/UIKit.h>
+
+class VulkanContextIPhone : public VulkanContext {
+
+ virtual const char *_get_platform_surface_extension() const;
+
+public:
+ int window_create(void *p_window, int p_width, int p_height);
+
+ VulkanContextIPhone();
+ ~VulkanContextIPhone();
+};
+
+#endif // VULKAN_CONTEXT_IPHONE_H
diff --git a/platform/iphone/vulkan_context_iphone.mm b/platform/iphone/vulkan_context_iphone.mm
new file mode 100644
index 0000000000..f49b85c097
--- /dev/null
+++ b/platform/iphone/vulkan_context_iphone.mm
@@ -0,0 +1,56 @@
+/*************************************************************************/
+/* vulkan_context_osx.mm */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "vulkan_context_iphone.h"
+#include <vulkan/vulkan_ios.h>
+
+const char *VulkanContextIPhone::_get_platform_surface_extension() const {
+ return VK_MVK_IOS_SURFACE_EXTENSION_NAME;
+}
+
+int VulkanContextIPhone::window_create(void *p_window, int p_width, int p_height) {
+
+ VkIOSSurfaceCreateInfoMVK createInfo;
+ createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.pView = p_window;
+
+ VkSurfaceKHR surface;
+ VkResult err = vkCreateIOSSurfaceMVK(_get_instance(), &createInfo, NULL, &surface);
+ ERR_FAIL_COND_V(err, -1);
+ return _window_create(surface, p_width, p_height);
+}
+
+VulkanContextIPhone::VulkanContextIPhone() {
+}
+
+VulkanContextIPhone::~VulkanContextIPhone() {
+}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index d4eb4927b2..edd65f60e2 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -266,7 +266,6 @@ void VisualShaderNodeCustom::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_name"));
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_description"));
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_category"));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_subcategory"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_return_icon_type"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_port_count"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_port_type", PropertyInfo(Variant::INT, "port")));