Commit graph

707 commits

Author SHA1 Message Date
lawnjelly
45b0b8bff8 GLES2 2d Batch rendering (across items)
2d rendering is currently bottlenecked by drawing primitives one at a time, limiting OpenGL efficiency. This PR batches primitives and renders in fewer drawcalls, resulting in significant performance improvements. This also speeds up text rendering.

This PR batches across canvas items as well as within items.

The code dynamically chooses between a vertex format with and without color, depending on the input data for a frame, in order to optimize throughput and maximize batch size. It also adds an option to use glScissor to reduce fillrate in light passes.
2020-04-04 17:13:58 +01:00
fhuya
30d738eda7 Add support for opengl external textures as defined by https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image_external.txt 2020-03-05 13:09:49 -08:00
Yuri Roubinsky
786b1cc7ff Fix shader crash if using multiple underscores in identifier names
(cherry picked from commit 15358b808b)
2020-02-06 13:02:07 +01:00
Eric Rybicki
3d4a2a09f6 Fix Softbody always spawns from world center [gles2]
Fixes #35373
2020-01-24 09:25:05 +01:00
Rémi Verschelde
37897dba80
Merge pull request #35406 from lawnjelly/ortho-shadow
Replace CameraMatrix::get_viewport_size with get_viewport_half_extents, shadow culling with ortho camera and other affected issues
2020-01-22 22:02:09 +01:00
lawnjelly
eaf8e5ce52 Change CameraMatrix::get_viewport_size to get_viewport_half_extents
Fixes #26637.
Fixes #19900.

The viewport_size returned by get_viewport_size was previously incorrect, being half the correct value. The function is renamed to get_viewport_half_extents, and now returns a Vector2.

Code which called this function has also been modified accordingly.

This PR also fixes shadow culling when using ortho cameras, because the correct input for CameraMatrix::set_orthogonal should be the full HEIGHT from get_viewport_half_extents, and not half the width.

It also fixes state.ubo_data.viewport_size in rasterizer_scene_gles3.cpp to be the width and the height of the viewport in pixels as stated in the documentation, rather than the current value which is half the viewport extents in worldspace, presumed to be a bug.
2020-01-22 18:22:00 +00:00
Rémi Verschelde
4faaf6089a Remove unused #if 0'ed code 2020-01-21 21:41:54 +01:00
Rémi Verschelde
669cd46495
Merge pull request #35215 from clayjohn/multimesh-error
Add multimesh format max for proper error checking
2020-01-16 23:06:20 +01:00
clayjohn
041fa57a88 Add multimesh format max for proper error checking 2020-01-16 13:31:17 -08:00
clayjohn
f3af81b059 Gracefully handle 3D textures in GLES2 2020-01-16 11:28:14 -08:00
Yuri Roubinsky
5098232ee6 Disabled array initialization, const array and arr.length in shaders 2020-01-16 11:46:11 +03:00
Rémi Verschelde
3af0400a32
Merge pull request #35176 from clayjohn/csg-crash
Fix light related crashes
2020-01-16 08:03:56 +01:00
Rémi Verschelde
318445c548
Merge pull request #35178 from clayjohn/GLES2-fix-lightmap
Fix array constructor for lightmaps
2020-01-16 07:47:49 +01:00
clayjohn
f1d0c391c7 fix light related crashes 2020-01-15 21:40:05 -08:00
clayjohn
910f8719a0 Fix array constructor for lightmaps 2020-01-15 17:41:46 -08:00
clayjohn
a345088433 Add background mode keep to GLES2 2020-01-15 15:59:00 -08:00
clayjohn
179193775b Fix light and multimesh crashes 2020-01-12 17:45:06 -08:00
Rémi Verschelde
815bf761a5 RasterizerCanvas: Use getornull to fetch light occluder polygon
Fixes #21286 when the occluder is not fully configured.
2020-01-08 11:29:15 +01:00
Hugo Locurcio
0cad2c0cd1
Add VisualServer methods to get the video adapter name and vendor
These methods can be used in scripts to retrieve the OpenGL
`GL_RENDERER` and `GL_VENDOR` strings (respectively).

This closes #28404.
2020-01-06 00:37:56 +01:00
Rémi Verschelde
94658de1ff
Merge pull request #34794 from clayjohn/GLES2-trimesh-crash
Fix crash on trimesh_create
2020-01-03 22:53:57 +01:00
clayjohn
906b5e7f3f Fix crash on trimesh_create by making surface->data available in non-tool builds 2020-01-03 13:39:40 -08:00
Rémi Verschelde
fa82664419
Merge pull request #34726 from nekomatata/polygon2d-antialiasing-fix
Fixed antialiasing option for Polygon2D with concave/hollow shapes
2020-01-03 14:17:05 +01:00
PouleyKetchoupp
1591677eb8 Fixed antialiasing option for Polygon2D
Some cases were not handled properly for Polygon2D after making changes in common code to fix Line2D antialiasing. Added an option for drawing polygons to differentiate the two use cases.

Fixes #34568
2020-01-01 11:40:14 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
clayjohn
28543667fd Always use 16 bit renderbuffer depth on WebGL 2019-12-19 20:41:32 -08:00
clayjohn
2a694a44cb fix shadow color in GLES2 by making sRGB 2019-12-15 10:27:31 -08:00
Rémi Verschelde
371de5132c
Merge pull request #34251 from bojidar-bg/32993-lightoccluder-flip
Flip cull mode when rendering flipped Light2D and LightOccluder2D
2019-12-12 07:33:19 +01:00
Rémi Verschelde
f676d7509e
Merge pull request #34262 from clayjohn/default_point_size
Add a default POINT_SIZE
2019-12-12 06:45:31 +01:00
Bojidar Marinov
eec7702711
Flip cull mode when rendering flipped Light2D and LightOccluder2D
Fixes #32993
2019-12-11 23:28:35 +02:00
clayjohn
676f647c74 Add a default POINT_SIZE 2019-12-10 23:08:20 -08:00
Rémi Verschelde
435cced7d8
Merge pull request #34238 from clayjohn/GLES2-use-renderbuffer-post-process
Use renderbuffer depth for post-process buffers when appropriate
2019-12-10 17:16:40 +01:00
clayjohn
fd31cebcbe Use renderbuffer depth for post-process buffers when appropriate 2019-12-09 22:19:11 -08:00
clayjohn
e8d652f160 Force 32 bit depth buffer for WebGL 2019-12-09 22:14:12 -08:00
Rémi Verschelde
fbfd56c247 GLES2: Fix uninitialized members in ShaderGLES2::Version
Fixes #34109.
2019-12-05 09:15:31 +01:00
Rémi Verschelde
10bae7c05b
Merge pull request #33857 from nekomatata/polygon-2d-antialiasing
Fixed antialiased option for Polygon2D
2019-12-03 07:51:16 +01:00
Rémi Verschelde
65e6efaa3b
Merge pull request #33836 from clayjohn/blinn-fix
Fix Specular Blinn function
2019-12-03 07:50:37 +01:00
PouleyKetchoupp
f5e81b894a Removed duplicated conditional in GLES2 2019-11-29 06:32:55 +01:00
PouleyKetchoupp
e6ebc43d72 Fixed antialiased option for Polygon2D / Line2D
Polygon2D:
The property wasn't used anymore after switching from canvas_item_add_polygon() to canvas_item_add_triangle_array() for drawing.

Line2D:
Added the same property as for Polygon2D & fixed smooth line drawing to use indices correctly.

Fixes #26823
2019-11-28 22:57:27 +01:00
George Marques
c51fe7f7cd
Use ANGLE multisample extensions for UWP 2019-11-26 13:55:19 -03:00
clayjohn
5ab3b61520 Restructure depth_internalformat code to work on mobile
This changes the code path so that `glRenderBufferStorage*` always uses
values appropriate for renderbuffers and `glTexImage2D` never uses an
internalformat meant for buffers.

Fixes #33825.
2019-11-23 18:08:19 -08:00
Rémi Verschelde
bb1d75f55e glTexImage2D: Fix confusion between format and internal format
The `format` parameter is similar to `internalFormat` but takes different
values, and especially only `GL_DEPTH_COMPONENT` for depth, without size
specifier.

Cf. https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml

Fixes a regression from #33278 and another occurrence.
2019-11-23 19:38:31 +01:00
clayjohn
334d41d7cc Fix Specular Blinn function 2019-11-22 22:03:26 -08:00
clayjohn
4d6737ec73 Fix bugs introduced by IBL fixes 2019-11-20 22:54:44 -08:00
Rémi Verschelde
083d088de3
Merge pull request #33583 from qarmin/fix_overflows_unitialized
Fix some overflows and unitialized variables
2019-11-20 21:31:12 +01:00
Rafał Mikrut
99d8626f4a Fix some overflows and unitialized variables 2019-11-20 16:22:16 +01:00
Rémi Verschelde
3be6e76f22
Merge pull request #33668 from clayjohn/Fix_environment_mapping_issues
Fix issues with environment mapping
2019-11-20 08:45:53 +01:00
clayjohn
cd40154890 Fix issues with environment mapping 2019-11-19 22:30:48 -08:00
Rémi Verschelde
7a0228fbba
Merge pull request #33720 from BastiaanOlij/fix_gles2_rgb8
Need to use GL_RGB8 and GL_RGBA8 as the internal format for GLES2
2019-11-19 11:12:03 +01:00
Bastiaan Olij
15cd81dc69 Need to use GL_RGB8 and GL_RGBA8 as the internal format for GLES2 2019-11-19 20:57:18 +11:00
Rémi Verschelde
6536105af2
Merge pull request #33527 from clayjohn/GLES2-bufferdata_optimization
Improve glBufferSubData usage where safe
2019-11-19 09:36:30 +01:00