1 #ifndef MSP_GL_PIPELINESTATE_H_
2 #define MSP_GL_PIPELINESTATE_H_
5 #include <msp/core/noncopyable.h>
7 #include "pipelinestate_backend.h"
8 #include "primitivetype.h"
25 Stores state for the entire GPU pipeline.
27 Applications normally use the higher-level Renderer class rather than this.
29 class PipelineState: public PipelineStateBackend
31 friend PipelineStateBackend;
38 const Texture *texture;
39 const Sampler *sampler;
41 BoundTexture(unsigned);
44 struct BoundUniformBlock
48 const UniformBlock *block;
50 BoundUniformBlock(int);
69 const Framebuffer *framebuffer = 0;
70 const Rect *viewport = 0;
71 const Rect *scissor = 0;
72 const Program *shprog = 0;
73 std::vector<BoundUniformBlock> uniform_blocks;
74 std::vector<BoundTexture> textures;
75 const VertexSetup *vertex_setup = 0;
76 PrimitiveType primitive_type = TRIANGLES;
77 FaceWinding front_face = COUNTERCLOCKWISE;
78 CullMode face_cull = NO_CULL;
79 const DepthTest *depth_test = 0;
80 const StencilTest *stencil_test = 0;
81 const Blend *blend = 0;
84 void set(T &, T, unsigned);
86 void set_framebuffer(const Framebuffer *);
87 void set_viewport(const Rect *);
88 void set_scissor(const Rect *);
89 void set_shader_program(const Program *);
90 void set_uniform_block(int, const UniformBlock *);
91 void set_texture(unsigned, const Texture *, const Sampler *);
92 void set_vertex_setup(const VertexSetup *);
93 void set_primitive_type(PrimitiveType);
94 void set_front_face(FaceWinding);
95 void set_face_cull(CullMode);
96 void set_depth_test(const DepthTest *);
97 void set_stencil_test(const StencilTest *);
98 void set_blend(const Blend *);
100 const Framebuffer *get_framebuffer() const { return framebuffer; }
101 const Program *get_shader_program() const { return shprog; }
102 const VertexSetup *get_vertex_setup() const { return vertex_setup; }
103 FaceWinding get_front_face() const { return front_face; }
104 CullMode get_face_cull() const { return face_cull; }