X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fpipelinestate.h;h=42543e4dc2596f5de2e2c0a7c71e85f9b64fa4c8;hb=be92396630a2065e43c21d9d1904e97014844cff;hp=a931e25c406808232cd07809c44d616d15c5a7d4;hpb=2b2676392aff2eb6b38c3e463cc67f4d67a4ef8b;p=libs%2Fgl.git diff --git a/source/core/pipelinestate.h b/source/core/pipelinestate.h index a931e25c..42543e4d 100644 --- a/source/core/pipelinestate.h +++ b/source/core/pipelinestate.h @@ -1,27 +1,29 @@ -#ifndef PIPELINESTATE_H_ -#define PIPELINESTATE_H_ +#ifndef MSP_GL_PIPELINESTATE_H_ +#define MSP_GL_PIPELINESTATE_H_ #include #include #include "cullface.h" +#include "pipelinestate_backend.h" namespace Msp { namespace GL { class Blend; -class BufferBackedUniformBlock; -class DefaultUniformBlock; class DepthTest; +class Framebuffer; class Program; +class Rect; class Sampler; class StencilTest; class Texture; class UniformBlock; class VertexSetup; -class WindingTest; -class PipelineState: public NonCopyable +class PipelineState: public PipelineStateBackend { + friend PipelineStateBackend; + private: struct BoundTexture { @@ -52,9 +54,15 @@ private: UNIFORMS = 32, DEPTH_TEST = 64, STENCIL_TEST = 128, - BLEND = 256 + BLEND = 256, + FRAMEBUFFER = 512, + VIEWPORT = 1024, + SCISSOR = 2048 }; + const Framebuffer *framebuffer; + const Rect *viewport; + const Rect *scissor; const Program *shprog; const VertexSetup *vertex_setup; FaceWinding front_face; @@ -67,42 +75,32 @@ private: const Blend *blend; mutable unsigned changes; - static const PipelineState *last_applied; - static std::vector bound_tex_targets; - public: PipelineState(); - ~PipelineState(); private: template void set(T &, T, unsigned); public: + void set_framebuffer(const Framebuffer *); + void set_viewport(const Rect *); + void set_scissor(const Rect *); void set_shader_program(const Program *); void set_vertex_setup(const VertexSetup *); void set_front_face(FaceWinding); void set_face_cull(CullMode); void set_enabled_clip_planes(unsigned); void set_texture(unsigned, const Texture *, const Sampler *); - void set_uniforms(const DefaultUniformBlock *); - void set_uniform_block(unsigned, const BufferBackedUniformBlock *); -private: - void set_uniform_block_(int, const UniformBlock *); -public: + void set_uniform_block(int, const UniformBlock *); void set_depth_test(const DepthTest *); void set_stencil_test(const StencilTest *); void set_blend(const Blend *); + const Framebuffer *get_framebuffer() const { return framebuffer; } const Program *get_shader_program() const { return shprog; } const VertexSetup *get_vertex_setup() const { return vertex_setup; } FaceWinding get_front_face() const { return front_face; } CullMode get_face_cull() const { return face_cull; } - - void apply() const; -private: - void apply(unsigned) const; -public: - static void clear(); }; } // namespace GL