summaryrefslogtreecommitdiff
path: root/indra/llrender/llrendertarget.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llrendertarget.h')
-rw-r--r--indra/llrender/llrendertarget.h58
1 files changed, 49 insertions, 9 deletions
diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h
index d6db054e45..d5d809b791 100644
--- a/indra/llrender/llrendertarget.h
+++ b/indra/llrender/llrendertarget.h
@@ -33,6 +33,9 @@
#ifndef LL_LLRENDERTARGET_H
#define LL_LLRENDERTARGET_H
+// LLRenderTarget is unavailible on the mapserver since it uses FBOs.
+#if !LL_MESA_HEADLESS
+
#include "llgl.h"
#include "llrender.h"
@@ -60,6 +63,7 @@
*/
+class LLMultisampleBuffer;
class LLRenderTarget
{
@@ -68,15 +72,25 @@ public:
static BOOL sUseFBO;
LLRenderTarget();
- ~LLRenderTarget();
+ virtual ~LLRenderTarget();
//allocate resources for rendering
//must be called before use
//multiple calls will release previously allocated resources
- void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, BOOL use_fbo = FALSE);
+ void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, BOOL use_fbo = FALSE);
+
+ //provide this render target with a multisample resource.
+ void setSampleBuffer(LLMultisampleBuffer* buffer);
+
+ //add color buffer attachment
+ //limit of 4 color attachments per render target
+ virtual void addColorAttachment(U32 color_fmt);
//allocate a depth texture
- void allocateDepth();
+ virtual void allocateDepth();
+
+ //share depth buffer with provided render target
+ virtual void shareDepthBuffer(LLRenderTarget& target);
//free any allocated resources
//safe to call redundantly
@@ -84,14 +98,14 @@ public:
//bind target for rendering
//applies appropriate viewport
- void bindTarget();
+ virtual void bindTarget();
//unbind target for rendering
static void unbindTarget();
//clear render targer, clears depth buffer if present,
//uses scissor rect if in copy-to-texture mode
- void clear();
+ void clear(U32 mask = 0xFFFFFFFF);
//get applied viewport
void getViewport(S32* viewport);
@@ -104,10 +118,12 @@ public:
LLTexUnit::eTextureType getUsage(void) const { return mUsage; }
- U32 getTexture(void) const { return mTex; }
+ U32 getTexture(U32 attachment = 0) const;
U32 getDepth(void) const { return mDepth; }
+ void bindTexture(U32 index, S32 channel);
+
//flush rendering operations
//must be called when rendering is complete
//should be used 1:1 with bindTarget
@@ -116,23 +132,47 @@ public:
// the current depth texture. A depth texture will be allocated if needed.
void flush(BOOL fetch_depth = FALSE);
+ void copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1,
+ S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter);
+
//Returns TRUE if target is ready to be rendered into.
//That is, if the target has been allocated with at least
//one renderable attachment (i.e. color buffer, depth buffer).
BOOL isComplete() const;
-private:
+protected:
+ friend class LLMultisampleBuffer;
U32 mResX;
U32 mResY;
- U32 mTex;
+ std::vector<U32> mTex;
U32 mFBO;
U32 mDepth;
- U32 mStencil;
+ BOOL mStencil;
BOOL mUseDepth;
BOOL mRenderDepth;
LLTexUnit::eTextureType mUsage;
+ U32 mSamples;
+ LLMultisampleBuffer* mSampleBuffer;
};
+class LLMultisampleBuffer : public LLRenderTarget
+{
+public:
+ LLMultisampleBuffer();
+ virtual ~LLMultisampleBuffer();
+
+ void releaseSampleBuffer();
+
+ virtual void bindTarget();
+ void bindTarget(LLRenderTarget* ref);
+ virtual void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo);
+ void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples);
+ virtual void addColorAttachment(U32 color_fmt);
+ virtual void allocateDepth();
+};
+
+#endif //!LL_MESA_HEADLESS
+
#endif