Commit graph

64 commits

Author SHA1 Message Date
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
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
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
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
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
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