Commit Graph

193 Commits

Author SHA1 Message Date
Bjorn d23164235b
Merge pull request #732 from bjornbytes/model-vertex-compression
Model Vertex Compression
2024-01-31 13:35:58 -08:00
bjorn dacc17e1b7 Fix errhand loop when debug library is unavailable; 2024-01-24 17:54:07 -08:00
bjorn 40d85c6a16 Model uses sn10x3 normals and tangents;
This shaves 20 bytes off of each model vertex, or around 40% savings.
The vertex size is also a power of two which results in extreme amounts
of style points.
2024-01-20 17:39:36 -08:00
bjorn 1b1bc182bf Fix cubemap orientation;
+Z is the front face in a cubemap, not -Z.  Currently cubemap faces are
flipped in both the X and Z directions.

Some kind of flip is required because cubemaps use a left-handed
coordinate space instead of lovr's/vulkan's right-handed coordinate
space.

Equirect does not need any changes.
2024-01-06 13:58:14 -08:00
bjorn d29e6c2ec3 Fix warning message when requiring module fails; 2024-01-05 14:23:34 -08:00
bjorn 6c93e87560 Add back --console argument; 2023-12-02 18:23:16 -08:00
bjorn 987c029479 Add back graphics module check to errhand; 2023-12-01 16:50:45 -08:00
bjorn afd11cf0b9 Fix pcall and only use nogame conf for nogame; 2023-11-27 19:02:31 -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 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 275b63a731 Change offset to seated in default conf;
This was innocuous, but incorrect.
2023-11-21 13:02:01 -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 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 8d58ad8533 errhand doesn't use lovr.graphics.isInitialized; 2023-11-06 15:52:44 -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 9f33a83ae8 Add Vulkan requirement to Android manifest; 2023-10-20 14:48:29 -07:00
bjorn 6a83ef9678 Fix lovr.quit to not get called twice when aborting quit; 2023-10-18 12:58:49 -07:00
bjorn 1d6f3afc34 v0.17.0; 2023-10-14 19:36:19 -07:00
bjorn fecb0c27d5 Fix nogame screen when headset module is disabled; 2023-09-30 01:46:51 -07:00
bjorn 7486108462 Add gammaToLinear and linearToGamma shader helpers; 2023-09-28 05:10:26 -07:00
bjorn 73b1b951f5 Model:clone has separate blend shape state; 2023-09-24 23:51:42 -07:00
bjorn 0fcbdcbf5d Fixup overlay order;
- state.features.overlay should remain a bool since it just indicates
  whether the extension is supported/enabled.
- split the config value into a bool/u32 pair so the full u32 range can
  be used for the order (seems important to coordinate with other apps).
  - Also you can use a boolean now like before, which uses 0 as the order.
2023-08-21 15:15:39 -07:00
Bjorn f8f9c833b1
Merge branch 'dev' into master 2023-08-21 14:59:53 -07:00
BabbleBones 6fbfc16f7d feat: overlay layers 2023-08-18 11:30:58 -04:00
bjorn 003d69ea94 Make Surface more flexible;
- Add newSurface, which returns a "blank" surface, allowing you to set
  your own properties.
- Add finalizeSurface, which sets computed surface properties and clamps
  values to prepare for lighting.
- Add applyMaterial, which takes all of the properties in the material
  and applies them to a surface
- Add helper functions for getting properties from the Material, which
  combine scalar factors and texture samples while respecting shader
  flags:
  - getMaterialBaseColor
  - getMaterialEmissive
  - getMaterialMetalness
  - getMaterialRoughness
  - getMaterialOcclusion
  - getMaterialClearcoat
  - getMaterialClearcoatRoughness
- Add getDefaultSurface, which returns what initSurface would result in
  today, deprecating initSurface.
2023-08-02 18:11:36 -07:00
bjorn 339e6cf94b Shrink DrawData from 128 to 64 bytes!;
- Last row of transform matrix is unused, make it 4x3
  - Requires funny row-major packing due to vec3 std140 padding.
  - Teach spirv parser to tolerate non-square matrix types, though
    they aren't supported anywhere else yet.
- Compute cofactor in shader for normal matrix, ALU is free,
  optimize out many terms, rm maf_cofactor.
- Take out complex UBO alignment logic since stuff is PO2 these days.

This was a common bottleneck for some workloads, so there are measurable
performance gains (up to 2x faster pass submission on CPU).  GPU time is
identical, at least on desktop.
2023-08-01 18:57:09 -07:00
bjorn 2e6f95f06a Fix errhand when headset module is disabled; 2023-07-17 00:10:02 -07:00
xiejiangzhi 8542624895 Fix boot.lua without math.globals 2023-07-17 10:11:22 +08:00
bjorn 74325d81a1 Expose runtime name in lovr.headset.getDriver; 2023-07-10 19:35:21 -07:00
bjorn 0d30055dd7 webgpu/wasm updates;
Some compile fixes and a rename from gpu_wgpu to gpu_web, since wgpu
refers to a specific implementation of WebGPU and I'm really bad at
typing it for some reason.
2023-07-09 13:13:58 -07:00
bjorn 10c2c75482 Frustum culling;
- Adds Pass:setViewCull to enable/disable frustum culling.
- Renames Pass:setCullMode to Pass:setFaceCull (with backcompat).

Some stuff currently missing:

- Text is not culled, but should be.
- VR view frusta are not merged yet.
2023-07-07 14:51:22 -07:00
bjorn 6e018b8c96 Replace HeadsetOrigin with 'seated' flag;
Origin type used to be a query-able property of the VR system that
indicated whether the tracking was roomscale or seated-scale.

The t.headset.offset config value could be used to design an
origin-agnostic experience, which by default shifted content up 1.7
meters when tracking was seated-scale.  That way, stuff rendered at
y=1.7m was always at "eye level".  It worked pretty well.

It's getting replaced with a t.headset.seated flag.

- If seated is false (the default), the origin of the coordinate space
  will be on the floor, enabling the y=1.7m eye level paradigm.  If
  tracking is not roomscale, a floor offset of 1.7m will be emulated.
- If seated is true, the origin of the coordinate space will be y=0
  at eye level (where the headset was when the app started).  This is
  the case on both roomscale and seated-scale tracking.

So basically 'seated' is an opt-in preference for where the app wants
its vertical origin to be.

One advantage of this is that it's possible to consistently get a y=0
eye level coordinate space, which was not possible before.  This makes
it easier to design simpler experiences that only need to render a
floating UI and don't want to render a full environment or deal with
offsetting everything relative to a 'floor'.  This also makes it easier
to implement hybrid VR+flatscreen experiences, because the camera is at
y=0 when the headset module is disabled.

The opt-in nature of the flag, coupled with the fact that it is
consistent across all types of tracking and hardware, is hopefully a
more useful design.
2023-06-28 16:38:36 -07:00
bjorn 3f0dbeb595 Add lovr.headset.stopVibration; 2023-06-27 20:45:44 -07:00
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 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
bjorn a723ec7c5c Update error screen;
The error screen uses an orthographic projection when rendered in a
window, so the text is always the same size instead of scaling with the
window size.

Also you can close it with escape.
2023-05-12 17:16:22 +01:00
bjorn 61fe0f3bc0 Default errhand uses transparent background in AR; 2023-05-12 14:31:31 +01:00
bjorn 776a709de1 nogame: quit on escape; 2023-05-12 14:30:47 +01:00
bjorn b8a8aa2755 nogame: only set background color in VR; 2023-05-12 14:28:53 +01:00
bjorn 264bfdeadf Use lovr.system.pollEvents in lovr.errhand; 2023-05-10 18:14:09 +01:00