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

5075 commits

Author SHA1 Message Date
bjorn 5f53b21469 Merge branch 'stable' into dev 2023-11-30 09:04:19 -08:00
bjorn 49328b88a6 Shader #include errors on missing file; 2023-11-30 09:03:33 -08:00
bjorn 858bc7ffa0 Fix morgue overflow;
The morgue is a fixed-size queue for GPU resources that are waiting to
be destroyed.  There's been an annoying issue with it for a while where
destroying too many objects at once will trigger a "Morgue overflow!"
error.  Even innocuous projects that create more than 1024 textures will
see this during a normal quit.

One way to solve this problem is to make the queue unbounded instead of
bounded.  However, this can hide problems and lead to more catastrophic
failure modes.

A better solution is to add "backpressure", where we avoid putting
things in the queue if it's full, or find some way to deal with them.
In this case it means finding a way to destroy stuff in the morgue when
it's full, to make space for more victims.

We weren't able to add backpressure reliably before, because command
buffers could have commands that reference the condemned resources.
This was mostly a problem for texture transfers -- if you create
thousands of textures in a loop, we'd have a giant command buffer with
commands to transfer pixels to the textures.  If these textures were
destroyed before submitting anything, the morgue would fill up, and we
wouldn't have any way to clear space because there was still a pending
command buffer that needs to act on the textures!

A simple change is to flush all pending transfers whenever a buffer or
texture is destroyed.  This lets us add backpressure to the morgue
because we can guarantee that there are no pending command buffers that
refer to an object in the morgue.

For backpressure, we try to destroy the oldest object in the morgue if
the GPU is done using it.  If that doesn't work, we'll wait on the fence
for its tick and destroy it.  This *should* always work, although in an
extreme case you could vkDeviceWaitIdle and clear out the entire morgue.

It should also be noted that in general command buffers need to be
flushed when destroying objects that they refer to.  However, for our
particular usage patterns, we only need to flush state.stream when a
buffer or texture is destroyed.  Pass objects already refcount their
buffers and textures and their commands are software command buffers, so
they don't require any special handling.  Other objects like shaders,
pipelines, descriptor set layouts, etc. all survive until shutdown, so
those don't impact anything either.
2023-11-30 05:45:13 -08:00
bjorn 6ed2e4b8fb s/PassTime/TimingInfo; 2023-11-30 01:16:31 -08:00
bjorn 49ffda57cb Pipelines use virtual memory; 2023-11-30 00:14:06 -08:00
bjorn d375e96c13 sRGB storage image views take 2;
There were numerous problems with the previous effort to add support for
linear views of sRGB storage textures.  Here's another attempt:

- Images are always created with the linear version of their format.
- The default texture view uses the sRGB format if the parent is sRGB.
- Use ImageViewUsageCreateInfo to specify the usage for render/storage views.
- sRGB image views always have their storage bit forcibly cleared.

The storage view now behaves more like the existing renderView -- if we
detect that you couldn't use the default texture view for storage, we'll
create one that is guaranteed to be usable for storage bindings (by
clearing the sRGB flag on it).
2023-11-28 22:47:17 -08:00
bjorn 6da3f8efbe Support aliased shader resources within a shader stage;
Previously this would include multiple descriptors with the same
binding, which isn't allowed.  Instead, just reuse the inter-stage
tracking/merging for intra-stage resources as well.
2023-11-28 11:12:29 -08:00
bjorn afd11cf0b9 Fix pcall and only use nogame conf for nogame; 2023-11-27 19:02:31 -08:00
bjorn 2aed5135b7 Android: default ANDROID_ASSETS to nogame bundle; 2023-11-27 18:42:49 -08:00
bjorn b5922656a8 macos: Put nogame bundle in Resources folder instead of appending to exe; 2023-11-27 18:42:49 -08:00
bjorn fc8b196f12 macos: return executable path when bundle isn't present; 2023-11-27 18:42:49 -08:00
bjorn 0a17cc566d Add nogame bundle; CMake zips and concats nogame; 2023-11-27 18:42:49 -08:00
bjorn 4f67fa9a2e Fix coroutine error handling; 2023-11-27 18:42:49 -08:00
bjorn 6edd4ec049 Improve error messages; Add comments; 2023-11-27 18:42:49 -08:00
bjorn 427ad25120 Fix errhand alignment; 2023-11-27 18:42:49 -08:00
bjorn 3351f473f2 Rework boot process; 2023-11-27 18:42:49 -08:00
bjorn 9d55a5b222 boot.lua sets source instead of filesystem module; 2023-11-27 18:42:49 -08:00
bjorn 64950bc152 lovr.filesystem.setSource; 2023-11-27 18:42:49 -08:00
bjorn 4926362cc7 lovr.filesystem.getBundlePath; 2023-11-27 18:42:49 -08:00
bjorn 1cac651392 Inline LOVR_PATH_SEP; 2023-11-27 18:42:49 -08:00
bjorn a1309cfe87 Minor boot.lua refactors; 2023-11-27 18:42:49 -08:00
bjorn 703e9d3c36 boot.lua stores lovr in local; 2023-11-27 18:42:49 -08:00
bjorn 2e543a96de More zip fixes; 2023-11-27 18:39:27 -08:00
bjorn 399a283536 zip fixes; 2023-11-26 21:49:41 -08:00
bjorn 9445331df8 Create files/directories with more permissions;
Files are created with 664 (though usually modified by umask).

Directories are created with 755 permissions.

Main motivation is to allow adb to access files on Android 12+
2023-11-26 19:10:42 -08:00
bjorn 9da89b7834 Fix Windows build; 2023-11-26 18:15:53 -08:00
Bjorn 07ff7412df
Merge pull request #724 from jmiskovic/fix/vector_pool_allocation
Use virtual memory in vector pools
2023-11-26 14:04:50 -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 3a16e0c290
Merge pull request #721 from bjornbytes/file
File Object
2023-11-22 16:48:20 -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 a8d44b27f0 Fix CMakeLists; 2023-11-21 19:07:59 -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 275b63a731 Change offset to seated in default conf;
This was innocuous, but incorrect.
2023-11-21 13:02:01 -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