Commit Graph

127 Commits

Author SHA1 Message Date
bjorn f208a5e067 Fix array initialization;
Because the new arr.h contains an array on the stack, we can't
initialize it and then copy it, or the pointer to the stack array
will be pointing to the wrong thing, causing incorrect behavior.
2019-07-09 09:06:11 -07:00
bjorn 57f97056da Use I4ui instead of I1ui for lovrDrawID constant value;
glVertexAttribI1ui isn't supported on GLES for some reason.
2019-07-02 12:51:36 -07:00
bjorn 6256acfc6d Ahhh fix everything;
- If you have an instanced batch, it will use the instanced mesh.  That
  has a drawID attribute that uses the identity buffer, which has a vertex
  divisor.  BUT if you only have one instance, then we won't emit an
  instanced draw, and the use of a divisor'd attribute w/ a non-instanced
  draw is causing mega problems on macOS.
- This also fixes observed macOS bugs like:
  - Needing to have a small UBO
  - Flickering at startup
  - Flicker when writing to the last byte of a UBO
  - etc.
- Also make the generic attribute value for lovrDrawID more correct (scalar instead of vector).
2019-06-29 20:24:36 -07:00
bjorn afe4d8c0e3 Fix GL error with buffer unmapping;
This doesn't seem to fix any of the macOS rendering bugs though...
2019-06-29 20:08:31 -07:00
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 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 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 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 5881bdd5b1 Fix gpu timer array; 2019-06-20 14:44:28 -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 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 4cc154fdfa More number conversions; 2019-05-20 20:35:07 -07:00
bjorn 57aad490ae Start sized int conversions; 2019-05-20 14:34:03 -07:00
bjorn a17f10e273 Add modules folder; 2019-05-19 00:38:35 -07:00
Renamed from src/graphics/opengl.c (Browse further)