1 module evael.renderer.pipeline;
2 
3 import evael.renderer.enums;
4 import evael.renderer.shader;
5 import evael.renderer.texture;
6 import evael.renderer.blend_state;
7 import evael.renderer.depth_state;
8 import evael.renderer.resources;
9 import evael.renderer.graphics_buffer;
10 
11 import evael.lib.memory;
12 import evael.lib.containers;
13 
14 abstract class Pipeline
15 {
16     public uint primitiveType;
17 
18     public Shader shader;
19     
20     public BlendState blendState;
21     
22     public DepthState depthState;
23 
24     protected Array!Resource m_resources;
25 
26     @nogc
27     public this()
28     {
29         this.blendState = BlendState.Default;
30     }
31 
32     @nogc
33     public ~this()
34     {
35         foreach (resource; this.m_resources)
36         {
37             MemoryHelper.dispose(resource);
38         }
39 
40         this.m_resources.dispose();
41     }
42 
43     @nogc
44     public abstract void apply() const nothrow;
45 
46     @nogc
47     public abstract void clear() const nothrow;
48     
49     @nogc
50     public abstract TextureResource addTextureResource(Texture texture = null);
51 
52     @nogc
53     @property nothrow
54     public ref Array!Resource resources()
55     {
56         return this.m_resources;
57     }
58 
59 }