Commit graph

87 commits

Author SHA1 Message Date
Yuri Rubinsky
56954485ed Refactor ShaderData & fix the sorting of shader uniforms 2022-12-15 10:02:59 +03:00
Yuri Rubinsky
5693286e90 Mark shader built-ins as used when passed to functions as out parameter 2022-11-15 22:06:16 +03:00
Rémi Verschelde
85fe6ecc32 Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used 2022-09-28 17:05:34 +02:00
Yuri Rubinsky
e4a8646c19 Prevent duplicated hints in shader uniform completion 2022-09-11 15:21:43 +03:00
clayjohn
028ef2edc8 Add shader uniform hints for screen textures so users can specify custom filter and repeat modes.
At this time, it works best in the Vulkan Renderers as they support using multiple samplers with the same texture.

In GLES3 this feature really only allows you to use the screen texture without mipmaps if you want to save the cost of generating them.
2022-08-09 12:29:49 -04:00
Hugo Locurcio
813f6a5d57
Add hint_transparent to use a transparent black placeholder texture
This can be used in shaders to avoid the need to supply a transparent
placeholder texture manually.
2022-08-01 23:38:06 +02:00
Hugo Locurcio
4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +02:00
Yuri Rubinsky
886c2d9681 Implement shader uniform groups/subgroups 2022-07-26 11:26:09 +03:00
Yuri Rubinsky
be3fb7a216 Fix errors when using built-ins in shaderinc 2022-07-25 12:33:04 +03:00
reduz
f649678402 Clean up Shader Preprocessor
* Moved preprocessor to Shader and ShaderInclude
* Clean up RenderingServer side
* Preprocessor is separate from parser now, but it emits tokens with include location hints.
* Improved ShaderEditor validation code
* Added include file code completion
* Added notification for all files affected by a broken include.
2022-07-22 22:53:03 +02:00
Yuri Roubinsky
7b94603baa Adding shader preprocessor support
Co-authored-by: TheOrangeDay <6472143+TheOrangeDay@users.noreply.github.com>
2022-07-22 22:51:57 +02:00
clayjohn
a94110d0c6 Remove GLES2 shader constraints from GLES3 2022-06-14 12:01:52 -07:00
Yuri Rubinsky
cf240a7ae0 Refactor shader hints 2022-05-31 11:51:47 +03:00
Rémi Verschelde
1314e6cbcc
Merge pull request #60803 from Chaosus/shader_hint_rename
Rename `hint_albedo`, `hint_white/black` in shaders
2022-05-24 08:15:33 +02:00
Rémi Verschelde
126470caa1
Merge pull request #61226 from Chaosus/shader_fix_keyword_completion 2022-05-23 19:05:29 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Yuri Rubinsky
29ff04acf2 Fix incorrect keyword completion after period in shader editor 2022-05-20 18:40:57 +03:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Yuri Roubinsky
a8bbe570ca Rename hint_albedo, hint_white/black in shaders 2022-05-09 22:50:18 +03:00
Rémi Verschelde
477b53d280
Merge pull request #60568 from Chaosus/shader_keyword_completions
Add keyword completion to shader editor
2022-05-04 23:27:33 +02:00
Rémi Verschelde
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Yuri Roubinsky
15032e01e6 Add keyword completion to shader editor 2022-04-29 08:40:43 +03:00
Yuri Roubinsky
643e75bea9 Prevent shader crash when using precision on boolean types 2022-04-26 12:30:24 +03:00
Rémi Verschelde
a7b1d85828
Merge pull request #59825 from Chaosus/shader_fix
Fix incorrect parsing array's `length()` at return statement in shader
2022-04-12 12:40:54 +02:00
Rémi Verschelde
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Yuri Roubinsky
0864c9abaa Fix incorrect parsing array's length() at return statement in shader 2022-04-03 09:55:04 +03:00
reduz
360dea5348 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +02:00
Yuri Roubinsky
58696fd774 Allow multiple declarations in for loop in a shader 2022-02-03 11:35:38 +03:00
Yuri Roubinsky
e0304f83e7 Add translation links to shader errors 2022-01-19 15:16:32 +03:00
Yuri Roubinsky
36a82c8c69 Unify variable and array declarations in shaders 2022-01-18 12:42:39 +03:00
Yuri Roubinsky
08208406ca Refactor size expression parsing for arrays in the shaders 2022-01-15 15:47:39 +03:00
Yuri Roubinsky
c377891145 Add completion for shader_type 2022-01-13 18:37:13 +03:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Yuri Roubinsky
fd9c92d4ab Add a shader warning when the uniform buffer limit is exceeded 2022-01-03 16:24:56 +03:00
Yuri Roubinsky
108b6a2000 Allow pass varyings as out param to the function, when it's possible 2021-12-23 18:03:19 +03:00
Yuri Roubinsky
e8a457ba89 Refactor render_mode in shaders, forbid declaring duplicates 2021-12-21 22:20:09 +03:00
Yuri Roubinsky
f0a58af12f Rename shader hint filter_anisotropy to filter_anisotropic 2021-12-15 22:12:38 +03:00
Yuri Roubinsky
25a2241e7d Fix shader array parsing in variable declaration 2021-12-15 17:54:15 +03:00
Rémi Verschelde
864ccb5776
Merge pull request #55913 from Chaosus/fix_shader_crash 2021-12-15 13:07:34 +01:00
Yuri Roubinsky
09185d76ac Rename shader hint filter_aniso to filter_anisotropy 2021-12-15 13:18:32 +03:00
Yuri Roubinsky
3cbd8ef098 Fix shader crash when assigned array from struct to a variable by index 2021-12-13 21:19:13 +03:00
Hugo Locurcio
92e9cca5be
Rename hint_aniso to hint_anisotropy in the shader language
The word "anisotropy" is used in full form in BaseMaterial3D's
anisotropy-related properties.
2021-12-10 17:41:17 +01:00
Yuri Roubinsky
bcbcf14469 Refactor constant suffix parsing in a shader 2021-12-10 15:38:27 +03:00
Yuri Roubinsky
b66510d509 Added completion for uniform hints in a shader 2021-12-10 10:12:25 +03:00
Yuri Roubinsky
76f6c0849c Make compile shader function to use struct instead long parameter list 2021-12-08 11:34:40 +03:00
Yuri Roubinsky
5ba93619fa Allow using empty statements in the shader, added formatting warning 2021-12-01 11:52:25 +03:00
Yuri Roubinsky
6e80e97b0f Fix built-in(PI, TAU, E) assignment to a global constant in a shader 2021-11-29 10:32:36 +03:00
Yuri Roubinsky
e9b7ffd1fa Added few more built-ins to shader language 2021-10-13 20:27:36 +03:00
Yuri Roubinsky
b1ac3e256f Allow declare the shader arrays with a size defined before identifier 2021-10-08 10:28:31 +03:00
Yuri Roubinsky
7c07ae4c50 Fix shader crash when passing array.length to functions
and similar cases
2021-10-05 12:49:59 +03:00