Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 110 additions & 72 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ resolver = "2"

# Sub packages provided by lambda.
members = [
"crates/lambda-rs",
"crates/lambda-rs-args",
"crates/lambda-rs-logging",
"crates/lambda-rs-platform",
"tools/obj_loader"
"crates/lambda-rs",
"crates/lambda-rs-args",
"crates/lambda-rs-logging",
"crates/lambda-rs-platform",
"tools/obj_loader",
]

default-members = [
"crates/lambda-rs",
"crates/lambda-rs-args",
"crates/lambda-rs-logging",
"crates/lambda-rs-platform",
"tools/obj_loader"
"crates/lambda-rs",
"crates/lambda-rs-args",
"crates/lambda-rs-logging",
"crates/lambda-rs-platform",
"tools/obj_loader",
]
161 changes: 102 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
![lambda-rs](https://img.shields.io/crates/v/lambda-rs)

## Table of contents

1. [Description](#description)
1. [API Documentation](#documentation)
1. [Building](#building)
Expand All @@ -23,13 +24,16 @@
1. [Releases & Publishing](#publishing)
1. [How to contribute](#contribute)
1. [Resources](#resources)

## Description <a name="description"></a>

Lambda is a framework for developing cross platform applications and workloads using Rust.

Lambda aims to enable developers to create highly performant, portable, and
minimal desktop applications by providing a platform agnostic API for all of the features that any application or workload might need.

Lambda :

* Desktop applications
* Productivity tools
* Data visualizations
Expand All @@ -49,11 +53,13 @@ lightweight HTML/CSS based rendering in the future but we're primarily focused
on implementing a Rust native UI framework built on top of our rendering engine.

## Documentation <a name="documentation"></a>

* [lambda-rs API documentation](https://docs.rs/lambda-rs/2023.1.29/lambda/)

## Installation <a name="building"></a>

### From crates.io <a name="crates"></a>

lambda is now available on [crates.io](https://crates.io/crates/lambda-rs)
and can be added to your project by adding the following to your
`Cargo.toml` file:
Expand All @@ -64,142 +70,178 @@ lambda-rs = "2023.1.30"
```

or from the CLI:

```bash
cargo add lambda-rs
```

### From source <a name="source"></a>

#### Required external dependencies <a name="ext_deps"></a>

* All platforms
* `cmake >= 3.20.0` is needed to build shaderc from source.
* `ninja` is needed to build shaderc from source.
* `git` is needed to clone the project and manage it's dependencies.
* `git-lfs` is needed for asset files.
* `rust >= 1.60` is needed for compiling lambda and all of it's crates.
* `pre-commit` is used for development git commit hooks and any changes that do not pass the pre-commit checks will not be accepted.
* `cmake >= 3.20.0` is needed to build shaderc from source.
* `ninja` is needed to build shaderc from source.
* `git` is needed to clone the project and manage it's dependencies.
* `git-lfs` is needed for asset files.
* `rust >= 1.60` is needed for compiling lambda and all of it's crates.
* `pre-commit` is used for development git commit hooks and any changes that do not pass the pre-commit checks will not be accepted.

#### Rendering API support

These are the Rendering APIs that are supported on each platform and must be
installed manually. More information on how to choose which backend lambda
uses on each platform is provided further below.

* Windows
* `OpenGL`
* `Vulkan`
* `DirectX11`
* `DirectX12`
* `OpenGL`
* `Vulkan`
* `DirectX11`
* `DirectX12`
* Linux
* `OpenGL`
* `Vulkan`
* `OpenGL`
* `Vulkan`
* MacOS
* `Metal`
* `Vulkan`
* `Metal`
* `Vulkan`

#### Linux (bash), MacOS (bash), Windows (git-bash) <a name="bash"></a>

If planning to develop for lambda, you must run the setup script provided by repository like so:

```bash
./scripts/setup.sh
```

This will initialize pre commit checks for development use and setup git-lfs for asset management.

In order to validate that lambda successfully compiles, you can build the library by performing a build with cargo.

```bash
cargo build --lib
```

If this works successfully, then lambda is ready to work on your system!

## Getting started <a name="get_started"></a>

Coming soon.

## Tutorials <a name="tutorials"></a>

Start with the tutorials to build features step by step:

- Tutorials index: [docs/tutorials/](./docs/tutorials/)
- Uniform Buffers: Build a Spinning Triangle: [docs/tutorials/uniform-buffers.md](./docs/tutorials/uniform-buffers.md)
* Tutorials index: [docs/tutorials/](./docs/tutorials/)
* Uniform Buffers: Build a Spinning Triangle: [docs/tutorials/uniform-buffers.md](./docs/tutorials/uniform-buffers.md)

## Examples <a name="examples"></a>

Browse example sources:

- Core API examples: [crates/lambda-rs/examples/](./crates/lambda-rs/examples/)
- Logging examples: [crates/lambda-rs-logging/examples/](./crates/lambda-rs-logging/examples/)
- Argument parsing examples: [crates/lambda-rs-args/examples/](./crates/lambda-rs-args/examples/)
* Core API examples: [crates/lambda-rs/examples/](./crates/lambda-rs/examples/)
* Logging examples: [crates/lambda-rs-logging/examples/](./crates/lambda-rs-logging/examples/)
* Argument parsing examples: [crates/lambda-rs-args/examples/](./crates/lambda-rs-args/examples/)

### Minimal

A minimal example of an application with a working window using lambda.

```rust
cargo run --example minimal
```

### Push Constants
An example of using shaders with push constants to render a 3D image.
### Immediates

An example of using shaders with immediates (per-draw data) to render a 3D image.

```rust
cargo run --example push_constants
cargo run --example immediates
```

#### Notes

* On windows, you need to run this example with
`--features lambda-rs/with-vulkan` as the shader used in the example does not work
in either dx11 or dx12.

### Triangle

An example using shaders to render a single triangle.

```rust
cargo run --example triangle
```

### Triangles

An example using shaders to render multiple triangles and keyboard input to move one of the triangles on screen.

```rust
cargo run --example triangles
```

## Plans <a name="plans"></a>
- ### Architecture support
- [x] x86
- [x] arm64
- ### Operating system support
- [x] MacOS
- [x] Linux
- [x] Windows 10/11
- [ ] Xbox Series S|X (Long term goal)
- [ ] iOS (Long term goal)
- [ ] Android (Long term goal)
- ### Rendering API support
- [x] OpenGL
- [x] Vulkan
- [x] Metal
- [x] DirectX11
- [x] DirectX12
- ### Packages
- [x] (WIP) [lambda-rs-args](./crates/lambda-rs-args/README.md) -- Command line argument parsing.
- [x] (WIP) [lambda-rs-platform](./crates/lambda-rs-platform/README.md) -- Dependency wrappers & platform support.
- [x] [lambda-rs-logging](./crates/lambda-rs-logging/README.md) -- Lightweight Logging API for lambda-rs packages.
- [x] (WIP) [lambda-rs](./crates/lambda-rs/README.md) -- The public Lambda API.
- ### Examples
- [x] Minimal -- A minimal example of an application with a working window

* ### Architecture support

* [x] x86
* [x] arm64

* ### Operating system support

* [x] MacOS
* [x] Linux
* [x] Windows 10/11
* [ ] Xbox Series S|X (Long term goal)
* [ ] iOS (Long term goal)
* [ ] Android (Long term goal)

* ### Rendering API support

* [x] OpenGL
* [x] Vulkan
* [x] Metal
* [x] DirectX11
* [x] DirectX12

* ### Packages

* [x] (WIP) [lambda-rs-args](./crates/lambda-rs-args/README.md) -- Command line argument parsing.
* [x] (WIP) [lambda-rs-platform](./crates/lambda-rs-platform/README.md) -- Dependency wrappers & platform support.
* [x] [lambda-rs-logging](./crates/lambda-rs-logging/README.md) -- Lightweight Logging API for lambda-rs packages.
* [x] (WIP) [lambda-rs](./crates/lambda-rs/README.md) -- The public Lambda API.

* ### Examples

* [x] Minimal -- A minimal example of an application with a working window
using lambda.
- [x] Push Constants -- An example of using shaders with push constants to
* [x] Immediates -- An example of using shaders with immediate data to
render a 3D image.
- [x] Triangle -- An example using shaders to render a single triangle.
- [x] Triangles -- An example using shaders to render multiple triangles and keyboard input to move one of the triangles on screen.
- ### Tools
- [x] obj-loader -- (WIP) Loads .obj files into lambda. Meshes need to be triangulated in order for it to render at the moment.
- [ ] platform-info -- Utility for viewing information about the current platform.
- ### CI/CD
- [x] Github action pipelines for building lambda on all platforms.
- [ ] Github action pipelines for creating downloadable builds from releases.
- [ ] Tests & benchmarking.
- [ ] Unit tests.
- [ ] Nightly builds.
* [x] Triangle -- An example using shaders to render a single triangle.
* [x] Triangles -- An example using shaders to render multiple triangles and keyboard input to move one of the triangles on screen.

* ### Tools

* [x] obj-loader -- (WIP) Loads .obj files into lambda. Meshes need to be triangulated in order for it to render at the moment.
* [ ] platform-info -- Utility for viewing information about the current platform.

* ### CI/CD

* [x] Github action pipelines for building lambda on all platforms.
* [ ] Github action pipelines for creating downloadable builds from releases.
* [ ] Tests & benchmarking.
* [ ] Unit tests.
* [ ] Nightly builds.

## Releases & Publishing <a name="publishing"></a>

For cutting releases, publishing crates to crates.io, and attaching
multi-platform artifacts to GitHub Releases, see:

- docs/publishing.md

* docs/publishing.md

## How to contribute <a name="contribute"></a>

Fork the current repository and then make the changes that you'd like to
said fork. Stable releases will happen within the main branch requiring that
additions to be made off of `dev` which is the nightly build branch for lambda.
Expand All @@ -211,6 +253,7 @@ changes made, my schedule, and any other variable factors. They must also pass
all of the build pipelines are configured to run at merge.

## Resources <a name="resources"></a>

[The Cherno's playlist for making a game engine](https://www.youtube.com/playlist?list=PLlrATfBNZ98dC-V-N3m0Go4deliWHPFwT)

[Creator of Logo](https://github.com/RinniSwift)
41 changes: 30 additions & 11 deletions crates/lambda-rs-platform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,47 @@ path = "src/lib.rs"
[dependencies]
winit = "=0.29.15"
shaderc = { version = "=0.7", optional = true, default-features = false }
naga = { version = "=26.0.0", optional = true, default-features = false, features = ["spv-out", "glsl-in", "wgsl-in"] }
naga = { version = "=28.0.0", optional = true, default-features = false, features = [
"spv-out",
"glsl-in",
"wgsl-in",
] }
rand = "=0.8.5"
obj-rs = "=0.7.0"
wgpu = { version = "=26.0.1", optional = true, features = ["wgsl", "spirv"] }
wgpu = { version = "=28.0.0", optional = true, features = ["wgsl", "spirv"] }
pollster = { version = "=0.4.0", optional = true }
lambda-rs-logging = { path = "../lambda-rs-logging", version = "2023.1.30" }

# Force windows crate to 0.62 to unify wgpu-hal and gpu-allocator dependencies.
# Both crates support this version range, but Cargo may resolve to different
# versions without this explicit constraint.
[target.'cfg(windows)'.dependencies]
windows = "0.62"

[dev-dependencies]
mockall = "=0.11.3"

[features]
default=["wgpu", "shader-backend-naga"]
default = ["wgpu", "shader-backend-naga"]

shader-backend-naga=["dep:naga"]
shader-backend-shaderc=["dep:shaderc"]
shader-backend-shaderc-build-from-source=["shader-backend-shaderc", "shaderc/build-from-source"]
shader-backend-naga = ["dep:naga"]
shader-backend-shaderc = ["dep:shaderc"]
shader-backend-shaderc-build-from-source = [
"shader-backend-shaderc",
"shaderc/build-from-source",
]

wgpu=["dep:wgpu", "dep:pollster", "wgpu/wgsl", "wgpu/spirv", "shader-backend-naga"]
wgpu-with-vulkan=["wgpu"]
wgpu-with-metal=["wgpu", "wgpu/metal"]
wgpu-with-dx12=["wgpu", "wgpu/dx12"]
wgpu-with-gl=["wgpu", "wgpu/webgl"]
wgpu = [
"dep:wgpu",
"dep:pollster",
"wgpu/wgsl",
"wgpu/spirv",
"shader-backend-naga",
]
wgpu-with-vulkan = ["wgpu"]
wgpu-with-metal = ["wgpu", "wgpu/metal"]
wgpu-with-dx12 = ["wgpu", "wgpu/dx12"]
wgpu-with-gl = ["wgpu", "wgpu/webgl"]

[profile.dev]
crate-type = ["cdylib", "rlib"]
Expand Down
Loading
Loading