mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-26 08:44:08 +00:00
add Capabilities::MULTISAMPLED_SHADING
This commit is contained in:
parent
964d9204bc
commit
cc3a8ac737
@ -149,7 +149,7 @@ fn backends(c: &mut Criterion) {
|
|||||||
let inputs = {
|
let inputs = {
|
||||||
let mut validator = naga::valid::Validator::new(
|
let mut validator = naga::valid::Validator::new(
|
||||||
naga::valid::ValidationFlags::empty(),
|
naga::valid::ValidationFlags::empty(),
|
||||||
naga::valid::Capabilities::empty(),
|
naga::valid::Capabilities::default(),
|
||||||
);
|
);
|
||||||
let input_modules = gather_modules();
|
let input_modules = gather_modules();
|
||||||
input_modules
|
input_modules
|
||||||
|
@ -5,6 +5,6 @@ fuzz_target!(|module: naga::Module| {
|
|||||||
use naga::valid as v;
|
use naga::valid as v;
|
||||||
// Check if the module validates without errors.
|
// Check if the module validates without errors.
|
||||||
//TODO: may also fuzz the flags and capabilities
|
//TODO: may also fuzz the flags and capabilities
|
||||||
let mut validator = v::Validator::new(v::ValidationFlags::all(), v::Capabilities::empty());
|
let mut validator = v::Validator::new(v::ValidationFlags::all(), v::Capabilities::default());
|
||||||
let _result = validator.validate(&module);
|
let _result = validator.validate(&module);
|
||||||
});
|
});
|
||||||
|
@ -141,6 +141,7 @@ impl VaryingContext<'_> {
|
|||||||
Bi::CullDistance => Capabilities::CULL_DISTANCE,
|
Bi::CullDistance => Capabilities::CULL_DISTANCE,
|
||||||
Bi::PrimitiveIndex => Capabilities::PRIMITIVE_INDEX,
|
Bi::PrimitiveIndex => Capabilities::PRIMITIVE_INDEX,
|
||||||
Bi::ViewIndex => Capabilities::MULTIVIEW,
|
Bi::ViewIndex => Capabilities::MULTIVIEW,
|
||||||
|
Bi::SampleIndex => Capabilities::MULTISAMPLED_SHADING,
|
||||||
_ => Capabilities::empty(),
|
_ => Capabilities::empty(),
|
||||||
};
|
};
|
||||||
if !self.capabilities.contains(required) {
|
if !self.capabilities.contains(required) {
|
||||||
@ -312,6 +313,14 @@ impl VaryingContext<'_> {
|
|||||||
// qualifiers, so we won't complain about that here.
|
// qualifiers, so we won't complain about that here.
|
||||||
let _ = sampling;
|
let _ = sampling;
|
||||||
|
|
||||||
|
let required = match sampling {
|
||||||
|
Some(crate::Sampling::Sample) => Capabilities::MULTISAMPLED_SHADING,
|
||||||
|
_ => Capabilities::empty(),
|
||||||
|
};
|
||||||
|
if !self.capabilities.contains(required) {
|
||||||
|
return Err(VaryingError::UnsupportedCapability(required));
|
||||||
|
}
|
||||||
|
|
||||||
match ty_inner.scalar_kind() {
|
match ty_inner.scalar_kind() {
|
||||||
Some(crate::ScalarKind::Float) => {
|
Some(crate::ScalarKind::Float) => {
|
||||||
if needs_interpolation && interpolation.is_none() {
|
if needs_interpolation && interpolation.is_none() {
|
||||||
|
@ -84,7 +84,6 @@ impl Default for ValidationFlags {
|
|||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
/// Allowed IR capabilities.
|
/// Allowed IR capabilities.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[derive(Default)]
|
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
|
||||||
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
|
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
|
||||||
pub struct Capabilities: u16 {
|
pub struct Capabilities: u16 {
|
||||||
@ -110,6 +109,14 @@ bitflags::bitflags! {
|
|||||||
const MULTIVIEW = 0x200;
|
const MULTIVIEW = 0x200;
|
||||||
/// Support for `early_depth_test`.
|
/// Support for `early_depth_test`.
|
||||||
const EARLY_DEPTH_TEST = 0x400;
|
const EARLY_DEPTH_TEST = 0x400;
|
||||||
|
/// Support for [`Builtin::SampleIndex`] and [`Sampling::Sample`].
|
||||||
|
const MULTISAMPLED_SHADING = 0x800;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Capabilities {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::MULTISAMPLED_SHADING
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ fn check_targets(module: &naga::Module, name: &str, targets: Targets) {
|
|||||||
let capabilities = if params.god_mode {
|
let capabilities = if params.god_mode {
|
||||||
naga::valid::Capabilities::all()
|
naga::valid::Capabilities::all()
|
||||||
} else {
|
} else {
|
||||||
naga::valid::Capabilities::empty()
|
naga::valid::Capabilities::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let dest = PathBuf::from(root).join(BASE_DIR_OUT);
|
let dest = PathBuf::from(root).join(BASE_DIR_OUT);
|
||||||
@ -589,7 +589,7 @@ fn convert_spv(name: &str, adjust_coordinate_space: bool, targets: Targets) {
|
|||||||
check_targets(&module, name, targets);
|
check_targets(&module, name, targets);
|
||||||
naga::valid::Validator::new(
|
naga::valid::Validator::new(
|
||||||
naga::valid::ValidationFlags::all(),
|
naga::valid::ValidationFlags::all(),
|
||||||
naga::valid::Capabilities::empty(),
|
naga::valid::Capabilities::default(),
|
||||||
)
|
)
|
||||||
.validate(&module)
|
.validate(&module)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -903,7 +903,7 @@ fn validation_error(source: &str) -> Result<naga::valid::ModuleInfo, naga::valid
|
|||||||
};
|
};
|
||||||
naga::valid::Validator::new(
|
naga::valid::Validator::new(
|
||||||
naga::valid::ValidationFlags::all(),
|
naga::valid::ValidationFlags::all(),
|
||||||
naga::valid::Capabilities::empty(),
|
naga::valid::Capabilities::default(),
|
||||||
)
|
)
|
||||||
.validate(&module)
|
.validate(&module)
|
||||||
.map_err(|e| e.into_inner()) // TODO: Add tests for spans, too?
|
.map_err(|e| e.into_inner()) // TODO: Add tests for spans, too?
|
||||||
|
Loading…
Reference in New Issue
Block a user