Commit Graph

132 Commits

Author SHA1 Message Date
Stuart Carnie 5cfacc8767
[Editor,Servers]: Minor optimizations 2024-09-12 06:22:04 +10:00
Pedro J. Estébanez 7f1989bac1 RenderingDevice: Fix uncapped mipmap sizes causing div-by-zero 2024-09-09 17:10:47 +02:00
Rémi Verschelde e98aaf1caa
Merge pull request #94477 from RedMser/typos-batch-1
Fix various typos
2024-08-28 00:12:12 +02:00
Rémi Verschelde 330fca1ffd
Merge pull request #93985 from alvinhochun/windows-gpu-pref
Respect integrated GPU preference in Windows Settings
2024-08-28 00:11:45 +02:00
Matias N. Goldberg 59d0422dcd Disable extra memory tracking by default
PR #90993 added several debugging utilities.

Among them, advanced memory tracking through the use of custom
allocators and VK_EXT_device_memory_report.

However as issue #95967 reveals, it is dangerous to leave it on by
default because drivers (or even the Vulkan loader) can too easily
accidentally break custom allocators by allocating memory through std
malloc but then request us to deallocate it (or viceversa).

This PR fixes the following problems:
 - Adds --extra-gpu-memory-tracking cmd line argument
 - Adds missing enum entries to
RenderingContextDriverVulkan::VkTrackedObjectType
 - Adds RenderingDevice::get_driver_and_device_memory_report
    - GDScript users can easily check via print(
RenderingServer.get_rendering_device().get_driver_and_device_memory_report()
)
- Uses get_driver_and_device_memory_report on device lost for appending
further info.

Fixes #95967
2024-08-24 20:52:39 -03:00
Matias N. Goldberg 364f916f3f
Add debug utilities for Vulkan
Features:
- Debug-only tracking of objects by type. See
get_driver_allocs_by_object_type et al.
 - Debug-only Breadcrumb info for debugging GPU crashes and device lost
 - Performance report per frame from get_perf_report
- Some VMA calls had to be modified in order to insert the necessary
memory callbacks

Functionality marked as "debug-only" is only available in debug or dev
builds.

Misc fixes:
 - Early break optimization in RenderingDevice::uniform_set_create

============================

The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.
2024-08-21 23:48:08 +02:00
Stuart Carnie 2d0165574d
Add Metal support for macOS (arm64) and iOS 2024-08-20 12:11:06 +02:00
clayjohn b0e33aa00f Fail when submit or sync called on main rendering device
Fail if submit or sync called multiple times in a row
2024-08-12 15:50:01 -07:00
BlueCube3310 eb3b217777 RenderingDevice: Use the correct amount of layers for Cubemaps for boundary checks 2024-07-24 20:26:46 +02:00
BlueCube3310 741bb152ae RenderingDevice: Fix getting cubemap data 2024-07-23 13:44:28 +02:00
Rémi Verschelde 0f1e2c38a8
Merge pull request #94069 from RandomShaper/fix_vk_vali_blocky
RenderingDevice: Leave handling of compressed block granularity to the driver
2024-07-18 10:45:27 +02:00
RedMser f9258ff928 Fix typos 2024-07-17 18:53:03 +02:00
Alvin Wong 4091abd727 Respect integrated GPU preference in Windows Settings 2024-07-16 23:46:37 +08:00
Hugo Locurcio cf2d2e2dd8
Silence Vulkan "Unable to acquire framebuffer." swapchain error
This error is harmless and can be safely ignored.
2024-07-09 17:12:54 +02:00
Pedro J. Estébanez 00e89229bf RenderingDevice: Leave handling of compressed block granularity to the driver 2024-07-08 11:58:51 +02:00
Rémi Verschelde 7197678df2
Merge pull request #91551 from m4rr5/configure_timestamp_query_elements
Add a project setting to configure the maximum number of timestamps.
2024-07-07 12:38:19 +02:00
Pedro J. Estébanez 32d9c93af3 Improve handling of rendering startup errors 2024-06-28 19:31:50 +02:00
Rémi Verschelde 705b7a0b0b
Merge pull request #92587 from RandomShaper/validate_tex_usage
RenderingDevice: Reject creation of textures with no usage
2024-05-31 14:16:55 +02:00
Rémi Verschelde f2796fa06d
Merge pull request #91769 from DarioSamo/d3d12_enhanced_barriers
Add support for enhanced barriers in D3D12.
2024-05-31 14:15:49 +02:00
Pedro J. Estébanez 3e5865660b RenderingDevice: Reject creation of textures with no usage 2024-05-31 12:00:58 +02:00
Rémi Verschelde abfe8ba7d6
Merge pull request #92258 from DarioSamo/render_list_pass_alloc
Reduce allocations each time a render pass begins in RenderingDevice.
2024-05-23 23:25:51 +02:00
Dario ce4f19a034 Switch vectors in each render pass to use TLS. 2024-05-23 10:52:29 -03:00
bruvzg 628c81d2d9
[DisplayServer] Add method to check if window transparency is supported and enabled. 2024-05-23 15:23:18 +03:00
Dario adabd14d08 Add support for enhanced barriers in D3D12.
Enables support for enhanced barriers if available.

Gets rid of the implementation of [CROSS_FAMILY_FALLBACK] in the D3D12 driver. The logic has been reimplemented at a higher level in RenderingDevice itself.

This fallback is only used if the RenderingDeviceDriver reports the API traits and the capability of sharing texture formats correctly. Aliases created in this way can only be used for sampling: never for writing. In most cases, the formats that do not support sharing do not support unordered access/storage writes in the first place.
2024-05-20 13:04:44 -03:00
Rémi Verschelde d3e261523f
Merge pull request #88289 from DarioSamo/rd_minimized_window
Fix swap chain errors when application starts minimized.
2024-05-17 11:13:31 +02:00
Dario 61cd007cf4 Rewrite implementation for prepare for use commands to be skipped when not required by the API. 2024-05-15 14:34:52 -03:00
Dario d5789e09eb Add optional driver workaround to RenderingDevice for Adreno 6XX.
Co-authored-by: Clay John <claynjohn@gmail.com>
2024-05-13 10:20:31 -03:00
A Thousand Ships a0dbdcc3ab
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
Marcel Offermans 2bb34a4489 Added a project setting to configure the maximum amount of timestamps, with a description and a reference to the setting when the limit is hit and an ERR_FAIL_COND is hit. 2024-05-05 09:09:04 +02:00
Rémi Verschelde 7ebc866418
Merge pull request #91545 from clayjohn/RD-shadow-atlas
Properly set size of shadow atlas quadrant when subdivision is 8 or higher.
2024-05-04 11:52:45 +02:00
clayjohn caeef3473b Properly set size of shadow atlas quadrant when subdivision is 8 or higher.
Also fix renderpass rect validation
2024-05-03 17:11:05 -07:00
Dario c41e407e61 Add draw and dispatch count to timestamp validation. 2024-05-03 14:23:38 -03:00
Rémi Verschelde 258be6d762
Merge pull request #90911 from clayjohn/RD-tex-copy
Ensure minimum block size is respected when doing GPU to CPU copies of compressed textures
2024-04-23 19:11:51 +02:00
clayjohn c52e217cd3 Ensure minimum block size is respected when doing GPU to CPU copies of compressed textures 2024-04-19 10:17:17 -07:00
thimenesup 1ab5a47347 Fix incorrect bounds check in rendering device push constant 2024-04-13 14:53:19 +02:00
Rémi Verschelde 9cba6ec216
Merge pull request #89491 from thimenesup/compute_dispatch_indirect
Expose bindings to compute dispatch indirect of rendering device
2024-04-09 10:42:22 +02:00
thimenesup 8017c8cf21 Expose bindings to compute dispatch indirect rendering device 2024-04-08 20:46:53 +02:00
jsjtxietian 5a5453bcf2 Fixes `RenderingDevice::get_driver_resource` will crash or give incorrect result with certain resources 2024-04-08 12:31:22 +08:00
Dario ecaafa6001 Add toggle for enabling or disabling RenderingDevice's pipeline cache. 2024-04-05 13:14:07 -03:00
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
Rémi Verschelde e74f4ea115
Vulkan: Don't warn about pipelines cache if missing
It used to warn when opening a new project because no cache pre-exists,
which isn't particularly helpful.

Also include the rendering method in the cache filename, as it differs
between Forward+ and Mobile for a same GPU.
2024-03-05 16:39:14 +01:00
Robert Yevdokimov 13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
Rémi Verschelde dd1d838e09
Merge pull request #88631 from DarioSamo/mobile_subpass_usage_fix
Remove tracking logic for input attachments as it's not necessary.
2024-02-22 11:23:28 +01:00
Dario 5e59c941c9 Remove tracking logic for input attachments as it's not necessary. 2024-02-21 11:18:10 -03:00
Dario ee2d8f68ba Merge execute and present commands for RenderingDeviceDriver. 2024-02-19 13:09:03 -03:00
Anatoli Babenia e25cfffc7f Add `--no-header` option to clean output
* Do not print empty line when header is disabled
* Do not print Vulcan header
* Also add "Print header" project setting (default On)
  (suggested by @kaissouDev)
* Add docs for the project setting
  (with suggestions by @Mickeon and @akien-mga)

Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-02-15 14:10:11 +03:00
Dario fc8ec5d8a9 Handle error when setting boot image if swap chain is not available. Skip resizing swap chain during screen creation as it's not necessary and can fail when it starts minimized. 2024-02-13 14:19:26 -03:00
Dario 73eff10c76 Finish splitting functionality of the Vulkan and D3D12 backends into RenderingDeviceDriver. 2024-02-12 10:02:18 -03:00
A Thousand Ships 684752e75b
Replace error checks against `size` with `is_empty` 2024-02-09 12:50:15 +01:00
A Thousand Ships 2a372186ec
Null check improvements 2024-01-19 12:50:21 +01:00