Commit graph

565 commits

Author SHA1 Message Date
Rémi Verschelde 74e224f2c7 GLES2: Add comments around EXT_shader_texture_lod check
To avoid reintroducing bugs as I did in #26928 and #26932.

texture2DLodEXT and textureCubeLodEXT are only for the fragment shader with
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_shader_texture_lod.txt
In the vertex shader, texture2DLod and textureCubeLod are built-in.
2019-03-11 23:18:21 +01:00
Rémi Verschelde 764671d2d0 Revert "GLES2: Ensure extension checks for texture2DLod"
This reverts commit f5f565e3e4.
2019-03-11 23:12:49 +01:00
Rémi Verschelde 4cdb2d0502 Revert "GLES2: Fix regression on texture2DLod extension checks"
This reverts commit 8c2d38152f.
2019-03-11 23:12:39 +01:00
Rémi Verschelde 8c2d38152f GLES2: Fix regression on texture2DLod extension checks
These can't be done after any non-preprocessor token.
2019-03-11 21:59:20 +01:00
Rémi Verschelde bc3c6338cf
Merge pull request #26928 from akien-mga/gles2-texture2DLod-ext-check
GLES2: Ensure extension checks for texture2DLod
2019-03-11 20:51:36 +01:00
Juan Linietsky d9235be54b Enable seamless cubemap only if extension is present. 2019-03-11 16:49:04 -03:00
Rémi Verschelde f5f565e3e4 GLES2: Ensure extension checks for texture2DLod
In canvas.glsl and scene.glsl, we were using texel2DFetch from stdlib.glsl,
which uses texture2DLod. In both cases, the stdlib.glsl include came before
the define of texture2DLod.

Might fix issues for drivers that don't support GL_EXT_shader_texture_lod.
2019-03-11 19:34:31 +01:00
clayjohn 13eee31461 increase size of radiance map in gles2 2019-03-10 22:08:08 -07:00
clayjohn 63bb6808e6 gles2 reallocate texture when transparent is set 2019-03-09 10:56:51 -08:00
Juan Linietsky 7141c73ae8 Use glCopyTexSubImage2D instead of glCopyTexImage2D, should be safer and faster.
May be a solution to #26500
2019-03-07 00:14:13 -03:00
Rémi Verschelde b753223ac2
Merge pull request #26567 from clayjohn/pixel_snap_artifact
Fixed pixel snap precision artifact
2019-03-04 16:58:08 +01:00
clayjohn b804c491b7 fixed pixel snap precision artifact 2019-03-04 07:18:02 -08:00
Rémi Verschelde b811207406 More style cleanup... 2019-03-04 10:11:29 +01:00
Juan Linietsky 34dd772054 Properly redraw if something animated is visible 2019-03-03 13:43:54 -03:00
Juan Linietsky 2f32a75d2e Skeletons can now choose between using local or world coords for processing, fixes #26468 2019-03-03 12:24:00 -03:00
Rémi Verschelde e930fb9a6e Fix typo in 7bad170
And cleanup.
2019-03-02 00:45:01 +01:00
Juan Linietsky 7bad1706c2 -Fix prepass state not being reset, closes #26348
-Send zero values for shader if no default exists
2019-03-01 19:28:24 -03:00
Juan Linietsky 834a984b08 Fixed RGTC (and other compressed) texture supports in GLES2. Fixes #26414 an probably others. 2019-03-01 18:18:55 -03:00
Juan Linietsky ff34cd58ff Skeleton was not providing prober AABB in GLES2, fixed. 2019-03-01 17:41:15 -03:00
Juan Linietsky 51b80f6857 Fixed some crashers, closes #26393 2019-03-01 17:24:57 -03:00
Juan Linietsky 8a9119ad7f Fix non initialized variable. 2019-03-01 16:45:38 -03:00
Rémi Verschelde 3ece0004fa Remove unused include from previous commit 2019-03-01 20:12:35 +01:00
Juan Linietsky 3f681b0681 Clean up blend shape support in GLES2 and GLES3. 2019-03-01 16:01:44 -03:00
Juan Linietsky 8799f69b2c Strive for maximum compatibility in GLES2 regarding depth buffers. 2019-03-01 11:21:21 -03:00
Juan Linietsky 5efd693384 Massive improvement to GLES2 performance, rewrote most ShaderGLES2 class.
This fixes #26337
2019-02-27 23:49:34 -03:00
Juan Linietsky 057d3e874d Detect for 24 bits oes support on GLES2, closes #26344 2019-02-27 18:57:33 -03:00
Rémi Verschelde 426a6fdc17
Merge pull request #26134 from marxin/fix-Wsign-compare
Fix -Wsign-compare warnings.
2019-02-27 09:22:47 +01:00
Rémi Verschelde 0ba75c195e Fix GCC 5 build after #26331 and cleanup style
Also cleanup after 01a3dd3.
2019-02-27 09:01:24 +01:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
Juan Linietsky 01a3dd389c Remove references to OES24, which is incompatible with many devices. 2019-02-26 19:45:15 -03:00
Juan Linietsky 5eeb06ffd1 -Remove harcoded opengl extension testing from OS, ask rasterizer instead.
-Fixed a bug where etc textures were imported broken
2019-02-26 11:58:47 -03:00
Rémi Verschelde e47b4bdc3d
Merge pull request #26286 from kaadmy/gles2_ortho_shadow
Fix orthographic shadow color when using GLES2
2019-02-26 08:50:42 +01:00
Juan Linietsky a32b26dfa2 Several fixes to make GLES2 on HTML5 work much better.
Changed math class error reporting to be a bit less paranoid.
2019-02-25 21:47:29 -03:00
KaadmY e1a34d0728 Fix orthographic shadow color when using GLES2 2019-02-25 13:57:23 -08:00
Juan Linietsky 31656301b2 Removed debug function. 2019-02-24 23:12:27 -03:00
Juan Linietsky 74d0ed2236 Many separate fixes to ensure non power of 2 textures work on GLES2, closes #25897 and many others 2019-02-24 22:36:53 -03:00
Hein-Pieter van Braam a83e77fded Explicitly use floating point numbers in the our shaders
We need to be explicit about using floating point numbers in our shaders
for compatibility with mobile GLES drivers.
2019-02-24 23:35:10 +00:00
Juan Linietsky ab8f3d7842 Fixed issue with buffers being wrongly cleared, closes #25484 2019-02-24 00:33:22 -03:00
Juan Linietsky d79c8d7655 Fix vertex lighting in GLES2, closes #25365 2019-02-23 19:53:04 -03:00
Juan Linietsky 16e67388a2 Properly update materials when adding surface, fixes #23790 2019-02-22 16:27:00 -03:00
Rémi Verschelde 513b7ddab6 Remove unused variable after aab8f44 2019-02-22 16:51:16 +01:00
Juan Linietsky aab8f443f9 -Support DEPTH_TEXTURE in GLES2, fixes #25106
-Fix use of transparent framebuffers in GLES2
-Fix use of ambient color clearing in GLES2 when no environment exists.
2019-02-22 11:35:39 -03:00
Rémi Verschelde c4b736d7ad Fix code style issues 2019-02-22 09:52:27 +01:00
Juan Linietsky 5784caae73 Make alpha 1.0 when using texscreen, fixes #25850 2019-02-21 19:43:34 -03:00
JFonS 32e7641667 Revert back to ignoring LIGHT_VEC for 2D shadows 2019-02-21 12:16:10 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde 19f79d04fb
Merge pull request #26005 from clayjohn/gles2_shadow_color
Added shadow_color property to gles2
2019-02-18 13:48:17 +01:00
clayjohn 9b0326d2f3 added shadow_color property to gles2 2019-02-17 23:57:57 -08:00
Rémi Verschelde 5fc86026ca Fix typos with codespell
Using codespell 1.14.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
doubleclick
lod
nd
numer
que
te
unselect
EOF
$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-02-13 09:23:29 +01:00
Rémi Verschelde 55ca2a7c88
Merge pull request #25821 from akien-mga/sync-class-and-filenames
Ensure classes match their header filename
2019-02-13 08:49:39 +01:00
Rémi Verschelde 5aff990354 Fix infinite recursion in GLES2 _copy_texscreen
Bug introduced in 9430e68cf3,
likely a typo.
2019-02-12 23:38:33 +01:00
Juan Linietsky 9430e68cf3 Support SCREEN_TEXTURE in GLES2, fixes #25405 2019-02-12 18:49:57 -03:00
Juan Linietsky b8319e7c60 Ability to vflip viewports in GLES2, fixes #24555
Also culling was reversed somehow.
2019-02-12 15:56:39 -03:00
Juan Linietsky 0d0d074c4d Use UVs with the nvidia rendering hack, fixes #24563 2019-02-12 15:31:10 -03:00
Juan Linietsky 4af8009b9d Fix fog in GLES2 by using epic hack, closes #25410 2019-02-12 14:35:16 -03:00
Juan Linietsky 8fd6a02d3e Missing canvas end left mask turned on, fixes #25666 2019-02-12 09:55:22 -03:00
Rémi Verschelde b7cc2bb1e2 Core: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `core/dvector.h` -> `pool_vector.h`
- `core/io/resource_import.h` -> `resource_importer.h`
- `core/sort.h` -> `sort_array.h`
- `core/string_db.h` -> `string_name.h`

Dropped:
- `core/allocators.h`
- `core/os/shell.h`
- `core/variant_construct_string.cpp`
2019-02-12 13:34:25 +01:00
Rémi Verschelde 13c50e8aa5
Merge pull request #25481 from hpvb/fix-ubsan-asan-reports
Fix many asan and ubsan reported issues
2019-02-12 12:21:01 +01:00
Rémi Verschelde 6e43bd4e85
Merge pull request #25623 from clayjohn/multimesh_color_bug
[GLES2] Initialize color buffer to white in gles2 multimesh
2019-02-12 11:31:45 +01:00
Rémi Verschelde 204f9083f4
Merge pull request #25682 from JFonS/fix_light_canvas_gles2
Fix canvas light shaders on GLES2
2019-02-12 11:27:21 +01:00
Rémi Verschelde 48bc7aedaa
Merge pull request #25779 from JFonS/fix_25581
Make LIGHT_VEC affect 2D shadows again
2019-02-12 11:24:27 +01:00
Juan Linietsky 7713ec8637
Merge pull request #25134 from staddy/master
Check for null pointer in RasterizerSceneGLES2::render_shadow
2019-02-12 07:04:12 -03:00
JFonS 076a342a4e Make LIGHT_VEC affect 2D shadows again 2019-02-10 21:14:32 +01:00
JFonS 5186d4f3ad Fix canvas light shaders on GLES2 2019-02-07 15:58:36 +01:00
clayjohn f752aaf970 initialize color buffer to white in gles2 multimesh 2019-02-04 20:08:35 -08:00
Hein-Pieter van Braam d308eb091a Fix many asan and ubsan reported issues
This allows most demos to run without any ubsan or asan errors. There
are still some things in thirdpart/ and some things in AudioServer that
needs a look but this fixes a lot of issues. This should help debug less
obvious issues, hopefully.

This fixes #25217 and fixes #25218
2019-01-30 06:43:56 +01:00
Rémi Verschelde b77b536582 Cleanup and identify ShaderCompilerGLES[23] differences 2019-01-28 19:28:00 +01:00
Rémi Verschelde 1148a33b20 GLES2: Define LIGHT Spatial shader builtin
Fixes #25421.
2019-01-28 17:27:20 +01:00
Juan Linietsky 2e5ede7a4e Properly discard fragments during depth prepass opaque pass, fixes #23321 2019-01-27 20:20:07 -03:00
Juan Linietsky 0c60d4c682 Properly get proxy texture size for canvas light, fixes #17067 2019-01-27 16:57:05 -03:00
Juan Linietsky 953cd03ea6 Use transparent framebuffer only when set to transparent, closes #21827 2019-01-27 15:47:17 -03:00
muiroc d1e399a971 fix s3tc support detection for webgl 2019-01-26 22:25:03 +01:00
Juan Linietsky 18c3ed245a Further fixes to avoid memory corruption, closes #25336 2019-01-26 10:47:04 -03:00
Juan Linietsky 973b68f396 Properly dispose of custom shaders, closes #19300 2019-01-25 19:28:27 -03:00
Juan Linietsky 5b5db08a51 Fix depth prepass in GLES2, closes #23321 2019-01-25 09:41:25 -03:00
Juan Linietsky b32298a660 Ensure WebGL uses highp by default, and fix some wrong mediump usages. Fixes #22962. 2019-01-24 18:58:42 -03:00
Juan Linietsky fb7c526ec4 Fix crash with cube shadows in gles2, closes #22635 2019-01-24 17:51:49 -03:00
Juan Linietsky 7fa41f17a6 Makes screen texture work in GLES2 (2D for now), fixes #23604 2019-01-24 17:00:33 -03:00
Juan Linietsky 2d57ec2460 Fix problem with texture2Dlod, closes #25263 2019-01-23 17:06:37 -03:00
Rémi Verschelde 2a45b298c1 Remove unused method in RasterizerStorageGLES2
Added in 4f4e46edd5 but not used in the end.
2019-01-23 10:31:05 +01:00
Juan Linietsky 4f4e46edd5 Implement unpacking for compressed vertex formats on GLES2 when not supported, fixes #22957 2019-01-22 21:57:09 -03:00
Juan Linietsky 4333a68ca0 Do not use shadow cubemaps if depth write is not supported to avoid errors, closes #25219 2019-01-22 11:07:26 -03:00
Juan Linietsky 46af4b0a4b Changes to GLES2 renderer to not use cube shadows if not available, fixes #25132 2019-01-22 10:05:23 -03:00
santouits 3c1cd2873b WebGL1 some changes
glRenderBufferStorage doesn't accept the _DEPTH_COMPONENT24_OES so I changed it to GL_DEPTH_COMPONENT16
https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/renderbufferStorage
https://www.khronos.org/registry/webgl/extensions/rejected/OES_depth24/

Enabled ext_shader_texture_lod extension. I guess it does the same like the GL_ARB_shader_texture_lod extension, but in WebGL1
https://www.khronos.org/registry/webgl/extensions/EXT_shader_texture_lod/

And last WebGL1 doesn't allow indexes not constant, so I changed it into a loop reading this:
https://stackoverflow.com/questions/19529690/index-expression-must-be-constant-webgl-glsl-error
2019-01-22 13:40:28 +02:00
santouits e7e9a7cc6c webgl1 doesn't like backslashes in #define
According to
https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf
, backslashes aren't necessary supported as line continuation characters
in preprocessor directives
2019-01-21 21:41:39 +02:00
Stanislav dc7d9f8868 Check for null pointer in RasterizerSceneGLES2::render_shadow
Fixes #25131
2019-01-19 16:48:43 +03:00
Juan Linietsky 682fdf0f74 Use 16 bit indices on phones that dont support 32, fixes #19797 2019-01-18 17:30:12 -03:00
RedMser a285a1cfdf Fix shader compile error line numbers starting at 0. 2019-01-17 19:25:08 +01:00
Juan Linietsky 7478f468b2 Fixes to 2D lights, closes #24750 2019-01-17 10:40:36 -03:00
Juan Linietsky ffcb5cd18c Ensure texture hints are obeyed, fixes #24875 2019-01-16 00:37:00 -03:00
Rémi Verschelde 72f501de13 GLES2: Fix typo in project setting
It used a different name than the equivalent GLES3 parameter.
2019-01-15 13:26:54 +01:00
Juan Linietsky ee3eadf345 Implement black margins in GLES2, which was missing, fixes #24556 2019-01-14 19:00:36 -03:00
Rémi Verschelde 02ffc59270 GLES2: Make Nvidia flicker workaround opt-in
It has a big impact on 2D and text rendering performance (cf. #24466)
so the solution seems worse than the bug it aims to work around.

It's now opt-in via "rendering/quality/2d/gles2_use_nvidia_rect_flicker_workaround"
for those who need it and have a simple enough game for the performance
drop not to be an issue.

Fixes #24466.
2019-01-14 19:02:07 +01:00
Juan Linietsky b3dc02b5df Was not properly re-setting light uniforms, fixes #24976 2019-01-14 12:04:26 -03:00
Juan Linietsky 6d8083ea65 Do not use the workaround for desktop nvidia on mobile and html5. 2019-01-14 11:24:00 -03:00
Rémi Verschelde 1185f4c4ac GLES2: Clarify why we exclude debug code on iOS
Supersedes and closes #24873.
2019-01-11 20:04:13 +01:00
Juan Linietsky a3a537c2cf Fix background color rendering on GLES2 (linear should not be used) 2019-01-07 10:52:24 -03:00
Daeil Kim ecf520b70e Change blend equation for canvasitems 2019-01-06 00:57:52 +09:00
Rémi Verschelde 1504c96112
Merge pull request #24539 from BastiaanOlij/override_gl_position
Override GL_position
2019-01-04 15:40:05 +01:00
Marcin Zawiejski 4e73274837
Fix negative size rectangle drawing
Fixes rectangle being drawn as it was a non-negative size in case it actually is. This can be observed e.g. when drawing a negative size selection rectangle (i.e. press mouse button and move cursor up and left).
2019-01-02 14:47:28 +01:00