diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/llrender/llrendertarget.h | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/llrender/llrendertarget.h')
-rw-r--r-- | indra/llrender/llrendertarget.h | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 9fcea35e3d..b5745b5b49 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -1,25 +1,25 @@ -/** +/** * @file llrendertarget.h * @brief Off screen render target abstraction. Loose wrapper for GL_EXT_framebuffer_objects. * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,56 +37,56 @@ SAMPLE USAGE: - LLRenderTarget target; + LLRenderTarget target; - ... + ... - //allocate a 256x256 RGBA render target with depth buffer - target.allocate(256,256,GL_RGBA,TRUE); + //allocate a 256x256 RGBA render target with depth buffer + target.allocate(256,256,GL_RGBA,TRUE); - //render to contents of offscreen buffer - target.bindTarget(); - target.clear(); - ... <issue drawing commands> ... - target.flush(); + //render to contents of offscreen buffer + target.bindTarget(); + target.clear(); + ... <issue drawing commands> ... + target.flush(); - ... + ... - //use target as a texture - gGL.getTexUnit(INDEX)->bind(&target); - ... <issue drawing commands> ... + //use target as a texture + gGL.getTexUnit(INDEX)->bind(&target); + ... <issue drawing commands> ... */ class LLRenderTarget { public: - //whether or not to use FBO implementation - static bool sUseFBO; - static U32 sBytesAllocated; - static U32 sCurFBO; - static U32 sCurResX; - static U32 sCurResY; + //whether or not to use FBO implementation + static bool sUseFBO; + static U32 sBytesAllocated; + static U32 sCurFBO; + static U32 sCurResX; + static U32 sCurResY; - LLRenderTarget(); - ~LLRenderTarget(); + LLRenderTarget(); + ~LLRenderTarget(); - //allocate resources for rendering - //must be called before use - //multiple calls will release previously allocated resources + //allocate resources for rendering + //must be called before use + //multiple calls will release previously allocated resources // resX - width // resY - height // color_fmt - GL color format (e.g. GL_RGB) // depth - if true, allocate a depth buffer // usage - deprecated, should always be TT_TEXTURE - bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth = false, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, LLTexUnit::eTextureMipGeneration generateMipMaps = LLTexUnit::TMG_NONE); + bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth = false, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, LLTexUnit::eTextureMipGeneration generateMipMaps = LLTexUnit::TMG_NONE); - //resize existing attachments to use new resolution and color format - // CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined - // DO NOT use for screen space buffers or for scratch space for an image that might be uploaded - // DO use for render targets that resize often and aren't likely to ruin someone's day if they break - void resize(U32 resx, U32 resy); + //resize existing attachments to use new resolution and color format + // CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined + // DO NOT use for screen space buffers or for scratch space for an image that might be uploaded + // DO use for render targets that resize often and aren't likely to ruin someone's day if they break + void resize(U32 resx, U32 resy); //point this render target at a particular LLImageGL // Intended usage: @@ -96,95 +96,95 @@ public: // < issue GL calls> // target.flush(); // target.releaseColorAttachment(); - // + // // attachment -- LLImageGL to render into // use_name -- optional texture name to target instead of attachment->getTexName() // NOTE: setColorAttachment and releaseColorAttachment cannot be used in conjuction with - // addColorAttachment, allocateDepth, resize, etc. + // addColorAttachment, allocateDepth, resize, etc. void setColorAttachment(LLImageGL* attachment, LLGLuint use_name = 0); // detach from current color attachment void releaseColorAttachment(); - //add color buffer attachment - //limit of 4 color attachments per render target - bool addColorAttachment(U32 color_fmt); + //add color buffer attachment + //limit of 4 color attachments per render target + bool addColorAttachment(U32 color_fmt); - //allocate a depth texture - bool allocateDepth(); + //allocate a depth texture + bool allocateDepth(); - //share depth buffer with provided render target - void shareDepthBuffer(LLRenderTarget& target); + //share depth buffer with provided render target + void shareDepthBuffer(LLRenderTarget& target); - //free any allocated resources - //safe to call redundantly + //free any allocated resources + //safe to call redundantly // asserts that this target is not currently bound or present in the RT stack - void release(); + void release(); - //bind target for rendering - //applies appropriate viewport - // If an LLRenderTarget is currently bound, stores a reference to that LLRenderTarget + //bind target for rendering + //applies appropriate viewport + // If an LLRenderTarget is currently bound, stores a reference to that LLRenderTarget // and restores previous binding on flush() (maintains a stack of Render Targets) // Asserts that this target is not currently bound in the stack - void bindTarget(); + void bindTarget(); - //clear render targer, clears depth buffer if present, - //uses scissor rect if in copy-to-texture mode + //clear render targer, clears depth buffer if present, + //uses scissor rect if in copy-to-texture mode // asserts that this target is currently bound - void clear(U32 mask = 0xFFFFFFFF); - - //get applied viewport - void getViewport(S32* viewport); + void clear(U32 mask = 0xFFFFFFFF); + + //get applied viewport + void getViewport(S32* viewport); - //get X resolution - U32 getWidth() const { return mResX; } + //get X resolution + U32 getWidth() const { return mResX; } - //get Y resolution - U32 getHeight() const { return mResY; } + //get Y resolution + U32 getHeight() const { return mResY; } - LLTexUnit::eTextureType getUsage(void) const { return mUsage; } + LLTexUnit::eTextureType getUsage(void) const { return mUsage; } - U32 getTexture(U32 attachment = 0) const; - U32 getNumTextures() const; + U32 getTexture(U32 attachment = 0) const; + U32 getNumTextures() const; - U32 getDepth(void) const { return mDepth; } + U32 getDepth(void) const { return mDepth; } - void bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options = LLTexUnit::TFO_BILINEAR); + void bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options = LLTexUnit::TFO_BILINEAR); - //flush rendering operations - //must be called when rendering is complete - //should be used 1:1 with bindTarget - // call bindTarget once, do all your rendering, call flush once + //flush rendering operations + //must be called when rendering is complete + //should be used 1:1 with bindTarget + // call bindTarget once, do all your rendering, call flush once // If an LLRenderTarget was bound when bindTarget was called, binds that RenderTarget for rendering (maintains RT stack) // asserts that this target is currently bound - void flush(); + void flush(); - //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; + //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; // Returns true if this RenderTarget is bound somewhere in the stack bool isBoundInStack() const; - static LLRenderTarget* getCurrentBoundTarget() { return sBoundTarget; } + static LLRenderTarget* getCurrentBoundTarget() { return sBoundTarget; } protected: - U32 mResX; - U32 mResY; - std::vector<U32> mTex; - std::vector<U32> mInternalFormat; - U32 mFBO; + U32 mResX; + U32 mResY; + std::vector<U32> mTex; + std::vector<U32> mInternalFormat; + U32 mFBO; LLRenderTarget* mPreviousRT = nullptr; U32 mDepth; bool mUseDepth; - LLTexUnit::eTextureMipGeneration mGenerateMipMaps; - U32 mMipLevels; + LLTexUnit::eTextureMipGeneration mGenerateMipMaps; + U32 mMipLevels; + + LLTexUnit::eTextureType mUsage; - LLTexUnit::eTextureType mUsage; - - static LLRenderTarget* sBoundTarget; + static LLRenderTarget* sBoundTarget; }; #endif |