Commit graph

2345 commits

Author SHA1 Message Date
JFonS
b1ca82c43a CPU lightmapper fixes.
- Fix Embree runtime when using MinGW (patch by @RandomShaper).
- Fix baking of lightmaps on GridMaps.
- Fix some GLSL errors.
- Fix overflow in the number of shader variants (GLES2).
2021-01-15 12:32:54 +01:00
JFonS
112b416056 Implement new CPU lightmapper
Completely re-write the lightmap generation code:
- Follow the general lightmapper code structure from 4.0.
- Use proper path tracing to compute the global illumination.
- Use atlassing to merge all lightmaps into a single texture (done by @RandomShaper)
- Use OpenImageDenoiser to improve the generated lightmaps.
- Take into account alpha transparency in material textures.
- Allow baking environment lighting.
- Add bicubic lightmap filtering.

There is some minor compatibility breakage in some properties and methods
in BakedLightmap, but lightmaps generated in previous engine versions
should work fine out of the box.

The scene importer has been changed to generate `.unwrap_cache` files
next to the imported scene files. These files *SHOULD* be added to any
version control system as they guarantee there won't be differences when
re-importing the scene from other OSes or engine versions.

This work started as a Google Summer of Code project; Was later funded by IMVU for a good amount of progress;
Was then finished and polished by me on my free time.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2021-01-14 18:05:56 +01:00
Lorenz Junglas
c7f2f9fa1f
Fix nanosleep usage
nanosleep returns 0 or -1 not the error code.
The error code "EINTR" (if encountered) is placed in errno, in which case nanosleep can be safely recalled with the remaining time.

This is required, so that nanosleep continues if the calling thread is interrupted by a signal.

See manpage nanosleep(2) for additional details.

(cherry picked from commit 1107c7f327)
2021-01-13 16:17:09 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde
188609e5ab
CI: Update to clang-format 11 and apply ternary operator changes
(cherry picked from commit af878716f2)
2021-01-13 16:14:35 +01:00
lawnjelly
1e99e893ef Batching - fix proxy textures (e.g. animated) especially ninepatch
Ninepatch code has a check to prevent use of zero sized textures. This didn't deal properly with animated textures, which use a proxy (link to another texture).

This PR uses a generalised method of getting textures, with built in support for proxy textures and protection against infinite loops.
2020-12-29 10:40:17 +00:00
clayjohn
6cefadc233 Properly apply auto exposure with FXAA in GLES3 2020-12-26 15:23:08 -08:00
lawnjelly
15e57a0235 Remove buffer orphaning options project settings
These were only put in for the betas, in order to test hypotheses for stalling on Macs. It seems that most of the problems in the Mac editor have been solved by fixing the excessive redraw_requests.

As a result no one has reported any results from these options, but in future we will be able to refer users to try the beta versions, so there is no need to include them in the stable release. Indeed they are only likely to cause confusion.
2020-12-23 15:23:02 +00:00
Rémi Verschelde
542acc8580
Merge pull request #44340 from lawnjelly/ninepatch_zerosize
Batching - Protection against zero and small sized ninepatches
2020-12-20 19:50:01 +01:00
Rémi Verschelde
8c63b65b67
Merge pull request #44489 from ForestKatsch/3.2
Fix PanoramaSky artifacts on Android/GLES2
2020-12-20 19:31:17 +01:00
Forest Katsch
8825aa8b5b Fixes #43667.
The root cause of the issue is that OpenGL ES 2 does not support the `textureCubeLod` function.
There are (optional) extensions to support this, but they don't appear to be exposed with the ES2 renderer (even though the hardware needed to support LOD features are certainly available.)
The existing shim in `drivers/gles2/shaders/cubemap_filter.glsl` just creates a macro:

```
 #define textureCubeLod(img, coord, lod) textureCube(img, coord)
```

But the third parameter of `textureCube` is actually a mip bias, not an absolute mip level.
(And it doesn't seem to work regardless.)
In this specific case, the `cubemap_filter` should only sample from the first level of the "source" panorama cubemap.
In lieu of a method to force a lod level of zero, I've chosen to comment out the switchover from a 2D equirectangular panorama to the cubemap version of the same image, therefore always sampling roughness values from the 2D equirectangular panorama.
This may cause additional artifacts or issues across the seam, but at least it prevents the glaringly obvious black areas.

---

This same issue (no fragment texture LOD support) has rather large repercussions elsewhere too; it means materials with larger cubemap density (i.e. planar or distant objects) will be far rougher than expected.
Since GLES 3 appears to properly support fragment `texture*Lod` functions, switching to the GLES 3 backend would solve this problem.

---

Root cause discovered with help from @KaadmY.
2020-12-20 10:32:30 -06:00
Theogen Ratkin
8f6a6ac8d0 Add interpolation parameter to resize_to_po2()
Image::resize_to_po2() now takes an optional p_interpolation parameter
that it passes directly to resize() with default value INTERPOLATE_BILINEAR.

GLES2: call resize_to_po2() with interpolate argument

Call resize_to_po2() in GLES2 rasterizer storage with either
INTERPOLATE_BILINEAR or INTERPOLATE_NEAREST depending on TEXTURE_FLAG_FILTER.

This avoids filtering issues with non power of two pixel art textures.
See #44379
2020-12-18 14:02:38 -04:00
Hugo Locurcio
680312b95a
Fix invalid property hint for max_renderable_elements project setting
This closes #36240.
2020-12-16 19:33:15 +01:00
lawnjelly
2d6cb3e208 Batching - Protection against zero and small sized ninepatches
Although the minimum size of ninepatches is set to the sum of the margins in normal use (through gdscript etc) it turns out that it is possible to programmatically create ninepatches that are small than this minimum - in particular zero size is used in sliders to not draw items.

This PR deals with zero sized ninepatches by not drawing anything, and has some basic protection for ninepatches smaller than the margins. Whether these occur in the wild is not clear but is put in for completeness.
2020-12-13 10:17:50 +00:00
lawnjelly
e13040b373 Fix bug in normal map decompression
Not clamping the range here leads to dithering artifacts.
2020-12-11 10:34:53 +00:00
Fabio Alessandrelli
f73c9e555f
Remove now unused FileAccessBuffered.
(cherry picked from commit 781efc26e0)
2020-12-09 11:36:58 +01:00
Marcus Brummer
b02900478f Fixed the inverse(mat3) polyfill for GLES2 2020-12-07 22:19:45 +01:00
Cooper Harasyn
4bf141a47e
Prevent ALSA audio corruption
When using the ALSA driver, corruption would occur if `snd_pcm_writei`
was unable to consume the entire sound buffer. This would occur
frequently on the Raspberry Pi 3 which uses the `snd_bcm2835` audio
driver.

This bug resulted from incorrect pointer math on line 187, resulting in
the sample source pointer being advanced by `total * ad->channels` bytes
instead of `total * ad->channels` samples. In my opinion, the best fix
is to change `*src` to type `int16_t`, since that is the sample type in
use.

Fixes #43927.

(cherry picked from commit 25b2f82ccf)
2020-12-01 09:00:53 +01:00
lawnjelly
4c588c21e8 Fix ninepatch batch break logic.
I'd forgotten to add check for need for a new batch. Fixes visual anomalies, particularly tab container.
2020-11-30 10:29:52 +00:00
Firepal
ec7a9ca018 Use correct normal for ReflectionProbe in GLES2 2020-11-26 13:08:30 +01:00
Rémi Verschelde
ac8dedd532
doc: Warn about using Node internal processing
See #43689.

Also 'fixed' some spelling for behavior in publicly visible strings.
(Sorry en_GB, en_CA, en_AU, and more... Silicon Valley won the tech spelling
war.)

(cherry picked from commit a655de89e3)
2020-11-26 09:38:45 +01:00
jfons
69939028b3 Fix regression in baked lights when using GLES2
Lights with bake mode set to "All" were behaving erratically because of a
faulty check in the renderer. This should be the correct way to check if
a geometry instance is using baked light.
2020-11-25 18:12:50 +01:00
lawnjelly
7c4cf1c043 Batching - BackBuffer copy fix
For fixing a previous issue state.canvas_texscreen_used was reset to false at the start of each render_joined_item. This was causing a later shader that used SCREEN_TEXTURE to force recapturing the back buffer immediately prior to use, which we don't want.

This PR preserves the state across joined items, and also prevents joining of items that copy the back buffer as this may be problematic.

It turns out that the original issue that needed the line is now fixed, and the later issue is also fixed by removing it.
2020-11-24 14:59:15 +00:00
Rémi Verschelde
5a66e66448
Merge pull request #43776 from lawnjelly/ewok_asserts3
2d Legacy - close vulnerabilities and more debug checks
2020-11-24 09:14:17 +01:00
lawnjelly
1d65b83cdb Put in check for zero sized textures
To prevent divide by zero.
2020-11-22 18:09:05 +00:00
lawnjelly
3c69377f10 2d Legacy - close vulnerabilities and more debug checks
While adding more debug checks to legacy renderer, I closed 2 types of vulnerabilities:

* TYPE_PRIMITIVE would previously read from uninitialized data if only specifying a single color
* Other legacy draw operations would fail in debug AFTER accessing out of bounds memory rather than before

Many calls to glBufferSubData are wrapped in a safe version which checks for out of bounds and exits the draw function if this is detected.
2020-11-22 16:09:02 +00:00
lawnjelly
4ae797b802 Batching - more error checking options
This adds some more error checking options for development, and simplifies the control flow checks which now become debug asserts.
2020-11-21 15:12:36 +00:00
lawnjelly
1394df3188 Prevent item joining with custom shaders using selected BUILTINs
Large FVF allows batching of many custom shaders, but should not join items which have shaders that utilize BUILTINs which would change for each item, because these will not be sent individually, and all joined items would wrongly use the values from the first joined item.
2020-11-19 15:09:33 +00:00
lawnjelly
f84f1e8b81 Prevent poly color path when translating batches than are non-poly
A previous fix for poly colors had caused a regression in the rect behaviour, this PR re-enables proper translation of rect batches.
2020-11-19 10:10:09 +00:00
lawnjelly
4cadae5713 Batching - blank UVs in polys that contain no UVs
Polys that have no texture assigned contain no UVs in the poly command. These were previously not blanked, leading to random values if read from a custom shader.

This PR just blanks them.
2020-11-18 10:36:47 +00:00
Unknown
5965fbd9fa Make lights_per_object configurable 2020-11-17 10:03:44 -05:00
Rémi Verschelde
b38f7af4fd
Merge pull request #43498 from lawnjelly/ewok_poly_modulate
Poly colors fixes
2020-11-16 09:58:36 +01:00
lawnjelly
7183e3ce43 Fix 2d software skinning with scaled polys
In some situations where polygons were scaled, existing software skinning was producing incorrect results.

The transform inverse needed to use an affine inverse rather than a cheaper inverse to account for this scaling.
2020-11-14 13:24:10 +00:00
lawnjelly
e88b4f330e Poly colors fixes
This adds support for custom shaders for polys, and properly handles modulate in the case of large FVF and modulate FVF.

It also fixes poly vertex colors not being sent to OpenGL.
2020-11-13 13:23:28 +00:00
Pedro J. Estébanez
3ec62c82a3 Implement no-window mode for X11 and MacOS
Bonus: Homogeinize and improve OS::alert() for no-window mode
2020-11-09 20:56:12 +01:00
Rémi Verschelde
d3ffff3ad8
Merge pull request #43126 from lawnjelly/buffer_orphan_mode
Add project settings to manually specify API usage
2020-11-05 12:30:38 +01:00
lawnjelly
df4ef8dfac Batching - use legacy path for antialiased polys.
Antialiased polys work by drawing a smoothed line around the poly after the main drawing. Batching draws polys as a series of triangles with no concept of 'edge', and when 2 polys are joined it becomes impractical to back calculate the edges from the triangles.

For this reason batching is disabled for antialiased polys in this PR.
2020-11-05 10:50:50 +00:00
clayjohn
756a37bcae Properly reset texture flags when generating radiance 2020-11-01 09:06:44 -08:00
lawnjelly
5c8f497a24 Add project settings to manually specify API usage
As a result of the GLES specifications being vague about best practice for how buffers should be used dynamically, different GPUs / platforms appear to have different preferences.

Mac in particular seems to have a number of problems in this area, and none of the rendering team uses Macs. So far we have relied on guesswork to choose the best usage, but in an attempt to pin this down, this PR begins to introduce manual selection of options for users to test their configurations.
2020-10-31 18:33:55 +00:00
Rémi Verschelde
c43b2ab603
Merge pull request #42942 from Calinou/add-viewport-debanding-3.2
Add a debanding property to Viewport for GLES3
2020-10-30 11:47:57 +01:00
Ev1lbl0w
126d08e33d
Fix wrong exit code being returned
(cherry picked from commit 0d3a168a53)
2020-10-28 14:05:41 +01:00
Rémi Verschelde
efdc5f0f89
Merge pull request #43054 from lawnjelly/ewok_fix_largefvf
Fix transforms in custom shaders using large FVF
2020-10-28 09:49:36 +01:00
lawnjelly
586285639a Fix lines used in item with custom shader
Lines are batched using the simplest fvf 'BatchVertex', however when used in an item with a custom shader material, it may attempt to translate to large_fvf without the required extra channels. To prevent this a special case in flushing is made to deal with lines.
2020-10-26 17:45:44 +00:00
lawnjelly
f4cb88e232 Fix transforms in custom shaders using large FVF
In small batches using hardware transform, vertices would be drawn in incorrect positions due to the item transform being applied twice - once in the transform uniform, and once from the transform passed as a vertex attribute.

This PR alters the shader to ignore uniform transforms when using large FVF.
2020-10-25 12:57:42 +00:00
clayjohn
505d469e50 Remove extra exposure multiply in FXAA 2020-10-24 13:11:27 -07:00
lawnjelly
debda7f411 Reverting changes to legacy polys and generic prims
Due to my less than eagle-like view over these functions I had assumed they were passing in a single buffer input for the changes to make buffer uploading more efficient. They aren't, which is less than ideal.

So these particular changes should be reverted. When I have some more time I'll see whether the API for these calls can be changed, because as is the multiple glSubBufferData calls could be causing stalls on some hardware.
2020-10-22 10:01:25 +01:00
Hugo Locurcio
2dbc329704
Add a debanding property to Viewport for GLES3
It can be enabled in the Project Settings
(`rendering/quality/filters/use_debanding`). It's disabled
by default as it has a small performance impact and can make
PNG screenshots much larger (due to how dithering works).

As a result, it should be enabled only when banding is noticeable enough.

Since debanding requires a HDR viewport to work, it's only supported
in the GLES3 backend.
2020-10-20 19:07:15 +02:00
Hugo Locurcio
af45c97652
Add fast approximate antialiasing (FXAA) to Viewport
This backports FXAA from the `master` branch.

Co-authored-by: Clay John <claynjohn@gmail.com>
2020-10-20 14:54:52 +02:00
lawnjelly
a63d8aa634 Resync RasterizerDummy to Rasterizer 2020-10-20 11:59:13 +01:00
Rémi Verschelde
f442dc062a
Merge pull request #42056 from Yetizone/negative_lights_behavior
tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
2020-10-19 22:40:24 +02:00
Juan Linietsky
388ebfb498
Merge pull request #41629 from JFonS/disable_baked_lights
Disable lights for objects with baked lighting
2020-10-19 14:12:50 -03:00
Rémi Verschelde
123942f61f
Merge pull request #42119 from lawnjelly/ewok3
Unified GLES3 / GLES2 Batching
2020-10-19 15:01:10 +02:00
Rémi Verschelde
4a92d2111b
Merge pull request #38954 from puchik/ssr-far-clip
Check if screen space reflection has passed far clip
2020-10-18 20:48:44 +02:00
Juan Linietsky
8ca98dd1a0
Merge pull request #41892 from puchik/ssr-edge-fade
Fade screen-space reflection towards inner margin
2020-10-18 14:50:20 -03:00
lawnjelly
74c460fb67 Reduce glBufferSubData calls in legacy renderer
This is part of effort to make more efficient use of the API for devices with poor drivers. This eliminates multiple calls to glBufferSubData per update.
2020-10-18 11:27:08 +01:00
lawnjelly
c2290dbedd Unified GLES2 / GLES3 Batching
Batching is mostly separated into a common template which can be used with multiple backends (GLES2 and GLES3 here). Only necessary specifics are in the backend files.

Batching is extended to cover more primitives.
2020-10-16 10:34:47 +01:00
lawnjelly
42bca1a4a9 Fix buffer orphaning on desktop
Vertex / Index Buffer orphaning was previously turned off on desktop, which was causing performance problems on some platforms, especially Mac.
2020-10-12 10:32:35 +01:00
JFonS
fcb00ca048 Disable lights for objects with baked lighting
Don't apply lighting to objects when they have a lightmap texture and
the light is set to BAKE_ALL. This prevents applying the same direct
light twice on the same object and makes setting up scenes with mixed
lighting much easier.
2020-10-11 20:41:40 +02:00
PouleyKetchoupp
f9544716f4 Option for software skinning in MeshInstance
Option in MeshInstance to enable software skinning, in order to test
against the current USE_SKELETON_SOFTWARE path which causes problems
with bad performance.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2020-10-08 16:14:55 +02:00
Rémi Verschelde
2882284795
Merge pull request #42538 from clayjohn/GLES2-light-texture
Use separate texture unit for light_texture
2020-10-03 23:33:57 +02:00
clayjohn
081d016e60 Use separate texture unit for light_texture 2020-10-03 12:15:58 -07:00
xix xeaon
975637c60b
Fix mod op (%) implementation in GLES2 2020-10-02 11:43:19 +02:00
clayjohn
ea1b8d8435 Fix glow on devices with only 8 texture slots 2020-09-30 22:28:20 -07:00
Haoyu Qiu
7840a550b5
Hides special folders in FileDialog for macOS
(cherry picked from commit 1998f78679)
2020-09-29 13:57:58 +02:00
Bartłomiej T. Listwon
858bdbacfd
Add all headers to VS Project
(cherry picked from commit 317c2b194d)
2020-09-29 13:57:56 +02:00
Rémi Verschelde
422c279fcb
Merge pull request #41323 from lawnjelly/kessel_lightangles
GLES2 2D fix normal mapping - batching and nvidia workaround
2020-09-28 18:45:43 +02:00
Rémi Verschelde
cd05197fb3
Merge pull request #41254 from lawnjelly/gles3_nvidia_normalrotation
GLES3 fix normal map flipping with nvidia workaround
2020-09-28 10:40:22 +02:00
Vasiliy Makarov
f388ea00bf iOS: Fix multiple issues with PVRTC import, disable ETC1
Fixes: #28683, #28621, #28596 and maybe others

For iOS we enable pvrtc feature by default for both GLES2/GLES3
Etc1 for iOS doesn't have any sense, so it disabled.
Fixed checks in export editor.
Fixed pvrtc ability detection in GLES2 driver.
Fixed pvrtc encoding procedure.
2020-09-23 11:13:50 +02:00
Rémi Verschelde
c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 14:09:51 +02:00
Rémi Verschelde
b73a9109ab
NetBSD: Implement OS_Unix::get_executable_path()
Same implementation as OpenBSD seems to work fine.

(cherry picked from commit 01185acecb)
2020-09-18 11:55:58 +02:00
Rémi Verschelde
cb78a5d7ae
Linux/BSD: Fix support for NetBSD
Add __NetBSD__ to `platform_config.h` so that it can find `alloca`
and use the proper `pthread_setname_np` format.

Rename RANDOM_MAX to avoid conflict with NetBSD stdlib.

Fixes #42145.

(cherry picked from commit 5f4d64f4f3)
2020-09-18 10:29:52 +02:00
Yetizone
e6a860deb6 tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
Color values can become negative in the case of negative lights which
leads to undesired behaviour.
2020-09-15 15:46:30 +03:00
Arman
cf7bb2c51f Fade screen-space reflection towards inner margin
- Fade reflection towards inner margin and clip it at screen edges instead of external margin.
- Round edges of the fade margin if both are being cut off to prevent sharp corners.
2020-09-08 15:29:36 -07:00
Marcel Admiraal
5f1dd48496
Replace calls to gmtime with gmtime_r and localtime with localtime_r.
(cherry picked from commit 4b3aec50c0)
2020-09-08 08:55:26 +02:00
Fredia Huya-Kouadio
0af5cded1e Fix the update logic for user-added custom defines.
The previous logic was causing the (unintentional) removal of custom defines automatically added by the engine.
2020-09-06 21:31:09 -07:00
Marcel Admiraal
c6cccdf0c6 Ensure header guards enclose entire header.
(cherry picked from commit f6ad1954f7)
2020-09-04 08:48:35 +02:00
Adam Brown
a16bedd2d9 dummy_rasterizer now returns lightmap type
Previously VS::INSTANCE_NONE was returned for Lightmap data, this caused `visual_server_scene.cpp` to assert in `instance_set_use_lightmap()`

Now `dummy_rasterizer.h` returns `VS::INSTANCE_LIGHTMAP_CAPTURE` for lightmap capture data thus satisfying `visual_server_scene`
2020-09-02 11:50:36 -07:00
lawnjelly
674327b78f GLES3 fix normal map flipping with nvidia workaround
When not using TEXTURE_RECT path, flips have to sent via another method to the shader, to ensure that normal maps are correctly adjusted for direction. This PR adds an extra vertex attribute, LIGHT_ANGLE.

For nvidia workarounds, where the shader still has access to the final transform and extra matrix, the LIGHT_ANGLE can be 0 (no adjustment), 180 degrees for a horizontal flip, and negative indicates a vertical flip.

For batching path, the LIGHT_ANGLE can be used to directly specify the light angle for normal mapping, even when the final transform and extra matrix have been baked into vertex positions, so the same shader can be used for both.
2020-08-23 07:54:58 +01:00
lawnjelly
ecd39094ed GLES2 2D fix normal mapping - batching and nvidia workaround
Normal mapping previously took no account of rotation or flips in any path except the TEXTURE_RECT (uniform draw) method. This passed flips to the shader in uniforms.

In order to pass flips and rotations to the shader in batching and nvidia workaround, a per vertex attribute is required rather than a uniform. This introduces LIGHT_ANGLE which encodes both the rotation of a quad (vertex) and the horizontal and vertical flip.

In order to optionally store light angles in batching, we switch to using a 'unit' sized array which can be reused for different FVF types, as there is no need for a separate array for each FVF, as it is a waste of memory.
2020-08-18 17:49:24 +01:00
lawnjelly
2961d905bb GLES2 batching - Fix redundant transform synchronization in batches
In rare circumstances an item would issue multiple transform commands before a (non rect) draw command. The command syncronization would incorrectly start from first transform, instead of the current transform in these circumstances, which could have the result of missing drawing some commands from the end of the batch.

This had been shown in the wild occuring in debug collision polys. It was a benign error (sometimes visual elements would be lost), but did not cause any serious problems.

This PR fixes this synchronization error.
2020-08-18 08:37:07 +01:00
bruvzg
b0aabf2c03 [macOS] Fix crash on failed fork.
(cherry picked from commit d6e3a8a137)
2020-08-14 00:32:04 +02:00
lawnjelly
e126b941be Removes some superfluous FORCE_INLINES
Compiler is usually in the best position to decide whether to inline functions. Great care must be taken using FORCE_INLINE because it can have unforeseen consequences with recursion, loops and bloat to the executable.

Here some FORCE_INLINES are removed in order to allow the compiler to make best choice and remove a compilation warning where unable to inline during a recursive function.

Fixes #41226
2020-08-13 17:58:47 +01:00
Holger Dammertz
efe6b50f17 Added option to enable high precision float in GLES2
An additional project setting under rendering/gles2/compatibility with the name
enable_high_float.Android is introduced that enables #define USE_HIGHP_PRECISION
in GLES2 shader on Android when it is supported by the shader compiler.
This fixes #33633 and #32813 and also https://github.com/GodotVR/godot_oculus_mobile/issues/60
and https://github.com/GodotVR/godot_oculus_mobile/issues/68 on devices that
support the highp (high precision) modifier.
2020-07-30 05:40:15 +02:00
Nathan Franke
b9e1db7e03
Revert "Fix Directory Open Check"
This reverts commit 3f898f5207.
2020-07-28 13:54:13 -04:00
Rémi Verschelde
b40f3f9740 Style: Sync other changes from new fix_style.sh and clang_format.sh 2020-07-24 10:39:18 +02:00
clayjohn
2534e28918 Fix OpenGL error when generating radiance 2020-07-21 10:40:49 -07:00
clayjohn
e5cc4d4f87 Allow nearest neighbor lookup when using mipmaps 2020-07-19 14:44:42 -07:00
lawnjelly
2f983c82c8 GLES2 Batching - Fix FORCE_REPEAT not being set properly on npot hardware
On platforms that don't report support for GL_REPEAT for non power of two textures, the FORCE_REPEAT conditional is used instead. However for rect batches, the conditional was being set AFTER binding the shader, which meant it wasn't being activated.

This PR simply shifts setting the conditional to before the shader bind.
2020-07-15 09:28:16 +01:00
Johan Rastén
4c2d0d38fd Handle 16 bit PNG files in sRGB format
(cherry picked from commit e7e632cbed)
2020-07-10 08:51:21 +02:00
PouleyKetchoupp
5854bf4696 Fixed mesh data access errors in GLES2
1. Removed errors in mesh_surface_get_array as it's supported now
2. More accurate errors in mesh_surface_get_blend_shapes

(cherry picked from commit e19a3df98f)
2020-07-10 08:51:21 +02:00
Nathan Franke
3f898f5207 Fix Directory Open Check
(cherry picked from commit 09aeb7706b)
2020-07-08 09:01:57 +02:00
azagaya
d539627be2 Fixed white image in margins when using same image in scene 2020-07-06 15:54:45 -03:00
Rémi Verschelde
22863363a7
Merge pull request #37475 from azagaya/3.2
Fixed images in black margins
2020-07-03 13:09:22 +02:00
clayjohn
95f93b5f0f force depth prepass when using alpha prepass 2020-06-26 15:16:20 -07:00
Wavesonics
23d44223e6 Fix memory leaks in RasterizerStorageDummy::free
Lightmap capture data is now freed as well
free() now also properly returns true or false based on if something was actually freed.
2020-06-25 12:22:00 -07:00
lawnjelly
491059ca82 GLES2 Batching - Fix texture wrapping state bug.
For textures that were imported as wrapping, the legacy renderer relied on GL repeat state being set as a once off during load, and didn't alter the GL wrapping state at runtime.

Batching was setting wrapping according to the CANVAS_RECT_TILE flag on rects, however this reset GL wrapping to clamp after use, which was conflicting with later drawcalls that relied on the default wrapping being preserved.

In this PR we only set the wrapping in GL if the texture has not been imported with wrapping. This duplicates the logic in the legacy renderer and solves the state bug.
2020-06-23 08:34:17 +01:00
lawnjelly
a4bd66f854 GLES2 Batching - prevent baking on VERTEX use in a shader
Using the operator += in a shader is classified as an 'assign', and so is classified as a write rather than a read. This means that we need to prevent vertex baking on either a write or read (i.e. on usage), rather than just on reads.
2020-06-19 09:42:04 +01:00
Rémi Verschelde
e50e834197
Merge pull request #39559 from RandomShaper/fix_half_float_textures_3.2
Fix wrong internal format for half-float textures
2020-06-15 19:36:49 +02:00
Pedro J. Estébanez
c15e5af60e Fix wrong internal format for half-float textures 2020-06-15 13:03:13 +02:00
lawnjelly
94d127ccc3 GLES2 Batching - Fix try_join_item logic for lights
The old logic was incorrect, the first item with lights would prevent joining the next item in case it didn't have lights. Now the check is deferred so that items without lights check to see if the previous item had lights, and if so they prevent a join.
2020-06-14 08:22:41 +01:00