Commit Graph

44 Commits

Author SHA1 Message Date
bjorn 370124c88d Batching cleanup;
- Rename drawMode to topology in some places.
- Batch uses DrawCommand internally to simplify stuff.
- Do less work while flushing.
- Store global head/tail cursors instead of unused per-batch cursors.
2019-06-27 20:58:42 -07:00
bjorn 779949964f More small batching changes;
- Reduce number of batches to 4.  Yeah it's arbitrary, will monitor.
- Just use memcmp for BatchParams.  Since we're using designated initializers,
  we aren't running into issues with memcmp+struct padding bits, and in the
  event it does lead to false positives on some platforms, at worst we'll just
  experience a harmless reduction in batching efficiency.
2019-06-27 19:05:54 -07:00
bjorn 6da17b0a91 Optimize gamma correction;
Currently, we gamma correct colors on every clear and every draw.
It's taking a lot of time.  Instead, we'll gamma correct colors
when they're changed using lovr.graphics.setColor/setBackgroundColor.
2019-06-27 15:41:57 -07:00
bjorn 7e067da8e7 Add defaultCanvas;
Having a normal Canvas object that represents the backbuffer reduces
some indirection where we have to last-minute check if a Canvas is
set.  It also means that all of the draw-related info that was _sometimes_
on the Canvas is now _always_ on the Canvas, which reduces the amount
of redundant information we need to provide for a draw call.

There may be some issues related to changing the width/height/stereo
of the default Canvas.
2019-06-27 15:36:51 -07:00
bjorn 26e474bcfc Simplify Mesh handling;
Removes some indirection from flush (I guess moves it into batch,
not sure what's better).
2019-06-27 14:14:31 -07:00
bjorn 551dea8c86 Adjust includes; 2019-06-27 13:44:09 -07:00
bjorn b8e63adcbf graphics: Cleanup;
Make batching structs and defines private.
2019-06-27 13:38:38 -07:00
bjorn fe21de403b lovrGraphicsDrawMesh; 2019-06-27 13:35:43 -07:00
bjorn b3080ae5d9 rm macos instancing hack;
I haven't been able to see adverse affects from it anymore.  Can
always put it back if it resurfaces.
2019-06-27 13:27:43 -07:00
bjorn 39b0d2d754 graphics: Minor refactoring; 2019-06-27 13:26:39 -07:00
bjorn 297208c205 Minor cleanup to stream buffer code; 2019-06-27 13:01:04 -07:00
bjorn 052990aa47 Make some graphics structs private; 2019-06-27 01:48:35 -07:00
bjorn 2baa8d03ee Make singlepass detection more readable; 2019-06-26 21:47:22 -07:00
bjorn 6b2de4a0a1 Temporary implementation for persistent buffer discard;
Should fix potential crashes with persistent buffers.
2019-06-25 19:16:08 -07:00
bjorn 312a7617c3 Fix typo in shader; 2019-06-25 19:15:11 -07:00
bjorn 09b6f74acf Native textures: initialize mipmapCount; 2019-06-25 18:59:31 -07:00
bjorn 749774e2fc Native texture depth must be explicitly specified;
To fix validation errors when attaching them to Canvases.
2019-06-25 18:57:18 -07:00
bjorn 928ccee5f1 Multiview; 2019-06-25 01:21:59 -07:00
bjorn a691192af9 lovrBufferDiscard; 2019-06-25 01:21:59 -07:00
bjorn 5cd93b66c6 rm fence syncs;
They are too buggy and are not as efficient as orphaning.
2019-06-24 19:17:55 -07:00
bjorn 879c789a08 Polyfill M_PI;
It technically isn't part of C, which is causing problems on some systems.
2019-06-20 21:43:40 -07:00
bjorn 5881bdd5b1 Fix gpu timer array; 2019-06-20 14:44:28 -07:00
bjorn 4611b1c9a3 Add no-op standard shader; 2019-06-20 14:21:35 -07:00
bjorn 612f699aa4 Rename default shader to unlit; 2019-06-20 14:09:55 -07:00
bjorn d856f6d592 opengl: Create default texture at startup;
More predictable performance, fixes an obscure bug.
2019-06-20 11:35:46 -07:00
bjorn eb1e257209 Add new array implementation; Upgrade filesystem;
Filesystem:

- Uses streaming file IO.
- Uses less memory when requiring files.
- Simplifies its require path implementation.
2019-06-16 13:30:30 -07:00
bjorn 909ee1ad79 Use highp in vertex shaders on GLES; 2019-06-10 08:12:36 -07:00
bjorn 98f4365474 Add astc and dxt GraphicsFeatures; 2019-06-09 23:59:57 -07:00
bjorn b0a7d5c122 ASTC textures;
I like typing numbers.
2019-06-09 09:11:29 -07:00
bjorn d1f754d5f9 Fix Model memory leaks; 2019-06-03 08:13:42 -07:00
bjorn 06c6b172de vec3 has 4 elements; 2019-06-03 07:20:03 -07:00
bjorn 22fe333150 Update refcounting (again);
- Ref struct only stores refcount now and is more general.
- Proxy stores a hash of its type name instead of an enum.
- Variants store additional information instead of using a vtable.
- Remove the concept of superclasses from the API.
- Clean up some miscellaneous includes.
2019-06-02 01:02:26 -07:00
bjorn d2bff7d239 lovr.graphics.tick and tock;
Initial support for GPU timer queries.
2019-06-01 17:29:53 -07:00
bjorn 29b2420dea Work around macOS flicker bug;
At this point I don't know if maybe I'm just using UBOs wrong but whatever.
2019-05-27 19:05:47 -07:00
bjorn 56f4c812ce Small intermediate fix for models without animators; 2019-05-26 21:12:07 -07:00
bjorn 3bf08f0ca3 Add the ability to create default shaders;
lovr.graphics.newShader('font')
2019-05-22 18:00:02 -07:00
bjorn db5076a100 Rename SHADER_DEFAULT to SHADER_UNLIT; 2019-05-22 16:34:57 -07:00
bjorn 698466d19c Add missing include in animator.h; 2019-05-21 00:32:20 -07:00
bjorn 4cc154fdfa More number conversions; 2019-05-20 20:35:07 -07:00
bjorn df6b7fc96a Ref is mostly private now;
It's really nice how objects don't need to care about how they're
allocated/managed now.
2019-05-20 15:09:06 -07:00
bjorn 57aad490ae Start sized int conversions; 2019-05-20 14:34:03 -07:00
bjorn 67b76e08c2 Details; 2019-05-20 04:15:24 -07:00
bjorn 7645f4c014 Add core folder; 2019-05-20 02:47:33 -07:00
bjorn a17f10e273 Add modules folder; 2019-05-19 00:38:35 -07:00