diff options
author | Brad Linden <brad@lindenlab.com> | 2024-06-10 16:22:12 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-06-10 16:22:12 -0700 |
commit | 7c42711ca3a4e67b95473aa5129dce5ff19bea15 (patch) | |
tree | 593c0bedf07bffc79ec4640b157839edf61260f5 /indra/llrender | |
parent | e0e6e7fd747121442370fc811c84aa34ed612f64 (diff) | |
parent | 9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff) |
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into project/gltf_development
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llfontbitmapcache.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llfontbitmapcache.h | 2 | ||||
-rw-r--r-- | indra/llrender/llfontfreetype.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llfontgl.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 8 | ||||
-rw-r--r-- | indra/llrender/llgl.h | 9 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 4 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 70 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 28 |
12 files changed, 68 insertions, 73 deletions
diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index d2c40ad590..46c2e89797 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -108,7 +108,7 @@ bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp S32 num_components = getNumComponents(bitmap_type); mImageRawVec[bitmap_idx].push_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components)); - bitmap_num = mImageRawVec[bitmap_idx].size() - 1; + bitmap_num = static_cast<U32>(mImageRawVec[bitmap_idx].size()) - 1; LLImageRaw* image_raw = getImageRaw(bitmap_type, bitmap_num); if (EFontGlyphType::Grayscale == bitmap_type) diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 6b19ba2154..f2dfd87877 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -60,7 +60,7 @@ public: LLImageGL* getImageGL(EFontGlyphType bitmapType, U32 bitmapNum) const; S32 getMaxCharWidth() const { return mMaxCharWidth; } - U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? mImageRawVec[static_cast<U32>(bitmapType)].size() : 0; } + U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? static_cast<U32>(mImageRawVec[static_cast<U32>(bitmapType)].size()) : 0U; } S32 getBitmapWidth() const { return mBitmapWidth; } S32 getBitmapHeight() const { return mBitmapHeight; } diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 94b576885f..741ed993b0 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -328,7 +328,7 @@ S32 LLFontFreetype::ftOpenFace(const std::string& filename, S32 face_n) pFtStream = new LLFT_Stream(); pFtStream->base = 0; pFtStream->pos = 0; - pFtStream->size = file_size; + pFtStream->size = static_cast<unsigned long>(file_size); pFtStream->descriptor.pointer = pFileStream; pFtStream->read = ft_read_cb; pFtStream->close = ft_close_cb; diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 25706c77eb..59ee8ef84f 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -149,7 +149,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if(!sDisplayFont) //do not display texts { - return wstr.length() ; + return static_cast<S32>(wstr.length()); } if (wstr.empty()) @@ -278,7 +278,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons LLColor4U text_color(color); // Preserve the transparency to render fading emojis in fading text (e.g. // for the chat console)... HB - LLColor4U emoji_color(255, 255, 255, text_color.mV[VW]); + LLColor4U emoji_color(255, 255, 255, text_color.mV[VALPHA]); std::pair<EFontGlyphType, S32> bitmap_entry = std::make_pair(EFontGlyphType::Grayscale, -1); S32 glyph_count = 0; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 0586c34e50..7959b3bb57 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1173,7 +1173,7 @@ bool LLGLManager::initGL() // This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture. initExtensions(); - S32 old_vram = mVRAM; + U32 old_vram = mVRAM; mVRAM = 0; #if LL_WINDOWS @@ -1215,7 +1215,7 @@ bool LLGLManager::initGL() // Function will check all GPUs WMI knows of and will pick up the one with most // memory. We need to check all GPUs because system can switch active GPU to // weaker one, to preserve power when not under load. - S32 mem = LLDXHardware::getMBVideoMemoryViaWMI(); + U32 mem = LLDXHardware::getMBVideoMemoryViaWMI(); if (mem != 0) { mVRAM = mem; @@ -1240,7 +1240,7 @@ bool LLGLManager::initGL() glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples); glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &mMaxUniformBlockSize); - // sanity clamp max uniform block size to 64k just in case + // sanity clamp max uniform block size to 64k just in case // there's some implementation that reports a crazy value mMaxUniformBlockSize = llmin(mMaxUniformBlockSize, 65536); @@ -1350,7 +1350,7 @@ void LLGLManager::asLLSD(LLSD& info) info["gpu_version"] = mDriverVersionVendorString; info["opengl_version"] = mGLVersionString; - info["vram"] = mVRAM; + info["vram"] = LLSD::Integer(mVRAM); // OpenGL limits info["max_samples"] = mMaxSamples; diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 254c983110..909dad2e85 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -119,9 +119,7 @@ public: std::string mDriverVersionVendorString; std::string mGLVersionString; - S32 mVRAM; // VRAM in MB - - void getPixelFormat(); // Get the best pixel format + U32 mVRAM; // VRAM in MB std::string getGLInfoString(); void printGLInfoString(); @@ -139,7 +137,6 @@ public: private: void initExtensions(); void initGLStates(); - void initGLImages(); }; extern LLGLManager gGLManager; @@ -161,11 +158,11 @@ void clear_glerror(); # define llglassertok() assert_glerror() // stop_glerror is still needed on OS X but has performance implications -// use macro below to conditionally add stop_glerror to non-release builds +// use macro below to conditionally add stop_glerror to non-release builds // on OS X #if LL_DARWIN && !LL_RELEASE_FOR_DOWNLOAD #define STOP_GLERROR stop_glerror() -#else +#else #define STOP_GLERROR #endif diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 6a60914b80..e47c842228 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -384,7 +384,7 @@ void LLGLSLShader::unloadInternal() bool LLGLSLShader::createShader() { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - + unloadInternal(); sInstances.insert(this); @@ -968,7 +968,7 @@ bool LLGLSLShader::mapUniforms() glUniformBlockBinding(mProgramObject, UBOBlockIndex, i); } } - + unbind(); LL_DEBUGS("ShaderUniform") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL; diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index f2b5c4881c..3b4224cbfd 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -70,8 +70,8 @@ public: template<typename T> struct UniformSetting { - S32 mUniform; - T mValue; + S32 mUniform{ 0 }; + T mValue{}; }; typedef UniformSetting<S32> IntSetting; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 59f3dd56d6..7e5cd628c1 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -100,7 +100,7 @@ void LLImageGLMemory::free_tex_image(U32 texName) // track texture free on given texNames void LLImageGLMemory::free_tex_images(U32 count, const U32* texNames) { - for (int i = 0; i < count; ++i) + for (U32 i = 0; i < count; ++i) { free_tex_image(texNames[i]); } @@ -1318,7 +1318,7 @@ void LLImageGL::generateTextures(S32 numTextures, U32 *textures) name_count = pool_size; } - if (numTextures <= name_count) + if ((U32)numTextures <= name_count) { //copy teture names off the end of the pool memcpy(textures, name_pool + name_count - numTextures, sizeof(U32) * numTextures); diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 098e23435d..efdde77a32 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llrendertarget.cpp * @brief LLRenderTarget implementation * * $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$ */ @@ -44,7 +44,7 @@ void check_framebuffer_status() break; default: LL_WARNS() << "check_framebuffer_status failed -- " << std::hex << status << LL_ENDL; - ll_fail("check_framebuffer_status failed"); + ll_fail("check_framebuffer_status failed"); break; } } @@ -75,10 +75,10 @@ LLRenderTarget::~LLRenderTarget() } void LLRenderTarget::resize(U32 resx, U32 resy) -{ +{ //for accounting, get the number of pixels added/subtracted S32 pix_diff = (resx*resy)-(mResX*mResY); - + mResX = resx; mResY = resy; @@ -92,7 +92,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy) } if (mDepth) - { + { gGL.getTexUnit(0)->bindManual(mUsage, mDepth); U32 internal_type = LLTexUnit::getInternalType(mUsage); LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); @@ -100,7 +100,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy) sBytesAllocated += pix_diff*4; } } - + bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLTexUnit::eTextureType usage, LLTexUnit::eTextureMipGeneration generateMipMaps) { @@ -112,7 +112,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLT resy = llmin(resy, (U32) gGLManager.mGLMaxTextureSize); release(); - + mResX = resx; mResY = resy; @@ -125,7 +125,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLT // Calculate the number of mip levels based upon resolution that we should have. mMipLevels = 1 + floor(log10((float)llmax(mResX, mResY))/log10(2.0)); } - + if (depth) { if (!allocateDepth()) @@ -140,12 +140,12 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLT if (mDepth) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), mDepth, 0); glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); } - + return addColorAttachment(color_fmt); } @@ -190,7 +190,7 @@ void LLRenderTarget::releaseColorAttachment() llassert(!isBoundInStack()); llassert(mTex.size() == 1); //cannot use releaseColorAttachment with LLRenderTarget managed color targets llassert(mFBO != 0); // mFBO must be valid - + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, LLTexUnit::getInternalType(mUsage), 0, 0); glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); @@ -208,7 +208,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) return true; } - U32 offset = mTex.size(); + U32 offset = static_cast<U32>(mTex.size()); if( offset >= 4 ) { @@ -238,12 +238,12 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) return false; } } - + sBytesAllocated += mResX*mResY*4; stop_glerror(); - + if (offset == 0) { //use bilinear filtering on single texture render targets that aren't multisampled gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); @@ -266,15 +266,15 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); stop_glerror(); } - + if (mFBO) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+offset, LLTexUnit::getInternalType(mUsage), tex, 0); - + check_framebuffer_status(); - + glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); } @@ -286,8 +286,8 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) bindTarget(); flush(); } - - + + return true; } @@ -296,7 +296,7 @@ bool LLRenderTarget::allocateDepth() LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; LLImageGL::generateTextures(1, &mDepth); gGL.getTexUnit(0)->bindManual(mUsage, mDepth); - + U32 internal_type = LLTexUnit::getInternalType(mUsage); stop_glerror(); clear_glerror(); @@ -336,7 +336,7 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) if (mDepth) { glBindFramebuffer(GL_FRAMEBUFFER, target.mFBO); - + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), mDepth, 0); check_framebuffer_status(); @@ -355,7 +355,7 @@ void LLRenderTarget::release() if (mDepth) { LLImageGL::deleteTextures(1, &mDepth); - + mDepth = 0; sBytesAllocated -= mResX*mResY*4; @@ -378,11 +378,11 @@ void LLRenderTarget::release() if (mFBO && (mTex.size() > 1)) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - S32 z; + size_t z; for (z = mTex.size() - 1; z >= 1; z--) { sBytesAllocated -= mResX*mResY*4; - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+z, LLTexUnit::getInternalType(mUsage), 0, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, static_cast<GLenum>(GL_COLOR_ATTACHMENT0+z), LLTexUnit::getInternalType(mUsage), 0, 0); LLImageGL::deleteTextures(1, &mTex[z]); } glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); @@ -408,7 +408,7 @@ void LLRenderTarget::release() mTex.clear(); mInternalFormat.clear(); - + mResX = mResY = 0; } @@ -417,7 +417,7 @@ void LLRenderTarget::bindTarget() LL_PROFILE_GPU_ZONE("bindTarget"); llassert(mFBO); llassert(!isBoundInStack()); - + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); sCurFBO = mFBO; @@ -426,8 +426,8 @@ void LLRenderTarget::bindTarget() GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; - glDrawBuffers(mTex.size(), drawbuffers); - + glDrawBuffers(static_cast<GLsizei>(mTex.size()), drawbuffers); + if (mTex.empty()) { //no color buffer to draw to glDrawBuffer(GL_NONE); @@ -452,7 +452,7 @@ void LLRenderTarget::clear(U32 mask_in) if (mUseDepth) { mask |= GL_DEPTH_BUFFER_BIT; - + } if (mFBO) { @@ -485,7 +485,7 @@ U32 LLRenderTarget::getTexture(U32 attachment) const U32 LLRenderTarget::getNumTextures() const { - return mTex.size(); + return static_cast<U32>(mTex.size()); } void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options) @@ -560,7 +560,7 @@ bool LLRenderTarget::isBoundInStack() const { LLRenderTarget* cur = sBoundTarget; while (cur && cur != this) - { + { cur = cur->mPreviousRT; } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 4d53df5f06..c3cb015556 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -689,7 +689,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev { //switches are supported in GLSL 1.30 and later if (gGLManager.mIsNVIDIA) { //switches are unreliable on some NVIDIA drivers - for (U32 i = 0; i < texture_index_channels; ++i) + for (S32 i = 0; i < texture_index_channels; ++i) { std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i); extra_code_text[extra_code_count++] = strdup(if_string.c_str()); @@ -1120,7 +1120,7 @@ bool LLShaderMgr::saveCachedProgramBinary(LLGLSLShader* shader) program_binary.resize(binary_info.mBinaryLength); GLenum error = glGetError(); // Clear current error - glGetProgramBinary(shader->mProgramObject, program_binary.size() * sizeof(U8), nullptr, &binary_info.mBinaryFormat, program_binary.data()); + glGetProgramBinary(shader->mProgramObject, static_cast<GLsizei>(program_binary.size() * sizeof(U8)), nullptr, &binary_info.mBinaryFormat, program_binary.data()); error = glGetError(); if (error == GL_NO_ERROR) { diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index a4d33c91df..5bace72ffd 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -316,7 +316,7 @@ public: { //allocate a new buffer LL_PROFILE_GPU_ZONE("vbo alloc"); - // ON OS X, we don't allocate a VBO until the last possible moment + // ON OS X, we don't allocate a VBO until the last possible moment // in unmapBuffer data = (U8*) ll_aligned_malloc_16(size); STOP_GLERROR; @@ -328,12 +328,12 @@ public: LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER); llassert(size >= 2); - + if (data) { ll_aligned_free_16(data); } - + mAllocated -= size; STOP_GLERROR; if (name) @@ -702,7 +702,7 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto if (tc != nullptr) { - for (int i = 0; i < num_indices; ++i) + for (U32 i = 0; i < num_indices; ++i) { U16 idx = indicesp[i]; gGL.texCoord2fv(tc[idx].mV); @@ -711,7 +711,7 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto } else { - for (int i = 0; i < num_indices; ++i) + for (U32 i = 0; i < num_indices; ++i) { U16 idx = indicesp[i]; gGL.vertex3fv(pos[idx].getF32ptr()); @@ -728,19 +728,17 @@ bool LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of return true; } - llassert(start < (U32)mNumVerts); - llassert(end < (U32)mNumVerts); + llassert(start < mNumVerts); + llassert(end < mNumVerts); - if (start >= (U32) mNumVerts || - end >= (U32) mNumVerts) + if (start >= mNumVerts || + end >= mNumVerts) { LL_ERRS() << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << LL_ENDL; } - llassert(mNumIndices >= 0); - - if (indices_offset >= (U32) mNumIndices || - indices_offset + count > (U32) mNumIndices) + if (indices_offset >= mNumIndices || + indices_offset + count > mNumIndices) { LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL; } @@ -778,7 +776,7 @@ bool LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of for (U32 i = start; i < end; i++) { U32 idx = (U32) (v[i][3]+0.25f); - if (idx >= shader->mFeatures.mIndexedTextureChannels) + if (idx >= (U32)shader->mFeatures.mIndexedTextureChannels) { LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL; } @@ -1491,7 +1489,7 @@ void LLVertexBuffer::setBuffer() // no data may be pending llassert(mMappedVertexRegions.empty()); llassert(mMappedIndexRegions.empty()); - + // a shader must be bound llassert(LLGLSLShader::sCurBoundShaderPtr); |