mirror of https://github.com/bjornbytes/lovr.git
3775ed1be6
Fixes easily-encounterable GPU OOM on discrete cards. Currently when mapping CPU-accessible GPU memory, there are only two types of memory: write and read. The "write" allocations try to use the special 256MB pinned memory region, with the thought that since this memory is usually for vertices, uniforms, etc. it should be fast. However, this memory is also used for staging buffers for buffers and textures, which can easily exceed the 256MB (or 246MB on NV) limit upon creating a handful of large textures. To fix this, we're going to separate WRITE mappings into STREAM and STAGING. STREAM will act like the old CPU_WRITE mapping type and use the same memory type. STAGING will use plain host-visible memory and avoid hogging the precious 256MB memory region. STAGING also uses a different allocation strategy. Instead of creating a big buffer with a zone for each tick, it's a more traditional linear allocator that allocates in 4MB chunks and condemns the chunk if it ever fills up. This is a better fit for staging buffer lifetimes since there's usually a bunch of them at startup and then a small/sporadic amount afterwards. The buffer doesn't need to double in size, and it doesn't need to be kept around after the transfers are issued. The memory really is single-use and won't roll over from frame to frame like the other scratchpads. |
||
---|---|---|
deps | ||
etc | ||
src | ||
.gitignore | ||
.gitmodules | ||
CMakeLists.txt | ||
LICENSE | ||
README.md | ||
Tupfile.lua |
README.md
LÖVR
A simple Lua framework for rapidly building VR experiences.
You can use LÖVR to easily create VR experiences without much setup or programming experience. The framework is tiny, fast, open source, and supports lots of different platforms and devices.
Homepage | Documentation | FAQ
Features
- Cross-Platform - Runs on Windows, Mac, Linux, Android, WebXR.
- Cross-Device - Supports Vive/Index, Oculus Rift/Quest, Windows MR, and has a VR simulator.
- Beginner-friendly - Simple VR scenes can be created in just a few lines of Lua.
- Fast - Writen in C11 and scripted with LuaJIT, includes optimized single-pass stereo rendering.
- Asset Import - Supports 3D models (glTF, OBJ), skeletal animation, HDR textures, cubemaps, fonts, etc.
- Spatialized Audio - Audio is automatically spatialized using HRTFs.
- Vector Library - Efficient first-class support for 3D vectors, quaternions, and matrices.
- 3D Rigid Body Physics - Including 4 collider shapes, triangle mesh colliders, and 4 joint types.
- Compute Shaders - For high performance GPU tasks, like particles.
Getting Started
It's really easy to get started making things with LÖVR. Grab a copy of the executable from https://lovr.org/download,
then write a main.lua
script and drag its parent folder onto the executable. Here are some example projects to try:
Hello World
function lovr.draw(pass)
pass:text('Hello World!', 0, 1.7, -3, .5)
end
Spinning Cube
function lovr.draw(pass)
pass:cube(0, 1.7, -1, .5, lovr.timer.getTime())
end
Hand Tracking
function lovr.draw(pass)
for _, hand in ipairs(lovr.headset.getHands()) do
pass:sphere(vec3(lovr.headset.getPosition(hand)), .1)
end
end
3D Models
function lovr.load()
model = lovr.graphics.newModel('model.gltf')
end
function lovr.draw(pass)
pass:draw(model, x, y, z)
end
More examples are on the docs page.
Building
You can build LÖVR from source using CMake. Here are the steps using the command line:
mkdir build
cd build
cmake ..
cmake --build .
See the Compiling Guide for more info.
Resources
- Documentation: Guides, tutorials, examples, and API documentation.
- FAQ: Frequently Asked Questions.
- Slack Group: For general LÖVR discussion and support.
- Matrix Room: Decentralized alternative to Slack.
- Nightly Builds: Nightly builds for Windows.
- Compiling Guide: Information on compiling LÖVR from source.
- Contributing: Guide for helping out with development 💜
- LÖVE: LÖVR is heavily inspired by LÖVE, a 2D game framework.
Contributors
License
MIT, see LICENSE
for details.