pub enum EarlyDepthTest {
Force,
Allow {
conservative: ConservativeDepth,
},
}
Expand description
Explicitly allows early depth/stencil tests.
Normally, depth/stencil tests are performed after fragment shading. However, as an optimization, most drivers will move the depth/stencil tests before fragment shading if this does not have any observable consequences. This optimization is disabled under the following circumstances:
discard
is called in the fragment shader.- The fragment shader writes to the depth buffer.
- The fragment shader writes to any storage bindings.
When EarlyDepthTest
is set, it is allowed to perform an early depth/stencil test even if the
above conditions are not met. When EarlyDepthTest::Force
is used, depth/stencil tests
must be performed before fragment shading.
To force early depth/stencil tests in a shader:
- GLSL:
layout(early_fragment_tests) in;
- HLSL:
Attribute earlydepthstencil
- SPIR-V:
ExecutionMode EarlyFragmentTests
- WGSL:
@early_depth_test(force)
This may also be enabled in a shader by specifying a ConservativeDepth
.
For more, see:
Variants§
Force
Requires depth/stencil tests to be performed before fragment shading.
This will disable depth/stencil tests after fragment shading, so discarding the fragment or overwriting the fragment depth will have no effect.
Allow
Allows an additional depth/stencil test to be performed before fragment shading.
It is up to the driver to decide whether early tests are performed. Unlike Force
, this
does not disable depth/stencil tests after fragment shading.
Fields
conservative: ConservativeDepth
Specifies restrictions on how the depth value can be modified within the fragment shader.
This may be taken into account when deciding whether to perform early tests.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for EarlyDepthTest
impl<'arbitrary> Arbitrary<'arbitrary> for EarlyDepthTest
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read moreSource§impl Clone for EarlyDepthTest
impl Clone for EarlyDepthTest
Source§fn clone(&self) -> EarlyDepthTest
fn clone(&self) -> EarlyDepthTest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for EarlyDepthTest
impl Debug for EarlyDepthTest
Source§impl<'de> Deserialize<'de> for EarlyDepthTest
impl<'de> Deserialize<'de> for EarlyDepthTest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for EarlyDepthTest
impl Hash for EarlyDepthTest
Source§impl Ord for EarlyDepthTest
impl Ord for EarlyDepthTest
Source§fn cmp(&self, other: &EarlyDepthTest) -> Ordering
fn cmp(&self, other: &EarlyDepthTest) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EarlyDepthTest
impl PartialEq for EarlyDepthTest
Source§impl PartialOrd for EarlyDepthTest
impl PartialOrd for EarlyDepthTest
Source§impl Serialize for EarlyDepthTest
impl Serialize for EarlyDepthTest
impl Copy for EarlyDepthTest
impl Eq for EarlyDepthTest
impl StructuralPartialEq for EarlyDepthTest
Auto Trait Implementations§
impl Freeze for EarlyDepthTest
impl RefUnwindSafe for EarlyDepthTest
impl Send for EarlyDepthTest
impl Sync for EarlyDepthTest
impl Unpin for EarlyDepthTest
impl UnwindSafe for EarlyDepthTest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.