Rémi Verschelde
e52213e2fa
More codespell fixes, do more changes from previous ignore list
2023-02-01 12:11:36 +01:00
Yuri Rubinsky
e034d5f764
Fix shader failure when using non-const initializer on a constant
2023-02-01 13:03:11 +03:00
clayjohn
97ed3dcf71
Add a shader error when trying to using hint_normal_roughness_texture in the gl_compatibility renderer
2023-01-30 09:04:34 -08:00
Rémi Verschelde
3cacc83526
Merge pull request #72138 from clayjohn/GL-globals
...
Properly append global uniform buffer name in gl_compatibility shaders
2023-01-26 22:52:42 +01:00
Rémi Verschelde
b2164ee75b
Merge pull request #72109 from Chaosus/shader_derivative
...
Add derivative functions with precision to shaders
2023-01-26 22:51:54 +01:00
clayjohn
eefddb07bc
Properly append global uniform buffer name in gl_compatibility shaders
...
Also error when using instance uniforms
2023-01-26 12:14:45 -08:00
Yuri Rubinsky
8c8c333bf2
Add derivative functions with precision to shaders
2023-01-26 20:53:46 +03:00
bitsawer
6f5598979f
Several shader preprocessor parser fixes and improvements
2023-01-26 14:57:23 +02:00
Yuri Rubinsky
a6eb6b6b55
Fix array of token names in the shader parser
2023-01-25 18:18:07 +03:00
PrecisionRender
d9698f0e6f
Fix type in hint when using removed built-in textures
2023-01-20 22:06:51 -06:00
clayjohn
921f99f9e3
Decrement texture_binding count when using screen textures
2023-01-20 12:48:13 -08:00
clayjohn
faea9f5c10
Remove SCREEN_TEXTURE, DEPTH_TEXTURE, and NORMAL_ROUGHNESS_TEXTURE
...
in favour of texture hints
2023-01-18 19:52:47 -08:00
Rémi Verschelde
d95794ec8a
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".
2023-01-05 13:25:55 +01:00
Yuri Rubinsky
f28348fc5c
Fix shader crash when using boolean type for vertex->fragment varyings
2022-12-23 07:47:49 +03:00
Yuri Rubinsky
522d4243bf
Add missing != operator to `StringName`
2022-12-20 17:25:54 +03:00
Rémi Verschelde
5d20dccade
Add MAKE_RESOURCE_TYPE_HINT macro to simplify binding arrays of resources
2022-11-24 14:06:00 +01:00
Rémi Verschelde
cb1826deae
Shader: Set proper resource type hints for sampler uniforms
...
Supersedes #64383 .
2022-11-22 15:38:52 +01:00
Markus Sauermann
28af870750
Code simplifications found by cppcheck
...
They are based on:
- Boolean arithmetic simplifications
- setting variables that are not accessed
- constant variables
2022-11-21 08:43:36 +01:00
Lily Garcia
0683bc3783
Fix global uniforms parsed as instance uniform
2022-11-17 17:18:20 -05:00
Rémi Verschelde
a6a6af32e2
Merge pull request #68718 from dzil123/fix_fog_shader_buffer_overflow
...
Fix shader compiler asan out of bounds
2022-11-16 09:23:16 +01: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
dzil123
6f0cd8072f
Fix Fog shader buffer overflow
2022-11-15 06:51:48 -08:00
Markus Sauermann
3b14f0334c
Remove redundant Variant-types initializations
2022-11-14 19:35:19 +01:00
Yuri Rubinsky
c07d13182c
Some fixes for instance shader parameters
2022-11-09 21:20:11 +03:00
Yuri Rubinsky
0a85d3b0cc
Fix predefined constants to be accessible in the shader includes
2022-11-01 19:53:05 +03:00
Yuri Rubinsky
926d4ebb28
Fix editor crash when assigning some uniform hints to the textures
2022-10-16 19:55:08 +03:00
Rémi Verschelde
e5857bd6c7
Merge pull request #66548 from akien-mga/msvc-warnings-c4701-c4703
...
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
2022-09-28 20:47:50 +02:00
Rémi Verschelde
85fe6ecc32
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
2022-09-28 17:05:34 +02:00
Rémi Verschelde
7ab01450cf
Fix MSVC warning C4702: unreachable code
...
Part of #66537 .
2022-09-28 16:46:48 +02:00
Yuri Rubinsky
e4a8646c19
Prevent duplicated hints in shader uniform completion
2022-09-11 15:21:43 +03:00
Yuri Rubinsky
47145800a6
Remove `shader_type` from completion (when it does not need any more)
2022-09-07 16:19:36 +03:00
Yuri Rubinsky
d4a10e7e04
Allow using integer varyings with `flat` interpolation modifier
2022-08-25 13:21:02 +03:00
Max Hilbrunner
019d6584ee
Merge pull request #64167 from clayjohn/screen-texture-hint
...
Add shader uniform hints for screen textures
2022-08-19 21:51:39 +02:00
Yuri Rubinsky
f2a6168414
Merge pull request #64310 from Chaosus/shader_texture_funcs
2022-08-12 21:28:22 +03:00
Yuri Rubinsky
e21aad968d
Add `textureQueryLod/Levels` functions to the shader language
2022-08-12 20:44:57 +03:00
Yuri Rubinsky
7822fbc9e2
Add `textureProjGrad` function to the shader language
2022-08-12 12:01:37 +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
Rémi Verschelde
f754dd20be
Merge pull request #62454 from Geometror/reflect-refract-vec2-vec4
...
Allow for vec2/vec4 to be used in reflect and refract
2022-08-07 19:16:05 +02:00
Hendrik Brucker
b8d5f4bdd5
Allow vec2 and vec4 for reflect and refract
2022-08-07 18:03:16 +02:00
Yuri Rubinsky
988041b74c
Merge pull request #63847 from Zylann/shader_switch_uint
2022-08-03 08:05:19 +03:00
Marc Gilleron
779a5cd34a
Allow shading language to use `switch` statement with uints
2022-08-02 23:08:41 +01: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
2dc59a3eea
Fix incorrect conversion of default value for mat4 uniform in shaders
2022-07-27 09:06:18 +03:00
Yuri Rubinsky
886c2d9681
Implement shader uniform groups/subgroups
2022-07-26 11:26:09 +03:00
Rémi Verschelde
49b0aa93e3
Merge pull request #63424 from Chaosus/shader_preprocessor_inc_fix
2022-07-25 14:56:06 +02:00
Yuri Rubinsky
be3fb7a216
Fix errors when using built-ins in shaderinc
2022-07-25 12:33:04 +03:00
reduz
455c06ecd4
Implement Vector4, Vector4i, Projection
...
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02: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
c9ae83b5ab
Prevent defining float constant without number after exponent in shaders
2022-06-10 11:35:56 +03: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
Aaron Record
900c676b02
Use range iterators for RBSet in most cases
2022-05-19 12:09:16 +02: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
Yuri Roubinsky
5eb3a0ef4a
Add `hint_color` support for `vec3` in shaders
2022-05-01 09:47:35 +03: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
Yuri Rubinsky
f4b0c7a1ea
Merge pull request #60175 from Geometror/visual-shader-vector4
2022-04-20 08:33:42 +03:00
Hendrik Brucker
cf58d23a72
Add Vector4 to VisualShader
2022-04-12 19:09:29 +02: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
bruvzg
f851c4aa33
Fix some issues found by cppcheck.
2022-04-06 14:34:37 +03:00
Yuri Roubinsky
0864c9abaa
Fix incorrect parsing array's `length()` at return statement in shader
2022-04-03 09:55:04 +03:00
Yuri Roubinsky
d47035a6fb
Fix shader crashing when attempting to access `length()` at global space
2022-04-01 08:39:29 +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
notSanil
36fa7059ed
Fix device limit exceeding for uniform buffer
2022-03-16 16:52:35 +05:30
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
...
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
ZuBsPaCe
2e2c9a27b6
Fixed shader error message for instance qualifier
...
Moved argument from RTR to vformat. Message is now similar to uniform-arrays-error further down.
2022-02-09 21:32:09 +01:00
Yuri Roubinsky
a2484c3293
Fix unknown identifier error in for loop
2022-02-06 08:38:33 +03:00
Yuri Roubinsky
e01d08159c
Few more fixes to for loop in shaders
2022-02-05 08:42:32 +03:00
bruvzg
244db37508
Cleanup and move char functions to the `char_utils.h` header.
2022-02-04 11:35:01 +02:00
Yuri Roubinsky
58696fd774
Allow multiple declarations in for loop in a shader
2022-02-03 11:35:38 +03:00
Anilforextra
fc27636999
Vectors: Use clear() and has().
...
Use clear() instead of resize(0).
Use has() instead of "find(p_val) != -1".
2022-02-02 00:11:09 +05:45
Yuri Roubinsky
b01065b9a4
Prevent checking of global uniform type outside the editor
2022-01-25 19:22:37 +03:00
Yuri Roubinsky
0e66587dbf
Remove incorrect items from completion of main functions in shader
2022-01-24 10:37:47 +03:00
Yuri Roubinsky
3ca57e5157
Fix incorrect unused local var warning in shader blocks
2022-01-23 20:22:31 +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
4201af6649
Fix completion for global constants in shaders
2022-01-13 19:52:06 +03:00
Yuri Roubinsky
c377891145
Add completion for shader_type
2022-01-13 18:37:13 +03:00
Yuri Roubinsky
b0356bcb72
Prevent redefinition of main functions in shader
2022-01-13 15:12:35 +03:00
Yuri Roubinsky
bd61d8f80c
Enhances a shader uniform limit warning
2022-01-08 21:44:37 +03:00
Yuri Roubinsky
b74968c2ca
Merge pull request #56477 from Chaosus/fix_device_crash
2022-01-04 13:23:38 +03:00
Yuri Roubinsky
0e2ef987b1
Add a check for device in shader lang to prevent startup editor crash
2022-01-04 11:50:50 +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
Rémi Verschelde
9221c0f8ad
Merge pull request #56190 from Chaosus/shader_varying_pass_to_func
2022-01-03 13:08:55 +01:00
luz paz
a124f1effe
Fix various typos
...
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 01:03:58 -05: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
Rémi Verschelde
be83968b6b
Merge pull request #55970 from Chaosus/shader_fix_struct_warning
2021-12-16 13:35:44 +01:00
Yuri Roubinsky
1414a7be91
Fix struct usage passing to shader warning system
2021-12-15 22:54:46 +03:00
Yuri Roubinsky
f0a58af12f
Rename shader hint `filter_anisotropy` to `filter_anisotropic`
2021-12-15 22:12:38 +03:00