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

4325 commits

Author SHA1 Message Date
bjorn 9da89b7834 Fix Windows build; 2023-11-26 18:15:53 -08:00
Josip Miskovic a1d7bf5fbc Use virtual memory in vector pools 2023-11-26 16:54:29 +01:00
bjorn 08d6b2ad28 Refcounted modules;
This allows them to be initialized/destroyed from multiple threads in
any order.  Previously, the first thread to require a module had to be
the last thread to use the module, otherwise it would be destroyed too
early.

There are still a few issues.  If the main thread doesn't require a
module, it won't pick up the conf.lua settings.  Also graphics isn't
handling the shader cache writing properly.  And I think this breaks the
headset-graphics refcounting.  But these will be fixed in future
commits.
2023-11-23 17:07:44 -08:00
xiejiangzhi d2b4ad5a5c Fix euler var name(z forwrad) 2023-11-23 10:43:57 +08:00
bjorn a42ccaa975 Fix Windows; 2023-11-22 16:42:28 -08:00
bjorn 7ca331a5f5 Adjust fs_read/fs_write signatures; Fix seeking; 2023-11-22 16:37:31 -08:00
bjorn c0c62e165a File:seek returns success; 2023-11-22 16:24:46 -08:00
bjorn 1ef562dcdd fs_open fails if you try to open a directory; 2023-11-22 16:19:45 -08:00
bjorn d949b90eea Details; 2023-11-22 16:19:40 -08:00
bjorn f04a0e6bc4 Fix zip EOF emulation;
To match regular files, the file offset should be allowed to go past the
end of the file, but reads will return 0 bytes.
2023-11-22 15:49:10 -08:00
bjorn 8ac4d7167c File:isEOF; 2023-11-22 15:45:57 -08:00
xiejiangzhi aea3e7cd47 Fix quat_fromEuler 2023-11-22 20:22:10 +08:00
xiejiangzhi e078b10b68 quat<->euler y-up & fix compile warning 2023-11-22 19:08:17 +08:00
xiejiangzhi f328207932 Fix singularity problem for quat_toEuler 2023-11-22 18:04:31 +08:00
xiejiangzhi 655c0816ba Add quat:ToEuler and quat:fromEuler 2023-11-22 15:54:52 +08:00
bjorn 79abe3b1d6 Windows fixes; 2023-11-21 20:19:49 -08:00
bjorn 19ac219b0c Add File object; 2023-11-21 18:49:32 -08:00
bjorn f50e9f6fe1 Use miniz to decompress files; 2023-11-21 18:49:32 -08:00
bjorn d0f1462e51 Make Archive a refcounted object;
- Archive is now an object that has a refcount
- Archives are stored in linked list instead of array
- Not exposed to Lua yet, but could be in the future
- core/zip was merged into the filesystem module
- Mountpoints are handled centrally instead of per-archive
- Zip doesn't pre-hash with the mountpoint anymore
- mtime is truly only computed on request for zips

Mountpoints don't work properly yet.
2023-11-21 18:49:32 -08:00
bjorn 209ea1e4b5 Simplify Pass draw list;
It's a normal stretchy buffer instead of a weird page table thing.

This was definitely overdesigned.

Now it uses less memory too.
2023-11-18 02:02:05 -08:00
bjorn e5733bc667 Only generate mipmaps for blittable texture formats;
- If you load an image with a non-blittable format, mipmap count will
  default to 1.
- If you explicitly request mipmaps on a non-blank texture with a
  non-blittable format, that's an error (rather than leaving mipmap
  chain undefined or sliently falling back to 1 mipmap).
2023-11-17 20:48:44 -08:00
Bjorn 895c702388
Merge pull request #720 from xiejiangzhi/auto_wakeup
Auto wake up collider when calling API to apply force or change force.
2023-11-17 17:50:10 -08:00
xiejiangzhi 1e120d3401 Auto wake up collider when calling API to apply force or change force. 2023-11-18 09:43:52 +08:00
bjorn e0e1bc68f9 Add support for cubemap arrays;
- Cubemaps can have any layer count that is a multiple of 6.
- A cubemap with more than 6 layers will be a cubemap array image view.
  - This isn't perfect because it conflates regular cubemaps with
    6-layer cubemap arrays.
- Enable the vk feature, handle the spv feature, add getPixel helper.
2023-11-10 11:15:16 -08:00
bjorn 67b1929af6 Merge branch 'stable' into dev 2023-11-09 16:51:28 -08:00
bjorn eefc89909e Fix bitangent sign;
Really gotta compress ModelVertex at some point.
2023-11-09 16:50:52 -08:00
bjorn 62810a195c rm Pass:append;
This was an experiment that was never documented/announced.
2023-11-09 16:08:14 -08:00
bjorn 534947bc20 Merge branch 'stable' into dev 2023-11-09 14:57:42 -08:00
bjorn 4522d1050f Fix OpenXR layout transitions; 2023-11-09 14:57:29 -08:00
bjorn ce4e07db1b Revert removal of lovr.graphics.initialize;
I forgot that graphics also needs to be initialized after headset,
otherwise the XR_KHR_vulkan_enable2 callbacks won't exist yet. Boo
2023-11-09 13:31:56 -08:00
bjorn 02860ff8e9 Merge branch 'stable' into dev 2023-11-09 12:48:10 -08:00
bjorn 648118d308 Fix excessive gamma-to-linear conversion; 2023-11-09 12:47:39 -08:00
bjorn c4cda0a7bb core/gpu: rm TRANSIENT texture usage;
It's implied when the usage is just RENDER
2023-11-08 14:54:10 -08:00
bjorn e8945763c2 core/gpu: allocation callbacks; 2023-11-08 14:45:04 -08:00
bjorn 9e82dc9148 Layer count is implicitly 6 when creating cubemap;
LÖVR understands me
2023-11-06 15:53:01 -08:00
bjorn 8ed5572b0e rm lovr.graphics.initialize/isInitialized;
This only existed because the graphics module had to know about the
window during initialization, but this is no longer the case.
2023-11-03 15:53:33 -07:00
bjorn c98db5b670 lovr.system.wasMousePressed/Released; 2023-11-02 18:55:02 -07:00
bjorn 038db88cb7 Consolidate texture format features;
- 'sample' now implies both sample and linear filtering (practically always
  true for all formats lovr supports)
- 'render' now includes 'blend' for color formats (also practically
  always true except for r32f on some old mobile GPUs)
- 'blit' now includes 'blitsrc'/'blitdst' because lovr doesn't support
  blitting between textures with different formats
- 'atomic' is removed because lovr doesn't really support atomic images yet
2023-11-02 15:33:29 -07:00
bjorn eac68d2fe4 Skip creating texture views for transfer-only textures;
Vulkan forbids it!
2023-11-02 13:50:55 -07:00
bjorn c2d9aa5657 Destroy linear texture views; 2023-11-02 13:40:16 -07:00
bjorn 90a14478a3 lovrImageCreateRaw takes sRGB flag; Fix readback encoding;
Roundtripping pixels through a readback preserves sRGB encoding.
2023-11-02 13:38:21 -07:00
bjorn b2083e9a4a Ignore linear=false flag for linear-only formats;
Also fix bug with r8 srgb canvases...
2023-11-02 13:26:49 -07:00
bjorn afef8887ba Texture:getFormat also returns linear/srgb encoding; 2023-11-02 13:17:05 -07:00
bjorn 0468a2f090 Default texture is linear; 2023-11-02 13:16:00 -07:00
bjorn e9743a2fb8 Secretly create and bind linear views of sRGB storage textures; 2023-10-31 17:14:09 -07:00
bjorn a28d66e3a1 Mesh:setMaterial takes texture too; 2023-10-31 16:08:00 -07:00
bjorn 55a27d0a69 Implement numpad keys for desktop; 2023-10-31 15:55:00 -07:00
bjorn 9ff8ad61e1 Prefix KEY enums with OS_KEY; 2023-10-31 13:16:20 -07:00
bjorn 1d82e7f66c gpu_texture refactoring; 2023-10-30 18:41:51 -07:00
bjorn df9f50ca5c Fixes for layer depth test and depth submission; 2023-10-26 16:29:35 -07:00
bjorn bdbdd467e0 Layer improvements; 2023-10-25 15:24:14 -07:00
bjorn 6bccbd66ec Layer fixes; 2023-10-25 15:24:14 -07:00
bjorn c8eb6606c6 OpenXR layer implementation; 2023-10-25 15:24:13 -07:00
bjorn 4c2e206e30 Bindings; 2023-10-25 15:23:41 -07:00
bjorn 72aac1c58a Start Layers; 2023-10-25 15:23:41 -07:00
bjorn 2f8d9aa6dc Disable depth submission when depthResolve is not supported;
Prefer MSAA over depth submission on GPUs that can't resolve depth
buffers (Quest 1).
2023-10-25 15:22:16 -07:00
bjorn 42cfb273f9 Fix bug where depth wasn't being submitted to VR runtime; 2023-10-25 15:15:16 -07:00
bjorn 2c5f9d379b World:raycastAny and World:raycastClosest;
These are methods that implement some common raycast behaviors without
creating a closure.  They also take tag filters.  The tag filters could
be optimized to use tag numbers instead of string comparison, and the
default raycast method could take a tag filter, but I didn't want to
modify the C API while Jolt is in progress.
2023-10-23 16:09:07 -07:00
bjorn 0dfa95626e Model:resetBlendShapes;
Resets blend shapes to default values, like :resetNodeTransforms.
2023-10-18 15:51:52 -07:00
bjorn c9e12680fe rm deprecated headset stuff; 2023-10-15 14:10:39 -07:00
bjorn 35628e332c rm deprecated pass stuff; 2023-10-15 14:10:39 -07:00
bjorn ab3922345f rm deprecated buffer stuff; 2023-10-15 14:08:50 -07:00
bjorn 1d6f3afc34 v0.17.0; 2023-10-14 19:36:19 -07:00
bjorn 99f8c3a25c Fix frustum culling;
The technique used only works for AABBs.  Trying to apply the model
matrix to the extent like that isn't valid.  For now, switch back to
the naive approach.  This is quite a bit slower, but at least it's
correct.
2023-10-11 18:21:11 -07:00
bjorn 68aad50a2d Use better UBO size when pass has more than 256 draws; 2023-10-11 13:55:25 -07:00
bjorn 5d6f538524 Pass:barrier also barriers against indirect stage;
Fixes a validation error that probably no one was running into.
2023-10-11 08:26:06 -07:00
bjorn b319aeeb40 Fix Pass:send when using a table with an array UBO; 2023-10-07 16:22:56 -07:00
bjorn 539b19c84c Fix minor undefined behavior; 2023-10-05 12:21:27 -07:00
bjorn 6cfbfd050d Fix issue with synchronization;
If there is only a single pass in the submit, barrierCount is zero
since there will be no inter-pass synchronization.  This is almost
correct, but not quite, because if a Pass has compute and render work,
the render pass may need to synchronize with the compute pass.  So a
barrier is still necessary.  For simplicity, always allocate the full
number of barriers, even though the final render barrier will always be
empty.

Additionally, avoids passing NULL to memset when the barrier count is
zero and the barrier arrays are NULL.
2023-10-05 12:09:55 -07:00
bjorn 6e12370ee8 Fix out of bounds access in newShader; 2023-10-05 11:26:43 -07:00
bjorn 2a3b517334 Fix incorrect depth buffer default in Pass:setCanvas;
If you did newPass(texture) instead of using a table, the pass would not
have a depth buffer instead of using d32f.
2023-10-05 07:20:01 -07:00
bjorn e307487041 Pass:send supports single booleans for push constants;
vectors/arrays/structs with booleans still aren't supported.
2023-10-05 06:36:21 -07:00
bjorn fc9bb8a5e4 Fix crash when trying to load hand models on non-Quest; 2023-10-04 17:04:03 -07:00
bjorn c0fbc515f8 Fix Mesh:getIndices; 2023-10-04 14:40:34 -07:00
bjorn 6682fe1930 Fix Mesh:computeBoundingBox; 2023-10-04 14:36:39 -07:00
bjorn 44b250a517 Fix issue with texture readback layer count; 2023-10-04 13:12:55 -07:00
bjorn 327b1954ea Readbacks with nesting always use key-value format; 2023-10-04 09:00:36 -07:00
bjorn 805b83601f Buffer readbacks use a more consistent format;
- Always wrapped in table
- Length is always item count
- Scalars are tables of numbers { 1, 2, 3 }
- Vectors are wrapped in tables { { 1, 2 }, { 3, 4 } }
- Compound formats are wrapped in tables, like Mesh vertices
- Structs/nested types are tables
2023-10-04 08:52:05 -07:00
bjorn 842df4b305 Fix buffer readback issues; 2023-10-04 08:52:05 -07:00
bjorn c976b36682 Buffer:getData takes optional index/count arguments;
Also, the Buffer needs to have a format.
2023-10-04 08:52:05 -07:00
bjorn 86db0e3ab5 Buffer:getPointer is renamed to mapData;
It also takes range parameters.

:getPointer is deprecated.
2023-10-04 08:52:05 -07:00
bjorn 9dd2782af9 Fix win32 warnings; 2023-10-03 11:51:08 -07:00
bjorn f0686f0115 Update msdfgen; Orient contours properly;
This fixes issues where some fonts would have glyphs with weird windings
and they would get rendered inside-out.

Unfortunately updating msdfgen increased its size by a factor of 2-3x.
2023-10-03 11:12:38 -07:00
bjorn 3041a9a484 Pass:setTallyBuffer(nil) works; 2023-10-02 10:49:54 -07:00
bjorn 9a276e5f9a Tally fixups;
- rm :getTallyData, it's totally lame, just do a readback
  - rm gpu_tally_get_data too, webgpu doesn't support it anyway
- Clamp tally copy count so it doesn't overflow buffer
- Tally buffer offset's gotta be a multiple of 4
- Return nil instead of 2 values when tally buffer isn't set
- Copy correct number of tallies (multiply by view count instead of max
  view count)
- Skip occlusion queries entirely if no tally buffer was set
2023-10-02 10:20:52 -07:00
bjorn 9c28eab732 Fix crash when drawing with an active compute shader; 2023-10-02 09:56:33 -07:00
bjorn 6462c7bc07 getBundle takes bindings; 2023-10-02 09:07:50 -07:00
bjorn 9734ef005c Fix Pass:setClear w/ table of numbers; 2023-10-02 08:47:04 -07:00
bjorn d901481cdc Clear canvas info properly when setting canvas to nil; 2023-09-30 13:19:31 -07:00
bjorn fd2b2e7e4a Render pass samples can't be a boolean that's weird; 2023-09-30 12:31:10 -07:00
bjorn d7c6461916 Render targets with mipmaps get transfer usage;
Also I think no mipmaps is more sane default for render targets.
2023-09-29 05:22:03 -07:00
bjorn 4e6effceff lovr.graphics.wait updates timing stats and readbacks; 2023-09-28 23:26:04 -07:00
bjorn a2f539de56 Update glslang; Shader #include uses virtual filesystem;
This update seemed to increased glslang's binary size even more...
2023-09-28 22:04:05 -07:00
bjorn 684560ef81 Fix Mesh:getDrawRange not returning base vertex; 2023-09-28 03:17:18 -07:00
bjorn c3b99a397a Mesh bounding box uses same convention as everyone else;
It was using

minx, miny, minz, maxx, maxy, maxz

Instead of

minx, maxx, miny, maxy, minz, maxz
2023-09-28 02:26:53 -07:00
bjorn 19c4aed465 Fix crash when headset module is disabled; 2023-09-27 23:04:55 -07:00
bjorn c3c5284f11 Improve viewport/scissor accessors;
- Better validation
- Can set to nil to "disable"
- Getter returns nil when "disabled"
- Negative viewport height works again
2023-09-27 00:24:01 -07:00
bjorn 3fb3590b77 Mat4:mul/Quat:mul return temp vectors;
Quat:mul also takes numbers.
They both require 3 args when using numbers.
I didn't opt for the 4-component Mat4:mul(numbers) variant, mostly out
of laziness.

Co-Authored-By: Josip Miskovic <josipmiskovic@gmail.com>
2023-09-26 01:30:54 -07:00
bjorn 6883c36397 Rename Mat4:getTranslation/Rotation -> position/orientation;
It's a little less correct, but literally everything else is
"getPosition" and "getOrientation".
2023-09-25 21:59:51 -07:00
bjorn fbdecda440 Render textures have mipmaps by default again;
They defaulted to 1 to avoid confusion when mipmaps weren't generated
during a render pass (withou the { mipmaps = true } flag), but now the
mipmaps flag is obsolete and render passes automatically generate
mipmaps for all levels in their texture views.  This means that render
passes can have mipmaps by default again, which leads to better
appearance when sampling them later.
2023-09-25 00:07:26 -07:00