Commit Graph

205 Commits

Author SHA1 Message Date
bjorn 26d17fc402 boot.lua: exit successfully when printing help; 2024-03-12 13:32:26 -07:00
Ilya 994f623c5d
Fix boot.lua merge
boot.lua was broken during merging with stable branch.
2024-03-12 23:12:29 +03:00
bjorn 2b218d09d0 Merge branch 'stable' into dev 2024-03-12 11:58:34 -07:00
bjorn 66f6ee9bb9 v0.17.1; 2024-03-12 11:56:30 -07:00
bjorn 1f6904c04b Fix errhand loop when debug library is unavailable;
(cherry picked from commit dacc17e1b7)
2024-03-12 11:02:00 -07:00
bjorn 5611a6130b 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.

(cherry picked from commit 1b1bc182bf)
2024-03-12 10:53:28 -07:00
bjorn a4c1d9fce6 Thread module initializes job system;
Worker count can be set from conf.lua.

A negative worker count is relative to the number of cores.

-1 is the default.
2024-02-28 12:31:34 -08:00
bjorn 6a669bd967 rm var shader macro;
It is no longer necessary, and wasn't widely used/documented.
2024-02-21 10:28:30 -08:00
bjorn 64e253a8ef mv logo shader to nogame bundle; 2024-02-21 10:21:42 -08:00
bjorn 81ef58d032 Use push constant instead of BaseInstance for DrawID;
This is a little slower, but means indirect draws can use Transform and Color.

There are other solutions for this.  For example LÖVR could reserve
BaseInstance and use a compute shader to rewrite indirect buffers.

For now we choose to be correct and a little slower.
2024-02-21 10:21:42 -08:00
bjorn 875a7f8237 Shader rework;
- Undeprecate ShaderType (it's good actually, kinda like a pipeline bind
  point and more specific than having lovr trying to make sense of a
  random set of stages).
- Use a default uniform block instead of push constants.  The Constants
  macro now maps to a uniform block declaration.
- It is no longer possible to create a shader by giving a single
  DefaultShader string (you can still give a per-stage DefaultShader
  though).
- lovr.graphics.compileShader now takes all stages instead of a single
  stage.  In general we need all stages when compiling GLSL because
  default uniforms require linking across stages.
2024-02-21 10:21:41 -08:00
bjorn 93348499e9 Binding numbers are assigned explicitly and merged across stages; 2024-02-20 10:16:41 -08:00
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