Commit graph

1044 commits

Author SHA1 Message Date
lawnjelly
614dc363ab 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.
2022-02-14 10:56:06 +00:00
Rémi Verschelde
d0b446c6d5
Merge pull request #45372 from Firepal/prepass-nightmares 2022-02-11 15:19:26 +01:00
Firepal
ff55157d3f Don't use prepass threshold with alpha scissor 2022-02-11 12:01:15 +01:00
Rémi Verschelde
7a16bb2ee4
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +01:00
lawnjelly
a0c6d16c90 Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests.

This can be fine on high power desktops but can be an annoyance on lower power machines.

This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority.

An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes:

* Continuous
* Update all changes
* Update vital changes
2022-02-02 11:26:45 +00:00
Rémi Verschelde
6c0c0c4b29
Merge pull request #54165 from Calinou/directional-shadow-runtime-change-3.x
Allow changing directional shadow size at run-time
2022-01-22 15:25:09 +01:00
Hugo Locurcio
a80187f5bc
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.
2022-01-16 18:00:13 +01:00
Rémi Verschelde
22166639ed
Merge pull request #56366 from Calinou/async-shaders-use-in-editor
Use asynchronous shader compilation and cache in the editor if requested
2022-01-16 10:34:07 +01:00
Rémi Verschelde
31c7f13ea4
Merge pull request #56802 from jnlopar/oren_nayer_vert_lighting_bug
Fixes broken scene shader compile due to undefined 'diffuse_color' variable with Oren Nayar + Vertex Lighting
2022-01-15 09:19:43 +01:00
Jason Neufeld
36c3b87883 Fixes shader compile due to undefined 'diffuse_color' variable with Oren Nayer + Vertex Lighting 2022-01-14 13:09:30 -08:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
b197de6f5f
Fix typos with codespell
Using codespell 2.1.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
readded
seeked
statics
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2022-01-07 00:14:54 +01:00
Rémi Verschelde
25369acff9
Merge pull request #51708 from Calinou/viewport-add-32bpc-color-depth 2022-01-04 14:30:24 +01:00
Rémi Verschelde
cc6e0e7fb3
Merge pull request #56161 from The-O-King/blend_shapes_octahedral 2022-01-04 14:09:49 +01:00
Brian Semrau
2c60c29340 Fix GPU particles transform feedback for WebGL 2 2022-01-03 00:20:42 -05:00
Hugo Locurcio
ae918c3041
Use asynchronous shader compilation and cache in the editor if requested
This provides more consistent behavior between the editor and running
project.
2021-12-31 02:20:29 +01:00
Omar El Sheikh
50ed674ec2 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!
2021-12-22 10:00:12 -05:00
Bastiaan Olij
5fbc24f3e0 Fix issue with external textures being freed by Godot 2021-12-22 11:46:37 +11:00
Haoyu Qiu
e614a0e9fc Fix incompatible addition in auto exposure shader 2021-12-16 16:06:31 +08:00
Rémi Verschelde
ee1877e63e
Revert "Fix particles emitting at old location" 2021-12-07 10:52:39 +01:00
Rémi Verschelde
71d8ccbe9e
Merge pull request #55676 from RandomShaper/fix_layered_lightmap_3.x
[3.x] Fix atlassed lightmaps not visible on GL ES 3
2021-12-06 21:44:27 +01:00
Pedro J. Estébanez
c026c86255 Fix atlassed lightmaps not visible on GL ES 3 2021-12-06 19:06:59 +01:00
lawnjelly
6f4c0b95fc Fix incorrect RID cleanup in Rasterizers
Proper cleanup for GLES3 RIDs (preventing leak reports), and added missing destructor for RasterizerSceneGLES2.
2021-12-06 16:05:27 +00:00
lawnjelly
3d981b8265 Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
2021-12-06 14:43:34 +00:00
Fabio Alessandrelli
bbfe054175 [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.
2021-11-26 15:58:04 +01:00
Hugo Locurcio
d7d35e4f73
Add const qualifier support for function arguments in shaders
This prevents the function argument from being reassigned within
the function.

Example:

    void test(const int t) {}
2021-11-19 21:20:23 +01:00
Rémi Verschelde
caf39c9e7d
Merge pull request #54160 from Calinou/shadow-filter-use-early-bailing 2021-11-16 14:11:38 +01:00
Rémi Verschelde
4103b0b7d8
Merge pull request #50823 from fbcosentino/3d-material-overlay 2021-11-16 08:21:18 +01:00
Fernando Cosentino
cc8846bef6 Added material_overlay property to MeshInstance
Applying overlay materials into multi-surface meshes currently
requires adding a next pass material to all the surfaces, which
might be cumbersome when the material is to be applied to a range
of different geometries. This also makes it not trivial to use
AnimationPlayer to control the material in case of visual effects.
The material_override property is not an option as it works
replacing the active material for the surfaces, not adding a new pass.

This commit adds the material_overlay property to GeometryInstance
(and therefore MeshInstance), having the same reach as
material_override (that is, all surfaces) but adding a new material
pass on top of the active materials, instead of replacing them.

Implemented in rasterizer of both GLES2 and GLES3.
2021-11-15 23:50:34 +00:00
Rémi Verschelde
908bd5bc41
Merge pull request #54733 from robfram/particles-emit-old-location 2021-11-15 23:16:32 +01:00
Fabio Alessandrelli
340ecb93be [HTML5] Call glGetBufferSubData directly from C++.
Remove leftover EM_ASM causing problems with gdnative builds.
2021-11-14 15:54:05 +01:00
robfram
91b7c80d28 Fix particles emitting at old location 2021-11-09 17:18:14 +01:00
Rémi Verschelde
1f8497d281
Merge pull request #53411 from RandomShaper/ubershaders_3.x 2021-11-09 13:12:44 +01:00
Pedro J. Estébanez
4c710780d4 Implement async shader compilation plus caching for GL ES 3
Async. compilation via ubershader is currently available in the scene and particles shaders only.

Bonus:
- Use `#if defined()` syntax for not true conditionals, so they don't unnecessarily take a bit in the version flagset.
- Remove unused `ENABLE_CLIP_ALPHA` from scene shader.
- Remove unused `PARTICLES_COPY` from the particles shader.
- Remove unused uniform related code.
- Shader language/compiler: use ordered hash maps for deterministic code generation (needed for caching).
2021-11-09 12:19:12 +01:00
Rémi Verschelde
cfff7a9032
Merge pull request #54751 from NHodgesVFX/3.x 2021-11-09 00:15:49 +01:00
Omar El Sheikh
8a43b222c7 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
2021-11-08 12:11:48 -05:00
NHodgesVFX
237f7eeabe Add more OpenGL Attributes
Co-Authored-By: Johann Meyer <25986904+johannmeyer@users.noreply.github.com>
Co-Authored-By: Clay John <claynjohn@gmail.com>
2021-11-08 01:22:40 -05: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
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
clayjohn
3f03b60718 Fudge irradiance map lookup to avoid precision issues 2021-10-24 12:03:54 -07:00
Hugo Locurcio
e534343914
Use early bailing to improve 3D shadow filtering performance in GLES3
This makes PCF13 much faster than it previously was. The performance
difference between PCF5 and PCF13 is now much lower.
2021-10-23 22:50:51 +02:00
Hugo Locurcio
31ad99072f
Allow changing directional shadow size at run-time
Factoring out the directional shadow creation code allows calling it
at any time. This works in both GLES3 and GLES2.
2021-10-23 22:04:59 +02: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
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