Refactor dynamic state commands (#1911)

This commit is contained in:
Rua 2022-06-06 20:33:23 +02:00 committed by GitHub
parent bd53e74150
commit 6da73f3be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 972 additions and 577 deletions

File diff suppressed because it is too large Load Diff

View File

@ -17,8 +17,8 @@ use crate::{
},
device::{physical::QueueFamily, DeviceOwned},
query::{
GetResultsError, QueriesRange, Query, QueryControlFlags, QueryPool, QueryResultElement,
QueryResultFlags, QueryType,
QueriesRange, Query, QueryControlFlags, QueryPool, QueryResultElement, QueryResultFlags,
QueryType,
},
sync::{AccessFlags, PipelineMemoryAccess, PipelineStage, PipelineStages},
DeviceSize, VulkanObject,
@ -888,20 +888,3 @@ impl From<SyncCommandBufferBuilderError> for QueryError {
Self::SyncCommandBufferBuilderError(err)
}
}
impl From<GetResultsError> for QueryError {
#[inline]
fn from(value: GetResultsError) -> Self {
match value {
GetResultsError::BufferTooSmall {
required_len,
actual_len,
} => Self::BufferTooSmall {
required_len,
actual_len,
},
GetResultsError::InvalidFlags => Self::InvalidFlags,
GetResultsError::DeviceLost | GetResultsError::OomError(_) => unreachable!(),
}
}
}

View File

@ -48,7 +48,7 @@ use std::{
borrow::Cow,
collections::{hash_map::Entry, HashMap},
error, fmt,
ops::Range,
ops::{Range, RangeInclusive},
sync::Arc,
};
@ -958,7 +958,7 @@ pub(in crate::command_buffer) struct CurrentState {
pub(in crate::command_buffer) cull_mode: Option<CullMode>,
pub(in crate::command_buffer) depth_bias: Option<DepthBias>,
pub(in crate::command_buffer) depth_bias_enable: Option<bool>,
pub(in crate::command_buffer) depth_bounds: Option<(f32, f32)>,
pub(in crate::command_buffer) depth_bounds: Option<RangeInclusive<f32>>,
pub(in crate::command_buffer) depth_bounds_test_enable: Option<bool>,
pub(in crate::command_buffer) depth_compare_op: Option<CompareOp>,
pub(in crate::command_buffer) depth_test_enable: Option<bool>,
@ -1223,8 +1223,8 @@ impl<'a> CommandBufferState<'a> {
/// Returns the current depth bounds settings, or `None` if nothing has been set yet.
#[inline]
pub fn depth_bounds(&self) -> Option<(f32, f32)> {
self.current_state.depth_bounds
pub fn depth_bounds(&self) -> Option<RangeInclusive<f32>> {
self.current_state.depth_bounds.clone()
}
/// Returns whether depth bound testing is enabled, or `None` if nothing has been set yet.