Commit graph

3189 commits

Author SHA1 Message Date
clayjohn
d3c3fa32af Stop incrementing light_count once max number of lights are reached in 2D canvas renderer 2023-01-20 17:04:00 -08:00
Rémi Verschelde
4db3716d8d
Merge pull request #71772 from clayjohn/GLES3-li
Assign light indices after sorting in OpenGL renderer
2023-01-21 01:43:08 +01:00
clayjohn
6d0af4fcd8 Assign light indices after sorting in OpenGL renderer
This ensures that the light indices sent to the shader actually match where the light is saved
2023-01-20 15:41:20 -08:00
clayjohn
49bebf2bfb Sort decals and lights based on camera origin
Also implement sort_offset for decals

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-01-20 09:58:17 -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
6da836bbb4
Merge pull request #71514 from akien-mga/os-unset_environment
OS: Add `unset_environment`, better validate input
2023-01-18 08:35:43 +01: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
91a54cdbc1
Linux/BSD: Add LINUXBSD_ENABLED define for non X11-related checks 2023-01-16 17:01:35 +01:00
Rémi Verschelde
818a9e99a4
OS: Add unset_environment, better validate input
Instead of returning an undocumented boolean error code, we do the
validation checks that should ensure a successful result.

Based on:
- https://linux.die.net/man/3/setenv
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setenvironmentvariable
2023-01-16 16:39:44 +01:00
Bastiaan Olij
318656d326 Enabling additional vulkan extension and adding further checks 2023-01-15 14:49:15 +11: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
Rémi Verschelde
886f7f8290
Merge pull request #71248 from rsjtdrjgfuzkfg/opengl-texture-format
OpenGL: Support FORMAT_{ETC2,DXT5}_RA_AS_RG
2023-01-12 21:11:44 +01:00
Rémi Verschelde
0e4e782ada
Merge pull request #70714 from Calinou/doc-os-stdin
Improve documentation for `OS.read_string_from_stdin()`
2023-01-12 09:24:47 +01: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
Hugo Locurcio
86b8176864
Improve documentation for OS.read_string_from_stdin()
This makes it clearer that calls to this method are blocking.

The unused method parameter was also removed.
2023-01-11 19:57:25 +01:00
Juan Linietsky
c5390f203d Prevent opening Windows console files
Fixes #20110.
2023-01-11 15:05:29 +01:00
Pedro J. Estébanez
5ca2ba45f1 Make inclusion of Godot version in shader hash universal 2023-01-09 17:47:02 +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
bruvzg
3d8a942a56
Fix reading Unicode from stdio. 2022-12-21 09:07:59 +02:00
Rémi Verschelde
f318d60e06
Merge pull request #65376 from reduz/astc-support
Implement basic ASTC support
2022-12-20 12:44:30 +01:00
Juan Linietsky
71d21c7ccb Implement basic ASTC support
Implements basic ASTC support:
* Only 4x4 and 8x8 block sizes.
* Other block sizes are too complex to handle for Godot image compression handling. May be implemented sometime in the future.

The need for ASTC is mostly for the following use cases:
* Implement a high quality compression option for textures on mobile and M1 Apple hardware.
* For this, the 4x4 is sufficient, since it uses the same size as BPTC.

ASTC supports a lot of block sizes, but the benefit of supporting most of them is slim, while the implementation complexity in Godot is very high.
Supporting only 4x4 (and 8x8) solves the real problem, which is lack of a BPTC alternative on hardware where it's missing.

Note: This does not yet support encoding on import, an ASTC encoder will need to be added.
2022-12-20 11:26:30 +01: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
Clay John
aa8a899f52
Merge pull request #70104 from RandomShaper/vk_dev_asserts
Replace certain sanity checks with proper dev-only assertions in Vulkan RD
2022-12-15 08:22:17 -08:00
Yuri Rubinsky
d99ea32999
Merge pull request #70102 from Chaosus/rd_remove_usage_indirect 2022-12-15 16:22:19 +03:00
Pedro J. Estébanez
af6189711e Replace certain sanity checks with proper dev-only assertions in Vulkan RD 2022-12-15 12:34:08 +01:00
Rémi Verschelde
346efd29e0
Fix typos with codespell 2022-12-15 12:24:08 +01:00
Yuri Rubinsky
807632a90c Changed STORAGE_BUFFER_USAGE_DISPATCH_INDIRECT type to enum flags 2022-12-15 14:10:37 +03:00
Rémi Verschelde
762c6d4b36
Merge pull request #69709 from RandomShaper/refactor_spirv_reflection
Refactor SPIR-V reflection into a generic RenderingDevice feature
2022-12-15 09:21:35 +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
Pedro J. Estébanez
14e301467e Refactor SPIR-V reflection into a generic RenderingDevice feature 2022-12-12 14:14:53 +01:00
Pedro J. Estébanez
c985ee985f Tidy up some aspects of Vulkan RD 2022-12-12 14:14:53 +01:00
Rémi Verschelde
f79c034713
Merge pull request #69635 from BastiaanOlij/fix_get_buffer
Fix barrier on buffer_get_data
2022-12-12 11:44:29 +01:00
Rémi Verschelde
f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière
be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
Rémi Verschelde
97df6de4a7
Merge pull request #69901 from akien-mga/gles3-fix-scene-shader-omni-spot
OpenGL: Fix scene shader error when using Omni or Spot but not both
2022-12-12 08:27:41 +01:00
Yuri Rubinsky
6e48db69a3 Changed RD::PipelineDynamicStateFlags type to enum flags 2022-12-11 15:37:35 +03: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
6717c4cad2
Merge pull request #69322 from BastiaanOlij/fix_vulkan_versions
Fix issue around incorrect Vulkan version
2022-12-06 16:11:10 +01: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
Bastiaan Olij
d79f692cae Fix barrier on buffer_get_data 2022-12-06 22:44:35 +11: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
Bastiaan Olij
2562c06032 Fix issue where we should be using device supported version instead of instance version for Vulkan 2022-12-05 10:12:07 +11: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
Rémi Verschelde
2d1bf56510
Merge pull request #68740 from bruvzg/ios_fixes
[iOS] Fix getting Unicode executable path, fix error spam on start.
2022-11-28 08:31:53 +01:00
Yuri Rubinsky
5934eef44c Changed RenderingDevice::TextureUsageBits type to enum flags 2022-11-26 13:08:07 +03: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
Bastiaan Olij
a479f5af22 Improve logic for detecting and tracking extensions 2022-11-24 21:48:16 +11:00
Rémi Verschelde
e7418cac3d
Merge pull request #68942 from Chaosus/barrier_mask_flags
Expose `BarrierMask` as flags enum in `RenderingDevice`
2022-11-22 08:31:12 +01:00