Commit Graph

2406 Commits

Author SHA1 Message Date
bjorn 2fb393306c rm skybox args;
They used to always be necessary, now they are almost never necessary.
2019-06-29 21:01:03 -07:00
bjorn e3e930d6cc Set index buffer at the right time;
Just a small ordering issue with previous commit.
2019-06-29 20:39:01 -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 d3f08fd1f0 rm logo.png; 2019-06-29 18:28:20 -07:00
bjorn b2df3e9816 Update nogame screen;
- Slightly dim background color (may change).
- Use a shader for the logo (it's centered now, not quite 100% like the image).
- Adjust text optical weight (I hate it).
2019-06-29 18:27:55 -07:00
bjorn e82ba030a6 lovr.headset.getDisplayTime;
Returns the predicted display time, which is the estimated time at which
the photons of the next frame will hit the eyeballs of a person in the HMD.

This should be used instead of lovr.timer.getTime when used for rendering
something that is time-dependent.  Updating simulations, logic, or access
to high frequency times should still use lovr.timer.getTime.
2019-06-29 17:36:36 -07:00
bjorn 8faff22f38 Regenerate math.lua.h; 2019-06-28 22:07:31 -07:00
bjorn d87fc56b63 lovr.headset.getDisplayMask; 2019-06-28 00:13:45 -07:00
bjorn 79a19ef267 Fix M_PI redefinition;
We just set it in util now.
2019-06-28 00:13:45 -07:00
bjorn 4222be88b5 Use UBO for Camera matrices;
Ugh I don't like the "Camera" concept anymore, but I can't figure
out how to easily get rid of it.  Maybe wait till displays are a thing.
2019-06-27 22:17:50 -07:00
bjorn fa6c4a6b39 Organization; 2019-06-27 21:04:15 -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 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 111872904a Update LuaJIT; 2019-06-27 15:01:52 -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 5745ffa226 tup: Add LibOVR include path when CONFIG_OCULUS is set; 2019-06-25 18:19:36 -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