1 #ifndef MSP_GL_PIPELINESTATE_H_
2 #define MSP_GL_PIPELINESTATE_H_
5 #include <msp/core/noncopyable.h>
7 #include "pipelinestate_backend.h"
24 Stores state for the entire GPU pipeline.
26 Applications normally use the higher-level Renderer class rather than this.
28 class PipelineState: public PipelineStateBackend
30 friend PipelineStateBackend;
37 const Texture *texture;
38 const Sampler *sampler;
40 BoundTexture(unsigned);
43 struct BoundUniformBlock
47 const UniformBlock *block;
49 BoundUniformBlock(int);
67 const Framebuffer *framebuffer = 0;
68 const Rect *viewport = 0;
69 const Rect *scissor = 0;
70 const Program *shprog = 0;
71 const VertexSetup *vertex_setup = 0;
72 FaceWinding front_face = COUNTERCLOCKWISE;
73 CullMode face_cull = NO_CULL;
74 std::vector<BoundTexture> textures;
75 std::vector<BoundUniformBlock> uniform_blocks;
76 const DepthTest *depth_test = 0;
77 const StencilTest *stencil_test = 0;
78 const Blend *blend = 0;
79 mutable unsigned changes = 0;
82 void set(T &, T, unsigned);
84 void set_framebuffer(const Framebuffer *);
85 void set_viewport(const Rect *);
86 void set_scissor(const Rect *);
87 void set_shader_program(const Program *);
88 void set_vertex_setup(const VertexSetup *);
89 void set_front_face(FaceWinding);
90 void set_face_cull(CullMode);
91 void set_texture(unsigned, const Texture *, const Sampler *);
92 void set_uniform_block(int, const UniformBlock *);
93 void set_depth_test(const DepthTest *);
94 void set_stencil_test(const StencilTest *);
95 void set_blend(const Blend *);
97 const Framebuffer *get_framebuffer() const { return framebuffer; }
98 const Program *get_shader_program() const { return shprog; }
99 const VertexSetup *get_vertex_setup() const { return vertex_setup; }
100 FaceWinding get_front_face() const { return front_face; }
101 CullMode get_face_cull() const { return face_cull; }