GLTypes.cs 1.39 KB
Newer Older
pcy's avatar
initial  
pcy committed
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
using System;
using System.Collections.Generic;
using System.Linq;

namespace PoroCYon.FNAGLSL {
	public class GLException : Exception {
		public readonly GLError Error;

		public GLException(GLError err)
				: base(TranslateMsg(err)) {
			Error = err;
		}

		public static string TranslateMsg(GLError err) {
			switch (err) {
			case GLError.NoError: return "No error";
			case GLError.InvalidEnum: return "Invalid enum";
			case GLError.InvalidValue: return "Invalid value";
			case GLError.InvalidOperation: return "Invalid operation";
			case GLError.StackOverflow: return "Stack overflow";
			case GLError.StackUnderflow: return "Stack underflow";
			case GLError.OutOfMemory: return "Out of memory";
			default: return String.Format("??? ({0})", (uint)err);
			}
		}
	}
	public class GLSLCompileException : Exception {
		public GLSLCompileException(string msg) : base(msg) { }
	}
	public class GLSLLinkException : Exception {
		public GLSLLinkException(string msg) : base(msg) { }
	}

	public enum GLError : uint/*GLenum*/ {
		NoError          = 0,
		InvalidEnum      = 0x0500,
		InvalidValue     = 0x0501,
		InvalidOperation = 0x0502,
		StackOverflow    = 0x0503,
		StackUnderflow   = 0x0504,
		OutOfMemory      = 0x0505
	}

	public enum GLSLPurpose {
		VertexShader   = 0x8B31,
		GeomShader     = 0x8DD9,
		TessCtrlShader = 0x8E88,
		TessEvalShader = 0x8E87,
		FragmentShader = 0x8B30,
		//ComputeShader  = 0x91B9
	}
}