diff options
Diffstat (limited to 'drivers')
32 files changed, 100 insertions, 100 deletions
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index 90c3d3af83..488fd4b468 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -32,8 +32,8 @@ #ifdef ALSA_ENABLED +#include "core/config/project_settings.h" #include "core/os/os.h" -#include "core/project_settings.h" #include <errno.h> diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp index 69a6956c2b..07a4360cd2 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.cpp +++ b/drivers/alsamidi/midi_driver_alsamidi.cpp @@ -33,7 +33,7 @@ #include "midi_driver_alsamidi.h" #include "core/os/os.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <errno.h> diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h index 6aabe8e3fd..fef87459c7 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.h +++ b/drivers/alsamidi/midi_driver_alsamidi.h @@ -36,7 +36,7 @@ #include "core/os/midi_driver.h" #include "core/os/mutex.h" #include "core/os/thread.h" -#include "core/vector.h" +#include "core/templates/vector.h" #include <alsa/asoundlib.h> #include <stdio.h> diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index 48d0a29516..60c491f5f8 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -32,8 +32,8 @@ #include "audio_driver_coreaudio.h" +#include "core/config/project_settings.h" #include "core/os/os.h" -#include "core/project_settings.h" #define kOutputBus 0 #define kInputBus 1 diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp index 004c594e17..b9e7853735 100644 --- a/drivers/coremidi/midi_driver_coremidi.cpp +++ b/drivers/coremidi/midi_driver_coremidi.cpp @@ -32,7 +32,7 @@ #include "midi_driver_coremidi.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <CoreAudio/HostTime.h> #include <CoreServices/CoreServices.h> diff --git a/drivers/coremidi/midi_driver_coremidi.h b/drivers/coremidi/midi_driver_coremidi.h index 0459544f75..02167aa891 100644 --- a/drivers/coremidi/midi_driver_coremidi.h +++ b/drivers/coremidi/midi_driver_coremidi.h @@ -34,7 +34,7 @@ #define MIDI_DRIVER_COREMIDI_H #include "core/os/midi_driver.h" -#include "core/vector.h" +#include "core/templates/vector.h" #include <CoreMIDI/CoreMIDI.h> #include <stdio.h> diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index bef4d999af..2d1c4f8d85 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -32,8 +32,8 @@ #define RASTERIZER_DUMMY_H #include "core/math/camera_matrix.h" -#include "core/rid_owner.h" -#include "core/self_list.h" +#include "core/templates/rid_owner.h" +#include "core/templates/self_list.h" #include "scene/resources/mesh.h" #include "servers/rendering/rasterizer.h" #include "servers/rendering_server.h" @@ -98,7 +98,7 @@ public: void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) override {} - void environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density) override {} + void environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_aerial_perspective) override {} void environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_light, float p_light_energy, float p_length, float p_detail_spread, float p_gi_inject, RS::EnvVolumetricFogShadowFilter p_shadow_filter) override {} void environment_set_volumetric_fog_volume_size(int p_size, int p_depth) override {} void environment_set_volumetric_fog_filter_active(bool p_enable) override {} @@ -161,7 +161,7 @@ public: void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {} RID render_buffers_create() override { return RID(); } - void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa) override {} + void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding) override {} void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {} bool screen_space_roughness_limiter_is_active() const override { return false; } @@ -251,6 +251,15 @@ public: void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {} + /* CANVAS TEXTURE API */ + + RID canvas_texture_create() override { return RID(); } + void canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture) override {} + void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess) override {} + + void canvas_texture_set_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) override {} + void canvas_texture_set_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) override {} + #if 0 RID texture_create() override { @@ -935,23 +944,22 @@ public: class RasterizerCanvasDummy : public RasterizerCanvas { public: - TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) override { return 0; } - void free_texture_binding(TextureBindingID p_binding) override {} - PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>()) override { return 0; } void free_polygon(PolygonID p_polygon) override {} - void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform) override {} + void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, Light *p_directional_list, const Transform2D &p_canvas_transform, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_vertices_to_pixel) override {} void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) override {} RID light_create() override { return RID(); } void light_set_texture(RID p_rid, RID p_texture) override {} - void light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution) override {} - void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) override {} + void light_set_use_shadow(RID p_rid, bool p_enable) override {} + void light_update_shadow(RID p_rid, int p_shadow_index, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) override {} + void light_update_directional_shadow(RID p_rid, int p_shadow_index, const Transform2D &p_light_xform, int p_light_mask, float p_cull_distance, const Rect2 &p_clip_rect, LightOccluderInstance *p_occluders) override {} RID occluder_polygon_create() override { return RID(); } void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) override {} void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) override {} + void set_shadow_texture_size(int p_size) override {} void draw_window_margins(int *p_margins, RID *p_margin_textures) override {} diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp index ddd2943720..6158a2ac54 100644 --- a/drivers/dummy/texture_loader_dummy.cpp +++ b/drivers/dummy/texture_loader_dummy.cpp @@ -31,7 +31,7 @@ #include "texture_loader_dummy.h" #include "core/os/file_access.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <string.h> diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 79924b849c..cd0c68e947 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -31,7 +31,7 @@ #include "image_loader_png.h" #include "core/os/os.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include "drivers/png/png_driver_common.h" #include <string.h> diff --git a/drivers/png/png_driver_common.h b/drivers/png/png_driver_common.h index 2099ddc536..e7ec9b96bd 100644 --- a/drivers/png/png_driver_common.h +++ b/drivers/png/png_driver_common.h @@ -31,7 +31,7 @@ #ifndef PNG_DRIVER_COMMON_H #define PNG_DRIVER_COMMON_H -#include "core/image.h" +#include "core/io/image.h" namespace PNGDriverCommon { diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 3a0b319a45..a2d0d5881a 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -30,7 +30,7 @@ #include "resource_saver_png.h" -#include "core/image.h" +#include "core/io/image.h" #include "core/os/file_access.h" #include "drivers/png/png_driver_common.h" #include "scene/resources/texture.h" diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index c32b383521..1d4dcfb57f 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -31,7 +31,7 @@ #ifndef RESOURCE_SAVER_PNG_H #define RESOURCE_SAVER_PNG_H -#include "core/image.h" +#include "core/io/image.h" #include "core/io/resource_saver.h" class ResourceSaverPNG : public ResourceFormatSaver { diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index a6bc4f3b2c..5acaa3ac99 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -32,8 +32,8 @@ #ifdef PULSEAUDIO_ENABLED +#include "core/config/project_settings.h" #include "core/os/os.h" -#include "core/project_settings.h" void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) { AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata; diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 5b99a2f53f..63fa143a03 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -32,9 +32,9 @@ #if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED) -#include "core/list.h" #include "core/os/memory.h" -#include "core/print_string.h" +#include "core/string/print_string.h" +#include "core/templates/list.h" #include <errno.h> #include <stdio.h> diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 51c657007c..ce1e135fe0 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -33,7 +33,7 @@ #if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED) #include "core/os/os.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <sys/stat.h> #include <sys/types.h> diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index eec6eb8303..318638e5d0 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -32,10 +32,10 @@ #ifdef UNIX_ENABLED +#include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" #include "core/debugger/script_debugger.h" #include "core/os/thread_dummy.h" -#include "core/project_settings.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" #include "drivers/unix/net_socket_posix.h" diff --git a/drivers/unix/rw_lock_posix.cpp b/drivers/unix/rw_lock_posix.cpp index 50b74e84f7..cf24d54c50 100644 --- a/drivers/unix/rw_lock_posix.cpp +++ b/drivers/unix/rw_lock_posix.cpp @@ -32,7 +32,7 @@ #include "rw_lock_posix.h" -#include "core/error_macros.h" +#include "core/error/error_macros.h" #include "core/os/memory.h" #include <stdio.h> diff --git a/drivers/unix/syslog_logger.cpp b/drivers/unix/syslog_logger.cpp index a4c7070f0e..b29d1ec541 100644 --- a/drivers/unix/syslog_logger.cpp +++ b/drivers/unix/syslog_logger.cpp @@ -31,7 +31,7 @@ #ifdef UNIX_ENABLED #include "syslog_logger.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <syslog.h> void SyslogLogger::logv(const char *p_format, va_list p_list, bool p_err) { diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index 285088342b..f4e3de7646 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -32,9 +32,9 @@ #if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS) +#include "core/object/script_language.h" #include "core/os/memory.h" -#include "core/safe_refcount.h" -#include "core/script_language.h" +#include "core/templates/safe_refcount.h" #ifdef PTHREAD_BSD_SET_NAME #include <pthread_np.h> diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub index ddd6be51bc..13fcaf16d2 100644 --- a/drivers/vulkan/SCsub +++ b/drivers/vulkan/SCsub @@ -64,7 +64,6 @@ elif env["builtin_vulkan"]: "VK_USE_PLATFORM_WIN32_KHR", "VULKAN_NON_CMAKE_BUILD", "WIN32_LEAN_AND_MEAN", - "STRSAFE_NO_DEPRECATE", 'API_NAME=\\"%s\\"' % "Vulkan", ] ) diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 92d7906b6c..902876616b 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -30,10 +30,10 @@ #include "rendering_device_vulkan.h" -#include "core/hashfuncs.h" +#include "core/config/project_settings.h" #include "core/os/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" +#include "core/templates/hashfuncs.h" #include "drivers/vulkan/vulkan_context.h" #include "thirdparty/spirv-reflect/spirv_reflect.h" @@ -2947,7 +2947,7 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color, image_memory_barrier.srcAccessMask = valid_texture_access; image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; image_memory_barrier.oldLayout = src_tex->layout; - image_memory_barrier.oldLayout = clear_layout; + image_memory_barrier.newLayout = clear_layout; image_memory_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; @@ -3227,8 +3227,8 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF } if (reference.layout != description.finalLayout) { // NOTE: this should be smarter based on the textures knowledge of it's subsequent role - dependency_from_external.dstStageMask |= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; - dependency_from_external.dstAccessMask |= VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; + dependency_to_external.dstStageMask |= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + dependency_to_external.dstAccessMask |= VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; } } @@ -3258,7 +3258,7 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF render_pass_create_info.pAttachments = attachments.ptr(); render_pass_create_info.subpassCount = 1; render_pass_create_info.pSubpasses = &subpass; - render_pass_create_info.dependencyCount = 0; //2 - throws validation layer error + render_pass_create_info.dependencyCount = 2; render_pass_create_info.pDependencies = dependencies; VkRenderPass render_pass; @@ -6795,13 +6795,12 @@ void RenderingDeviceVulkan::compute_list_add_barrier(ComputeListID p_list) { void RenderingDeviceVulkan::compute_list_end() { ERR_FAIL_COND(!compute_list); - const VkPipelineStageFlags dest_stage_mask = VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT; for (Set<Texture *>::Element *E = compute_list->state.textures_to_sampled_layout.front(); E; E = E->next()) { VkImageMemoryBarrier image_memory_barrier; image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; image_memory_barrier.pNext = nullptr; image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; - image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT; + image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_TRANSFER_READ_BIT; image_memory_barrier.oldLayout = E->get()->layout; image_memory_barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; @@ -6815,7 +6814,7 @@ void RenderingDeviceVulkan::compute_list_end() { image_memory_barrier.subresourceRange.layerCount = E->get()->layers; // TODO: Look at the usages in the compute list and determine tighter dst stage and access masks based on some "final" usage equivalent - vkCmdPipelineBarrier(compute_list->command_buffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dest_stage_mask, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier); + vkCmdPipelineBarrier(compute_list->command_buffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier); E->get()->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; } @@ -6825,7 +6824,7 @@ void RenderingDeviceVulkan::compute_list_end() { #ifdef FORCE_FULL_BARRIER _full_barrier(true); #else - _memory_barrier(VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dest_stage_mask, VK_ACCESS_SHADER_WRITE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT, true); + _memory_barrier(VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT, true); #endif } diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h index e6cbf2e01d..6463078d0a 100644 --- a/drivers/vulkan/rendering_device_vulkan.h +++ b/drivers/vulkan/rendering_device_vulkan.h @@ -31,9 +31,9 @@ #ifndef RENDERING_DEVICE_VULKAN_H #define RENDERING_DEVICE_VULKAN_H -#include "core/oa_hash_map.h" #include "core/os/thread_safe.h" -#include "core/rid_owner.h" +#include "core/templates/oa_hash_map.h" +#include "core/templates/rid_owner.h" #include "servers/rendering/rendering_device.h" #ifdef DEBUG_ENABLED diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 997ed3935f..28634d5e70 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -30,9 +30,9 @@ #include "vulkan_context.h" -#include "core/engine.h" -#include "core/project_settings.h" -#include "core/ustring.h" +#include "core/config/engine.h" +#include "core/config/project_settings.h" +#include "core/string/ustring.h" #include "core/version.h" #include "vk_enum_string_helper.h" @@ -154,7 +154,7 @@ VkBool32 VulkanContext::_check_layers(uint32_t check_count, const char **check_n } } if (!found) { - ERR_PRINT("Can't find layer: " + String(check_names[i])); + WARN_PRINT("Can't find layer: " + String(check_names[i])); return 0; } } @@ -707,7 +707,8 @@ Error VulkanContext::_window_create(DisplayServer::WindowID p_window_id, VkSurfa // We use a single GPU, but we need a surface to initialize the // queues, so this process must be deferred until a surface // is created. - _initialize_queues(p_surface); + Error err = _initialize_queues(p_surface); + ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE); } Window window; @@ -1479,23 +1480,6 @@ VkPhysicalDeviceLimits VulkanContext::get_device_limits() const { return gpu_props.limits; } -VulkanContext::VulkanContext() { - queue_props = nullptr; - command_buffer_count = 0; - instance_validation_layers = nullptr; - use_validation_layers = true; - VK_KHR_incremental_present_enabled = true; - VK_GOOGLE_display_timing_enabled = true; - - command_buffer_queue.resize(1); //first one is the setup command always - command_buffer_queue.write[0] = nullptr; - command_buffer_count = 1; - queues_initialized = false; - - buffers_prepared = false; - swapchainImageCount = 0; -} - RID VulkanContext::local_device_create() { LocalDevice ld; @@ -1583,6 +1567,13 @@ void VulkanContext::local_device_free(RID p_local_device) { local_device_owner.free(p_local_device); } +VulkanContext::VulkanContext() { + use_validation_layers = Engine::get_singleton()->is_validation_layers_enabled(); + + command_buffer_queue.resize(1); // First one is always the setup command. + command_buffer_queue.write[0] = nullptr; +} + VulkanContext::~VulkanContext() { if (queue_props) { free(queue_props); @@ -1596,7 +1587,7 @@ VulkanContext::~VulkanContext() { vkDestroySemaphore(device, image_ownership_semaphores[i], nullptr); } } - if (inst_initialized) { + if (inst_initialized && use_validation_layers) { DestroyDebugUtilsMessengerEXT(inst, dbg_messenger, nullptr); } vkDestroyDevice(device, nullptr); diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h index 9ebea42ecb..26d4b76e86 100644 --- a/drivers/vulkan/vulkan_context.h +++ b/drivers/vulkan/vulkan_context.h @@ -31,12 +31,13 @@ #ifndef VULKAN_CONTEXT_H #define VULKAN_CONTEXT_H -#include "core/error_list.h" -#include "core/map.h" +#include "core/error/error_list.h" #include "core/os/mutex.h" -#include "core/rid_owner.h" -#include "core/ustring.h" +#include "core/string/ustring.h" +#include "core/templates/map.h" +#include "core/templates/rid_owner.h" #include "servers/display_server.h" + #include <vulkan/vulkan.h> class VulkanContext { @@ -51,13 +52,15 @@ class VulkanContext { VkPhysicalDevice gpu; VkPhysicalDeviceProperties gpu_props; uint32_t queue_family_count; - VkQueueFamilyProperties *queue_props; + VkQueueFamilyProperties *queue_props = nullptr; VkDevice device; bool device_initialized = false; bool inst_initialized = false; - //present - bool queues_initialized; + bool buffers_prepared = false; + + // Present queue. + bool queues_initialized = false; uint32_t graphics_queue_family_index; uint32_t present_queue_family_index; bool separate_present_queue; @@ -78,7 +81,6 @@ class VulkanContext { VkCommandBuffer graphics_to_present_cmd; VkImageView view; VkFramebuffer framebuffer; - } SwapchainImageResources; struct Window { @@ -89,7 +91,7 @@ class VulkanContext { uint32_t current_buffer = 0; int width = 0; int height = 0; - VkCommandPool present_cmd_pool; //for separate present queue + VkCommandPool present_cmd_pool; // For separate present queue. VkRenderPass render_pass = VK_NULL_HANDLE; }; @@ -102,19 +104,24 @@ class VulkanContext { RID_Owner<LocalDevice, true> local_device_owner; Map<DisplayServer::WindowID, Window> windows; - uint32_t swapchainImageCount; + uint32_t swapchainImageCount = 0; - //commands + // Commands. bool prepared; - //extensions - bool VK_KHR_incremental_present_enabled; - bool VK_GOOGLE_display_timing_enabled; - const char **instance_validation_layers; - uint32_t enabled_extension_count; - uint32_t enabled_layer_count; + Vector<VkCommandBuffer> command_buffer_queue; + int command_buffer_count = 1; + + // Extensions. + + bool VK_KHR_incremental_present_enabled = true; + bool VK_GOOGLE_display_timing_enabled = true; + uint32_t enabled_extension_count = 0; const char *extension_names[MAX_EXTENSIONS]; + + const char **instance_validation_layers = nullptr; + uint32_t enabled_layer_count = 0; const char *enabled_layers[MAX_LAYERS]; PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT; @@ -142,7 +149,8 @@ class VulkanContext { Error _initialize_extensions(); VkBool32 _check_layers(uint32_t check_count, const char **check_names, uint32_t layer_count, VkLayerProperties *layers); - static VKAPI_ATTR VkBool32 VKAPI_CALL _debug_messenger_callback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + static VKAPI_ATTR VkBool32 VKAPI_CALL _debug_messenger_callback( + VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *pUserData); @@ -160,12 +168,11 @@ class VulkanContext { Error _create_swap_chain(); Error _create_semaphores(); - Vector<VkCommandBuffer> command_buffer_queue; - int command_buffer_count; - protected: virtual const char *_get_platform_surface_extension() const = 0; - // virtual VkResult _create_surface(VkSurfaceKHR *surface, VkInstance p_instance) = 0; + + // Enabled via command line argument. + bool use_validation_layers = false; virtual Error _window_create(DisplayServer::WindowID p_window_id, VkSurfaceKHR p_surface, int p_width, int p_height); @@ -173,10 +180,6 @@ protected: return inst; } - bool buffers_prepared; - - bool use_validation_layers; - public: VkDevice get_device(); VkPhysicalDevice get_physical_device(); diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index cd1c08b717..67e175d8d1 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -32,8 +32,8 @@ #include "audio_driver_wasapi.h" +#include "core/config/project_settings.h" #include "core/os/os.h" -#include "core/project_settings.h" #include <functiondiscoverykeys.h> diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 03e4e30797..3c61aa7289 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -33,7 +33,7 @@ #include "dir_access_windows.h" #include "core/os/memory.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <stdio.h> #include <wchar.h> diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index dd86061ea7..ec393c98ba 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -33,7 +33,7 @@ #include "file_access_windows.h" #include "core/os/os.h" -#include "core/print_string.h" +#include "core/string/print_string.h" #include <shlwapi.h> #include <windows.h> diff --git a/drivers/windows/rw_lock_windows.cpp b/drivers/windows/rw_lock_windows.cpp index 757c7661f5..1007689728 100644 --- a/drivers/windows/rw_lock_windows.cpp +++ b/drivers/windows/rw_lock_windows.cpp @@ -32,7 +32,7 @@ #include "rw_lock_windows.h" -#include "core/error_macros.h" +#include "core/error/error_macros.h" #include "core/os/memory.h" #include <stdio.h> diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h index 502c418ce0..939f487fc1 100644 --- a/drivers/windows/thread_windows.h +++ b/drivers/windows/thread_windows.h @@ -33,8 +33,8 @@ #ifdef WINDOWS_ENABLED +#include "core/object/script_language.h" #include "core/os/thread.h" -#include "core/script_language.h" #include <windows.h> diff --git a/drivers/winmidi/midi_driver_winmidi.cpp b/drivers/winmidi/midi_driver_winmidi.cpp index 9cbc7f43e2..75f57b3bb9 100644 --- a/drivers/winmidi/midi_driver_winmidi.cpp +++ b/drivers/winmidi/midi_driver_winmidi.cpp @@ -32,7 +32,7 @@ #include "midi_driver_winmidi.h" -#include "core/print_string.h" +#include "core/string/print_string.h" void MIDIDriverWinMidi::read(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { if (wMsg == MIM_DATA) { diff --git a/drivers/winmidi/midi_driver_winmidi.h b/drivers/winmidi/midi_driver_winmidi.h index 934eb5a493..9ed3fc2faa 100644 --- a/drivers/winmidi/midi_driver_winmidi.h +++ b/drivers/winmidi/midi_driver_winmidi.h @@ -34,7 +34,7 @@ #define MIDI_DRIVER_WINMIDI_H #include "core/os/midi_driver.h" -#include "core/vector.h" +#include "core/templates/vector.h" #include <stdio.h> #include <windows.h> diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 421cf6a8cf..c9ad054089 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -30,8 +30,8 @@ #include "audio_driver_xaudio2.h" +#include "core/config/project_settings.h" #include "core/os/os.h" -#include "core/project_settings.h" const char *AudioDriverXAudio2::get_name() const { return "XAudio2"; |