Integrate SMAA and rework post process chain for better visual quality
Add SMAA buffer generation passes Add quality levels for both FXAA and SMAA Separate gamma correction and tonemapping for effects that require linear-but-tonemapped inputs Move application of noise to final render pass to screen to avoid damaging other post process effectsmaster
parent
3a73748929
commit
958afaa7a7
|
|
@ -241,6 +241,10 @@ public:
|
|||
|
||||
void clearPermutations();
|
||||
void addPermutation(std::string name, std::string value);
|
||||
void addPermutations(const std::map<std::string, std::string>& defines)
|
||||
{
|
||||
mDefines.insert(defines.begin(), defines.end());
|
||||
}
|
||||
void removePermutation(std::string name);
|
||||
|
||||
void addConstant(const LLGLSLShader::eShaderConsts shader_const);
|
||||
|
|
|
|||
|
|
@ -1619,7 +1619,6 @@ void LLRender::flush()
|
|||
{
|
||||
|
||||
HBXXH64 hash;
|
||||
|
||||
U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask;
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -597,6 +597,15 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
|
|||
}
|
||||
}
|
||||
|
||||
if (type == GL_FRAGMENT_SHADER)
|
||||
{
|
||||
extra_code_text[extra_code_count++] = strdup("#define FRAGMENT_SHADER 1\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
extra_code_text[extra_code_count++] = strdup("#define VERTEX_SHADER 1\n");
|
||||
}
|
||||
|
||||
// Use alpha float to store bit flags
|
||||
// See: C++: addDeferredAttachment(), shader: frag_data[2]
|
||||
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_SKIP_ATMOS 0.0 \n"); // atmo kill
|
||||
|
|
@ -1468,6 +1477,11 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||
|
||||
mReservedUniforms.push_back("debug_normal_draw_length");
|
||||
|
||||
mReservedUniforms.push_back("edgesTex");
|
||||
mReservedUniforms.push_back("areaTex");
|
||||
mReservedUniforms.push_back("searchTex");
|
||||
mReservedUniforms.push_back("blendTex");
|
||||
|
||||
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
|
||||
|
||||
std::set<std::string> dupe_check;
|
||||
|
|
|
|||
|
|
@ -332,6 +332,11 @@ public:
|
|||
|
||||
DEBUG_NORMAL_DRAW_LENGTH, // "debug_normal_draw_length"
|
||||
|
||||
SMAA_EDGE_TEX, // "edgesTex"
|
||||
SMAA_AREA_TEX, // "areaTex"
|
||||
SMAA_SEARCH_TEX, // "searchTex"
|
||||
SMAA_BLEND_TEX, // "blendTex"
|
||||
|
||||
END_RESERVED_UNIFORMS
|
||||
} eGLSLReservedUniforms;
|
||||
// clang-format on
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,157 @@
|
|||
/**
|
||||
* @file SMAASearchTex.h
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013 Jorge Jimenez (jorge@iryoku.com)
|
||||
* Copyright (C) 2013 Jose I. Echevarria (joseignacioechevarria@gmail.com)
|
||||
* Copyright (C) 2013 Belen Masia (bmasia@unizar.es)
|
||||
* Copyright (C) 2013 Fernando Navarro (fernandn@microsoft.com)
|
||||
* Copyright (C) 2013 Diego Gutierrez (diegog@unizar.es)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to
|
||||
* do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software. As clarification, there
|
||||
* is no requirement that the copyright notice and permission be included in
|
||||
* binary distributions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SEARCHTEX_H
|
||||
#define SEARCHTEX_H
|
||||
|
||||
#define SEARCHTEX_WIDTH 64
|
||||
#define SEARCHTEX_HEIGHT 16
|
||||
#define SEARCHTEX_PITCH SEARCHTEX_WIDTH
|
||||
#define SEARCHTEX_SIZE (SEARCHTEX_HEIGHT * SEARCHTEX_PITCH)
|
||||
|
||||
/**
|
||||
* Stored in R8 format. Load it in the following format:
|
||||
* - DX9: D3DFMT_L8
|
||||
* - DX10: DXGI_FORMAT_R8_UNORM
|
||||
*/
|
||||
static const unsigned char searchTexBytes[] = {
|
||||
0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x7f, 0x7f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00,
|
||||
0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0xfe, 0x7f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0xfe,
|
||||
0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f,
|
||||
0x7f, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x7f, 0x7f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00,
|
||||
0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0xfe, 0x7f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0xfe,
|
||||
0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f,
|
||||
0x7f, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x7f,
|
||||
0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f,
|
||||
0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f,
|
||||
0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00,
|
||||
0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x7f,
|
||||
0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f,
|
||||
0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f,
|
||||
0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x00, 0x00,
|
||||
0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -7300,7 +7300,7 @@
|
|||
<key>RenderBufferVisualization</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Outputs a selected buffer to the screen. -1 = final render buffer. 0 = Albedo, 1 = Specular/ORM, 2 = Normal, 3 = Emissive, 4 = Eye luminance</string>
|
||||
<string>Outputs a selected buffer to the screen. -1 = final render buffer. 0 = Albedo, 1 = Specular/ORM, 2 = Normal, 3 = Emissive, 4 = Eye luminance, 5 = FXAA Luminance/SMAA Edge Tex, 6 = SMAA Blend Weights</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
|
|
@ -7684,17 +7684,6 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderPostProcessingHDR</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable HDR for post processing buffer</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderHDRIExposure</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -8399,7 +8388,18 @@
|
|||
<key>RenderFSAASamples</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Number of samples to use for FSAA (0 = no AA).</string>
|
||||
<string>Quality of antialiasing: 0 = Low, 1 = Medium, 2 = High, 3 = Ultra</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderFSAAType</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Type of Antialiasing to use: 0 = None, 1 = FXAA, 2 = SMAA</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
|
|||
|
|
@ -2067,9 +2067,6 @@ A_STATIC void CasSetup(
|
|||
AF3 CasLoad(ASU2 p) { return texelFetch(diffuseRect, p, 0).rgb; }
|
||||
void CasInput(inout AF1 r,inout AF1 g,inout AF1 b)
|
||||
{
|
||||
r = AFromSrgbF1(r);
|
||||
g = AFromSrgbF1(g);
|
||||
b = AFromSrgbF1(b);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -2553,6 +2550,7 @@ void main()
|
|||
vec4 diff = vec4(0.f);
|
||||
uvec2 point = uvec2(vary_fragcoord * out_screen_res.xy);
|
||||
CasFilter(diff.r, diff.g, diff.b, point, cas_param_0, cas_param_1, true);
|
||||
frag_color = vec4(linear_to_srgb(diff.rgb), 1.0);
|
||||
diff.a = texture(diffuseRect, vary_fragcoord).a;
|
||||
frag_color = diff;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* @file SMAABlendWeightsF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
in vec2 vary_texcoord0;
|
||||
in vec2 vary_pixcoord;
|
||||
in vec4 vary_offset[3];
|
||||
|
||||
uniform sampler2D edgesTex;
|
||||
uniform sampler2D areaTex;
|
||||
uniform sampler2D searchTex;
|
||||
|
||||
vec4 SMAABlendingWeightCalculationPS(vec2 texcoord,
|
||||
vec2 pixcoord,
|
||||
vec4 offset[3],
|
||||
sampler2D edgesTex,
|
||||
sampler2D areaTex,
|
||||
sampler2D searchTex,
|
||||
vec4 subsampleIndices);
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = SMAABlendingWeightCalculationPS(vary_texcoord0,
|
||||
vary_pixcoord,
|
||||
vary_offset,
|
||||
edgesTex,
|
||||
areaTex,
|
||||
searchTex,
|
||||
vec4(0.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* @file SMAABlendWeightsV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
in vec3 position;
|
||||
|
||||
out vec2 vary_texcoord0;
|
||||
out vec2 vary_pixcoord;
|
||||
out vec4 vary_offset[3];
|
||||
|
||||
#define float4 vec4
|
||||
#define float2 vec2
|
||||
void SMAABlendingWeightCalculationVS(float2 texcoord,
|
||||
out float2 pixcoord,
|
||||
out float4 offset[3]);
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xyz, 1.0);
|
||||
vary_texcoord0 = (gl_Position.xy*0.5+0.5);
|
||||
|
||||
SMAABlendingWeightCalculationVS(vary_texcoord0,
|
||||
vary_pixcoord,
|
||||
vary_offset);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* @file SMAAEdgeDetectF.glsl
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
in vec2 vary_texcoord0;
|
||||
in vec4 vary_offset[3];
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
#if SMAA_PREDICATION
|
||||
uniform sampler2D predicationTex;
|
||||
#endif
|
||||
|
||||
#define float4 vec4
|
||||
#define float2 vec2
|
||||
#define SMAATexture2D(tex) sampler2D tex
|
||||
|
||||
float2 SMAAColorEdgeDetectionPS(float2 texcoord,
|
||||
float4 offset[3],
|
||||
SMAATexture2D(colorTex)
|
||||
#if SMAA_PREDICATION
|
||||
, SMAATexture2D(predicationTex)
|
||||
#endif
|
||||
);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 val = SMAAColorEdgeDetectionPS(vary_texcoord0,
|
||||
vary_offset,
|
||||
diffuseRect
|
||||
#if SMAA_PREDICATION
|
||||
, predicationTex
|
||||
#endif
|
||||
);
|
||||
frag_color = float4(val,0.0,0.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* @file SMAAEdgeDetectV.glsl
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
in vec3 position;
|
||||
|
||||
out vec2 vary_texcoord0;
|
||||
out vec4 vary_offset[3];
|
||||
|
||||
#define float4 vec4
|
||||
#define float2 vec2
|
||||
void SMAAEdgeDetectionVS(float2 texcoord,
|
||||
out float4 offset[3]);
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xyz, 1.0);
|
||||
vary_texcoord0 = (gl_Position.xy*0.5+0.5);
|
||||
|
||||
SMAAEdgeDetectionVS(vary_texcoord0, vary_offset);
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* @file SMAANeighborhoodBlendF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
in vec2 vary_texcoord0;
|
||||
in vec4 vary_offset;
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D blendTex;
|
||||
#if SMAA_REPROJECTION
|
||||
uniform sampler2D velocityTex;
|
||||
#endif
|
||||
|
||||
#define float4 vec4
|
||||
#define float2 vec2
|
||||
#define SMAATexture2D(tex) sampler2D tex
|
||||
|
||||
float4 SMAANeighborhoodBlendingPS(float2 texcoord,
|
||||
float4 offset,
|
||||
SMAATexture2D(colorTex),
|
||||
SMAATexture2D(blendTex)
|
||||
#if SMAA_REPROJECTION
|
||||
, SMAATexture2D(velocityTex)
|
||||
#endif
|
||||
);
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = SMAANeighborhoodBlendingPS(vary_texcoord0,
|
||||
vary_offset,
|
||||
diffuseRect,
|
||||
blendTex
|
||||
#if SMAA_REPROJECTION
|
||||
, velocityTex
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* @file SMAANeighborhoodBlendV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
in vec3 position;
|
||||
|
||||
out vec2 vary_texcoord0;
|
||||
out vec4 vary_offset;
|
||||
|
||||
#define float4 vec4
|
||||
#define float2 vec2
|
||||
void SMAANeighborhoodBlendingVS(float2 texcoord,
|
||||
out float4 offset);
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xyz, 1.0);
|
||||
vary_texcoord0 = (gl_Position.xy*0.5+0.5);
|
||||
|
||||
SMAANeighborhoodBlendingVS(vary_texcoord0, vary_offset);
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ out vec4 frag_color;
|
|||
|
||||
#define FXAA_PC 1
|
||||
//#define FXAA_GLSL_130 1
|
||||
#define FXAA_QUALITY__PRESET 12
|
||||
//#define FXAA_QUALITY__PRESET 12
|
||||
|
||||
/*============================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -28,140 +28,14 @@
|
|||
out vec4 frag_color;
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D exposureMap;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
in vec2 vary_fragcoord;
|
||||
|
||||
vec3 linear_to_srgb(vec3 cl);
|
||||
|
||||
//===============================================================
|
||||
// tone mapping taken from Khronos sample implementation
|
||||
//===============================================================
|
||||
|
||||
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
|
||||
const mat3 ACESInputMat = mat3
|
||||
(
|
||||
0.59719, 0.07600, 0.02840,
|
||||
0.35458, 0.90834, 0.13383,
|
||||
0.04823, 0.01566, 0.83777
|
||||
);
|
||||
|
||||
|
||||
// ODT_SAT => XYZ => D60_2_D65 => sRGB
|
||||
const mat3 ACESOutputMat = mat3
|
||||
(
|
||||
1.60475, -0.10208, -0.00327,
|
||||
-0.53108, 1.10813, -0.07276,
|
||||
-0.07367, -0.00605, 1.07602
|
||||
);
|
||||
|
||||
// ACES tone map (faster approximation)
|
||||
// see: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
vec3 toneMapACES_Narkowicz(vec3 color)
|
||||
{
|
||||
const float A = 2.51;
|
||||
const float B = 0.03;
|
||||
const float C = 2.43;
|
||||
const float D = 0.59;
|
||||
const float E = 0.14;
|
||||
return clamp((color * (A * color + B)) / (color * (C * color + D) + E), 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
// ACES filmic tone map approximation
|
||||
// see https://github.com/TheRealMJP/BakingLab/blob/master/BakingLab/ACES.hlsl
|
||||
vec3 RRTAndODTFit(vec3 color)
|
||||
{
|
||||
vec3 a = color * (color + 0.0245786) - 0.000090537;
|
||||
vec3 b = color * (0.983729 * color + 0.4329510) + 0.238081;
|
||||
return a / b;
|
||||
}
|
||||
|
||||
|
||||
// tone mapping
|
||||
vec3 toneMapACES_Hill(vec3 color)
|
||||
{
|
||||
color = ACESInputMat * color;
|
||||
|
||||
// Apply RRT and ODT
|
||||
color = RRTAndODTFit(color);
|
||||
|
||||
color = ACESOutputMat * color;
|
||||
|
||||
// Clamp to [0, 1]
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
uniform float exposure;
|
||||
uniform float gamma;
|
||||
uniform float aces_mix;
|
||||
uniform vec2 screen_res;
|
||||
in vec2 vary_fragcoord;
|
||||
|
||||
vec3 toneMap(vec3 color)
|
||||
{
|
||||
#ifndef NO_POST
|
||||
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
|
||||
|
||||
color *= exposure * exp_scale;
|
||||
|
||||
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content
|
||||
color = mix(toneMapACES_Hill(color), color, aces_mix);
|
||||
#endif
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
|
||||
//=================================
|
||||
// borrowed noise from:
|
||||
// <https://www.shadertoy.com/view/4dS3Wd>
|
||||
// By Morgan McGuire @morgan3d, http://graphicscodex.com
|
||||
//
|
||||
float hash(float n) { return fract(sin(n) * 1e4); }
|
||||
float hash(vec2 p) { return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); }
|
||||
|
||||
float noise(float x) {
|
||||
float i = floor(x);
|
||||
float f = fract(x);
|
||||
float u = f * f * (3.0 - 2.0 * f);
|
||||
return mix(hash(i), hash(i + 1.0), u);
|
||||
}
|
||||
|
||||
float noise(vec2 x) {
|
||||
vec2 i = floor(x);
|
||||
vec2 f = fract(x);
|
||||
|
||||
// Four corners in 2D of a tile
|
||||
float a = hash(i);
|
||||
float b = hash(i + vec2(1.0, 0.0));
|
||||
float c = hash(i + vec2(0.0, 1.0));
|
||||
float d = hash(i + vec2(1.0, 1.0));
|
||||
|
||||
// Simple 2D lerp using smoothstep envelope between the values.
|
||||
// return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),
|
||||
// mix(c, d, smoothstep(0.0, 1.0, f.x)),
|
||||
// smoothstep(0.0, 1.0, f.y)));
|
||||
|
||||
// Same code, with the clamps in smoothstep and common subexpressions
|
||||
// optimized away.
|
||||
vec2 u = f * f * (3.0 - 2.0 * f);
|
||||
return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
|
||||
}
|
||||
|
||||
//=============================
|
||||
|
||||
void debugExposure(inout vec3 color)
|
||||
{
|
||||
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
|
||||
exp_scale *= 0.5;
|
||||
if (abs(vary_fragcoord.y-exp_scale) < 0.01 && vary_fragcoord.x < 0.1)
|
||||
{
|
||||
color = vec3(1,0,0);
|
||||
}
|
||||
}
|
||||
vec3 linear_to_srgb(vec3 cl);
|
||||
|
||||
vec3 legacyGamma(vec3 color)
|
||||
{
|
||||
|
|
@ -175,23 +49,12 @@ void main()
|
|||
{
|
||||
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
|
||||
vec4 diff = texture(diffuseRect, vary_fragcoord);
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
|
||||
#ifdef LEGACY_GAMMA
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
diff.rgb = legacyGamma(diff.rgb);
|
||||
#else
|
||||
#ifndef NO_POST
|
||||
diff.rgb = toneMap(diff.rgb);
|
||||
#endif
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
#endif
|
||||
|
||||
vec2 tc = vary_fragcoord.xy*screen_res*4.0;
|
||||
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
|
||||
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));
|
||||
diff.rgb += nz*0.003;
|
||||
|
||||
//debugExposure(diff.rgb);
|
||||
frag_color = max(diff, vec4(0));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,57 @@ uniform sampler2D depthMap;
|
|||
uniform vec2 screen_res;
|
||||
in vec2 vary_fragcoord;
|
||||
|
||||
//=================================
|
||||
// borrowed noise from:
|
||||
// <https://www.shadertoy.com/view/4dS3Wd>
|
||||
// By Morgan McGuire @morgan3d, http://graphicscodex.com
|
||||
//
|
||||
float hash(float n) { return fract(sin(n) * 1e4); }
|
||||
float hash(vec2 p) { return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); }
|
||||
|
||||
float noise(float x) {
|
||||
float i = floor(x);
|
||||
float f = fract(x);
|
||||
float u = f * f * (3.0 - 2.0 * f);
|
||||
return mix(hash(i), hash(i + 1.0), u);
|
||||
}
|
||||
|
||||
float noise(vec2 x) {
|
||||
vec2 i = floor(x);
|
||||
vec2 f = fract(x);
|
||||
|
||||
// Four corners in 2D of a tile
|
||||
float a = hash(i);
|
||||
float b = hash(i + vec2(1.0, 0.0));
|
||||
float c = hash(i + vec2(0.0, 1.0));
|
||||
float d = hash(i + vec2(1.0, 1.0));
|
||||
|
||||
// Simple 2D lerp using smoothstep envelope between the values.
|
||||
// return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),
|
||||
// mix(c, d, smoothstep(0.0, 1.0, f.x)),
|
||||
// smoothstep(0.0, 1.0, f.y)));
|
||||
|
||||
// Same code, with the clamps in smoothstep and common subexpressions
|
||||
// optimized away.
|
||||
vec2 u = f * f * (3.0 - 2.0 * f);
|
||||
return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
|
||||
}
|
||||
|
||||
//=============================
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
#ifdef HAS_NOISE
|
||||
vec2 tc = vary_fragcoord.xy*screen_res*4.0;
|
||||
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
|
||||
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));
|
||||
diff.rgb += nz*0.003;
|
||||
#endif
|
||||
|
||||
frag_color = diff;
|
||||
|
||||
gl_FragDepth = texture(depthMap, vary_fragcoord.xy).r;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,150 @@
|
|||
/**
|
||||
* @file postDeferredTonemap.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2024, 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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D exposureMap;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
in vec2 vary_fragcoord;
|
||||
|
||||
vec3 linear_to_srgb(vec3 cl);
|
||||
|
||||
//===============================================================
|
||||
// tone mapping taken from Khronos sample implementation
|
||||
//===============================================================
|
||||
|
||||
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
|
||||
const mat3 ACESInputMat = mat3
|
||||
(
|
||||
0.59719, 0.07600, 0.02840,
|
||||
0.35458, 0.90834, 0.13383,
|
||||
0.04823, 0.01566, 0.83777
|
||||
);
|
||||
|
||||
|
||||
// ODT_SAT => XYZ => D60_2_D65 => sRGB
|
||||
const mat3 ACESOutputMat = mat3
|
||||
(
|
||||
1.60475, -0.10208, -0.00327,
|
||||
-0.53108, 1.10813, -0.07276,
|
||||
-0.07367, -0.00605, 1.07602
|
||||
);
|
||||
|
||||
// ACES tone map (faster approximation)
|
||||
// see: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
vec3 toneMapACES_Narkowicz(vec3 color)
|
||||
{
|
||||
const float A = 2.51;
|
||||
const float B = 0.03;
|
||||
const float C = 2.43;
|
||||
const float D = 0.59;
|
||||
const float E = 0.14;
|
||||
return clamp((color * (A * color + B)) / (color * (C * color + D) + E), 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
// ACES filmic tone map approximation
|
||||
// see https://github.com/TheRealMJP/BakingLab/blob/master/BakingLab/ACES.hlsl
|
||||
vec3 RRTAndODTFit(vec3 color)
|
||||
{
|
||||
vec3 a = color * (color + 0.0245786) - 0.000090537;
|
||||
vec3 b = color * (0.983729 * color + 0.4329510) + 0.238081;
|
||||
return a / b;
|
||||
}
|
||||
|
||||
|
||||
// tone mapping
|
||||
vec3 toneMapACES_Hill(vec3 color)
|
||||
{
|
||||
color = ACESInputMat * color;
|
||||
|
||||
// Apply RRT and ODT
|
||||
color = RRTAndODTFit(color);
|
||||
|
||||
color = ACESOutputMat * color;
|
||||
|
||||
// Clamp to [0, 1]
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
uniform float exposure;
|
||||
uniform float gamma;
|
||||
uniform float aces_mix;
|
||||
|
||||
vec3 toneMap(vec3 color)
|
||||
{
|
||||
#ifndef NO_POST
|
||||
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
|
||||
|
||||
color *= exposure * exp_scale;
|
||||
|
||||
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content
|
||||
color = mix(toneMapACES_Hill(color), color, aces_mix);
|
||||
#endif
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
|
||||
void debugExposure(inout vec3 color)
|
||||
{
|
||||
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
|
||||
exp_scale *= 0.5;
|
||||
if (abs(vary_fragcoord.y-exp_scale) < 0.01 && vary_fragcoord.x < 0.1)
|
||||
{
|
||||
color = vec3(1,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
vec3 legacyGamma(vec3 color)
|
||||
{
|
||||
vec3 c = 1. - clamp(color, vec3(0.), vec3(1.));
|
||||
c = 1. - pow(c, vec3(gamma)); // s/b inverted already CPU-side
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
|
||||
vec4 diff = texture(diffuseRect, vary_fragcoord);
|
||||
|
||||
#ifndef NO_POST
|
||||
diff.rgb = toneMap(diff.rgb);
|
||||
#else
|
||||
diff.rgb = clamp(diff.rgb, vec3(0.0), vec3(1.0));
|
||||
#endif
|
||||
|
||||
//debugExposure(diff.rgb);
|
||||
frag_color = max(diff, vec4(0));
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
version 62
|
||||
version 63
|
||||
// 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
|
||||
|
|
@ -66,7 +66,8 @@ RenderDeferred 1 1
|
|||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
RenderUseStreamVBO 1 1
|
||||
RenderFSAASamples 1 16
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 3
|
||||
RenderMaxTextureIndex 1 16
|
||||
RenderGLContextCoreProfile 1 1
|
||||
RenderGLMultiThreadedTextures 1 0
|
||||
|
|
@ -108,6 +109,7 @@ RenderVolumeLODFactor 1 1.125
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 0
|
||||
RenderFSAASamples 1 0
|
||||
RenderScreenSpaceReflections 1 0
|
||||
RenderReflectionProbeLevel 1 0
|
||||
|
|
@ -144,6 +146,7 @@ RenderVolumeLODFactor 1 1.125
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 0
|
||||
RenderFSAASamples 1 0
|
||||
RenderScreenSpaceReflections 1 0
|
||||
RenderReflectionProbeLevel 1 0
|
||||
|
|
@ -178,7 +181,8 @@ RenderVolumeLODFactor 1 1.25
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAASamples 1 2
|
||||
RenderFSAAType 1 1
|
||||
RenderFSAASamples 1 1
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 0
|
||||
RenderScreenSpaceReflections 1 0
|
||||
|
|
@ -214,7 +218,8 @@ RenderVolumeLODFactor 1 1.375
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAASamples 1 2
|
||||
RenderFSAAType 1 1
|
||||
RenderFSAASamples 1 1
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
RenderScreenSpaceReflections 1 0
|
||||
|
|
@ -250,6 +255,7 @@ RenderVolumeLODFactor 1 1.5
|
|||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 1
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 2
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
|
|
@ -286,6 +292,7 @@ RenderVolumeLODFactor 1 1.75
|
|||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 2
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
|
|
@ -322,7 +329,8 @@ WindLightUseAtmosShaders 1 1
|
|||
WLSkyDetail 1 128
|
||||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
RenderFSAASamples 1 2
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 3
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
RenderScreenSpaceReflections 1 0
|
||||
|
|
@ -366,6 +374,7 @@ RenderMirrors 0 0
|
|||
|
||||
list Intel
|
||||
RenderAnisotropic 1 0
|
||||
RenderFSAAType 1 0
|
||||
RenderFSAASamples 1 0
|
||||
RenderGLContextCoreProfile 1 0
|
||||
RenderGLMultiThreadedMedia 1 0
|
||||
|
|
@ -375,6 +384,7 @@ list AMD
|
|||
RenderGLMultiThreadedTextures 1 1
|
||||
|
||||
list GL3
|
||||
RenderFSAAType 0 0
|
||||
RenderFSAASamples 0 0
|
||||
RenderReflectionsEnabled 0 0
|
||||
RenderReflectionProbeDetail 0 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version 59
|
||||
version 60
|
||||
// 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
|
||||
|
|
@ -63,7 +63,8 @@ RenderDeferred 1 1
|
|||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
RenderUseStreamVBO 1 1
|
||||
RenderFSAASamples 1 16
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 3
|
||||
RenderMaxTextureIndex 1 16
|
||||
RenderGLContextCoreProfile 1 1
|
||||
RenderGLMultiThreadedTextures 1 0
|
||||
|
|
@ -103,6 +104,7 @@ RenderVolumeLODFactor 1 1.125
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 0
|
||||
RenderFSAASamples 1 0
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 0
|
||||
|
|
@ -139,6 +141,7 @@ RenderVolumeLODFactor 1 1.125
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 0
|
||||
RenderFSAASamples 1 0
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 0
|
||||
|
|
@ -175,7 +178,8 @@ RenderVolumeLODFactor 1 1.25
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAASamples 1 2
|
||||
RenderFSAAType 1 1
|
||||
RenderFSAASamples 1 0
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 0
|
||||
RenderScreenSpaceReflections 1 0
|
||||
|
|
@ -211,7 +215,8 @@ RenderVolumeLODFactor 1 1.375
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAASamples 1 2
|
||||
RenderFSAAType 1 1
|
||||
RenderFSAASamples 1 1
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 0
|
||||
RenderScreenSpaceReflections 1 0
|
||||
|
|
@ -247,6 +252,7 @@ RenderVolumeLODFactor 1 1.5
|
|||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 1
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 1
|
||||
RenderFSAASamples 1 2
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
|
|
@ -283,6 +289,7 @@ RenderVolumeLODFactor 1 1.75
|
|||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
WLSkyDetail 1 96
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 2
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
|
|
@ -319,7 +326,8 @@ WindLightUseAtmosShaders 1 1
|
|||
WLSkyDetail 1 128
|
||||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
RenderFSAASamples 1 2
|
||||
RenderFSAAType 1 2
|
||||
RenderFSAASamples 1 3
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionProbeDetail 1 1
|
||||
RenderScreenSpaceReflections 1 0
|
||||
|
|
|
|||
|
|
@ -140,8 +140,6 @@ void LLFloaterPreferenceGraphicsAdvanced::onAdvancedAtmosphericsEnable()
|
|||
|
||||
void LLFloaterPreferenceGraphicsAdvanced::refresh()
|
||||
{
|
||||
getChild<LLUICtrl>("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples"));
|
||||
|
||||
// sliders and their text boxes
|
||||
// mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow");
|
||||
// slider text boxes
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ bool LLGLTFPreviewTexture::render()
|
|||
SetTemporarily<bool> no_dof(&LLPipeline::RenderDepthOfField, false);
|
||||
SetTemporarily<bool> no_glow(&LLPipeline::sRenderGlow, false);
|
||||
SetTemporarily<bool> no_ssr(&LLPipeline::RenderScreenSpaceReflections, false);
|
||||
SetTemporarily<U32> no_fxaa(&LLPipeline::RenderFSAASamples, U32(0));
|
||||
SetTemporarily<U32> no_aa(&LLPipeline::RenderFSAAType, U32(0));
|
||||
SetTemporarily<LLPipeline::RenderTargetPack*> use_auxiliary_render_target(&gPipeline.mRT, &gPipeline.mAuxillaryRT);
|
||||
|
||||
LLVector3 light_dir3(1.0f, 1.0f, 1.0f);
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ void settings_setup_listeners()
|
|||
setting_setup_signal_listener(gSavedSettings, "RenderMaxTextureIndex", handleSetShaderChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderUIBuffer", handleWindowResized);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderDepthOfField", handleReleaseGLBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderFSAASamples", handleReleaseGLBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderFSAAType", handleReleaseGLBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderPostProcessingHDR", handleReleaseGLBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderSpecularResX", handleLUTBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderSpecularResY", handleLUTBufferChanged);
|
||||
|
|
|
|||
|
|
@ -194,15 +194,20 @@ LLGLSLShader gDeferredSkinnedEmissiveProgram;
|
|||
LLGLSLShader gDeferredPostProgram;
|
||||
LLGLSLShader gDeferredCoFProgram;
|
||||
LLGLSLShader gDeferredDoFCombineProgram;
|
||||
LLGLSLShader gDeferredPostTonemapProgram;
|
||||
LLGLSLShader gNoPostTonemapProgram;
|
||||
LLGLSLShader gDeferredPostGammaCorrectProgram;
|
||||
LLGLSLShader gNoPostGammaCorrectProgram;
|
||||
LLGLSLShader gLegacyPostGammaCorrectProgram;
|
||||
LLGLSLShader gExposureProgram;
|
||||
LLGLSLShader gExposureProgramNoFade;
|
||||
LLGLSLShader gLuminanceProgram;
|
||||
LLGLSLShader gFXAAProgram;
|
||||
LLGLSLShader gFXAAProgram[4];
|
||||
LLGLSLShader gSMAAEdgeDetectProgram[4];
|
||||
LLGLSLShader gSMAABlendWeightsProgram[4];
|
||||
LLGLSLShader gSMAANeighborhoodBlendProgram[4];
|
||||
LLGLSLShader gCASProgram;
|
||||
LLGLSLShader gDeferredPostNoDoFProgram;
|
||||
LLGLSLShader gDeferredPostNoDoFNoiseProgram;
|
||||
LLGLSLShader gDeferredWLSkyProgram;
|
||||
LLGLSLShader gEnvironmentMapProgram;
|
||||
LLGLSLShader gDeferredWLCloudProgram;
|
||||
|
|
@ -427,8 +432,9 @@ void LLViewerShaderMgr::finalizeShaderList()
|
|||
mShaderList.push_back(&gDeferredWLSunProgram);
|
||||
mShaderList.push_back(&gDeferredPBRAlphaProgram);
|
||||
mShaderList.push_back(&gHUDPBRAlphaProgram);
|
||||
mShaderList.push_back(&gDeferredPostTonemapProgram);
|
||||
mShaderList.push_back(&gNoPostTonemapProgram);
|
||||
mShaderList.push_back(&gDeferredPostGammaCorrectProgram); // for gamma
|
||||
mShaderList.push_back(&gNoPostGammaCorrectProgram);
|
||||
mShaderList.push_back(&gLegacyPostGammaCorrectProgram);
|
||||
mShaderList.push_back(&gDeferredDiffuseProgram);
|
||||
mShaderList.push_back(&gDeferredBumpProgram);
|
||||
|
|
@ -1102,9 +1108,17 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gExposureProgramNoFade.unload();
|
||||
gLuminanceProgram.unload();
|
||||
gDeferredPostGammaCorrectProgram.unload();
|
||||
gNoPostGammaCorrectProgram.unload();
|
||||
gLegacyPostGammaCorrectProgram.unload();
|
||||
gFXAAProgram.unload();
|
||||
gDeferredPostTonemapProgram.unload();
|
||||
gNoPostTonemapProgram.unload();
|
||||
for (auto i = 0; i < 4; ++i)
|
||||
{
|
||||
gFXAAProgram[i].unload();
|
||||
gSMAAEdgeDetectProgram[i].unload();
|
||||
gSMAABlendWeightsProgram[i].unload();
|
||||
gSMAANeighborhoodBlendProgram[i].unload();
|
||||
}
|
||||
gCASProgram.unload();
|
||||
gEnvironmentMapProgram.unload();
|
||||
gDeferredWLSkyProgram.unload();
|
||||
gDeferredWLCloudProgram.unload();
|
||||
|
|
@ -2307,21 +2321,6 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gNoPostGammaCorrectProgram.mName = "No Post Gamma Correction Post Process";
|
||||
gNoPostGammaCorrectProgram.mFeatures.hasSrgb = true;
|
||||
gNoPostGammaCorrectProgram.mFeatures.isDeferred = true;
|
||||
gNoPostGammaCorrectProgram.mShaderFiles.clear();
|
||||
gNoPostGammaCorrectProgram.clearPermutations();
|
||||
gNoPostGammaCorrectProgram.addPermutation("NO_POST", "1");
|
||||
gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
|
||||
gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER));
|
||||
gNoPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gNoPostGammaCorrectProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gLegacyPostGammaCorrectProgram.mName = "Legacy Gamma Correction Post Process";
|
||||
|
|
@ -2337,27 +2336,143 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gDeferredPostTonemapProgram.mName = "Deferred Tonemap Post Process";
|
||||
gDeferredPostTonemapProgram.mFeatures.hasSrgb = true;
|
||||
gDeferredPostTonemapProgram.mFeatures.isDeferred = true;
|
||||
gDeferredPostTonemapProgram.mShaderFiles.clear();
|
||||
gDeferredPostTonemapProgram.clearPermutations();
|
||||
gDeferredPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredTonemap.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredPostTonemapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gDeferredPostTonemapProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gNoPostTonemapProgram.mName = "No Post Tonemap Post Process";
|
||||
gNoPostTonemapProgram.mFeatures.hasSrgb = true;
|
||||
gNoPostTonemapProgram.mFeatures.isDeferred = true;
|
||||
gNoPostTonemapProgram.mShaderFiles.clear();
|
||||
gNoPostTonemapProgram.clearPermutations();
|
||||
gNoPostTonemapProgram.addPermutation("NO_POST", "1");
|
||||
gNoPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
|
||||
gNoPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredTonemap.glsl", GL_FRAGMENT_SHADER));
|
||||
gNoPostTonemapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gNoPostTonemapProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
||||
if (success && gGLManager.mGLVersion > 3.9f)
|
||||
{
|
||||
gFXAAProgram.mName = "FXAA Shader";
|
||||
gFXAAProgram.mFeatures.isDeferred = true;
|
||||
gFXAAProgram.mShaderFiles.clear();
|
||||
gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER));
|
||||
gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
if (gGLManager.mGLVersion > 3.9)
|
||||
std::vector<std::pair<std::string, std::string>> quality_levels = { {"12", "Low"},
|
||||
{"23", "Medium"},
|
||||
{"28", "High"},
|
||||
{"39", "Ultra"} };
|
||||
int i = 0;
|
||||
for (const auto& quality_pair : quality_levels)
|
||||
{
|
||||
gFXAAProgram.addPermutation("FXAA_GLSL_400", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
gFXAAProgram.addPermutation("FXAA_GLSL_130", "1");
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
gFXAAProgram[i].mName = llformat("FXAA Shader (%s)", quality_pair.second.c_str());
|
||||
gFXAAProgram[i].mFeatures.isDeferred = true;
|
||||
gFXAAProgram[i].mShaderFiles.clear();
|
||||
gFXAAProgram[i].mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER));
|
||||
gFXAAProgram[i].mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
gFXAAProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gFXAAProgram.createShader();
|
||||
llassert(success);
|
||||
gFXAAProgram[i].clearPermutations();
|
||||
gFXAAProgram[i].addPermutation("FXAA_QUALITY__PRESET", quality_pair.first);
|
||||
if (gGLManager.mGLVersion > 3.9)
|
||||
{
|
||||
gFXAAProgram[i].addPermutation("FXAA_GLSL_400", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
gFXAAProgram[i].addPermutation("FXAA_GLSL_130", "1");
|
||||
}
|
||||
|
||||
gFXAAProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gFXAAProgram[i].createShader();
|
||||
llassert(success);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
std::vector<std::pair<std::string, std::string>> quality_levels = { {"SMAA_PRESET_LOW", "Low"},
|
||||
{"SMAA_PRESET_MEDIUM", "Medium"},
|
||||
{"SMAA_PRESET_HIGH", "High"},
|
||||
{"SMAA_PRESET_ULTRA", "Ultra"} };
|
||||
int i = 0;
|
||||
for (const auto& smaa_pair : quality_levels)
|
||||
{
|
||||
std::map<std::string, std::string> defines;
|
||||
if (gGLManager.mGLVersion >= 4.f)
|
||||
defines.emplace("SMAA_GLSL_4", "1");
|
||||
else if (gGLManager.mGLVersion >= 3.1f)
|
||||
defines.emplace("SMAA_GLSL_3", "1");
|
||||
else
|
||||
defines.emplace("SMAA_GLSL_2", "1");
|
||||
defines.emplace("SMAA_PREDICATION", "0");
|
||||
defines.emplace("SMAA_REPROJECTION", "0");
|
||||
defines.emplace(smaa_pair.first, "1");
|
||||
|
||||
if (success)
|
||||
{
|
||||
gSMAAEdgeDetectProgram[i].mName = llformat("SMAA Edge Detection (%s)", smaa_pair.second.c_str());
|
||||
gSMAAEdgeDetectProgram[i].mFeatures.isDeferred = true;
|
||||
|
||||
gSMAAEdgeDetectProgram[i].clearPermutations();
|
||||
gSMAAEdgeDetectProgram[i].addPermutations(defines);
|
||||
|
||||
gSMAAEdgeDetectProgram[i].mShaderFiles.clear();
|
||||
gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAAEdgeDetectF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAAEdgeDetectV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gSMAAEdgeDetectProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gSMAAEdgeDetectProgram[i].createShader();
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gSMAABlendWeightsProgram[i].mName = llformat("SMAA Blending Weights (%s)", smaa_pair.second.c_str());
|
||||
gSMAABlendWeightsProgram[i].mFeatures.isDeferred = true;
|
||||
|
||||
gSMAABlendWeightsProgram[i].clearPermutations();
|
||||
gSMAABlendWeightsProgram[i].addPermutations(defines);
|
||||
|
||||
gSMAABlendWeightsProgram[i].mShaderFiles.clear();
|
||||
gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAABlendWeightsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAABlendWeightsV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gSMAABlendWeightsProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gSMAABlendWeightsProgram[i].createShader();
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gSMAANeighborhoodBlendProgram[i].mName = llformat("SMAA Neighborhood Blending (%s)", smaa_pair.second.c_str());
|
||||
gSMAANeighborhoodBlendProgram[i].mFeatures.isDeferred = true;
|
||||
|
||||
gSMAANeighborhoodBlendProgram[i].clearPermutations();
|
||||
gSMAANeighborhoodBlendProgram[i].addPermutations(defines);
|
||||
|
||||
gSMAANeighborhoodBlendProgram[i].mShaderFiles.clear();
|
||||
gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAANeighborhoodBlendF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAANeighborhoodBlendV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gSMAANeighborhoodBlendProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gSMAANeighborhoodBlendProgram[i].createShader();
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
|
|
@ -2419,6 +2534,22 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gDeferredPostNoDoFNoiseProgram.mName = "Deferred Post NoDoF Noise Shader";
|
||||
gDeferredPostNoDoFNoiseProgram.mFeatures.isDeferred = true;
|
||||
gDeferredPostNoDoFNoiseProgram.mShaderFiles.clear();
|
||||
gDeferredPostNoDoFNoiseProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredPostNoDoFNoiseProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
gDeferredPostNoDoFNoiseProgram.clearPermutations();
|
||||
gDeferredPostNoDoFNoiseProgram.addPermutation("HAS_NOISE", "1");
|
||||
|
||||
gDeferredPostNoDoFNoiseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gDeferredPostNoDoFNoiseProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gEnvironmentMapProgram.mName = "Environment Map Program";
|
||||
|
|
|
|||
|
|
@ -245,12 +245,17 @@ extern LLGLSLShader gDeferredShadowFullbrightAlphaMaskProgram;
|
|||
extern LLGLSLShader gDeferredPostProgram;
|
||||
extern LLGLSLShader gDeferredCoFProgram;
|
||||
extern LLGLSLShader gDeferredDoFCombineProgram;
|
||||
extern LLGLSLShader gFXAAProgram;
|
||||
extern LLGLSLShader gFXAAProgram[4];
|
||||
extern LLGLSLShader gSMAAEdgeDetectProgram[4];
|
||||
extern LLGLSLShader gSMAABlendWeightsProgram[4];
|
||||
extern LLGLSLShader gSMAANeighborhoodBlendProgram[4];
|
||||
extern LLGLSLShader gCASProgram;
|
||||
extern LLGLSLShader gDeferredPostNoDoFProgram;
|
||||
extern LLGLSLShader gDeferredPostNoDoFNoiseProgram;
|
||||
extern LLGLSLShader gDeferredPostGammaCorrectProgram;
|
||||
extern LLGLSLShader gNoPostGammaCorrectProgram;
|
||||
extern LLGLSLShader gLegacyPostGammaCorrectProgram;
|
||||
extern LLGLSLShader gDeferredPostTonemapProgram;
|
||||
extern LLGLSLShader gNoPostTonemapProgram;
|
||||
extern LLGLSLShader gExposureProgram;
|
||||
extern LLGLSLShader gExposureProgramNoFade;
|
||||
extern LLGLSLShader gLuminanceProgram;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "pipeline.h"
|
||||
|
||||
// library includes
|
||||
#include "llimagepng.h"
|
||||
#include "llaudioengine.h" // For debugging.
|
||||
#include "llerror.h"
|
||||
#include "llviewercontrol.h"
|
||||
|
|
@ -117,6 +118,9 @@
|
|||
#include "llenvironment.h"
|
||||
#include "llsettingsvo.h"
|
||||
|
||||
#include "SMAAAreaTex.h"
|
||||
#include "SMAASearchTex.h"
|
||||
|
||||
#ifndef LL_WINDOWS
|
||||
#define A_GCC 1
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
|
@ -135,7 +139,7 @@ bool gShiftFrame = false;
|
|||
bool LLPipeline::WindLightUseAtmosShaders;
|
||||
bool LLPipeline::RenderDeferred;
|
||||
F32 LLPipeline::RenderDeferredSunWash;
|
||||
U32 LLPipeline::RenderFSAASamples;
|
||||
U32 LLPipeline::RenderFSAAType;
|
||||
U32 LLPipeline::RenderResolutionDivisor;
|
||||
bool LLPipeline::RenderUIBuffer;
|
||||
S32 LLPipeline::RenderShadowDetail;
|
||||
|
|
@ -280,6 +284,7 @@ static LLStaticHashedString sDelta("delta");
|
|||
static LLStaticHashedString sDistFactor("dist_factor");
|
||||
static LLStaticHashedString sKern("kern");
|
||||
static LLStaticHashedString sKernScale("kern_scale");
|
||||
static LLStaticHashedString sSmaaRTMetrics("SMAA_RT_METRICS");
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
|
|
@ -498,7 +503,7 @@ void LLPipeline::init()
|
|||
// DEPRECATED -- connectRefreshCachedSettingsSafe("WindLightUseAtmosShaders");
|
||||
// DEPRECATED -- connectRefreshCachedSettingsSafe("RenderDeferred");
|
||||
connectRefreshCachedSettingsSafe("RenderDeferredSunWash");
|
||||
connectRefreshCachedSettingsSafe("RenderFSAASamples");
|
||||
connectRefreshCachedSettingsSafe("RenderFSAAType");
|
||||
connectRefreshCachedSettingsSafe("RenderResolutionDivisor");
|
||||
connectRefreshCachedSettingsSafe("RenderUIBuffer");
|
||||
connectRefreshCachedSettingsSafe("RenderShadowDetail");
|
||||
|
|
@ -736,40 +741,26 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
|
|||
// refresh cached settings here to protect against inconsistent event handling order
|
||||
refreshCachedSettings();
|
||||
|
||||
U32 samples = RenderFSAASamples;
|
||||
|
||||
eFBOStatus ret = FBO_SUCCESS_FULLRES;
|
||||
if (!allocateScreenBuffer(resX, resY, samples))
|
||||
if (!allocateScreenBufferInternal(resX, resY))
|
||||
{
|
||||
//failed to allocate at requested specification, return false
|
||||
ret = FBO_FAILURE;
|
||||
|
||||
releaseScreenBuffers();
|
||||
//reduce number of samples
|
||||
while (samples > 0)
|
||||
{
|
||||
samples /= 2;
|
||||
if (allocateScreenBuffer(resX, resY, samples))
|
||||
{ //success
|
||||
return FBO_SUCCESS_LOWRES;
|
||||
}
|
||||
releaseScreenBuffers();
|
||||
}
|
||||
|
||||
samples = 0;
|
||||
|
||||
//reduce resolution
|
||||
while (resY > 0 && resX > 0)
|
||||
{
|
||||
resY /= 2;
|
||||
if (allocateScreenBuffer(resX, resY, samples))
|
||||
if (allocateScreenBufferInternal(resX, resY))
|
||||
{
|
||||
return FBO_SUCCESS_LOWRES;
|
||||
}
|
||||
releaseScreenBuffers();
|
||||
|
||||
resX /= 2;
|
||||
if (allocateScreenBuffer(resX, resY, samples))
|
||||
if (allocateScreenBufferInternal(resX, resY))
|
||||
{
|
||||
return FBO_SUCCESS_LOWRES;
|
||||
}
|
||||
|
|
@ -782,7 +773,7 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
|
||||
if (mRT == &mMainRT)
|
||||
|
|
@ -797,14 +788,14 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||
|
||||
mRT = &mAuxillaryRT;
|
||||
U32 res = mReflectionMapManager.mProbeResolution * 4; //multiply by 4 because probes will be 16x super sampled
|
||||
allocateScreenBuffer(res, res, samples);
|
||||
allocateScreenBufferInternal(res, res);
|
||||
|
||||
if (RenderMirrors)
|
||||
{
|
||||
mHeroProbeManager.initReflectionMaps();
|
||||
res = mHeroProbeManager.mProbeResolution; // We also scale the hero probe RT to the probe res since we don't super sample it.
|
||||
mRT = &mHeroProbeRT;
|
||||
allocateScreenBuffer(res, res, samples);
|
||||
allocateScreenBufferInternal(res, res);
|
||||
}
|
||||
|
||||
mRT = &mMainRT;
|
||||
|
|
@ -836,8 +827,8 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||
|
||||
mRT->deferredScreen.shareDepthBuffer(mRT->screen);
|
||||
|
||||
if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0)
|
||||
{ //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa
|
||||
if (shadow_detail > 0 || ssao || RenderDepthOfField)
|
||||
{ //only need mRT->deferredLight for shadows OR ssao OR dof
|
||||
if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false;
|
||||
}
|
||||
else
|
||||
|
|
@ -857,13 +848,18 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||
}
|
||||
}
|
||||
|
||||
if (samples > 0)
|
||||
if (RenderFSAAType > 0)
|
||||
{
|
||||
if (!mFXAAMap.allocate(resX, resY, GL_RGBA)) return false;
|
||||
if (RenderFSAAType == 2)
|
||||
{
|
||||
if (!mSMAABlendBuffer.allocate(resX, resY, GL_RGBA, false)) return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mFXAAMap.release();
|
||||
mSMAABlendBuffer.release();
|
||||
}
|
||||
|
||||
//water reflection texture (always needed as scratch space whether or not transparent water is enabled)
|
||||
|
|
@ -878,9 +874,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||
mSceneMap.release();
|
||||
}
|
||||
|
||||
const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR");
|
||||
const U32 post_color_fmt = post_hdr ? GL_RGBA16F : GL_RGBA;
|
||||
mPostMap.allocate(resX, resY, post_color_fmt);
|
||||
mPostMap.allocate(resX, resY, GL_RGBA16F);
|
||||
|
||||
// used to scale down textures
|
||||
// See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
|
||||
|
|
@ -1015,7 +1009,7 @@ void LLPipeline::refreshCachedSettings()
|
|||
WindLightUseAtmosShaders = true; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders");
|
||||
RenderDeferred = true; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred");
|
||||
RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
|
||||
RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0;
|
||||
RenderFSAAType = gSavedSettings.getU32("RenderFSAAType");
|
||||
RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
|
||||
RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer");
|
||||
RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail");
|
||||
|
|
@ -1119,6 +1113,18 @@ void LLPipeline::releaseGLBuffers()
|
|||
mTrueNoiseMap = 0;
|
||||
}
|
||||
|
||||
if (mSMAAAreaMap)
|
||||
{
|
||||
LLImageGL::deleteTextures(1, &mSMAAAreaMap);
|
||||
mSMAAAreaMap = 0;
|
||||
}
|
||||
|
||||
if (mSMAASearchMap)
|
||||
{
|
||||
LLImageGL::deleteTextures(1, &mSMAASearchMap);
|
||||
mSMAASearchMap = 0;
|
||||
}
|
||||
|
||||
releaseLUTBuffers();
|
||||
|
||||
mWaterDis.release();
|
||||
|
|
@ -1268,6 +1274,77 @@ void LLPipeline::createGLBuffers()
|
|||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
|
||||
if (!mSMAAAreaMap)
|
||||
{
|
||||
std::vector<U8> tempBuffer(AREATEX_SIZE);
|
||||
for (U32 y = 0; y < AREATEX_HEIGHT; y++)
|
||||
{
|
||||
U32 srcY = AREATEX_HEIGHT - 1 - y;
|
||||
// unsigned int srcY = y;
|
||||
memcpy(&tempBuffer[y * AREATEX_PITCH], areaTexBytes + srcY * AREATEX_PITCH, AREATEX_PITCH);
|
||||
}
|
||||
|
||||
LLImageGL::generateTextures(1, &mSMAAAreaMap);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mSMAAAreaMap);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RG8, AREATEX_WIDTH, AREATEX_HEIGHT, GL_RG,
|
||||
GL_UNSIGNED_BYTE, tempBuffer.data(), false);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
|
||||
if (!mSMAASearchMap)
|
||||
{
|
||||
std::vector<U8> tempBuffer(SEARCHTEX_SIZE);
|
||||
for (U32 y = 0; y < SEARCHTEX_HEIGHT; y++)
|
||||
{
|
||||
U32 srcY = SEARCHTEX_HEIGHT - 1 - y;
|
||||
// unsigned int srcY = y;
|
||||
memcpy(&tempBuffer[y * SEARCHTEX_PITCH], searchTexBytes + srcY * SEARCHTEX_PITCH, SEARCHTEX_PITCH);
|
||||
}
|
||||
|
||||
LLImageGL::generateTextures(1, &mSMAASearchMap);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mSMAASearchMap);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R8, SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT,
|
||||
GL_RED, GL_UNSIGNED_BYTE, tempBuffer.data(), false);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
|
||||
if (!mSMAASampleMap)
|
||||
{
|
||||
LLPointer<LLImageRaw> raw_image = new LLImageRaw;
|
||||
LLPointer<LLImagePNG> png_image = new LLImagePNG;
|
||||
static LLCachedControl<std::string> sample_path(gSavedSettings, "SamplePath", "");
|
||||
if (gDirUtilp->fileExists(sample_path()) && png_image->load(sample_path()) && png_image->decode(raw_image, 0.0f))
|
||||
{
|
||||
U32 format = 0;
|
||||
switch (raw_image->getComponents())
|
||||
{
|
||||
case 1:
|
||||
format = GL_RED;
|
||||
break;
|
||||
case 2:
|
||||
format = GL_RG;
|
||||
break;
|
||||
case 3:
|
||||
format = GL_RGB;
|
||||
break;
|
||||
case 4:
|
||||
format = GL_RGBA;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
};
|
||||
LLImageGL::generateTextures(1, &mSMAASampleMap);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mSMAASampleMap);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB, raw_image->getWidth(),
|
||||
raw_image->getHeight(), format, GL_UNSIGNED_BYTE, raw_image->getData(), false);
|
||||
stop_glerror();
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
}
|
||||
|
||||
createLUTBuffers();
|
||||
|
||||
gBumpImageList.restoreGL();
|
||||
|
|
@ -6975,11 +7052,12 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
|
|||
|
||||
extern LLPointer<LLImageGL> gEXRImage;
|
||||
|
||||
void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
|
||||
void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
|
||||
{
|
||||
dst->bindTarget();
|
||||
// gamma correct lighting
|
||||
{
|
||||
LL_PROFILE_GPU_ZONE("gamma correct");
|
||||
LL_PROFILE_GPU_ZONE("tonemap");
|
||||
|
||||
static LLCachedControl<bool> buildNoPost(gSavedSettings, "RenderDisablePostProcessing", false);
|
||||
|
||||
|
|
@ -6992,9 +7070,7 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
|
|||
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
|
||||
|
||||
bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools->isAvailable());
|
||||
LLGLSLShader& shader = no_post ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping)
|
||||
psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? gLegacyPostGammaCorrectProgram :
|
||||
gDeferredPostGammaCorrectProgram;
|
||||
LLGLSLShader& shader = no_post ? gNoPostTonemapProgram : gDeferredPostTonemapProgram;
|
||||
|
||||
shader.bind();
|
||||
|
||||
|
|
@ -7025,6 +7101,34 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
|
|||
dst->flush();
|
||||
}
|
||||
|
||||
void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst)
|
||||
{
|
||||
dst->bindTarget();
|
||||
// gamma correct lighting
|
||||
{
|
||||
LL_PROFILE_GPU_ZONE("gamma correct");
|
||||
|
||||
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
|
||||
|
||||
static LLCachedControl<bool> buildNoPost(gSavedSettings, "RenderDisablePostProcessing", false);
|
||||
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
|
||||
|
||||
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
|
||||
LLGLSLShader& shader = psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? gLegacyPostGammaCorrectProgram :
|
||||
gDeferredPostGammaCorrectProgram;
|
||||
|
||||
shader.bind();
|
||||
shader.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT);
|
||||
shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)src->getWidth(), (GLfloat)src->getHeight());
|
||||
|
||||
mScreenTriangleVB->setBuffer();
|
||||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
||||
shader.unbind();
|
||||
}
|
||||
dst->flush();
|
||||
}
|
||||
|
||||
void LLPipeline::copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* dst)
|
||||
{
|
||||
|
||||
|
|
@ -7211,18 +7315,19 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
|
|||
{
|
||||
{
|
||||
llassert(!gCubeSnapshot);
|
||||
bool multisample = RenderFSAASamples > 1 && mFXAAMap.isComplete();
|
||||
bool multisample = RenderFSAAType == 1 && mFXAAMap.isComplete();
|
||||
LLGLSLShader* shader = &gGlowCombineProgram;
|
||||
|
||||
S32 width = dst->getWidth();
|
||||
S32 height = dst->getHeight();
|
||||
|
||||
// Present everything.
|
||||
if (multisample)
|
||||
{
|
||||
LL_PROFILE_GPU_ZONE("aa");
|
||||
S32 width = dst->getWidth();
|
||||
S32 height = dst->getHeight();
|
||||
|
||||
// bake out texture2D with RGBL for FXAA shader
|
||||
mFXAAMap.bindTarget();
|
||||
mFXAAMap.clear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
shader = &gGlowCombineFXAAProgram;
|
||||
shader->bind();
|
||||
|
|
@ -7245,7 +7350,11 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
|
|||
mFXAAMap.flush();
|
||||
|
||||
dst->bindTarget();
|
||||
shader = &gFXAAProgram;
|
||||
|
||||
static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
|
||||
U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
|
||||
|
||||
shader = &gFXAAProgram[fsaa_quality];
|
||||
shader->bind();
|
||||
|
||||
channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage());
|
||||
|
|
@ -7288,6 +7397,187 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
|
|||
}
|
||||
}
|
||||
|
||||
void LLPipeline::generateSMAABuffers(LLRenderTarget* src)
|
||||
{
|
||||
llassert(!gCubeSnapshot);
|
||||
bool multisample = RenderFSAAType == 2 && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete();
|
||||
|
||||
// Present everything.
|
||||
if (multisample)
|
||||
{
|
||||
LL_PROFILE_GPU_ZONE("aa");
|
||||
static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
|
||||
U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
|
||||
|
||||
S32 width = src->getWidth();
|
||||
S32 height = src->getHeight();
|
||||
|
||||
float rt_metrics[] = { 1.f / width, 1.f / height, (float)width, (float)height };
|
||||
|
||||
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
|
||||
|
||||
static LLCachedControl<bool> use_sample(gSavedSettings, "RenderSMAAUseSample", false);
|
||||
//static LLCachedControl<bool> use_stencil(gSavedSettings, "RenderSMAAUseStencil", true);
|
||||
{
|
||||
//LLGLState stencil(GL_STENCIL_TEST, use_stencil);
|
||||
|
||||
// Bind setup:
|
||||
LLRenderTarget& dest = mFXAAMap;
|
||||
LLGLSLShader& edge_shader = gSMAAEdgeDetectProgram[fsaa_quality];
|
||||
|
||||
dest.bindTarget();
|
||||
dest.clear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
edge_shader.bind();
|
||||
edge_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics);
|
||||
|
||||
S32 channel = edge_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
|
||||
if (channel > -1)
|
||||
{
|
||||
if (!use_sample)
|
||||
{
|
||||
src->bindTexture(0, channel, LLTexUnit::TFO_POINT);
|
||||
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mSMAASampleMap);
|
||||
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
}
|
||||
|
||||
//if (use_stencil)
|
||||
//{
|
||||
// glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
// glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
// glStencilMask(0xFF);
|
||||
//}
|
||||
mScreenTriangleVB->setBuffer();
|
||||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
||||
edge_shader.unbind();
|
||||
dest.flush();
|
||||
|
||||
gGL.getTexUnit(channel)->unbindFast(LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
|
||||
{
|
||||
//LLGLState stencil(GL_STENCIL_TEST, use_stencil);
|
||||
|
||||
// Bind setup:
|
||||
LLRenderTarget& dest = mSMAABlendBuffer;
|
||||
LLGLSLShader& blend_weights_shader = gSMAABlendWeightsProgram[fsaa_quality];
|
||||
|
||||
dest.bindTarget();
|
||||
dest.clear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
blend_weights_shader.bind();
|
||||
blend_weights_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics);
|
||||
|
||||
S32 edge_tex_channel = blend_weights_shader.enableTexture(LLShaderMgr::SMAA_EDGE_TEX, mFXAAMap.getUsage());
|
||||
if (edge_tex_channel > -1)
|
||||
{
|
||||
mFXAAMap.bindTexture(0, edge_tex_channel, LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(edge_tex_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
S32 area_tex_channel = blend_weights_shader.enableTexture(LLShaderMgr::SMAA_AREA_TEX, LLTexUnit::TT_TEXTURE);
|
||||
if (area_tex_channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(area_tex_channel)->bindManual(LLTexUnit::TT_TEXTURE, mSMAAAreaMap);
|
||||
gGL.getTexUnit(area_tex_channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(area_tex_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
S32 search_tex_channel = blend_weights_shader.enableTexture(LLShaderMgr::SMAA_SEARCH_TEX, LLTexUnit::TT_TEXTURE);
|
||||
if (search_tex_channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(search_tex_channel)->bindManual(LLTexUnit::TT_TEXTURE, mSMAASearchMap);
|
||||
gGL.getTexUnit(search_tex_channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(search_tex_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
|
||||
//if (use_stencil)
|
||||
//{
|
||||
// glStencilFunc(GL_EQUAL, 1, 0xFF);
|
||||
// glStencilMask(0x00);
|
||||
//}
|
||||
mScreenTriangleVB->setBuffer();
|
||||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
//if (use_stencil)
|
||||
//{
|
||||
// glStencilFunc(GL_ALWAYS, 0, 0xFF);
|
||||
//}
|
||||
blend_weights_shader.unbind();
|
||||
dest.flush();
|
||||
gGL.getTexUnit(edge_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(area_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(search_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst)
|
||||
{
|
||||
llassert(!gCubeSnapshot);
|
||||
bool multisample = RenderFSAAType == 2 && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete();
|
||||
|
||||
// Present everything.
|
||||
if (multisample)
|
||||
{
|
||||
LL_PROFILE_GPU_ZONE("aa");
|
||||
static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
|
||||
U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
|
||||
|
||||
S32 width = src->getWidth();
|
||||
S32 height = src->getHeight();
|
||||
|
||||
float rt_metrics[] = { 1.f / width, 1.f / height, (float)width, (float)height };
|
||||
|
||||
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
|
||||
|
||||
static LLCachedControl<bool> use_sample(gSavedSettings, "RenderSMAAUseSample", false);
|
||||
//static LLCachedControl<bool> use_stencil(gSavedSettings, "RenderSMAAUseStencil", true);
|
||||
|
||||
{
|
||||
//LLGLDisable stencil(GL_STENCIL_TEST);
|
||||
|
||||
// Bind setup:
|
||||
LLRenderTarget* bound_target = dst;
|
||||
LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality];
|
||||
|
||||
bound_target->bindTarget();
|
||||
bound_target->clear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
blend_shader.bind();
|
||||
blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics);
|
||||
|
||||
S32 diffuse_channel = blend_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE);
|
||||
if(diffuse_channel > -1)
|
||||
{
|
||||
src->bindTexture(0, diffuse_channel, LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
|
||||
S32 blend_channel = blend_shader.enableTexture(LLShaderMgr::SMAA_BLEND_TEX);
|
||||
if (blend_channel > -1)
|
||||
{
|
||||
mSMAABlendBuffer.bindTexture(0, blend_channel, LLTexUnit::TFO_BILINEAR);
|
||||
}
|
||||
|
||||
mScreenTriangleVB->setBuffer();
|
||||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
||||
bound_target->flush();
|
||||
blend_shader.unbind();
|
||||
gGL.getTexUnit(diffuse_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(blend_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
copyRenderTarget(src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPipeline::copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst)
|
||||
{
|
||||
|
||||
|
|
@ -7496,18 +7786,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
|
|||
{ // combine result based on alpha
|
||||
|
||||
dst->bindTarget();
|
||||
if (RenderFSAASamples > 1 && mFXAAMap.isComplete())
|
||||
{
|
||||
glViewport(0, 0, dst->getWidth(), dst->getHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
|
||||
gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
|
||||
gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
|
||||
gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
|
||||
glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
|
||||
}
|
||||
glViewport(0, 0, dst->getWidth(), dst->getHeight());
|
||||
|
||||
gDeferredDoFCombineProgram.bind();
|
||||
gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
|
||||
|
|
@ -7555,20 +7834,27 @@ void LLPipeline::renderFinalize()
|
|||
gGL.setColorMask(true, true);
|
||||
glClearColor(0, 0, 0, 0);
|
||||
|
||||
|
||||
copyScreenSpaceReflections(&mRT->screen, &mSceneMap);
|
||||
|
||||
generateLuminance(&mRT->screen, &mLuminanceMap);
|
||||
|
||||
generateExposure(&mLuminanceMap, &mExposureMap);
|
||||
|
||||
tonemap(&mRT->screen, &mPostMap);
|
||||
|
||||
applyCAS(&mPostMap, &mRT->screen);
|
||||
|
||||
generateSMAABuffers(&mRT->screen);
|
||||
|
||||
gammaCorrect(&mRT->screen, &mPostMap);
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
generateGlow(&mPostMap);
|
||||
applySMAA(&mPostMap, &mRT->screen);
|
||||
|
||||
combineGlow(&mPostMap, &mRT->screen);
|
||||
generateGlow(&mRT->screen);
|
||||
|
||||
combineGlow(&mRT->screen, &mPostMap);
|
||||
|
||||
gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
|
||||
gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
|
||||
|
|
@ -7576,15 +7862,19 @@ void LLPipeline::renderFinalize()
|
|||
gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
|
||||
glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
|
||||
|
||||
applyCAS(&mRT->screen, &mPostMap);
|
||||
|
||||
renderDoF(&mPostMap, &mRT->screen);
|
||||
|
||||
applyFXAA(&mRT->screen, &mPostMap);
|
||||
LLRenderTarget* finalBuffer = &mPostMap;
|
||||
LLRenderTarget* finalBuffer = &mRT->screen;
|
||||
static LLCachedControl<U32> aa_type(gSavedSettings, "RenderFSAAType", 2U);
|
||||
if (RenderFSAAType == 1)
|
||||
{
|
||||
applyFXAA(&mRT->screen, &mPostMap);
|
||||
finalBuffer = &mPostMap;
|
||||
}
|
||||
|
||||
if (RenderBufferVisualization > -1)
|
||||
{
|
||||
finalBuffer = &mRT->screen;
|
||||
finalBuffer = &mPostMap;
|
||||
switch (RenderBufferVisualization)
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -7595,6 +7885,22 @@ void LLPipeline::renderFinalize()
|
|||
break;
|
||||
case 4:
|
||||
visualizeBuffers(&mLuminanceMap, finalBuffer, 0);
|
||||
case 5:
|
||||
{
|
||||
if (RenderFSAAType > 0)
|
||||
{
|
||||
visualizeBuffers(&mFXAAMap, finalBuffer, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
if (RenderFSAAType == 2)
|
||||
{
|
||||
visualizeBuffers(&mSMAABlendBuffer, finalBuffer, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -7602,11 +7908,11 @@ void LLPipeline::renderFinalize()
|
|||
|
||||
// Present the screen target.
|
||||
|
||||
gDeferredPostNoDoFProgram.bind();
|
||||
gDeferredPostNoDoFNoiseProgram.bind(); // Add noise as part of final render to screen pass to avoid damaging other post effects
|
||||
|
||||
// Whatever is last in the above post processing chain should _always_ be rendered directly here. If not, expect problems.
|
||||
gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, finalBuffer);
|
||||
gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
|
||||
gDeferredPostNoDoFNoiseProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, finalBuffer);
|
||||
gDeferredPostNoDoFNoiseProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
|
||||
|
||||
{
|
||||
LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
|
||||
|
|
@ -7614,7 +7920,7 @@ void LLPipeline::renderFinalize()
|
|||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
gDeferredPostNoDoFProgram.unbind();
|
||||
gDeferredPostNoDoFNoiseProgram.unbind();
|
||||
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
|
||||
//attempt to allocate screen buffers at resX, resY
|
||||
//returns true if allocation successful, false otherwise
|
||||
bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples);
|
||||
bool allocateScreenBufferInternal(U32 resX, U32 resY);
|
||||
bool allocateShadowBuffer(U32 resX, U32 resY);
|
||||
|
||||
// rebuild all LLVOVolume render batches
|
||||
|
|
@ -155,10 +155,13 @@ public:
|
|||
void copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void generateLuminance(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool use_history = true);
|
||||
void tonemap(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void generateGlow(LLRenderTarget* src);
|
||||
void applyCAS(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void applyFXAA(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void generateSMAABuffers(LLRenderTarget* src);
|
||||
void applySMAA(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void renderDoF(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
void combineGlow(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
|
|
@ -726,6 +729,7 @@ public:
|
|||
|
||||
// FXAA helper target
|
||||
LLRenderTarget mFXAAMap;
|
||||
LLRenderTarget mSMAABlendBuffer;
|
||||
|
||||
// render ui to buffer target
|
||||
LLRenderTarget mUIScreen;
|
||||
|
|
@ -782,6 +786,11 @@ public:
|
|||
U32 mTrueNoiseMap;
|
||||
U32 mLightFunc;
|
||||
|
||||
//smaa
|
||||
U32 mSMAAAreaMap = 0;
|
||||
U32 mSMAASearchMap = 0;
|
||||
U32 mSMAASampleMap = 0;
|
||||
|
||||
LLColor4 mSunDiffuse;
|
||||
LLColor4 mMoonDiffuse;
|
||||
LLVector4 mSunDir;
|
||||
|
|
@ -989,7 +998,7 @@ public:
|
|||
static bool WindLightUseAtmosShaders;
|
||||
static bool RenderDeferred;
|
||||
static F32 RenderDeferredSunWash;
|
||||
static U32 RenderFSAASamples;
|
||||
static U32 RenderFSAAType;
|
||||
static U32 RenderResolutionDivisor;
|
||||
static bool RenderUIBuffer;
|
||||
static S32 RenderShadowDetail;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater
|
||||
height="411"
|
||||
height="430"
|
||||
layout="topleft"
|
||||
name="prefs_graphics_advanced"
|
||||
help_topic="Preferences_Graphics_Advanced"
|
||||
|
|
@ -359,7 +359,41 @@
|
|||
name="use HiDPI"
|
||||
tool_tip="Enable OpenGL for High-Resolution Drawing."
|
||||
width="315" />
|
||||
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="20"
|
||||
layout="topleft"
|
||||
left="30"
|
||||
name="antialiasing label"
|
||||
top_delta="20"
|
||||
width="120">
|
||||
Antialiasing:
|
||||
</text>
|
||||
<combo_box
|
||||
control_name="RenderFSAAType"
|
||||
height="20"
|
||||
initial_value="false"
|
||||
label="Antialiasing"
|
||||
layout="topleft"
|
||||
left_pad="40"
|
||||
name="fsaa"
|
||||
top_delta="0"
|
||||
width="90">
|
||||
<combo_box.item
|
||||
label="Disabled"
|
||||
name="FSAADisabled"
|
||||
value="0" />
|
||||
<combo_box.item
|
||||
label="FXAA"
|
||||
name="FXAA"
|
||||
value="1" />
|
||||
<combo_box.item
|
||||
label="SMAA"
|
||||
name="SMAA"
|
||||
value="2" />
|
||||
</combo_box>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
|
|
@ -367,10 +401,10 @@
|
|||
height="20"
|
||||
layout="topleft"
|
||||
left="30"
|
||||
name="antialiasing label"
|
||||
name="antialiasing quality label"
|
||||
top_delta="20"
|
||||
width="100">
|
||||
Antialiasing:
|
||||
width="120">
|
||||
Antialiasing Quality:
|
||||
</text>
|
||||
<combo_box
|
||||
control_name="RenderFSAASamples"
|
||||
|
|
@ -379,17 +413,25 @@
|
|||
label="Antialiasing"
|
||||
layout="topleft"
|
||||
left_pad="40"
|
||||
name="fsaa"
|
||||
name="fsaa quality"
|
||||
top_delta="0"
|
||||
width="90">
|
||||
<combo_box.item
|
||||
label="Disabled"
|
||||
name="FSAADisabled"
|
||||
label="Low"
|
||||
name="Low"
|
||||
value="0" />
|
||||
<combo_box.item
|
||||
label="FXAA"
|
||||
name="FXAA"
|
||||
label="Medium"
|
||||
name="Medium"
|
||||
value="1" />
|
||||
<combo_box.item
|
||||
label="High"
|
||||
name="High"
|
||||
value="2" />
|
||||
<combo_box.item
|
||||
label="Ultra"
|
||||
name="Ultra"
|
||||
value="3" />
|
||||
</combo_box>
|
||||
<text
|
||||
type="string"
|
||||
|
|
@ -545,7 +587,7 @@
|
|||
</text>
|
||||
<view_border
|
||||
bevel_style="in"
|
||||
height="357"
|
||||
height="377"
|
||||
layout="topleft"
|
||||
left="385"
|
||||
name="vert_border"
|
||||
|
|
@ -908,7 +950,7 @@
|
|||
layout="topleft"
|
||||
left="13"
|
||||
name="horiz_border"
|
||||
top="373"
|
||||
top="393"
|
||||
top_delta="5"
|
||||
width="774"/>
|
||||
<button
|
||||
|
|
|
|||
Loading…
Reference in New Issue