1 module ppsl.shader;
2 import ppsl.errors;
3 import ppsl.tokens;
4 
5 enum PPSLCompiler {
6 	GLSL,
7 	CG
8 }
9 
10 class OutputShader {
11 	public string FragmentShader;
12 	public string VertexShader;
13 }
14 
15 class PPSLShaderCollection {
16 	public PPSLShader[] Shaders;
17 
18 	public void Add(PPSLShader shader) {
19 		Shaders.length++;
20 		Shaders[$-1] = shader;
21 	}
22 }
23 
24 public enum PPSLScope {
25 	Fragment,
26 	Vertex,
27 	Total
28 }
29 
30 public enum PPSLAttributeDirection {
31 	In,
32 	Out,
33 	Uniform
34 }
35 
36 public enum PPSLPlacementLoc {
37 	PreAttribute,
38 	Auto
39 }
40 
41 class PPSLAttribute {
42 	public PPSLScope Scope;
43 	public PPSLAttributeDirection Direction;
44 	public string Type;
45 	public string Name;
46 }
47 
48 class PPSLShaderCode {
49 	public PPSLPlacementLoc Location;
50 	public string Code;
51 }
52 
53 class PPSLTechnique {
54 	public string Name;
55 	public string ShaderCode;
56 }
57 
58 class PPSLShaderScope {
59 	public PPSLScope Scope;
60 	public PPSLTechnique[] Techniques;
61 	public PPSLShaderCode Code;
62 }
63 
64 class PPSLShader {
65 	public string Name;
66 	public string Version;
67 	public PPSLAttribute[] Attributes;
68 	public PPSLShaderScope[] Scopes;
69 	public PPSLCompiler Compiler;
70 
71 
72 
73 	private this(PPSLCompiler compiler) {
74 		if (compiler == PPSLCompiler.CG) {
75 			throw ERROR_CG_UNSUPPORTED;
76 		}
77 		this.Compiler = compiler;
78 	}
79 }