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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ jobs:
# FIXME(eddyb) consider using lavapipe instead, or even trying both.
install_swiftshader: true
# install_lavapipe: true
- name: Install rustup components
run: rustup component add rustfmt clippy
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
- name: Install rustup components
run: rustup component add rustfmt clippy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't even need these, with rust-toolchain.toml they should be installed automatically

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but it gives better accuracy how long each step takes, when you're comparing CI times like in #334

(not that it really matters for lint, but why not make it match the others)

- name: cargo fetch --locked
run: cargo fetch --locked
- name: Rustfmt
Expand Down
12 changes: 6 additions & 6 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ macro_rules! simple_shift_op {
let result = (|| Some(match (const_lhs, const_rhs) {
$(
(ConstValue::Unsigned($int_lhs), ConstValue::Unsigned($int_rhs)) => $fold_int,
(ConstValue::Unsigned($int_lhs), ConstValue::Signed($int_rhs)) => $fold_int,
(ConstValue::Signed($int_lhs), ConstValue::Unsigned($int_rhs)) => $fold_int as u128,
(ConstValue::Signed($int_lhs), ConstValue::Signed($int_rhs)) => $fold_int as u128,
)?
$(
(ConstValue::Unsigned($uint_lhs), ConstValue::Unsigned($uint_rhs)) => $fold_uint,
(ConstValue::Unsigned($int_lhs), ConstValue::Signed($int_rhs)) => $fold_int,
(ConstValue::Signed($int_lhs), ConstValue::Unsigned($int_rhs)) => $fold_int as u128,
(ConstValue::Signed($int_lhs), ConstValue::Signed($int_rhs)) => $fold_int as u128,
)?
$(
(ConstValue::Unsigned($uint_lhs), ConstValue::Unsigned($uint_rhs)) => $fold_uint,
(ConstValue::Unsigned($uint_lhs), ConstValue::Signed($uint_rhs)) => $fold_uint,
)?
$(
Expand Down
36 changes: 18 additions & 18 deletions crates/rustc_codegen_spirv/src/builder/format_args_decompiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ impl<'tcx> DecodedFormatArgs<'tcx> {

let prepare_args_insts = try_rev_take(2).ok_or_else(|| {
FormatArgsNotRecognized(
"fmt::Arguments::new_v1_formatted call: ran out of instructions".into(),
)
"fmt::Arguments::new_v1_formatted call: ran out of instructions".into(),
)
})?;
let (rt_args_slice_ptr_id, _fmt_placeholders_slice_ptr_id) =
match prepare_args_insts[..] {
Expand Down Expand Up @@ -567,22 +567,22 @@ impl<'tcx> DecodedFormatArgs<'tcx> {
})?;

*maybe_ref_arg_id = match ref_arg_store_insts[..] {
[
Inst::InBoundsAccessChain(field_ptr, base_ptr, field_idx),
Inst::Store(st_dst_ptr, st_val),
] if base_ptr == ref_args_tmp_slot_ptr
&& field_idx as usize == rt_arg_idx
&& st_dst_ptr == field_ptr =>
{
Some(st_val)
}
_ => None,
}
.ok_or_else(|| {
FormatArgsNotRecognized(format!(
"fmt::rt::Argument::new argument store sequence ({ref_arg_store_insts:?})"
))
})?;
[
Inst::InBoundsAccessChain(field_ptr, base_ptr, field_idx),
Inst::Store(st_dst_ptr, st_val),
] if base_ptr == ref_args_tmp_slot_ptr
&& field_idx as usize == rt_arg_idx
&& st_dst_ptr == field_ptr =>
{
Some(st_val)
}
_ => None,
}
.ok_or_else(|| {
FormatArgsNotRecognized(format!(
"fmt::rt::Argument::new argument store sequence ({ref_arg_store_insts:?})"
))
})?;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions crates/spirv-std/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ macro_rules! impl_scalar {
impl Sealed for $ty {}
impl ScalarComposite for $ty {
#[inline]
fn transform<F: ScalarOrVectorTransform>(self, f: &mut F) -> Self {
f.transform_scalar(self)
}
}
unsafe impl ScalarOrVector for $ty {
fn transform<F: ScalarOrVectorTransform>(self, f: &mut F) -> Self {
f.transform_scalar(self)
}
}
unsafe impl ScalarOrVector for $ty {
type Scalar = Self;
const N: NonZeroUsize = NonZeroUsize::new(1).unwrap();
}
Expand Down
142 changes: 71 additions & 71 deletions examples/runners/ash/src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,77 +91,77 @@ impl MyRenderPipelineManager {
)?;

let mut pipelines =
self
.device
.create_graphics_pipelines(vk::PipelineCache::null(), &[vk::GraphicsPipelineCreateInfo::default()
.stages(
&[
vk::PipelineShaderStageCreateInfo {
module: shader_module,
p_name: c"main_vs".as_ptr(),
stage: vk::ShaderStageFlags::VERTEX,
..Default::default()
},
vk::PipelineShaderStageCreateInfo {
module: shader_module,
p_name: c"main_fs".as_ptr(),
stage: vk::ShaderStageFlags::FRAGMENT,
// NOTE(eddyb) this acts like an integration test for specialization constants.
p_specialization_info: &vk::SpecializationInfo::default()
.map_entries(&[vk::SpecializationMapEntry::default()
.constant_id(0x5007)
.offset(0)
.size(4)])
.data(&u32::to_le_bytes(
self.sky_fs_spec_id_0x5007_sun_intensity_extra_spec_const_factor,
)),
..Default::default()
},
],
)
.vertex_input_state(&vk::PipelineVertexInputStateCreateInfo::default())
.input_assembly_state(&vk::PipelineInputAssemblyStateCreateInfo {
topology: vk::PrimitiveTopology::TRIANGLE_LIST,
..Default::default()
})
.rasterization_state(&vk::PipelineRasterizationStateCreateInfo {
front_face: vk::FrontFace::COUNTER_CLOCKWISE,
line_width: 1.0,
..Default::default()
})
.multisample_state(&vk::PipelineMultisampleStateCreateInfo {
rasterization_samples: vk::SampleCountFlags::TYPE_1,
..Default::default()
})
.depth_stencil_state(&vk::PipelineDepthStencilStateCreateInfo::default())
.color_blend_state(
&vk::PipelineColorBlendStateCreateInfo::default()
.attachments(
&[vk::PipelineColorBlendAttachmentState {
blend_enable: 0,
src_color_blend_factor: vk::BlendFactor::SRC_COLOR,
dst_color_blend_factor: vk::BlendFactor::ONE_MINUS_DST_COLOR,
color_blend_op: vk::BlendOp::ADD,
src_alpha_blend_factor: vk::BlendFactor::ZERO,
dst_alpha_blend_factor: vk::BlendFactor::ZERO,
alpha_blend_op: vk::BlendOp::ADD,
color_write_mask: vk::ColorComponentFlags::RGBA,
}],
),
)
.dynamic_state(
&vk::PipelineDynamicStateCreateInfo::default()
.dynamic_states(&[vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR]),
)
.viewport_state(
&vk::PipelineViewportStateCreateInfo::default()
.scissor_count(1)
.viewport_count(1),
)
.layout(pipeline_layout)
.push_next(&mut vk::PipelineRenderingCreateInfo::default().color_attachment_formats(&[self.color_out_format]))
], None).map_err(|(_, e)| e)
.context("Unable to create graphics pipeline")?;
self
.device
.create_graphics_pipelines(vk::PipelineCache::null(), &[vk::GraphicsPipelineCreateInfo::default()
.stages(
&[
vk::PipelineShaderStageCreateInfo {
module: shader_module,
p_name: c"main_vs".as_ptr(),
stage: vk::ShaderStageFlags::VERTEX,
..Default::default()
},
vk::PipelineShaderStageCreateInfo {
module: shader_module,
p_name: c"main_fs".as_ptr(),
stage: vk::ShaderStageFlags::FRAGMENT,
// NOTE(eddyb) this acts like an integration test for specialization constants.
p_specialization_info: &vk::SpecializationInfo::default()
.map_entries(&[vk::SpecializationMapEntry::default()
.constant_id(0x5007)
.offset(0)
.size(4)])
.data(&u32::to_le_bytes(
self.sky_fs_spec_id_0x5007_sun_intensity_extra_spec_const_factor,
)),
..Default::default()
},
],
)
.vertex_input_state(&vk::PipelineVertexInputStateCreateInfo::default())
.input_assembly_state(&vk::PipelineInputAssemblyStateCreateInfo {
topology: vk::PrimitiveTopology::TRIANGLE_LIST,
..Default::default()
})
.rasterization_state(&vk::PipelineRasterizationStateCreateInfo {
front_face: vk::FrontFace::COUNTER_CLOCKWISE,
line_width: 1.0,
..Default::default()
})
.multisample_state(&vk::PipelineMultisampleStateCreateInfo {
rasterization_samples: vk::SampleCountFlags::TYPE_1,
..Default::default()
})
.depth_stencil_state(&vk::PipelineDepthStencilStateCreateInfo::default())
.color_blend_state(
&vk::PipelineColorBlendStateCreateInfo::default()
.attachments(
&[vk::PipelineColorBlendAttachmentState {
blend_enable: 0,
src_color_blend_factor: vk::BlendFactor::SRC_COLOR,
dst_color_blend_factor: vk::BlendFactor::ONE_MINUS_DST_COLOR,
color_blend_op: vk::BlendOp::ADD,
src_alpha_blend_factor: vk::BlendFactor::ZERO,
dst_alpha_blend_factor: vk::BlendFactor::ZERO,
alpha_blend_op: vk::BlendOp::ADD,
color_write_mask: vk::ColorComponentFlags::RGBA,
}],
),
)
.dynamic_state(
&vk::PipelineDynamicStateCreateInfo::default()
.dynamic_states(&[vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR]),
)
.viewport_state(
&vk::PipelineViewportStateCreateInfo::default()
.scissor_count(1)
.viewport_count(1),
)
.layout(pipeline_layout)
.push_next(&mut vk::PipelineRenderingCreateInfo::default().color_attachment_formats(&[self.color_out_format]))
], None).map_err(|(_, e)| e)
.context("Unable to create graphics pipeline")?;

// A single `pipeline_info` results in a single pipeline.
assert_eq!(pipelines.len(), 1);
Expand Down
4 changes: 4 additions & 0 deletions tests/compiletests/ui/arch/shared/reduction_array.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// build-pass
// ignore-spv1.0
// ignore-spv1.1
// ignore-spv1.2
// ignore-vulkan1.0

use core::ops::{Add, AddAssign, Deref, DerefMut};
use spirv_std::arch::workgroup_memory_barrier_with_group_sync;
Expand Down
4 changes: 4 additions & 0 deletions tests/compiletests/ui/arch/shared/reduction_big_struct.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// build-pass
// ignore-spv1.0
// ignore-spv1.1
// ignore-spv1.2
// ignore-vulkan1.0

use core::ops::{Add, AddAssign};
use spirv_std::arch::workgroup_memory_barrier_with_group_sync;
Expand Down
4 changes: 4 additions & 0 deletions tests/compiletests/ui/arch/shared/reduction_u32.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// build-pass
// ignore-spv1.0
// ignore-spv1.1
// ignore-spv1.2
// ignore-vulkan1.0

use spirv_std::arch::workgroup_memory_barrier_with_group_sync;
use spirv_std::glam::*;
Expand Down
4 changes: 4 additions & 0 deletions tests/compiletests/ui/arch/shared/reduction_vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// build-pass
// ignore-spv1.0
// ignore-spv1.1
// ignore-spv1.2
// ignore-vulkan1.0

use spirv_std::arch::workgroup_memory_barrier_with_group_sync;
use spirv_std::glam::*;
Expand Down
18 changes: 9 additions & 9 deletions tests/difftests/tests/lang/abi/vector_layout/cpu/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ pub trait WriteLayout {

macro_rules! write_layout {
($out:ident, $offset:ident, $name:ident($($member:ident),*)) => {
{
// offset 0: size
$out[$offset.inc()] = size_of::<$name>() as u32;
// offset 4: alignment
$out[$offset.inc()] = align_of::<$name>() as u32;
// offset 8 onwards: members
$($out[$offset.inc()] = offset_of!($name, $member) as u32;)*
}
};
{
// offset 0: size
$out[$offset.inc()] = size_of::<$name>() as u32;
// offset 4: alignment
$out[$offset.inc()] = align_of::<$name>() as u32;
// offset 8 onwards: members
$($out[$offset.inc()] = offset_of!($name, $member) as u32;)*
}
};
}

/// gid is checked within this range. Note this is a range, so it **must be +1 from the max entry you use**.
Expand Down