Change how depth format is picked
This commit is contained in:
+38
-31
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
const DUMP_SPV_TO_FILE: bool = true;
|
const DUMP_SPV_TO_FILE: bool = true;
|
||||||
const PIPELINE_CACHING: bool = false;
|
const PIPELINE_CACHING: bool = false;
|
||||||
|
const IGNORE_STENCIL: bool = true;
|
||||||
|
|
||||||
const BYTECODE_IMITATES_GLSL: bool = false;
|
const BYTECODE_IMITATES_GLSL: bool = false;
|
||||||
|
|
||||||
@@ -333,37 +334,37 @@ impl App {
|
|||||||
physical_device.properties().device_type,
|
physical_device.properties().device_type,
|
||||||
);
|
);
|
||||||
|
|
||||||
let depth_format = if physical_device
|
const DEPTH_FORMAT_ORDERING: [Format; 4] = [
|
||||||
.format_properties(Format::D24_UNORM_S8_UINT)
|
Format::D24_UNORM_S8_UINT,
|
||||||
.unwrap()
|
Format::X8_D24_UNORM_PACK32,
|
||||||
.optimal_tiling_features
|
Format::D32_SFLOAT_S8_UINT,
|
||||||
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
Format::D16_UNORM_S8_UINT,
|
||||||
{
|
];
|
||||||
Format::D24_UNORM_S8_UINT
|
|
||||||
} else if physical_device
|
const DEPTH_FORMAT_ORDERING_IGNORE_STENCIL: [Format; 6] = [
|
||||||
.format_properties(Format::X8_D24_UNORM_PACK32)
|
Format::D32_SFLOAT,
|
||||||
.unwrap()
|
Format::D24_UNORM_S8_UINT,
|
||||||
.optimal_tiling_features
|
Format::X8_D24_UNORM_PACK32,
|
||||||
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
Format::D32_SFLOAT_S8_UINT,
|
||||||
{
|
Format::D16_UNORM,
|
||||||
Format::X8_D24_UNORM_PACK32
|
Format::D16_UNORM_S8_UINT,
|
||||||
} else if physical_device
|
];
|
||||||
.format_properties(Format::D32_SFLOAT_S8_UINT)
|
|
||||||
.unwrap()
|
let depth_format = (if IGNORE_STENCIL {
|
||||||
.optimal_tiling_features
|
DEPTH_FORMAT_ORDERING_IGNORE_STENCIL.iter()
|
||||||
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
|
||||||
{
|
|
||||||
Format::D32_SFLOAT_S8_UINT
|
|
||||||
} else if physical_device
|
|
||||||
.format_properties(Format::D16_UNORM_S8_UINT)
|
|
||||||
.unwrap()
|
|
||||||
.optimal_tiling_features
|
|
||||||
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
|
||||||
{
|
|
||||||
Format::D16_UNORM_S8_UINT
|
|
||||||
} else {
|
} else {
|
||||||
panic!("Could not find suitable depth format!");
|
DEPTH_FORMAT_ORDERING.iter()
|
||||||
};
|
})
|
||||||
|
.filter(|format| {
|
||||||
|
physical_device
|
||||||
|
.format_properties(**format)
|
||||||
|
.unwrap()
|
||||||
|
.optimal_tiling_features
|
||||||
|
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
||||||
|
})
|
||||||
|
.next()
|
||||||
|
.expect("Could not find suitable depth format!")
|
||||||
|
.clone();
|
||||||
|
|
||||||
info!("Using depth format {:?}", depth_format);
|
info!("Using depth format {:?}", depth_format);
|
||||||
|
|
||||||
@@ -1583,6 +1584,12 @@ impl App {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let depth_clear = if self.depth_format.numeric_format_stencil().is_some() {
|
||||||
|
Some((0.0, 0).into())
|
||||||
|
} else {
|
||||||
|
Some((0.0).into())
|
||||||
|
};
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.begin_render_pass(
|
.begin_render_pass(
|
||||||
RenderPassBeginInfo {
|
RenderPassBeginInfo {
|
||||||
@@ -1592,7 +1599,7 @@ impl App {
|
|||||||
Some([0.12, 0.1, 0.1, 1.0].into()),
|
Some([0.12, 0.1, 0.1, 1.0].into()),
|
||||||
Some([0.0, 0.0, 0.0, 1.0].into()),
|
Some([0.0, 0.0, 0.0, 1.0].into()),
|
||||||
Some([0.0, 0.0, 0.0, 1.0].into()),
|
Some([0.0, 0.0, 0.0, 1.0].into()),
|
||||||
Some((0.0, 0).into()),
|
depth_clear,
|
||||||
],
|
],
|
||||||
..RenderPassBeginInfo::framebuffer(rcx.framebuffers[image_index].clone())
|
..RenderPassBeginInfo::framebuffer(rcx.framebuffers[image_index].clone())
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user