Skip to content

Commit

Permalink
Bump naga
Browse files Browse the repository at this point in the history
  • Loading branch information
IcanDivideBy0 committed Feb 4, 2022
1 parent e50b62f commit 15af97a
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion cts_runner/examples/hello-compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const device = await adapter.requestDevice();

const shaderCode = `@block
struct PrimeIndices {
data: @stride(4) array<u32>;
data: array<u32>;
}; // this is used as both input and output for convenience
@group(0)
@binding(0)
Expand Down
2 changes: 1 addition & 1 deletion player/tests/data/zero-init-buffer-for-binding.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct InOutBuffer {
data: @stride(4) array<u32>;
data: array<u32>;
};

@group(0)
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ thiserror = "1"

[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "81dc674"
rev = "9b89c5f"
#version = "0.8"
features = ["span", "validate", "wgsl-in"]

Expand Down
23 changes: 13 additions & 10 deletions wgpu-core/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct Resource {
name: Option<String>,
bind: naga::ResourceBinding,
ty: ResourceType,
class: naga::StorageClass,
class: naga::AddressSpace,
}

#[derive(Clone, Copy, Debug)]
Expand Down Expand Up @@ -181,9 +181,9 @@ pub enum BindingError {
#[error("type on the shader side does not match the pipeline binding")]
WrongType,
#[error("storage class {binding:?} doesn't match the shader {shader:?}")]
WrongStorageClass {
binding: naga::StorageClass,
shader: naga::StorageClass,
WrongAddressSpace {
binding: naga::AddressSpace,
shader: naga::AddressSpace,
},
#[error("buffer structure size {0}, added to one element of an unbound array, if it's the last field, ended up greater than the given `min_binding_size`")]
WrongBufferSize(wgt::BufferSize),
Expand Down Expand Up @@ -373,23 +373,23 @@ impl Resource {
} => {
let (class, global_use) = match ty {
wgt::BufferBindingType::Uniform => {
(naga::StorageClass::Uniform, GlobalUse::READ)
(naga::AddressSpace::Uniform, GlobalUse::READ)
}
wgt::BufferBindingType::Storage { read_only } => {
let mut global_use = GlobalUse::READ | GlobalUse::QUERY;
global_use.set(GlobalUse::WRITE, !read_only);
let mut naga_access = naga::StorageAccess::LOAD;
naga_access.set(naga::StorageAccess::STORE, !read_only);
(
naga::StorageClass::Storage {
naga::AddressSpace::Storage {
access: naga_access,
},
global_use,
)
}
};
if self.class != class {
return Err(BindingError::WrongStorageClass {
return Err(BindingError::WrongAddressSpace {
binding: class,
shader: self.class,
});
Expand Down Expand Up @@ -540,8 +540,8 @@ impl Resource {
Ok(match self.ty {
ResourceType::Buffer { size } => BindingType::Buffer {
ty: match self.class {
naga::StorageClass::Uniform => wgt::BufferBindingType::Uniform,
naga::StorageClass::Storage { .. } => wgt::BufferBindingType::Storage {
naga::AddressSpace::Uniform => wgt::BufferBindingType::Uniform,
naga::AddressSpace::Storage { .. } => wgt::BufferBindingType::Storage {
read_only: !shader_usage.contains(GlobalUse::WRITE),
},
_ => return Err(BindingError::WrongType),
Expand Down Expand Up @@ -905,6 +905,9 @@ impl Interface {
class,
},
naga::TypeInner::Sampler { comparison } => ResourceType::Sampler { comparison },
naga::TypeInner::Array { stride, .. } => ResourceType::Buffer {
size: wgt::BufferSize::new(stride as u64).unwrap(),
},
ref other => {
log::error!("Unexpected resource type: {:?}", other);
continue;
Expand All @@ -915,7 +918,7 @@ impl Interface {
name: var.name.clone(),
bind,
ty,
class: var.class,
class: var.space,
},
Default::default(),
);
Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ js-sys = { version = "0.3" }

[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "81dc674"
rev = "9b89c5f"
#version = "0.8"

# DEV dependencies

[dev-dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "81dc674"
rev = "9b89c5f"
#version = "0.8"
features = ["wgsl-in"]

Expand Down
6 changes: 3 additions & 3 deletions wgpu-hal/src/gles/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ impl CompilationContext<'_> {
if ep_info[handle].is_empty() {
continue;
}
let register = match var.class {
naga::StorageClass::Uniform => super::BindingRegister::UniformBuffers,
naga::StorageClass::Storage { .. } => super::BindingRegister::StorageBuffers,
let register = match var.space {
naga::AddressSpace::Uniform => super::BindingRegister::UniformBuffers,
naga::AddressSpace::Storage { .. } => super::BindingRegister::StorageBuffers,
_ => continue,
};

Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/src/metal/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl super::Device {
let mut sized_bindings = Vec::new();
let mut immutable_buffer_mask = 0;
for (var_handle, var) in module.global_variables.iter() {
if var.class == naga::StorageClass::WorkGroup {
if var.class == naga::AddressSpace::WorkGroup {
let size = module.types[var.ty].inner.size(&module.constants);
wg_memory_sizes.push(size);
}
Expand All @@ -129,7 +129,7 @@ impl super::Device {

if !ep_info[var_handle].is_empty() {
let storage_access_store = match var.class {
naga::StorageClass::Storage { access } => {
naga::AddressSpace::Storage { access } => {
access.contains(naga::StorageAccess::STORE)
}
_ => false,
Expand Down
6 changes: 3 additions & 3 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,20 @@ env_logger = "0.8"

[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "81dc674"
rev = "9b89c5f"
#version = "0.8"
optional = true

# used to test all the example shaders
[dev-dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "81dc674"
rev = "9b89c5f"
#version = "0.8"
features = ["wgsl-in"]

[target.'cfg(target_arch = "wasm32")'.dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "81dc674"
rev = "9b89c5f"
#version = "0.8"
features = ["wgsl-out"]

Expand Down
2 changes: 1 addition & 1 deletion wgpu/examples/boids/compute.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct SimParams {
};

struct Particles {
particles : @stride(16) array<Particle>;
particles : array<Particle>;
};

@group(0) @binding(0) var<uniform> params : SimParams;
Expand Down
2 changes: 1 addition & 1 deletion wgpu/examples/hello-compute/shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct PrimeIndices {
data: @stride(4) array<u32>;
data: array<u32>;
}; // this is used as both input and output for convenience

@group(0)
Expand Down
2 changes: 1 addition & 1 deletion wgpu/examples/shadow/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct Light {
};

struct Lights {
data: @stride(96) array<Light>;
data: array<Light>;
};

// Used when storage types are not supported
Expand Down

0 comments on commit 15af97a

Please sign in to comment.