Skip to content

Commit fdeacb0

Browse files
committed
Update to spirv-std 0.6.0
1 parent d68093b commit fdeacb0

File tree

7 files changed

+22
-33
lines changed

7 files changed

+22
-33
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
crate_type = ["dylib", "rlib"]
88

99
[dependencies]
10-
bitflags = "1.3.2"
11-
spirv-std = { version = "0.5.0", features = ["glam"] }
10+
bitflags = "2.0.1"
11+
spirv-std = "0.6.0"
1212
permutate-macro = { git = "https://github.com/Bevy-Rust-GPU/permutate-macro", tag = "v0.4.0" }
13-
rust-gpu-bridge = { git = "https://github.com/Bevy-Rust-GPU/rust-gpu-bridge", tag = "v0.3.0", features = ["spirv-std"] }
13+
rust-gpu-bridge = { git = "https://github.com/Bevy-Rust-GPU/rust-gpu-bridge", branch = "master", features = ["spirv-std"] }

rust-toolchain

Lines changed: 0 additions & 14 deletions
This file was deleted.

rust-toolchain.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[toolchain]
2+
channel = "nightly-2023-01-21"
3+
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
4+
# commit_hash = 5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14
5+
6+
# Whenever changing the nightly channel, update the commit hash above, and make
7+
# sure to change REQUIRED_TOOLCHAIN in crates/rustc_codegen_spirv/src/build.rs also.

src/environment_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ impl EnvironmentMap for EnvironmentMapLight {
7878
let radiance_level =
7979
perceptual_roughness * (lights.environment_map_smallest_specular_mip_level) as f32;
8080
let irradiance = environment_map_diffuse
81-
.sample::<f32, Vec4>(*environment_map_sampler, n)
81+
.sample::<f32>(*environment_map_sampler, n)
8282
.truncate();
8383
let radiance = environment_map_specular
84-
.sample_by_lod::<f32, Vec4>(*environment_map_sampler, r, radiance_level)
84+
.sample_by_lod::<f32>(*environment_map_sampler, r, radiance_level)
8585
.truncate();
8686

8787
// Multiscattering approximation: https://www.jcgt.org/published/0008/01/03/paper.pdf

src/mesh/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ impl Mesh {
5656
// Unreal Engine, Godot, and more all use the mikktspace method. Do not change this code
5757
// unless you really know what you are doing.
5858
// http://www.mikktspace.com/
59-
(Mat3 {
60-
x_axis: model.x_axis.truncate(),
61-
y_axis: model.y_axis.truncate(),
62-
z_axis: model.z_axis.truncate(),
63-
} * vertex_tangent.truncate())
59+
(Mat3::from_mat4(model) * vertex_tangent.truncate())
6460
.normalize()
6561
.extend(
6662
// NOTE: Multiplying by the sign of the determinant of the 3x3 model matrix accounts for

src/pbr/entry_points.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub fn fragment(
255255
#[permutate(uv = some)]
256256
if (material.base.flags & STANDARD_MATERIAL_FLAGS_BASE_COLOR_TEXTURE_BIT) != 0 {
257257
*output_color =
258-
*output_color * base_color_texture.sample::<f32, Vec4>(*base_color_sampler, *vertex_uv);
258+
*output_color * base_color_texture.sample::<f32>(*base_color_sampler, *vertex_uv);
259259
}
260260

261261
// NOTE: Unlit bit not set means == 0 is true, so the true case is if lit
@@ -277,7 +277,7 @@ pub fn fragment(
277277
{
278278
(emissive.truncate()
279279
* emissive_texture
280-
.sample::<f32, Vec4>(*emissive_sampler, *vertex_uv)
280+
.sample::<f32>(*emissive_sampler, *vertex_uv)
281281
.truncate())
282282
.extend(1.0)
283283
} else {
@@ -294,8 +294,8 @@ pub fn fragment(
294294

295295
#[permutate(uv = some)]
296296
if (material.base.flags & STANDARD_MATERIAL_FLAGS_METALLIC_ROUGHNESS_TEXTURE_BIT) != 0 {
297-
let metallic_roughness = metallic_roughness_texture
298-
.sample::<f32, Vec4>(*metallic_roughness_sampler, *vertex_uv);
297+
let metallic_roughness =
298+
metallic_roughness_texture.sample::<f32>(*metallic_roughness_sampler, *vertex_uv);
299299
// Sampling from GLTF standard channels for now
300300
metallic = metallic * metallic_roughness.z;
301301
perceptual_roughness = perceptual_roughness * metallic_roughness.y;
@@ -310,7 +310,7 @@ pub fn fragment(
310310
#[permutate(uv = some)]
311311
if (material.base.flags & STANDARD_MATERIAL_FLAGS_OCCLUSION_TEXTURE_BIT) != 0 {
312312
occlusion = occlusion_texture
313-
.sample::<f32, Vec4>(*occlusion_sampler, *vertex_uv)
313+
.sample::<f32>(*occlusion_sampler, *vertex_uv)
314314
.x;
315315
}
316316

@@ -355,7 +355,7 @@ pub fn fragment(
355355

356356
// Nt is the tangent-space normal.
357357
let mut nt = normal_map_texture
358-
.sample::<f32, Vec4>(*normal_map_sampler, *vertex_uv)
358+
.sample::<f32>(*normal_map_sampler, *vertex_uv)
359359
.truncate();
360360
if (material.base.flags & STANDARD_MATERIAL_FLAGS_TWO_COMPONENT_NORMAL_MAP) != 0 {
361361
// Only use the xy components and derive z for 2-component normal maps.

src/tonemapping_shared.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub enum TonemapMethodAgx {}
2222
impl SampleCurrentLut for TonemapMethodAgx {
2323
fn sample_current_lut(dt_lut_texture: &Texture3d, dt_lut_sampler: &Sampler, p: Vec3) -> Vec3 {
2424
dt_lut_texture
25-
.sample_by_lod::<f32, Vec4>(*dt_lut_sampler, p, 0.0)
25+
.sample_by_lod::<f32>(*dt_lut_sampler, p, 0.0)
2626
.truncate()
2727
}
2828
}
@@ -32,7 +32,7 @@ pub enum TonemapMethodTonyMcMapFace {}
3232
impl SampleCurrentLut for TonemapMethodTonyMcMapFace {
3333
fn sample_current_lut(dt_lut_texture: &Texture3d, dt_lut_sampler: &Sampler, p: Vec3) -> Vec3 {
3434
dt_lut_texture
35-
.sample_by_lod::<f32, Vec4>(*dt_lut_sampler, p, 0.0)
35+
.sample_by_lod::<f32>(*dt_lut_sampler, p, 0.0)
3636
.truncate()
3737
}
3838
}
@@ -42,7 +42,7 @@ pub enum TonemapMethodBlenderFilmic {}
4242
impl SampleCurrentLut for TonemapMethodBlenderFilmic {
4343
fn sample_current_lut(dt_lut_texture: &Texture3d, dt_lut_sampler: &Sampler, p: Vec3) -> Vec3 {
4444
dt_lut_texture
45-
.sample_by_lod::<f32, Vec4>(*dt_lut_sampler, p, 0.0)
45+
.sample_by_lod::<f32>(*dt_lut_sampler, p, 0.0)
4646
.truncate()
4747
}
4848
}

0 commit comments

Comments
 (0)