Commit graph

1338 commits

Author SHA1 Message Date
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
c4a8284dec Flag dirty dependencies when GeometryInstance dependencies change in renderer
Normally dependencies are only set dirty when changed during culling, but that misses changes that happen in the renderer (like a new shader being set in a material)
2023-01-17 12:39:13 -08:00
clayjohn
eace1276a5 Decompress RA_AS_RG formats on Web platform in GLES3 renderer and disable texture swizzling
While using compressed formats is allowed, the RA_AS_RG formats need texture swizzling which is not available on web
2023-01-17 10:48:04 -08:00
Rémi Verschelde
226daf9b59
GLES3: Fix canvas shader use of undefined draw_data
Fixes #71551.
2023-01-17 13:17:53 +01:00
Rémi Verschelde
59dcf64dd6
Merge pull request #71382 from jainl28patel/sprite2d_flip_normal_map
fix normal map not flipping in sprite2D
2023-01-17 10:56:44 +01:00
Rémi Verschelde
ac104a69b8
Merge pull request #71309 from BastiaanOlij/improve_renderscaling_options
Improving communication of scaling settings to renderer implementation
2023-01-14 14:45:02 +01:00
jainl28patel
390f83bf5a fix normal map not flipping in sprite2D 2023-01-14 11:51:56 +05:30
Yuri Rubinsky
01cddbb12a Clear material arrays to prevent freeing of invalid texture RID 2023-01-13 23:25:09 +03:00
Bastiaan Olij
478c37deb8 Improving communication of scaling settings to renderer implementation 2023-01-13 12:54:15 +11:00
rsjtdrjgfuzkfg
ebe1123532 OpenGL: Support FORMAT_{ETC2,DXT5}_RA_AS_RG
This commit adds support for FORMAT_EXT2_RA_AS_RG and
FORMAT_DXT5_RA_AS_RG with OpenGL, fixing VRAM compression with the
normal map option enabled.
2023-01-11 22:58:11 +01:00
clayjohn
f78b492682 Properly map shader language texture hints to sampler hints in GLES3 renderer 2023-01-06 15:52:12 -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
clayjohn
062fb8b0dc Ignore depth draw optimization when using depth draw alpha prepass
This is necessary as the scene shader still uses alpha in this case so we can't discard fragments that weren't written to the depth buffer
2023-01-03 12:33:07 -08:00
Rémi Verschelde
f064898956
Merge pull request #70253 from BastiaanOlij/cleanup_sky_render
Cleanup and improve sky render
2022-12-23 23:44:02 +01:00
Rémi Verschelde
1cab6c91e9
Merge pull request #69998 from BastiaanOlij/sorting-pivot-4
Added options for sorting transparent objects (port of PR #63040)
2022-12-23 09:47:24 +01:00
Bastiaan Olij
e886a7af81 Cleanup and improve sky render 2022-12-23 19:45:19 +11:00
Bastiaan Olij
6f4f38db07 Added options for sorting transparent objects (port of PR 63040) 2022-12-23 19:30:33 +11:00
Rémi Verschelde
2b056115ef
Merge pull request #70091 from clayjohn/bone-aabbs
Remove mesh bone_aabbs as they are not used anywhere and calculating them is a pain
2022-12-17 12:32:32 +01:00
Rémi Verschelde
676f60b0cc
Merge pull request #70132 from clayjohn/RT-update
Implement render_target_was_used API so that Viewports can properly check if they have been used.
2022-12-17 12:26:51 +01:00
Rémi Verschelde
376290ea86
Merge pull request #70163 from clayjohn/particles-sdf
Transform sdf xfrom by particle emission transform when particles are in global space
2022-12-17 12:24:51 +01:00
Rémi Verschelde
3b6d697676
Merge pull request #70133 from lyuma/negative_scale_backface
Flip culling when rendering a camera with negative scale
2022-12-17 12:22:18 +01:00
Rémi Verschelde
13593d8644
Merge pull request #70087 from clayjohn/mesh-aabb
Cache mesh AABB when modified by skeleton and update instance AABB when skeleton changes
2022-12-17 12:21:01 +01:00
clayjohn
d7ffcd20f2 Implement boot image in OpenGL3 renderer 2022-12-16 13:27:33 -08:00
clayjohn
99a159cd9b Transform sdf xfrom by particle emission transform when particles are in global space 2022-12-16 11:55:11 -08:00
clayjohn
1b330820bf Implement render_target_was_used API so that Viewports can properly check if they have been used.
For the RD renderer, this does not work for Viewports used in scene shaders yet
2022-12-16 09:50:45 -08:00
Lyuma
80dea918c4 Flip culling when rendering a camera with negative scale 2022-12-15 16:12:10 -08:00
Rémi Verschelde
47ef0549ee
Merge pull request #70065 from clayjohn/GLES3-attribs
Use instanced array buffer instead of UBO for canvas item batching
2022-12-15 18:45:07 +01:00
Yuri Rubinsky
5c83e95103
Merge pull request #70016 from Chaosus/refactor_rd_shader_data
fixed https://github.com/godotengine/godot/issues/69949
2022-12-15 20:28:26 +03:00
clayjohn
b6a1aa15b1 Use instanced array buffer instead of UBO for canvas item batching
This simplifies the generated shader code which increases both performance and compile time on low end devices
2022-12-15 08:25:44 -08:00
Rémi Verschelde
346efd29e0
Fix typos with codespell 2022-12-15 12:24:08 +01:00
Yuri Rubinsky
56954485ed Refactor ShaderData & fix the sorting of shader uniforms 2022-12-15 10:02:59 +03:00
clayjohn
ef246d9156 Remove mesh bone_aabbs as they are not used anywhere and calculating them is a pain 2022-12-14 19:32:19 -08:00
clayjohn
b7088bbf52 Cache mesh AABB when modified by skeleton and update instance AABB when
skeleton changes
2022-12-14 18:07:07 -08:00
Rémi Verschelde
465d4c1d95
Merge pull request #70009 from clayjohn/glow-hq
Remove high quality glow as it is not any higher quality than regular glow
2022-12-13 23:32:15 +01:00
clayjohn
bdd4001ef0 Various fixes and documentation for CanvasGroup
Properly apply custom materials with CanvasGroups in the GLES3 backend

Properly blur backbuffer when using a partial rect in forward_plus and
gl_compatibility renderers

Properly set fit_margin when clear_margin is set

Fix shader error during backbuffer clear in mobile renderer
2022-12-13 10:22:18 -08:00
clayjohn
5b5cd2b98b Remove high quality glow as it is not any higher quality than regular glow 2022-12-13 10:15:45 -08:00
Rémi Verschelde
4454498d1e
OpenGL: Fix scene shader error when using Omni or Spot but not both
Fixes #69886.
2022-12-11 10:39:39 +01:00
Malcolm Nixon
deb2adf4bd Invalidate the previous index array after calling glBindVertexArray, as this call clears the GL_ELEMEMT_ARRAY_BUFFER when changing the state.
Update rasterizer_scene_gles3.cpp

Fix white-space to match godotengine checks.
2022-12-10 10:28:17 -05:00
Rémi Verschelde
60d7525d84
Merge pull request #69735 from clayjohn/Particles2D-sdf
Detect and report if 2D particles use the screen SDF
2022-12-08 09:52:01 +01:00
Rémi Verschelde
cf093f8e47
Merge pull request #69733 from clayjohn/GLES3-skeleton-leak
Properly free Skeleton RID in RenderingServer.free()
2022-12-07 22:23:40 +01:00
clayjohn
0a88c68d0a Detect and report if 2D particles use the screen SDF
This ensures that the SDF is updated even if not used in a canvas_item shader
2022-12-07 10:03:08 -08:00
clayjohn
1aa61a877a Properly free Skeleton RID in RenderingServer.free() 2022-12-07 09:35:13 -08:00
Rémi Verschelde
bd290ad566
Merge pull request #69636 from Malcolmnixon/vulkan-mobile-sky-matrix
Fix mobile renderer sky_transform operations
2022-12-06 15:16:20 +01:00
Malcolm Nixon
0f8a968cd4 Modified the mobile renderer to apply the sky_transform operations in the same order as the forward_plus renderer.
Update rasterizer_scene_gles3.cpp

Apply sky_transform order fix to the gles3 renderer.
2022-12-06 06:47:50 -05:00
Rémi Verschelde
43e9ca40ff
Merge pull request #65035 from nathanfranke/fix-aabb-mesh
Fix AABB errors on meshes with bones on multiple surfaces
2022-12-06 12:26:03 +01:00
Rémi Verschelde
8ec9701ad0
Merge pull request #69634 from clayjohn/GLES3-spec
Clean up specialization constants in OpenGL scene renderer
2022-12-06 11:00:28 +01:00
Rémi Verschelde
d321bae91e
Merge pull request #69633 from clayjohn/GLES3-textures
Use internal texture name when setting texture uniform location in OpenGL renderer
2022-12-06 11:00:23 +01:00
Rémi Verschelde
09a128761a
Merge pull request #69581 from dsnopek/openxr-opengl-flip-screen
[opengl] Don't flip render target when blitting it to screen if it wasn't rendered upside down
2022-12-06 10:47:05 +01:00
clayjohn
975a8f9ada Clean up specialization constants in OpenGL scene renderer
Also add support for disabling omni and spot lights when not used
2022-12-05 18:10:13 -08:00
clayjohn
ac6b25f33e Use internal texture name when setting texture uniform location in OpenGL renderer 2022-12-05 18:01:24 -08:00
Rémi Verschelde
0697d6f8cd
Merge pull request #69521 from clayjohn/GLES3-glsl
Expose emulated *Unorm4x8 glsl functions in non-android builds
2022-12-05 10:13:38 +01:00
clayjohn
7bc11b5fe8 Exposure emulated *Unorm4x8 glsl functions in non-android builds
Originally these functions were exposed on all GLSL ES 300 devices. However, that causes a build error as Android devices expose the *Unorm4x8 functions despite them not being in the ES 300 spec
2022-12-04 14:05:14 -08:00
Nathan Franke
aef261aa2a
fix aabb errors on meshes with bones on multiple surfaces 2022-12-04 14:40:19 -06:00
David Snopek
5af751bfb7 [opengl] Don't flip render target when blitting it to screen if it wasn't rendered upside down 2022-12-04 14:09:52 -06:00
NumbuhFour
1b09fd5410 Implement CAMERA_VISIBLE_LAYERS as built-in shader variable 2022-12-03 22:41:27 -08:00
Rémi Verschelde
daf168f4c8
Merge pull request #69522 from clayjohn/IBL-black-metal
Allow black metallic materials to reflect IBL
2022-12-03 12:46:30 +01:00
Rémi Verschelde
29ddbfa19a
Merge pull request #69514 from clayjohn/IBL-roughness
Properly remap roughness when reading from radiance map
2022-12-03 12:46:25 +01:00
clayjohn
1e05dd3504 Allow black metallic materials to reflect IBL 2022-12-02 19:54:59 -08:00
clayjohn
b2b89d7294 Properly remap roughness when reading from radiance map
This ensures that we consistently use perceptual roughness which matches the behaviour of most other PBR renderers like Blender, Ue4 and Godot 3
2022-12-02 15:39:20 -08:00
Rémi Verschelde
7ef9947d0e
Merge pull request #68870 from dsnopek/master-webxr-input
Get WebXR fully working in Godot 4!
2022-12-02 12:24:40 +01:00
David Snopek
310bf39cd3 Get WebXR fully working in Godot 4! 2022-12-01 21:46:30 -06:00
Rémi Verschelde
8177e5d7de
Merge pull request #69325 from clayjohn/GLES3-skeletons
Add Skeletons and Blend Shapes to the OpenGL renderer
2022-12-01 23:22:42 +01:00
clayjohn
9141984e7e Enable GLES3 on Android
Add necessary build flags and switch from using a
GLES2 context to a GLES3 one.

This also enables building for OpenXR

Co-authored-by: m4gr3d <fhuyakou@gmail.com>
Co-authored-by: dsnopek <dsnopek@gmail.com>
2022-11-29 14:18:24 -08:00
clayjohn
f33ffd9ab4 Add Skeletons and Blend Shapes to the OpenGL renderer
This uses a similar multipass approach to blend shapes
as Godot 3.x, the major difference here is that we
need to convert the normals and tangents to octahedral
for rendering.

Skeletons work the same as the Vulkan renderer except the bones
are stored in a texture as they were in 3.x.
2022-11-29 09:45:03 -08:00
clayjohn
535f1adc8d Fix drawing of Mesh2D
The batch was being discarded if no instance buffer was present, but an instance buffer is only needed for MultiMesh and particles.
2022-11-24 13:00:42 -08:00
dzil123
b4437cbaa6 Fix various missing rendering parameter checks 2022-11-22 03:48:32 -08:00
clayjohn
e81a1e5b5a Expose model_matrix in GLES3 scene fragment shader 2022-11-21 09:56:08 -08:00
Rémi Verschelde
3a43d44656
Merge pull request #68830 from Ayush-singla27/issuebranch
fixed incorrect mesh normals in shaders
2022-11-20 11:35:52 +01:00
clayjohn
0e5a98cdd8 Fix drawing of 2D skeletons in the RD renderer.
Also clean up skeleton code in preparation for adding them to GLES3

Properly update Mesh2D AABBs when skeleton is updated
2022-11-18 23:36:40 -08:00
Ayush Singla
75ba0a7957 fixed incorrect mesh normals in shaders 2022-11-19 11:06:03 +05:30
dzil123
8fab25f32f GLES3 TextureStorage - add missing null checks 2022-11-16 23:31:59 -08:00
Rémi Verschelde
dbf6ff0cb6
Merge pull request #68372 from Riteo/glad2
Regenerate GL loader code with GLAD 2
2022-11-15 11:56:16 +01:00
Rémi Verschelde
5f78f24b08
Merge pull request #68426 from clayjohn/GLES3-particles
Add GPUParticles to the OpenGL3 renderer.
2022-11-15 10:28:44 +01:00
Rémi Verschelde
64d7ce2a6e
Merge pull request #68628 from clayjohn/shadows
Implement is_animated and casts_shadows
2022-11-15 10:27:29 +01:00
clayjohn
9ce57050a5 Add GPUParticles to the OpenGL3 renderer.
This includes collision (2D SDF, Box, Sphere, Heightmap),
attraction (Box, Sphere), and all sorting modes.

This does not include 3D SDF collisions, trails, or
manual emission.
2022-11-14 23:28:25 -08:00
Riteo
f6397bffb1 Regenerate GL loader code with GLAD 2
GLAD 1 creates unusable loaders for EGL, while the newly released GLAD 2
does not, so for consistency I thought that it would be a good idea to
uniform things beforehand. While it had some API changes some renames
were all that was needed and everything works like before, at least on
the Wayland branch.

I've kept the structure identical, although this new generator has quite
a few hefty features, such as a single header mode.

I've also added GLAD to `thirdparty/README.md`, but I haven't specified
that in the commit title because it's a very small "fix".
2022-11-14 21:48:01 +01:00
Markus Sauermann
3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
Rémi Verschelde
63cded6a85
Merge pull request #61884 from Calinou/alpha-hash-use-opaque-pipeline
Use opaque rendering pipeline for alpha hash materials
2022-11-14 11:08:35 +01:00
clayjohn
4abf47f407 Implement is_animated and casts_shadows
This allows the renderer to correctly decide when to update shadow maps

This PR also adds TIME to a few missing places
2022-11-13 14:09:21 -08:00
clayjohn
539b73384f Implement texture_proxy_update which is needed for AnimatedTexture 2022-11-11 10:05:07 -08:00
Rémi Verschelde
e10f8cbf40
Merge pull request #68186 from pkdawson/expose-texture-rd
Expose texture_get_rd_texture for scripts
2022-11-11 10:43:57 +01:00
Rémi Verschelde
1691a33eb9
Merge pull request #67374 from MrBlockers/fix-draw-primitive
Fix draw_primitive ignoring texture argument
2022-11-11 10:43:18 +01:00
Rémi Verschelde
f4c354630a
Merge pull request #68440 from clayjohn/redraw-TIME
Request redraw in OpenGL3 and mobile renderers when TIME used in shader
2022-11-09 08:58:06 +01:00
clayjohn
a1c3591461 Request redraw in OpenGL3 and mobile renderers when TIME used in shader 2022-11-08 22:52:11 -08:00
David Snopek
23603e409c Add support for OpenGL to OpenXR 2022-11-08 18:47:11 -06:00
clayjohn
3c1e5003ab Fix pathological corner case in drawing tileset editor
Interleaving draw_rect calls with and without a texture forces every rect to
have its own draw call. In this case it meant that there is a draw call for every single
tile in the atlas. This change makes it so the renderer can batch draw calls
which reduced the draw call count by a factor of 512
2022-11-04 13:04:20 -07:00
David Snopek
7fb8b931d7 Collapse three seperate texture storage methods into render_target_set_override() 2022-11-03 13:03:30 -05:00
Patrick Dawson
71d8de2763 Expose texture_get_rd_texture 2022-11-03 05:27:24 +01:00
Rémi Verschelde
4746e874ad
Merge pull request #67770 from clayjohn/GLES3-flip_y
Remove depth correction in GLES3 renderer
2022-11-03 00:32:07 +01:00
Rémi Verschelde
efefd9b198
Merge pull request #68120 from akien-mga/style-doc-cleanup
Style: Misc docs and comment style and language fixes
2022-11-02 22:36:31 +01:00
Rémi Verschelde
f7c611ab71
Style: Misc docs and comment style and language fixes
- Removed empty paragraphs in XML.
- Consistently use bold style for "Example:", on a new line.
- Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`).
- Fix invalid usage of backticks for inline code in BBCode.
- Fix some American/British English spelling inconsistencies.
- Other minor fixes spotted along the way, including typo fixes with codespell.
- Don't specify `@GlobalScope` for `enum` and `constant`.
2022-11-02 19:01:18 +01:00
clayjohn
134a3046b6 Bind DirectionalLight buffer to uniform slot even when not used
This avoids a WEBGL error causes PanoramaSkys to fail to render
2022-11-02 10:38:59 -07:00
Rémi Verschelde
cb1931b271
Merge pull request #67639 from clayjohn/GLES3-2d-shadows
Add 2D shadows and canvas SDF to OpenGL3 renderer
2022-11-02 17:12:20 +01:00
clayjohn
eb07056e70 Add texture reading code to OpenGL3 renderer for web and mobile
This allows using texture_2d_get on all platforms which is needed for the get_image function

This commit also fixes some OpenGL warnings on the Web platform that came from attempting to map a buffer with zero length
2022-11-01 13:42:53 -07:00
Rémi Verschelde
5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Rémi Verschelde
5a00568afb
Merge pull request #67032 from clayjohn/GLES3-gpu-profiling
Add OpenGL timer queries to OpenGL3 backend
2022-10-31 10:43:13 +01:00
Yuri Rubinsky
11e1bac768
Merge pull request #67112 from Chaosus/fix_boolean_uniform_instances 2022-10-28 23:17:23 +03:00
clayjohn
2ec234ff67 Add 2D shadows and canvas SDF to OpenGL3 renderer
This is an initial implementation based on the current RD implementation

Performance will improve later
2022-10-28 11:33:23 -07:00
Clay John
0d711cad30
Merge pull request #66107 from devloglogan/ambient-light-disabled-fix
Fix ambient_light_disabled render mode flag
2022-10-27 10:08:29 -07:00
Clay John
8fd92ed867
Merge pull request #64710 from MinusKube/window-size-crash
Prevent windows from having a size greater than device limit
2022-10-27 10:02:44 -07:00
Clay John
e1caa8797b
Merge pull request #67043 from clayjohn/clip_children
Improve behaviour of clip_children by clipping to parent alpha value but still retaining parent color
2022-10-27 09:59:27 -07:00
Gordon MacPherson
56df8d5f19 Fix EXE_BAD_ACCESS caused by optional argument
This argument is now non optional, but this never hits the same bad access.
I voted to simplify the code here since the argument is never used optionally in our codebase.
2022-10-26 19:33:35 +01:00
Clay John
753a182797
Merge pull request #65334 from dsnopek/opengl-multiview
[opengl] Add multiview to the opengl3 driver
2022-10-23 17:00:01 -07:00
clayjohn
62dc9cd044 Remove depth correction in GLES3 renderer
This code should only have been included in the RD renderer where the
depth range is 0 - 1 instead of -1 - 1
2022-10-22 16:01:52 -07:00
keptsecret
31d44043bb implemented mesh_surface_update_x functions 2022-10-22 16:44:33 -04:00
David Snopek
398ee08375 Add multiview to the opengl3 driver 2022-10-21 21:00:32 -05:00
MrBlockers
0c4fd03f40 Fix draw_primitive ignoring texture argument 2022-10-21 21:35:13 -04:00
kobewi
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Rémi Verschelde
dc4b616596 Merge pull request #63332 from KoBeWi/static_images_aka_photos
Make some Image methods static
2022-10-15 12:56:57 +02:00
Rémi Verschelde
6feded171b Merge pull request #67416 from clayjohn/GLES3-primitive
Fix drawing of 2D primitives in OpenGL3 renderer
2022-10-15 12:56:38 +02:00
clayjohn
6d048af42f Fix drawing of 2D primitives in OpenGL3 renderer
Previously the wrong vertices were used when assembling the second triangle
of a quad
2022-10-14 16:55:14 -07:00
clayjohn
978aa05a99 Fix error in Web builds that resulting in 2D
objects not drawing in the GLES3 backend.

Issue came from not binding a light UBO when using the DISABLE_LIGHTING
code path
2022-10-14 11:18:27 -07:00
clayjohn
b6f44859d7 Implement multiple clip_children modes for CanvasItems 2022-10-14 08:02:28 -07:00
kobewi
072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
clayjohn
09b1a6f85f Improve behaviour of clip_children by clipping
to parent alpha value, but still retaining
parent color
2022-10-13 18:35:12 -07:00
Rémi Verschelde
367a9b8056 Merge pull request #67335 from clayjohn/GLES3-2d-lights
Add 2D lights to OpenGL3 canvas renderer
2022-10-13 09:05:36 +02:00
Rémi Verschelde
f2bd389e21 Merge pull request #67307 from TechnoPorg/lod-radial-distance
Use radial distance for making LOD decisions.
2022-10-13 09:05:00 +02:00
clayjohn
e600fb93a5 Add 2D lights to OpenGL3 canvas renderer
This is an initial implementation using the same single-pass approach as the RenderingDevice.
2022-10-12 17:55:01 -07:00
TechnoPorg
b04350828e Use radial distance for making LOD decisions.
Previously, only forward basis distance from the camera was used.
This means that unnecessarily high LOD levels were used for objects located to the side of the camera.
The distance from the camera origin is now used, independently of direction.
2022-10-12 07:21:42 -06:00
Yuri Rubinsky
f4db4bb7a2 Fix incorrect setup of boolean uniform instances 2022-10-09 08:50:18 +03:00
Yuri Rubinsky
816600382e Fix incorrect offset for vec3 datatypes in _fill_std140_ubo_empty 2022-10-09 06:32:50 +03:00
clayjohn
4765e5fa64 Allow clearing backbuffer after finishing CanvasGroup
This avoids an issue where having multiple CanvasGroups overlap
would create a weird artifact
2022-10-07 14:13:40 -07:00
clayjohn
aca964de4f Add OpenGL timer queries to OpenGL3 backend
This is useful for the visual debugger, printing FPS, and the in-editor FPS display
2022-10-07 09:25:09 -07: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
clayjohn
154b9c1c91 Use a giant UBO to optimize performance in 2D
This removes the countless small UBO writes we had before
and replaces them with a single large write per render pass.

This results in much faster rendering on low-end devices
but improves speed on all devices.
2022-10-06 11:24:45 -07:00
Rémi Verschelde
5b6ccf2fd2 Merge pull request #66720 from qarmin/unintialized_memory
Remove usage of unitialized variables
2022-10-05 11:42:47 +02:00
Rémi Verschelde
3a2b0ab73d Merge pull request #66898 from aaronfranke/proj-mat-columns
Rename Projection `matrix` to `columns`
2022-10-05 08:35:26 +02:00
Bastiaan Olij
c7656978ba Adding getters to RenderTarget and implementing override functionality for XR 2022-10-05 11:37:49 +11:00
Aaron Franke
2cea42cc7f
Rename Projection matrix to columns 2022-10-04 12:34:19 -05:00
Rémi Verschelde
bff9fcfc1c Merge pull request #65822 from BastiaanOlij/more_reorg_20220915
Move cluster builder, sdfgi and gi structures to clustered renderer, and more
2022-10-04 11:20:13 +02:00
clayjohn
c8f0f27a0b Properly expose TEXTURE_PIXEL_SIZE in Opengl3 renderer 2022-10-03 19:13:17 -07:00
Bastiaan Olij
ddc4ae1175 Move cluster builder, sdfgi and gi structures to clustered renderer, move light and probe elements into storage and reorganise our render_scene method. 2022-10-04 11:03:32 +11:00
Rafał Mikrut
2233624152 Remove usage of unitialized variables 2022-10-01 21:09:22 +02:00
Markus Sauermann
7e9327350c Remove ERR_FAIL_COND that never happens in _draw_sky
In the conditional `sky` is always true.
2022-09-30 12:42:50 +02:00
Rémi Verschelde
fe40c52be8 Merge pull request #66638 from timothyqiu/rendering-null
Add various null checks in RenderingServer
2022-09-30 09:58:58 +02:00
Rémi Verschelde
7a0500d9a3 Merge pull request #66626 from danboo/fix-typo-run-debug-collisons
Fix typos - "collison" -> "collision"
2022-09-30 09:58:25 +02:00
Haoyu Qiu
ffdac72eaa Add various null checks in RenderingServer 2022-09-30 10:18:14 +08:00
danboo
eba8be6e45 Fix typo - "collison" -> "collision" 2022-09-29 13:56:26 -08:00
Rémi Verschelde
6991e9b43d Merge pull request #66583 from bruvzg/constexpr
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings.
2022-09-29 10:44:22 +02:00
bruvzg
ea1848ce0a
Use constexpr in the conditions with template parameters and sizeofs to suppress C4127 warnings. 2022-09-29 10:38:21 +03:00
clayjohn
1a0890122f Clean up canvas light shader API.
Expose LIGHT_ENERGY and LIGHT_IS_DIRECTIONAL.
Add LIGHT_DIRECTION
2022-09-28 11:46:58 -07:00
Rémi Verschelde
7da532275b Merge pull request #65541 from clayjohn/renderer-setting
Split rendering driver project setting into renderer_name and rendering_driver
2022-09-20 09:43:59 +02:00
Logan Lang
e61d8b6f53 enabled ambient_light_disabled render mode flag 2022-09-19 17:12:32 -05:00
clayjohn
4a1c7de57c Split rendering driver project setting into renderer_name and rendering_driver. To differentiate between a driver (e.g. Vulkan or D3D12) and a renderer (e.g. clustered or mobile renderer). 2022-09-19 10:26:10 -07:00
Tobias Widner
422bacbfd1 Fix Vulkan: SpotLight3D's and OmniLight3D's Projector doesn't work 2022-09-19 17:18:45 +02:00
Rémi Verschelde
bda63e1b5a Merge pull request #65833 from JFonS/taa_fix_particles_errors
Fix error spam in the renderer when using GPUParticles3D
2022-09-16 11:59:00 +02:00
JFonS
b668268772 Fix error spam in the renderer when using GPUParticles3D
The flag INSTANCE_DATA_FLAG_MULTIMESH is used for both multimesh and particles instances, this commit adds a new INSTANCE_DATA_FLAG_PARTICLES flag to discriminate between them.

This flag will also be used in the future to properly support TAA in particles.
2022-09-16 09:44:22 +02:00
Rémi Verschelde
848668ed45 Merge pull request #65794 from Geometror/fix-canvas-backbuffer
Fix/restore BackBufferCopy
2022-09-16 09:20:04 +02:00
Hendrik Brucker
e235bca995 Fix/restore BackBufferCopy 2022-09-15 02:36:39 +02:00
Rémi Verschelde
0ef17b341d
Merge pull request #65796 from clayjohn/GLES3-canvas-shader 2022-09-14 22:38:08 +02:00
clayjohn
9239c61aa6 Fix canvasitem shader builtins when using GLES3
Remove prefix canvas_data. as it isn't used in the internal canvasitem shader
2022-09-14 12:41:08 -07:00
clayjohn
72d899702b Clear last frame directional light buffer when number of lights changes.
This ensures that the buffers don't go out of sync.
2022-09-14 08:30:35 -07:00
Rémi Verschelde
2e6ba5ff13
Merge pull request #65746 from clayjohn/GLES3-mem-leak
Fix leaking of Mesh version and lod memory when freeing mesh in GLES3
2022-09-13 23:56:53 +02:00
clayjohn
8fa76a5272 Move debanding into internal sky shader code so that it is applied after everything else.
This ensures that the debanding does not scale with exposure or any other effect.
2022-09-13 10:39:04 -07:00
clayjohn
9f708489fa Fix leaking of Mesh version and lod memory when freeing mesh in GLES3 2022-09-13 08:19:14 -07:00
clayjohn
96b7cb66df Fix multiwindow support in GLES3 for X11, Windows, and MacOS.
Instead of updating all viewports, then blitting all viewports
to the backbuffer, then swapping all buffers, we run through
all viewports and render, blit, and swap backbuffer before
going to the next viewport.
2022-09-12 17:30:50 -07:00
Rémi Verschelde
79b21e96ad
Merge pull request #65544 from clayjohn/lambert-wrap
Apply energy conservation to LAMBERT_WRAP diffuse mode by dividing by PI
2022-09-12 20:42:27 +02:00
clayjohn
97be1fb7b6 Apply energy conservation to LAMBERT_WRAP and TOON diffuse modes by dividing by PI 2022-09-12 08:45:40 -07:00
clayjohn
05f351b215 Use proper color type for transparent render targets in GLES3 2022-09-12 08:19:03 -07:00
Rémi Verschelde
337e4d185a
Merge pull request #65016 from timothyqiu/skin-data
Fix crash when executing `TubeTrailMesh.get_faces()` with GLES3
2022-09-07 22:17:55 +02:00
clayjohn
fea48cdfc6 Fix rendering when using WebGL2.
Fixes include using proper depth buffer format in 3D (this had previously been fixed already but the changes were lost in a rebase), Remove unused lighting and shadowing code in 2D, and update 2D UBOs using glBufferSubData so that they remain the appropriate size.
2022-09-06 14:42:08 -07:00
Rémi Verschelde
5062aafc2d Merge pull request #64417 from aaronfranke/has-space
Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
2022-09-06 17:00:44 +02:00
Rémi Verschelde
7b5d1ea5b9 Fix various uninitialized member pointers
Using this command:
```
find -name "thirdparty" -prune -o -name "*.h" -exec sed -i {} -e '/return /! s/\t\([A-Za-z0-9_]* \*[A-Za-z0-9_]*\)\;/\t\1 = nullptr;/g' \;
```

And then reviewing the changes manually to discard the ones that don't
seem correct/safe/good (notably changes to `core` unions).
2022-09-06 11:20:27 +02:00
Aaron Franke
817ae95667
Replace AABB has_no_volume with has_volume
Also replace has_no_surface with has_surface
2022-09-04 23:03:36 -05:00
MinusKube
f5a808192b Prevent windows from having a size greater than device limit 2022-09-04 22:48:54 +02:00
bruvzg
57829b7cc4
Re-enable per-pixel transparency support on Linux, macOS, and Windows (for Vulkan and OpenGL rendering drivers). 2022-09-03 19:16:03 +03:00
Rémi Verschelde
3a62c294c7 Merge pull request #65170 from KoBeWi/your_argument_is_TypedArray 2022-09-02 13:57:02 +02:00
Rémi Verschelde
c82bbc38a5 Merge pull request #64952 from Chaosus/vs_rename_uniform_to_param 2022-09-02 13:49:53 +02:00
kobewi
7adc8376ed Change Array arguments to TypedArray 2022-09-01 13:13:19 +02:00
Bastiaan Olij
2cd84be64d Extracting render buffers and changing it to a more generic solution 2022-09-01 20:01:45 +10: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
Hugo Locurcio
09bedcead4
Add a per-light volumetric fog energy property
Per-light energy gives more control to the user on the final result of
volumetric fog. Specific lights can be fully excluded from volumetric fog
by setting their volumetric fog energy to 0, which improves performance
slightly. This can also be used to prevent short-lived dynamic effects
from poorly interacting with volumetric fog, as it's updated over several
frames by default unless temporal reprojection is disabled.

Volumetric fog shadows now obey Light3D's Shadow Opacity property as well.

The shadow fog fade property was removed as it had little visible impact
on the final scene's rendering.
2022-08-30 20:03:38 +02:00
Rémi Verschelde
02d510bd07
Merge pull request #63003 from Geometror/msaa-2d 2022-08-30 14:54:20 +02:00
Aaron Franke
10a56981dc
Rename String plus_file to path_join 2022-08-29 19:38:13 -05:00
Fabio Alessandrelli
d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Haoyu Qiu
7c77cd0f7b Fix crash when executing TubeTrailMesh.get_faces() with GLES3 2022-08-29 13:05:10 +08:00
Rémi Verschelde
f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
bruvzg
bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
Rémi Verschelde
7b4927bb5f
Merge pull request #60309 from The-O-King/oct 2022-08-22 19:29:21 +02:00
Max Hilbrunner
5e0d2b5097
Merge pull request #62046 from clayjohn/vertexless-draw
Allow creating meshes without vertex positions
2022-08-20 05:32:28 +02:00
clayjohn
bbbcdd725a Remove requirement to have vertex positions when creating a mesh. Meshes can now be constructed from an index buffer alone 2022-08-19 14:50:12 -06: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
Aaron Franke
f91934872d
Use a const ref for the bone AABB in rendering code 2022-08-18 12:20:11 -05:00
Clay John
982ff7d925
Merge pull request #64416 from aaronfranke/aabb
Don't try to merge unused bone AABBs in the rendering server
2022-08-17 23:56:05 -06:00
Aaron Franke
e0d80b37e9
Don't try to merge unused bone AABBs in the rendering server 2022-08-14 23:30:48 -05:00
Omar El Sheikh
f1fda97c33 Implement Octahedral on OpenGL3 2022-08-13 10:20:14 -07:00
Hendrik Brucker
e96b1a2c0c Implement MSAA for 2D [Vulkan only] 2022-08-13 01:09:48 +02:00
clayjohn
65e0b266d1 Bind uniform buffer locations for lights even when no lights present to comply with strict webGL drivers 2022-08-12 15:23:01 -06: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
bruvzg
e7464e7a30
Fix macOS and iOS defines in the rendering code. 2022-08-08 17:51:31 +03:00
Rémi Verschelde
8734ef1f7a
Merge pull request #62547 from clayjohn/ref_vec_pbr 2022-08-08 10:18:32 +02:00
Hugo Locurcio
baaa7503c7
Add a shadow opacity property to Light3D
This can be used to make shadows translucent for a specific light.

The light distance fade system also uses this to smoothly fade the shadow
when the light fade transition distance is greater than 0.
2022-08-07 11:06:32 +02:00
Rafał Mikrut
49632bf993 Check also GLES3 in CI 2022-08-06 19:12:09 +02:00
Hugo Locurcio
db22b7ded0
Rename shader parameter uniform setter/getter methods for consistency
`shader_uniform` is now consistenly used across both per-shader
and per-instance shader uniform methods. This makes methods easier
to find in the class reference when looking for them.
2022-08-04 23:17:06 +02:00
Rémi Verschelde
8a9700c8a7 Force disable S3TC support on Android/iOS since we don't handle it
Fixes #63909 for now.
This could be improved in the future if we want to properly support S3TC on mobile.
2022-08-04 18:27:56 +02:00
Patrick Exner
fe5901310e Add spatial built-ins (camera-pos, object-pos, camera-eye etc.) 2022-08-02 17:30:41 +02:00
Rémi Verschelde
8cce479c01
Merge pull request #51672 from Calinou/shader-add-hint-transparent-texture
Add `hint_transparent` to use a transparent black placeholder texture
2022-08-02 07:15:59 +02: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