mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
chore: revert removal of DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE
(#6534)
This commit is contained in:
parent
b5986a9df1
commit
efc15ba03b
@ -16,6 +16,8 @@ use std::ops;
|
|||||||
|
|
||||||
pub type NonUniformResult = Option<Handle<crate::Expression>>;
|
pub type NonUniformResult = Option<Handle<crate::Expression>>;
|
||||||
|
|
||||||
|
const DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE: bool = true;
|
||||||
|
|
||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
/// Kinds of expressions that require uniform control flow.
|
/// Kinds of expressions that require uniform control flow.
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
|
||||||
@ -23,8 +25,8 @@ bitflags::bitflags! {
|
|||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub struct UniformityRequirements: u8 {
|
pub struct UniformityRequirements: u8 {
|
||||||
const WORK_GROUP_BARRIER = 0x1;
|
const WORK_GROUP_BARRIER = 0x1;
|
||||||
const DERIVATIVE = 0x2;
|
const DERIVATIVE = if DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE { 0 } else { 0x2 };
|
||||||
const IMPLICIT_LEVEL = 0x4;
|
const IMPLICIT_LEVEL = if DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE { 0 } else { 0x4 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,52 +1352,56 @@ fn uniform_control_flow() {
|
|||||||
&expressions,
|
&expressions,
|
||||||
&Arena::new(),
|
&Arena::new(),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
if DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE {
|
||||||
block_info,
|
assert_eq!(info[derivative_expr].ref_count, 2);
|
||||||
Err(FunctionError::NonUniformControlFlow(
|
} else {
|
||||||
UniformityRequirements::DERIVATIVE,
|
assert_eq!(
|
||||||
derivative_expr,
|
block_info,
|
||||||
UniformityDisruptor::Expression(non_uniform_global_expr)
|
Err(FunctionError::NonUniformControlFlow(
|
||||||
)
|
UniformityRequirements::DERIVATIVE,
|
||||||
.with_span()),
|
derivative_expr,
|
||||||
);
|
UniformityDisruptor::Expression(non_uniform_global_expr)
|
||||||
assert_eq!(info[derivative_expr].ref_count, 1);
|
)
|
||||||
|
.with_span()),
|
||||||
|
);
|
||||||
|
assert_eq!(info[derivative_expr].ref_count, 1);
|
||||||
|
|
||||||
// Test that the same thing passes when we disable the `derivative_uniformity`
|
// Test that the same thing passes when we disable the `derivative_uniformity`
|
||||||
let mut diagnostic_filters = Arena::new();
|
let mut diagnostic_filters = Arena::new();
|
||||||
let diagnostic_filter_leaf = diagnostic_filters.append(
|
let diagnostic_filter_leaf = diagnostic_filters.append(
|
||||||
DiagnosticFilterNode {
|
DiagnosticFilterNode {
|
||||||
inner: crate::diagnostic_filter::DiagnosticFilter {
|
inner: crate::diagnostic_filter::DiagnosticFilter {
|
||||||
new_severity: crate::diagnostic_filter::Severity::Off,
|
new_severity: crate::diagnostic_filter::Severity::Off,
|
||||||
triggering_rule: FilterableTriggeringRule::DerivativeUniformity,
|
triggering_rule: FilterableTriggeringRule::DerivativeUniformity,
|
||||||
|
},
|
||||||
|
parent: None,
|
||||||
},
|
},
|
||||||
parent: None,
|
crate::Span::default(),
|
||||||
},
|
);
|
||||||
crate::Span::default(),
|
let mut info = FunctionInfo {
|
||||||
);
|
diagnostic_filter_leaf: Some(diagnostic_filter_leaf),
|
||||||
let mut info = FunctionInfo {
|
..info.clone()
|
||||||
diagnostic_filter_leaf: Some(diagnostic_filter_leaf),
|
};
|
||||||
..info.clone()
|
|
||||||
};
|
|
||||||
|
|
||||||
let block_info = info.process_block(
|
let block_info = info.process_block(
|
||||||
&vec![stmt_emit2, stmt_if_non_uniform].into(),
|
&vec![stmt_emit2, stmt_if_non_uniform].into(),
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
&expressions,
|
&expressions,
|
||||||
&diagnostic_filters,
|
&diagnostic_filters,
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
block_info,
|
block_info,
|
||||||
Ok(FunctionUniformity {
|
Ok(FunctionUniformity {
|
||||||
result: Uniformity {
|
result: Uniformity {
|
||||||
non_uniform_result: None,
|
non_uniform_result: None,
|
||||||
requirements: UniformityRequirements::DERIVATIVE,
|
requirements: UniformityRequirements::DERIVATIVE,
|
||||||
},
|
},
|
||||||
exit: ExitFlags::empty()
|
exit: ExitFlags::empty()
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
assert_eq!(info[derivative_expr].ref_count, 2);
|
assert_eq!(info[derivative_expr].ref_count, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assert_eq!(info[non_uniform_global], GlobalUse::READ);
|
assert_eq!(info[non_uniform_global], GlobalUse::READ);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user