Skip to content

Commit

Permalink
Reduce typo count. (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Sep 25, 2024
1 parent 83c7e8d commit 529aaf4
Show file tree
Hide file tree
Showing 31 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [PR#612](https://github.com/EmbarkStudios/rust-gpu/pull/612) added `is_helper_invocation` to `spirv-std`
- [PR#624](https://github.com/EmbarkStudios/rust-gpu/pull/624) added `OpTypeSampler` and `OpTypeAccelerationStructureKHR` support to inline `asm!`
- [PR#622](https://github.com/EmbarkStudios/rust-gpu/pull/622) added the ability to query entry-point names from `spirv-builder`
- [PR#630](https://github.com/EmbarkStudios/rust-gpu/pull/630) added a more convenient API to `spirv-builder`, for requesting extensions and/or capabilties
- [PR#630](https://github.com/EmbarkStudios/rust-gpu/pull/630) added a more convenient API to `spirv-builder`, for requesting extensions and/or capabilities
- [PR#629](https://github.com/EmbarkStudios/rust-gpu/pull/629) added an optimization to convert N identical scalar (e.g. arithmetic) ops, into one N-wide vector op (as e.g. `glam` only emits the former)
- [PR#596](https://github.com/EmbarkStudios/rust-gpu/pull/596) added a `RuntimeArray` type to `spirv-val`, to represent SPIR-V `OpRuntimeArray`s
- [PR#635](https://github.com/EmbarkStudios/rust-gpu/pull/635) added several `spirv-builder` options for controlling `spirv-val` flags
Expand Down
6 changes: 3 additions & 3 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
})
.collect();

// Special-case field accesses through a `pointercast`, to accesss the
// Special-case field accesses through a `pointercast`, to access the
// right field in the original type, for the `Logical` addressing model.
let ptr = ptr.strip_ptrcasts();
let ptr_id = ptr.def(self);
Expand Down Expand Up @@ -1378,8 +1378,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
);
self.icmp(IntPredicate::IntEQ, rhs_lt_zero, result_gt_lhs)
} else {
// for unsigned addition, overflow occured if the result is less than any of the operands.
// for subtraction, overflow occured if the result is greater.
// for unsigned addition, overflow occurred if the result is less than any of the operands.
// for subtraction, overflow occurred if the result is greater.
self.icmp(
if is_add {
IntPredicate::IntULT
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/src/codegen_cx/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ impl<'tcx> CodegenCx<'tcx> {
),
};
// alloc_id is not needed by read_scalar, so we just use 0. If the context
// refers to a pointer, read_scalar will find the the actual alloc_id. It
// only uses the input alloc_id in the case that the scalar is uninitilized
// refers to a pointer, read_scalar will find the actual alloc_id. It
// only uses the input alloc_id in the case that the scalar is uninitialized
// as part of the error output
// tldr, the pointer here is only needed for the offset
let value = match alloc.inner().read_scalar(
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/codegen_cx/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ impl<'tcx> CodegenCx<'tcx> {
// (e.g. Vulkan has specific rules for builtin storage classes).

// Emit `OpName` in the simple case of a pattern that's just a variable
// name (e.g. "foo" for `foo: Vec3`). While `OpName` is *not* suppposed
// name (e.g. "foo" for `foo: Vec3`). While `OpName` is *not* supposed
// to be semantic, OpenGL and some tooling rely on it for reflection.
if let hir::PatKind::Binding(_, _, ident, _) = &hir_param.pat.kind {
self.emit_global()
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/linker/duplicates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn remove_duplicate_extensions(module: &mut Module) {
});
}

pub fn remove_duplicate_capablities(module: &mut Module) {
pub fn remove_duplicate_capabilities(module: &mut Module) {
let mut set = FxHashSet::default();
module.capabilities.retain(|inst| {
inst.class.opcode != Op::Capability || set.insert(inst.operands[0].unwrap_capability())
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/src/linker/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub fn inline(sess: &Session, module: &mut Module) -> super::Result<()> {
}

let header = module.header.as_mut().unwrap();
// FIXME(eddyb) clippy false positive (seperate `map` required for borrowck).
// FIXME(eddyb) clippy false positive (separate `map` required for borrowck).
#[allow(clippy::map_unwrap_or)]
let mut inliner = Inliner {
op_type_void_id: module
Expand Down Expand Up @@ -807,7 +807,7 @@ impl Inliner<'_, '_> {
..
} = *self;

// HACK(eddyb) this is terrible, but we have to deal with it becasue of
// HACK(eddyb) this is terrible, but we have to deal with it because of
// how this inliner is outside-in, instead of inside-out, meaning that
// context builds up "outside" of the callee blocks, inside the caller.
let mut enclosing_inlined_frames = SmallVec::<[_; 8]>::new();
Expand Down
6 changes: 3 additions & 3 deletions crates/rustc_codegen_spirv/src/linker/mem2reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ fn collect_access_chains(
Some(VarInfo {
ty: *pointer_to_pointee.get(&inst.result_type.unwrap()).unwrap(),
indices: {
let mut base_indicies = base.indices.clone();
let mut base_indices = base.indices.clone();
for op in inst.operands.iter().skip(1) {
base_indicies.push(*constants.get(&op.id_ref_any().unwrap())?);
base_indices.push(*constants.get(&op.id_ref_any().unwrap())?);
}
base_indicies
base_indices
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/linker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub fn link(
{
let _timer = sess.timer("link_remove_duplicates");
duplicates::remove_duplicate_extensions(&mut output);
duplicates::remove_duplicate_capablities(&mut output);
duplicates::remove_duplicate_capabilities(&mut output);
duplicates::remove_duplicate_ext_inst_imports(&mut output);
duplicates::remove_duplicate_types(&mut output);
// jb-todo: strip identical OpDecoration / OpDecorationGroups
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/linker/peephole_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn composite_construct(types: &FxHashMap<Word, Instruction>, function: &mut
let index = cur_inst.operands[2].unwrap_literal_int32() as usize;
if index >= components.len() {
// Theoretically shouldn't happen, as it's invalid SPIR-V if the index is out
// of bounds, but just stop optimizing instead of panicing here.
// of bounds, but just stop optimizing instead of panicking here.
break;
}
if components[index].is_none() {
Expand Down
10 changes: 5 additions & 5 deletions crates/rustc_codegen_spirv/src/linker/specializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<F: Fn(&mut fmt::Formatter<'_>) -> fmt::Result> fmt::Display for FmtBy<F> {
}

pub trait Specialization {
/// Return `true` if the specializer should replace every occurence of
/// Return `true` if the specializer should replace every occurrence of
/// `operand` with some other inferred `Operand`.
fn specialize_operand(&self, operand: &Operand) -> bool;

Expand Down Expand Up @@ -1903,7 +1903,7 @@ impl<'a, S: Specialization> InferCx<'a, S> {
);
}

// HACK(eddyb) workaround for `OpFunction`, see earlier HACK commment.
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK comment.
if let Some(ret_ty) = record_fn_ret_ty {
let (ret_ty, _) = InferOperand::from_operand_and_generic_args(
&Operand::IdRef(ret_ty),
Expand All @@ -1929,7 +1929,7 @@ impl<'a, S: Specialization> InferCx<'a, S> {
);
(
Some(type_of_result),
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK commment.
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK comment.
match inst.class.opcode {
Op::Function => all_generic_args,
_ => rest,
Expand All @@ -1942,7 +1942,7 @@ impl<'a, S: Specialization> InferCx<'a, S> {
let debug_dump_if_enabled = |cx: &Self, prefix| {
if cx.specializer.debug {
let result_type = match inst.class.opcode {
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK commment.
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK comment.
Op::Function => Some(
InferOperand::from_operand_and_generic_args(
&Operand::IdRef(inst.result_type.unwrap()),
Expand Down Expand Up @@ -1976,7 +1976,7 @@ impl<'a, S: Specialization> InferCx<'a, S> {

// If we have some instruction signatures for `inst`, enforce them.
if let Some(sigs) = spirv_type_constraints::instruction_signatures(inst.class.opcode) {
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK commment.
// HACK(eddyb) workaround for `OpFunction`, see earlier HACK comment.
// (specifically, `type_of_result` isn't *Result Type* for `OpFunction`)
assert_ne!(inst.class.opcode, Op::Function);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl UseOrigin<'_> {
inst: ext_inst,
} => {
// FIXME(eddyb) inefficient (ideally the `InternedStr`
// shoudl be available), but this is the error case.
// should be available), but this is the error case.
assert_eq!(&cx[ext_set], &custom_insts::CUSTOM_EXT_INST_SET[..]);

CustomOp::decode(ext_inst)
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/src/spirv_type_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub enum TyPat<'a> {
/// Index the composite type matched by the inner pattern (like a `Var`)
/// by all of the value operands of the instruction which don't have their
/// types consumed explicitly, i.e. the indices operands correspond to
/// the `TyListPat::Any` part of the the `inputs` of the `InstSig`,
/// the `TyListPat::Any` part of the `inputs` of the `InstSig`,
/// e.g. in `sig! { (_, T, _, ..) -> IndexComposite(T) }`, the output type
/// has to be identical to the result of indexing `T` by all the value
/// operands *other than* the first 3.
Expand Down Expand Up @@ -758,7 +758,7 @@ pub fn instruction_signatures(op: Op) -> Option<&'static [InstSig<'static>]> {
| Op::TraceNV
| Op::TypeAccelerationStructureNV
| Op::ExecuteCallableNV => {
// NOTE(eddyb) Some KHR variants are aliased to the the NV instructions.
// NOTE(eddyb) Some KHR variants are aliased to the NV instructions.
// reserved!(SPV_NV_ray_tracing)
}
// SPV_NV_cooperative_matrix
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const EXECUTION_MODES: &[(&str, ExecutionMode, ExecutionModeExtraDim)] = {
("vertex_order_cw", VertexOrderCw, None),
("vertex_order_ccw", VertexOrderCcw, None),
("pixel_center_integer", PixelCenterInteger, None),
("orgin_upper_left", OriginUpperLeft, None),
("origin_upper_left", OriginUpperLeft, None),
("origin_lower_left", OriginLowerLeft, None),
("early_fragment_tests", EarlyFragmentTests, None),
("point_mode", PointMode, None),
Expand Down
2 changes: 1 addition & 1 deletion crates/spirv-builder/src/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl SpirvBuilder {
path
} else {
let (tx, rx) = sync_channel(0);
// Fall back to watching from the crate root if the inital compilation fails
// Fall back to watching from the crate root if the initial compilation fails
let mut watcher =
notify::recommended_watcher(move |event: notify::Result<Event>| match event {
Ok(e) => match e.kind {
Expand Down
2 changes: 1 addition & 1 deletion crates/spirv-std/src/arch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! SPIR-V Instrinics
//! SPIR-V Intrinsics
//!
//! This module is intended as a low level abstraction over SPIR-V instructions.
//! These functions will typically map to a single instruction, and will perform
Expand Down
4 changes: 2 additions & 2 deletions crates/spirv-std/src/byte_addressable_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ unsafe fn buffer_store_intrinsic<T>(
}

/// `ByteAddressableBuffer` is an untyped blob of data, allowing loads and stores of arbitrary
/// basic data types at arbitrary indicies. However, all data must be aligned to size 4, each
/// basic data types at arbitrary indices. However, all data must be aligned to size 4, each
/// element within the data (e.g. struct fields) must have a size and alignment of a multiple of 4,
/// and the `byte_index` passed to load and store must be a multiple of 4 (`byte_index` will be
/// rounded down to the nearest multiple of 4). So, it's not technically a *byte* addressable
/// buffer, but rather a *word* buffer, but this naming and behavior was inhereted from HLSL (where
/// buffer, but rather a *word* buffer, but this naming and behavior was inherited from HLSL (where
/// it's UB to pass in an index not a multiple of 4).
#[repr(transparent)]
pub struct ByteAddressableBuffer<'a> {
Expand Down
2 changes: 1 addition & 1 deletion crates/spirv-std/src/image/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{integer::Integer, scalar::Scalar, vector::Vector, vector::VectorTrun
/// Marker trait for arguments that accept single scalar values or vectors
/// of scalars. Defines 2-, 3- and 4-component vector types based on the sample type.
pub trait SampleType<const FORMAT: u32, const COMPONENTS: u32>: Scalar {
/// The default vector/scalar of ths sample type
/// The default vector/scalar of this sample type
type SampleResult: Default;

/// A 2-component vector of this sample type
Expand Down
2 changes: 1 addition & 1 deletion docs/src/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ used to override them later ("specializing" the shader):
* note: WebGPU calls them ["pipeline-overridable constants"](https://gpuweb.github.io/gpuweb/wgsl/#pipeline-overridable)
* in OpenCL: [via `clSetProgramSpecializationConstant()` calls, before `clBuildProgram()`](https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clSetProgramSpecializationConstant.html)

If a "specialization constant" is not overriden, it falls back to its *default*
If a "specialization constant" is not overridden, it falls back to its *default*
value, which is either user-specified (via `default = ...`), or `0` otherwise.

While only "specialization constants" of type `u32` are currently supported, it's
Expand Down
2 changes: 1 addition & 1 deletion docs/src/codegen-args.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ While most of those flags are usually only exposed through higher-level `spirv-b

## Debugging "codegen args" flags/options

As mentioned above, these form the bulk of "codegen args", but keep in mind the list is not exhaustive and you will want to cehck the full list with e.g. `RUSTGPU_CODEGEN_ARGS="--help"`.
As mentioned above, these form the bulk of "codegen args", but keep in mind the list is not exhaustive and you will want to check the full list with e.g. `RUSTGPU_CODEGEN_ARGS="--help"`.

### `--dump-mir DIR`

Expand Down
6 changes: 3 additions & 3 deletions docs/src/rfcs/001-resource-binding-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ In recent years most Desktop platforms have switched to loading resource descrip
| Maximum number of Samplers in all descriptor tables per shader stage| 16| full heap| full heap

### Vulkan
On the other hand in Vulkan resource descriptor binding is designed in such a way that it can accomodate hardware that still relies on descriptor slots instead of memory, because still a lot of such hardware exists in the wild. Especially in the Mobile space.
On the other hand in Vulkan resource descriptor binding is designed in such a way that it can accommodate hardware that still relies on descriptor slots instead of memory, because still a lot of such hardware exists in the wild. Especially in the Mobile space.

There are some constraints that currently exist when it comes to binding resources to shaders that we may need to take into account, Vulkan has `maxBoundDescriptorSets` for example (between 4 and 32). However for the sake of argument we'll ignore these practical limitations for now.
</details>
Expand Down Expand Up @@ -163,7 +163,7 @@ fn main(inputs: &ShadingInputs, indirect_lighting: &IndirectLighting) {

# Suggestion

I think the most ergonomic and future proof binding method would be to have descriptors in structs, bound to the entrypoint. This allows us some nice, even more ergonomic upsides later on (when support is more widely available) where we can put data members in these structs as well. And along with this, we can have very egonomic CPU side code as well, where we can keep shader invocation looking like a function call for a large part, instead of having to manually bind to slots again.
I think the most ergonomic and future proof binding method would be to have descriptors in structs, bound to the entrypoint. This allows us some nice, even more ergonomic upsides later on (when support is more widely available) where we can put data members in these structs as well. And along with this, we can have very ergonomic CPU side code as well, where we can keep shader invocation looking like a function call for a large part, instead of having to manually bind to slots again.

# Prior art

Expand All @@ -186,7 +186,7 @@ ConstantBuffer<myConstants> c[10000] : register(b0);

In DirectX12 the feature of Root Signatures got added that is essentially a new domain specific language to set up the layout / calling convention of the shader; specified in a string.

Note the the two examples don't match necessarily.
Note the two examples don't match necessarily.

```hlsl
#define MyRS1 "RootFlags( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | " \
Expand Down
2 changes: 1 addition & 1 deletion docs/src/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ how to configure it, and add new tests.

### Blessing Tests

You will occassionally need to "bless" the output from UI tests to update the
You will occasionally need to "bless" the output from UI tests to update the
normalised output, you can do this by passing a `--bless` flag to
`cargo compiletest`.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/writing-shader-crates.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If you're writing a bigger application and you want to integrate SPIR-V shader
crates to display, it's recommended to use `spirv-builder` in a build script.

1. Copy the [`rust-toolchain.toml`] file to your project. (You must use the same
version of Rust as `rust-gpu`. Utimately, the build will fail with a nice
version of Rust as `rust-gpu`. Ultimately, the build will fail with a nice
error message when you don't use the exact same version)
2. Reference `spirv-builder` in your Cargo.toml:
```toml
Expand Down Expand Up @@ -156,7 +156,7 @@ crate-type = ["dylib"]
spirv-std = { version = "0.9" }
```

Make sure your shader code uses the `no_std` attribute and makes the `spirv` attribute visibile in the global scope. Then, you're ready to write your first shader. Here's a very simple fragment shader called `main_fs` as an example that outputs the color red:
Make sure your shader code uses the `no_std` attribute and makes the `spirv` attribute visible in the global scope. Then, you're ready to write your first shader. Here's a very simple fragment shader called `main_fs` as an example that outputs the color red:

```rust,norun
#![no_std]
Expand Down
6 changes: 3 additions & 3 deletions examples/runners/ash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ pub fn main() {
)],
);

let (compiler_sender, compiler_reciever) = sync_channel(1);
let (compiler_sender, compiler_receiver) = sync_channel(1);

event_loop
.run(move |event, event_loop_window_target| match event {
Event::AboutToWait { .. } => {
match compiler_reciever.try_recv() {
match compiler_receiver.try_recv() {
Err(TryRecvError::Empty) => {
if ctx.rendering_paused {
let vk::Extent2D { width, height } = ctx.base.surface_resolution();
Expand All @@ -166,7 +166,7 @@ pub fn main() {
ctx.rebuild_pipelines(vk::PipelineCache::null());
}
Err(TryRecvError::Disconnected) => {
panic!("compiler reciever disconnected unexpectedly");
panic!("compiler receiver disconnected unexpectedly");
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ fn rust_flags(codegen_backend_path: &Path) -> String {
.join(" ")
}

/// Convience function to map process failure to results in Rust.
/// Convenience function to map process failure to results in Rust.
fn map_status_to_result(status: std::process::ExitStatus) -> io::Result<()> {
match status.success() {
true => Ok(()),
Expand Down
Loading

0 comments on commit 529aaf4

Please sign in to comment.