Commit Graph

2119 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 adf5e69ea1 oculus: Remove unused variable; 2019-06-26 14:51:32 -07:00
mcc fc90a03584 Fix MSVC-specific warnings 2019-06-25 19:16:48 -07:00
mcc 430fbc27d5 ovrHand -> ovrHandType in oculus.c. We don't understand how this worked before but it fixes the oculus-windows build. 2019-06-25 19:16:48 -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 010bbff519 openvr: Fix stereo Canvas dimensions mismatch;
(The width is automatically doubled when stereo now)
2019-06-25 19:15:38 -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 7e65116add Fix oculus backend; 2019-06-25 18:16:54 -07:00
bjorn a3d5371d01 rm lib/vec/vec from oculus.c; 2019-06-25 18:07:56 -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 b17d01e4aa Don't return NULL from mat4_invert; 2019-06-22 17:25:48 -07:00
bjorn 8d2f005bf3 Add stdlib.h to oculus_mobile; 2019-06-21 11:28:40 -07:00
bjorn 9f3638b018 TextureData:paste; 2019-06-20 23:36:18 -07:00
bjorn 7ebee200ea rm strdup;
It isn't part of C, causing compiler errors on some platforms.
2019-06-20 22:21:31 -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 807c519397 Fix typo; 2019-06-20 21:36:07 -07:00
bjorn b6d65922af Standard shader: spherical harmonics irradiance; 2019-06-20 21:17:32 -07:00
bjorn 286cb711e4 Standard shader: emissive; 2019-06-20 18:22:49 -07:00
bjorn a9241e781b Standard shader: emissive; 2019-06-20 18:20:07 -07:00
bjorn 179071023f Standard shader: diffuse, specular, normal mapping;
No shader flags yet.  Still need occlusion, emissive, configurable
lighting, IBL.
2019-06-20 17:46:22 -07:00
bjorn b54f68a3d5 glTF: Support Textures with missing images and samplers; 2019-06-20 17:44:30 -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 c10851d726 Fix tostring; 2019-06-20 13:47:43 -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 6b2d06e766 Add lovrPlatformOpenConsole; 2019-06-16 18:55:43 -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 f8f6d98df4 Use better default for identity quat; 2019-06-14 15:04:17 -07:00
bjorn 9e42fe295a math.lua: Fix vec3:sub; 2019-06-14 13:30:07 -07:00
bjorn 9c322495fa Fix bug when reading mat4s; 2019-06-14 13:22:13 -07:00
bjorn 2f3c23ed7e Ensure getHands uses 4-element vec3; 2019-06-14 13:04:10 -07:00
bjorn 79083c7df1 Fix warnings on newer versions of gcc; 2019-06-11 19:57:20 -07:00
bjorn 909ee1ad79 Use highp in vertex shaders on GLES; 2019-06-10 08:12:36 -07:00