/// Used to represent one of many possible errors that may be omitted by the /// rendering subsystem. #[derive(Debug)] pub enum RenderError { PipelineError(gfx::PipelineStateError), UpdateError(gfx::UpdateError), TexUpdateError(gfx::UpdateError<[u16; 3]>), CombinedError(gfx::CombinedError), BufferCreationError(gfx::buffer::CreationError), IncludeError(glsl_include::Error), MappingError(gfx::mapping::Error), CopyError(gfx::CopyError<[u16; 3], usize>), CustomError(String), } impl From> for RenderError { fn from(err: gfx::PipelineStateError) -> Self { Self::PipelineError(err) } } impl From> for RenderError { fn from(err: gfx::PipelineStateError<&str>) -> Self { match err { gfx::PipelineStateError::DescriptorInit(err) => { gfx::PipelineStateError::DescriptorInit(err) }, err => err, } .into() } } impl From for RenderError { fn from(err: gfx::shade::ProgramError) -> Self { gfx::PipelineStateError::::Program(err).into() } } impl From> for RenderError { fn from(err: gfx::UpdateError) -> Self { Self::UpdateError(err) } } impl From> for RenderError { fn from(err: gfx::UpdateError<[u16; 3]>) -> Self { Self::TexUpdateError(err) } } impl From for RenderError { fn from(err: gfx::CombinedError) -> Self { Self::CombinedError(err) } } impl From for RenderError { fn from(err: gfx::TargetViewError) -> Self { Self::CombinedError(err.into()) } } impl From for RenderError { fn from(err: gfx::ResourceViewError) -> Self { Self::CombinedError(err.into()) } } impl From for RenderError { fn from(err: gfx::texture::CreationError) -> Self { Self::CombinedError(err.into()) } } impl From for RenderError { fn from(err: gfx::buffer::CreationError) -> Self { Self::BufferCreationError(err) } } impl From for RenderError { fn from(err: glsl_include::Error) -> Self { Self::IncludeError(err) } } impl From for RenderError { fn from(err: gfx::mapping::Error) -> Self { Self::MappingError(err) } } impl From> for RenderError { fn from(err: gfx::CopyError<[u16; 3], usize>) -> Self { Self::CopyError(err) } }