diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-12-09 16:34:28 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2022-12-09 16:34:28 -0500 |
commit | f41278082f2ab204ec60c15ee1530ca4440937a5 (patch) | |
tree | c382bb0e6cde299e853d09b19a47f1d82dc537fa /indra | |
parent | fc424a0db90fd2d2e44e85a19750ad6eaa57b28a (diff) | |
parent | e3b34fec6962e6deda3dd9dd83bf9fa20ab594af (diff) |
SL-18809: Merge 'DRTVWR-559' of secondlife/viewer into sl-18809
Diffstat (limited to 'indra')
86 files changed, 2115 insertions, 1505 deletions
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index e5060a1076..9b1de2e9a5 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -477,9 +477,14 @@ void LLQueuedThread::processRequest(LLQueuedThread::QueuedRequest* req) mRequestQueue.post([=] { LL_PROFILE_ZONE_NAMED("processRequest - retry"); - while (LL::WorkQueue::TimePoint::clock::now() < retry_time) + if (LL::WorkQueue::TimePoint::clock::now() < retry_time) { - std::this_thread::yield(); //note: don't use LLThread::yield here to avoid + auto sleep_time = std::chrono::duration_cast<std::chrono::milliseconds>(retry_time - LL::WorkQueue::TimePoint::clock::now()); + + if (sleep_time.count() > 0) + { + ms_sleep(sleep_time.count()); + } } processRequest(req); }); diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index a807acc56e..4eaa05c335 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -42,6 +42,7 @@ #ifdef LL_WINDOWS + const DWORD MS_VC_EXCEPTION=0x406D1388; #pragma pack(push,8) @@ -133,6 +134,15 @@ void LLThread::threadRun() { #ifdef LL_WINDOWS set_thread_name(-1, mName.c_str()); + +#if 0 // probably a bad idea, see usage of SetThreadIdealProcessor in LLWindowWin32) + HANDLE hThread = GetCurrentThread(); + if (hThread) + { + SetThreadAffinityMask(hThread, (DWORD_PTR) 0xFFFFFFFFFFFFFFFE); + } +#endif + #endif LL_PROFILER_SET_THREAD_NAME( mName.c_str() ); diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 8739eeef00..24eaa4c1a9 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -92,6 +92,7 @@ U32 micro_sleep(U64 us, U32 max_yields) U32 micro_sleep(U64 us, U32 max_yields) { LL_PROFILE_ZONE_SCOPED +#if 0 LARGE_INTEGER ft; ft.QuadPart = -static_cast<S64>(us * 10); // '-' using relative time @@ -99,6 +100,9 @@ U32 micro_sleep(U64 us, U32 max_yields) SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); WaitForSingleObject(timer, INFINITE); CloseHandle(timer); +#else + Sleep(us / 1000); +#endif return 0; } diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp index 856306d8f4..3a9a5a2062 100644 --- a/indra/llcommon/threadpool.cpp +++ b/indra/llcommon/threadpool.cpp @@ -23,6 +23,43 @@ #include "llsd.h" #include "stringize.h" +#include <boost/fiber/algo/round_robin.hpp> + +/***************************************************************************** +* Custom fiber scheduler for worker threads +*****************************************************************************/ +// As of 2022-12-06, each of our worker threads only runs a single (default) +// fiber: we don't launch explicit fibers within worker threads, nor do we +// anticipate doing so. So a worker thread that's simply waiting for incoming +// tasks should really sleep a little. Override the default fiber scheduler to +// implement that. +struct sleepy_robin: public boost::fibers::algo::round_robin +{ + virtual void suspend_until( std::chrono::steady_clock::time_point const&) noexcept + { +#if LL_WINDOWS + // round_robin holds a std::condition_variable, and + // round_robin::suspend_until() calls + // std::condition_variable::wait_until(). On Windows, that call seems + // busier than it ought to be. Try just sleeping. + Sleep(1); +#else + // currently unused other than windows, but might as well have something here + // different units than Sleep(), but we actually just want to sleep for any de-minimis duration + usleep(1); +#endif + } + + virtual void notify() noexcept + { + // Since our Sleep() call above will wake up on its own, we need not + // take any special action to wake it. + } +}; + +/***************************************************************************** +* ThreadPoolBase +*****************************************************************************/ LL::ThreadPoolBase::ThreadPoolBase(const std::string& name, size_t threads, WorkQueueBase* queue): super(name), @@ -81,6 +118,11 @@ void LL::ThreadPoolBase::close() void LL::ThreadPoolBase::run(const std::string& name) { +#if LL_WINDOWS + // Try using sleepy_robin fiber scheduler. + boost::fibers::use_scheduling_algorithm<sleepy_robin>(); +#endif // LL_WINDOWS + LL_DEBUGS("ThreadPool") << name << " starting" << LL_ENDL; run(); LL_DEBUGS("ThreadPool") << name << " stopping" << LL_ENDL; diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index d634945632..e3b29dc812 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -61,6 +61,21 @@ U32 LLGLSLShader::sTotalDrawCalls = 0; LLGLSLShader gUIProgram; LLGLSLShader gSolidColorProgram; +// NOTE: Keep gShaderConsts* and LLGLSLShader::ShaderConsts_e in sync! +const std::string gShaderConstsKey[ LLGLSLShader::NUM_SHADER_CONSTS ] = +{ + "LL_SHADER_CONST_CLOUD_MOON_DEPTH" + , "LL_SHADER_CONST_STAR_DEPTH" +}; + +// NOTE: Keep gShaderConsts* and LLGLSLShader::ShaderConsts_e in sync! +const std::string gShaderConstsVal[ LLGLSLShader::NUM_SHADER_CONSTS ] = +{ + "0.99998" // SHADER_CONST_CLOUD_MOON_DEPTH // SL-14113 + , "0.99999" // SHADER_CONST_STAR_DEPTH // SL-14113 +}; + + BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) { return v1 != v2; @@ -776,6 +791,11 @@ void LLGLSLShader::addPermutation(std::string name, std::string value) mDefines[name] = value; } +void LLGLSLShader::addConstant( const LLGLSLShader::eShaderConsts shader_const ) +{ + addPermutation( gShaderConstsKey[ shader_const ], gShaderConstsVal[ shader_const ] ); +} + void LLGLSLShader::removePermutation(std::string name) { mDefines[name].erase(); diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 67a9fca53a..23db1a8549 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -135,6 +135,13 @@ public: class LLGLSLShader { public: + // NOTE: Keep gShaderConsts and LLGLSLShader::ShaderConsts_e in sync! + enum eShaderConsts + { + SHADER_CONST_CLOUD_MOON_DEPTH + , SHADER_CONST_STAR_DEPTH + , NUM_SHADER_CONSTS + }; // enum primarily used to control application sky settings uniforms typedef enum @@ -224,6 +231,8 @@ public: void addPermutation(std::string name, std::string value); void removePermutation(std::string name); + void addConstant( const LLGLSLShader::eShaderConsts shader_const ); + //enable/disable texture channel for specified uniform //if given texture uniform is active in the shader, //the corresponding channel will be active upon return diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index fc24c6846d..6122681c09 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -74,10 +74,12 @@ U32 vbo_block_size(U32 size) U32 vbo_block_index(U32 size) { - return vbo_block_size(size)/LL_VBO_BLOCK_SIZE; + U32 blocks = vbo_block_size(size)/LL_VBO_BLOCK_SIZE; // block count reqd + llassert(blocks > 0); + return blocks - 1; // Adj index, i.e. single-block allocations are at index 0, etc } -const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE); +const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE) + 1; //============================================================================ @@ -120,7 +122,6 @@ bool LLVertexBuffer::sUseStreamDraw = true; bool LLVertexBuffer::sUseVAO = false; bool LLVertexBuffer::sPreferStreamDraw = false; - U32 LLVBOPool::genBuffer() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX @@ -151,8 +152,9 @@ void LLVBOPool::deleteBuffer(U32 name) LLVBOPool::LLVBOPool(U32 vboUsage, U32 vboType) -: mUsage(vboUsage), mType(vboType) +: mUsage(vboUsage), mType(vboType), mMissCountDirty(true) { + mFreeList.resize(LL_VBO_POOL_SEED_COUNT); mMissCount.resize(LL_VBO_POOL_SEED_COUNT); std::fill(mMissCount.begin(), mMissCount.end(), 0); } @@ -181,6 +183,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (!for_seed && i < LL_VBO_POOL_SEED_COUNT) { //record this miss mMissCount[i]++; + mMissCountDirty = true; // signal to ::seedPool() } if (mType == GL_ARRAY_BUFFER) @@ -200,13 +203,13 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) ret = (U8*) ll_aligned_malloc<64>(size); if (!ret) { - LL_ERRS() << "Failed to allocate "<< size << " bytes for LLVBOPool buffer " << name <<"." << LL_NEWLINE - << "Free list size: " << mFreeList.size() // this happens if we are out of memory so a solution might be to clear some from freelist + LL_ERRS() + << "Failed to allocate " << size << " bytes for LLVBOPool buffer " << name << "." << LL_NEWLINE + << "Free list size: " + << mFreeList.size() // this happens if we are out of memory so a solution might be to clear some from freelist << " Allocated Bytes: " << LLVertexBuffer::sAllocatedBytes - << " Allocated Index Bytes: " << LLVertexBuffer::sAllocatedIndexBytes - << " Pooled Bytes: " << sBytesPooled - << " Pooled Index Bytes: " << sIndexBytesPooled - << LL_ENDL; + << " Allocated Index Bytes: " << LLVertexBuffer::sAllocatedIndexBytes << " Pooled Bytes: " << sBytesPooled + << " Pooled Index Bytes: " << sIndexBytesPooled << LL_ENDL; } } } @@ -234,6 +237,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) sIndexBytesPooled += size; } mFreeList[i].push_back(rec); + mMissCountDirty = true; // signal to ::seedPool() } } else @@ -251,6 +255,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) } mFreeList[i].pop_front(); + mMissCountDirty = true; // signal to ::seedPool() } return ret; @@ -276,31 +281,27 @@ void LLVBOPool::release(U32 name, U8* buffer, U32 size) void LLVBOPool::seedPool() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX - U32 dummy_name = 0; - - if (mFreeList.size() < LL_VBO_POOL_SEED_COUNT) + if (mMissCountDirty) { - LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("VBOPool Resize"); - mFreeList.resize(LL_VBO_POOL_SEED_COUNT); - } + U32 dummy_name = 0; + U32 size = LL_VBO_BLOCK_SIZE; for (U32 i = 0; i < LL_VBO_POOL_SEED_COUNT; i++) { if (mMissCount[i] > mFreeList[i].size()) { - U32 size = i*LL_VBO_BLOCK_SIZE; - S32 count = mMissCount[i] - mFreeList[i].size(); for (U32 j = 0; j < count; ++j) { allocate(dummy_name, size, true); } } + size += LL_VBO_BLOCK_SIZE; + } + mMissCountDirty = false; } } - - void LLVBOPool::cleanup() { U32 size = LL_VBO_BLOCK_SIZE; @@ -478,7 +479,7 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos) } gGL.end(); gGL.flush(); -} + } //static void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp) @@ -514,7 +515,7 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto U16 idx = indicesp[i]; gGL.vertex3fv(pos[idx].getF32ptr()); } - } +} gGL.end(); gGL.flush(); } @@ -709,10 +710,10 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const #ifndef LL_RELEASE_FOR_DOWNLOAD llassert(mNumVerts >= 0); - if (first >= (U32)mNumVerts || - first + count > (U32)mNumVerts) + if (first >= (U32) mNumVerts || + first + count > (U32) mNumVerts) { - LL_ERRS() << "Bad vertex buffer draw range: [" << first << ", " << first + count << "]" << LL_ENDL; + LL_ERRS() << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << LL_ENDL; } if (mGLArray) @@ -792,6 +793,11 @@ void LLVertexBuffer::cleanupClass() sStreamVBOPool.cleanup(); sDynamicVBOPool.cleanup(); sDynamicCopyVBOPool.cleanup(); + + llassert(0 == LLVBOPool::sBytesPooled); + llassert(0 == LLVBOPool::sIndexBytesPooled); + //llassert(0 == sAllocatedBytes); + //llassert(0 == sAllocatedIndexBytes); } //---------------------------------------------------------------------------- @@ -2381,10 +2387,10 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) } llglassertok(); -} + } void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) -{ + { U8* base = (U8*)mAlignedOffset; if (data_mask & MAP_NORMAL) @@ -2472,7 +2478,7 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } -} + } LLVertexBuffer::MappedRegion::MappedRegion(S32 type, S32 index, S32 count) : mType(type), mIndex(index), mCount(count) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index e846ab70e2..4d73cf07c0 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -88,6 +88,7 @@ public: typedef std::list<Record> record_list_t; std::vector<record_list_t> mFreeList; std::vector<U32> mMissCount; + bool mMissCountDirty; // flag any changes to mFreeList or mMissCount //used to avoid calling glGenBuffers for every VBO creation static U32 sNamePool[1024]; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index c0d3424141..be5af8240f 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -467,7 +467,6 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // process deprioritization during profiles // force high thread priority HANDLE hProcess = GetCurrentProcess(); - HANDLE hThread = GetCurrentThread(); if (hProcess) { @@ -484,6 +483,20 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, } } } +#endif + +#if 0 // this is also probably a bad idea, but keep it in your back pocket for getting main thread off of background thread cores (see also LLThread::threadRun) + HANDLE hThread = GetCurrentThread(); + + SYSTEM_INFO sysInfo; + + GetSystemInfo(&sysInfo); + U32 core_count = sysInfo.dwNumberOfProcessors; + + if (max_cores != 0) + { + core_count = llmin(core_count, max_cores); + } if (hThread) { @@ -499,6 +512,9 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, { LL_INFOS() << "Failed to set thread priority: " << std::hex << GetLastError() << LL_ENDL; } + + // tell main thread to prefer core 0 + SetThreadIdealProcessor(hThread, 0); } } #endif diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bea54f0b69..7a0a3428b3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9558,7 +9558,7 @@ <key>RenderHoverGlowEnable</key> <map> <key>Comment</key> - <string>Show glow effect when hovering on interactive objects.</string> + <string>DEPRECATED --- Show glow effect when hovering on interactive objects.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -10327,7 +10327,8 @@ <key>Value</key> <integer>1</integer> </map> - <key>RenderReflectionDetail</key> + + <key>RenderReflectionDetail</key> <map> <key>Comment</key> <string>DEPRECATED -- use RenderTransparentWater and RenderReflectionProbeDetail -- Detail of reflection render pass.</string> @@ -10349,6 +10350,17 @@ <key>Value</key> <integer>2</integer> </map> + <key>RenderReflectionsEnabled</key> + <map> + <key>Comment</key> + <string>Enable/disable reflection probes</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>RenderReflectionProbeDetail</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl deleted file mode 100644 index bbdc8fdd1c..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @file avatarAlphaNoColorV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec2 texcoord0; - -mat4 getSkinnedTransform(); -void calcAtmospherics(vec3 inPositionEye); - -float calcDirectionalLight(vec3 n, vec3 l); - -vec3 atmosAmbient(); -vec3 atmosAffectDirectionalLight(float lightIntensity); - -VARYING vec3 vary_position; -VARYING vec3 vary_ambient; -VARYING vec3 vary_directional; -VARYING vec3 vary_fragcoord; -VARYING vec3 vary_pointlight_col; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_norm; - - -uniform float near_clip; - -uniform vec4 color; - -uniform vec4 light_position[8]; -uniform vec3 light_direction[8]; -uniform vec3 light_attenuation[8]; -uniform vec3 light_diffuse[8]; - -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight); - -void main() -{ - vary_texcoord0 = texcoord0; - - vec4 pos; - vec3 norm; - - mat4 trans = getSkinnedTransform(); - vec4 pos_in = vec4(position.xyz, 1.0); - pos.x = dot(trans[0], pos_in); - pos.y = dot(trans[1], pos_in); - pos.z = dot(trans[2], pos_in); - pos.w = 1.0; - - norm.x = dot(trans[0].xyz, normal); - norm.y = dot(trans[1].xyz, normal); - norm.z = dot(trans[2].xyz, normal); - norm = normalize(norm); - vary_norm = norm; - - vec4 frag_pos = projection_matrix * pos; - gl_Position = frag_pos; - - vary_position = pos.xyz; - - calcAtmospherics(pos.xyz); - - vec4 col = vec4(0.0, 0.0, 0.0, 1.0); - - // Collect normal lights - col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z); - col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z); - col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z); - col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z); - col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z); - col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z); - - vary_pointlight_col = col.rgb*color.rgb; - - col.rgb = vec3(0,0,0); - - // Add windlight lights - col.rgb = atmosAmbient(); - - vary_ambient = col.rgb*color.rgb; - vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); - - col.rgb = col.rgb * color.rgb; - - vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); -} - - diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index 788ce4a47b..b45dfcd550 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -126,6 +126,6 @@ void main() frag_data[1] = vec4(0.0,0.0,0.0,0.0); frag_data[2] = vec4(0,0,0,GBUFFER_FLAG_SKIP_ATMOS); - gl_FragDepth = 0.99995f; + gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 Stars and Clouds need same depth } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 33b97aefcb..73e5b401c0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -54,35 +54,44 @@ vec3 fullbrightScaleSoftClip(vec3 light); uniform float minimum_alpha; #endif +#ifdef IS_ALPHA +void waterClip(vec3 pos); +#endif + void main() { + +#ifdef IS_ALPHA + waterClip(vary_position.xyz); +#endif + #ifdef HAS_DIFFUSE_LOOKUP - vec4 color = diffuseLookup(vary_texcoord0.xy); + vec4 color = diffuseLookup(vary_texcoord0.xy); #else - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); #endif - float final_alpha = color.a * vertex_color.a; + float final_alpha = color.a * vertex_color.a; #ifdef HAS_ALPHA_MASK - if (color.a < minimum_alpha) - { - discard; - } + if (color.a < minimum_alpha) + { + discard; + } #endif - color.rgb *= vertex_color.rgb; + color.rgb *= vertex_color.rgb; #ifdef WATER_FOG - vec3 pos = vary_position; - vec4 fogged = applyWaterFogView(pos, vec4(color.rgb, final_alpha)); - color.rgb = fogged.rgb; - color.a = fogged.a; + vec3 pos = vary_position; + vec4 fogged = applyWaterFogView(pos, vec4(color.rgb, final_alpha)); + color.rgb = fogged.rgb; + color.a = fogged.a; #else color.a = final_alpha; #endif - frag_color.rgb = srgb_to_linear(color.rgb); - frag_color.a = color.a; + frag_color.rgb = srgb_to_linear(color.rgb); + frag_color.a = color.a; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index e71636f2c9..e565722164 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -38,9 +38,7 @@ void calcAtmospherics(vec3 inPositionEye); vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); -#ifdef WATER_FOG VARYING vec3 vary_position; -#endif VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; @@ -66,9 +64,7 @@ void main() gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif -#ifdef WATER_FOG vary_position = pos.xyz; -#endif vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index b4044353b4..7032c45603 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -54,6 +54,12 @@ void main() fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 ); vec4 c = texture2D(diffuseMap, vary_texcoord0.xy); + + // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible + // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> + if (c.a <= 2./255.) // 0.00784 + discard; + // c.rgb = srgb_to_linear(c.rgb); c.rgb *= moonlight_color.rgb; c.rgb *= moon_brightness; @@ -67,6 +73,6 @@ void main() frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_HAS_ATMOS); - gl_FragDepth = 0.999985f; + gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 } diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index ef9cee3fa0..6376527273 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -46,8 +46,13 @@ float twinkle(){ return abs(d); } +// See: +// ALM off: class1/environment/starsF.glsl +// ALM on : class1/deferred/starsF.glsl void main() { + // camera above water: class1\deferred\starsF.glsl + // camera below water: class1\environment\starsF.glsl vec4 col_a = texture2D(diffuseMap, vary_texcoord0.xy); vec4 col_b = texture2D(diffuseMap, vary_texcoord0.xy); vec4 col = mix(col_b, col_a, blend_factor); @@ -62,6 +67,6 @@ void main() frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); - gl_FragDepth = 0.99995f; + gl_FragDepth = LL_SHADER_CONST_STAR_DEPTH; // SL-14113 Moon Haze -- Stars need to depth test behind the moon } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index 8863869e44..38276859a0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -70,7 +70,7 @@ void main() d *= d; oPosition = vec4(position, 1.0); - oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); +// oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon vary_position = modelview_matrix * oPosition; oPosition = modelViewProj * oPosition; diff --git a/indra/newview/app_settings/shaders/class1/environment/moonF.glsl b/indra/newview/app_settings/shaders/class1/environment/moonF.glsl new file mode 100644 index 0000000000..a220971f06 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/environment/moonF.glsl @@ -0,0 +1,51 @@ +/** + * @file class1/environment/moonF.glsl + * + * $LicenseInfo:firstyear=2021&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2021, 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$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +uniform sampler2D tex0; + +VARYING vec2 vary_texcoord0; + +// See: +// AS off: class1/environment/moonF.glsl +// ALM off: class1/windlight/moonF.glsl +// ALM on : class1/deferred/moonF.glsl +void main() +{ + vec4 color = texture2D(tex0, vary_texcoord0.xy); + + // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible + // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> + if (color.a <= 2./255.) // 0.00784 + discard; + + frag_color = color; + gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 Moon is infront of stars +} diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl b/indra/newview/app_settings/shaders/class1/environment/moonV.glsl index 254c1d4fc2..c00f202c23 100644 --- a/indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/moonV.glsl @@ -1,9 +1,9 @@ /** - * @file fullbrightF.glsl + * @file class1\environment\moonV.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -22,12 +22,17 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - - +uniform mat4 modelview_projection_matrix; -void main() +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; + +VARYING vec2 vary_texcoord0; + +void main() { - fullbright_lighting(); + gl_Position = modelview_projection_matrix * vec4(position, 1); + vary_texcoord0 = texcoord0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendF.glsl b/indra/newview/app_settings/shaders/class1/environment/starsF.glsl index 44f2a73e1f..e1a9cc6387 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/starsF.glsl @@ -1,9 +1,9 @@ /** - * @file shadowAlphaMaskF.glsl + * @file class1/environment/starsF.glsl * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -23,8 +23,6 @@ * $/LicenseInfo$ */ -/*[EXTRA_CODE_HERE]*/ - #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; #else @@ -33,23 +31,21 @@ out vec4 frag_color; uniform sampler2D diffuseMap; -#if !defined(DEPTH_CLAMP) -VARYING float pos_zd2; -#endif - -VARYING float pos_w; +uniform float custom_alpha; -VARYING float target_pos_x; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +// See: +// ALM off: class1/environment/starsF.glsl +// ALM on : class1/deferred/starsF.glsl void main() { - float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a; + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); + color.rgb = pow(color.rgb, vec3(0.45)); + color.rgb *= vertex_color.rgb; + color.a *= max(custom_alpha, vertex_color.a); - frag_color = vec4(alpha, alpha, alpha, 1); - -#if !defined(DEPTH_CLAMP) - gl_FragDepth = max(pos_zd2/pos_w+0.5, 0.0); -#endif + frag_color = color; + gl_FragDepth = LL_SHADER_CONST_STAR_DEPTH; // SL-14113 Moon Haze -- Stars need to depth test behind the moon } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendV.glsl b/indra/newview/app_settings/shaders/class1/environment/starsV.glsl index f45c343066..6fcfec6b6a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/starsV.glsl @@ -1,9 +1,9 @@ /** - * @file shadowAlphaMaskV.glsl + * @file class1/environment/starsV.glsl * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -23,45 +23,19 @@ * $/LicenseInfo$ */ -uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -uniform float shadow_target_width; ATTRIBUTE vec3 position; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; -#if !defined(DEPTH_CLAMP) -VARYING float pos_zd2; -#endif - -VARYING float pos_w; - -VARYING float target_pos_x; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -void passTextureIndex(); - void main() { - //transform vertex - vec4 pre_pos = vec4(position.xyz, 1.0); - vec4 pos = modelview_projection_matrix * pre_pos; - target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - - pos_w = pos.w; - -#if !defined(DEPTH_CLAMP) - pos_zd2 = pos.z * 0.5; - - gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else - gl_Position = pos; -#endif - - passTextureIndex(); - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = texcoord0; vertex_color = diffuse_color; } + diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index a0a0e7dfca..ac400aa2a6 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -80,7 +80,7 @@ void main() d *= d; oPosition = vec4(position, 1.0); - oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); +// oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon oPosition = modelViewProj * oPosition; diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index f03003f5e1..c4ab0c95dc 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -51,6 +51,12 @@ void main() fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 ); vec4 c = texture2D(diffuseMap, vary_texcoord0.xy); + + // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible + // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> + if (c.a <= 2./255.) // 0.00784 + discard; + // c.rgb = pow(c.rgb, vec3(0.7f)); // can't use "srgb_to_linear(color.rgb)" as that is a deferred only function c.rgb *= moonlight_color.rgb; c.rgb *= moon_brightness; @@ -61,5 +67,6 @@ void main() c.rgb = scaleSoftClip(c.rgb); frag_color = vec4(c.rgb, c.a); + gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 } diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 9c5a4903d0..6f4bdbde28 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -127,5 +127,11 @@ void main() /// Gamma correct for WL (soft clip effect). frag_color = vec4(color.rgb, alpha1); + + // SL-14113 Moon Haze -- When the camera is underwater fix clouds clipping into moon + // camera above water: class1\deferred\cloudsF.glsl + // camera below water: class2\windlight\coudsV.glsl + // See: starsV.glsl, cloudsV.glsl, moonF.glsl + gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; } diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index aedba9b49a..14819ac5e9 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 41 +version 42 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -47,7 +47,8 @@ RenderMaxPartCount 1 8192 RenderObjectBump 1 1 RenderLocalLights 1 1 RenderTransparentWater 1 1 -RenderReflectionProbeDetail 1 2 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 2 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTreeLODFactor 1 1.0 @@ -90,7 +91,8 @@ RenderGlowResolutionPow 1 8 RenderLocalLights 1 0 RenderMaxPartCount 1 0 RenderTransparentWater 1 0 -RenderReflectionProbeDetail 1 -1 +RenderReflectionsEnabled 1 0 +RenderReflectionProbeDetail 1 0 RenderTerrainDetail 1 0 RenderTerrainLODFactor 1 1 RenderTreeLODFactor 1 0 @@ -115,7 +117,8 @@ RenderGlowResolutionPow 1 8 RenderMaxPartCount 1 2048 RenderLocalLights 1 1 RenderTransparentWater 1 0 -RenderReflectionProbeDetail 1 -1 +RenderReflectionsEnabled 1 0 +RenderReflectionProbeDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 RenderTreeLODFactor 1 0.5 @@ -149,6 +152,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 // @@ -174,6 +178,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -199,6 +204,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -224,6 +230,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -249,6 +256,7 @@ RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -288,4 +296,6 @@ RenderGLContextCoreProfile 1 0 list GL3 RenderFSAASamples 0 0 -RenderReflectionProbeDetail 0 -1 +RenderReflectionsEnabled 0 0 +RenderReflectionProbeDetail 0 0 + diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index d40e7aff0b..621499de2e 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 41 +version 42 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -71,6 +71,7 @@ RenderFSAASamples 1 16 RenderMaxTextureIndex 1 16 RenderGLContextCoreProfile 1 1 RenderGLMultiThreaded 1 0 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 2 // @@ -97,7 +98,8 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 -RenderReflectionProbeDetail 1 -1 +RenderReflectionsEnabled 1 0 +RenderReflectionProbeDetail 1 0 // // Medium Low Graphics Settings @@ -122,7 +124,8 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 -RenderReflectionProbeDetail 1 -1 +RenderReflectionsEnabled 1 0 +RenderReflectionProbeDetail 1 0 // // Medium Graphics Settings (standard) @@ -147,6 +150,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 // @@ -172,6 +176,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 // @@ -197,6 +202,7 @@ RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -222,6 +228,7 @@ RenderShadowDetail 1 2 RenderUseAdvancedAtmospherics 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -247,6 +254,7 @@ RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 // @@ -291,4 +299,5 @@ RenderFSAASamples 1 0 list GL3 RenderFSAASamples 0 0 -RenderReflectionProbeDetail 0 -1 +RenderReflectionProbeDetail 0 0 +RenderReflectionsEnabled 0 0 diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 57a59d81c4..5de52c1daf 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2043,6 +2043,13 @@ LLVector3d LLAgentCamera::getFocusOffsetInitial() F32 LLAgentCamera::getCameraMaxZoomDistance() { + // SL-14706 / SL-14885 TPV have relaxed camera constraints allowing you to mousewheeel zoom WAY out. + static LLCachedControl<bool> s_disable_camera_constraints(gSavedSettings, "DisableCameraConstraints", false); + if (s_disable_camera_constraints) + { + return (F32)INT_MAX; + } + // Ignore "DisableCameraConstraints", we don't want to be out of draw range when we focus onto objects or avatars return llmin(MAX_CAMERA_DISTANCE_FROM_OBJECT, mDrawDistance - 1, // convenience, don't hit draw limit when focusing on something diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6e0bbb05ee..584808167e 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -572,7 +572,7 @@ static void settings_modify() LLPipeline::sRenderDeferred = TRUE; // FALSE is deprecated -- LLPipeline::sRenderBump&& gSavedSettings.getBOOL("RenderDeferred"); LLRenderTarget::sUseFBO = LLPipeline::sRenderDeferred; LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); - LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; // square lod factor to get exponential range of [1,4] + LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] gDebugGL = gDebugGLSession || gDebugSession; gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); } @@ -1276,7 +1276,6 @@ bool LLAppViewer::init() //LLSimpleton creations LLEnvironment::createInstance(); - LLEnvironment::getInstance()->initSingleton(); LLWorld::createInstance(); LLSelectMgr::createInstance(); LLViewerCamera::createInstance(); @@ -2181,6 +2180,12 @@ bool LLAppViewer::initThreads() // get the number of concurrent threads that can run S32 cores = std::thread::hardware_concurrency(); + U32 max_cores = gSavedSettings.getU32("EmulateCoreCount"); + if (max_cores != 0) + { + cores = llmin(cores, (S32) max_cores); + } + // The only configurable thread count right now is ImageDecode // The viewer typically starts around 8 threads not including image decode, // so try to leave at least one core free diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 9031ea5b1b..eb2c156ca5 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -124,7 +124,7 @@ public: LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, TargetType_t targetType, bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, taskUploadFinish_f finish) : LLScriptAssetUpload(taskId, itemId, targetType, isRunning, - exerienceId, std::string(), finish), + exerienceId, std::string(), finish, nullptr), mScriptName(scriptName), mQueueId(queueId) { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 759aa078ff..c09de14b23 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -173,7 +173,7 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) prepare_alpha_shader(emissive_shader, true, false, water_sign); fullbright_shader = (LLPipeline::sImpostorRender) ? &gDeferredFullbrightAlphaMaskProgram : - (LLPipeline::sUnderWaterRender) ? &gDeferredFullbrightWaterProgram : &gDeferredFullbrightAlphaMaskProgram; + (LLPipeline::sUnderWaterRender) ? &gDeferredFullbrightWaterAlphaProgram : &gDeferredFullbrightAlphaMaskAlphaProgram; prepare_alpha_shader(fullbright_shader, true, true, water_sign); simple_shader = (LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram : diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 684cf55b6b..6af4e2274c 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -41,6 +41,7 @@ #include "lldrawable.h" #include "llface.h" #include "llsky.h" +#include "llstartup.h" #include "lltextureentry.h" #include "llviewercamera.h" #include "llviewertexturelist.h" @@ -79,11 +80,6 @@ static S32 bump_channel = -1; #define LL_BUMPLIST_MULTITHREADED 0 // TODO -- figure out why this doesn't work -// static -void LLStandardBumpmap::init() -{ - LLStandardBumpmap::restoreGL(); -} // static void LLStandardBumpmap::shutdown() @@ -94,7 +90,7 @@ void LLStandardBumpmap::shutdown() // static void LLStandardBumpmap::restoreGL() { - addstandard(); + addstandard(); } // static @@ -107,6 +103,12 @@ void LLStandardBumpmap::addstandard() return ; } + if (LLStartUp::getStartupState() < STATE_SEED_CAP_GRANTED) + { + // Not ready, need caps for images + return; + } + // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps. //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); clear(); @@ -297,7 +299,7 @@ void LLDrawPoolBump::beginShiny() void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; - if( cube_map ) + if( cube_map && !LLPipeline::sReflectionProbesEnabled ) { if (shader ) { @@ -344,7 +346,7 @@ void LLDrawPoolBump::renderShiny() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); - if( gSky.mVOSkyp->getCubeMap() ) + if( gSky.mVOSkyp->getCubeMap() && !LLPipeline::sReflectionProbesEnabled ) { LLGLEnable blend_enable(GL_BLEND); if (mShaderLevel > 1) @@ -376,7 +378,7 @@ void LLDrawPoolBump::renderShiny() void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; - if( cube_map ) + if( cube_map && !LLPipeline::sReflectionProbesEnabled) { if (shader_level > 1) { @@ -444,7 +446,7 @@ void LLDrawPoolBump::beginFullbrightShiny() LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; - if (cube_map) + if (cube_map && !LLPipeline::sReflectionProbesEnabled) { // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for // the cube map in the one pass shiny shaders @@ -532,7 +534,7 @@ void LLDrawPoolBump::endFullbrightShiny() LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; - if( cube_map ) + if( cube_map && !LLPipeline::sReflectionProbesEnabled ) { cube_map->disable(); if (shader->mFeatures.hasReflectionProbes) @@ -786,8 +788,6 @@ void LLBumpImageList::init() llassert( mBrightnessEntries.size() == 0 ); llassert( mDarknessEntries.size() == 0 ); - LLStandardBumpmap::init(); - LLStandardBumpmap::restoreGL(); sMainQueue = LL::WorkQueue::getInstance("mainloop"); sTexUpdateQueue = LL::WorkQueue::getInstance("LLImageGL"); // Share work queue with tex loader. diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index e8a027967b..cf463f4458 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -118,7 +118,6 @@ public: static void clear(); static void addstandard(); - static void init(); static void shutdown(); static void restoreGL(); static void destroyGL(); diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index 5b614a2ce0..a7b5ec5fc8 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -112,20 +112,39 @@ void LLDrawPoolSky::renderSkyFace(U8 index) return; } - if (index < 6) // sky tex...interp + if (index < LLVOSky::FACE_SUN) // sky tex...interp { llassert(mSkyTex); mSkyTex[index].bindTexture(true); // bind the current tex face->renderIndexed(); } + else // Moon + if (index == LLVOSky::FACE_MOON) + { + LLGLSPipelineDepthTestSkyBox gls_skybox(true, true); // SL-14113 Write depth for moon so stars can test if behind it + + LLGLEnable blend(GL_BLEND); + + // if (LLGLSLShader::sNoFixedFunction) // TODO: Necessary? is this always true? We already bailed on gPipeline.canUseWindLightShaders ... above + LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP); + if (tex) + { + gMoonProgram.bind(); // SL-14113 was gOneTextureNoColorProgram + gGL.getTexUnit(0)->bind(tex, true); + face->renderIndexed(); + } + } else // heavenly body faces, no interp... { + LLGLSPipelineDepthTestSkyBox gls_skybox(true, false); // reset to previous + LLGLEnable blend(GL_BLEND); LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP); if (tex) { + gOneTextureNoColorProgram.bind(); gGL.getTexUnit(0)->bind(tex, true); face->renderIndexed(); } diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 3f39716449..bc42dab1f2 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -300,7 +300,7 @@ void LLDrawPoolWater::render(S32 pass) stop_glerror(); - if (gSky.mVOSkyp->getCubeMap()) + if (gSky.mVOSkyp->getCubeMap() && !LLPipeline::sReflectionProbesEnabled) { gSky.mVOSkyp->getCubeMap()->enable(0); gSky.mVOSkyp->getCubeMap()->bind(); @@ -357,7 +357,7 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() { #if 0 LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; - LLVOSky *voskyp = gSky.mVOSkyp; + LLVOSky *voskyp = gSky.mVOSkyp; if (voskyp == NULL) { @@ -365,16 +365,16 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() } LLGLSLShader* shader = NULL; - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectSimpleNonIndexedTexGenWaterProgram; - } - else - { - shader = &gObjectSimpleNonIndexedTexGenProgram; - } + if (LLPipeline::sUnderWaterRender) + { + shader = &gObjectSimpleNonIndexedTexGenWaterProgram; + } + else + { + shader = &gObjectSimpleNonIndexedTexGenProgram; + } - shader->bind(); + shader->bind(); stop_glerror(); @@ -508,9 +508,9 @@ void LLDrawPoolWater::renderWater() LLColor3 light_diffuse(0, 0, 0); F32 light_exp = 0.0f; - LLEnvironment & environment = LLEnvironment::instance(); - LLSettingsWater::ptr_t pwater = environment.getCurrentWater(); - LLSettingsSky::ptr_t psky = environment.getCurrentSky(); + LLEnvironment& environment = LLEnvironment::instance(); + LLSettingsWater::ptr_t pwater = environment.getCurrentWater(); + LLSettingsSky::ptr_t psky = environment.getCurrentSky(); LLVector3 light_dir = environment.getLightDirection(); bool sun_up = environment.getIsSunUp(); bool moon_up = environment.getIsMoonUp(); @@ -535,15 +535,15 @@ void LLDrawPoolWater::renderWater() F32 ground_proj_sq = light_dir.mV[0] * light_dir.mV[0] + light_dir.mV[1] * light_dir.mV[1]; light_exp = llmax(32.f, 256.f * powf(ground_proj_sq, 16.0f)); if (0.f < light_diffuse.normalize()) // Normalizing a color? Puzzling... - { + { light_diffuse *= (1.5f + (6.f * ground_proj_sq)); } // set up normal maps filtering for (auto norm_map : mWaterNormp) - { + { if (norm_map) norm_map->setFilteringOption(has_normal_mips ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT); - } + } LLColor4 specular(sun_up ? psky->getSunlightColor() : psky->getMoonlightColor()); F32 phase_time = (F32) LLFrameTimer::getElapsedSeconds() * 0.5f; @@ -570,51 +570,51 @@ void LLDrawPoolWater::renderWater() } gPipeline.bindDeferredShader(*shader); - + // bind textures for water rendering - S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); - if (reftex > -1) - { - gGL.getTexUnit(reftex)->activate(); - gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); - gGL.getTexUnit(0)->activate(); - } + S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); + if (reftex > -1) + { + gGL.getTexUnit(reftex)->activate(); + gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); + gGL.getTexUnit(0)->activate(); + } - // bind normal map - S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); - S32 bumpTex2 = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP2); + //bind normal map + S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); + S32 bumpTex2 = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP2); - LLViewerTexture *tex_a = mWaterNormp[0]; - LLViewerTexture *tex_b = mWaterNormp[1]; + LLViewerTexture* tex_a = mWaterNormp[0]; + LLViewerTexture* tex_b = mWaterNormp[1]; F32 blend_factor = pwater->getBlendFactor(); + + gGL.getTexUnit(bumpTex)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(bumpTex)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE); - - if (tex_a && (!tex_b || (tex_a == tex_b))) - { - gGL.getTexUnit(bumpTex)->bind(tex_a); - blend_factor = 0; // only one tex provided, no blending - } - else if (tex_b && !tex_a) - { - gGL.getTexUnit(bumpTex)->bind(tex_b); - blend_factor = 0; // only one tex provided, no blending - } - else if (tex_b != tex_a) - { - gGL.getTexUnit(bumpTex)->bind(tex_a); - gGL.getTexUnit(bumpTex2)->bind(tex_b); - } - - // bind reflection texture from RenderTarget - S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); + if (tex_a && (!tex_b || (tex_a == tex_b))) + { + gGL.getTexUnit(bumpTex)->bind(tex_a); + blend_factor = 0; // only one tex provided, no blending + } + else if (tex_b && !tex_a) + { + gGL.getTexUnit(bumpTex)->bind(tex_b); + blend_factor = 0; // only one tex provided, no blending + } + else if (tex_b != tex_a) + { + gGL.getTexUnit(bumpTex)->bind(tex_a); + gGL.getTexUnit(bumpTex2)->bind(tex_b); + } + + // bind reflection texture from RenderTarget + S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); S32 screenDepth = shader->enableTexture(LLShaderMgr::WATER_SCREENDEPTH); F32 screenRes[] = {1.f / gGLViewport[2], 1.f / gGLViewport[3]}; - - S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); + + S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); // set uniforms for shader if (deferred_render) @@ -626,26 +626,26 @@ void LLDrawPoolWater::renderWater() } } - shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); - shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); + shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); + shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); - F32 fog_density = pwater->getModifiedWaterFogDensity(underwater); - - if (screentex > -1) - { - shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, fog_density); - gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); - } + F32 fog_density = pwater->getModifiedWaterFogDensity(underwater); + if (screentex > -1) + { + shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, fog_density); + gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); + } + if (screenDepth > -1) { gGL.getTexUnit(screenDepth)->bind(&gPipeline.mWaterDis, true); } - if (mShaderLevel == 1) - { - fog_color.mV[VW] = log(fog_density) / log(2); - } + if (mShaderLevel == 1) + { + fog_color.mV[VW] = log(fog_density) / log(2); + } F32 water_height = environment.getWaterHeight(); F32 camera_height = LLViewerCamera::getInstance()->getOrigin().mV[2]; @@ -654,45 +654,48 @@ void LLDrawPoolWater::renderWater() shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); shader->uniform4fv(LLShaderMgr::SPECULAR_COLOR, 1, specular.mV); - shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, fog_color.mV); + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, fog_color.mV); shader->uniform3fv(LLShaderMgr::WATER_FOGCOLOR_LINEAR, 1, fog_color_linear.mV); - shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); - shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); + shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); + shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, pwater->getWave1Dir().mV); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, pwater->getWave2Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, pwater->getWave1Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, pwater->getWave2Dir().mV); - shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); + shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); - shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, pwater->getNormalScale().mV); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, pwater->getFresnelScale()); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, pwater->getFresnelOffset()); - shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, pwater->getBlurMultiplier()); + shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, pwater->getNormalScale().mV); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, pwater->getFresnelScale()); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, pwater->getFresnelOffset()); + shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, pwater->getBlurMultiplier()); - F32 sunAngle = llmax(0.f, light_dir.mV[1]); - F32 scaledAngle = 1.f - sunAngle; + F32 sunAngle = llmax(0.f, light_dir.mV[1]); + F32 scaledAngle = 1.f - sunAngle; shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up ? 1 : 0); - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); - shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f * sunAngle); - shader->uniform1i(LLShaderMgr::WATER_EDGE_FACTOR, edge ? 1 : 0); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); + shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); + shader->uniform1i(LLShaderMgr::WATER_EDGE_FACTOR, edge ? 1 : 0); - LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm(); - shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV); - shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); + // SL-15861 This was changed from getRotatedLightNorm() as it was causing + // lightnorm in shaders\class1\windlight\atmosphericsFuncs.glsl in have inconsistent additive lighting for 180 degrees of the FOV. + LLVector4 rotated_light_direction = LLEnvironment::instance().getClampedLightNorm(); + shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV); - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleBelow()); - } - else - { - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleAbove()); - } + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); - LLGLDisable cullface(GL_CULL_FACE); + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleBelow()); + } + else + { + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleAbove()); + } + + LLGLDisable cullface(GL_CULL_FACE); LLVOWater *water = nullptr; for (LLFace *const &face : mDrawFace) @@ -701,41 +704,41 @@ void LLDrawPoolWater::renderWater() water = static_cast<LLVOWater *>(face->getViewerObject()); if (!water) continue; - gGL.getTexUnit(diffTex)->bind(face->getTexture()); + gGL.getTexUnit(diffTex)->bind(face->getTexture()); if ((bool)edge == (bool) water->getIsEdgePatch()) - { - face->renderIndexed(); + { + face->renderIndexed(); // Note non-void water being drawn, updates required if (!edge) // SL-16461 remove !LLPipeline::sUseOcclusion check - { - sNeedsReflectionUpdate = TRUE; - sNeedsDistortionUpdate = TRUE; + { + sNeedsReflectionUpdate = TRUE; + sNeedsDistortionUpdate = TRUE; } - } + } } - shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); - shader->disableTexture(LLShaderMgr::BUMP_MAP); - shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); - shader->disableTexture(LLShaderMgr::WATER_REFTEX); - shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); + shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); + shader->disableTexture(LLShaderMgr::BUMP_MAP); + shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); + shader->disableTexture(LLShaderMgr::WATER_REFTEX); + shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); // clean up gPipeline.unbindDeferredShader(*shader); gGL.getTexUnit(bumpTex)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE); - } + } - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - if (!deferred_render) - { - gGL.setColorMask(true, false); - } + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + if (!deferred_render) + { + gGL.setColorMask(true, false); + } } LLViewerTexture *LLDrawPoolWater::getDebugTexture() diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 6678e244b9..9fe1b64d3d 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -166,6 +166,11 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const { + if (!gSky.mVOSkyp) + { + return; + } + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) @@ -266,18 +271,23 @@ void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const gGL.pushMatrix(); gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); - gCustomAlphaProgram.bind(); - gCustomAlphaProgram.uniform1f(sCustomAlpha, star_alpha.mV[3]); + gStarsProgram.bind(); + gStarsProgram.uniform1f(sCustomAlpha, star_alpha.mV[3]); gSky.mVOWLSkyp->drawStars(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.popMatrix(); - gCustomAlphaProgram.unbind(); -} + gStarsProgram.unbind(); // SL-14113 was gCustomAlphaProgram + } void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const { + if (!gSky.mVOSkyp) + { + return; + } + LLGLSPipelineBlendSkyBox gls_sky(true, false); gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); @@ -319,6 +329,7 @@ void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const gGL.pushMatrix(); gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); + gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); if (LLPipeline::sReflectionRender) @@ -343,7 +354,7 @@ void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const { - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) + if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex()) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); @@ -397,7 +408,7 @@ void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const { - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) + if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex()) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); @@ -453,7 +464,8 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() { if (!gSky.mVOSkyp) return; - LLGLSPipelineBlendSkyBox gls_skybox(true, false); + //LLGLSPipelineBlendSkyBox gls_skybox(true, false); + LLGLSPipelineBlendSkyBox gls_skybox(true, true); // SL-14113 we need moon to write to depth to clip stars behind LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); gGL.pushMatrix(); @@ -583,8 +595,8 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { renderSkyHazeDeferred(origin, camHeightLocal); - renderStarsDeferred(origin); renderHeavenlyBodies(); + renderStarsDeferred(origin); renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); } gGL.setColorMask(true, true); @@ -602,8 +614,8 @@ void LLDrawPoolWLSky::render(S32 pass) LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); renderSkyHaze(origin, camHeightLocal); + renderHeavenlyBodies(); renderStars(origin); - renderHeavenlyBodies(); renderSkyClouds(origin, camHeightLocal, cloud_shader); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 361a7666fa..d1f9e7a943 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -118,35 +118,10 @@ BOOL LLViewerDynamicTexture::render() //----------------------------------------------------------------------------- void LLViewerDynamicTexture::preRender(BOOL clear_depth) { - gPipeline.allocatePhysicsBuffer(); - if (!gNonInteractive) - { - llassert(mFullWidth <= static_cast<S32>(gPipeline.mPhysicsDisplay.getWidth())); - llassert(mFullHeight <= static_cast<S32>(gPipeline.mPhysicsDisplay.getHeight())); - } - - if (gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsAMD) - { //using offscreen render target, just use the bottom left corner - mOrigin.set(0, 0); - } - else - { // force rendering to on-screen portion of frame buffer - LLCoordScreen window_pos; - gViewerWindow->getWindow()->getPosition( &window_pos ); - mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight); // top left corner - - if (window_pos.mX < 0) - { - mOrigin.mX = -window_pos.mX; - } - if (window_pos.mY < 0) - { - mOrigin.mY += window_pos.mY; - mOrigin.mY = llmax(mOrigin.mY, 0) ; - } - } + //use the bottom left corner + mOrigin.set(0, 0); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Set up camera LLViewerCamera* camera = LLViewerCamera::getInstance(); mCamera.setOrigin(*camera); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 64d89282e2..efe4ad2af2 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -874,26 +874,37 @@ void LLEnvironment::initSingleton() requestRegion(); - gAgent.addParcelChangedCallback([this]() { onParcelChange(); }); + if (!mParcelCallbackConnection.connected()) + { + mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onParcelChange(); }); - //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer. - // We need to know new env version to fix this, without it we can only do full re-request - // Happens: on updates, on opening LLFloaterRegionInfo, on region crossing if info floater is open - LLRegionInfoModel::instance().setUpdateCallback([this]() { requestRegion(); }); - gAgent.addRegionChangedCallback([this]() { onRegionChange(); }); + //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer. + // We need to know new env version to fix this, without it we can only do full re-request + // Happens: on updates, on opening LLFloaterRegionInfo, on region crossing if info floater is open + mRegionUpdateCallbackConnection = LLRegionInfoModel::instance().setUpdateCallback([this]() { requestRegion(); }); + mRegionChangeCallbackConnection = gAgent.addRegionChangedCallback([this]() { onRegionChange(); }); - gAgent.whenPositionChanged([this](const LLVector3 &localpos, const LLVector3d &) { onAgentPositionHasChanged(localpos); }); + mPositionCallbackConnection = gAgent.whenPositionChanged([this](const LLVector3 &localpos, const LLVector3d &) { onAgentPositionHasChanged(localpos); }); + } if (!gGenericDispatcher.isHandlerPresent(MESSAGE_PUSHENVIRONMENT)) { gGenericDispatcher.addHandler(MESSAGE_PUSHENVIRONMENT, &environment_push_dispatch_handler); } + LLEventPumps::instance().obtain(PUMP_EXPERIENCE).stopListening(LISTENER_NAME); LLEventPumps::instance().obtain(PUMP_EXPERIENCE).listen(LISTENER_NAME, [this](LLSD message) { listenExperiencePump(message); return false; }); } void LLEnvironment::cleanupSingleton() { + if (mParcelCallbackConnection.connected()) + { + mParcelCallbackConnection.disconnect(); + mRegionUpdateCallbackConnection.disconnect(); + mRegionChangeCallbackConnection.disconnect(); + mPositionCallbackConnection.disconnect(); + } LLEventPumps::instance().obtain(PUMP_EXPERIENCE).stopListening(LISTENER_NAME); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 330de2bea8..64fd170e43 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -402,6 +402,11 @@ private: bool mShowMoonBeacon; S32 mEditorCounter; + connection_t mParcelCallbackConnection; + connection_t mRegionUpdateCallbackConnection; + connection_t mRegionChangeCallbackConnection; + connection_t mPositionCallbackConnection; + struct UpdateInfo { typedef std::shared_ptr<UpdateInfo> ptr_t; diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 1dd9a43b72..1ec25ccaa1 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -179,6 +179,7 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter) SOUND_FILTER \ IMAGE_FILTER \ ANIM_FILTER \ + MATERIAL_FILTER \ L"\0"; break; case FFLOAD_WAV: diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 1a98ab9d76..9c4c9b3e59 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2004,7 +2004,6 @@ BOOL LLPanelLandOptions::postBuild() mSnapshotCtrl->setAllowNoTexture ( TRUE ); mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mSnapshotCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 81b3c23417..4c8b4df0b6 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1220,10 +1220,19 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() getChildView("fsaa")->setEnabled(FALSE); } - if (!LLFeatureManager::instance().isFeatureAvailable("RenderReflectionProbeDetail")) + enabled = false; + if (!LLFeatureManager::instance().isFeatureAvailable("RenderReflectionsEnabled")) { - getChildView("ReflectionDetail")->setEnabled(FALSE); + getChildView("ReflectionsEnabled")->setEnabled(FALSE); } + else + { + enabled = gSavedSettings.getBOOL("RenderReflectionsEnabled"); + } + + getChildView("ReflectionDetail")->setEnabled(enabled); + getChildView("ReflectionDetailText")->setEnabled(enabled); + getChildView("ScreenSpaceReflections")->setEnabled(enabled); // Hardware settings diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 45de0b71ae..d04a674e91 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -32,7 +32,6 @@ #include "lldispatcher.h" #include "llfetchedgltfmaterial.h" #include "llfilesystem.h" -#include "llmaterialeditor.h" #include "llsdserialize.h" #include "lltinygltfhelper.h" #include "llviewercontrol.h" @@ -147,6 +146,11 @@ public: LLGLTFMaterialOverrideDispatchHandler() = default; ~LLGLTFMaterialOverrideDispatchHandler() override = default; + void addCallback(void(*callback)(const LLUUID& object_id, S32 side)) + { + mSelectionCallbacks.push_back(callback); + } + bool operator()(const LLDispatcher* dispatcher, const std::string& key, const LLUUID& invoice, const sparam_t& strings) override { LL_PROFILE_ZONE_SCOPED; @@ -210,7 +214,15 @@ public: return true; } - static void applyData(const LLGLTFOverrideCacheEntry &object_override) + void doSelectionCallbacks(const LLUUID& object_id, S32 side) + { + for (auto& callback : mSelectionCallbacks) + { + callback(object_id, side); + } + } + + void applyData(const LLGLTFOverrideCacheEntry &object_override) { // Parse the data @@ -264,7 +276,7 @@ public: } return results; }, - [object_override](std::vector<ReturnData> results) // Callback to main thread + [object_override, this](std::vector<ReturnData> results) // Callback to main thread { LLViewerObject * obj = gObjectList.findObject(object_override.mObjectId); @@ -285,32 +297,31 @@ public: // object not ready to receive override data, queue for later gGLTFMaterialList.queueOverrideUpdate(object_override.mObjectId, results[i].mSide, results[i].mMaterial); } - else if (obj && obj->isAnySelected()) + else if (obj && obj->getTE(i) && obj->getTE(i)->isSelected()) { - LLMaterialEditor::updateLive(object_override.mObjectId, results[i].mSide); + doSelectionCallbacks(object_override.mObjectId, results[i].mSide); } } else { // unblock material editor - if (obj && obj->isAnySelected()) + if (obj && obj->getTE(i) && obj->getTE(i)->isSelected()) { - LLMaterialEditor::updateLive(object_override.mObjectId, results[i].mSide); + doSelectionCallbacks(object_override.mObjectId, results[i].mSide); } } } if (obj && side_set.size() != obj->getNumTEs()) { // object exists and at least one texture entry needs to have its override data nulled out - bool object_has_selection = obj->isAnySelected(); for (int i = 0; i < obj->getNumTEs(); ++i) { if (side_set.find(i) == side_set.end()) { obj->setTEGLTFMaterialOverride(i, nullptr); - if (object_has_selection) + if (obj->getTE(i) && obj->getTE(i)->isSelected()) { - LLMaterialEditor::updateLive(object_override.mObjectId, i); + doSelectionCallbacks(object_override.mObjectId, i); } } } @@ -318,18 +329,21 @@ public: } else if (obj) { // override list was empty or an error occurred, null out all overrides for this object - bool object_has_selection = obj->isAnySelected(); for (int i = 0; i < obj->getNumTEs(); ++i) { obj->setTEGLTFMaterialOverride(i, nullptr); - if (object_has_selection) + if (obj->getTE(i) && obj->getTE(i)->isSelected()) { - LLMaterialEditor::updateLive(obj->getID(), i); + doSelectionCallbacks(obj->getID(), i); } } } }); } + +private: + + std::vector<void(*)(const LLUUID& object_id, S32 side)> mSelectionCallbacks; }; namespace @@ -357,20 +371,19 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) if (iter != mQueuedOverrides.end()) { - bool object_has_selection = obj->isAnySelected(); override_list_t& overrides = iter->second; for (int i = 0; i < overrides.size(); ++i) { if (overrides[i].notNull()) { - if (!obj->getTE(i)->getGLTFMaterial()) + if (!obj->getTE(i) || !obj->getTE(i)->getGLTFMaterial()) { // object doesn't have its base GLTF material yet, don't apply override (yet) return; } obj->setTEGLTFMaterialOverride(i, overrides[i]); - if (object_has_selection) + if (obj->getTE(i)->isSelected()) { - LLMaterialEditor::updateLive(id, i); + handle_gltf_override_message.doSelectionCallbacks(id, i); } } } @@ -459,6 +472,11 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) } } +void LLGLTFMaterialList::addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)) +{ + handle_gltf_override_message.addCallback(update_callback); +} + class AssetLoadUserData { public: @@ -713,5 +731,5 @@ void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides, void LLGLTFMaterialList::loadCacheOverrides(const LLGLTFOverrideCacheEntry& override) { - LLGLTFMaterialOverrideDispatchHandler::applyData(override); + handle_gltf_override_message.applyData(override); } diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 0f0edf7414..abbb755599 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -74,6 +74,8 @@ public: // Automatically called once per frame, but may be called explicitly // for cases that care about the done_callback forwarded to LLCoros::instance().launch static void flushUpdates(void(*done_callback)(bool) = nullptr); + + static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 7254015d64..b5853ad9a3 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -73,7 +73,7 @@ // Increment this if the inventory contents change in a non-backwards-compatible way. // For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. -const S32 LLInventoryModel::sCurrentInvCacheVersion = 3; +const S32 LLInventoryModel::sCurrentInvCacheVersion = 2; BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; ///---------------------------------------------------------------------------- diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index 89f14c6cfa..a9099b1ce9 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -308,48 +308,10 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::vector<std::string>& filenames) S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) { - std::string exten = gDirUtilp->getExtension(filename); - S32 materials_in_file = 0; - - if (exten == "gltf" || exten == "glb") + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + if (materials_in_file <= 0) { - tinygltf::TinyGLTF loader; - std::string error_msg; - std::string warn_msg; - - tinygltf::Model model_in; - - std::string filename_lc = filename; - LLStringUtil::toLower(filename_lc); - - // Load a tinygltf model fom a file. Assumes that the input filename has already been - // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. - bool decode_successful = false; - if (std::string::npos == filename_lc.rfind(".gltf")) - { // file is binary - decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc); - } - else - { // file is ascii - decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc); - } - - if (!decode_successful) - { - LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg - << ", warning:" << warn_msg - << " file: " << filename - << LL_ENDL; - return 0; - } - - if (model_in.materials.empty()) - { - // materials are missing - LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL; - return 0; - } - materials_in_file = model_in.materials.size(); + return 0; } S32 loaded_materials = 0; diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index fe674abeee..2e57c35326 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -347,6 +347,7 @@ LLMaterialEditor::LLMaterialEditor(const LLSD& key) , mRevertedChanges(0) , mExpectedUploadCost(0) , mUploadingTexturesCount(0) + , mUploadingTexturesFailure(false) { const LLInventoryItem* item = getItem(); if (item) @@ -390,14 +391,10 @@ BOOL LLMaterialEditor::postBuild() if (!gAgent.isGodlike()) { // Only allow fully permissive textures - mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mBaseColorTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mMetallicTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mEmissiveTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mNormalTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mNormalTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); + mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mNormalTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } // Texture callback @@ -408,6 +405,9 @@ BOOL LLMaterialEditor::postBuild() if (mIsOverride) { + // Material override change success callback + LLGLTFMaterialList::addSelectionUpdateCallback(&LLMaterialEditor::updateLive); + // Live editing needs a recovery mechanism on cancel mBaseColorTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_BASE_COLOR_TEX_DIRTY)); mMetallicTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY)); @@ -1252,9 +1252,9 @@ bool LLMaterialEditor::saveIfNeeded() { if (mUploadingTexturesCount > 0) { - // upload already in progress - // wait until textures upload - // will retry saving on callback + // Upload already in progress, wait until + // textures upload will retry saving on callback. + // Also should prevent some failure-callbacks return true; } @@ -1319,18 +1319,38 @@ bool LLMaterialEditor::updateInventoryItem(const std::string &buffer, const LLUU if (task_id.isNull() && !agent_url.empty()) { uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(item_id, LLAssetType::AT_MATERIAL, buffer, - [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) { - LLMaterialEditor::finishInventoryUpload(itemId, newAssetId, newItemId); - }); + [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) + { + // done callback + LLMaterialEditor::finishInventoryUpload(itemId, newAssetId, newItemId); + }, + nullptr // failure callback + ); url = agent_url; } else if (!task_id.isNull() && !task_url.empty()) { LLUUID object_uuid(task_id); uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(task_id, item_id, LLAssetType::AT_MATERIAL, buffer, - [object_uuid](LLUUID itemId, LLUUID, LLUUID newAssetId, LLSD) { - LLMaterialEditor::finishTaskUpload(itemId, newAssetId, object_uuid); - }); + [](LLUUID itemId, LLUUID task_id, LLUUID newAssetId, LLSD) + { + // done callback + LLMaterialEditor::finishTaskUpload(itemId, newAssetId, task_id); + }, + [](LLUUID itemId, LLUUID task_id, LLSD response, std::string reason) + { + // failure callback + LLSD floater_key; + floater_key["taskid"] = task_id; + floater_key["itemid"] = itemId; + LLMaterialEditor* me = LLFloaterReg::findTypedInstance<LLMaterialEditor>("material_editor", floater_key); + if (me) + { + me->setEnabled(true); + } + return true; + } + ); url = task_url; } @@ -1395,14 +1415,16 @@ void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std: inv_item_id, LLAssetType::AT_MATERIAL, output, - [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) { - LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " asset: " << new_asset_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; - LLSD params = llsd::map("ASSET_ID", new_asset_id); - LLNotificationsUtil::add("MaterialCreated", params); - }); + [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) + { + // done callback + LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " asset: " << new_asset_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; + LLSD params = llsd::map("ASSET_ID", new_asset_id); + LLNotificationsUtil::add("MaterialCreated", params); + }, + nullptr // failure callback, floater already closed + ); - // todo: apply permissions from textures here if server doesn't - // if any texture is 'no transfer', material should be 'no transfer' as well const LLViewerRegion* region = gAgent.getRegion(); if (region) { @@ -1537,6 +1559,12 @@ void LLMaterialEditor::refreshFromInventory(const LLUUID& new_item_id) void LLMaterialEditor::onClickSaveAs() { + if (!LLMaterialEditor::capabilitiesAvailable()) + { + LLNotificationsUtil::add("MissingMaterialCaps"); + return; + } + if (!can_afford_transaction(mExpectedUploadCost)) { LLSD args; @@ -1685,6 +1713,61 @@ static void pack_textures( } } +void LLMaterialEditor::uploadMaterialFromFile(const std::string& filename, S32 index) +{ + if (index < 0 || !LLMaterialEditor::capabilitiesAvailable()) + { + return; + } + + tinygltf::TinyGLTF loader; + std::string error_msg; + std::string warn_msg; + + bool loaded = false; + tinygltf::Model model_in; + + std::string filename_lc = filename; + LLStringUtil::toLower(filename_lc); + + // Load a tinygltf model fom a file. Assumes that the input filename has already been + // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. + if (std::string::npos == filename_lc.rfind(".gltf")) + { // file is binary + loaded = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename); + } + else + { // file is ascii + loaded = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename); + } + + if (!loaded) + { + LLNotificationsUtil::add("CannotUploadMaterial"); + return; + } + + if (model_in.materials.empty()) + { + // materials are missing + return; + } + + if (index >= 0 && model_in.materials.size() <= index) + { + // material is missing + return; + } + + // Todo: no point in loading whole editor + // This uses 'filename' to make sure multiple bulk uploads work + // instead of fighting for a single instance. + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD().with("filename", filename).with("index", LLSD::Integer(index))); + me->loadMaterial(model_in, filename_lc, index, false); + me->saveIfNeeded(); +} + + void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index) { tinygltf::TinyGLTF loader; @@ -1962,22 +2045,7 @@ void LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback(const LLSD& notificati } } -void LLMaterialEditor::loadFromGLTFMaterial(LLUUID &asset_id) -{ - if (asset_id.isNull()) - { - LL_WARNS("MaterialEditor") << "Trying to open material with null id" << LL_ENDL; - return; - } - LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); - me->mMaterialName = LLTrans::getString("New Material"); - me->setTitle(me->mMaterialName); - me->setFromGLTFMaterial(gGLTFMaterialList.getMaterial(asset_id)); - me->openFloater(); - me->setFocus(TRUE); -} - -void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index) +void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index, bool open_floater) { if (model_in.materials.size() <= index) { @@ -2075,10 +2143,13 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std:: markChangesUnsaved(U32_MAX); - openFloater(); - setFocus(TRUE); + if (open_floater) + { + openFloater(getKey()); + setFocus(TRUE); - applyToSelection(); + applyToSelection(); + } } bool LLMaterialEditor::setFromGltfModel(const tinygltf::Model& model, S32 index, bool set_textures) @@ -2453,7 +2524,7 @@ public: { // overrides are not supposed to work or apply if // there is no base material to work from - return false; + continue; } LLPointer<LLGLTFMaterial> material = tep->getGLTFMaterialOverride(); @@ -2955,6 +3026,16 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con U32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + LLSD key = getKey(); + std::function<bool(LLUUID itemId, LLSD response, std::string reason)> failed_upload([key](LLUUID assetId, LLSD response, std::string reason) + { + LLMaterialEditor* me = LLFloaterReg::findTypedInstance<LLMaterialEditor>("material_editor", key); + if (me) + { + me->setFailedToUploadTexture(); + } + return true; // handled + }); LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewBufferedResourceUploadInfo>( buffer, @@ -2970,13 +3051,26 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, false, - cb)); + cb, + failed_upload)); upload_new_resource(uploadInfo); } +void LLMaterialEditor::setFailedToUploadTexture() +{ + mUploadingTexturesFailure = true; + mUploadingTexturesCount--; + if (mUploadingTexturesCount == 0) + { + setEnabled(true); + } +} + S32 LLMaterialEditor::saveTextures() { + mUploadingTexturesFailure = false; // not supposed to get here if already uploading + S32 work_count = 0; LLSD key = getKey(); // must be locally declared for lambda's capture to work if (mBaseColorTextureUploadId == getBaseColorId() && mBaseColorTextureUploadId.notNull()) @@ -2991,16 +3085,29 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setBaseColorId(newAssetId); + + // discard upload buffers once texture have been saved + me->mBaseColorJ2C = nullptr; + me->mBaseColorFetched = nullptr; + me->mBaseColorTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - // To make sure that we won't retry (some failures can cb immediately) - me->setBaseColorId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } @@ -3016,16 +3123,29 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setNormalId(newAssetId); + + // discard upload buffers once texture have been saved + me->mNormalJ2C = nullptr; + me->mNormalFetched = nullptr; + me->mNormalTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - me->setNormalId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->setNormalId(newAssetId); - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } @@ -3041,15 +3161,29 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setMetallicRoughnessId(newAssetId); + + // discard upload buffers once texture have been saved + me->mMetallicRoughnessJ2C = nullptr; + me->mMetallicRoughnessFetched = nullptr; + me->mMetallicTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - me->setMetallicRoughnessId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } @@ -3066,21 +3200,39 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setEmissiveId(newAssetId); + + // discard upload buffers once texture have been saved + me->mEmissiveJ2C = nullptr; + me->mEmissiveFetched = nullptr; + me->mEmissiveTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - me->setEmissiveId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } - // discard upload buffers once textures have been saved - clearTextures(); + if (!work_count) + { + // Discard upload buffers once textures have been confirmed as saved. + // Otherwise we keep buffers for potential upload failure recovery. + clearTextures(); + } // asset storage can callback immediately, causing a decrease // of mUploadingTexturesCount, report amount of work scheduled diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 6deda5df50..74c776031e 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -103,6 +103,7 @@ public: void loadAsset() override; // @index if -1 and file contains more than one material, // will promt to select specific one + static void uploadMaterialFromFile(const std::string& filename, S32 index); static void loadMaterialFromFile(const std::string& filename, S32 index = -1); void onSelectionChanged(); // live overrides selection changes @@ -115,14 +116,13 @@ public: static void savePickedMaterialAs(); static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response); - static void loadFromGLTFMaterial(LLUUID &asset_id); - static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); void inventoryChanged(LLViewerObject* object, LLInventoryObject::object_list_t* inventory, S32 serial_num, void* user_data) override; typedef std::function<void(LLUUID newAssetId, LLSD response)> upload_callback_f; void saveTexture(LLImageJ2C* img, const std::string& name, const LLUUID& asset_id, upload_callback_f cb); + void setFailedToUploadTexture(); // save textures to inventory if needed // returns amount of scheduled uploads @@ -242,7 +242,7 @@ private: void setFromGLTFMaterial(LLGLTFMaterial* mat); bool setFromSelection(); - void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index); + void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index, bool open_floater = true); friend class LLMaterialFilePicker; @@ -294,6 +294,7 @@ private: U32 mRevertedChanges; // flags to indicate individual reverted parameters S32 mUploadingTexturesCount; S32 mExpectedUploadCost; + bool mUploadingTexturesFailure; std::string mMaterialNameShort; std::string mMaterialName; diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index d11b3b57f3..2d1cd43e94 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1360,7 +1360,6 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id) "SELECT PHOTO", PERM_NONE, PERM_NONE, - PERM_NONE, FALSE, NULL); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index ea10aa75ae..69998e8be4 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -574,7 +574,6 @@ static void init_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const L // Don't allow (no copy) or (notransfer) textures to be selected. texture_ctrl->setImmediateFilterPermMask(PERM_NONE); texture_ctrl->setDnDFilterPermMask(PERM_NONE); - texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE); } } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 84b1ff63f4..8848accab0 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -32,7 +32,6 @@ // library includes #include "llcalc.h" #include "llerror.h" -#include "llfocusmgr.h" #include "llrect.h" #include "llstring.h" #include "llfontgl.h" @@ -95,6 +94,8 @@ using namespace std::literals; +LLPanelFace::Selection LLPanelFace::sMaterialOverrideSelection; + // // Constant definitions for comboboxes // Must match the commbobox definitions in panel_tools_texture.xml @@ -136,7 +137,7 @@ LLGLTFMaterial::TextureInfo texture_info_from_pbrtype(S32 pbr_type) } } -void updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func) +void LLPanelFace::updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func) { struct LLSelectedTEGLTFMaterialFunctor : public LLSelectedTEFunctor { @@ -158,6 +159,7 @@ void updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func) std::function<void(LLGLTFMaterial*)> mFunc; } select_func(func); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&select_func); } @@ -268,11 +270,14 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this); childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this); - childSetCommitCallback("gltfTextureScaleU", boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); - childSetCommitCallback("gltfTextureScaleV", boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); - childSetCommitCallback("gltfTextureRotation", boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); - childSetCommitCallback("gltfTextureOffsetU", boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); - childSetCommitCallback("gltfTextureOffsetV", boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); + getChild<LLUICtrl>("gltfTextureScaleU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); + getChild<LLUICtrl>("gltfTextureScaleV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); + getChild<LLUICtrl>("gltfTextureRotation")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); + getChild<LLUICtrl>("gltfTextureOffsetU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); + getChild<LLUICtrl>("gltfTextureOffsetV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); + + LLGLTFMaterialList::addSelectionUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); + sMaterialOverrideSelection.connect(); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); @@ -486,6 +491,11 @@ void LLPanelFace::draw() updateMediaTitle(); LLPanel::draw(); + + if (sMaterialOverrideSelection.update()) + { + setMaterialOverridesFromSelection(); + } } void LLPanelFace::sendTexture() @@ -986,8 +996,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL) { - mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + // When selecting an object with a pbr and UI combo is not set, + // set to pbr option, otherwise to a texture (material) + if (has_pbr_material) + { + mComboMatMedia->selectNthItem(MATMEDIA_PBR); + } + else + { + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } } + mComboMatMedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); @@ -1054,7 +1074,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable); + getChildView("ColorTrans")->setEnabled(editable && has_material); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); @@ -1773,7 +1793,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { has_pbr_material = false; - BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + const bool editable = objectp->permModify() && !objectp->isPermanentEnforced(); bool has_pbr_capabilities = LLMaterialEditor::capabilitiesAvailable(); // pbr material @@ -1784,10 +1804,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool identical_pbr; LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); + has_pbr_material = pbr_id.notNull(); + pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); pbr_ctrl->setEnabled(editable && has_pbr_capabilities); pbr_ctrl->setImageAssetID(pbr_id); - has_pbr_material = pbr_id.notNull(); } getChildView("pbr_from_inventory")->setEnabled(editable && has_pbr_capabilities); @@ -1797,65 +1818,23 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) { - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); - LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); - LLUICtrl* gltfCtrlTextureRotation = getChild<LLUICtrl>("gltfTextureRotation"); + LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); + LLUICtrl* gltfCtrlTextureRotation = getChild<LLUICtrl>("gltfTextureRotation"); LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV"); - gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities); - gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities); - gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities); - gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities); - gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities); + gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - if (show_texture_info) - { - LLGLTFMaterial::TextureTransform transform; - bool scale_u_same = true; - bool scale_v_same = true; - bool rotation_same = true; - bool offset_u_same = true; - bool offset_v_same = true; - - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; - }, transform.mScale[VX], scale_u_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; - }, transform.mScale[VY], scale_v_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; - }, transform.mRotation, rotation_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; - }, transform.mOffset[VX], offset_u_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; - }, transform.mOffset[VY], offset_v_same, true, 1e-3f); - - gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); - gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); - gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); - gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); - gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); - - gltfCtrlTextureScaleU->setTentative(!scale_u_same); - gltfCtrlTextureScaleV->setTentative(!scale_v_same); - gltfCtrlTextureRotation->setTentative(!rotation_same); - gltfCtrlTextureOffsetU->setTentative(!offset_u_same); - gltfCtrlTextureOffsetV->setTentative(!offset_v_same); - } + // Control values are set in setMaterialOverridesFromSelection } } @@ -2084,6 +2063,12 @@ void LLPanelFace::unloadMedia() mTitleMedia->unloadMediaSource(); } +// static +void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side) +{ + sMaterialOverrideSelection.onSelectedObjectUpdated(object_id, side); +} + ////////////////////////////////////////////////////////////////////////////// // void LLPanelFace::navigateToTitleMedia( const std::string url ) @@ -2828,6 +2813,7 @@ void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) // and generally reflecting old state when switching tabs or objects // self->updateUI(); + self->setMaterialOverridesFromSelection(); } // static @@ -4677,7 +4663,7 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) self->sendTextureInfo(); } -void updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit) +void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit) { U32 texture_info_start; U32 texture_info_end; @@ -4699,6 +4685,148 @@ void updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LL edit(&new_transform); } }); + + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); + if (node) + { + LLViewerObject* object = node->getObject(); + sMaterialOverrideSelection.setObjectUpdatePending(object->getID(), node->getLastSelectedTE()); + } +} + +void LLPanelFace::setMaterialOverridesFromSelection() +{ + const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) + { + return; + } + + LLGLTFMaterial::TextureTransform transform; + bool scale_u_same = true; + bool scale_v_same = true; + bool rotation_same = true; + bool offset_u_same = true; + bool offset_v_same = true; + + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; + }, transform.mScale[VX], scale_u_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; + }, transform.mScale[VY], scale_v_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; + }, transform.mRotation, rotation_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; + }, transform.mOffset[VX], offset_u_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; + }, transform.mOffset[VY], offset_v_same, true, 1e-3f); + + LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); + LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); + LLUICtrl* gltfCtrlTextureRotation = getChild<LLUICtrl>("gltfTextureRotation"); + LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU"); + LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV"); + + gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); + gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); + gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); + gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); + gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); + + gltfCtrlTextureScaleU->setTentative(!scale_u_same); + gltfCtrlTextureScaleV->setTentative(!scale_v_same); + gltfCtrlTextureRotation->setTentative(!rotation_same); + gltfCtrlTextureOffsetU->setTentative(!offset_u_same); + gltfCtrlTextureOffsetV->setTentative(!offset_v_same); +} + +void LLPanelFace::Selection::connect() +{ + if (!mSelectConnection.connected()) + { + mSelectConnection = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLPanelFace::Selection::onSelectionChanged, this)); + } +} + +bool LLPanelFace::Selection::update() +{ + const bool selection_changed = compareSelection(); + if (selection_changed) + { + clearObjectUpdatePending(); + } + else if (isObjectUpdatePending()) + { + return false; + } + + const bool changed = mChanged; + mChanged = false; + return changed; +} + +void LLPanelFace::Selection::setObjectUpdatePending(const LLUUID &object_id, S32 side) +{ + mPendingObjectID = object_id; + mPendingSide = side; +} + +void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S32 side) +{ + if (object_id == mSelectedObjectID && side == mSelectedSide) + { + mChanged = true; + clearObjectUpdatePending(); + } +} + +void LLPanelFace::Selection::clearObjectUpdatePending() +{ + mPendingObjectID = LLUUID::null; + mPendingSide = -1; +} + +bool LLPanelFace::Selection::compareSelection() +{ + if (!mNeedsSelectionCheck) + { + return false; + } + mNeedsSelectionCheck = false; + + const S32 old_object_count = mSelectedObjectCount; + const LLUUID old_object_id = mSelectedObjectID; + const S32 old_side = mSelectedSide; + + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = selection->getFirstNode(); + if (node) + { + LLViewerObject* object = node->getObject(); + mSelectedObjectCount = selection->getObjectCount(); + mSelectedObjectID = object->getID(); + mSelectedSide = node->getLastSelectedTE(); + } + else + { + mSelectedObjectCount = 0; + mSelectedObjectID = LLUUID::null; + mSelectedSide = -1; + } + + const bool selection_changed = old_object_count != mSelectedObjectCount || old_object_id != mSelectedObjectID || old_side != mSelectedSide; + mChanged = mChanged || selection_changed; + return selection_changed; } void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 69744689b5..c0afc79cbe 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -29,6 +29,7 @@ #include "v4color.h" #include "llpanel.h" +#include "llgltfmaterial.h" #include "llmaterial.h" #include "llmaterialmgr.h" #include "lltextureentry.h" @@ -102,7 +103,7 @@ public: void refreshMedia(); void unloadMedia(); - static void onGLTFMaterialUpdate(const LLUUID& object_id, S32 side); + static void onMaterialOverrideReceived(const LLUUID& object_id, S32 side); /*virtual*/ void draw(); @@ -176,7 +177,6 @@ protected: // // @param force_set_values forces spinners to set value even if they are focused void updateUI(bool force_set_values = false); - void updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool force_set_values); // Convenience func to determine if all faces in selection have // identical planar texgen settings during edits @@ -229,11 +229,13 @@ protected: static void onCommitGlow( LLUICtrl* ctrl, void *userdata); static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo); + void onCommitGLTFTextureScaleU(LLUICtrl* ctrl); void onCommitGLTFTextureScaleV(LLUICtrl* ctrl); void onCommitGLTFRotation(LLUICtrl* ctrl); void onCommitGLTFTextureOffsetU(LLUICtrl* ctrl); void onCommitGLTFTextureOffsetV(LLUICtrl* ctrl); + static void onClickAutoFix(void*); static void onAlignTexture(void*); static void onClickBtnLoadInvPBR(void* userdata); @@ -291,7 +293,6 @@ private: // Do NOT call updateUI from within this function. // void updateVisibility(); - void updateVisibilityGLTF(); // Hey look everyone, a type-safe alternative to copy and paste! :) // @@ -451,29 +452,62 @@ private: void onTextureSelectionChanged(LLInventoryItem* itemp); void onPbrSelectionChanged(LLInventoryItem* itemp); + void updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool force_set_values); + void updateVisibilityGLTF(); + + void updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func); + void updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit); + + void setMaterialOverridesFromSelection(); + LLMenuButton* mMenuClipboardColor; LLMenuButton* mMenuClipboardTexture; bool mIsAlpha; - /* These variables interlock processing of materials updates sent to - * the sim. mUpdateInFlight is set to flag that an update has been - * sent to the sim and not acknowledged yet, and cleared when an - * update is received from the sim. mUpdatePending is set when - * there's an update in flight and another UI change has been made - * that needs to be sent as a materials update, and cleared when the - * update is sent. This prevents the sim from getting spammed with - * update messages when, for example, the user holds down the - * up-arrow on a spinner, and avoids running afoul of its throttle. - */ - bool mUpdateInFlight; - bool mUpdatePending; - LLSD mClipboardParams; LLSD mMediaSettings; bool mNeedMediaTitle; + class Selection + { + public: + void connect(); + + // Returns true if the selected objects or sides have changed since + // this was last called, and no object update is pending + bool update(); + + // Prevents update() returning true until the provided object is + // updated. Necessary to prevent controls updating when the mouse is + // held down. + void setObjectUpdatePending(const LLUUID &object_id, S32 side); + + // Callbacks + void onSelectionChanged() { mNeedsSelectionCheck = true; } + void onSelectedObjectUpdated(const LLUUID &object_id, S32 side); + + protected: + void clearObjectUpdatePending(); + bool isObjectUpdatePending() { return mPendingSide != -1; } + + bool compareSelection(); + + bool mChanged = false; + + boost::signals2::scoped_connection mSelectConnection; + bool mNeedsSelectionCheck = true; + S32 mSelectedObjectCount = 0; + LLUUID mSelectedObjectID; + S32 mSelectedSide = -1; + + LLUUID mPendingObjectID; + S32 mPendingSide = -1; + }; + + static Selection sMaterialOverrideSelection; + public: #if defined(DEF_GET_MAT_STATE) #undef DEF_GET_MAT_STATE diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 26cd3ff1c1..213a66f005 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -86,7 +86,6 @@ BOOL LLPanelLandMedia::postBuild() mMediaTextureCtrl->setAllowNoTexture ( TRUE ); mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaAutoScaleCheck = getChild<LLCheckBoxCtrl>("media_auto_scale"); childSetCommitCallback("media_auto_scale", onCommitAny, this); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 0bfc1297d3..0236b66b70 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -250,8 +250,6 @@ BOOL LLPanelObject::postBuild() // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mCtrlSculptTexture->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - // Allow any texture to be used during non-immediate mode. - mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE); LLAggregatePermissions texture_perms; if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index f4eaa78f11..d9a8d496d1 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1864,7 +1864,6 @@ void LLPanelProfileSecondLife::onShowTexturePicker() "SELECT PHOTO", PERM_NONE, PERM_NONE, - PERM_NONE, FALSE, NULL); @@ -2205,7 +2204,6 @@ void LLPanelProfileFirstLife::onChangePhoto() "SELECT PHOTO", PERM_NONE, PERM_NONE, - PERM_NONE, FALSE, NULL); diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 759e7859f2..544ff8b5dc 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -1108,14 +1108,16 @@ void LLPreviewGesture::saveIfNeeded() item->setComplete(true); uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mItemUUID, LLAssetType::AT_GESTURE, buffer, - [](LLUUID itemId, LLUUID newAssetId, LLUUID, LLSD) { + [](LLUUID itemId, LLUUID newAssetId, LLUUID, LLSD) + { LLPreviewGesture::finishInventoryUpload(itemId, newAssetId); - }); + }, + nullptr); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) { - uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, nullptr); + uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, nullptr, nullptr); url = task_url; } diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 3fd4f51559..2eccc0474f 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -552,7 +552,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mItemUUID, LLAssetType::AT_NOTECARD, buffer, [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) { LLPreviewNotecard::finishInventoryUpload(itemId, newAssetId, newItemId); - }); + }, + nullptr); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) @@ -561,7 +562,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer, [object_uuid](LLUUID itemId, LLUUID, LLUUID newAssetId, LLSD) { LLPreviewNotecard::finishTaskUpload(itemId, newAssetId, object_uuid); - }); + }, + nullptr); url = task_url; } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5043250e08..8b93dd103d 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1686,6 +1686,32 @@ void LLPreviewLSL::finishedLSLUpload(LLUUID itemId, LLSD response) } } +bool LLPreviewLSL::failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason) +{ + LLSD floater_key; + if (taskId.notNull()) + { + floater_key["taskid"] = taskId; + floater_key["itemid"] = itemId; + } + else + { + floater_key = LLSD(itemId); + } + + LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", floater_key); + if (preview) + { + // unfreeze floater + LLSD errors; + errors.append(LLTrans::getString("UploadFailed") + reason); + preview->callbackLSLCompileFailed(errors); + return true; + } + + return false; +} + // Save needs to compile the text in the buffer. If the compile // succeeds, then save both assets out to the database. If the compile // fails, go ahead and save the text anyway. @@ -1723,7 +1749,8 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) [old_asset_id](LLUUID itemId, LLUUID, LLUUID, LLSD response) { LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT); LLPreviewLSL::finishedLSLUpload(itemId, response); - })); + }, + LLPreviewLSL::failedLSLUpload)); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } @@ -2282,7 +2309,8 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) [isRunning, old_asset_id](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT); LLLiveLSLEditor::finishLSLUpload(itemId, taskId, newAssetId, response, isRunning); - })); + }, + nullptr)); // needs failure handling? LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index f851ff6f3f..b01c7fd4ad 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -245,6 +245,7 @@ protected: static void* createScriptEdPanel(void* userdata); static void finishedLSLUpload(LLUUID itemId, LLSD response); + static bool failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason); protected: // Can safely close only after both text and bytecode are uploaded diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 8282aa2507..088b83a8e9 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -41,6 +41,11 @@ extern BOOL gTeleportDisplay; LLReflectionMapManager::LLReflectionMapManager() { + initCubeFree(); +} + +void LLReflectionMapManager::initCubeFree() +{ for (int i = 1; i < LL_MAX_REFLECTION_PROBE_COUNT; ++i) { mCubeFree[i] = true; @@ -50,12 +55,6 @@ LLReflectionMapManager::LLReflectionMapManager() mCubeFree[0] = false; } -struct CompareReflectionMapDistance -{ - -}; - - struct CompareProbeDistance { bool operator()(const LLPointer<LLReflectionMap>& lhs, const LLPointer<LLReflectionMap>& rhs) @@ -79,7 +78,6 @@ void LLReflectionMapManager::update() return; } - // =============== TODO -- move to an init function ================= initReflectionMaps(); if (!mRenderTarget.isComplete()) @@ -918,3 +916,30 @@ void LLReflectionMapManager::initReflectionMaps() mVertexBuffer = buff; } } + +void LLReflectionMapManager::cleanup() +{ + mVertexBuffer = nullptr; + mRenderTarget.release(); + + mMipChain.clear(); + + mTexture = nullptr; + mIrradianceMaps = nullptr; + + mProbes.clear(); + mKillList.clear(); + mCreateList.clear(); + + mReflectionMaps.clear(); + mUpdatingFace = 0; + + mDefaultProbe = nullptr; + mUpdatingProbe = nullptr; + + glDeleteBuffers(1, &mUBO); + mUBO = 0; + + // note: also called on teleport (not just shutdown), so make sure we're in a good "starting" state + initCubeFree(); +} diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index e0a2c00db3..14a6c089da 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -58,6 +58,9 @@ public: // allocate an environment map of the given resolution LLReflectionMapManager(); + // release any GL state + void cleanup(); + // maintain reflection probes void update(); @@ -94,6 +97,9 @@ public: private: friend class LLPipeline; + // initialize mCubeFree array to default values + void initCubeFree(); + // delete the probe with the given index in mProbes void deleteProbe(U32 i); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index f9b7c749b3..59cfb4f0c4 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -234,9 +234,11 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION); LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(), - [settings, callback](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response) { + [settings, callback](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response) + { LLSettingsVOBase::onAgentAssetUploadComplete(itemId, newAssetId, newItemId, response, settings, callback); - }); + }, + nullptr); LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); } @@ -265,9 +267,11 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION); LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(object_id, inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(), - [settings, callback](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { - LLSettingsVOBase::onTaskAssetUploadComplete(itemId, taskId, newAssetId, response, settings, callback); - }); + [settings, callback](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) + { + LLSettingsVOBase::onTaskAssetUploadComplete(itemId, taskId, newAssetId, response, settings, callback); + }, + nullptr); LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 7d1bc7fc48..113cd98164 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2328,7 +2328,7 @@ S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& sca return detail; } -void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLColor4& line_color) +void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color) { LLUUID mesh_id = volume->getVolume()->getParams().getSculptID(); LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id); @@ -2340,13 +2340,8 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo { if (!decomp->mBaseHullMesh.empty()) { - gGL.diffuseColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.diffuseColor4fv(line_color.mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } else { @@ -2363,19 +2358,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo } } -void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color) +void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color) { - gGL.diffuseColor4fv(color.mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glLineWidth(3.f); - gGL.diffuseColor4fv(line_color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions); - glLineWidth(1.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } -void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) +void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe) { U8 physics_type = volume->getPhysicsShapeType(); @@ -2405,7 +2394,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) color = lerp( mid, high, 2.f * ( normalizedCost - 0.5f ) ); } - LLColor4 line_color = color*0.5f; + if (wireframe) + { + color = color * 0.5f; + } U32 data_mask = LLVertexBuffer::MAP_VERTEX; @@ -2425,9 +2417,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) gGL.pushMatrix(); gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); - LLGLEnable(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(3.f, 3.f); - if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH) { LLUUID mesh_id = volume->getVolume()->getParams().getSculptID(); @@ -2448,23 +2437,19 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) for (U32 i = 0; i < decomp->mMesh.size(); ++i) { - render_hull(decomp->mMesh[i], color, line_color); + render_hull(decomp->mMesh[i], color); } } else if (!decomp->mPhysicsShapeMesh.empty()) { //decomp has physics mesh, render that mesh - gGL.diffuseColor4fv(color.mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.diffuseColor4fv(line_color.mV); + gGL.diffuseColor4fv(color.mV); + LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } else { //no mesh or decomposition, render base hull - renderMeshBaseHull(volume, data_mask, color, line_color); + renderMeshBaseHull(volume, data_mask, color); if (decomp->mPhysicsShapeMesh.empty()) { @@ -2484,7 +2469,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) { if (volume->isMesh()) { - renderMeshBaseHull(volume, data_mask, color, line_color); + renderMeshBaseHull(volume, data_mask, color); } else { @@ -2580,20 +2565,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) if (phys_volume->mHullPoints) { //render hull - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - gGL.diffuseColor4fv(line_color.mV); - LLVertexBuffer::unbind(); + gGL.diffuseColor4fv(color.mV); - llassert(LLGLSLShader::sCurBoundShader != 0); - - LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); - - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + LLVertexBuffer::unbind(); LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); - } else { @@ -2606,41 +2581,50 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX) { - LLVector3 center = physics_spec.getCenter(); - LLVector3 scale = physics_spec.getScale(); - LLVector3 vscale = volume->getScale()*2.f; - scale.set(scale[0]/vscale[0], scale[1]/vscale[1], scale[2]/vscale[2]); - - gGL.diffuseColor4fv(color.mV); - drawBox(center, scale); + if (!wireframe) + { + LLVector3 center = physics_spec.getCenter(); + LLVector3 scale = physics_spec.getScale(); + LLVector3 vscale = volume->getScale() * 2.f; + scale.set(scale[0] / vscale[0], scale[1] / vscale[1], scale[2] / vscale[2]); + + gGL.diffuseColor4fv(color.mV); + drawBox(center, scale); + } } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE) { - LLVolumeParams volume_params; - volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE ); - volume_params.setBeginAndEndS( 0.f, 1.f ); - volume_params.setBeginAndEndT( 0.f, 1.f ); - volume_params.setRatio ( 1, 1 ); - volume_params.setShear ( 0, 0 ); - LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); - - gGL.diffuseColor4fv(color.mV); - pushVerts(sphere); - LLPrimitive::sVolumeManager->unrefVolume(sphere); + if (!wireframe) + { + LLVolumeParams volume_params; + volume_params.setType(LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE); + volume_params.setBeginAndEndS(0.f, 1.f); + volume_params.setBeginAndEndT(0.f, 1.f); + volume_params.setRatio(1, 1); + volume_params.setShear(0, 0); + LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); + + gGL.diffuseColor4fv(color.mV); + pushVerts(sphere); + LLPrimitive::sVolumeManager->unrefVolume(sphere); + } } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER) { - LLVolumeParams volume_params; - volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE ); - volume_params.setBeginAndEndS( 0.f, 1.f ); - volume_params.setBeginAndEndT( 0.f, 1.f ); - volume_params.setRatio ( 1, 1 ); - volume_params.setShear ( 0, 0 ); - LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); - - gGL.diffuseColor4fv(color.mV); - pushVerts(cylinder); - LLPrimitive::sVolumeManager->unrefVolume(cylinder); + if (!wireframe) + { + LLVolumeParams volume_params; + volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE); + volume_params.setBeginAndEndS(0.f, 1.f); + volume_params.setBeginAndEndT(0.f, 1.f); + volume_params.setRatio(1, 1); + volume_params.setShear(0, 0); + LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); + + gGL.diffuseColor4fv(color.mV); + pushVerts(cylinder); + LLPrimitive::sVolumeManager->unrefVolume(cylinder); + } } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_MESH) { @@ -2648,14 +2632,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) S32 detail = get_physics_detail(volume_params, volume->getScale()); LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - gGL.diffuseColor4fv(line_color.mV); - pushVerts(phys_volume); - - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + gGL.diffuseColor4fv(color.mV); pushVerts(phys_volume); + LLPrimitive::sVolumeManager->unrefVolume(phys_volume); } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_CONVEX) @@ -2667,21 +2647,15 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) if (phys_volume->mHullPoints && phys_volume->mHullIndices) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + llassert(LLGLSLShader::sCurBoundShader != 0); LLVertexBuffer::unbind(); glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); - gGL.diffuseColor4fv(line_color.mV); - gGL.syncMatrices(); - { - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); - } - - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - { - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); - } + + gGL.diffuseColor4fv(color.mV); + + gGL.syncMatrices(); + glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); } else { @@ -2703,7 +2677,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) gGL.popMatrix(); } -void renderPhysicsShapes(LLSpatialGroup* group) +void renderPhysicsShapes(LLSpatialGroup* group, bool wireframe) { for (OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { @@ -2721,7 +2695,7 @@ void renderPhysicsShapes(LLSpatialGroup* group) { gGL.pushMatrix(); gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); - bridge->renderPhysicsShapes(); + bridge->renderPhysicsShapes(wireframe); gGL.popMatrix(); } } @@ -2735,16 +2709,17 @@ void renderPhysicsShapes(LLSpatialGroup* group) gGL.pushMatrix(); LLVector3 trans = drawable->getRegion()->getOriginAgent(); gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); - renderPhysicsShape(drawable, volume); + renderPhysicsShape(drawable, volume, wireframe); gGL.popMatrix(); } else { - renderPhysicsShape(drawable, volume); + renderPhysicsShape(drawable, volume, wireframe); } } else { +#if 0 LLViewerObject* object = drawable->getVObj(); if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) { @@ -2762,10 +2737,10 @@ void renderPhysicsShapes(LLSpatialGroup* group) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - gGL.diffuseColor3f(0.2f, 0.5f, 0.3f); + gGL.diffuseColor4f(0.2f, 0.5f, 0.3f, 0.5f); buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); - gGL.diffuseColor3f(0.2f, 1.f, 0.3f); + gGL.diffuseColor4f(0.2f, 1.f, 0.3f, 0.75f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); } @@ -2773,6 +2748,7 @@ void renderPhysicsShapes(LLSpatialGroup* group) } gGL.popMatrix(); } +#endif } } } @@ -3573,7 +3549,9 @@ class LLOctreeRenderPhysicsShapes : public OctreeTraveler { public: LLCamera* mCamera; - LLOctreeRenderPhysicsShapes(LLCamera* camera): mCamera(camera) {} + bool mWireframe; + + LLOctreeRenderPhysicsShapes(LLCamera* camera, bool wireframe): mCamera(camera), mWireframe(wireframe) {} virtual void traverse(const OctreeNode* node) { @@ -3594,7 +3572,7 @@ public: group->rebuildGeom(); group->rebuildMesh(); - renderPhysicsShapes(group); + renderPhysicsShapes(group, mWireframe); } } @@ -3727,7 +3705,7 @@ public: }; -void LLSpatialPartition::renderPhysicsShapes() +void LLSpatialPartition::renderPhysicsShapes(bool wireframe) { LLSpatialBridge* bridge = asBridge(); LLCamera* camera = LLViewerCamera::getInstance(); @@ -3739,11 +3717,9 @@ void LLSpatialPartition::renderPhysicsShapes() gGL.flush(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glLineWidth(3.f); - LLOctreeRenderPhysicsShapes render_physics(camera); + LLOctreeRenderPhysicsShapes render_physics(camera, wireframe); render_physics.traverse(mOctree); gGL.flush(); - glLineWidth(1.f); } void LLSpatialPartition::renderDebug() diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 42ae1a2a15..020a010405 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -434,7 +434,7 @@ public: LLSpatialBridge* asBridge() { return mBridge; } BOOL isBridge() { return asBridge() != NULL; } - void renderPhysicsShapes(); + void renderPhysicsShapes(bool depth_only); void renderDebug(); void renderIntersectingBBoxes(LLCamera* camera); void restoreGL(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 862db08e62..76b7347b21 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -325,6 +325,8 @@ void set_flags_and_update_appearance() { LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op); + + LLInventoryModelBackgroundFetch::instance().start(); } // Returns false to skip other idle processing. Should only return @@ -1435,6 +1437,9 @@ bool idle_startup() // to hapen with caps granted gTextureList.doPrefetchImages(); + // will init images, should be done with caps, but before gSky.init() + LLEnvironment::getInstance()->initSingleton(); + display_startup(); update_texture_fetch(); display_startup(); @@ -2918,6 +2923,7 @@ void reset_login() gAgentWearables.cleanup(); gAgentCamera.cleanup(); gAgent.cleanup(); + gSky.cleanup(); // mVOSkyp is an inworld object. LLWorld::getInstance()->resetClass(); if ( gViewerWindow ) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 3374af1c76..9911af8eb1 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -148,7 +148,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately, LLUIImagePtr fallback_image) : LLFloater(LLSD()), @@ -167,7 +166,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mFilterEdit(NULL), mImmediateFilterPermMask(immediate_filter_perm_mask), mDnDFilterPermMask(dnd_filter_perm_mask), - mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mContextConeOpacity(0.f), mSelectedItemPinned( FALSE ), mCanApply(true), @@ -254,7 +252,6 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) mCanApplyImmediately = b; getChild<LLUICtrl>("apply_immediate_check")->setValue(mCanApplyImmediately); - updateFilterPermMask(); } void LLFloaterTexturePicker::stopUsingPipette() @@ -332,7 +329,6 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( if (mod) item_perm_mask |= PERM_MODIFY; if (xfer) item_perm_mask |= PERM_TRANSFER; - //PermissionMask filter_perm_mask = getFilterPermMask(); Commented out due to no-copy texture loss. PermissionMask filter_perm_mask = mDnDFilterPermMask; if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) { @@ -488,8 +484,6 @@ BOOL LLFloaterTexturePicker::postBuild() childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); - // update permission filter once UI is fully initialized - updateFilterPermMask(); mSavedFolderState.setApply(FALSE); LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); @@ -667,12 +661,6 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co return LLUUID::null; } -PermissionMask LLFloaterTexturePicker::getFilterPermMask() -{ - bool apply_immediate = getChild<LLUICtrl>("apply_immediate_check")->getValue().asBoolean(); - return apply_immediate ? mImmediateFilterPermMask : mNonImmediateFilterPermMask; -} - void LLFloaterTexturePicker::commitIfImmediateSet() { if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply) @@ -1051,7 +1039,6 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; gSavedSettings.setBOOL("TextureLivePreview", check_box->get()); - picker->updateFilterPermMask(); picker->commitIfImmediateSet(); } @@ -1128,11 +1115,6 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data } } -void LLFloaterTexturePicker::updateFilterPermMask() -{ - //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. -} - void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply) { getChildRef<LLUICtrl>("Select").setEnabled(can_apply); @@ -1372,7 +1354,6 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mAllowNoTexture( p.allow_no_texture ), mAllowLocalTexture( TRUE ), mImmediateFilterPermMask( PERM_NONE ), - mNonImmediateFilterPermMask( PERM_NONE ), mCanApplyImmediately( FALSE ), mNeedsRawImageData( FALSE ), mValid( TRUE ), @@ -1552,7 +1533,6 @@ void LLTextureCtrl::showPicker(BOOL take_focus) mLabel, mImmediateFilterPermMask, mDnDFilterPermMask, - mNonImmediateFilterPermMask, mCanApplyImmediately, mFallbackImage); mFloaterHandle = floaterp->getHandle(); @@ -1635,8 +1615,16 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) if (!mOpenTexPreview) { showPicker(FALSE); - //grab textures first... - LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + //grab materials first... + LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL)); + } + else + { + //grab textures first... + LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); + } //...then start full inventory fetch. LLInventoryModelBackgroundFetch::instance().start(); handled = TRUE; @@ -1820,7 +1808,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, allow_dnd = is_texture || is_mesh || is_material; } - if (getEnabled() && allow_dnd && allowDrop(item)) + if (getEnabled() && allow_dnd && allowDrop(item, cargo_type, tooltip_msg)) { if (drop) { @@ -1972,7 +1960,7 @@ void LLTextureCtrl::draw() LLUICtrl::draw(); } -BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) +BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg) { BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); @@ -1984,8 +1972,6 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) if (mod) item_perm_mask |= PERM_MODIFY; if (xfer) item_perm_mask |= PERM_TRANSFER; -// PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss. -// mImmediateFilterPermMask : mNonImmediateFilterPermMask; PermissionMask filter_perm_mask = mImmediateFilterPermMask; if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) { @@ -2000,6 +1986,12 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) } else { + PermissionMask mask = PERM_COPY | PERM_TRANSFER; + if ((filter_perm_mask & mask) == mask + && cargo_type == DAD_TEXTURE) + { + tooltip_msg.assign(LLTrans::getString("TooltipTextureRestrictedDrop")); + } return FALSE; } } diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index d06a82bbd5..d898722006 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -187,10 +187,7 @@ public: { mImmediateFilterPermMask = mask; } void setDnDFilterPermMask(PermissionMask mask) { mDnDFilterPermMask = mask; } - void setNonImmediateFilterPermMask(PermissionMask mask) - { mNonImmediateFilterPermMask = mask; } PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; } - PermissionMask getNonImmediateFilterPermMask() { return mNonImmediateFilterPermMask; } void closeDependentFloater(); @@ -226,7 +223,7 @@ public: EPickInventoryType getInventoryPickType() { return mInventoryPickType; }; private: - BOOL allowDrop(LLInventoryItem* item); + BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg); BOOL doDrop(LLInventoryItem* item); private: @@ -252,7 +249,6 @@ private: BOOL mAllowLocalTexture; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - PermissionMask mNonImmediateFilterPermMask; BOOL mCanApplyImmediately; BOOL mCommitOnSelection; BOOL mNeedsRawImageData; @@ -286,7 +282,6 @@ public: const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately, LLUIImagePtr fallback_image_name ); @@ -317,9 +312,7 @@ public: LLView* getOwner() const { return mOwner; } void setOwner(LLView* owner) { mOwner = owner; } void stopUsingPipette(); - PermissionMask getFilterPermMask(); - void updateFilterPermMask(); void commitIfImmediateSet(); void commitCancel(); @@ -388,7 +381,6 @@ protected: LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - PermissionMask mNonImmediateFilterPermMask; BOOL mCanApplyImmediately; BOOL mNoCopyTextureSelected; F32 mContextConeOpacity; diff --git a/indra/newview/lltinygltfhelper.cpp b/indra/newview/lltinygltfhelper.cpp index 05587af9bc..838524e910 100644 --- a/indra/newview/lltinygltfhelper.cpp +++ b/indra/newview/lltinygltfhelper.cpp @@ -182,12 +182,62 @@ LLImageRaw * LLTinyGLTFHelper::getTexture(const std::string & folder, const tiny return rawImage; } +S32 LLTinyGLTFHelper::getMaterialCountFromFile(const std::string& filename) +{ + std::string exten = gDirUtilp->getExtension(filename); + S32 materials_in_file = 0; + + if (exten == "gltf" || exten == "glb") + { + tinygltf::TinyGLTF loader; + std::string error_msg; + std::string warn_msg; + + tinygltf::Model model_in; + + std::string filename_lc = filename; + LLStringUtil::toLower(filename_lc); + + // Load a tinygltf model fom a file. Assumes that the input filename has already been + // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. + bool decode_successful = false; + if (std::string::npos == filename_lc.rfind(".gltf")) + { // file is binary + decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc); + } + else + { // file is ascii + decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc); + } + + if (!decode_successful) + { + LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg + << ", warning:" << warn_msg + << " file: " << filename + << LL_ENDL; + return 0; + } + + if (model_in.materials.empty()) + { + // materials are missing + LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL; + return 0; + } + materials_in_file = model_in.materials.size(); + } + return materials_in_file; +} + bool LLTinyGLTFHelper::getMaterialFromFile( const std::string& filename, S32 mat_index, - LLPointer < LLFetchedGLTFMaterial> material, + LLFetchedGLTFMaterial* material, std::string& material_name) { + llassert(material); + tinygltf::TinyGLTF loader; std::string error_msg; std::string warn_msg; @@ -304,5 +354,4 @@ bool LLTinyGLTFHelper::getMaterialFromFile( } return true; - } diff --git a/indra/newview/lltinygltfhelper.h b/indra/newview/lltinygltfhelper.h index 250a4b0b9a..92c9876aff 100644 --- a/indra/newview/lltinygltfhelper.h +++ b/indra/newview/lltinygltfhelper.h @@ -43,10 +43,12 @@ namespace LLTinyGLTFHelper LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index); + S32 getMaterialCountFromFile(const std::string& filename); + bool getMaterialFromFile( const std::string& filename, S32 mat_index, - LLPointer < LLFetchedGLTFMaterial> material, + LLFetchedGLTFMaterial* material, std::string& material_name); void initFetchedTextures(tinygltf::Material& material, diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 5fb83bf08e..80ba54ab6c 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -823,15 +823,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) LLViewerMediaFocus::getInstance()->clearHover(); } - static LLCachedControl<bool> enable_highlight( - gSavedSettings, "RenderHoverGlowEnable", false); - LLDrawable* drawable = NULL; - if (enable_highlight && show_highlight && object) - { - drawable = object->mDrawable; - } - gPipeline.setHighlightObject(drawable); - return TRUE; } diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 3eb9f9eda2..f86c1405a7 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -34,7 +34,6 @@ #include "lluuid.h" #include "llvorbisencode.h" #include "lluploaddialog.h" -#include "llpreviewscript.h" #include "llnotificationsutil.h" #include "llagent.h" #include "llfloaterreg.h" @@ -568,12 +567,14 @@ LLNewBufferedResourceUploadInfo::LLNewBufferedResourceUploadInfo( U32 everyonePerms, S32 expectedCost, bool show_inventory, - uploadFinish_f finish) + uploadFinish_f finish, + uploadFailure_f failure) : LLResourceUploadInfo(name, description, compressionInfo, destinationType, inventoryType, nextOWnerPerms, groupPerms, everyonePerms, expectedCost, show_inventory) , mBuffer(buffer) , mFinishFn(finish) + , mFailureFn(failure) { setAssetType(assetType); setAssetId(asset_id); @@ -614,8 +615,18 @@ LLUUID LLNewBufferedResourceUploadInfo::finishUpload(LLSD &result) return newItemId; } +bool LLNewBufferedResourceUploadInfo::failedUpload(LLSD &result, std::string &reason) +{ + if (mFailureFn) + { + return mFailureFn(getAssetId(), result, reason); + } + + return false; // Not handled +} + //========================================================================= -LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish) : +LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed) : LLResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, 0, 0, 0), mTaskUpload(false), @@ -623,6 +634,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType: mContents(buffer), mInvnFinishFn(finish), mTaskFinishFn(nullptr), + mFailureFn(failed), mStoredToCache(false) { setItemId(itemId); @@ -637,6 +649,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer<LL mContents(), mInvnFinishFn(finish), mTaskFinishFn(nullptr), + mFailureFn(nullptr), mStoredToCache(false) { setItemId(itemId); @@ -663,7 +676,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer<LL mContents.assign((char *)image->getData(), imageSize); } -LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish) : +LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed) : LLResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, 0, 0, 0), mTaskUpload(true), @@ -671,6 +684,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemI mContents(buffer), mInvnFinishFn(nullptr), mTaskFinishFn(finish), + mFailureFn(failed), mStoredToCache(false) { setItemId(itemId); @@ -760,10 +774,19 @@ LLUUID LLBufferedAssetUploadInfo::finishUpload(LLSD &result) return newAssetId; } +bool LLBufferedAssetUploadInfo::failedUpload(LLSD &result, std::string &reason) +{ + if (mFailureFn) + { + return mFailureFn(getItemId(), getTaskId(), result, reason); + } + return false; +} + //========================================================================= -LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish): - LLBufferedAssetUploadInfo(itemId, LLAssetType::AT_LSL_TEXT, buffer, finish), +LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed): + LLBufferedAssetUploadInfo(itemId, LLAssetType::AT_LSL_TEXT, buffer, finish, failed), mExerienceId(), mTargetType(LSL2), mIsRunning(false) @@ -771,8 +794,8 @@ LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invn } LLScriptAssetUpload::LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType, - bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish): - LLBufferedAssetUploadInfo(taskId, itemId, LLAssetType::AT_LSL_TEXT, buffer, finish), + bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed): + LLBufferedAssetUploadInfo(taskId, itemId, LLAssetType::AT_LSL_TEXT, buffer, finish, failed), mExerienceId(exerienceId), mTargetType(targetType), mIsRunning(isRunning) @@ -986,19 +1009,15 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res LLNotificationsUtil::add(label, args); - // unfreeze script preview - if (uploadInfo->getAssetType() == LLAssetType::AT_LSL_TEXT) + if (uploadInfo->failedUpload(result, reason)) { - LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", - uploadInfo->getItemId()); - if (preview) - { - LLSD errors; - errors.append(LLTrans::getString("UploadFailed") + reason); - preview->callbackLSLCompileFailed(errors); - } + // no further action required, already handled by a callback + // ex: do not trigger snapshot floater when failing material texture + return; } + // Todo: move these floater specific actions into proper callbacks + // Let the Snapshot floater know we have failed uploading. LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); if (floater_snapshot && floater_snapshot->isWaitingState()) diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 9eddcfbd0e..7f7707f5bb 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -64,6 +64,9 @@ public: virtual void logPreparedUpload(); virtual LLUUID finishUpload(LLSD &result); + // return true if no further action is need + virtual bool failedUpload(LLSD &result, std::string &reason) { return false; } + LLTransactionID getTransactionId() const { return mTransactionId; } LLAssetType::EType getAssetType() const { return mAssetType; } std::string getAssetTypeString() const; @@ -173,6 +176,7 @@ class LLNewBufferedResourceUploadInfo : public LLResourceUploadInfo { public: typedef std::function<void(LLUUID newAssetId, LLSD response)> uploadFinish_f; + typedef std::function<bool(LLUUID assetId, LLSD response, std::string reason)> uploadFailure_f; LLNewBufferedResourceUploadInfo( const std::string& buffer, @@ -188,7 +192,8 @@ public: U32 everyonePerms, S32 expectedCost, bool show_inventory, - uploadFinish_f finish); + uploadFinish_f finish, + uploadFailure_f failure); virtual LLSD prepareUpload(); @@ -196,9 +201,11 @@ protected: virtual LLSD exportTempFile(); virtual LLUUID finishUpload(LLSD &result); + virtual bool failedUpload(LLSD &result, std::string &reason); private: uploadFinish_f mFinishFn; + uploadFailure_f mFailureFn; std::string mBuffer; }; @@ -208,14 +215,16 @@ class LLBufferedAssetUploadInfo : public LLResourceUploadInfo public: typedef std::function<void(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response)> invnUploadFinish_f; typedef std::function<void(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response)> taskUploadFinish_f; + typedef std::function<bool(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason)> uploadFailed_f; - LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish); + LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed); LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer<LLImageFormatted> image, invnUploadFinish_f finish); - LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish); + LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed); virtual LLSD prepareUpload(); virtual LLSD generatePostBody(); virtual LLUUID finishUpload(LLSD &result); + virtual bool failedUpload(LLSD &result, std::string &reason); LLUUID getTaskId() const { return mTaskId; } const std::string & getContents() const { return mContents; } @@ -232,6 +241,7 @@ private: std::string mContents; invnUploadFinish_f mInvnFinishFn; taskUploadFinish_f mTaskFinishFn; + uploadFailed_f mFailureFn; bool mStoredToCache; }; @@ -245,9 +255,9 @@ public: MONO }; - LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish); + LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed); LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType, - bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish); + bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed); virtual LLSD generatePostBody(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0c9324cc42..534f3413b3 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -724,6 +724,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderResolutionDivisor", handleRenderResolutionDivisorChanged); // DEPRECATED - setting_setup_signal_listener(gSavedSettings, "RenderDeferred", handleRenderDeferredChanged); setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeDetail", handleReflectionProbeDetailChanged); + setting_setup_signal_listener(gSavedSettings, "RenderReflectionsEnabled", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderShadowDetail", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderDeferredSSAO", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderPerformanceTest", handleRenderPerfTestChanged); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 40857b732c..1b2f07515a 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -742,18 +742,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT); } - LLGLState::checkStates(); - - //if (!for_snapshot) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 3") - LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); - gPipeline.generateHighlight(*LLViewerCamera::getInstance()); - gPipeline.renderPhysicsDisplay(); - } - - LLGLState::checkStates(); - ////////////////////////////////////// // // Update images, using the image stats generated during object update/culling diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index c028a663ea..33c7240fe0 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -38,6 +38,7 @@ #include "llfloatermap.h" #include "llfloatermodelpreview.h" #include "llmaterialeditor.h" +#include "llfloaterperms.h" #include "llfloatersnapshot.h" #include "llfloateroutfitsnapshot.h" #include "llimage.h" @@ -49,9 +50,9 @@ #include "llinventorymodel.h" // gInventory #include "llpluginclassmedia.h" #include "llresourcedata.h" -#include "lltoast.h" -#include "llfloaterperms.h" #include "llstatusbar.h" +#include "lltinygltfhelper.h" +#include "lltoast.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewertexturelist.h" #include "lluictrlfactory.h" @@ -471,19 +472,33 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost)) { - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( - filename, - asset_name, - asset_name, 0, - LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms("Uploads"), - LLFloaterPerms::getGroupPerms("Uploads"), - LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost)); + LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + filename, + asset_name, + asset_name, 0, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost)); + + upload_new_resource(uploadInfo); + } - upload_new_resource(uploadInfo); - } -} + // gltf does not use normal upload procedure + if (ext == "gltf" || ext == "glb") + { + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + for (S32 i = 0; i < materials_in_file; i++) + { + // Todo: + // 1. Decouple bulk upload from material editor + // 2. Take into account possiblity of identical textures + LLMaterialEditor::uploadMaterialFromFile(filename, i); + } + } + } } bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S32& total_cost, S32& file_count, S32& bvh_count) @@ -511,6 +526,44 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3 total_cost += cost; file_count++; } + + if (ext == "gltf" || ext == "glb") + { + S32 texture_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + for (S32 i = 0; i < materials_in_file; i++) + { + LLPointer<LLFetchedGLTFMaterial> material = new LLFetchedGLTFMaterial(); + std::string material_name; + bool decode_successful = LLTinyGLTFHelper::getMaterialFromFile(filename, i, material.get(), material_name); + + if (decode_successful) + { + // Todo: make it account for possibility of same texture in different + // materials and even in scope of same material + S32 texture_count = 0; + if (material->mBaseColorId.notNull()) + { + texture_count++; + } + if (material->mMetallicRoughnessId.notNull()) + { + texture_count++; + } + if (material->mNormalId.notNull()) + { + texture_count++; + } + if (material->mEmissiveId.notNull()) + { + texture_count++; + } + total_cost += texture_count * texture_upload_cost; + file_count++; + } + } + } } return file_count > 0; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 9e2d28f29e..408e60595c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -74,7 +74,7 @@ LLVector4 gShinyOrigin; LLGLSLShader gOcclusionProgram; LLGLSLShader gSkinnedOcclusionProgram; LLGLSLShader gOcclusionCubeProgram; -LLGLSLShader gCustomAlphaProgram; +LLGLSLShader gCustomAlphaProgram; // SL-14113 This used to be used for the stars with Atmospheric Shaders: OFF LLGLSLShader gGlowCombineProgram; LLGLSLShader gSplatTextureRectProgram; LLGLSLShader gReflectionMipProgram; @@ -143,6 +143,8 @@ LLGLSLShader gObjectAlphaMaskNoColorProgram; LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; //environment shaders +LLGLSLShader gMoonProgram; +LLGLSLShader gStarsProgram; LLGLSLShader gTerrainProgram; LLGLSLShader gTerrainWaterProgram; LLGLSLShader gWaterProgram; @@ -232,8 +234,11 @@ LLGLSLShader gDeferredSkinnedAlphaWaterProgram; LLGLSLShader gDeferredAvatarEyesProgram; LLGLSLShader gDeferredFullbrightProgram; LLGLSLShader gDeferredFullbrightAlphaMaskProgram; +LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram; LLGLSLShader gDeferredFullbrightWaterProgram; LLGLSLShader gDeferredSkinnedFullbrightWaterProgram; +LLGLSLShader gDeferredFullbrightWaterAlphaProgram; +LLGLSLShader gDeferredSkinnedFullbrightWaterAlphaProgram; LLGLSLShader gDeferredFullbrightAlphaMaskWaterProgram; LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskWaterProgram; LLGLSLShader gDeferredEmissiveProgram; @@ -253,6 +258,7 @@ LLGLSLShader gDeferredFullbrightShinyProgram; LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; LLGLSLShader gDeferredSkinnedFullbrightProgram; LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskProgram; +LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskAlphaProgram; LLGLSLShader gNormalMapGenProgram; LLGLSLShader gDeferredGenBrdfLutProgram; @@ -353,14 +359,18 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredSkinnedAlphaWaterProgram); mShaderList.push_back(&gDeferredFullbrightProgram); mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram); + mShaderList.push_back(&gDeferredFullbrightAlphaMaskAlphaProgram); mShaderList.push_back(&gDeferredFullbrightWaterProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightWaterProgram); + mShaderList.push_back(&gDeferredFullbrightWaterAlphaProgram); + mShaderList.push_back(&gDeferredSkinnedFullbrightWaterAlphaProgram); mShaderList.push_back(&gDeferredFullbrightAlphaMaskWaterProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskWaterProgram); mShaderList.push_back(&gDeferredFullbrightShinyProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightShinyProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskProgram); + mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskAlphaProgram); mShaderList.push_back(&gDeferredEmissiveProgram); mShaderList.push_back(&gDeferredSkinnedEmissiveProgram); mShaderList.push_back(&gDeferredAvatarEyesProgram); @@ -753,6 +763,9 @@ void LLViewerShaderMgr::unloadShaders() gWaterProgram.unload(); gWaterEdgeProgram.unload(); gUnderWaterProgram.unload(); + + gMoonProgram.unload(); + gStarsProgram.unload(); gTerrainProgram.unload(); gTerrainWaterProgram.unload(); gGlowProgram.unload(); @@ -899,7 +912,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() ch = llmax(LLGLSLShader::sIndexedTextureChannels, 1); } - bool has_reflection_probes = gSavedSettings.getS32("RenderReflectionProbeDetail") >= 0 && gGLManager.mGLVersion > 3.99f; + bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f; std::vector<S32> index_channels; index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) ); @@ -986,6 +999,34 @@ BOOL LLViewerShaderMgr::loadShadersEnvironment() llassert(success); } + if (success) + { + gStarsProgram.mName = "Environment Stars Shader"; + gStarsProgram.mShaderFiles.clear(); + gStarsProgram.mShaderFiles.push_back(make_pair("environment/starsV.glsl", GL_VERTEX_SHADER_ARB)); + gStarsProgram.mShaderFiles.push_back(make_pair("environment/starsF.glsl", GL_FRAGMENT_SHADER_ARB)); + gStarsProgram.mShaderLevel = mShaderLevel[SHADER_ENVIRONMENT]; + gStarsProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113 + success = gStarsProgram.createShader(NULL, NULL); + llassert(success); + } + + if (success) + { + gMoonProgram.mName = "Environment Moon Shader"; + gMoonProgram.mShaderFiles.clear(); + gMoonProgram.mShaderFiles.push_back(make_pair("environment/moonV.glsl", GL_VERTEX_SHADER_ARB)); + gMoonProgram.mShaderFiles.push_back(make_pair("environment/moonF.glsl", GL_FRAGMENT_SHADER_ARB)); + gMoonProgram.mShaderLevel = mShaderLevel[SHADER_ENVIRONMENT]; + gMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 + success = gMoonProgram.createShader(NULL, NULL); + if (success) + { + gMoonProgram.bind(); + gMoonProgram.uniform1i(sTex0, 0); + } + } + if (!success) { mShaderLevel[SHADER_ENVIRONMENT] = 0; @@ -1240,8 +1281,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedAlphaWaterProgram.unload(); gDeferredFullbrightProgram.unload(); gDeferredFullbrightAlphaMaskProgram.unload(); + gDeferredFullbrightAlphaMaskAlphaProgram.unload(); gDeferredFullbrightWaterProgram.unload(); gDeferredSkinnedFullbrightWaterProgram.unload(); + gDeferredFullbrightWaterAlphaProgram.unload(); + gDeferredSkinnedFullbrightWaterAlphaProgram.unload(); gDeferredFullbrightAlphaMaskWaterProgram.unload(); gDeferredSkinnedFullbrightAlphaMaskWaterProgram.unload(); gDeferredEmissiveProgram.unload(); @@ -1263,6 +1307,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedFullbrightShinyProgram.unload(); gDeferredSkinnedFullbrightProgram.unload(); gDeferredSkinnedFullbrightAlphaMaskProgram.unload(); + gDeferredSkinnedFullbrightAlphaMaskAlphaProgram.unload(); gDeferredHighlightProgram.unload(); gDeferredHighlightNormalProgram.unload(); @@ -2180,6 +2225,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightAlphaMaskProgram.mShaderFiles.clear(); gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); + gDeferredFullbrightAlphaMaskProgram.clearPermutations(); gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1"); gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredFullbrightAlphaMaskProgram, gDeferredSkinnedFullbrightAlphaMaskProgram); @@ -2187,6 +2233,27 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gDeferredFullbrightAlphaMaskAlphaProgram.mName = "Deferred Fullbright Alpha Masking Alpha Shader"; + gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.calculatesAtmospherics = true; + gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.hasGamma = true; + gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.hasTransport = true; + gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.hasSrgb = true; + gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.isDeferred = true; + gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; + gDeferredFullbrightAlphaMaskAlphaProgram.mShaderFiles.clear(); + gDeferredFullbrightAlphaMaskAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); + gDeferredFullbrightAlphaMaskAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); + gDeferredFullbrightAlphaMaskAlphaProgram.clearPermutations(); + gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1"); + gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1"); + gDeferredFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = make_rigged_variant(gDeferredFullbrightAlphaMaskAlphaProgram, gDeferredSkinnedFullbrightAlphaMaskAlphaProgram); + success = success && gDeferredFullbrightAlphaMaskAlphaProgram.createShader(NULL, NULL); + llassert(success); + } + if (success) { gDeferredFullbrightWaterProgram.mName = "Deferred Fullbright Underwater Shader"; @@ -2207,6 +2274,29 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gDeferredFullbrightWaterAlphaProgram.mName = "Deferred Fullbright Underwater Alpha Shader"; + gDeferredFullbrightWaterAlphaProgram.mFeatures.calculatesAtmospherics = true; + gDeferredFullbrightWaterAlphaProgram.mFeatures.hasGamma = true; + gDeferredFullbrightWaterAlphaProgram.mFeatures.hasTransport = true; + gDeferredFullbrightWaterAlphaProgram.mFeatures.hasWaterFog = true; + gDeferredFullbrightWaterAlphaProgram.mFeatures.hasSrgb = true; + gDeferredFullbrightWaterAlphaProgram.mFeatures.isDeferred = true; + gDeferredFullbrightWaterAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; + gDeferredFullbrightWaterAlphaProgram.mShaderFiles.clear(); + gDeferredFullbrightWaterAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); + gDeferredFullbrightWaterAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); + gDeferredFullbrightWaterAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gDeferredFullbrightWaterAlphaProgram.mShaderGroup = LLGLSLShader::SG_WATER; + gDeferredFullbrightWaterAlphaProgram.clearPermutations(); + gDeferredFullbrightWaterAlphaProgram.addPermutation("WATER_FOG", "1"); + gDeferredFullbrightWaterAlphaProgram.addPermutation("IS_ALPHA", "1"); + success = make_rigged_variant(gDeferredFullbrightWaterAlphaProgram, gDeferredSkinnedFullbrightWaterAlphaProgram); + success = success && gDeferredFullbrightWaterAlphaProgram.createShader(NULL, NULL); + llassert(success); + } + if (success) { gDeferredFullbrightAlphaMaskWaterProgram.mName = "Deferred Fullbright Underwater Alpha Masking Shader"; @@ -2801,6 +2891,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER)); gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; + gDeferredWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 success = gDeferredWLCloudProgram.createShader(NULL, NULL); llassert(success); } @@ -2840,6 +2931,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLMoonProgram.mShaderFiles.push_back(make_pair("deferred/moonF.glsl", GL_FRAGMENT_SHADER)); gDeferredWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY; + gDeferredWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 success = gDeferredWLMoonProgram.createShader(NULL, NULL); llassert(success); } @@ -2852,6 +2944,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER)); gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY; + gDeferredStarProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113 success = gDeferredStarProgram.createShader(NULL, NULL); llassert(success); } @@ -3901,6 +3994,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER)); gWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; gWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; + gWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 success = gWLCloudProgram.createShader(NULL, NULL); } @@ -3937,6 +4031,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonF.glsl", GL_FRAGMENT_SHADER)); gWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY; + gWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 success = gWLMoonProgram.createShader(NULL, NULL); } #endif diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 4ed6b02728..a53706e96a 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -211,6 +211,8 @@ extern LLGLSLShader gObjectShinyProgram; extern LLGLSLShader gObjectShinyWaterProgram; //environment shaders +extern LLGLSLShader gMoonProgram; +extern LLGLSLShader gStarsProgram; extern LLGLSLShader gTerrainProgram; extern LLGLSLShader gTerrainWaterProgram; extern LLGLSLShader gWaterProgram; @@ -292,8 +294,10 @@ extern LLGLSLShader gDeferredAlphaProgram; extern LLGLSLShader gDeferredAlphaImpostorProgram; extern LLGLSLShader gDeferredFullbrightProgram; extern LLGLSLShader gDeferredFullbrightAlphaMaskProgram; +extern LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram; extern LLGLSLShader gDeferredAlphaWaterProgram; extern LLGLSLShader gDeferredFullbrightWaterProgram; +extern LLGLSLShader gDeferredFullbrightWaterAlphaProgram; extern LLGLSLShader gDeferredFullbrightAlphaMaskWaterProgram; extern LLGLSLShader gDeferredEmissiveProgram; extern LLGLSLShader gDeferredAvatarEyesProgram; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 32fb7c13a9..ee39b7d02f 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -65,6 +65,53 @@ #include "llinventorymodel.h" #include "lluiusage.h" +// "Minimal Vulkan" to get max API Version + +// Calls + #if defined(_WIN32) + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL + #else + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR + #endif // _WIN32 + +// Macros + // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + // |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| + // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + // <variant> <-------major-------><-----------minor-----------> <--------------patch--------------> + // 0x7 0x7F 0x3FF 0xFFF + #define VK_API_VERSION_MAJOR( version) (((uint32_t)(version) >> 22) & 0x07FU) // 7 bits + #define VK_API_VERSION_MINOR( version) (((uint32_t)(version) >> 12) & 0x3FFU) // 10 bits + #define VK_API_VERSION_PATCH( version) (((uint32_t)(version) ) & 0xFFFU) // 12 bits + #define VK_API_VERSION_VARIANT(version) (((uint32_t)(version) >> 29) & 0x007U) // 3 bits + + // NOTE: variant is first parameter! This is to match vulkan/vulkan_core.h + #define VK_MAKE_API_VERSION(variant, major, minor, patch) (0\ + | (((uint32_t)(major & 0x07FU)) << 22) \ + | (((uint32_t)(minor & 0x3FFU)) << 12) \ + | (((uint32_t)(patch & 0xFFFU)) ) \ + | (((uint32_t)(variant & 0x007U)) << 29) ) + + #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +// Types + VK_DEFINE_HANDLE(VkInstance); + + typedef enum VkResult + { + VK_SUCCESS = 0, + VK_RESULT_MAX_ENUM = 0x7FFFFFFF + } VkResult; + +// Prototypes + typedef void (VKAPI_PTR *PFN_vkVoidFunction )(void); + typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr )(VkInstance instance, const char* pName); + typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceVersion)(uint32_t* pApiVersion); + namespace LLStatViewer { @@ -592,19 +639,76 @@ void send_viewer_stats(bool include_preferences) // detailed information on versions and extensions can come later. static bool vulkan_oneshot = false; static bool vulkan_detected = false; + static std::string vulkan_max_api_version( "0.0" ); // Unknown/None if (!vulkan_oneshot) { - HMODULE vulkan_loader = LoadLibraryExA("vulkan-1.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); + // The 32-bit and 64-bit versions normally exist in: + // C:\Windows\System32 + // C:\Windows\SysWOW64 + HMODULE vulkan_loader = LoadLibraryA("vulkan-1.dll"); if (NULL != vulkan_loader) { vulkan_detected = true; + vulkan_max_api_version = "1.0"; // We have at least 1.0. See the note about vkEnumerateInstanceVersion() below. + + // We use Run-Time Dynamic Linking (via GetProcAddress()) instead of Load-Time Dynamic Linking (via directly calling vkGetInstanceProcAddr()). + // This allows us to: + // a) not need the header: #include <vulkan/vulkan.h> + // (and not need to set the corresponding "Additional Include Directories" as long as we provide the equivalent Vulkan types/prototypes/etc.) + // b) not need to link to: vulkan-1.lib + // (and not need to set the corresponding "Additional Library Directories") + // The former will allow Second Life to start and run even if the vulkan.dll is missing. + // The latter will require us to: + // a) link with vulkan-1.lib + // b) cause a System Error at startup if the .dll is not found: + // "The code execution cannot proceed because vulkan-1.dll was not found." + // + // See: + // https://docs.microsoft.com/en-us/windows/win32/dlls/using-run-time-dynamic-linking + // https://docs.microsoft.com/en-us/windows/win32/dlls/run-time-dynamic-linking + + // NOTE: Technically we can use GetProcAddress() as a replacement for vkGetInstanceProcAddr() + // but the canonical recommendation (mandate?) is to use vkGetInstanceProcAddr(). + PFN_vkGetInstanceProcAddr pGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) GetProcAddress(vulkan_loader, "vkGetInstanceProcAddr"); + if(pGetInstanceProcAddr) + { + // Check for vkEnumerateInstanceVersion. If it exists then we have at least 1.1 and can query the max API version. + // NOTE: Each VkPhysicalDevice that supports Vulkan has its own VkPhysicalDeviceProperties.apiVersion which is separate from the max API version! + // See: https://www.lunarg.com/wp-content/uploads/2019/02/Vulkan-1.1-Compatibility-Statement_01_19.pdf + PFN_vkEnumerateInstanceVersion pEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) pGetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion"); + if(pEnumerateInstanceVersion) + { + uint32_t version = VK_MAKE_API_VERSION(0,1,1,0); // e.g. 4202631 = 1.2.135.0 + VkResult status = pEnumerateInstanceVersion( &version ); + if (status != VK_SUCCESS) + { + LL_INFOS("Vulkan") << "Failed to get Vulkan version. Assuming 1.0" << LL_ENDL; + } + else + { + // https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-coreversions-versionnumbers + int major = VK_API_VERSION_MAJOR ( version ); + int minor = VK_API_VERSION_MINOR ( version ); + int patch = VK_API_VERSION_PATCH ( version ); + int variant = VK_API_VERSION_VARIANT( version ); + + vulkan_max_api_version = llformat( "%d.%d.%d.%d", major, minor, patch, variant ); + LL_INFOS("Vulkan") << "Vulkan API version: " << vulkan_max_api_version << ", Raw version: " << version << LL_ENDL; + } + } + } + else + { + LL_WARNS("Vulkan") << "FAILED to get Vulkan vkGetInstanceProcAddr()!" << LL_ENDL; + } FreeLibrary(vulkan_loader); } vulkan_oneshot = true; } misc["string_1"] = vulkan_detected ? llformat("Vulkan driver is detected") : llformat("No Vulkan driver detected"); + misc["VulkanMaxApiVersion"] = vulkan_max_api_version; #else misc["string_1"] = llformat("Unused"); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 338aac2ccc..674c387430 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -45,6 +45,7 @@ #include "llxmltree.h" #include "message.h" +#include "lldrawpoolbump.h" // to init bumpmap images #include "lltexturecache.h" #include "lltexturefetch.h" #include "llviewercontrol.h" @@ -135,9 +136,6 @@ void LLViewerTextureList::doPreloadImages() //uv_test->setClamp(FALSE, FALSE); //uv_test->setMipFilterNearest(TRUE, TRUE); - // prefetch specific UUIDs - LLViewerTextureManager::getFetchedTexture(IMG_SHOT); - LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF); LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { @@ -206,13 +204,26 @@ void LLViewerTextureList::doPrefetchImages() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, FTT_DEFAULT, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); - if (imagep) + // todo: do not load without getViewerAssetUrl() + // either fail login without caps or provide this + // in some other way, textures won't load otherwise + LLViewerFetchedTexture *imagep = findImage(DEFAULT_WATER_NORMAL, TEX_LIST_STANDARD); + if (!imagep) { - imagep->setAddressMode(LLTexUnit::TAM_WRAP); - mImagePreloads.insert(imagep); + // add it to mImagePreloads only once + imagep = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, FTT_DEFAULT, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); + if (imagep) + { + imagep->setAddressMode(LLTexUnit::TAM_WRAP); + mImagePreloads.insert(imagep); + } } + LLViewerTextureManager::getFetchedTexture(IMG_SHOT); + LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF); + + LLStandardBumpmap::addstandard(); + if (LLAppViewer::instance()->getPurgeCache()) { // cache was purged, no point diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 5adc057484..d5979b2280 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -525,11 +525,6 @@ void LLVOSky::calc() void LLVOSky::initCubeMap() { - if (LLPipeline::sReflectionProbesEnabled) - { - return; - } - std::vector<LLPointer<LLImageRaw> > images; for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++) { @@ -697,7 +692,7 @@ bool LLVOSky::updateSky() LLHeavenBody::setInterpVal( mInterpVal ); updateDirections(psky); - if (!mCubeMap) + if (!mCubeMap || LLPipeline::sReflectionProbesEnabled) { mCubeMapUpdateStage = NUM_CUBEMAP_FACES; mForceUpdate = FALSE; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0f348e4bc4..0ca9d2d12b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -410,7 +410,7 @@ void LLPipeline::init() sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); - mInitialized = true; + mInitialized = true; stop_glerror(); @@ -659,6 +659,8 @@ void LLPipeline::cleanup() mDeferredVB = NULL; mCubeVB = NULL; + + mReflectionMapManager.cleanup(); } //============================================================================ @@ -723,17 +725,6 @@ void LLPipeline::resizeScreenTexture() } } -void LLPipeline::allocatePhysicsBuffer() -{ - GLuint resX = gViewerWindow->getWorldViewWidthRaw(); - GLuint resY = gViewerWindow->getWorldViewHeightRaw(); - - if (mPhysicsDisplay.getWidth() != resX || mPhysicsDisplay.getHeight() != resY) - { - mPhysicsDisplay.allocate(resX, resY, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_TEXTURE, FALSE); - } -} - bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; @@ -1017,8 +1008,6 @@ void LLPipeline::updateRenderBump() void LLPipeline::updateRenderDeferred() { sRenderPBR = sRenderDeferred; - static LLCachedControl<S32> sProbeDetail(gSavedSettings, "RenderReflectionProbeDetail", -1); - sReflectionProbesEnabled = sProbeDetail >= 0 && gGLManager.mGLVersion > 3.99f; } // static @@ -1110,7 +1099,9 @@ void LLPipeline::refreshCachedSettings() CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale"); RenderAutoHideSurfaceAreaLimit = gSavedSettings.getF32("RenderAutoHideSurfaceAreaLimit"); RenderScreenSpaceReflections = gSavedSettings.getBOOL("RenderScreenSpaceReflections"); + sReflectionProbesEnabled = gSavedSettings.getBOOL("RenderReflectionsEnabled"); RenderSpotLight = nullptr; + updateRenderDeferred(); if (gNonInteractive) @@ -1141,7 +1132,6 @@ void LLPipeline::releaseGLBuffers() mWaterRef.release(); mWaterDis.release(); mBake.release(); - mHighlight.release(); for (U32 i = 0; i < 3; i++) { @@ -1176,7 +1166,6 @@ void LLPipeline::releaseScreenBuffers() mRT->uiScreen.release(); mRT->screen.release(); mRT->fxaaBuffer.release(); - mPhysicsDisplay.release(); mRT->deferredScreen.release(); mRT->deferredDepth.release(); mRT->deferredLight.release(); @@ -1227,8 +1216,6 @@ void LLPipeline::createGLBuffers() // Use FBO for bake tex mBake.allocate(512, 512, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_TEXTURE, true); // SL-12781 Build > Upload > Model; 3D Preview - mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE); - stop_glerror(); GLuint resX = gViewerWindow->getWorldViewWidthRaw(); @@ -1760,14 +1747,6 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) } } - HighlightItem item(drawablep); - mHighlightSet.erase(item); - - if (mHighlightObject == drawablep) - { - mHighlightObject = NULL; - } - for (U32 i = 0; i < 2; ++i) { if (mShadowSpotLight[i] == drawablep) @@ -3585,166 +3564,161 @@ void renderScriptedBeacons(LLDrawable* drawablep) } } -void renderScriptedTouchBeacons(LLDrawable* drawablep) +void renderScriptedTouchBeacons(LLDrawable *drawablep) { - LLViewerObject *vobj = drawablep->getVObj(); - if (vobj - && !vobj->isAvatar() - && !vobj->getParent() - && vobj->flagScripted() - && vobj->flagHandleTouch()) - { - if (gPipeline.sRenderBeacons) - { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); - } + LLViewerObject *vobj = drawablep->getVObj(); + if (vobj && !vobj->isAvatar() && !vobj->getParent() && vobj->flagScripted() && vobj->flagHandleTouch()) + { + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), + LLPipeline::DebugBeaconLineWidth); + } - if (gPipeline.sRenderHighlight) - { - S32 face_id; - S32 count = drawablep->getNumFaces(); - for (face_id = 0; face_id < count; face_id++) - { - LLFace * facep = drawablep->getFace(face_id); - if (facep) - { - gPipeline.mHighlightFaces.push_back(facep); - } - } - } -} + if (gPipeline.sRenderHighlight) + { + S32 face_id; + S32 count = drawablep->getNumFaces(); + for (face_id = 0; face_id < count; face_id++) + { + LLFace *facep = drawablep->getFace(face_id); + if (facep) + { + gPipeline.mHighlightFaces.push_back(facep); + } + } + } + } } -void renderPhysicalBeacons(LLDrawable* drawablep) +void renderPhysicalBeacons(LLDrawable *drawablep) { - LLViewerObject *vobj = drawablep->getVObj(); - if (vobj - && !vobj->isAvatar() - //&& !vobj->getParent() - && vobj->flagUsePhysics()) - { - if (gPipeline.sRenderBeacons) - { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); - } + LLViewerObject *vobj = drawablep->getVObj(); + if (vobj && + !vobj->isAvatar() + //&& !vobj->getParent() + && vobj->flagUsePhysics()) + { + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), + LLPipeline::DebugBeaconLineWidth); + } - if (gPipeline.sRenderHighlight) - { - S32 face_id; - S32 count = drawablep->getNumFaces(); - for (face_id = 0; face_id < count; face_id++) - { - LLFace * facep = drawablep->getFace(face_id); - if (facep) - { - gPipeline.mHighlightFaces.push_back(facep); - } - } - } -} + if (gPipeline.sRenderHighlight) + { + S32 face_id; + S32 count = drawablep->getNumFaces(); + for (face_id = 0; face_id < count; face_id++) + { + LLFace *facep = drawablep->getFace(face_id); + if (facep) + { + gPipeline.mHighlightFaces.push_back(facep); + } + } + } + } } -void renderMOAPBeacons(LLDrawable* drawablep) +void renderMOAPBeacons(LLDrawable *drawablep) { - LLViewerObject *vobj = drawablep->getVObj(); + LLViewerObject *vobj = drawablep->getVObj(); - if(!vobj || vobj->isAvatar()) - return; + if (!vobj || vobj->isAvatar()) + return; - bool beacon=false; - U8 tecount=vobj->getNumTEs(); - for(int x=0;x<tecount;x++) - { - if(vobj->getTE(x)->hasMedia()) - { - beacon=true; - break; - } - } - if(beacon) - { - if (gPipeline.sRenderBeacons) - { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); - } + bool beacon = false; + U8 tecount = vobj->getNumTEs(); + for (int x = 0; x < tecount; x++) + { + if (vobj->getTE(x)->hasMedia()) + { + beacon = true; + break; + } + } + if (beacon) + { + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), + LLPipeline::DebugBeaconLineWidth); + } - if (gPipeline.sRenderHighlight) - { - S32 face_id; - S32 count = drawablep->getNumFaces(); - for (face_id = 0; face_id < count; face_id++) - { - LLFace * facep = drawablep->getFace(face_id); - if (facep) - { - gPipeline.mHighlightFaces.push_back(facep); - } - } - } -} + if (gPipeline.sRenderHighlight) + { + S32 face_id; + S32 count = drawablep->getNumFaces(); + for (face_id = 0; face_id < count; face_id++) + { + LLFace *facep = drawablep->getFace(face_id); + if (facep) + { + gPipeline.mHighlightFaces.push_back(facep); + } + } + } + } } -void renderParticleBeacons(LLDrawable* drawablep) +void renderParticleBeacons(LLDrawable *drawablep) { - // Look for attachments, objects, etc. - LLViewerObject *vobj = drawablep->getVObj(); - if (vobj - && vobj->isParticleSource()) - { - if (gPipeline.sRenderBeacons) - { - LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f); - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); - } + // Look for attachments, objects, etc. + LLViewerObject *vobj = drawablep->getVObj(); + if (vobj && vobj->isParticleSource()) + { + if (gPipeline.sRenderBeacons) + { + LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), + LLPipeline::DebugBeaconLineWidth); + } - if (gPipeline.sRenderHighlight) - { - S32 face_id; - S32 count = drawablep->getNumFaces(); - for (face_id = 0; face_id < count; face_id++) - { - LLFace * facep = drawablep->getFace(face_id); - if (facep) - { - gPipeline.mHighlightFaces.push_back(facep); - } - } - } -} + if (gPipeline.sRenderHighlight) + { + S32 face_id; + S32 count = drawablep->getNumFaces(); + for (face_id = 0; face_id < count; face_id++) + { + LLFace *facep = drawablep->getFace(face_id); + if (facep) + { + gPipeline.mHighlightFaces.push_back(facep); + } + } + } + } } -void renderSoundHighlights(LLDrawable* drawablep) +void renderSoundHighlights(LLDrawable *drawablep) { - // Look for attachments, objects, etc. - LLViewerObject *vobj = drawablep->getVObj(); - if (vobj && vobj->isAudioSource()) - { - if (gPipeline.sRenderHighlight) - { - S32 face_id; - S32 count = drawablep->getNumFaces(); - for (face_id = 0; face_id < count; face_id++) - { - LLFace * facep = drawablep->getFace(face_id); - if (facep) - { - gPipeline.mHighlightFaces.push_back(facep); - } - } - } -} + // Look for attachments, objects, etc. + LLViewerObject *vobj = drawablep->getVObj(); + if (vobj && vobj->isAudioSource()) + { + if (gPipeline.sRenderHighlight) + { + S32 face_id; + S32 count = drawablep->getNumFaces(); + for (face_id = 0; face_id < count; face_id++) + { + LLFace *facep = drawablep->getFace(face_id); + if (facep) + { + gPipeline.mHighlightFaces.push_back(facep); + } + } + } + } } void LLPipeline::touchTexture(LLViewerTexture* tex, F32 vsize) { if (tex) { - LLImageGL* gl_tex = tex->getGLTexture(); - if (gl_tex && gl_tex->updateBindStats()) - { - tex->setActive(); - tex->addTextureStats(vsize); - } + tex->setActive(); + tex->addTextureStats(vsize); } } @@ -3783,56 +3757,53 @@ void LLPipeline::touchTextures(LLDrawInfo* info) } } -void LLPipeline::postSort(LLCamera& camera) +void LLPipeline::postSort(LLCamera &camera) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - assertInitialized(); + assertInitialized(); - LL_PUSH_CALLSTACKS(); + LL_PUSH_CALLSTACKS(); if (!gCubeSnapshot) { - //rebuild drawable geometry + // rebuild drawable geometry for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i) { - LLSpatialGroup* group = *i; - if (!sUseOcclusion || - !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) + LLSpatialGroup *group = *i; + if (!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) { group->rebuildGeom(); } } LL_PUSH_CALLSTACKS(); - //rebuild groups + // rebuild groups sCull->assertDrawMapsEmpty(); rebuildPriorityGroups(); } - LL_PUSH_CALLSTACKS(); + LL_PUSH_CALLSTACKS(); - - //build render map - for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) - { - LLSpatialGroup* group = *i; - if ((sUseOcclusion && - group->isOcclusionState(LLSpatialGroup::OCCLUDED)) || - (RenderAutoHideSurfaceAreaLimit > 0.f && - group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit*llmax(group->mObjectBoxSize, 10.f))) - { - continue; - } + // build render map + for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) + { + LLSpatialGroup *group = *i; + if ((sUseOcclusion && group->isOcclusionState(LLSpatialGroup::OCCLUDED)) || + (RenderAutoHideSurfaceAreaLimit > 0.f && + group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit * llmax(group->mObjectBoxSize, 10.f))) + { + continue; + } - if (group->hasState(LLSpatialGroup::NEW_DRAWINFO) && group->hasState(LLSpatialGroup::GEOM_DIRTY) && !gCubeSnapshot) - { //no way this group is going to be drawable without a rebuild - group->rebuildGeom(); - } + if (group->hasState(LLSpatialGroup::NEW_DRAWINFO) && group->hasState(LLSpatialGroup::GEOM_DIRTY) && !gCubeSnapshot) + { // no way this group is going to be drawable without a rebuild + group->rebuildGeom(); + } for (LLSpatialGroup::draw_map_t::iterator j = group->mDrawMap.begin(); j != group->mDrawMap.end(); ++j) { - LLSpatialGroup::drawmap_elem_t& src_vec = j->second; + LLSpatialGroup::drawmap_elem_t &src_vec = j->second; if (!hasRenderType(j->first)) { continue; @@ -3862,7 +3833,7 @@ void LLPipeline::postSort(LLCamera& camera) for (LLSpatialGroup::drawmap_elem_t::iterator k = src_vec.begin(); k != src_vec.end(); ++k) { - LLDrawInfo* info = *k; + LLDrawInfo *info = *k; sCull->pushDrawInfo(j->first, info); if (!sShadowRender && !sReflectionRender && !gCubeSnapshot) @@ -3871,186 +3842,186 @@ void LLPipeline::postSort(LLCamera& camera) addTrianglesDrawn(info->mCount); } } - } + } - if (hasRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA)) - { - LLSpatialGroup::draw_map_t::iterator alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA); - - if (alpha != group->mDrawMap.end()) - { //store alpha groups for sorting - LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); - if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot) - { - if (bridge) - { - LLCamera trans_camera = bridge->transformCamera(camera); - group->updateDistance(trans_camera); - } - else - { - group->updateDistance(camera); - } - } - - if (hasRenderType(LLDrawPool::POOL_ALPHA)) - { - sCull->pushAlphaGroup(group); - } - } + if (hasRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA)) + { + LLSpatialGroup::draw_map_t::iterator alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA); + + if (alpha != group->mDrawMap.end()) + { // store alpha groups for sorting + LLSpatialBridge *bridge = group->getSpatialPartition()->asBridge(); + if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot) + { + if (bridge) + { + LLCamera trans_camera = bridge->transformCamera(camera); + group->updateDistance(trans_camera); + } + else + { + group->updateDistance(camera); + } + } + + if (hasRenderType(LLDrawPool::POOL_ALPHA)) + { + sCull->pushAlphaGroup(group); + } + } LLSpatialGroup::draw_map_t::iterator rigged_alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA_RIGGED); if (rigged_alpha != group->mDrawMap.end()) - { //store rigged alpha groups for LLDrawPoolAlpha prepass (skip distance update, rigged attachments use depth buffer) + { // store rigged alpha groups for LLDrawPoolAlpha prepass (skip distance update, rigged attachments use depth buffer) if (hasRenderType(LLDrawPool::POOL_ALPHA)) { sCull->pushRiggedAlphaGroup(group); } } - } - } - - //flush particle VB - if (LLVOPartGroup::sVB) - { - LLVOPartGroup::sVB->flush(); - } - else - { - LL_WARNS_ONCE() << "Missing particle buffer" << LL_ENDL; - } + } + } - /*bool use_transform_feedback = gTransformPositionProgram.mProgramObject && !mMeshDirtyGroup.empty(); + // flush particle VB + if (LLVOPartGroup::sVB) + { + LLVOPartGroup::sVB->flush(); + } + else + { + LL_WARNS_ONCE() << "Missing particle buffer" << LL_ENDL; + } - if (use_transform_feedback) - { //place a query around potential transform feedback code for synchronization - mTransformFeedbackPrimitives = 0; + /*bool use_transform_feedback = gTransformPositionProgram.mProgramObject && !mMeshDirtyGroup.empty(); - if (!mMeshDirtyQueryObject) - { - glGenQueries(1, &mMeshDirtyQueryObject); - } + if (use_transform_feedback) + { //place a query around potential transform feedback code for synchronization + mTransformFeedbackPrimitives = 0; - - glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject); - }*/ + if (!mMeshDirtyQueryObject) + { + glGenQueries(1, &mMeshDirtyQueryObject); + } - //pack vertex buffers for groups that chose to delay their updates - for (LLSpatialGroup::sg_vector_t::iterator iter = mMeshDirtyGroup.begin(); iter != mMeshDirtyGroup.end(); ++iter) - { - (*iter)->rebuildMesh(); - } - /*if (use_transform_feedback) - { - glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); - }*/ - - mMeshDirtyGroup.clear(); + glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject); + }*/ - if (!sShadowRender) - { + // pack vertex buffers for groups that chose to delay their updates + for (LLSpatialGroup::sg_vector_t::iterator iter = mMeshDirtyGroup.begin(); iter != mMeshDirtyGroup.end(); ++iter) + { + (*iter)->rebuildMesh(); + } + + /*if (use_transform_feedback) + { + glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); + }*/ + + mMeshDirtyGroup.clear(); + + if (!sShadowRender) + { // order alpha groups by distance - std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater()); + std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater()); // order rigged alpha groups by avatar attachment order std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder()); - } + } - LL_PUSH_CALLSTACKS(); - // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus - if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender && !gCubeSnapshot) - { - if (sRenderScriptedTouchBeacons) - { - // Only show the beacon on the root object. - forAllVisibleDrawables(renderScriptedTouchBeacons); - } - else - if (sRenderScriptedBeacons) - { - // Only show the beacon on the root object. - forAllVisibleDrawables(renderScriptedBeacons); - } + LL_PUSH_CALLSTACKS(); + // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus + if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender && !gCubeSnapshot) + { + if (sRenderScriptedTouchBeacons) + { + // Only show the beacon on the root object. + forAllVisibleDrawables(renderScriptedTouchBeacons); + } + else if (sRenderScriptedBeacons) + { + // Only show the beacon on the root object. + forAllVisibleDrawables(renderScriptedBeacons); + } - if (sRenderPhysicalBeacons) - { - // Only show the beacon on the root object. - forAllVisibleDrawables(renderPhysicalBeacons); - } + if (sRenderPhysicalBeacons) + { + // Only show the beacon on the root object. + forAllVisibleDrawables(renderPhysicalBeacons); + } - if(sRenderMOAPBeacons) - { - forAllVisibleDrawables(renderMOAPBeacons); - } + if (sRenderMOAPBeacons) + { + forAllVisibleDrawables(renderMOAPBeacons); + } - if (sRenderParticleBeacons) - { - forAllVisibleDrawables(renderParticleBeacons); - } + if (sRenderParticleBeacons) + { + forAllVisibleDrawables(renderParticleBeacons); + } - // If god mode, also show audio cues - if (sRenderSoundBeacons && gAudiop) - { - // Walk all sound sources and render out beacons for them. Note, this isn't done in the ForAllVisibleDrawables function, because some are not visible. - LLAudioEngine::source_map::iterator iter; - for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) - { - LLAudioSource *sourcep = iter->second; + // If god mode, also show audio cues + if (sRenderSoundBeacons && gAudiop) + { + // Walk all sound sources and render out beacons for them. Note, this isn't done in the ForAllVisibleDrawables function, because + // some are not visible. + LLAudioEngine::source_map::iterator iter; + for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) + { + LLAudioSource *sourcep = iter->second; - LLVector3d pos_global = sourcep->getPositionGlobal(); - LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global); - if (gPipeline.sRenderBeacons) - { - //pos += LLVector3(0.f, 0.f, 0.2f); - gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), DebugBeaconLineWidth); - } - } - // now deal with highlights for all those seeable sound sources - forAllVisibleDrawables(renderSoundHighlights); - } - } - LL_PUSH_CALLSTACKS(); - // If managing your telehub, draw beacons at telehub and currently selected spawnpoint. - if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot) - { - LLFloaterTelehub::addBeacons(); - } + LLVector3d pos_global = sourcep->getPositionGlobal(); + LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global); + if (gPipeline.sRenderBeacons) + { + // pos += LLVector3(0.f, 0.f, 0.2f); + gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), DebugBeaconLineWidth); + } + } + // now deal with highlights for all those seeable sound sources + forAllVisibleDrawables(renderSoundHighlights); + } + } + LL_PUSH_CALLSTACKS(); + // If managing your telehub, draw beacons at telehub and currently selected spawnpoint. + if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot) + { + LLFloaterTelehub::addBeacons(); + } - if (!sShadowRender && !gCubeSnapshot) - { - mSelectedFaces.clear(); + if (!sShadowRender && !gCubeSnapshot) + { + mSelectedFaces.clear(); - if (!gNonInteractive) - { - LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit()); - } + if (!gNonInteractive) + { + LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit()); + } - // Draw face highlights for selected faces. - if (LLSelectMgr::getInstance()->getTEMode()) - { - struct f : public LLSelectedTEFunctor - { - virtual bool apply(LLViewerObject* object, S32 te) - { - if (object->mDrawable) - { - LLFace * facep = object->mDrawable->getFace(te); - if (facep) - { - gPipeline.mSelectedFaces.push_back(facep); - } - } - return true; - } - } func; - LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); - } - } + // Draw face highlights for selected faces. + if (LLSelectMgr::getInstance()->getTEMode()) + { + struct f : public LLSelectedTEFunctor + { + virtual bool apply(LLViewerObject *object, S32 te) + { + if (object->mDrawable) + { + LLFace *facep = object->mDrawable->getFace(te); + if (facep) + { + gPipeline.mSelectedFaces.push_back(facep); + } + } + return true; + } + } func; + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + } + } - //LLSpatialGroup::sNoDelete = FALSE; - LL_PUSH_CALLSTACKS(); + // LLSpatialGroup::sNoDelete = FALSE; + LL_PUSH_CALLSTACKS(); } @@ -4111,107 +4082,6 @@ void LLPipeline::renderHighlights() LLGLEnable color_mat(GL_COLOR_MATERIAL); disableLights(); - if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD) && !mHighlightSet.empty()) - { //draw blurry highlight image over screen - LLGLEnable blend(GL_BLEND); - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); - LLGLDisable test(GL_ALPHA_TEST); - - //LLGLEnable stencil(GL_STENCIL_TEST); - gGL.flush(); - // stencil ops are deprecated - //glStencilMask(0xFFFFFFFF); - //glClearStencil(1); - //glClear(GL_STENCIL_BUFFER_BIT); - - //glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); - //glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - - gGL.setColorMask(false, false); - - gHighlightProgram.bind(); - - for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ++iter) - { - renderHighlight(iter->mItem->getVObj(), 1.f); - } - gGL.setColorMask(true, false); - - //glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // deprecated - //glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); - - //gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - - gGL.getTexUnit(0)->bind(&mHighlight); - - LLVector2 tc1; - LLVector2 tc2; - - tc1.setVec(0,0); - tc2.setVec(2,2); - - gGL.begin(LLRender::TRIANGLES); - - F32 scale = RenderHighlightBrightness; - LLColor4 color = RenderHighlightColor; - F32 thickness = RenderHighlightThickness; - - for (S32 pass = 0; pass < 2; ++pass) - { - if (pass == 0) - { - gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - } - else - { - gGL.setSceneBlendType(LLRender::BT_ALPHA); - } - - for (S32 i = 0; i < 8; ++i) - { - for (S32 j = 0; j < 8; ++j) - { - LLVector2 tc(i-4+0.5f, j-4+0.5f); - - F32 dist = 1.f-(tc.length()/sqrtf(32.f)); - dist *= scale/64.f; - - tc *= thickness; - tc.mV[0] = (tc.mV[0])/mHighlight.getWidth(); - tc.mV[1] = (tc.mV[1])/mHighlight.getHeight(); - - gGL.color4f(color.mV[0], - color.mV[1], - color.mV[2], - color.mV[3]*dist); - - gGL.texCoord2f(tc.mV[0]+tc1.mV[0], tc.mV[1]+tc2.mV[1]); - gGL.vertex2f(-1,3); - - gGL.texCoord2f(tc.mV[0]+tc1.mV[0], tc.mV[1]+tc1.mV[1]); - gGL.vertex2f(-1,-1); - - gGL.texCoord2f(tc.mV[0]+tc2.mV[0], tc.mV[1]+tc1.mV[1]); - gGL.vertex2f(3,-1); - } - } - } - - gGL.end(); - - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); - - //gGL.setSceneBlendType(LLRender::BT_ALPHA); - } - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { gHighlightProgram.bind(); @@ -4892,40 +4762,56 @@ void LLPipeline::renderPhysicsDisplay() return; } - allocatePhysicsBuffer(); + gGL.flush(); + gDebugProgram.bind(); - gGL.flush(); - mPhysicsDisplay.bindTarget(); - glClearColor(0,0,0,1); - gGL.setColorMask(true, true); - mPhysicsDisplay.clear(); - glClearColor(0,0,0,0); + LLGLEnable(GL_POLYGON_OFFSET_LINE); + glPolygonOffset(3.f, 3.f); + glLineWidth(3.f); + LLGLEnable blend(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_ALPHA); - gGL.setColorMask(true, false); + for (int pass = 0; pass < 3; ++pass) + { + // pass 0 - depth write enabled, color write disabled, fill + // pass 1 - depth write disabled, color write enabled, fill + // pass 2 - depth write disabled, color write enabled, wireframe + gGL.setColorMask(pass >= 1, false); + LLGLDepthTest depth(GL_TRUE, pass == 0); - gDebugProgram.bind(); + bool wireframe = (pass == 2); - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) - { - LLViewerRegion* region = *iter; - for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) - { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - if (hasRenderType(part->mDrawableType)) - { - part->renderPhysicsShapes(); - } - } - } - } + if (wireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } - gGL.flush(); + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + { + LLViewerRegion* region = *iter; + for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) + { + LLSpatialPartition* part = region->getSpatialPartition(i); + if (part) + { + if (hasRenderType(part->mDrawableType)) + { + part->renderPhysicsShapes(wireframe); + } + } + } + } + gGL.flush(); + if (wireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } + } + glLineWidth(1.f); gDebugProgram.unbind(); - mPhysicsDisplay.flush(); + } extern std::set<LLSpatialGroup*> visible_selected_groups; @@ -8236,33 +8122,7 @@ void LLPipeline::renderFinalize() if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) { - gSplatTextureRectProgram.bind(); - - gGL.setColorMask(true, false); - - LLVector2 tc1(0, 0); - LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw() * 2, - (F32) gViewerWindow->getWorldViewHeightRaw() * 2); - - LLGLEnable blend(GL_BLEND); - gGL.color4f(1, 1, 1, 0.75f); - - gGL.getTexUnit(0)->bind(&mPhysicsDisplay); - - gGL.begin(LLRender::TRIANGLES); - gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); - gGL.vertex2f(-1, -1); - - gGL.texCoord2f(tc1.mV[0], tc2.mV[1]); - gGL.vertex2f(-1, 3); - - gGL.texCoord2f(tc2.mV[0], tc1.mV[1]); - gGL.vertex2f(3, -1); - - gGL.end(); - gGL.flush(); - - gSplatTextureRectProgram.unbind(); + renderPhysicsDisplay(); } /*if (LLRenderTarget::sUseFBO && !gCubeSnapshot) @@ -8495,24 +8355,27 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); - channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - if (channel > -1) - { - LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; - if (cube_map) - { - cube_map->enable(channel); - cube_map->bind(); - } + if (!LLPipeline::sReflectionProbesEnabled) + { + channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + if (channel > -1) + { + LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; + if (cube_map) + { + cube_map->enable(channel); + cube_map->bind(); + } - F32* m = gGLModelView; + F32* m = gGLModelView; - F32 mat[] = { m[0], m[1], m[2], - m[4], m[5], m[6], - m[8], m[9], m[10] }; + F32 mat[] = { m[0], m[1], m[2], + m[4], m[5], m[6], + m[8], m[9], m[10] }; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); - } + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); + } + } bindReflectionProbes(shader); @@ -9352,15 +9215,18 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC); - S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - if (channel > -1) - { - LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; - if (cube_map) - { - cube_map->disable(); - } - } + if (!LLPipeline::sReflectionProbesEnabled) + { + S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + if (channel > -1) + { + LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; + if (cube_map) + { + cube_map->disable(); + } + } + } unbindReflectionProbes(shader); @@ -9913,61 +9779,6 @@ void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade) } } -void LLPipeline::generateHighlight(LLCamera& camera) -{ - //render highlighted object as white into offscreen render target - if (mHighlightObject.notNull()) - { - mHighlightSet.insert(HighlightItem(mHighlightObject)); - } - llassert(!gCubeSnapshot); - - if (!mHighlightSet.empty()) - { - F32 transition = gFrameIntervalSeconds.value()/RenderHighlightFadeTime; - - LLGLDisable test(GL_ALPHA_TEST); - LLGLDepthTest depth(GL_FALSE); - mHighlight.bindTarget(); - disableLights(); - gGL.setColorMask(true, true); - mHighlight.clear(); - - gHighlightProgram.bind(); - - gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); - for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ) - { - std::set<HighlightItem>::iterator cur_iter = iter++; - - if (cur_iter->mItem.isNull()) - { - mHighlightSet.erase(cur_iter); - continue; - } - - if (cur_iter->mItem == mHighlightObject) - { - cur_iter->incrFade(transition); - } - else - { - cur_iter->incrFade(-transition); - if (cur_iter->mFade <= 0.f) - { - mHighlightSet.erase(cur_iter); - continue; - } - } - - renderHighlight(cur_iter->mItem->getVObj(), cur_iter->mFade); - } - - mHighlight.flush(); - gGL.setColorMask(true, false); - gViewerWindow->setup3DViewport(); - } -} LLRenderTarget* LLPipeline::getSunShadowTarget(U32 i) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 0fbc5cf960..32e46a8db0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -133,8 +133,6 @@ public: bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples); bool allocateShadowBuffer(U32 resX, U32 resY); - void allocatePhysicsBuffer(); - void resetVertexBuffers(LLDrawable* drawable); void generateImpostor(LLVOAvatar* avatar, bool preview_avatar = false); void bindScreenToTexture(); @@ -319,11 +317,8 @@ public: LLRenderTarget* getSunShadowTarget(U32 i); LLRenderTarget* getSpotShadowTarget(U32 i); - void generateHighlight(LLCamera& camera); void renderHighlight(const LLViewerObject* obj, F32 fade); - void setHighlightObject(LLDrawable* obj) { mHighlightObject = obj; } - - + void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool use_shader, bool use_occlusion, U32 target_width); void renderHighlights(); void renderDebug(); @@ -692,8 +687,6 @@ public: LLRenderTarget mSpotShadow[2]; LLRenderTarget mSpotShadowOcclusion[2]; - LLRenderTarget mHighlight; - LLRenderTarget mPhysicsDisplay; LLRenderTarget mPbrBrdfLut; LLCullResult mSky; @@ -859,9 +852,6 @@ protected: } }; - std::set<HighlightItem> mHighlightSet; - LLPointer<LLDrawable> mHighlightObject; - ////////////////////////////////////////////////// // // Draw pools are responsible for storing all rendered data, diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 75b50c0e39..7f03fbe7c3 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -647,32 +647,58 @@ name="2" value="2"/> </combo_box> + + <check_box + control_name="RenderReflectionsEnabled" + height="16" + initial_value="true" + label="Reflections" + layout="topleft" + left="420" + name="ReflectionsEnabled" + top_delta="16" + width="240"> + <check_box.commit_callback + function="Pref.RenderOptionUpdate" /> + </check_box> + + <check_box + control_name="RenderScreenSpaceReflections" + height="16" + initial_value="true" + label="Screen Space Reflections" + layout="topleft" + left="440" + name="ScreenSpaceReflections" + top_delta="16" + width="240"> + <check_box.commit_callback + function="Pref.RenderOptionUpdate" /> + </check_box> + <text type="string" length="1" follows="left|top" height="16" layout="topleft" - left="420" - name="RenderReflectionDetailText" + left="440" + name="ReflectionDetailText" text_readonly_color="LabelDisabledColor" top_delta="16" width="128"> - Reflections: + Reflection Detail: </text> + <combo_box control_name="RenderReflectionProbeDetail" height="18" layout="topleft" - left_delta="130" + left_delta="110" top_delta="0" name="ReflectionDetail" width="150"> <combo_box.item - label="Disabled" - name="0" - value="-1"/> - <combo_box.item label="Static Only" name="0" value="0"/> diff --git a/indra/newview/skins/default/xui/en/menu_inventory_add.xml b/indra/newview/skins/default/xui/en/menu_inventory_add.xml index fa40c5df90..b04215872c 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_add.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_add.xml @@ -47,13 +47,23 @@ label="Model..." layout="topleft" name="Upload Model"> - <menu_item_call.on_click - function="File.UploadModel" - parameter="" /> - <menu_item_call.on_enable - function="File.EnableUploadModel" /> - <menu_item_call.on_visible - function="File.VisibleUploadModel"/> + <menu_item_call.on_click + function="File.UploadModel" + parameter="" /> + <menu_item_call.on_enable + function="File.EnableUploadModel" /> + <menu_item_call.on_visible + function="File.VisibleUploadModel"/> + </menu_item_call> + <menu_item_call + label="Material..." + layout="topleft" + name="Upload Material"> + <menu_item_call.on_click + function="File.UploadMaterial" + parameter="" /> + <menu_item_call.on_enable + function="File.EnableUploadMaterial" /> </menu_item_call> <menu_item_call label="Bulk..." diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index cb1dec6c61..a3c365e60c 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3247,16 +3247,6 @@ function="World.EnvPreset" function="Advanced.HandleAttachedLightParticles" parameter="RenderAttachedParticles" /> </menu_item_check> - <menu_item_check - label="Hover Glow Objects" - name="Hover Glow Objects"> - <menu_item_check.on_check - function="CheckControl" - parameter="RenderHoverGlowEnable" /> - <menu_item_check.on_click - function="ToggleControl" - parameter="RenderHoverGlowEnable" /> - </menu_item_check> <menu_item_call enabled="true" label="Rebuild Reflection Probes" diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index ba5a20dd22..3bcbe0ca3a 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -891,6 +891,40 @@ max_val="1" name="shinyOffsetV" width="265" /> + <check_box + follows="top|left" + height="16" + initial_value="false" + label="Align planar faces" + layout="topleft" + left="7" + name="checkbox planar align" + tool_tip="Align textures on all selected faces with the last selected face. Requires Planar texture mapping." + top_delta="20" + width="260" /> + <button + follows="left|top" + layout="topleft" + left="9" + top="231" + height="20" + label="Align" + label_selected="Align current texture layers" + name="button align textures" + tool_tip="Align current texture layers" + width="66" /> + <web_browser + visible="false" + enabled="false" + border_visible="true" + bottom_delta="0" + follows="top|left" + left="0" + name="title_media" + width="4" + height="4" + start_url="about:blank" + decouple_texture_size="true" /> <!-- BEGIN PBR Material texture transform parameters --> <spinner follows="left|top" @@ -903,7 +937,7 @@ min_val="-100" max_val="100" name="gltfTextureScaleU" - top_delta="-115" + top_delta="34" width="265" /> <spinner follows="left|top" @@ -954,38 +988,4 @@ name="gltfTextureOffsetV" width="265" /> <!-- END PBR Material texture transform parameters --> - <check_box - follows="top|left" - height="16" - initial_value="false" - label="Align planar faces" - layout="topleft" - left="7" - name="checkbox planar align" - tool_tip="Align textures on all selected faces with the last selected face. Requires Planar texture mapping." - top_delta="43" - width="260" /> - <button - follows="left|top" - layout="topleft" - left="9" - top="231" - height="20" - label="Align" - label_selected="Align current texture layers" - name="button align textures" - tool_tip="Align current texture layers" - width="66" /> - <web_browser - visible="false" - enabled="false" - border_visible="true" - bottom_delta="0" - follows="top|left" - left="0" - name="title_media" - width="4" - height="4" - start_url="about:blank" - decouple_texture_size="true" /> </panel> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index e7e1a24f5e..255aff06be 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -319,6 +319,11 @@ Only items with unrestricted 'next owner' permissions can be attached to notecards. </string> + <string name="TooltipTextureRestrictedDrop"> +Only textures with unrestricted +copy and transfer permissions +are allowed. + </string> <!-- searching - generic --> <string name="Searching">Searching...</string> |