Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ main, style_checks ]
branches: [ master, main, style_checks ]
pull_request:
branches: [ main, style_checks ]
branches: [ master, main, style_checks ]

env:
CARGO_TERM_COLOR: always
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Style

on:
push:
branches: [ main, style_checks ]
branches: [ master, main, style_checks ]
pull_request:
branches: [ main, style_checks ]
branches: [ master, main, style_checks ]

jobs:
check_clippy:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ cargo run --release
We are using GLSL shaders. There is no auto-compilation to SPV right now, so please use `glslc`:

```
glslc -fshader-stage=vertex src/models/shaders/only_mesh.vert.glsl -o src/models/shaders/only_mesh.vert.spv
glslc -fshader-stage=fragment src/models/shaders/only_mesh.frag.glsl -o src/models/shaders/only_mesh.frag.spv
glslc -fshader-stage=vertex src/models/shaders/skin_mesh.vert.glsl -o src/models/shaders/skin_mesh.vert.spv
glslc -fshader-stage=fragment src/models/shaders/skin_mesh.frag.glsl -o src/models/shaders/skin_mesh.frag.spv
glslc -fshader-stage=vertex src/models/shaders/only_mesh.vert -o src/models/shaders/only_mesh.vert.spv
glslc -fshader-stage=fragment src/models/shaders/only_mesh.frag -o src/models/shaders/only_mesh.frag.spv
glslc -fshader-stage=vertex src/models/shaders/skin_mesh.vert -o src/models/shaders/skin_mesh.vert.spv
glslc -fshader-stage=fragment src/models/shaders/skin_mesh.frag -o src/models/shaders/skin_mesh.frag.spv
```

## Sponsors
Expand Down
42 changes: 42 additions & 0 deletions src/graphics/vulkan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,27 @@ impl Gpu {
self.device.vk_device.destroy_buffer(buffer, None);
}

/// # Safety
///
/// This function requires valid Vulkan entities
#[inline(always)]
pub unsafe fn create_sampler(
&self,
sampler_create_info: &vk::SamplerCreateInfo,
) -> Result<vk::Sampler, vk::Result> {
self.device
.vk_device
.create_sampler(sampler_create_info, None)
}

/// # Safety
///
/// This function requires valid Vulkan entities
#[inline(always)]
pub unsafe fn destroy_sampler(&self, sampler: vk::Sampler) {
self.device.vk_device.destroy_sampler(sampler, None);
}

/// # Safety
///
/// This function requires valid Vulkan entities
Expand Down Expand Up @@ -1035,6 +1056,27 @@ impl Gpu {
)
}

/// # Safety
///
/// This function requires valid Vulkan entities
#[allow(clippy::too_many_arguments)]
pub unsafe fn cmd_copy_buffer_to_image(
&self,
command_buffer: vk::CommandBuffer,
src_buffer: vk::Buffer,
dst_image: vk::Image,
dst_image_layout: vk::ImageLayout,
regions: &[vk::BufferImageCopy],
) {
self.device.vk_device.cmd_copy_buffer_to_image(
command_buffer,
src_buffer,
dst_image,
dst_image_layout,
regions,
);
}

// Utils
pub fn find_memory_type_index(
&self,
Expand Down
9 changes: 6 additions & 3 deletions src/models/materials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use super::{Color, Image};
use crate::loaders::Asset;
use crate::utils::Id;

// NOTE: 1:albedo_map, 2:occlusion_map, 3:metallic_map, 4:normal_map, 5:roughness_map
pub const MAX_MATERIAL_IMAGES: u32 = 5;

/// Material component
#[derive(Debug)]
pub struct Material {
Expand Down Expand Up @@ -51,10 +54,10 @@ pub struct MaterialUniform {
pub color: [f32; 4],
/// Order: ambient_occlusion, metallic, roughness
pub options: [f32; 4],
/// Indices of PBR maps in the buffer
/// Order: ambient_occlusion, metallic, normal, roughness
pub maps_1: [u32; 4],
/// Index of Color map in the buffer + 3 reserved value¨
pub maps_1: [u32; 4],
/// Indice2 of PBR maps in the buffer
/// Order: ambient_occlusion, metallic, normal, roughness
pub maps_2: [u32; 4],
}

Expand Down
Loading
Loading