Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
8e1e466
[add] basic vector operations.
vmarcella Oct 19, 2022
36f9f5c
[rename] types.
vmarcella Oct 19, 2022
5f3e2bf
[update] internal modules to only be acessible via crates, fix render…
vmarcella Oct 22, 2022
d963ca3
[fix] high level rendering logic.
vmarcella Oct 22, 2022
4f03d83
[add] various minor changes.
vmarcella Oct 22, 2022
c3606fe
[update] event loop to send events to the components immediately.
vmarcella Oct 22, 2022
71ce73d
[add] a new vulkan push constants demo & add a translation function f…
vmarcella Nov 4, 2022
6b73942
[add] vector trait.
vmarcella Nov 13, 2022
383367e
[update] vector trait and implement functions for Vector2.
vmarcella Nov 14, 2022
9974b33
[remove] free functions and implement all vector traits and vector2 …
vmarcella Nov 18, 2022
9c97e9f
[add] a matrix trait type and update vector test modules.
vmarcella Nov 19, 2022
5cd01c4
[add] vector 3 tests and fix incomplete example.
vmarcella Nov 19, 2022
40f80c0
[add] a matrix4x4 implementation block and implement the multiply fun…
vmarcella Nov 19, 2022
d9f82e9
[add] the identity function.
vmarcella Nov 19, 2022
dd5332d
[add] transform implementation.
vmarcella Nov 20, 2022
6c8cc3b
[add] transform function.
vmarcella Nov 20, 2022
1d2f415
[add] vector and matrix modules to separate implementations.
vmarcella Nov 20, 2022
0f497d2
Merge branch 'main' into vmarcella/math-library
vmarcella Nov 25, 2022
1ad0b12
[update] matrix multiplications.
vmarcella Nov 25, 2022
96af5e8
[update] matrix traits and remove redundant traits.
vmarcella Nov 26, 2022
9071846
[add] rand package for random number generation.
vmarcella Nov 27, 2022
f34dcd2
[add] traits for common matrix initializers and properties.
vmarcella Nov 27, 2022
8134335
[add] two functions for sampling random numbers.
vmarcella Nov 27, 2022
5e096f3
[add] a random initializer for mat4x4.
vmarcella Nov 27, 2022
92040c4
[add] todo.
vmarcella Nov 27, 2022
2bfdf34
[add] generic implementations of MatrixProperties for all Matrix deri…
vmarcella Nov 27, 2022
55c9338
[update] naming.
vmarcella Nov 27, 2022
7093a42
[add] matrix tests.
vmarcella Nov 27, 2022
3019a7b
[add] start/stop parameters for random initialization and tests.
vmarcella Nov 28, 2022
bef2c39
[update] vector implementation to not be around tuples & generalize t…
vmarcella Dec 17, 2022
2aac3df
[update] vector implementations to not utilize Vector allocations for…
vmarcella Dec 18, 2022
3798cfe
[fix] cross product implementation and add tests for the dot product …
vmarcella Dec 25, 2022
f07f96e
[add] test for vector length.
vmarcella Dec 25, 2022
8355462
[add] tests for vector normalization.
vmarcella Dec 25, 2022
9ea46f9
[add] scale test.
vmarcella Dec 30, 2022
ee227b0
[add] matrix implementations.
vmarcella Dec 30, 2022
e82b3ae
[add] square matrix multiplications & initial matrix tests.
vmarcella Dec 31, 2022
d613bea
[add] addition/subtraction tests.
vmarcella Dec 31, 2022
75b3f17
[update] transpose implementation.
vmarcella Dec 31, 2022
a5383aa
[add] test for square matrix transpose.
vmarcella Dec 31, 2022
0c2b6b8
[add] a matrix determinant implementation utilizing laplace expansion.
vmarcella Jan 2, 2023
8909dc0
[add] test for non square matrix determinant calls.
vmarcella Jan 3, 2023
334f22b
[update] matrix implementations, add submatrix function for slicing a…
vmarcella Jan 9, 2023
3b6f5ef
[add] generic translation matrix implementation.
vmarcella Jan 14, 2023
cd7cc38
[remove] redundant matrices.
vmarcella Jan 14, 2023
6983f5e
[add] basic perspective matrix implementation for 4x4 matrices.
vmarcella Jan 14, 2023
9d2bb2d
[update] fov in perspective test to be 1/4 turns (90 degrees) & add m…
vmarcella Jan 14, 2023
50869a4
[remove] unused code.
vmarcella Jan 14, 2023
96fd91c
[add] matrix rotations for 4x4 matrices & tests to validate.
vmarcella Jan 15, 2023
3018d8c
[update] pipeline so that the fragment shader is optional, add render…
vmarcella Jan 15, 2023
4b8328d
[add] vertex buffer & mesh structs for implementing meshes.
vmarcella Jan 17, 2023
7ba90aa
[add] mesh and vertex builders alongside tests.
vmarcella Jan 17, 2023
46566dd
[update] push constants example.
vmarcella Jan 17, 2023
af0b7db
[add] buffer implementation for gpu memory allocations, update matrix…
vmarcella Jan 17, 2023
dce03c9
[add] buffer allocations.
vmarcella Jan 17, 2023
c90ba3a
[add] documentation.
vmarcella Jan 17, 2023
80bab08
[update] buffer to fill data upon being built, implement buffer alloc…
vmarcella Jan 17, 2023
f9bdb39
[add] high level buffer implementation & introduce buffer types for u…
vmarcella Jan 18, 2023
41871eb
[update] the pipeline to support vertex buffers & attributes.
vmarcella Jan 19, 2023
d1ef60b
[update] how the render pipelines & primitive assembler process buffers.
vmarcella Jan 19, 2023
9e5fdf9
[update] Buffer & Mesh API, refactor internal api calls, implement ve…
vmarcella Jan 19, 2023
2aa4982
[fix] order.
vmarcella Jan 19, 2023
c015425
[fix] formatting for 3D demo.
vmarcella Jan 19, 2023
4044e7a
[update] render commands to support binding vertex buffers.
vmarcella Jan 20, 2023
2a8f379
[update] buffer flags, remove todo statements.
vmarcella Jan 20, 2023
e82d7e4
[fix] 3D demo to load the color to the correct location.
vmarcella Jan 20, 2023
53f3586
[update] mesh rendering in push_constants.
vmarcella Jan 20, 2023
1079b57
[add] comment.
vmarcella Jan 21, 2023
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
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions crates/lambda-platform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gfx-hal = "=0.9.0"
winit = "=0.27.5"
shaderc = "=0.7"
cfg-if = "=1.0.0"
rand = "=0.8.5"

# GFX-RS backends
gfx-backend-gl = { version="=0.9.0", optional = true }
Expand All @@ -33,6 +34,10 @@ gfx-with-metal=["dep:gfx-backend-metal"]
gfx-with-dx11=["dep:gfx-backend-dx11"]
gfx-with-dx12=["dep:gfx-backend-dx12"]

[profile.dev]
crate-type = ["cdylib", "rlib"]
incremental = true

[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies.gfx-platform-backend]
package = "gfx-backend-gl"
version = "=0.9.0"
Expand Down
3 changes: 1 addition & 2 deletions crates/lambda-platform/src/gfx/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ cfg_if::cfg_if! {
pub use gfx_backend_dx12 as RenderingAPI;
} else if #[cfg(feature = "detect-platform")] {
pub use gfx_platform_backend as RenderingAPI;
} else {
}
} else {}
}
72 changes: 64 additions & 8 deletions crates/lambda-platform/src/gfx/assembler.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,81 @@
//! Primitive assembly for the graphics pipeline.

use gfx_hal::pso;
pub use gfx_hal::pso::Element as VertexElement;
use gfx_hal::pso::{
self,
AttributeDesc,
VertexBufferDesc,
};

use super::{
buffer::Buffer,
surface::ColorFormat,
};

/// Attributes for a vertex.
#[derive(Debug, Clone)]
pub struct VertexAttribute {
pub location: u32,
pub offset: u32,
pub element: VertexElement<ColorFormat>,
}

/// PrimitiveAssemblerBuilder for preparing PrimitiveAssemblers to use in the
/// lambda-platform Rendering pipeline.
pub struct PrimitiveAssemblerBuilder {}
pub struct PrimitiveAssemblerBuilder {
buffer_descriptions: Vec<VertexBufferDesc>,
attribute_descriptions: Vec<AttributeDesc>,
}

impl PrimitiveAssemblerBuilder {
pub fn new() -> Self {
return Self {};
return Self {
buffer_descriptions: Vec::new(),
attribute_descriptions: Vec::new(),
};
}

/// Build a primitive assembler given the lambda-platform vertex shader
/// module.
/// module. Buffers & attributes do not have to be tied to
pub fn build<'shader, RenderBackend: gfx_hal::Backend>(
self,
&'shader mut self,
vertex_shader: &'shader super::shader::ShaderModule<RenderBackend>,
buffers: Option<&Vec<&Buffer<RenderBackend>>>,
attributes: Option<&[VertexAttribute]>,
) -> PrimitiveAssembler<'shader, RenderBackend> {
let binding = self.buffer_descriptions.len() as u32;

match (buffers, attributes) {
(Some(buffers), Some(attributes)) => {
println!(
"[DEBUG] Building primitive assembler with buffers and attributes"
);
self.buffer_descriptions = buffers
.iter()
.map(|buffer| VertexBufferDesc {
binding,
stride: buffer.stride() as u32,
rate: pso::VertexInputRate::Vertex,
})
.collect();

self.attribute_descriptions = attributes
.iter()
.map(|attribute| {
return AttributeDesc {
location: attribute.location,
binding,
element: attribute.element,
};
})
.collect();
}
_ => {}
}

let primitive_assembler = pso::PrimitiveAssemblerDesc::Vertex {
buffers: &[],
attributes: &[],
buffers: self.buffer_descriptions.as_slice(),
attributes: self.attribute_descriptions.as_slice(),
input_assembler: pso::InputAssemblerDesc::new(
pso::Primitive::TriangleList,
),
Expand Down Expand Up @@ -52,7 +108,7 @@ impl<'shader, RenderBackend: gfx_hal::Backend>

/// Internal functions for the primitive assembler. User applications most
/// likely should not use these functions directly nor should they need to.
pub mod internal {
pub(crate) mod internal {
#[inline]
pub fn into_primitive_assembler<'shader, RenderBackend: gfx_hal::Backend>(
primitive_assembler: super::PrimitiveAssembler<'shader, RenderBackend>,
Expand Down
Loading