alex/beta-minecraft-rust
Minecraft Beta 1.7.3 Rewrite
BRANCH main
SNAPSHOT Draw terrain GPU-driven from packed per-section buffers with GPU occlusion culling, add a render distance slider (2-128) with a quad/disk shape, cut chunk bookkeeping at high render distances, and fix a light underflow at y=0
DOWNLOAD
root crates volcanic-mem src error.rs
use volcanic::VkResult;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Vulkan command `{0}` is not loaded")]
MissingCommand(&'static str),
#[error("{call} failed with {result:?}")]
Vulkan {
call: &'static str,
result: VkResult,
},
#[error("no memory type satisfies the requirements")]
NoMemoryType,
#[error("out of memory")]
OutOfMemory,
#[error("allocation size must be non-zero")]
ZeroSize,
#[error("alignment {0} is not a power of two")]
InvalidAlignment(u64),
#[error("descriptor heap of {size} bytes exceeds the device limit of {max} bytes")]
HeapTooLarge { size: u64, max: u64 },
#[error("descriptor heap address {address:#x} is not aligned to {alignment}")]
MisalignedHeap { address: u64, alignment: u64 },
}
pub type Result<T, E = Error> = core::result::Result<T, E>;
#[inline]
pub(crate) fn check(call: &'static str, result: VkResult) -> Result<()> {
match result {
VkResult::Success => Ok(()),
VkResult::ErrorOutOfDeviceMemory | VkResult::ErrorOutOfHostMemory => {
Err(Error::OutOfMemory)
}
result => Err(Error::Vulkan { call, result }),
}
}