Fix using cubemaps with immutable images

This commit is contained in:
Pierre Krieger 2016-09-13 22:59:25 +02:00
parent 8303728870
commit 043c2ac50c
2 changed files with 14 additions and 1 deletions

View File

@ -111,7 +111,7 @@ impl<F> ImmutableImage<F> {
format: format,
per_layer: {
let mut v = SmallVec::new();
for _ in 0 .. dimensions.array_layers() {
for _ in 0 .. dimensions.array_layers_with_cube() {
v.push(PerLayer {
latest_write_submission: Mutex::new(None),
started_reading: AtomicBool::new(false),

View File

@ -206,6 +206,19 @@ impl Dimensions {
}
}
#[inline]
pub fn array_layers_with_cube(&self) -> u32 {
match *self {
Dimensions::Dim1d { .. } => 1,
Dimensions::Dim1dArray { array_layers, .. } => array_layers,
Dimensions::Dim2d { .. } => 1,
Dimensions::Dim2dArray { array_layers, .. } => array_layers,
Dimensions::Dim3d { .. } => 1,
Dimensions::Cubemap { .. } => 6,
Dimensions::CubemapArray { array_layers, .. } => array_layers * 6,
}
}
/// Builds the corresponding `ImageDimensions`.
#[inline]
pub fn to_image_dimensions(&self) -> ImageDimensions {