Commit Graph

3816 Commits

Author SHA1 Message Date
bjorn 1a12904800 Fix gpu_release; rm morgue flush; increase morgue size;
- When a memory block was freed, any allocators that were using it need
  to null out their memory blocks.  Otherwise it would just keep using
  the freed block.
- The emergency morgue expunge doesn't work.  It would be nice if it
  did, but if the emergency expunge deletes an object that exists in a
  command buffer that's still being recorded, it causes all kinds of
  problems and corrupts the command buffer.  You'd either need to submit
  these command buffers early before deleting the object (this is super
  tricky) or just prevent this entirely, maybe by growing the morgue
  infinitely or throwing an error if it fills up.  Either way, creating
  and releasing textures in a loop without submitting work will
  eventually throw an 'out of memory' error.  None of this is
  satisfactory and I'm not sure how to solve this well yet.
- To compromise, increase the size of the morgue a bit so emergency
  flushes happen slightly less often.
2022-10-20 20:21:55 -07:00
bjorn 3958c006fa Don't generate mipmaps for textures without initial contents; 2022-10-20 19:37:00 -07:00
bjorn 0b6fe9c81a Fix off-by-one error in gpu allocator;
Refcount wasn't being initialized to 1.
2022-10-18 22:28:14 -07:00
Josip Miskovic 9b6e884f7f Remove problematic bindings from Index controller
The "system" button on Valve Index controller may not be exposed to
applications through OpenXR. Oculus runtime throws error when binding
for that button is attempted.
2022-10-18 21:50:48 -07:00
bjorn 3b3d2d4e77 Fix newBoxShape dimensions; 2022-10-16 19:53:44 -07:00
bjorn 904fb282c2 v0.16.0; 2022-10-15 21:49:25 -07:00
bjorn 93b465bd1f gpu: Use portability extensions when needed;
This makes newer versions of macOS load Vulkan properly.
2022-10-15 00:45:46 -07:00
bjorn df8f52a71b Fix gcc warnings; 2022-10-12 10:57:43 -07:00
bjorn 82dc3cc920 Fix multiview limit;
When multiview is not supported (although technically lovr requires it),
the renderSize limit for array layers was zero, which meant no render
passes would work.  Instead, make sure it's at least 1, which is more
correct.
2022-10-12 10:37:58 -07:00
bjorn 1c3be230c0 Desktop driver implements hand/left/point device; 2022-10-12 00:46:48 -07:00
bjorn c59c242b7b Fix newTexture; 2022-10-12 00:46:48 -07:00
bjorn 0d7ed04789 Fix Quest pinch axis; 2022-10-02 14:00:52 -07:00
bjorn 272893fe66 Use correct array length for depth range; 2022-09-28 19:16:55 -07:00
bjorn b5620fb185 Revert "Fix Quest hand model orientation;"
This reverts commit a766bf4a35.
2022-09-26 14:58:34 -07:00
bjorn a766bf4a35 Fix Quest hand model orientation; 2022-09-23 17:52:21 -07:00
bjorn d2ceb6b81a Fix skeletal animation on some GPUs;
The animation compute shader was not specializing the workgroup size
properly, so it was only working on GPUs with a subgroup size of 32.

The Quest 1 has a subgroup size of 32 and the Quest 2 has a subgroup
size of 64, so this resulted in hand models breaking on Quest 2 only!
2022-09-23 14:36:20 -07:00
bjorn 74218da271 Fix luax_checkendpoints when direction is not normalized; 2022-09-23 11:58:26 -07:00
bjorn 2e0b5a4efa Flip msdf glyphs;
They don't look right when using a negative y scale for some reason,
even though the rendering was still working.
2022-09-22 20:30:04 -07:00
bjorn dd336b7473 Render target textures don't have mipmaps by default; 2022-09-21 21:18:32 -07:00
bjorn 311d1511bc Fix quest keyboard tracking; 2022-09-21 14:58:30 -07:00
Josip Miskovic da9328e72c Fix sending strings with \0 through channels
A null-char is valid part of Lua string. When such a string is sent
through the channel, its length should be stored as well to be able to
correctly reconstruct it on the other thread.

The bug was triggered with this code:

    s1 = 'a \0 b'
    print(#s1) -- 5
    ch:push(s1)
    s2 = ch:pop()
    print(#s2) -- 2
2022-09-21 09:15:20 -07:00
bjorn ece73be868 lovr.headset.getPose works with keyboard device on Quest; 2022-09-20 20:16:58 -07:00
bjorn d1b6bd3d15 OpenXR: fall back to d24s8 when d32fs8 isn't supported;
Window was already doing this.

Quest currently doesn't work with stencil = true because of this.
2022-09-20 19:09:04 -07:00
bjorn 28869431fb Fix stereo mirror window; 2022-09-15 20:45:26 -07:00
bjorn 6444aba832 OpenXR: Map Index system buttons to menu;
SteamVR doesn't expose these, but monado does, so might as well bind them.
2022-09-14 21:35:43 -07:00
bjorn 5be425ddbe Fix Pass:clear(Texture); 2022-09-14 20:53:42 -07:00
bjorn 1dd737d8a4 Make the logo a default shader;
Improves build system, improves filesize, seemingly improves startup time
2022-09-13 17:36:10 -07:00
bjorn a31ae6a68f Fix compileShader; 2022-09-13 17:22:48 -07:00
bjorn b5651f9193 Fix lod range of default samplers; 2022-09-12 18:09:29 -07:00
bjorn 68f3610d5e Fix stencil test; 2022-09-12 17:58:29 -07:00
bjorn d8c23bacec Source:setPitch;
Co-authored-by: Nevyn Bengtsson <nevyn@alloverse.com>
2022-09-11 20:41:58 -07:00
bjorn 1c9adea2e2 Simplify channel hash table; 2022-09-10 23:59:14 -07:00
bjorn bcde681710 Mark ASTC textures as sRGB;
They don't contain this metadata, but marking as sRGB is more reasonable
than not.
2022-09-10 23:55:15 -07:00
bjorn 76557eb6ed Add hand joint radius to getSkeleton; 2022-09-10 23:44:14 -07:00
bjorn 7636a3c5e9 Default window size matches conf.lua; 2022-09-10 21:10:01 -07:00
bjorn 860651e80c rm falsy variant of lovr.system.openWindow;
Probably vestigial from conf invocation.
2022-09-10 20:53:55 -07:00
bjorn 0da84894e8 Fix gamma correction of multicolor text; 2022-09-10 14:55:15 -07:00
bjorn 0191d29a45 Handle missing Vulkan error; 2022-09-10 13:06:32 -07:00
bjorn 0b544df470 Rename OS_EXPORT to avoid macOS clash; 2022-09-10 12:53:52 -07:00
bjorn d8c6c47e00 Add normal DefaultShader;
It's a pretty normal shader.
2022-09-10 11:07:55 -07:00
bjorn 5f921f1251 Unable to mipmap multisampled textures; 2022-09-10 11:02:03 -07:00
bjorn 7e1d9f1dd2 Fix desktop driver crash when window isn't open; 2022-09-10 10:58:11 -07:00
bjorn 931ffea17b Pass:getClear returns correct value for dontcare/load actions; 2022-09-10 10:28:54 -07:00
bjorn 5c4fc79242 mv lovr.graphics.init lovr.graphics.initialize;
init is undocumentable due to Lua conventions.
2022-09-10 10:22:52 -07:00
bjorn f30e37a2e3 Error if testing/writing non-existent stencil buffer; 2022-09-10 10:20:41 -07:00
bjorn 48ec18573a Pass:getClear only includes depth when depth buffer exists; 2022-09-10 10:17:24 -07:00
bjorn ee809ec31a Pass:mipmap base mipmap index is 1-indexed; 2022-09-10 10:14:46 -07:00
bjorn 7851f49910 Make blit layers 1-indexed;
Annoying for 3D textures, but matches layer indices most elsewhere.
2022-09-10 10:13:34 -07:00
bjorn a3beccb14e Fixup 3D texture blit validation; 2022-09-10 10:12:06 -07:00
bjorn a796c92556 Buffer:clear and Pass:clear(Buffer) use the same units; 2022-09-03 10:49:25 -07:00
bjorn 08f0ca7434 Font:getVertices wrap is optional; 2022-09-02 19:21:55 -07:00
bjorn ed035f9e81 Adjust; 2022-09-02 18:53:50 -07:00
bjorn 8697466009 Shader flag adjustments;
- glowTexture is on by default, but still requires the glow flag.
- occlusionTexture is named ambientOcclusion, and is on by default,
  but is still not used by any builtin shaders/helpers.
2022-09-02 15:33:18 -07:00
bjorn ea30100c31 rm texture variant of newMaterial;
Does not make sense anymore now that Pass:setMaterial(Texture) exists.
2022-09-02 15:05:01 -07:00
bjorn ce9662fa7e Make Model draw start vertex 1-indexed;
That way it matches Pass:mesh.
2022-09-01 21:54:34 -07:00
bjorn e57d76c6e9 Fix bug with base vertex in Pass:mesh; 2022-09-01 21:54:24 -07:00
bjorn 2a96fe4766 Desktop driver starts timestamp at zero;
Float conversion leads to precision issues
2022-08-28 15:02:46 -07:00
bjorn 63fbd4d223 Rebind descriptor sets if push constant ranges change; 2022-08-28 15:02:46 -07:00
mcc 2a0f9bb36c Minor comments on audio.c 2022-08-27 08:44:24 -07:00
bjorn de44f88b5f rm XR_KHR_android_create_instance;
It's not needed anymore.
2022-08-26 23:21:01 -07:00
bjorn 54a5ca1c36 Initialize stencil mask state slightly better;
Not sure this has an effect but it seems better.
2022-08-26 22:23:28 -07:00
bjorn e402f02918 Fix setColorWrite(bool) variant; 2022-08-26 22:23:13 -07:00
bjorn 7aebde2f92 Fix StencilAction; 2022-08-26 22:23:04 -07:00
bjorn cf474fe392 Shader flags can start with flag_;
It will be ignored for matching purposes.
2022-08-26 10:22:53 -07:00
bjorn 8e44a271df Fix default mipmap count for texture views; 2022-08-26 09:58:01 -07:00
bjorn 5a2fe54c04 Improve Pass:fill;
It can now fill an array texture to a multiview pass, copying to
the corresponding layers.
2022-08-26 09:57:51 -07:00
bjorn d655daf213 Better Pass:send('var', nil) error; 2022-08-25 23:54:11 -07:00
bjorn f4f95a64d7 Pass blends by default; 2022-08-25 22:01:12 -07:00
bjorn 78214988a4 Model only reskins when needed;
Saves a barriers when not animating models.
2022-08-25 21:59:10 -07:00
bjorn ede1036694 Temporary Passes;
Sigh, back to getPass.  I don't even know at this point.  Basically now
that we came up with a half-solution for temp buffers, it makes sense to
apply this to passes as well, since we aren't going with the workstream
idea and temp passes are more convenient than retained passes.
2022-08-25 21:57:15 -07:00
bjorn 18413114ad Fix depthClamp; 2022-08-24 03:09:09 -07:00
bjorn d3c93634ad Fix KTX1 cube/array loading; 2022-08-23 20:17:19 -07:00
bjorn 0496b81f23 Improve KTX1 error messages; 2022-08-23 20:16:58 -07:00
bjorn b8df6f9651 Fix rg11b10f KTX1 loading, I think; 2022-08-23 20:15:36 -07:00
bjorn 1a809666ec Fix loading KTX files with mipmaps;
Forgot to allocate memory for mipmaps.
2022-08-23 20:15:16 -07:00
bjorn fcf64cb6e4 Pass:send supports tables; 2022-08-23 19:25:45 -07:00
bjorn f45706f875 Change Buffer format 'name' to 'location' string;
Name is confusing because it seems like it supports key/value setting.
2022-08-23 19:17:54 -07:00
bjorn 1c48578e95 Fix automipmap synchronization; 2022-08-23 18:49:11 -07:00
bjorn e4024d82c4 Improve error messages for invalid view index; 2022-08-23 18:18:44 -07:00
bjorn 8dfc67d59c Add missing checks for automipmap transfer usage; 2022-08-23 18:17:38 -07:00
bjorn a4241db04f Add shorthand for procedural vertex rendering;
Instead of a vertex buffer, you can specify a vertex count.
2022-08-22 21:00:14 -07:00
bjorn ebf049e9d1 Model:resetNodeTransforms; 2022-08-22 20:44:01 -07:00
bjorn 79cd7c10a1 Improve temporary buffers;
- They no longer live in temporary memory, but in a dedicated pool.
- There are error checks for using a temporary buffer after it's invalid
  - However, these are imperfect, and could be improved.  One idea is to
    avoid recycling a temporary buffer until its refcount decays (i.e.
    Lua finally decides to garbage collect it).  This would explode
    memory usage sometimes, so it could only be enabled when
    t.graphics.debug is true.
2022-08-22 20:30:09 -07:00
bjorn 10252686aa Fix typo; 2022-08-22 20:18:47 -07:00
bjorn f914b6fcf1 Fix memory leak with shader cache; 2022-08-22 20:18:34 -07:00
bjorn 8b83626051 Increase size of swapchain format array; 2022-08-20 11:03:14 -07:00
bjorn dd5e89523d Fix BC1/BC4 sizes; 2022-08-19 23:15:18 -07:00
bjorn 460ae0f6a0 Fix Pass:send('bool', bool); 2022-08-19 22:26:20 -07:00
bjorn ba7bdd11c3 Fix index FieldType shorthand; 2022-08-19 20:51:50 -07:00
Josip Miskovic 6ba902ba1c Fix SPV type conversion for vec 2022-08-19 20:10:58 -07:00
Josip Miskovic fcc684ac28 Handle fullscreen fill without texture 2022-08-18 09:04:42 -07:00
Josip Miskovic 0cea42fb08 Fix default Image format 2022-08-18 09:04:42 -07:00
bjorn f515346e20 Rename CoordinateSpace;
It's now OriginType, and global -> root and local -> parent.
2022-08-17 22:33:43 -07:00
bjorn f570ee980c Add Model:getMaterialName; 2022-08-17 22:05:05 -07:00
bjorn 7087cef57f Fix bug with Image -> Texture copies; 2022-08-17 18:09:12 -07:00
bjorn 3e8b1681df Pass:mesh supports baseVertex; 2022-08-17 18:09:04 -07:00
bjorn 081afc3140 No more special-cased orthographic projection; 2022-08-17 18:08:38 -07:00
bjorn 817ed9f4e9 ModelData:getMeshIndex is 1-based; 2022-08-17 18:08:26 -07:00
bjorn 8bbff5dd77 lovr.graphics.present idempotence; 2022-08-14 12:02:51 -07:00
bjorn 74048a6345 Fix float specialization constants; 2022-08-14 09:42:54 -07:00