1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-02 12:33:52 +00:00
Commit graph

4807 commits

Author SHA1 Message Date
bjorn 452ee5c7c6 Pass rework;
Pass stores draw commands rather than sending them to Vulkan
immediately.

The main motivation is to allow more flexibility in the Lua API.  Passes
are now regular objects, aren't invalidated whenever submit is called,
and can cache their draws across multiple frames.  Draws can also be
internally culled, sorted, and batched.

Some API methods (tallies) are missing, and there are still some bugs to
fix, notably with background color.
2023-05-02 00:06:01 -07:00
bjorn 24a68ba648 OpenXR: Add an epoch so headset time starts at zero;
32-bit float precision can't handle huge XrTimes.
2023-05-01 19:09:35 -07:00
bjorn f96b915767 OpenXR: lastDisplayTime should be an XrTime; 2023-05-01 19:09:33 -07:00
bjorn f370da90d5 OpenXR: Always return a valid view count;
View count is well-defined to be 2 with the current view configuration,
and people should be able to rely on getViewCount even before the views
are tracked.  It returns the number of views in the view configuration,
not the number of views with valid data.
2023-05-01 18:59:15 -07:00
bjorn 6976a61464 Rename fill2d back to fill;
This rename was a mistake -- at the time I was thinking the fill shaders
were internal, but they definitely aren't.
2023-05-01 18:54:56 -07:00
bjorn 784440f5cb OpenXR: Handle zero timestamps; Handle tracking loss better;
- If timestamp is zero (before .update is called), return empty data
  instead of erroring.
- Check for valid position/orientation separately, and return empty data
  for anything that's invalid.  Previously both position/orientation
  were used if either was valid, which returns undefined results.
2023-05-01 18:49:59 -07:00
bjorn c115fd9c3a Simplify shader resource tracking; 2023-04-29 19:06:08 -07:00
bjorn f898a6f6b8 Linear allocator is no longer global to the graphics module;
Each Pass is gonna have its own allocator soon!
2023-04-29 18:35:01 -07:00
bjorn f98306e786 rm transfer passes; rm Tally for now;
- Add Buffer:newReadback
- Add Buffer:getData
- Buffer:getPointer works with permanent buffers
- Buffer:setData works with permanent buffers
- Buffer:clear works with permanent buffers
- Add Texture:newReadback
- Add Texture:getPixels
- Add Texture:setPixels
- Add Texture:clear
- Add Texture:generateMipmaps
- Buffer readbacks can now return tables in addition to Blobs using Readback:getData

Tally is coming back soon with an improved API, it's temporarily removed
since it made the transfer rework a bit easier.

Note that synchronous readbacks (Buffer:getData, Texture:getPixels)
internally call lovr.graphics.submit, so they invalidate existing Pass
objects.  This will be improved soon.
2023-04-29 18:31:03 -07:00
bjorn 775b6e4ff7 Rename some buffer helper functions; 2023-04-29 18:31:03 -07:00
bjorn c5cea29428 Mat4:getPosition; Mat4:getOrientation; Mat4:getScale; 2023-04-28 21:37:42 -07:00
bjorn dbc59b6749 Trailing comma nit; 2023-04-28 20:36:43 -07:00
bjorn 6c45c4df3c isDown/isTouched return nil instead of nothing; 2023-04-28 20:34:47 -07:00
bjorn 6862b8c970 Change cofactor/normal matrix to mat3;
This means per-draw uniform data is 128 bytes now!
2023-04-27 20:22:31 -07:00
bjorn e9d61bd254 Fix error typo; 2023-04-27 20:17:30 -07:00
bjorn b402745f6c Update comment; 2023-04-27 19:52:24 -07:00
bjorn b64fdc937f Move mapped buffers from core/gpu into graphics module; 2023-04-27 19:48:12 -07:00
bjorn 4563959ed1 Rename scratch buffers to temp buffers internally; 2023-04-27 19:15:56 -07:00
bjorn 8f654ed408 Simplify fill shaders;
Now there's 2 instead of 3!  Behavior is the same, fill goes
layer-by-layer onto each view until either the texture or canvas run out
of layers.
2023-04-26 22:18:06 -07:00
bjorn ad20289595 Make default compute shaders regular default shaders;
Minor cleanup;
2023-04-26 21:36:30 -07:00
bjorn f174755fc4 Fix accidental vec3->vec4 change;
Oops!  Too many ctrl-a's!
2023-04-26 17:31:02 -07:00
bjorn 4b8ada2690 Fix Pass:plane z scale / normal matrix;
Pass:plane was leaving its z scale uninitialized, which resulted in
a garbage normal matrix and other issues when using the transform in a
shader.  Planes were the only shape affected by this.
2023-04-26 17:27:00 -07:00
bjorn cb44549205 Fix more prototypes; 2023-04-25 21:45:30 -07:00
bjorn ad4978f692 Fix prototypes; 2023-04-25 21:37:14 -07:00
bjorn 6a030ef4f2 Add shader debug info when t.graphics.debug is set; 2023-04-19 20:49:34 -07:00
bjorn edb65a7578 Update glslang; 2023-04-19 20:49:30 -07:00
bjorn 56851fd0f2 Make builtin layouts constant instead of variable; 2023-04-14 21:27:47 -07:00
bjorn 70e5a69576 Cleanup; 2023-04-14 21:25:48 -07:00
bjorn 4bfab067ae Make shader input/output locations optional; 2023-04-14 21:21:14 -07:00
bjorn 6c252a47b8 Don't declare builtin flags in compute shaders;
They aren't used, and increase file size and clutter up disassembly.
2023-04-05 21:53:39 -07:00
bjorn 747c7fdddf Optimize blend shape shader;
This is ~20% faster, I think it's because all the SSBO stores are
"batched" at the end.
2023-04-05 21:53:39 -07:00
bjorn ba0412182b gpu: nickname shaders; 2023-04-05 21:53:39 -07:00
bjorn 024ea094a4 Fix Pass:roundrect bug;
It would draw a plane when radius was zero, even if it was supposed to
be thick.
2023-04-04 17:40:24 -07:00
bjorn 34c3e2c309 Fix Mesh validation and issues with untyped buffers; 2023-04-02 15:09:37 -07:00
bjorn f3448d3167 Improve error when buffer fields are missing; 2023-04-02 13:00:32 -07:00
bjorn 4f1e3a17e1 Improve error message for invalid first buffer arg; 2023-04-02 12:58:39 -07:00
bjorn 36e8ded0d8 Add helper function for getBuffer/newBuffer; 2023-04-02 12:54:19 -07:00
bjorn 01ba9927c1 Fix flipped condition when writing buffer data; 2023-04-02 10:09:06 -07:00
bjorn 9c054c0515 Add mouse input to lovr.system; 2023-04-01 13:08:47 -07:00
bjorn a2b12c9e7c Vertex tangents don't require normalMap flag anymore; 2023-03-31 19:23:20 -07:00
Bjorn 7c557132f9
Merge pull request #653 from bjornbytes/blendshapes
Blend Shapes
2023-03-31 18:54:46 -07:00
bjorn 94879c1529 Rebase fixes; 2023-03-31 18:45:40 -07:00
bjorn 26b52f83eb ModelData:getAnimationKeyframe works with blend weight animations; 2023-03-31 18:45:16 -07:00
bjorn 07a6d11c46 Split vertex animation into multiple dispatches as needed;
If the number of skinned vertices in a Model doesn't fit in a single
dispatch (~2M vertices on 32-sized subgroups or ~500K vertices on
8-sized subgroups), split it into multiple dispatches.
2023-03-31 18:45:16 -07:00
bjorn ff10461e69 Reduce blend shape chunk size from 128 to 64; 2023-03-31 18:45:16 -07:00
bjorn f56b48b3a7 Blend shapes and skinning work at the same time; 2023-03-31 18:45:16 -07:00
bjorn 4a6de6caf5 Write blend shape compute shader; Bugfixes; 2023-03-31 18:45:16 -07:00
bjorn 530db8c7f8 WIP blend shape compute dispatch; 2023-03-31 18:45:16 -07:00
bjorn 086aef1a79 Convert pipeline type bool into enum;
It's a little more readable.
Also batch compute passes for models with multiple skins, since they can
all run at the same time.
2023-03-31 18:44:31 -07:00
bjorn ce645c0285 Shader stores compute pipeline as pointer; 2023-03-31 18:44:31 -07:00