]> git.tdb.fi Git - libs/gl.git/blobdiff - source/framebuffer.h
Share shader data between copied RenderPasses
[libs/gl.git] / source / framebuffer.h
index 3bf439f98cc62ca3250369abe61cdaf6c5c9de9c..f977ad7eb11fdc109740c7a19077ca1e3e7d7ec9 100644 (file)
@@ -5,7 +5,10 @@
 #include "bindable.h"
 #include "gl.h"
 #include "texturecube.h"
+#include <msp/gl/extensions/arb_geometry_shader4.h>
+#include <msp/gl/extensions/ext_framebuffer_multisample.h>
 #include <msp/gl/extensions/ext_framebuffer_object.h>
+#include <msp/gl/extensions/nv_fbo_color_attachments.h>
 
 namespace Msp {
 namespace GL {
@@ -13,6 +16,7 @@ namespace GL {
 class Renderbuffer;
 class Texture;
 class Texture2D;
+class Texture3D;
 
 enum FramebufferAttachment
 {
@@ -32,6 +36,9 @@ enum FramebufferStatus
        FRAMEBUFFER_INCOMPLETE_FORMATS            = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT,
        FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER        = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER,
        FRAMEBUFFER_INCOMPLETE_READ_BUFFER        = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER,
+       FRAMEBUFFER_INCOMPLETE_MULTISAMPLE        = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE,
+       FRAMEBUFFER_INCOMPLETE_LAYER_COUNT        = GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB,
+       FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS      = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS,
        FRAMEBUFFER_UNSUPPORTED                   = GL_FRAMEBUFFER_UNSUPPORTED,
        FRAMEBUFFER_COMPLETE                      = GL_FRAMEBUFFER_COMPLETE
 };
@@ -40,22 +47,7 @@ enum BufferBits
 {
        COLOR_BUFFER_BIT   = GL_COLOR_BUFFER_BIT,
        DEPTH_BUFFER_BIT   = GL_DEPTH_BUFFER_BIT,
-       STENCIL_BUFFER_BIT = GL_STENCIL_BUFFER_BIT,
-       ACCUM_BUFFER_BIT   = GL_ACCUM_BUFFER_BIT
-};
-
-enum RWBuffer
-{
-       NO_BUFFER      = GL_NONE,
-       FRONT_LEFT     = GL_FRONT_LEFT,
-       FRONT_RIGHT    = GL_FRONT_RIGHT,
-       BACK_LEFT      = GL_BACK_LEFT,
-       BACK_RIGHT     = GL_BACK_RIGHT,
-       FRONT          = GL_FRONT,
-       BACK           = GL_BACK,
-       LEFT           = GL_LEFT,
-       RIGHT          = GL_RIGHT,
-       FRONT_AND_BACK = GL_FRONT_AND_BACK
+       STENCIL_BUFFER_BIT = GL_STENCIL_BUFFER_BIT
 };
 
 class framebuffer_incomplete: public std::runtime_error
@@ -90,18 +82,29 @@ private:
                        Texture *tex;
                };
                unsigned level;
-               GLenum cube_face;
+               unsigned layer;
 
                Attachment(FramebufferAttachment);
                void set(Renderbuffer &);
-               void set(Texture &, GLenum, unsigned);
+               void set(Texture &, unsigned, unsigned);
                void clear();
        };
 
+       struct Viewport
+       {
+               int left;
+               int bottom;
+               unsigned width;
+               unsigned height;
+
+               Viewport();
+       };
+
        unsigned id;
        std::vector<Attachment> attachments;
        unsigned width;
        unsigned height;
+       Viewport view;
        mutable unsigned dirty;
 
        Framebuffer(unsigned);
@@ -119,6 +122,7 @@ private:
 public:
        void attach(FramebufferAttachment attch, Renderbuffer &rbuf);
        void attach(FramebufferAttachment attch, Texture2D &tex, unsigned level = 0);
+       void attach(FramebufferAttachment attch, Texture3D &tex, unsigned layer, unsigned level = 0);
        void attach(FramebufferAttachment attch, TextureCube &tex, TextureCubeFace face, unsigned level = 0);
        void detach(FramebufferAttachment attch);
 
@@ -131,6 +135,9 @@ public:
        isn't. */
        void require_complete() const;
 
+       void viewport(int, int, unsigned, unsigned);
+       void reset_viewport();
+
        void clear(BufferBits);
 
        /** Blits a region from another framebuffer into this one.  If the source