aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/error.rs
blob: b029975d9450932b694f1d4e5d182cb148ffa617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2019 Oscar Shrimpton

// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.

// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
// more details.

// You should have received a copy of the GNU General Public License along
// with this program.  If not, see <http://www.gnu.org/licenses/>.

//! Error types

/// An error encountered creating a rendering context.
/// Falls into 3 main types:
/// 	- Hardware - No suitable card usually
/// 	- Sanity - Things that probably aren't true, likely indicating a deeper issue.
///				These aren't guaranteed sanity issues, but they are weird issues.
/// 	- Runtime - Things caused by runtime conditions, usually resource constraints.
#[derive(Debug)]
pub enum CreationError {
	WindowError,
	BadSurface,
	
	DeviceError (hal::device::CreationError),

	OutOfMemoryError,

	SyncObjectError,
	
	NoShaderC,
	ShaderCError (shaderc::Error),
	ShaderModuleFailed (hal::device::ShaderError),
	RenderPassError,
	PipelineError (hal::pso::CreationError),
	BufferError (hal::buffer::CreationError),
	BufferNoMemory,
	
	SwapchainError (hal::window::CreationError),
	ImageViewError (hal::image::ViewCreationError)
}

/// An error encountered when rendering.
/// Usually this is out of memory or something happened to the device/surface.
/// You'll likely need to exit or create a new context.
#[derive(Debug, Clone)]
pub enum FrameError {
	AcquireError (hal::window::AcquireError),
	SyncObjectError,
	PresentError
}