Commit Graph

227 Commits

Author SHA1 Message Date
Rémi Verschelde 1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
dzil123 aa0b91ca52 [3.x] Fix shader compiler asan out of bounds 2022-11-17 19:24:15 -08:00
Hugo Locurcio ab9a95f266
Add `hint_transparent` to use a transparent black placeholder texture 2022-08-02 23:32:07 +02:00
Haoyu Qiu 067e738cb8 Fix various typos 2022-05-19 19:07:45 +08:00
Yuri Roubinsky b5c5c2d52b Fix shader crashing when attempting to access length() at global space 2022-04-01 08:44:57 +03: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
Yuri Roubinsky 85deed9207 Backport some changes to 3.x shaders 2022-01-25 10:34:57 +03: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
Yuri Roubinsky 0c449befbf Allow pass varyings as out param to the function, when it's possible 2022-01-04 10:22:39 +03:00
Yuri Roubinsky 25e24f2d05 [3.x] Prevent writing incorrect shader hints 2021-12-16 10:22:01 +03:00
Yuri Roubinsky 933fd6be75 [3.x] Restore shader parsing errors with lack of semicolon in a block 2021-12-11 18:05:49 +03:00
Yuri Roubinsky de9205f72d Fix ^= operator in shaders 2021-12-03 10:34:56 +03:00
Yuri Roubinsky 5928cc90f8 [3.x] Prevent return statement from using in block in shader main func 2021-11-23 10:40:47 +03: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
Yuri Roubinsky 824183854c
Removed incorrect autocompletion of matrixes in shader
(cherry picked from commit 04a2053f9b)
2021-11-15 16:30:00 +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 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
Rémi Verschelde 51dd4d0c6c
Merge pull request #49509 from Chaosus/shader_time_3.x 2021-08-16 19:42:55 +02:00
Yuri Roubinsky 8a1c986455 [3.x] Fix shader crash when using local var with the same name as varying 2021-08-13 09:30:35 +03:00
Yuri Roubinsky 34f7ceefe0
Allow using more assignment operators on matrixes in shaders
(cherry picked from commit 0f42a29864)
2021-08-12 16:42:17 +02:00
Yuri Roubinsky 144e0856a4
Fix shader crash when using varying array in fragment->light context
(cherry picked from commit fead1595f9)
2021-08-12 16:42:17 +02:00
Yuri Roubinsky 8b6d9ab956 Fix varying usage in custom functions [3.x] 2021-07-28 08:11:35 +03:00
Rémi Verschelde 940ca74ccf
Merge pull request #50889 from Chaosus/shader_const_array_3.x
[3.x] Implemented global const array to shaders
2021-07-27 13:05:32 +02:00
Yuri Roubinsky 1e191847c7 [3.x] Implemented global const array to shaders 2021-07-26 16:29:39 +03:00
Yuri Roubinsky 0a99613e53 Backport latest varying fixes to 3.x (2) 2021-07-26 15:40:42 +03:00
Yuri Roubinsky 1e128c80c6 Backport latest varying fixes to 3.x 2021-07-22 08:43:12 +03:00
Yuri Roubinsky 2d7c9f1ef1 [3.x] Makes shader 'TIME' available in custom functions by default 2021-06-11 15:23:24 +03:00
Hugo Locurcio a38b447413
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Yuri Roubinsky 2d1f8f2352 Prevents shader crash if two struct with the same name are declared 2021-05-14 11:28:49 -07:00
Yuri Roubinsky ac547031d5 Prevents shader crash if passing invalid struct to the return statement 2021-05-14 11:28:49 -07:00
Yuri Roubinsky ae8de1f2ce Fix shader crash if duplicated struct members created 2021-05-14 11:28:49 -07:00
Lyuma fba6b62054 Backport dd0874e "Allow passing varying from fragment to light shader function" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma 0c028ad96e Backport bc0e8e7 "Fix using post-init shader array constructors" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma 25016bf715 Backport 6b99bda "Added support for arrays as shader struct members" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma fc6bee0750 Backport 6f16239 "Implementation of struct for shaders" to 3.4 2021-05-14 11:28:48 -07:00
Rémi Verschelde 140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Hugo Locurcio 0c6873b13e
Tweak shader errors for features only usable in GLES3
See https://github.com/godotengine/godot/issues/42719#issuecomment-792168504.
2021-03-07 13:27:13 +01:00
Ev1lbl0w 3fe851accc Added missing returns on error scenarios
(cherry picked from commit 3d9ef1e4de)
2021-03-02 10:26:14 +01:00
Yuri Roubinsky 29616f4a35 Fix parsing hexadecimal (lowercase `e`,`f`) in shaders
(cherry picked from commit 19e0a1ec9d)
2021-03-02 10:26:14 +01:00
Rémi Verschelde 49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

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

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 14:09:51 +02:00
Yuri Roubinsky ecd54630ef [3.2] Fix some incorrect conversions which lead to crash in shaders 2020-07-15 06:36:24 +03:00
Yuri Roubinsky 891b84a833 [3.2] Prevents usage of return in main shader functions 2020-06-27 17:38:22 +03:00
Yuri Roubinsky 474b178534 [3.2] Fix shader crash if pass const argument to 'out/inout' parameter 2020-06-25 10:27:37 +03:00
Yuri Roubinsky ee93c85ef1 Fix shader constant sorting 2020-03-31 14:32:33 +03:00
Yuri Roubinsky 4dd1eee769 Enables passing out built-in parameter from parent function in shaders
(cherry picked from commit 7a2c6a8c0e)
2020-03-25 11:38:53 +01:00