1 #ifndef MSP_GL_PIPELINESTATE_H_
2 #define MSP_GL_PIPELINESTATE_H_
5 #include <msp/core/noncopyable.h>
7 #include "pipelinestate_backend.h"
23 class PipelineState: public PipelineStateBackend
25 friend PipelineStateBackend;
32 const Texture *texture;
33 const Sampler *sampler;
35 BoundTexture(unsigned);
38 struct BoundUniformBlock
42 const UniformBlock *block;
44 BoundUniformBlock(int);
63 const Framebuffer *framebuffer = 0;
64 const Rect *viewport = 0;
65 const Rect *scissor = 0;
66 const Program *shprog = 0;
67 const VertexSetup *vertex_setup = 0;
68 FaceWinding front_face = COUNTERCLOCKWISE;
69 CullMode face_cull = NO_CULL;
70 unsigned enabled_clip_planes = 0;
71 std::vector<BoundTexture> textures;
72 std::vector<BoundUniformBlock> uniform_blocks;
73 const DepthTest *depth_test = 0;
74 const StencilTest *stencil_test = 0;
75 const Blend *blend = 0;
76 mutable unsigned changes = 0;
79 void set(T &, T, unsigned);
81 void set_framebuffer(const Framebuffer *);
82 void set_viewport(const Rect *);
83 void set_scissor(const Rect *);
84 void set_shader_program(const Program *);
85 void set_vertex_setup(const VertexSetup *);
86 void set_front_face(FaceWinding);
87 void set_face_cull(CullMode);
88 void set_enabled_clip_planes(unsigned);
89 void set_texture(unsigned, const Texture *, const Sampler *);
90 void set_uniform_block(int, const UniformBlock *);
91 void set_depth_test(const DepthTest *);
92 void set_stencil_test(const StencilTest *);
93 void set_blend(const Blend *);
95 const Framebuffer *get_framebuffer() const { return framebuffer; }
96 const Program *get_shader_program() const { return shprog; }
97 const VertexSetup *get_vertex_setup() const { return vertex_setup; }
98 FaceWinding get_front_face() const { return front_face; }
99 CullMode get_face_cull() const { return face_cull; }