Skip to content

Fix Windows build. #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/extension/libgodot.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern "C" {
*
* @return A pointer to created \ref GodotInstance GDExtension object or nullptr if there was an error.
*/
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func);
__declspec(dllexport) GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func, void *p_platform_data);

/**
* @name libgodot_destroy_godot_instance
Expand All @@ -60,7 +60,7 @@ GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[],
* @param p_godot_instance The reference to the GodotInstance object to destroy.
*
*/
void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance);
__declspec(dllexport) void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance);

#ifdef __cplusplus
}
Expand Down
73 changes: 73 additions & 0 deletions doc/classes/DisplayServerEmbedded.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="DisplayServerEmbedded" inherits="DisplayServer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="key">
<return type="void" />
<param index="0" name="key" type="int" enum="Key" />
<param index="1" name="char" type="int" />
<param index="2" name="unshifted" type="int" enum="Key" />
<param index="3" name="physical" type="int" enum="Key" />
<param index="4" name="modifiers" type="int" enum="KeyModifierMask" is_bitfield="true" />
<param index="5" name="pressed" type="bool" />
<param index="6" name="window" type="int" default="0" />
<description>
</description>
</method>
<method name="resize_window">
<return type="void" />
<param index="0" name="size" type="Vector2i" />
<param index="1" name="id" type="int" />
<description>
</description>
</method>
<method name="set_content_scale">
<return type="void" />
<param index="0" name="content_scale" type="float" />
<description>
</description>
</method>
<method name="set_native_surface" qualifiers="static">
<return type="void" />
<param index="0" name="native_surface" type="RenderingNativeSurface" />
<description>
</description>
</method>
<method name="touch_drag">
<return type="void" />
<param index="0" name="idx" type="int" />
<param index="1" name="prev_x" type="int" />
<param index="2" name="prev_y" type="int" />
<param index="3" name="x" type="int" />
<param index="4" name="y" type="int" />
<param index="5" name="pressure" type="float" />
<param index="6" name="tilt" type="Vector2" />
<param index="7" name="window" type="int" />
<description>
</description>
</method>
<method name="touch_press">
<return type="void" />
<param index="0" name="idx" type="int" />
<param index="1" name="x" type="int" />
<param index="2" name="y" type="int" />
<param index="3" name="pressed" type="bool" />
<param index="4" name="double_click" type="bool" />
<param index="5" name="window" type="int" />
<description>
</description>
</method>
<method name="touches_canceled">
<return type="void" />
<param index="0" name="idx" type="int" />
<param index="1" name="window" type="int" />
<description>
</description>
</method>
</methods>
</class>
7 changes: 7 additions & 0 deletions doc/classes/GDExtensionManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
Loads an extension by absolute file path. The [param path] needs to point to a valid [GDExtension]. Returns [constant LOAD_STATUS_OK] if successful.
</description>
</method>
<method name="load_function_extension">
<return type="int" enum="GDExtensionManager.LoadStatus" />
<param index="0" name="path" type="String" />
<param index="1" name="init_func" type="const GDExtensionInitializationFunction*" />
<description>
</description>
</method>
<method name="reload_extension">
<return type="int" enum="GDExtensionManager.LoadStatus" />
<param index="0" name="path" type="String" />
Expand Down
26 changes: 26 additions & 0 deletions doc/classes/GodotInstance.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="GodotInstance" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="is_started">
<return type="bool" />
<description>
</description>
</method>
<method name="iteration">
<return type="bool" />
<description>
</description>
</method>
<method name="start">
<return type="bool" />
<description>
</description>
</method>
</methods>
</class>
9 changes: 9 additions & 0 deletions doc/classes/RenderingNativeSurface.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RenderingNativeSurface" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
</class>
17 changes: 17 additions & 0 deletions doc/classes/RenderingNativeSurfaceApple.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RenderingNativeSurfaceApple" inherits="RenderingNativeSurface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="create" qualifiers="static">
<return type="RenderingNativeSurfaceApple" />
<param index="0" name="layer" type="int" />
<description>
</description>
</method>
</methods>
</class>
17 changes: 17 additions & 0 deletions doc/classes/RenderingNativeSurfaceVulkan.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RenderingNativeSurfaceVulkan" inherits="RenderingNativeSurface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="create" qualifiers="static">
<return type="RenderingNativeSurfaceVulkan" />
<param index="0" name="vulkan_surface" type="const void*" />
<description>
</description>
</method>
</methods>
</class>
18 changes: 18 additions & 0 deletions doc/classes/RenderingNativeSurfaceWayland.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RenderingNativeSurfaceWayland" inherits="RenderingNativeSurface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="create" qualifiers="static">
<return type="RenderingNativeSurfaceWayland" />
<param index="0" name="window" type="const void*" />
<param index="1" name="display" type="const void*" />
<description>
</description>
</method>
</methods>
</class>
18 changes: 18 additions & 0 deletions doc/classes/RenderingNativeSurfaceX11.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RenderingNativeSurfaceX11" inherits="RenderingNativeSurface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="create" qualifiers="static">
<return type="RenderingNativeSurfaceX11" />
<param index="0" name="window" type="const void*" />
<param index="1" name="display" type="const void*" />
<description>
</description>
</method>
</methods>
</class>
6 changes: 6 additions & 0 deletions doc/classes/Window.xml
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,12 @@
Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
</description>
</method>
<method name="set_native_surface">
<return type="void" />
<param index="0" name="native_surface" type="RenderingNativeSurface" />
<description>
</description>
</method>
<method name="set_unparent_when_invisible">
<return type="void" />
<param index="0" name="unparent" type="bool" />
Expand Down
1 change: 1 addition & 0 deletions drivers/d3d12/rendering_context_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "core/string/ustring.h"
#include "core/templates/local_vector.h"
#include "core/version.h"
#include "platform/windows/rendering_native_surface_windows.h"
#include "servers/rendering/rendering_device.h"

#if defined(__GNUC__) && !defined(__clang__)
Expand Down
2 changes: 1 addition & 1 deletion drivers/d3d12/rendering_device_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ static D3D12_BARRIER_LAYOUT _rd_texture_layout_to_d3d12_barrier_layout(RDD::Text
void RenderingDeviceDriverD3D12::command_pipeline_barrier(CommandBufferID p_cmd_buffer,
BitField<PipelineStageBits> p_src_stages,
BitField<PipelineStageBits> p_dst_stages,
VectorView<RDD::MemoryBarrier> p_memory_barriers,
VectorView<RDD::MemoryBarrierAlias> p_memory_barriers,
VectorView<RDD::BufferBarrier> p_buffer_barriers,
VectorView<RDD::TextureBarrier> p_texture_barriers) {
if (!barrier_capabilities.enhanced_barriers_supported) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/d3d12/rendering_device_driver_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
CommandBufferID p_cmd_buffer,
BitField<PipelineStageBits> p_src_stages,
BitField<PipelineStageBits> p_dst_stages,
VectorView<RDD::MemoryBarrier> p_memory_barriers,
VectorView<RDD::MemoryBarrierAlias> p_memory_barriers,
VectorView<RDD::BufferBarrier> p_buffer_barriers,
VectorView<RDD::TextureBarrier> p_texture_barriers) override final;

Expand Down
4 changes: 4 additions & 0 deletions drivers/register_driver_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@
#include "drivers/png/resource_saver_png.h"

#include "drivers/apple/rendering_native_surface_apple.h"
#ifdef VULKAN_ENABLED
#include "drivers/vulkan/rendering_native_surface_vulkan.h"
#endif

static Ref<ImageLoaderPNG> image_loader_png;
static Ref<ResourceSaverPNG> resource_saver_png;

void register_core_driver_types() {
GDREGISTER_ABSTRACT_CLASS(RenderingNativeSurfaceApple)

Check warning on line 47 in drivers/register_driver_types.cpp

View check run for this annotation

qiniu-x / cppcheck

drivers/register_driver_types.cpp#L47

There is an unknown macro here somewhere. Configuration is required. If GDREGISTER_ABSTRACT_CLASS is a macro then please configure it.
#ifdef VULKAN_ENABLED
GDREGISTER_ABSTRACT_CLASS(RenderingNativeSurfaceVulkan)
#endif

image_loader_png.instantiate();
ImageLoader::add_image_format_loader(image_loader_png);
Expand Down
1 change: 1 addition & 0 deletions platform/android/display_server_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "core/config/project_settings.h"

#if defined(RD_ENABLED)
#include "rendering_native_surface_android.h"
#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
#include "servers/rendering/rendering_device.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions platform/android/rendering_context_driver_vulkan_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ RenderingContextDriver::SurfaceID RenderingContextDriverVulkanAndroid::surface_c

VkAndroidSurfaceCreateInfoKHR create_info = {};
create_info.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
create_info.window = wpd->window;
create_info.window = android_native_surface->get_window();

VkSurfaceKHR vk_surface = VK_NULL_HANDLE;
VkResult err = vkCreateAndroidSurfaceKHR(instance_get(), &create_info, nullptr, &vk_surface);
ERR_FAIL_COND_V(err != VK_SUCCESS, SurfaceID());

Ref<RenderingNativeSurfaceVulkan> vulkan_surface = RenderingNativeSurfaceVulkan::create(vk_surface);
RenderingContextDriver::SurfaceID result = RenderingContextDriverVulkan::surface_create(vulkan_surface);
memdelete(vulkan_surface);
return result;
}

Expand Down
4 changes: 4 additions & 0 deletions platform/ios/display_server_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@

#import <sys/utsname.h>

#if defined(RD_ENABLED)
#include "drivers/apple/rendering_native_surface_apple.h"
#endif

static const float kDisplayServerIOSAcceleration = 1.f;

DisplayServerIOS *DisplayServerIOS::get_singleton() {
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/libgodot_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

static GodotInstance *instance = nullptr;

GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func) {
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func, void *p_platform_data) {
ERR_FAIL_COND_V_MSG(instance != nullptr, nullptr, "Only one Godot Instance may be created.");

os = new OS_IOS();
Expand Down
2 changes: 1 addition & 1 deletion platform/linuxbsd/libgodot_linuxbsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static OS_LinuxBSD *os = nullptr;

static GodotInstance *instance = nullptr;

GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func) {
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func, void *p_platform_data) {
ERR_FAIL_COND_V_MSG(instance != nullptr, nullptr, "Only one Godot Instance may be created.");

os = new OS_LinuxBSD();
Expand Down
4 changes: 2 additions & 2 deletions platform/linuxbsd/wayland/display_server_wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ bool DisplayServerWayland::_show_window() {
}
}

Error err = rendering_context->window_create(wd.id, wayland_surface);
ERR_FAIL_COND_V_MSG(err != OK, false, vformat("Can't create a %s window", rendering_driver));
Error create_err = rendering_context->window_create(wd.id, wayland_surface);
ERR_FAIL_COND_V_MSG(create_err != OK, false, vformat("Can't create a %s window", rendering_driver));

rendering_context->window_set_size(wd.id, wd.rect.size.width, wd.rect.size.height);
rendering_context->window_set_vsync_mode(wd.id, wd.vsync_mode);
Expand Down
2 changes: 1 addition & 1 deletion platform/macos/libgodot_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

static GodotInstance *instance = nullptr;

GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func) {
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func, void *p_platform_data) {
ERR_FAIL_COND_V_MSG(instance != nullptr, nullptr, "Only one Godot Instance may be created.");

os = new OS_MacOS();
Expand Down
10 changes: 7 additions & 3 deletions platform/windows/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ common_win = [
"rendering_native_surface_windows.cpp",
]

libgodot_files = [
"libgodot_windows.cpp",
]

if env.msvc:
common_win += ["crash_handler_windows_seh.cpp"]
else:
Expand Down Expand Up @@ -57,12 +61,12 @@ env.add_source_files(sources, common_win)
sources += res_obj

if env["library_type"] == "static_library":
prog = env.add_library("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
prog = env.add_library("#bin/godot", sources + libgodot_files)
arrange_program_clean(prog)
elif env["library_type"] == "shared_library":
prog = env.add_shared_library("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
prog = env.add_shared_library("#bin/godot", sources + libgodot_files)
arrange_program_clean(prog)
else:
else: # building executable
prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
arrange_program_clean(prog)

Expand Down
Loading
Loading