Fallback to D32 when D24 isn't available

This commit is contained in:
Joshua Groves committed 2019-09-27 23:44:26 -06:00
1 parent cbe197eb44
commit e430a4cf40
8 files changed
+51 -21

No files matched your search

+3 -1
View File
@@ -1,5 +1,5 @@
use super::CommandBuffer;
use crate::{hub::GfxBackend, track::TrackerSet, DeviceId, LifeGuard, Stored, SubmissionIndex};
use crate::{hub::GfxBackend, track::TrackerSet, DeviceId, Features, LifeGuard, Stored, SubmissionIndex};
use hal::{command::CommandBuffer as _, device::Device as _, pool::CommandPool as _};
use log::trace;
@@ -63,6 +63,7 @@ impl<B: GfxBackend> CommandAllocator<B> {
&self,
device_id: Stored<DeviceId>,
device: &B::Device,
features: Features,
) -> CommandBuffer<B> {
//debug_assert_eq!(device_id.backend(), B::VARIANT);
let thread_id = thread::current().id();
@@ -88,6 +89,7 @@ impl<B: GfxBackend> CommandAllocator<B> {
life_guard: LifeGuard::new(),
trackers: TrackerSet::new(B::VARIANT),
used_swap_chain: None,
features,
}
}
+5 -3
View File
@@ -30,6 +30,7 @@ use crate::{
CommandEncoderId,
ComputePassId,
DeviceId,
Features,
LifeGuard,
RenderPassId,
Stored,
@@ -119,6 +120,7 @@ pub struct CommandBuffer<B: hal::Backend> {
pub(crate) life_guard: LifeGuard,
pub(crate) trackers: TrackerSet,
pub(crate) used_swap_chain: Option<(Stored<TextureViewId>, B::Framebuffer)>,
pub(crate) features: Features,
}
impl<B: GfxBackend> CommandBuffer<B> {
@@ -324,7 +326,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
}
};
hal::pass::Attachment {
format: Some(conv::map_texture_format(view.format)),
format: Some(conv::map_texture_format(view.format, device.features)),
samples: view.samples,
ops: conv::map_load_store_ops(at.depth_load_op, at.depth_store_op),
stencil_ops: conv::map_load_store_ops(at.stencil_load_op, at.stencil_store_op),
@@ -400,7 +402,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
};
colors.push(hal::pass::Attachment {
format: Some(conv::map_texture_format(view.format)),
format: Some(conv::map_texture_format(view.format, device.features)),
samples: view.samples,
ops: conv::map_load_store_ops(at.load_op, at.store_op),
stencil_ops: hal::pass::AttachmentOps::DONT_CARE,
@@ -472,7 +474,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
};
resolves.push(hal::pass::Attachment {
format: Some(conv::map_texture_format(view.format)),
format: Some(conv::map_texture_format(view.format, device.features)),
samples: view.samples,
ops: hal::pass::AttachmentOps::new(
hal::pass::AttachmentLoadOp::DontCare,
+2 -3
View File
@@ -145,7 +145,6 @@ pub fn command_encoder_copy_buffer_to_texture<B: GfxBackend>(
) {
let hub = B::hub();
let mut token = Token::root();
let (mut cmb_guard, mut token) = hub.command_buffers.write(&mut token);
let cmb = &mut cmb_guard[command_encoder_id];
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
@@ -181,7 +180,7 @@ pub fn command_encoder_copy_buffer_to_texture<B: GfxBackend>(
});
let aspects = dst_texture.full_range.aspects;
let bytes_per_texel = conv::map_texture_format(dst_texture.format)
let bytes_per_texel = conv::map_texture_format(dst_texture.format, cmb.features)
.surface_desc()
.bits as u32
/ BITS_PER_BYTE;
@@ -271,7 +270,7 @@ pub fn command_encoder_copy_texture_to_buffer<B: GfxBackend>(
});
let aspects = src_texture.full_range.aspects;
let bytes_per_texel = conv::map_texture_format(src_texture.format)
let bytes_per_texel = conv::map_texture_format(src_texture.format, cmb.features)
.surface_desc()
.bits as u32
/ BITS_PER_BYTE;