Commit Graph

2526 Commits

Author SHA1 Message Date
Rémi Verschelde afe8492241 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-06-19 14:06:55 +02:00
Pedro J. Estébanez d780a0c8db Fix broken normals in meshes with blend shapes 2022-03-15 10:25:09 +01:00
Ansraer 36aa94502c Fix alpha scissor support
(cherry picked from commit 2fb998bfbc)
2022-03-13 15:32:49 +01:00
lawnjelly 6c3cfc72e2 Fix incorrect buffer upload size in GLES2 draw_gui_primitive
The buffer upload size appears to have been incorrect for quite some time, which causes uploading from undefined memory.

(cherry picked from commit 3dc0e97d05)
2022-03-11 16:33:33 +01:00
Rémi Verschelde cb66b672d7 GLES2: Fix VersionKey comparison in `ShaderGLES2::bind()`
This was comparing arrays, GCC 12 raises a warning for it:

```
drivers/gles2/shader_gles2.cpp: In member function 'bool ShaderGLES2::bind()':
drivers/gles2/shader_gles2.cpp:80:71: error: comparison between two arrays [-Werror=array-compare]
   80 |         if (active != this || !version || new_conditional_version.key != conditional_version.key) {
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gles2/shader_gles2.cpp:80:71: note: use unary '+' which decays operands to pointers or '&'component_ref' not supported by dump_decl<declaration error>[0] != &'component_ref' not supported by dump_decl<declaration error>[0]' to compare the addresses
```

(cherry picked from commit 76df26b110)
2022-03-07 14:39:46 +01:00
Omar El Sheikh 56d3abdbcc GLES2 Compression on Blend Shapes Fix
When compressed vertex positions are used in a blend shapes mesh, we
need to make sure we set the w-component of the position vector to 1.0

When octahedral compression is used on normals/tangents, they need to be
converted to cartesian floats to be used for blend shapes

This conversion also changes the number of components of that vertex
attribute, which caused issues because previously there was an
assumption that you had the same number of components in the blend shape
buffer as you did in the original mesh's buffer (which is not true for
oct norm/tang)

(cherry picked from commit 733a84f7a4)
2022-03-07 08:31:24 +01:00
Omar El Sheikh fb9aa26b9d Fix shader state caching when blend shapes used
Previously, conditionals set on the shader would change outside of the
_render_list function when blend shapes were used

This is an issue because the function keeps track of the previous shader
state to try to minimize state changes

Now we keep all this shader state change within the _render_list
function to ensure the saved previous state is correct

(cherry picked from commit 9988739332)
2022-03-07 08:31:08 +01:00
lawnjelly f911ec589d
Fix GL buffer upload size bugs
Wrapper functions for uploading buffers to OpenGL take all sizes and offsets in bytes. Some buffer sizes are specified as units (e.g. float) so require conversion to bytes when calling the buffer upload functions.

Two such bugs have been fixed in blendshapes, and parameter names and comments have been changed to emphasize that sizes should be in bytes.

In addition DEV_ASSERTS in the upload wrappers have been changed to ERR_FAIL.

(cherry picked from commit 614dc363ab)
2022-02-17 10:39:06 +01:00
lawnjelly 4f86249d1e
Fix for S3TC on Android and IOS devices
On some platforms, exporters are prevented from exporting S3TC textures. This causes problems if the .import file contains a reference to such a texture - the exported project will attempt to load the S3TC, fail, and probably crash.

This PR prevents this problem by faking lack of hardware support for S3TC on the affected platforms. This prevents the engine attempting to load the S3TC and avoids the problem.

(cherry picked from commit b15ad8e786)
2022-02-17 10:25:30 +01:00
Omar El Sheikh ca67b2bce1
Re-fix Disabling Half Floats on iOS
A previous change missed setting a flag that specified whether half
floats were being used on vertex positions when in the GLES2 driver

This caused errors with the vertex buffer when platforms (specifically
iOS) which do not properly support half float vertex attributes on
GLES2, try to remapt the vertex buffer to stop using half floats
(in this case that remapping never happened and caused artifacts)

Re-enable setting that flag to fix rendering issues on these platforms

(cherry picked from commit bf5b2f48e6)
2022-02-17 10:23:02 +01:00
Hugo Locurcio 0bf0dce1db
Fix visible background line in intersections in screen-space reflections
Adjusting the step grading by one resolves the issue without affecting
performance or introducing adverse artifacts.

(cherry picked from commit a80187f5bc)
2022-01-25 18:41:54 +01:00
Rémi Verschelde 0e0ccc4adf
ImageLoader: Remove references to unsupported svgz extension
I don't see any reference to gzip/svgz supported in the nanosvg library,
and the handful of test gzip compressed svgz files I tried failed loading.

Also cleaning a couple missing includes in platform export code.

(cherry picked from commit 1ee44b2366)
2022-01-25 18:41:01 +01:00
Jason Neufeld 965fbce9d4
Fixes shader compile due to undefined 'diffuse_color' variable with Oren Nayer + Vertex Lighting
(cherry picked from commit 36c3b87883)
2022-01-25 18:40:05 +01:00
Rémi Verschelde 71066cd63b
Update copyright statements to 2022
Happy new year to the wonderful Godot community!

(cherry picked from commit a627cdafc5)
2022-01-13 16:00:37 +01:00
bruvzg cb6d82a111
Fix multiple missing UTF-8 decoding.
(cherry picked from commit c69e0d16bc)
2022-01-06 21:30:41 +01:00
Brian Semrau 50178ea5c3
Fix GPU particles transform feedback for WebGL 2
(cherry picked from commit 2c60c29340)
2022-01-06 00:58:32 +01:00
Omar El Sheikh 6b0b5d2093
Fix Blend Shapes when Octahedral Compression is Used
Blend shapes did not take into account octahedral compressed vertex
attribute layouts and this resulted in incorrect lighting on the
resulting blended mesh

Now make the blend_shapes shader octahedral compression aware!

(cherry picked from commit 50ed674ec2)
2022-01-06 00:58:29 +01:00
Bastiaan Olij 150eb3533b
Fix issue with external textures being freed by Godot
(cherry picked from commit 5fbc24f3e0)
2022-01-06 00:58:29 +01:00
Lucas Ângelo 29dcb7a0d2
Trunc shader function fixed
the 'trunc' function was comparing integers with floats using the '>' operator, which is not supported in Android. This issue is now gone.

(cherry picked from commit 9f68b4fea3)
2021-12-21 12:23:19 +01:00
Haoyu Qiu f8387aafd4
Fix incompatible addition in auto exposure shader
(cherry picked from commit e614a0e9fc)
2021-12-16 23:00:05 +01:00
lawnjelly cd371c45b7
Fix leaking environment RIDs in GLES2
This PR adds the code necessary to correctly free environments in GLES2, which was previously missing causing them to leak.

(cherry picked from commit 7134ef90bb)
2021-12-09 12:08:42 +01:00
Rémi Verschelde 14f92f9944
Revert "Fix particles emitting at old location"
(cherry picked from commit ee1877e63e)
2021-12-07 10:56:45 +01:00
lawnjelly 1b5832494a
Fix incorrect RID cleanup in Rasterizers
Proper cleanup for GLES3 RIDs (preventing leak reports), and added missing destructor for RasterizerSceneGLES2.

(cherry picked from commit 6f4c0b95fc)
2021-12-07 09:14:40 +01:00
lawnjelly bf785444ff [3.4] Cutdown version of RID fixes to sync with 3.5 RID handles
The RID Handles PR introduced a couple of bug fixes, they are added here without the RID handles functionality in order to keep 3.4 and 3.x roughly in sync, allowing further fixes to RID lifetimes to be backported.
2021-12-06 16:43:27 +00:00
Hugo Locurcio e463d3daca
Only print message for `get_modified_time()` failure when in verbose mode
This error message was often displayed for no good reason when PCK
files were loaded in the editor.

Since file modification dates are secondary metadata, it's not
very important if it can't be retrieved successfully anyway.

(cherry picked from commit 5acb8a253e)
2021-12-02 17:32:17 +01:00
Fabio Alessandrelli 35b7e86e6e
[HTML5] Use compatibility function for glGetBufferSubData.
The "webgl/webgl2.h" include provides that function, but it's not
available in emscripten versions < 2.0.17 .

Since we need to support emscripten 1.39.9 (mono builds), this commit
adds a JS function in library_godot_display.js as a compatibility layer
for it, and implement glGetBufferSubData by funneling the call to that
function (so we don't have name collisions JS-side with recent emcc).

All those hacks are now moved to the platform directory instead of being
ifdefs inside the drivers implementations.

(cherry picked from commit bbfe054175)
2021-11-29 16:42:26 +01:00
robfram 6247687be8
Fix particles emitting at old location
(cherry picked from commit 91b7c80d28)
2021-11-15 23:32:24 +01:00
Fabio Alessandrelli fd8ae8ce39
[HTML5] Call glGetBufferSubData directly from C++.
Remove leftover EM_ASM causing problems with gdnative builds.

(cherry picked from commit 340ecb93be)
2021-11-15 22:37:36 +01:00
Hugo Locurcio 96b32740d3
Print the number of PulseAudio input channels when in verbose mode
This is useful information to have for troubleshooting, and it's
said to sidestep a possible race condition issue that breaks
microphone recording on Linux.

(cherry picked from commit de912a8bd9)
2021-11-15 22:30:57 +01:00
Omar El Sheikh 20e7a4095e
Fix Vertex Attribute Specification Octahedral
For octahedral compressed normals/tangents, we use vec4 in the shader
regardless of whether a normal/tangent does/doesn't exist

For the case where we only have a normal vector, we need to specify that
there are only two components being used when calling glVertexAttrib

Before we would always specify that there were 4 components, and used
offsets to determine where in the vertex buffer to read data from but
this doesn't work on all platforms

(cherry picked from commit 8a43b222c7)
2021-11-15 22:28:23 +01:00
Ibrahn Sahir 1c22bfdb37
AudioDriverPulseAudio: move Vector Cow access outside tight loop.
Replaced some in-loop uses of Vector.write with an out of loop ptrw,
to avoid a lot of superfluous reads on the CowData ref count.

(cherry picked from commit 47496a55bc)
2021-11-15 22:21:36 +01:00
Rémi Verschelde ecedc7df0b
Merge pull request #54197 from clayjohn/GLES3-irradiance-map
Fudge irradiance map lookup to avoid precision issues
2021-10-29 14:11:53 +02:00
Rémi Verschelde 87c80f529f
clang-format: Enable `BreakBeforeTernaryOperators`
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 14:50:33 +02:00
Rémi Verschelde 1b65550ec7
clang-format: Various fixes to comments alignment from `clang-format` 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde 42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Max Hilbrunner e29126914d
Save all 64 bits of get_ticks_msec() in more cases
(cherry picked from commit 5dc02eb8b0)
2021-10-26 18:23:31 +02:00
clayjohn 3f03b60718 Fudge irradiance map lookup to avoid precision issues 2021-10-24 12:03:54 -07:00
Omar El Sheikh b679594eac Fix CSGPolygon Buffer Overflow
Immediate meshes do not have geometry of type Surface so we check
to see the mesh isn't immediate before trying to cast to surface
to check for octahedral compression
2021-10-18 11:39:54 -04:00
clayjohn a4e8ba8cfd Only add emission on base pass in GLES3 2021-10-17 15:58:57 -07:00
Hugo Locurcio cc823bc5b3
Remove unused built-in GLES2 shaders
These shaders were never compiled in the Godot binary, so the binary
size remains identical.
2021-10-15 17:41:31 +02:00
Rémi Verschelde 6fb7f18e35
Merge pull request #53740 from clktmr/gles2-multiple-refprobes 2021-10-13 12:42:23 +02:00
Timur Celik e230bc6caa Fix flipped `interior` option for second refprobe
This patch fixes rendering of multiple reflection probes for a single
mesh in the GLES2 renderer.  If there were two reflection probes, one of
them would always have the `interior` option flipped, resulting in
broken blending between probes and flickering of ambient reflection.

Also make note of GLES2 reflection probe limit
2021-10-13 10:04:48 +02:00
Hugo Locurcio 2826bec5d4
Fix lights flickering in GLES3 when new light attenuation is disabled
Co-authored-by: Clay John <claynjohn@gmail.com>
2021-10-12 21:59:23 +02:00
Rémi Verschelde 302ad4e600
Merge pull request #52918 from Calinou/add-new-light-attenuation-3.x 2021-10-08 23:08:49 +02:00
Hugo Locurcio 85e080fcc0
Backport new 3D point light attenuation as an option
This provides more realistic lighting with a very small performance cost.
The option is available in both GLES3 and GLES2, and can be enabled in
the Project Settings. This goes well with the ACES Fitted tonemapping mode
that was recently added.

When enabled, this also makes upgrading Godot 3.x projects to Godot 4.0 easier,
since lighting in 3.x will better match how it'll look in Godot 4.0.
2021-10-08 22:15:22 +02:00
Rémi Verschelde 06fc2378de
Merge pull request #51491 from Calinou/glow-add-high-quality-mode-3.x
Add high quality glow mode (3.x)
2021-10-08 07:47:07 +02:00
lawnjelly 192ec963ae Create 'rendering/misc' project settings section
To prevent the project settings `rendering` section getting out of hand, this PR moves some of the smaller new settings into a `misc` category.
2021-10-05 11:47:03 +01:00
Rémi Verschelde d01c660954
Merge pull request #52964 from Pineapple/WIN32_LEAN_AND_MEAN 2021-10-05 12:03:52 +02:00
Rémi Verschelde d82c75adca
Merge pull request #53393 from lawnjelly/dev_asserts 2021-10-05 11:25:24 +02:00
Rémi Verschelde 37847eb94d
Merge pull request #53369 from RandomShaper/fix_shader_state_3.x
[3.x] Reset scene conditionals assumed to be false
2021-10-04 17:31:25 +02:00