Commit Graph

5206 Commits

Author SHA1 Message Date
Pedro J. Estébanez f757cc9a70
RenderingDevice: Fix uncapped mipmap sizes causing div-by-zero
(cherry picked from commit 7f1989bac1)
2024-09-17 08:57:44 +02:00
Adam Scott 0b815cbb99
Fix leak when using audio samples instead of streams
(cherry picked from commit d3ddce6b88)
2024-09-17 08:57:44 +02:00
Pedro J. Estébanez f11f9e3b7f
AudioServer: Fix code style issues
- Drop STL copy in favor of old-school for loops.
- Be explicit about loads and stores to atomic value. (This also fixes an error in certain compiler toolchains.)

(cherry picked from commit 1cc485ba1f)
2024-09-17 08:57:44 +02:00
Alexis Breust 2b05cf154a
Sky: No more auto-selecting REALTIME mode if radiance is not 256
(cherry picked from commit 44e526d3d5)
2024-09-17 08:57:43 +02:00
Radiant af8caffd0e
Fix shadow mesh recursion.
(cherry picked from commit 70860aafd8)
2024-09-17 08:57:43 +02:00
clayjohn b1fda8f5c4
Avoid indexing instances without a base in scene cull phase
(cherry picked from commit b5fd29e7bc)
2024-09-17 08:57:42 +02:00
clayjohn 1250b4568a
Various fixes for transmittance effect
Use correct shadow sampling for omni and spot lights

Disable transmittance if shadows are disabled

Correct DirectionalLight transmittance bias to match shadow bias (its still pretty sensitive though)

(cherry picked from commit d61fae36f3)
2024-09-17 08:57:42 +02:00
ComycSans 430a69baed
Fix SkyRD::Sky::free() freeing material
(cherry picked from commit 09e59fbec5)
2024-09-17 08:57:42 +02:00
viksl f3848b75cb
Fixes alpha materials being rendered with a reverse cull which is visible in reflections from reflection probes.
(cherry picked from commit 929c69bad8)
2024-09-17 08:57:42 +02:00
clayjohn 0a1724f713
Use correct lightmap coefficients to ensure that the directional lightmap mode looks correct
Also remove the metallic option from directional lightmap as it is guaranteed to return negative numbers in many cases

(cherry picked from commit f4ccba7508)
2024-09-17 08:57:41 +02:00
Sen e5be133032
Fix for multimesh motion vector corruption by resetting motion vector state and filling both halves of buffer
(cherry picked from commit 52cd5acdda)
2024-09-16 17:19:58 +02:00
Adam Scott 219ddde30c
Honor `pitch_scale` value before playing audio sample
(cherry picked from commit aaafd163b2)
2024-09-16 17:15:29 +02:00
Arseny Kapoulkine 40dcdcbe79
Fix double free in FSR2 destructor
Before this change, using FSR2 resulted in the following error when the
effect was destroyed:

	ERROR: Attempted to free invalid ID: 662734928609453
	   at: _free_internal (servers/rendering/rendering_device.cpp:4957)

This happened because ACCUMULATE and ACCUMULATE_SHARPEN passes shared
the same shader_version object but had different pipeline IDs. When
version_free was called for ACCUMULATE pass, it destroyed pipelines
created from that version, including the pipeline for the
ACCUMULATE_SHARPEN pass.

Using a unique version could work around this problem, but it's easier
to rely on version_free destroying the created pipelines through the
dependency mechanism.

(cherry picked from commit 0024cface5)
2024-09-16 17:10:59 +02:00
Arseny Kapoulkine b2c83b42f6
Relax motion vector updates to allow skipped frames for skeletons
Before this change, a skeleton that was not updated every frame would
result in a difference of 2+ between last_change and frame index every
frame, which would disable the buffer rotation and set motion vectors to
zero. This results in significant visual artifacts for FSR2 that are
especially prominent on the characters that move together with the view
such as the main character in third person mode.

This is a significant problem for high refresh rate displays: at 120 Hz,
we are effectively guaranteed to skip skeleton updates every other frame
with skeleton update happening during physics processing, and the lack
of physics interpolation for skeletons. This happens by default in TPS
demo when FSR2 is enabled.

In other places where motion vectors are disabled, such as multi-mesh
and mesh rendering (where previous transform is updated), the logic
effectively allows for a single-frame gap in updates, because it
compares the frame where the update happened (which is the current frame
if updates are consistent) with the current frame, so the latency of 0
means "update just happened", but both multi-mesh and mesh transform
updates permit a latency of 1 as well.

Here, however, last_change is updated *after* the frame processing has
concluded, so a zero-latency update has a distance of 1. Allowing a
distance of 2 (latency 1) reduces the severity of the problem and aligns
the logic with transform updates.

Note that the problem will still happen when refresh rate is noticeably
higher than physics rate times 2. For example, it still happens at 240
Hz. However, a longer latency allowance is inconsistent with other
transforms and could lead to issues, so ideally long term physical
interpolation of skeleton transforms would completely solve this.

(cherry picked from commit 92f2bc70dd)
2024-09-16 17:10:47 +02:00
jsjtxietian 139f5ee15e
Add model_normal_matrix for fragment shader
(cherry picked from commit e698351db2)
2024-09-16 17:09:36 +02:00
clayjohn c684d65c64
Use transformed roughness instead of raw roughness to calculate roughness fade in SSR
(cherry picked from commit b99d0d778a)
2024-09-16 17:06:30 +02:00
kleonc f0f69a7b7c
Fix Parallax2D repeats being not relative to its transform
(cherry picked from commit 1bd8372813)
2024-09-16 17:04:12 +02:00
clayjohn 6c202154a7
Add fixed fog to the sky in the Compatibility renderer
And apply luminance multiplier after fog in RD renderer

(cherry picked from commit 578049b7b9)
2024-09-16 17:01:45 +02:00
clayjohn 2d7266e764
Ensure fog_sky_affect is used even when using a background color
(cherry picked from commit 37be585fdf)
2024-09-16 16:57:44 +02:00
kevinkuo52 6aff947ee5
pass in render_info to _fill_instance_data for alpha to fix overdraw call count
(cherry picked from commit 3388a4a360)
2024-09-16 16:55:12 +02:00
jsjtxietian b84dbab84d
Fix undefined `alpha_scissor` in standard shader
(cherry picked from commit 970a237c20)
2024-09-16 16:42:01 +02:00
Yahkub-R 2b4ade1ed6
Fix AudioStreamPlayer get_playback_position() for web build
(cherry picked from commit bcd776e441)
2024-09-16 16:41:06 +02:00
Chaosus 3dc376ec0b
Fix shader crash when the comma used in `for` loop as a trailing
(cherry picked from commit d74749fd60)
2024-09-16 16:39:51 +02:00
bruvzg a7d79f9e6c
Fix `TextServer::shaped_text_*_character_pos` for the first character of wrapped string. Allow starting/ending RTL selection before line start.
(cherry picked from commit 932acce8f2)
2024-09-16 16:38:23 +02:00
jsjtxietian a70df8537e
Fix uniform subgroup in shader will carry out to next group
(cherry picked from commit e6c45fbe5d)
2024-09-16 16:34:02 +02:00
clayjohn 5a33e45fed
Fail when submit or sync called on main rendering device
Fail if submit or sync called multiple times in a row

(cherry picked from commit b0e33aa00f)
2024-09-16 16:33:25 +02:00
Slashscreen 13d5227911
Apply patch for considering visual layers for DirectionalLight
Co-authored-by: majikayogames <152851004+majikayogames@users.noreply.github.com>
(cherry picked from commit 4457b11ff0)
2024-09-16 16:31:40 +02:00
Jamie Pate f8c99efc3b
Fix LightmapGI causes crash when using --headless
Fixes #89119

Add dummy LightmapInstance and Lightmap resources for headless rendering

Prevents the RenderingServer from crashing when it accesses
lightmap_instance->base_data
2024-08-07 11:38:05 +02:00
Rémi Verschelde 52f22902c7
Merge pull request #94902 from clayjohn/SHADER-hints
Restrict sampler hint validation to only screen texture hints
2024-07-30 12:29:04 +02:00
clayjohn a2f2699208 Restrict sampler hint validation to only screen texture hints 2024-07-28 22:31:57 -07:00
Bastiaan Olij 1eb0039b6e Fix regression around OpenGL swapchain optimisation for OpenXR 2024-07-29 12:46:58 +10:00
Rémi Verschelde 8e47aafa08
Merge pull request #94812 from clayjohn/SHADER-normal-roughness
Emit `normal_roughness` compatibility code in custom functions
2024-07-28 17:46:45 +02:00
Rémi Verschelde e773f8c3ba
Merge pull request #94800 from adamscott/fix-sample-playback-list-typo
Fix typo that prevented samples finishing
2024-07-28 17:46:39 +02:00
clayjohn ba3457dfff Emit normal_roughness compatibility code in custom functions 2024-07-26 10:45:36 -07:00
Adam Scott 7802c361b7
Fix typo that prevented samples finishing 2024-07-26 09:56:44 -04:00
Rémi Verschelde 13c6c0cdb7
Merge pull request #94706 from alvinhochun/window-set-transient-parent-on-create
Pass window exclusive and transient properties for subwindow creation
2024-07-26 13:44:03 +02:00
jsjtxietian 38fad35356 Fix editor crash when shader has incorrect global array declaration 2024-07-26 11:53:11 +08:00
BlueCube3310 eb3b217777 RenderingDevice: Use the correct amount of layers for Cubemaps for boundary checks 2024-07-24 20:26:46 +02:00
Alvin Wong 97aa278edb Pass window exclusive and transient properties for subwindow creation
On Windows this allows to avoid having to change the owner of the window
after it has been created, which in rare circumstances may cause the
window to bug out.
2024-07-25 00:27:27 +08:00
Rémi Verschelde 62c88a4052
Merge pull request #94671 from Chaosus/shader_fix_varying
Fix shader crash when using a varying in separate func before it defined
2024-07-24 09:59:31 +02:00
Rémi Verschelde 139cf025c9
Merge pull request #94629 from RandomShaper/fix_undef_position
Fix position from vertex shader partially uninitialized
2024-07-24 09:59:24 +02:00
Feiyue Zhang 6f30df4b6a
Linearize color if HDR 2D is on 2024-07-24 09:49:50 +02:00
Yuri Rubinsky 965b2f6ca4 Fix shader crash when using a varying in separate func before it defined 2024-07-23 21:55:18 +03:00
Rémi Verschelde e4f7b69470
Merge pull request #94656 from BlueCube3310/cubemap-layers-retrieve-fix
RenderingDevice: Fix getting cubemap layer data
2024-07-23 15:55:53 +02:00
Rémi Verschelde 29e1bdee2b
Merge pull request #94653 from mihe/bind-physics-state-sync
Bind `PhysicsServer*D::body_set_state_sync_callback`
2024-07-23 15:55:46 +02:00
BlueCube3310 741bb152ae RenderingDevice: Fix getting cubemap data 2024-07-23 13:44:28 +02:00
Mikael Hermansson a559a1c6d8 Bind `PhysicsServer*D::body_set_state_sync_callback` 2024-07-23 13:30:44 +02:00
Pedro J. Estébanez 0064532c1e Fix position from vertex shader partially uninitialized 2024-07-23 09:04:54 +02:00
Yuri Rubinsky 574e61a542 Fix crash when assigning more textures than expected to texture array 2024-07-22 20:51:11 +03:00
Rémi Verschelde 587f1d0cb0
Merge pull request #92817 from Alex2782/fix_glsl_Mali-G
Fix glsl shader for Android Mali-GXXx GPUs and Vulkan API 1.3.xxx
2024-07-22 17:24:04 +02:00