Commit Graph

56 Commits

Author SHA1 Message Date
Yuri Rubinsky 246a760323 Fix completion of functions with struct param/return type in shaders 2024-05-28 12:13:25 +03:00
A Thousand Ships 955d5affa8
Reduce and prevent unnecessary random-access to `List`
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
jsjtxietian 747ae429de Add missing check when insert function `normal_roughness_compatibility` 2024-01-15 17:22:19 +08:00
Rémi Verschelde 6c390b620d
Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
clayjohn 43cf21cb71 Use best fit normals for storing screen space normals 2023-12-21 14:41:29 -07:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
jsjtxietian 967e0e6485 Fix int to uint implicit cast error when use uniform mat in gles3 2023-10-27 10:46:52 +08:00
Rémi Verschelde 24c166dfe2
Merge pull request #81619 from Chaosus/fix_shader_const
Re-allows constants in global space to be initialized with function call
2023-10-03 17:20:23 +02:00
A Thousand Ships fdd3d36c6d [Servers] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-25 18:45:30 +02:00
Yuri Roubinski d3d20f15bf Re-allows constants in global space to be initialized with function call 2023-09-13 21:04:29 +03:00
Yuri Sizov bb15241e06 Merge pull request #77740 from ChibiDenDen/simplify_vulkan
Replace sampler arrays with constant sampler elements, simplify and reuse code for all shaders
2023-07-12 17:16:12 +02:00
Yuri Sizov 5dff3c4484 Merge pull request #78538 from Sauermann/fix-code-simplifications
Remove unnecessary value assignments throughout the codebase
2023-07-12 15:09:26 +02:00
bitsawer 356297f909 Fix shader language float literal precision truncation 2023-07-03 12:48:33 +03:00
ChibiDenDen 35715e510f replace sampler arrays with constant sampler elements 2023-06-22 01:11:57 +03:00
Markus Sauermann 890fdd56df Code simplifications
CPPcheck found most of them.

no need to assign the variable twice:
- AnimationTrackEditTypeAudio
- SSEffects

variable is assigned in all if-else clauses:
- EditorHelp
- AndroidInputHandler
- MenuBar
- ShaderCompiler

same if clause:
- ItemList

clearing an empty bitfield has no effect:
- Viewport
2023-06-21 22:37:26 +02:00
Ninni Pipping 71ee65dc57 Enable shadow warnings and fix raised errors 2023-05-11 16:00:59 +02:00
Clay John 610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
VolTer 6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
Yuri Rubinsky 575e352a61 Fix to some operators in shaders are not compiled properly 2023-03-26 20:50:02 +03:00
clayjohn 6c1c71d68b Avoid inserting screen_texture compatibility code when using textureSize 2023-02-10 13:03:02 -08:00
Bastiaan Olij 85c478e170 Make screen texture and depth texture work in Multiview 2023-01-25 13:35:01 +11: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
clayjohn 89766848de Fix multiple issues that make the normal roughness texture unusable 2023-01-09 11:56:36 -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
Fabio Iotti c53c687962
Fix screen texture slightly darker 2022-12-12 21:17:36 +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
Yuri Rubinsky 099f127cc3
Make code generation for shader boolean uniform instances easier 2022-10-31 11:52:52 +01:00
Yuri Rubinsky f4db4bb7a2 Fix incorrect setup of boolean uniform instances 2022-10-09 08:50:18 +03:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Yuri Rubinsky a2c32590ee Fix global uniform crash at editor startup 2022-10-03 15:06:20 +03:00
Rémi Verschelde c82bbc38a5 Merge pull request #64952 from Chaosus/vs_rename_uniform_to_param 2022-09-02 13:49:53 +02:00
Yuri Rubinsky 8191b3c110 Rename `uniform` to `parameter` across the engine 2022-09-01 11:42:57 +03:00
clayjohn 385ee5c70b Implement Physical Light Units as an optional setting.
This allows light sources to be specified in physical light units in addition to the regular energy multiplier. In order to avoid loss of precision at high values, brightness values are premultiplied by an exposure normalization value.

In support of Physical Light Units this PR also renames CameraEffects to CameraAttributes.
2022-08-31 12:14:46 -07: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
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
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 Rubinsky cf240a7ae0 Refactor shader hints 2022-05-31 11:51:47 +03: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
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
clayjohn 2bf8831dd6 SceneShader compiling 2022-05-11 21:00:21 -07:00
clayjohn 3bb8e6a9fe SkyShaders working 2022-05-11 21:00:21 -07:00
clayjohn fe49244611 Use Filament specular models and parametrization 2022-02-22 19:39:41 -08:00
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
Rémi Verschelde f8f19b313d
Merge pull request #57562 from AnilBK/string-add-contains
String: Add contains().
2022-02-03 22:21:24 +01:00