Commit Graph

3656 Commits

Author SHA1 Message Date
bjorn 143b0ba664 Fix DefaultShader initialization; 2022-08-12 18:26:47 -07:00
bjorn 8233c202ba Fix Pass:points / Pass:lines with vectors; 2022-08-12 18:11:45 -07:00
bjorn 0be94e0f1a Set default material normalScale to 1; 2022-08-12 17:44:29 -07:00
bjorn 3b33f4917e Fix vertex format binding; 2022-08-12 17:43:41 -07:00
bjorn 7e5221492d rm pointSize from Material;
It's weird, and about as inconvenient as just putting it in the shader.
2022-08-09 19:54:54 -07:00
bjorn 63a327c0b2 Add getLighting builtin function to shaders; 2022-08-09 19:49:47 -07:00
bjorn 31d49fe8c6 When graphics module is destroyed, stop XR session;
Terrible, but better.
2022-08-08 23:27:35 -07:00
bjorn 3c71828afa Revert "Change the way modules are destroyed;"
This reverts commit 019814e2c1.
2022-08-08 23:16:34 -07:00
bjorn 0436a5deae Rework automipmapping;
The sync was totally wrong here.  It's a bit better now.  However there
are some general sync issues that need to be fixed.  Basically a Pass
that does reads and writes or multiple writes doesn't work properly, for
various reasons.  I think sync needs to be split into 2 phases -- first
process all the reads and merge barrier bits into the barrier of the
last writer, then process all the writes and set 'final' resource state
for stuff in the pass.  Due to branch prediction it may be better to
have 2 separate lists -- one for reads and one for writes.  And I'm not
100% sure on how to reconcile a Pass that is doing reads and writes to
the same resource yet, still thinking about it.
2022-08-08 21:26:07 -07:00
bjorn bf2f5a398c Fix defaultMaterial; 2022-08-08 20:40:57 -07:00
bjorn f310a7ad04 gpu_bind_bundles;
Now you can bind multiple bundles at once.
2022-08-08 20:36:22 -07:00
bjorn d88a7bdc8b Forbid Pass appearing twice in same submit; 2022-08-07 22:29:26 -07:00
bjorn 2ebb4bb415 Improve OpenXR layout transitions a bit; 2022-08-06 23:25:49 -07:00
bjorn 8aa1cf91b2 Submit depth buffer to OpenXR; 2022-08-06 22:52:18 -07:00
bjorn eba71d5921 Fix more warnings; 2022-08-06 19:23:41 -07:00
bjorn a2ee485d41 Fix most windows warnings in graphics code;
Co-authored-by: mcc <andi.m.mcclure@gmail.com>
2022-08-06 18:05:30 -07:00
bjorn 7efd19c45c Add uniform buffer for global constants;
So far it has resolution and timestamp.

Broke the nogame shader, need to recompile.
2022-08-06 13:37:27 -07:00
bjorn 642388709b Shader helper improvements; 2022-08-06 13:06:42 -07:00
bjorn c41188c4b4 Merge branch 'master' into dev 2022-08-06 11:08:02 -07:00
bjorn dd4fa5c382 Synchronize Material textures; 2022-08-06 00:50:25 -07:00
bjorn 6011e61d52 Fix lovr.headset.newModel and lovr.headset.animate; 2022-08-06 00:29:46 -07:00
bjorn ed59eeb11c gpu: don't use VkPipelineCacheHeaderVersionOne;
Doesn't exist in NDK...
2022-08-05 23:41:25 -07:00
bjorn 73f61b35b3 Fix background color space; 2022-08-05 22:14:09 -07:00
bjorn 2a3215fa05 Make indirect draws a :mesh variant; 2022-08-05 22:11:43 -07:00
bjorn fcbeccdfb1 Fix background colors; 2022-08-05 21:05:02 -07:00
bjorn cb59f64a7b Adjust desktop fov; 2022-08-05 19:18:41 -07:00
bjorn a23f0351cc WIP OpenXR layout transitions; 2022-08-05 18:36:51 -07:00
bjorn 7ceefcf4c2 Fix mat4_getFov; 2022-08-04 21:55:22 -07:00
bjorn 019814e2c1 Change the way modules are destroyed;
They are now destroyed explicitly after tearing down the Lua state
instead of relying on finalizers.  It's definitely annoying to make it
coordinated in a centralized way like this instead of being distributed,
but there's not really any reliabel way to ensure that graphics objects
are destroyed before the graphics module/device is destroyed, which is a
problem.
2022-08-04 21:44:34 -07:00
bjorn aa4fce2842 Rename luax_atexit internals; 2022-08-04 21:33:37 -07:00
bjorn 16860e8ef5 rm stats;
These stats don't make sense right now.
2022-08-04 07:59:07 -07:00
bjorn 7c7f8ed907 Free ModelData metadata; 2022-08-04 00:31:39 -07:00
bjorn eac3299bd0 ModelData:getMetadata; 2022-08-04 00:27:20 -07:00
bjorn a6d843c642 Fix desktop driver; 2022-08-04 00:12:41 -07:00
bjorn acd87a5e5c lovr.graphics.present;
It's nice to have an explicit action for presentation.
2022-08-04 00:06:54 -07:00
bjorn 9b19a1cd47 Fix lovr.headset.animate; 2022-08-02 23:06:49 -07:00
bjorn d42cac288f Use anonymous union for ModelNode transform; 2022-08-02 23:03:52 -07:00
bjorn 10f2b727b6 glslang: auto map locations and binding numbers; 2022-08-02 22:06:44 -07:00
bjorn 89312c1c4b Add on-disk shader cache;
Set t.graphics.shadercache to true (the default) and lovr will
read/write a shader cache file from/to disk.
2022-08-02 22:06:44 -07:00
bjorn 4ee092e81b Make Pass a regular object;
It uses newPass instead of getPass.  Temporary objects had lifetime
issues that were nearly impossible to solve.  And normal objects are
easier to understand because they behave like all other LÖVR objects.

However, Pass commands are not retained from frame to frame.  Pass
objects must be re-recorded before every submit, and must be reset
before being recorded again.

Pass objects now provide a natural place for render-pass-related info
like clears and texture handles.  They also allow more information to be
precomputed which should reduce overhead a bit.

It is now possible to request a stencil buffer and antialiasing on the
window and headset textures, via conf.lua.

lovr.graphics.setBackground should instead set the clear color on the
window pass.  Though we're still going to try to do spherical harmonics
in some capacity.

There are still major issues with OpenXR that are going to be ironed
out, and the desktop driver hasn't been converted over to the new
headset Pass system yet.  So lovr.headset integration is a bit WIP.
2022-08-02 22:06:44 -07:00
bjorn 289f08b0df Fix OpenXR texture layer count; 2022-08-01 22:43:44 -07:00
bjorn d81d906f58 Fix; 2022-08-01 22:35:20 -07:00
bjorn 8952476e35 Adjust; 2022-08-01 22:14:49 -07:00
Josip Miskovic 31ca502034 Add isKeyDown 2022-08-01 22:13:30 -07:00
bjorn c0dfb414d6 Per-stage default shaders; 2022-08-01 22:10:06 -07:00
bjorn ac104e6f41 WIP stereo blit shader; 2022-07-31 13:26:35 -07:00
bjorn c4ff7cca39 Passes track their readbacks;
There are some issues with immediately tracking readbacks in the global
linked list of pending readbacks:

- The Pass might not get submitted, in which case the readback will be
  "dangling" and never complete (or it will erroneously think it's
  completed but its buffer will contain garbage data).
- Thread safety issues of modifying a global data structure from a Pass.

Instead, Pass will locally track the readbacks it performs, and only at
submit time will those readbacks get added to the global list.

(There is a little bit of refcounting mistakes now, those will get
cleaned up).
2022-07-31 13:02:41 -07:00
bjorn 50f596bd34 Default shaders use lovrmain; 2022-07-31 11:18:15 -07:00
bjorn 2414f5f269 Material uvShift can be a single number too; 2022-07-31 10:39:49 -07:00
bjorn 4919daa93b Small fixes; 2022-07-31 10:39:49 -07:00