diff options
author | Brad Linden <46733234+brad-linden@users.noreply.github.com> | 2024-05-06 15:44:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 15:44:19 -0700 |
commit | 84827a7cb8d4b7a58309f98c7d4df4cfeb173935 (patch) | |
tree | b91494298eab93bbd8dd9b00722b7a30714a1b9c /indra/newview/lldrawpoolbump.cpp | |
parent | 76101843c0d390c25a783f212eb1ea75e508ada4 (diff) | |
parent | 8b747cee182cd8e95063fa152d9b5d7383cb1c74 (diff) |
Merge pull request #1413 from secondlife/gltf-dev-maint-a-merge
Merge Maint A to development
Diffstat (limited to 'indra/newview/lldrawpoolbump.cpp')
-rw-r--r-- | indra/newview/lldrawpoolbump.cpp | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 518310476b..44531e21bd 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -77,7 +77,7 @@ static LLGLSLShader* shader = NULL; static S32 cube_channel = -1; static S32 diffuse_channel = -1; static S32 bump_channel = -1; -static BOOL shiny = FALSE; +static bool shiny = false; // Enabled after changing LLViewerTexture::mNeedsCreateTexture to an // LLAtomicBool; this should work just fine, now. HB @@ -165,7 +165,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::LOCAL) ; - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, true, false, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0, 30.f) ; LLStandardBumpmap::sStandardBumpmapCount++; } @@ -198,7 +198,7 @@ void LLStandardBumpmap::destroyGL() LLDrawPoolBump::LLDrawPoolBump() : LLRenderPass(LLDrawPool::POOL_BUMP) { - shiny = FALSE; + shiny = false; } @@ -354,7 +354,7 @@ void LLDrawPoolBump::beginFullbrightShiny() diffuse_channel = 0; } - shiny = TRUE; + shiny = true; } void LLDrawPoolBump::renderFullbrightShiny() @@ -406,7 +406,7 @@ void LLDrawPoolBump::endFullbrightShiny() diffuse_channel = -1; cube_channel = 0; - shiny = FALSE; + shiny = false; } void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, bool texture = true) @@ -426,7 +426,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, bool texture = // static -BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) +bool LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) { U8 bump_code = params.mBump; @@ -434,7 +434,7 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) } //static -BOOL LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel) +bool LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel) { const LLTextureEntry* te = face->getTextureEntry(); if (te) @@ -443,11 +443,11 @@ BOOL LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel) return bindBumpMap(bump_code, face->getTexture(), channel); } - return FALSE; + return false; } //static -BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 channel) +bool LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 channel) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //Note: texture atlas does not support bump texture now. @@ -455,7 +455,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 cha if(!tex) { //if the texture is not a fetched texture - return FALSE; + return false; } LLViewerTexture* bump = NULL; @@ -491,10 +491,10 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 cha gGL.getTexUnit(channel)->bind(bump); } - return TRUE; + return true; } - return FALSE; + return false; } //static @@ -549,7 +549,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); - shiny = TRUE; + shiny = true; for (int i = 0; i < 2; ++i) { bool rigged = i == 1; @@ -597,7 +597,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) gGL.getTexUnit(0)->activate(); } - shiny = FALSE; + shiny = false; } @@ -706,12 +706,12 @@ void LLBumpImageList::updateImages() LLViewerTexture* image = iter->second; if( image ) { - BOOL destroy = TRUE; + bool destroy = true; if( image->hasGLTexture()) { if( image->getBoundRecently() ) { - destroy = FALSE; + destroy = false; } else { @@ -735,12 +735,12 @@ void LLBumpImageList::updateImages() LLViewerTexture* image = curiter->second; if( image ) { - BOOL destroy = TRUE; + bool destroy = true; if( image->hasGLTexture()) { if( image->getBoundRecently() ) { - destroy = FALSE; + destroy = false; } else { @@ -767,7 +767,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText LLViewerTexture* bump = NULL; bump_image_map_t* entries_list = NULL; - void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL; + void (*callback_func)( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) = NULL; switch( bump_code ) { @@ -791,7 +791,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText } else { - (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( TRUE ); + (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( true ); bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image } @@ -802,7 +802,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText //(LLPipeline::sRenderDeferred && bump->getComponents() != 4)) { src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ; - src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); + src_image->setLoadedCallback( callback_func, 0, true, false, new LLUUID(src_image->getID()), NULL ); src_image->forceToSaveRawImage(0) ; } } @@ -812,7 +812,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText // static -void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) +void LLBumpImageList::onSourceBrightnessLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLUUID* source_asset_id = (LLUUID*)userdata; @@ -824,7 +824,7 @@ void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTex } // static -void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) +void LLBumpImageList::onSourceDarknessLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) { LLUUID* source_asset_id = (LLUUID*)userdata; LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_DARKNESS ); @@ -834,7 +834,7 @@ void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTextu } } -void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +void LLBumpImageList::onSourceStandardLoaded( bool success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata) { if (success && LLPipeline::sRenderDeferred) { @@ -852,11 +852,14 @@ void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTextu void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image) { + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(nrm_image); + U8* nrm_data = nrm_image->getData(); S32 resX = src->getWidth(); S32 resY = src->getHeight(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); S32 src_cmp = src->getComponents(); @@ -906,7 +909,7 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr } // static -void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) +void LLBumpImageList::onSourceLoaded( bool success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) { LL_PROFILE_ZONE_SCOPED; @@ -914,6 +917,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + LLImageDataSharedLock lock(src); bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries ); bump_image_map_t::iterator iter = entries_list.find(source_asset_id); @@ -924,7 +928,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI iter->second->getWidth() != src->getWidth() || iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution { //make sure an entry exists for this image - entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture(TRUE); + entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture(true); iter = entries_list.find(src_vi->getID()); } } @@ -936,7 +940,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI U8* dst_data = dst_image->getData(); S32 dst_data_size = dst_image->getDataSize(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); S32 src_data_size = src->getDataSize(); S32 src_components = src->getComponents(); @@ -1089,7 +1093,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI bump_ptr->ref(); auto create_func = [=]() { - img->setUseMipMaps(TRUE); + img->setUseMipMaps(true); // upload dst_image to GPU (greyscale in red channel) img->setExplicitFormat(GL_RED, GL_RED); @@ -1103,7 +1107,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI // Note: bump will still point at GPU copy of dst_image bump_ptr->setExplicitFormat(GL_RGBA, GL_RGBA); LLGLuint tex_name; - img->createGLTexture(0, nullptr, 0, 0, true, &tex_name); + img->createGLTexture(0, nullptr, false, 0, true, &tex_name); // point render target at empty buffer sRenderTarget.setColorAttachment(img, tex_name); @@ -1115,7 +1119,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI LLGLDepthTest depth(GL_FALSE); LLGLDisable cull(GL_CULL_FACE); LLGLDisable blend(GL_BLEND); - gGL.setColorMask(TRUE, TRUE); + gGL.setColorMask(true, true); gNormalMapGenProgram.bind(); |