GLTypes.cs 3.36 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
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
	}
pcy's avatar
pcy committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

	public enum GLSLType : uint/*GLenum*/ {
		FLOAT      = 0x1406,
		FLOAT_VEC2 = 0x8B50,
		FLOAT_VEC3 = 0x8B51,
		FLOAT_VEC4 = 0x8B52,
		INT        = 0x1404,
		INT_VEC2   = 0x8B53,
		INT_VEC3   = 0x8B54,
		INT_VEC4   = 0x8B55,
		UNSIGNED_INT      = 0x1405,
		UNSIGNED_INT_VEC2 = 0x8DC6,
		UNSIGNED_INT_VEC3 = 0x8DC7,
		UNSIGNED_INT_VEC4 = 0x8DC8,
		BOOL       = 0x8B56,
		BOOL_VEC2  = 0x8B57,
		BOOL_VEC3  = 0x8B58,
		BOOL_VEC4  = 0x8B59,
		FLOAT_MAT2   = 0x8B5A,
		FLOAT_MAT3   = 0x8B5B,
		FLOAT_MAT4   = 0x8B5C,
73
		FLOAT_MAT2x3 = 0x8B65, // column x row
pcy's avatar
pcy committed
74
75
76
77
78
79
80
81
82
		FLOAT_MAT2x4 = 0x8B66,
		FLOAT_MAT3x2 = 0x8B67,
		FLOAT_MAT3x4 = 0x8B68,
		FLOAT_MAT4x2 = 0x8B69,
		FLOAT_MAT4x3 = 0x8B6A,
		SAMPLER_1D = 0x8B5D,
		SAMPLER_2D = 0x8B5E,
		SAMPLER_3D = 0x8B5F,
		SAMPLER_CUBE      = 0x8B60,
83
		/*SAMPLER_1D_SHADOW = 0x8B61,
pcy's avatar
pcy committed
84
85
86
87
88
89
90
91
92
93
		SAMPLER_2D_SHADOW = 0x8B62,
		SAMPLER_1D_ARRAY        = 0x8DC0,
		SAMPLER_2D_ARRAY        = 0x0DC1,
		SAMPLER_1D_ARRAY_SHADOW = 0x8DC3,
		SAMPLER_2D_ARRAY_SHADOW = 0x8DC4,
		SAMPLER_CUBE_SHADOW     = 0x8DC5,
		SAMPLER_2D_MULTISAMPLE       = 0x9108,
		SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B,
		SAMPLER_2D_RECT        = 0x8B63,
		SAMPLER_2D_RECT_SHADOW = 0x8B64,
94
		SAMPLER_BUFFER         = 0x8DC2,*/
pcy's avatar
pcy committed
95
96
97
98
		INT_SAMPLER_1D       = 0x8DC9,
		INT_SAMPLER_2D       = 0x8DCA,
		INT_SAMPLER_3D       = 0x8DCB,
		INT_SAMPLER_CUBE     = 0x8DCD,
99
		/*INT_SAMPLER_1D_ARRAY = 0x8DCE,
pcy's avatar
pcy committed
100
101
102
103
		INT_SAMPLER_2D_ARRAY = 0x8DCF,
		INT_SAMPLER_2D_MULTISAMPLE       = 0x9109,
		INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C,
		INT_SAMPLER_BUFFER  = 0x8DD0,
104
		INT_SAMPLER_2D_RECT = 0x8DCD,*/
pcy's avatar
pcy committed
105
106
107
108
		UNSIGNED_INT_SAMPLER_1D       = 0x8DD1,
		UNSIGNED_INT_SAMPLER_2D       = 0x8DD2,
		UNSIGNED_INT_SAMPLER_3D       = 0x8DD3,
		UNSIGNED_INT_SAMPLER_CUBE     = 0x8DD4,
109
		/*UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6,
pcy's avatar
pcy committed
110
111
112
113
		UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7,
		UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE       = 0x910A,
		UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D,
		UNSIGNED_INT_SAMPLER_BUFFER  = 0x8DD8,
114
		UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5*/
pcy's avatar
pcy committed
115
	}
pcy's avatar
initial  
pcy committed
116
117
}