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

4117 commits

Author SHA1 Message Date
bjorn 98729912a8 Add GL_EXT_samplerless_texture_functions; 2023-06-24 14:00:22 -07:00
bjorn 116d14cdf8 Details; 2023-06-24 11:26:09 -07:00
bjorn ad5d00fb2f Bugfixes; 2023-06-23 22:56:33 -07:00
bjorn 3ed3a1b2f9 Store align on stack instead of in field; 2023-06-23 21:35:39 -07:00
bjorn 68878f9197 Rename/refactor more Buffer stuff;
BufferField -> DataField
fields -> format
decontaminate buffer constructor
2023-06-23 21:14:19 -07:00
bjorn 0ff633fa56 mv FieldType DataType; 2023-06-23 19:11:30 -07:00
bjorn 3804d15184 rm Pass:setVertexFormat and table variant of Pass:mesh;
The complexity/convenience tradeoff isn't satisfactory.
2023-06-23 19:05:42 -07:00
bjorn d17232bac5 Fix warning; 2023-06-23 18:28:17 -07:00
bjorn a511064987 Collider:isDestroyed; 2023-06-22 15:48:23 -07:00
Bjorn 9c56c41b03
Merge pull request #676 from jmiskovic/add/vec3_from_quat
Initialize vec3 from quat
2023-06-22 15:48:11 -07:00
Josip Miskovic 3bd4c6c4f0 Initialize vec3 from quat 2023-06-22 19:14:19 +02:00
bjorn b9e14a8f2d Merge branch 'master' into dev 2023-06-21 16:52:10 -07:00
bjorn 06811dcb1a Fix lovr.graphics.newModel when model has unused meshes;
Prefer n^2 loop over a weird sentinel value that wasn't always getting written over.
2023-06-21 16:50:24 -07:00
bjorn b086b3d236 Fix issue where models sometimes wouldn't reanimate;
If the very first graphics-related thing done in a frame is drawing a
model, the reanimation logic would skip because a new frame hasn't
started yet.  lovrModelAnimateVertices needs to unconditionally start a
new frame.  (Previously, a new frame was guaranteed to be started
because all passes were temporary, but this is no longer the case).
2023-06-20 21:46:04 -07:00
bjorn 065fc7b1d5 Rename variable to avoid shadowing; 2023-06-20 21:45:58 -07:00
bjorn 97cc7d9137 Fix issue with blend shape compute shader;
It was only copying the raw vertex data for the first blend shape,
not the first blend shape in each group.
2023-06-20 21:42:44 -07:00
bjorn 4ec065757d Optimize blendshapes;
To initialize the vertices to their default state, it's way faster to
use a branch in the compute shader rather than using a copy.
2023-06-17 17:14:00 -07:00
Josip Miskovic f0d916787a Add wheelmoved callback 2023-06-17 12:42:18 +02:00
bjorn 8b1b262760 lovr.visible; lovr.headset.isVisible; 2023-06-13 21:06:05 -07:00
bjorn d36b2d334e Put back stencil validation checks; 2023-06-12 23:07:35 -07:00
bjorn 0b36eaccce Switch to better quat_fromMat4 implementation; 2023-06-10 12:45:00 -07:00
bjorn 313fc953cc Pass:append;
Copies draws from one pass onto another one.  Experimental.
2023-06-09 21:34:39 -07:00
bjorn efb7edeb08 Pass:draw(Texture); 2023-06-09 20:15:22 -07:00
bjorn 0a255af337 Add materials flag to newModel; 2023-06-09 18:32:54 -07:00
bjorn 82340f5da1 Mesh mode defaults to triangles;
Not sure where this went.
2023-06-06 22:39:22 -07:00
bjorn c9576bc98c Fix automaterial refcounting;
A little weird, but workable for now.
2023-06-05 19:54:44 -07:00
bjorn b57d7c2488 Per-draw cameras; Reset pass when canvas changes; 2023-06-05 19:45:20 -07:00
bjorn f17e2c790e Ensure draw index buffer is always set properly; 2023-06-05 00:01:52 -07:00
bjorn aa12263a29 Fix 24-bit WAV import; 2023-06-03 22:55:40 -07:00
bjorn 6ef16afee3 Tally fixup;
- rm Pass:getTallyCount.  It's unclear if this reports the current tally
  count, or the number of tallies in the last submit.  lovr was even
  getting this confused internally (fixed).
- rm tally index argument from Pass:beginTally and Pass:finishTally.
  The tally index is now an autoincremented value managed internally,
  and both :beginTally/:finishTally return it.  If someone wants to use
  their own indices, a lookup table can be used to do the mapping.
2023-05-31 18:56:09 -07:00
bjorn 4100be4f23 Fix vertex color import when model stores it as VEC3; 2023-05-27 12:04:35 -07:00
bjorn d003c4969d Merge branch 'master' into dev 2023-05-26 17:19:07 -07:00
bjorn 0b544209fb Fix luax_newmesh even more; 2023-05-26 17:18:38 -07:00
bjorn 6f85ea81b9 Merge branch 'master' into dev 2023-05-26 17:12:09 -07:00
bjorn 8e0ceec3a0 Fix luax_readmesh error message; 2023-05-26 17:11:45 -07:00
bjorn bd96b6afba Re-enable headless support on Android;
monado bug has since been fixed.
2023-05-26 17:04:18 -07:00
bjorn 9092545e9a Add bindings for Magic Leap 2 controller;
Notably, shoulder button is mapped to grip for now.
2023-05-26 17:03:11 -07:00
bjorn ce34bf702a Put back absindex in luax_checkstruct;
I thought it was for error messages, it's for correctness.
2023-05-26 16:47:58 -07:00
bjorn 4f29e3992c Don't bind pico4 actions if extension is unsupported; 2023-05-26 16:44:14 -07:00
duinodu 773c021d2d Add Pico4 support. 2023-05-18 15:27:18 +08:00
bjorn 77403a0908 rm unused prototype; 2023-05-17 20:29:46 -07:00
bjorn f9866f6771 Merge branch 'master' into dev 2023-05-17 20:29:10 -07:00
bjorn 4e4184cfc2 Pass:skybox requires a texture; 2023-05-17 20:26:38 -07:00
bjorn 08b911e142 Fix OpenXR interface; 2023-05-12 18:23:23 +01:00
bjorn 895f282241 Rename headet display frequencies to refresh rates;
Old API remains in deprecated state.
2023-05-12 18:01:42 +01:00
bjorn 440591746d Change default camera fov;
.6 is way too narrow, 1.2 is closer to previous versions
2023-05-12 17:35:19 +01:00
bjorn 18e327b135 Fix font wrap when camera is flipped to 2d; 2023-05-12 17:02:18 +01:00
bjorn 60ff2de78b Fix default projection matrix fov ratio;
Doubling the aspect doesn't really make sense.
2023-05-12 14:52:15 +01:00
bjorn 3f5e3bb0ed Improve passthrough API;
- lovr.headset.getPassthrough returns current passthrough mode
- lovr.headset.setPassthrough sets the passthrough mode
  - nil --> uses the default passthrough mode for the headset
  - bool --> false = opaque, true = one of the transparent modes
  - string --> explicit PassthroughMode
- lovr.headset.getPassthroughModes returns a table of supported modes
2023-05-12 14:18:22 +01:00
bjorn c9291d4401 Rename picoNeo3Controller flag to picoController;
It includes Pico 4 as well.
2023-05-12 10:47:47 +01:00
bjorn 51e3da75e1 Make utf8 module optional; 2023-05-11 08:16:18 +01:00
bjorn 4028b233a1 Model:clone;
Creates a lightweight copy of a Model, for situations where a single
model needs to be rendered with multiple poses in a single frame, which
is currently not possible.
2023-05-10 18:14:09 +01:00
bjorn 0bb16d24ef lovr.system.wasKeyPressed/Released; 2023-05-10 18:14:09 +01:00
bjorn be2502b3f2 Details; 2023-05-10 18:14:09 +01:00
bjorn da107f4387 Rename lovr.event.pump to lovr.system.pollEvents; 2023-05-10 18:14:09 +01:00
bjorn 98e648871e lovr.graphics.is/setTimingEnabled;
Enables automatic CPU/GPU timing for all passes.  Defaults to true
when graphics debugging is active, but can be enabled/disabled manually.

When active, Pass:getStats will return submitTime and gpuTime table
keys, respectively indicating CPU time the Pass took to record and the
time the Pass took to run on the GPU.  These have a delay of a few
frames.

This doesn't include a way to get "global" timing info for a submit.
This information would be useful because it doesn't require lovrrs to
sum all the timing info for all the passes and it would include other
work like transfers, synchronization, and CPU waits.  However, this is
more challenging to implement under the current architecture and will be
deferred to later.  Even if this were added, these per-pass timings will
remain useful.
2023-05-06 23:36:33 -07:00
bjorn 2e29ff1ecf Handle multiple compute writes to a resource properly; 2023-05-06 20:36:11 -07:00
bjorn 68808d991e Fix some bugs in lovr.graphics.submit;
- Make sure to reset barriers for compute/canvas resources too
- Delay stream ending so OpenXR layout transitions actually go in an
  active command buffer.
2023-05-06 20:32:16 -07:00
bjorn 5d342f3712 Fix readbacks never finishing; 2023-05-06 20:00:43 -07:00
bjorn b65fa7910d Merge branch 'master' into dev 2023-05-04 19:09:20 -07:00
bjorn d18109b6ce Use XR_BD_controller_interaction for Pico Neo 3 input;
Replaces nonstandard interaction profile.  Removed thumbrest paths and
applied menu to both hands, to align with the published extension.
2023-05-04 19:06:51 -07:00
bjorn a75086d0e4 Fix lovr.graphics.getWindowPass when there's no window; 2023-05-04 18:27:02 -07:00
bjorn f90cd237ca Add new occlusion query API; 2023-05-03 23:08:45 -07:00
Bjorn fd8bcdfaeb
Merge pull request #665 from bjornbytes/matrix-decompose
Mat4:getTranslation; Mat4:getRotation; Mat4:getScale;
2023-05-03 21:04:02 -07:00
bjorn 28553dda9f core/gpu: skip texture allocator init for unsupported formats;
Should avoid erroneous errors during init for devices that don't support
all the depth formats.
2023-05-03 21:00:41 -07:00
bjorn c717670a80 Add --graphics-debug command line argument; 2023-05-03 20:54:19 -07:00
bjorn 6fb0b5efd5 getPosition/getOrientation -> getTranslation/getRotation; 2023-05-03 20:42:44 -07:00
bjorn 04a96f828b Clear bindings when switching shader types;
If you switch to/from a compute shader and the other shader is either
nil or a graphics shader, clear bindings.

Maybe if you switch to/from nil the bindings shouldn't be cleared, but
this is a bit more complicated to implement and it's not clear that
there's any reason not to treat nil shaders as graphics shaders.
2023-05-03 20:16:30 -07:00
bjorn 0c99572f61 Fix/simplify push constant tracking; 2023-05-03 20:15:48 -07:00
bjorn 5131544221 Don't track temporary buffers;
This was accidentally removed.
2023-05-03 19:35:03 -07:00
bjorn e2ac329475 Add backwards compat variant for Pass:setCanvas; 2023-05-03 19:30:40 -07:00
bjorn 6fe9e0151f Add Pass:barrier function;
Previously, if you wanted to run compute operations that depend on the
results of prior compute operations, you had to put these in 2 different
passes, because logically all of the compute calls in a pass run "at the
same time" (or we're at least giving the GPU the freedom to do that).

Having to set up an entirely new pass just to synchronize 2 :compute
calls is pretty cumbersome, and incurs extra overhead.  It would be
possible to change things so *every* :compute call waits for previous
computes to finish, but this would destroy GPU parallelism.

The Pass:barrier method lets compute calls within a pass synchronize
with each other, without requiring multiple passes.  Adding a barrier
basically means "hey, wait for all the :compute calls before the barrier
to finish before running future :computes".

This lets things remain highly parallel but allows them to be easily
synchronized when needed.
2023-05-03 16:45:01 -07:00
bjorn 07276f9351 Fix Pass:setClear color space and headset background; 2023-05-03 16:35:09 -07:00
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 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