aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llrendertarget.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llrender/llrendertarget.h
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llrender/llrendertarget.h')
-rw-r--r--linden/indra/llrender/llrendertarget.h61
1 files changed, 51 insertions, 10 deletions
diff --git a/linden/indra/llrender/llrendertarget.h b/linden/indra/llrender/llrendertarget.h
index 38a41cb..d5d809b 100644
--- a/linden/indra/llrender/llrendertarget.h
+++ b/linden/indra/llrender/llrendertarget.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -32,6 +33,9 @@
32#ifndef LL_LLRENDERTARGET_H 33#ifndef LL_LLRENDERTARGET_H
33#define LL_LLRENDERTARGET_H 34#define LL_LLRENDERTARGET_H
34 35
36// LLRenderTarget is unavailible on the mapserver since it uses FBOs.
37#if !LL_MESA_HEADLESS
38
35#include "llgl.h" 39#include "llgl.h"
36#include "llrender.h" 40#include "llrender.h"
37 41
@@ -59,6 +63,7 @@
59 63
60*/ 64*/
61 65
66class LLMultisampleBuffer;
62 67
63class LLRenderTarget 68class LLRenderTarget
64{ 69{
@@ -67,15 +72,25 @@ public:
67 static BOOL sUseFBO; 72 static BOOL sUseFBO;
68 73
69 LLRenderTarget(); 74 LLRenderTarget();
70 ~LLRenderTarget(); 75 virtual ~LLRenderTarget();
71 76
72 //allocate resources for rendering 77 //allocate resources for rendering
73 //must be called before use 78 //must be called before use
74 //multiple calls will release previously allocated resources 79 //multiple calls will release previously allocated resources
75 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, BOOL use_fbo = FALSE); 80 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, BOOL use_fbo = FALSE);
81
82 //provide this render target with a multisample resource.
83 void setSampleBuffer(LLMultisampleBuffer* buffer);
84
85 //add color buffer attachment
86 //limit of 4 color attachments per render target
87 virtual void addColorAttachment(U32 color_fmt);
76 88
77 //allocate a depth texture 89 //allocate a depth texture
78 void allocateDepth(); 90 virtual void allocateDepth();
91
92 //share depth buffer with provided render target
93 virtual void shareDepthBuffer(LLRenderTarget& target);
79 94
80 //free any allocated resources 95 //free any allocated resources
81 //safe to call redundantly 96 //safe to call redundantly
@@ -83,14 +98,14 @@ public:
83 98
84 //bind target for rendering 99 //bind target for rendering
85 //applies appropriate viewport 100 //applies appropriate viewport
86 void bindTarget(); 101 virtual void bindTarget();
87 102
88 //unbind target for rendering 103 //unbind target for rendering
89 static void unbindTarget(); 104 static void unbindTarget();
90 105
91 //clear render targer, clears depth buffer if present, 106 //clear render targer, clears depth buffer if present,
92 //uses scissor rect if in copy-to-texture mode 107 //uses scissor rect if in copy-to-texture mode
93 void clear(); 108 void clear(U32 mask = 0xFFFFFFFF);
94 109
95 //get applied viewport 110 //get applied viewport
96 void getViewport(S32* viewport); 111 void getViewport(S32* viewport);
@@ -103,10 +118,12 @@ public:
103 118
104 LLTexUnit::eTextureType getUsage(void) const { return mUsage; } 119 LLTexUnit::eTextureType getUsage(void) const { return mUsage; }
105 120
106 U32 getTexture(void) const { return mTex; } 121 U32 getTexture(U32 attachment = 0) const;
107 122
108 U32 getDepth(void) const { return mDepth; } 123 U32 getDepth(void) const { return mDepth; }
109 124
125 void bindTexture(U32 index, S32 channel);
126
110 //flush rendering operations 127 //flush rendering operations
111 //must be called when rendering is complete 128 //must be called when rendering is complete
112 //should be used 1:1 with bindTarget 129 //should be used 1:1 with bindTarget
@@ -115,23 +132,47 @@ public:
115 // the current depth texture. A depth texture will be allocated if needed. 132 // the current depth texture. A depth texture will be allocated if needed.
116 void flush(BOOL fetch_depth = FALSE); 133 void flush(BOOL fetch_depth = FALSE);
117 134
135 void copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1,
136 S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter);
137
118 //Returns TRUE if target is ready to be rendered into. 138 //Returns TRUE if target is ready to be rendered into.
119 //That is, if the target has been allocated with at least 139 //That is, if the target has been allocated with at least
120 //one renderable attachment (i.e. color buffer, depth buffer). 140 //one renderable attachment (i.e. color buffer, depth buffer).
121 BOOL isComplete() const; 141 BOOL isComplete() const;
122 142
123private: 143protected:
144 friend class LLMultisampleBuffer;
124 U32 mResX; 145 U32 mResX;
125 U32 mResY; 146 U32 mResY;
126 U32 mTex; 147 std::vector<U32> mTex;
127 U32 mFBO; 148 U32 mFBO;
128 U32 mDepth; 149 U32 mDepth;
129 U32 mStencil; 150 BOOL mStencil;
130 BOOL mUseDepth; 151 BOOL mUseDepth;
131 BOOL mRenderDepth; 152 BOOL mRenderDepth;
132 LLTexUnit::eTextureType mUsage; 153 LLTexUnit::eTextureType mUsage;
154 U32 mSamples;
155 LLMultisampleBuffer* mSampleBuffer;
133 156
134}; 157};
135 158
159class LLMultisampleBuffer : public LLRenderTarget
160{
161public:
162 LLMultisampleBuffer();
163 virtual ~LLMultisampleBuffer();
164
165 void releaseSampleBuffer();
166
167 virtual void bindTarget();
168 void bindTarget(LLRenderTarget* ref);
169 virtual void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo);
170 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples);
171 virtual void addColorAttachment(U32 color_fmt);
172 virtual void allocateDepth();
173};
174
175#endif //!LL_MESA_HEADLESS
176
136#endif 177#endif
137 178