Dario
ff3ababb09
Reduce amount of permutations in mobile shader.
2025-05-16 12:40:21 -03:00
Thaddeus Crews
b7b3a1a78a
Merge pull request #106399 from DarioSamo/fix-canvas-validation-error
...
Rewrite textureProjLod usage to avoid a Vulkan validation error.
2025-05-15 14:53:26 -05:00
Thaddeus Crews
e625565853
Merge pull request #106396 from chocola-mint/canvas-item-add-triangle-array-count
...
Implement the `count` parameter in `RenderingServer.canvas_item_add_triangle_array`
2025-05-15 10:22:16 -05:00
Dario
499fff51fb
Rewrite textureProjLod usage to avoid a Vulkan validation error.
2025-05-15 11:35:34 -03:00
Thaddeus Crews
d0693d6867
Merge pull request #89988 from LunaCapra/specular-occlusion
...
Add support for bent normal maps for specular occlusion and indirect lighting
2025-05-14 09:44:06 -05:00
chocola-mint
101dc9868f
Implement the count parameter in RenderingServer.canvas_item_add_triangle_array()
2025-05-14 22:52:30 +09:00
landervr
be01c7f5a4
fix reflection probe box projection stretching
2025-05-14 00:02:06 +02:00
Capry
9828c365c3
Add support for bent normals for indirect lighting and specular occlusion
2025-05-12 12:52:04 +02:00
Thaddeus Crews
19bb18716e
Merge pull request #102399 from clayjohn/cull-mask-overhaul
...
Overhaul the cull mask internals for Lights, Decals, and Particle Colliders
2025-05-09 11:29:28 -05:00
Thaddeus Crews
dda0562f2f
Merge pull request #103934 from LiveTrower/dfg-lut
...
Forward+: Replace the current BRDF approximation with a DFG LUT and add multiscattering energy compensation
2025-05-09 11:29:16 -05:00
Thaddeus Crews
821170f054
Merge pull request #106145 from lander-vr/ambient-light-specular-occlusion
...
Add specular occlusion from ambient light
2025-05-09 11:29:14 -05:00
clayjohn
305216f558
Overhaul the cull mask internals for Lights, Decals, and Particle Colliders
...
Properly pair and unpair instances based on cull mask to avoid any unnecessary processing and to ensure that changing the cull_mask and layer_mask actually updates culling behavior
2025-05-08 21:39:12 -07:00
landervr
56730d0cb2
Add specular occlusion from ambient light
...
Co-authored-by: guerro323 <kaltobattle@gmail.com>
2025-05-08 23:52:01 +02:00
LiveTrower
44408eabaa
Replace BRDF approximation with a DFG LUT
2025-05-08 10:23:35 -06:00
Thaddeus Crews
288822e330
Merge pull request #105570 from kroketio/texture-extension-mipmaps
...
RenderingDevice: Pass mipmap count to `texture_create_from_extension()`
2025-05-08 07:19:16 -05:00
Sander
6ae50cad17
RenderingDevice: introduce parameter 'mipmaps' for texture_create_from_extension()
2025-05-07 15:15:55 +03:00
clayjohn
07ef21c87a
Avoid crash when allocating specular and normal-roughness buffers when render buffers aren't available
2025-05-04 13:54:11 -07:00
Thaddeus Crews
01fc9aee6c
Core: Modernize C headers with C++ equivalents
2025-05-02 08:23:01 -05:00
Thaddeus Crews
f4f1471b57
Merge pull request #105910 from lawnjelly/global_get_fast4
...
Add `GLOBAL_GET` cached macros.
2025-04-30 09:18:44 -05:00
lawnjelly
f8f350a32a
Add `GLOBAL_GET` cached macros.
...
GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-04-30 15:08:50 +01:00
dsmtE
4e68f277c6
add REGION_RECT
...
fix formatting
fix shader compile (region_rect after draw_data)
fix formatting
fix formatting
Review fix (move region_rect in main + remove useless visual shader options)
fix formatting
fix alphabetic order (+ remove useless action for spatial shaders)
typo + remove TYPE_LIGHT option for region_rect
2025-04-30 11:07:22 +02:00
landervr
e3dbf74634
Fix reflection probe dark borders
2025-04-29 17:18:52 +02:00
Thaddeus Crews
dedc072840
Merge pull request #105837 from clayjohn/sky-acos-bugfix
...
Fix float/int comparison in acos_approx in sky template shader
2025-04-28 10:01:34 -05:00
Thaddeus Crews
3947cbe3b2
Merge pull request #104386 from Repiteo/core/cpp-math
...
Core: Replace C math headers with C++ equivalents
2025-04-27 19:21:22 -05:00
clayjohn
d2dce41681
Fix float/int comparison in acos_approx in sky template shader
...
Strict GLSL implementations will not automatically convert `0` to a float
2025-04-27 17:06:34 -07:00
Thaddeus Crews
8954125990
Merge pull request #105437 from Ansraer/teleport_spatial_nodes
...
Allow moving meshes without motion vectors
2025-04-25 11:36:08 -05:00
Thaddeus Crews
33065d8323
Merge pull request #103238 from Ryan-000/mesh_support_vram_profiler
...
Add Meshes to the Video RAM Profiler
2025-04-25 11:36:01 -05:00
Ansraer
a4a5f4ed01
allow moving meshes without motion vectors
2025-04-25 14:25:06 +02:00
Ryan
4497e2a0d3
Add Meshes to the Video RAM Profiler
...
Apply suggestions from code review
Co-Authored-By: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-04-23 18:26:56 -04:00
mrjustaguy
bc746f2962
Implement FXAA 3.11
2025-04-22 22:19:06 -07:00
Thaddeus Crews
1f7a8eac9d
Merge pull request #101973 from clayjohn/sky-material-opt
...
Optimize ProceduralSkyMaterial by removing uses of acos and simplifying logic
2025-04-22 18:25:51 -05:00
Thaddeus Crews
2ffd5a3913
Merge pull request #104738 from YYF233333/cleanup_rid_owner
...
Use `LocalVector` in `RID_Owner::get_owned_list`
2025-04-22 10:44:25 -05:00
Thaddeus Crews
93c13f8399
Merge pull request #105424 from bruvzg/intel_mac_rd_crash
...
Fix RendererRD crash on start on Intel Macs.
2025-04-21 08:24:22 -05:00
Thaddeus Crews
2a96e895e6
Merge pull request #105525 from BlueCube3310/light-probe-sh-impr
...
Scene shader: Improve and document SH diffuse evaluation for light probes
2025-04-21 08:24:20 -05:00
Yyf2333
1a70a06a43
Change RID_Owner::get_owned_list.
2025-04-21 01:04:27 +08:00
Matthieu Bucchianeri
e3c215fc13
Add support for Direct3D 12 OpenXR backend.
...
This change adds support for running XR projects built with the `d3d12`
rendering backend. The XR backend hooks into the setup for the D3D12
render context in order to use the desired device and command queue for
submission to OpenXR. The XR backend takes care of importing the D3D12
swapchain images into the render context.
As part of this process, three issues are addressed:
- Ensuring that resource state transitions are only done on textures
that require them.
- Enabling view instancing in the PSOs for multiview render passes.
- Addressing a bug in the D3D12 runtime where PSO creation may fail
when front face detection is used.
Please refer to #86283 for additional discussions on the implementation
details.
2025-04-19 20:39:33 -07:00
BlueCube3310
5640ddd0a5
Scene shader: Improve and document SH evaluation for light probes
2025-04-19 15:08:02 +02:00
clayjohn
6fede0b951
Optimize SkyMaterials by removing uses of acos and simplifying logic
...
The results looks almost the same and run much faster.
2025-04-17 22:50:11 -07:00
Thaddeus Crews
98aced4e65
Merge pull request #99768 from dsnopek/openxr-vulkan-foveated-rendering
...
OpenXR: Use the `XR_FB_foveation_vulkan` extension to get the density map for VRS
2025-04-17 09:14:23 -05:00
Thaddeus Crews
ad40939b6f
Core: Replace C math headers with C++ equivalents
...
- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
2025-04-16 15:49:02 -05:00
Thaddeus Crews
6a9f46931a
Merge pull request #104480 from BlueCube3310/image-unsuported-format
...
Renderer: Warn when images need to be converted due to their formats being unsupported by hardware
2025-04-16 10:44:52 -05:00
Pāvels Nadtočajevs
472090dd88
Fix RendererRD crash on start on Intel Macs.
2025-04-15 20:35:56 +03:00
Thaddeus Crews
448f159c69
Merge pull request #105267 from clayjohn/rd-mobile-pipelines
...
Pre-allocate more resources when screen textures are detected in the Mobile renderer
2025-04-14 19:39:48 -05:00
Thaddeus Crews
f56a4d4fe4
Merge pull request #105138 from stuartcarnie/fix_hangs
...
Renderer: Reduce scope of mutex locks to prevent common deadlocks
2025-04-14 19:39:47 -05:00
Thaddeus Crews
a6979ef664
Merge pull request #97801 from basicer/srgb-color-hint
...
Add `color_conversion_disabled` shader hint.
2025-04-14 19:39:42 -05:00
Stuart Carnie
09282c316a
Renderer: Reduce scope of mutex locks to prevent common deadlocks
...
Fixes #102877
2025-04-13 06:56:13 +10:00
clayjohn
699695e5ff
Preallocate more resources when screen textures are detected in the Mobile renderer
...
This further reduces stutter when the screen texture suddenly becomes visible
2025-04-11 12:31:17 -07:00
Thaddeus Crews
c7e9dc96a4
Rendering: Fix `Math` constant conversion
2025-04-11 12:33:57 -05:00
Rob Blanckaert
8c54290b4a
Add `color_conversion_disabled` shader hint.
...
Sometimes shaders want to accept a color as input that is always
in the srgb color space. This adds a hint to vec3/vec4 to enable
the color picker popup for those vectors but disable color space
conversion.
2025-04-10 21:31:15 -07:00
Thaddeus Crews
94282d88f9
Core: Use `Math` namespace for constants
2025-04-10 16:29:30 -05:00
Thaddeus Crews
06c71fbf40
Merge pull request #105175 from clayjohn/RD-pipeline-sss-roughness
...
Detect more pipeline settings at load time to avoid pipeline stutters
2025-04-10 11:10:22 -05:00
Thaddeus Crews
d534107926
Revert early version of PR #105175
...
This reverts commit 6225e25f4a .
2025-04-10 11:09:50 -05:00
Thaddeus Crews
665bdf4fe2
Merge pull request #105175 from clayjohn/RD-pipeline-sss-roughness
...
Detect more pipeline settings at load time to avoid pipeline stutters
2025-04-10 10:18:18 -05:00
Thaddeus Crews
ae80141a54
Merge pull request #103306 from Calinou/macos-intel-vulkan-disable-texture-array-reflections
...
Disable texture array reflections on Intel GPUs on macOS due to driver bugs
2025-04-09 18:11:52 -05:00
clayjohn
bf47c42b21
Detect possible usage of SSS and screen textures at load time to allocate needed resources at load time.
...
This allows us to avoid a class of pipeline compilation stutters and
stutters from allocating screen textures.
2025-04-09 13:31:03 -07:00
clayjohn
6225e25f4a
Detect possible usage of SSS and screen textures at load time to allocate needed resources at load time.
...
This allows us to avoid a class of pipeline compilation stutters and
stutters from allocating screen textures.
2025-04-09 13:15:40 -07:00
Thaddeus Crews
4d5f455cf7
Merge pull request #105037 from clayjohn/RD-instance-index-crash
...
Avoid using a global variable to store instance index in canvas items shader in RD renderer
2025-04-07 08:43:27 -05:00
Thaddeus Crews
5edb235018
CI: Bump various pre-commit hooks
2025-04-07 08:23:35 -05:00
BlueCube3310
a861394e13
Renderer: Warn when images need to be converted due to their formats being unsupported by hardware
2025-04-06 19:27:02 +02:00
clayjohn
bef26b8861
Avoid using a global variable to store instance index in canvas items shader in RD renderer
2025-04-04 16:32:15 -07:00
Thaddeus Crews
6bd249a4c2
Merge pull request #104850 from Repiteo/core/warning-macros
...
Core: Integrate warning suppression macro helpers
2025-04-03 16:50:22 -05:00
Thaddeus Crews
207a2b6472
Core: Integrate warning suppression macro helpers
2025-04-03 10:13:46 -05:00
Aaron Franke
2800948d61
Organize ifdefs for disabling navigation, physics, and XR
2025-04-02 08:24:24 -07:00
Thaddeus Crews
1f56d96cf2
Merge pull request #104893 from Repiteo/scons/external-includes-alt
...
SCons: Add `CPPEXTPATH` for external includes
2025-04-02 07:48:03 -05:00
Thaddeus Crews
f25fc34439
SCons: Add `CPPEXTPATH` for external includes
2025-04-02 07:29:08 -05:00
Yufeng Ying
4f4031a675
Replace size() == 0 with is_empty().
2025-04-02 19:18:43 +08:00
David Snopek
79f5a4d9fe
OpenXR: Use the `XR_FB_foveation_vulkan` extension to get the density map for VRS
2025-03-31 07:21:58 -05:00
Rémi Verschelde
3b90bb56ad
Merge pull request #89782 from KoBeWi/stdArrayList
...
Use initializer list in Arrays
2025-03-28 17:29:40 +01:00
Rémi Verschelde
e81eb3f1e9
Merge pull request #102354 from YYF233333/style_iterator
...
Use iterator pattern instead of manually traverse `List::Element *`
2025-03-28 14:31:40 +01:00
Rémi Verschelde
408d07109b
Merge pull request #99551 from DarioSamo/fragment-density-map
...
Implement Fragment density map support.
2025-03-28 14:31:19 +01:00
Yyf2333
22b5ec17fb
Using iterator pattern instead of List::Element *.
...
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2025-03-28 13:29:15 +08:00
kobewi
75881f8322
Use initializer list in Arrays
2025-03-26 18:38:15 +01:00
Dario
76d709be74
Implement support for fragment density maps.
...
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 -05:00
kobewi
10f6c01b9c
Remove ABS in favor of Math::abs
2025-03-19 13:52:40 +01:00
Thaddeus Crews
70d37274aa
Merge pull request #60178 from Calinou/directional-shadow-normal-bias-split
...
Use lower shadow normal bias for distant directional shadow splits
2025-03-17 10:52:13 -05:00
Lukas Tenbrink
f4de2cd22a
Use `resize_zeroed` instead of `resize` then `fill(0)` in several places.
2025-03-14 12:09:39 +01:00
Thaddeus Crews
701505eb4f
Merge pull request #104044 from bruvzg/rd_pipeline_err_spam
...
Fix `Invalid Task ID` error spam in `PipelineHashMapRD`.
2025-03-13 08:57:45 -05:00
Thaddeus Crews
c1b7865ae9
Merge pull request #103557 from aaronfranke/godot-version-defines
...
Rename version defines to `GODOT_VERSION_*` to match GDExtension godot-cpp
2025-03-13 08:57:42 -05:00
Stuart Carnie
5e1fe8040a
rendering: compositor has `is_opengl` API; minor optimisations
2025-03-13 15:41:44 +11:00
Aaron Franke
97ee05e9b7
Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp
2025-03-12 11:11:38 -07:00
Pāvels Nadtočajevs
047afb1b1d
Fix `Invalid Task ID` error spam in `PipelineHashMapRD`.
2025-03-12 19:59:13 +02:00
Thaddeus Crews
2f5f3c9a5a
Merge pull request #103617 from stuartcarnie/fix_texture_pixel_size
...
2D: Fix light shader accessing `TEXTURE_PIXEL_SIZE`
2025-03-12 10:31:50 -05:00
Thaddeus Crews
15a5a2f309
Merge pull request #103766 from BlueCube3310/basisu-hdr-astc
...
BasisUniversal: Ensure ASTC's HDR variant is supported when transcoding
2025-03-12 10:31:49 -05:00
Thaddeus Crews
d7d85db701
Merge pull request #103889 from clayjohn/rd-allocations-cleanup
...
Clean up more dynamic allocations in the RD renderers with a focus on 2D
2025-03-11 14:00:38 -05:00
Thaddeus Crews
a77a28c029
Merge pull request #101971 from clayjohn/sky-light-size-fix
...
Pass angular diameter into light size constants for sky shaders.
2025-03-11 09:35:09 -05:00
Thaddeus Crews
0fb0804546
Merge pull request #103641 from darksylinc/matias-mobile-shadows-update
...
Fix inefficient upload in Mobile Shadows
2025-03-11 09:35:05 -05:00
Thaddeus Crews
85f9c46713
Merge pull request #103880 from 100gold/fix_deadlock_on_pipelinehashmaprd
...
Fix deadlock between `PipelineHashMapRD::local_mutex` and `GDScriptCache::mutex`
2025-03-11 09:35:02 -05:00
clayjohn
4cf9d58dce
Clean up more dynamic allocations in the RD renderers with a focus on 2D.
2025-03-10 13:16:12 -07:00
Thaddeus Crews
8d1c1c5867
Merge pull request #92476 from AThousandShips/string_remove_char
...
Add `String::remove_char(s)` methods for performance and convenience
2025-03-10 10:01:04 -05:00
100gold
477b6451a0
fix deadlock between PilelineHashMapRD::local_mutex and GDScriptCache::mutex
2025-03-10 17:48:28 +03:00
A Thousand Ships
331a43a9d8
Add `String::remove_char(s)` methods for performance and convenience
2025-03-10 13:19:28 +01:00
Lukas Tenbrink
605b62cd29
Add `Span` struct (replacing `StrRange`). Spans represent read-only access to a contiguous array, resembling `std::span`.
2025-03-09 18:19:51 +01:00
Thaddeus Crews
cae3d722a3
Merge pull request #99321 from AThousandShips/use_get_slicec
...
Use `get_slicec` instead of `get_slice` for single character splitters
2025-03-09 09:05:29 -05:00
Thaddeus Crews
dfdb5359ea
Merge pull request #103547 from clayjohn/forward-plus_instance_data_optimize
...
Optimize `_fill_instance_data` function in Forward+ renderer.
2025-03-09 09:05:19 -05:00
A Thousand Ships
466590d0ec
Use `get_slicec` instead of `get_slice` for single character splitters
2025-03-08 20:36:37 +01:00
clayjohn
5efcd64b23
Reduce per-frame memory allocations from the heap in the Mobile renderer.
2025-03-07 22:01:24 -08:00
clayjohn
574f5126a2
Optimize _fill_instance_data function in Forward+ and Mobile renderers.
...
This batches together a couple of micro-optimizations that were discovered in profiling and analyzing disassembly.
Importantly, this reduces the amount of instructions in a heavy loop. This has the biggest impact when there are lots of objects and lights in the scene as the function is called once per objects + once per light that touches the object
2025-03-07 15:44:53 -08:00
Thaddeus Crews
324512e11c
Style: Replace header guards with `#pragma once`
2025-03-07 17:33:47 -06:00
Thaddeus Crews
67d4a245d8
Merge pull request #103267 from YeldhamDev/reality_got_too_extended
...
Allow to compile the engine without XR support
2025-03-07 15:12:54 -06:00
BlueCube3310
4d46ef8e8e
BasisUniversal: Ensure ASTC's HDR variant is supported when transcoding
2025-03-07 15:26:03 +01:00
Thaddeus Crews
b6ece17de1
Merge pull request #103529 from clayjohn/RD-trivial-instance-data
...
Validate triviality of InstanceData struct in Mobile and Forward+ renderers
2025-03-06 16:36:14 -06:00
Thaddeus Crews
4bafafaeb3
Merge pull request #102777 from darksylinc/matias-astc-hdr
...
Add ASTC HDR format variants
2025-03-06 16:36:06 -06:00
Stuart Carnie
b3694662a2
2D: Fix light shader accessing TEXTURE_PIXEL_SIZE
2025-03-06 05:30:20 +11:00
Matias N. Goldberg
e605ad93c7
Fix inefficient upload in Mobile Shadows
...
Clustered performs the following shadow rendering steps
1. Process objects [0; 10) for cascade 0.
2. Process objects [10; 30) for cascade 1.
3. Process objects [30; 100) for cascade 2.
4. Upload objects [0; 100) to GPU.
5. Draw all cascades.
Mobile was supposed to be doing the same, but instead was doing:
1. Process objects [0; 10) for cascade 0.
2. Upload objects [0; 10) to GPU.
3. Process objects [10; 30) for cascade 1.
4. Upload objects [0; 30) to GPU.
5. Process objects [30; 100) for cascade 2.
6. Upload objects [0; 100) to GPU.
7. Draw all cascades.
That is, always reuploaded everything from scratch.
Therefore it pointlessly (and with geometric growth) wasted BW.
2025-03-05 15:21:25 -03:00
Thaddeus Crews
729c4e9e88
Merge pull request #102905 from kleonc/render_info_fix_primitive_count_per_triangle_strip
...
Fix render info primitive count per `TRIANGLE_STRIP`
2025-03-05 12:07:47 -06:00
Thaddeus Crews
9911baec70
Merge pull request #103531 from darksylinc/matias-mobile-shadows-update
...
Fix inefficient upload in Mobile Shadows
2025-03-05 12:07:42 -06:00
Thaddeus Crews
8777f088cc
Merge pull request #103348 from huwpascoe/render_params_fix
...
Fix 2D instance params crashing using outside of `main()`
2025-03-05 12:07:39 -06:00
Thaddeus Crews
5c3e7280f4
Merge pull request #103506 from bruvzg/shader_pool
...
Use separate WorkThreadPool for shader compiler.
2025-03-05 12:07:34 -06:00
Rémi Verschelde
d831381296
Merge pull request #103092 from darksylinc/matias-luminance-uninit
...
Fix uninitialized value in Tonemap
2025-03-04 01:00:38 +01:00
Rémi Verschelde
daa28e8338
Merge pull request #95912 from etodd/particle-pause-jitter-fix
...
Fix particle jitter when scene tree is paused
2025-03-04 01:00:10 +01:00
Matias N. Goldberg
62c1a4782d
Fix inefficient upload in Mobile Shadows
...
Clustered performs the following shadow rendering steps
1. Process objects [0; 10) for cascade 0.
2. Process objects [10; 30) for cascade 1.
3. Process objects [30; 100) for cascade 2.
4. Upload objects [0; 100) to GPU.
5. Draw all cascades.
Mobile was supposed to be doing the same, but instead was doing:
1. Process objects [0; 10) for cascade 0.
2. Upload objects [0; 10) to GPU.
3. Process objects [10; 30) for cascade 1.
4. Upload objects [0; 30) to GPU.
5. Process objects [30; 100) for cascade 2.
6. Upload objects [0; 100) to GPU.
7. Draw all cascades.
That is, always reuploaded everything from scratch.
Therefore it pointlessly (and with geometric growth) wasted BW.
2025-03-03 19:57:27 -03:00
clayjohn
1bdb3bc88a
Validate triviality of the InstanceData and RenderElementInfo structs in Mobile and Forward+ renderers.
...
This is needed to avoid overhead that results from calling the constructor during calls to LocalVector.resize()
2025-03-03 14:38:37 -08:00
Pāvels Nadtočajevs
53bb897458
Use separate WorkThreadPool for shader compiler.
2025-03-03 22:28:39 +02:00
yesfish
93bc18f2b0
Fix 2D instance params crashing using outside of main()
2025-02-27 22:10:56 +00:00
Rémi Verschelde
a9c5c4db71
Merge pull request #103201 from beicause/shaders-only-convert-source-color-linear
...
Shaders: Only convert default value to linear color if type hint is `source_color`
2025-02-27 19:34:12 +01:00
Evan Todd
87efa4d210
Fix particle jitter when scene tree is paused.
2025-02-27 08:40:40 -08:00
Hugo Locurcio
92f3173794
Disable texture array reflections on Intel GPUs on macOS due to driver bugs
...
The check is only present in x86 builds, since Apple Silicon never
uses an Intel GPU by definition.
2025-02-26 02:28:36 +01:00
David Snopek
a285d1aa98
`texture_create_from_native_handle()` should return `RID` for texture from `RenderingServer`, not `RenderingDevice`
2025-02-25 14:20:33 -06:00
Michael Alexsander
aea559b39a
Allow to compile the engine without XR support
2025-02-25 17:07:21 -03:00
LuoZhihao
5ca3862636
Shaders: Only convert default value to linear color if type is `source_color`
2025-02-23 12:35:53 +08:00
Matias N. Goldberg
8888f9e649
Fix uninitialized value in Tonemap
...
And anything that uses luminance.
The class Luminance in luminance.cpp is in charge of averaging the
luminance of all pixels.
It performs multiple passes until it reaches a 1x1 texture containing
the total average. This is standard luminance averaging on GPU.
Then the "result" of this frame and the "prev_frame_result" are averaged
together at a certain speed to mimic eye adaptation.
Then this avarege becomes the "source" for the next frame. This is done
here:
```cpp
SWAP(p_luminance_buffers->current,
p_luminance_buffers->reduce.write[p_luminance_buffers->reduce.size() -
1]);
```
So far pretty normal stuff.
**The problem is: prev_frame_result IS UNINITIALIZED**. Therefore it's
possible for prev_frame_result to contain garbage values like -5+e15
which causes the screen to stay black for a minute until eye adaptation
catches up.
Windows will always force allocations to be reset to 0, but Linux does
not do that.
However Windows just delays the bug; because it's possible for VMA to
reuse a block.
You can repro this bug by downloading Bistro, creating a camera,
selecting a default scene; and then launching Bistro.
Everything will work fine.
Until you decide to resize the window. It takes a few tries on Godot,
but eventually the screen becomes black.
If you wait around a minute, the screen will "unblack" itself back to
normal.
Even if it's not stuck in black after resize, you may notice that every
resize is inconsistent in how the eye adaptation catches up (i.e.
sometimes it flashes to white, sometimes it does not).
If you can't repro the bug, you need to try harder by doing arbitrary
resizes until it triggers.
Also, I advise to try this on Linux; since Windows' sanitization of
memory gets in the way.
There's probably multiple tickets already filled around issues that were
rooted in luminance calculations starting from uninitialized memory.
This PR sets a default value of 0, which causes the screen to always
flash white after resize. Setting a different value like 0.1 makes the
flash effect weaker. Setting it to a high value like 5.0 makes the
screen flash from dark instead.
This bug can be backported to 4.3. I don't know if it can be backported
to earlier; as the render graph makes sure the texture_clear() calls
gets issued in the right place; whereas in <= 4.2 it might be
problematic depending on when Luminance::LuminanceBuffers::configure is
being called.
2025-02-20 16:51:41 -03:00
kleonc
2bb6ad5cdf
Fix debug CanvasItem redraw rects in RD renderer
2025-02-18 23:49:43 +01:00
kleonc
b691a997a3
Fix render info primitive count per TRIANGLE_STRIP
2025-02-15 23:50:07 +01:00
Thaddeus Crews
b607110ad2
Merge pull request #102792 from clayjohn/varying-crash
...
Validate varying count when compiling shaders
2025-02-14 08:25:39 -06:00
clayjohn
35100396e4
Validate varying count when compiling shaders
...
This avoids crashing on devices when a number of varyings greater than the device limit is used.
For now this accurately prints an error when compiling the shader, but the error text only pops up in the editor if the number of user varyings is above the limit.
2025-02-13 15:07:15 -08:00
Rémi Verschelde
54006f6ebf
Merge pull request #102217 from clayjohn/mobile-pipelines
...
Reduce mobile pipeline compilations
2025-02-13 23:34:54 +01:00
Thaddeus Crews
1a0bf54677
Merge pull request #102805 from BlueCube3310/rd-tex-fetch-fix
...
RenderingDevice: Fix certain RD to Image format conversions
2025-02-13 10:15:47 -06:00
Matias N. Goldberg
fcd785ace2
Add ASTC HDR format variants
2025-02-13 11:45:42 -03:00
BlueCube3310
27c4e70ee8
RenderingDevice: Fix certain RD to Image format conversions
2025-02-13 10:44:10 +01:00
Matias N. Goldberg
4712d426ef
Fix broken skeletal animated meshes
...
Fixes #102791
2025-02-12 22:25:22 -03:00
Thaddeus Crews
78f1918bd4
Merge pull request #102668 from jkirsteins/janiskirsteins/ios-aspect-fill-splash
...
[iOS] Sync the boot splash and the launch screen image scale modes
2025-02-12 12:56:26 -06:00
Thaddeus Crews
1939e87db1
Merge pull request #101561 from darksylinc/matias-device-address-api
...
Change how device address is requested to avoid future API breakage
2025-02-12 12:56:25 -06:00
Jānis Kiršteins
0e266b0099
[iOS] Sync the boot splash and the launch screen image scale modes
2025-02-12 17:41:18 +01:00
Matias N. Goldberg
af900a5825
Change how device address is requested to avoid future API breakage
...
PR #100062 introduced BUFFER_USAGE_DEVICE_ADDRESS_BIT.
However it did so by adding a boolean to uniform_buffer_create(), called
"bool p_enable_device_address".
This makes maintaining backwards compatibility harder because I am
working on another feature that would require introducing yet another
bit flag.
This would save us the need to add fallback routines when the feature I
am working on makes it to Godot 4.5.
Even if my feature doesn't make it to 4.5 either, this PR makes the
routine more future-proof.
This PR also moves STORAGE_BUFFER_USAGE_DEVICE_ADDRESS into
BUFFER_CREATION_DEVICE_ADDRESS_BIT, since it's an option available to
both storage and uniforms.
This PR also moves the boolean use_as_storage into
BUFFER_CREATION_AS_STORAGE.
2025-02-11 20:00:18 -03:00
Rémi Verschelde
cfe0fd62d0
Merge pull request #102677 from stuartcarnie/free_invalid_id
...
2D: Fix free of invalid ID
2025-02-11 23:59:19 +01:00
Rémi Verschelde
d967d8d9bd
Merge pull request #102280 from Chaosus/fix_particles_process_shader_crash
...
Fix crash when assigning wrong shader to particle process material
2025-02-11 23:58:56 +01:00
Stuart Carnie
90b2d4b844
2D: Fix free of invalid ID
2025-02-11 08:17:29 +11:00
Rémi Verschelde
0bccb0abd1
Merge pull request #102497 from BlueCube3310/mesh-uv-render-compressed-fix
...
Fix rendering material when UV2 is compressed
2025-02-07 01:40:02 +01:00
Rémi Verschelde
46aeded4b7
Merge pull request #102480 from DarioSamo/dont-unroll-ubershader
...
Add loop annotations to ubershaders to prevent loop unrolling.
2025-02-07 01:39:48 +01:00
Rémi Verschelde
c695eb9159
Merge pull request #101952 from Flarkk/fix_spotlight_peterpanning_regression
...
Fix shadow peter-panning with default spotlight
2025-02-07 01:39:15 +01:00
BlueCube3310
8714b36171
Fix rendering material when UV2 is compressed
2025-02-06 20:24:46 +01:00
Dario
d39ac94c41
Add loop annotations to ubershaders to prevent loop unrolling.
2025-02-06 09:39:18 -03:00
clayjohn
7444839299
Reduce mobile pipeline compilations by tracking more feature usage globally and only compile what is needed
2025-02-05 18:27:23 -08:00
Rémi Verschelde
a9fa4fd7b9
Merge pull request #101642 from huwpascoe/fix_source_color
...
Shaders: Fix `source_color` default value
2025-02-05 11:33:54 +01:00
Thaddeus Crews
ea2770eb4f
Merge pull request #101947 from Rudolph-B/Issue-101750
...
Add Heightfield mask to GPUParticlesCollisionHeightField3D
2025-02-04 09:04:11 -06:00
Rudolph Bester
b162c59097
Fix GPUParticlesCollisionHeightField3D adding collisions excluded by its layer_mask
...
Co-authored-by: Yahia Zakaria <yahiazakaria13@gmail.com>
2025-02-04 08:02:44 +02:00
Chaosus
53e6d30771
Fix crash when assigning wrong shader to particle process material
2025-02-01 15:12:02 +03:00
clayjohn
6611c863bd
Use a smaller epsilon for omni and spot attenuation cutoff
...
We just want to avoid calculating shadows when the attenuation is zero, so we should use the smallest epsilon we can get away with
2025-01-31 17:08:23 -08:00
Chaosus
570e59df3d
Fix shader uniforms has null as default value
2025-01-31 07:35:51 +03:00
Thaddeus Crews
4b9f88280b
Merge pull request #102122 from DarioSamo/default-sdfgi-fix
...
Fix default SDFGI variant not being compiled in time.
2025-01-29 17:45:17 -06:00