summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-02-03 19:45:31 -0600
committerDave Parks <davep@lindenlab.com>2023-02-03 19:45:31 -0600
commit1c2410b8af62254e96d60b2ae2e411d4756215e4 (patch)
treec702253a1458a34dfa4149717948a3413dc017f7 /indra/llrender
parenteb341f856cb55155cce5e6749cef44707badb137 (diff)
SL-19148 Decruft followthrough -- decruft shader tree and some remaining forward rendering code.
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llglslshader.cpp1
-rw-r--r--indra/llrender/llglslshader.h1
-rw-r--r--indra/llrender/llpostprocess.cpp132
-rw-r--r--indra/llrender/llshadermgr.cpp31
4 files changed, 22 insertions, 143 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 1e3f539c81..6b56c23fcd 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -99,7 +99,6 @@ LLShaderFeatures::LLShaderFeatures()
, encodesNormal(false)
, isDeferred(false)
, hasScreenSpaceReflections(false)
- , hasIndirect(false)
, hasShadows(false)
, hasAmbientOcclusion(false)
, mIndexedTextureChannels(0)
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index f7bba35758..edf7b59491 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -54,7 +54,6 @@ public:
bool encodesNormal; // include: shaders\class1\environment\encodeNormF.glsl
bool isDeferred;
bool hasScreenSpaceReflections;
- bool hasIndirect;
S32 mIndexedTextureChannels;
bool disableTextureIndex;
bool hasAlphaMask;
diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp
index f1e5b71207..0f8655132b 100644
--- a/indra/llrender/llpostprocess.cpp
+++ b/indra/llrender/llpostprocess.cpp
@@ -230,35 +230,7 @@ void LLPostProcess::applyShaders(void)
void LLPostProcess::applyColorFilterShader(void)
{
- /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.
- gPostColorFilterProgram.bind();
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE);
-
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture);
-
- getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject);
- glUniform1i(colorFilterUniforms["RenderTexture"], 0);
- glUniform1f(colorFilterUniforms["brightness"], tweaks.getBrightness());
- glUniform1f(colorFilterUniforms["contrast"], tweaks.getContrast());
- float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f;
- baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI);
- float baseR = tweaks.getContrastBaseR() * baseI;
- float baseG = tweaks.getContrastBaseG() * baseI;
- float baseB = tweaks.getContrastBaseB() * baseI;
- glUniform3f(colorFilterUniforms["contrastBase"], baseR, baseG, baseB);
- glUniform1f(colorFilterUniforms["saturation"], tweaks.getSaturation());
- glUniform3f(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
- LLGLEnable blend(GL_BLEND);
- gGL.setSceneBlendType(LLRender::BT_REPLACE);
- LLGLDepthTest depth(GL_FALSE);
-
- /// Draw a screen space quad
- drawOrthoQuad(screenW, screenH, QUAD_NORMAL);
- gPostColorFilterProgram.unbind();
- */
}
void LLPostProcess::createColorFilterShader(void)
@@ -274,40 +246,7 @@ void LLPostProcess::createColorFilterShader(void)
void LLPostProcess::applyNightVisionShader(void)
{
- /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.
- gPostNightVisionProgram.bind();
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE);
-
- getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject);
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture);
- glUniform1i(nightVisionUniforms["RenderTexture"], 0);
-
- gGL.getTexUnit(1)->activate();
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
-
- gGL.getTexUnit(1)->bindManual(LLTexUnit::TT_TEXTURE, noiseTexture);
- glUniform1i(nightVisionUniforms["NoiseTexture"], 1);
-
-
- glUniform1f(nightVisionUniforms["brightMult"], tweaks.getBrightMult());
- glUniform1f(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength());
- noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f);
- noiseTextureScale *= (screenH / NOISE_SIZE);
-
-
- glUniform3f(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
- LLGLEnable blend(GL_BLEND);
- gGL.setSceneBlendType(LLRender::BT_REPLACE);
- LLGLDepthTest depth(GL_FALSE);
-
- /// Draw a screen space quad
- drawOrthoQuad(screenW, screenH, QUAD_NOISE);
- gPostNightVisionProgram.unbind();
- gGL.getTexUnit(0)->activate();
- */
}
void LLPostProcess::createNightVisionShader(void)
@@ -396,78 +335,7 @@ void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned
void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type)
{
-#if 0
- float noiseX = 0.f;
- float noiseY = 0.f;
- float screenRatio = 1.0f;
-
- if (type == QUAD_NOISE){
- noiseX = ((float) rand() / (float) RAND_MAX);
- noiseY = ((float) rand() / (float) RAND_MAX);
- screenRatio = (float) width / (float) height;
- }
-
-
- glBegin(GL_QUADS);
- if (type != QUAD_BLOOM_EXTRACT){
- glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height);
- } else {
- glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height * 2.0f);
- }
- if (type == QUAD_NOISE){
- glMultiTexCoord2f(GL_TEXTURE1,
- noiseX,
- noiseTextureScale + noiseY);
- } else if (type == QUAD_BLOOM_COMBINE){
- glMultiTexCoord2f(GL_TEXTURE1, 0.f, (GLfloat) height * 0.5f);
- }
- glVertex2f(0.f, (GLfloat) screenH - height);
-
- if (type != QUAD_BLOOM_EXTRACT){
- glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f);
- } else {
- glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f);
- }
- if (type == QUAD_NOISE){
- glMultiTexCoord2f(GL_TEXTURE1,
- noiseX,
- noiseY);
- } else if (type == QUAD_BLOOM_COMBINE){
- glMultiTexCoord2f(GL_TEXTURE1, 0.f, 0.f);
- }
- glVertex2f(0.f, (GLfloat) height + (screenH - height));
-
- if (type != QUAD_BLOOM_EXTRACT){
- glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, 0.f);
- } else {
- glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, 0.f);
- }
- if (type == QUAD_NOISE){
- glMultiTexCoord2f(GL_TEXTURE1,
- screenRatio * noiseTextureScale + noiseX,
- noiseY);
- } else if (type == QUAD_BLOOM_COMBINE){
- glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, 0.f);
- }
- glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height));
-
-
- if (type != QUAD_BLOOM_EXTRACT){
- glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, (GLfloat) height);
- } else {
- glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f);
- }
- if (type == QUAD_NOISE){
- glMultiTexCoord2f(GL_TEXTURE1,
- screenRatio * noiseTextureScale + noiseX,
- noiseTextureScale + noiseY);
- } else if (type == QUAD_BLOOM_COMBINE){
- glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f);
- }
- glVertex2f((GLfloat) width, (GLfloat) screenH - height);
- glEnd();
-#endif
}
void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height)
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index e9daf7cb75..646c9a821b 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -254,14 +254,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
}
}
- if (features->hasIndirect)
- {
- if (!shader->attachFragmentObject("deferred/indirect.glsl"))
- {
- return FALSE;
- }
- }
-
if (features->hasGamma || features->isDeferred)
{
if (!shader->attachFragmentObject("windlight/gammaF.glsl"))
@@ -624,7 +616,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
*/
LL_DEBUGS("ShaderLoading") << "Looking in " << open_file_name << LL_ENDL;
- file = LLFile::fopen(open_file_name, "r"); /* Flawfinder: ignore */
+ file = LLFile::fopen(open_file_name, "r+"); /* Flawfinder: ignore */
if (file)
{
LL_DEBUGS("ShaderLoading") << "Loading file: " << open_file_name << " (Want class " << gpu_class << ")" << LL_ENDL;
@@ -875,6 +867,13 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
GLuint out_of_extra_block_counter = 0, start_shader_code = shader_code_count, file_lines_count = 0;
+#define TOUCH_SHADERS 0
+
+#if TOUCH_SHADERS
+ const char* marker = "// touched";
+ bool touched = false;
+#endif
+
while(NULL != fgets((char *)buff, 1024, file)
&& shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text)))
{
@@ -882,6 +881,13 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
bool extra_block_area_found = NULL != strstr((const char*)buff, "[EXTRA_CODE_HERE]");
+#if TOUCH_SHADERS
+ if (NULL != strstr((const char*)buff, marker))
+ {
+ touched = true;
+ }
+#endif
+
if(extra_block_area_found && !(flag_extra_block_marker_was_found & flags))
{
if(!(flag_write_to_out_of_extra_block_area & flags))
@@ -944,6 +950,13 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
extra_code_count = 0;
}
+#if TOUCH_SHADERS
+ if (!touched)
+ {
+ fprintf(file, "\n%s\n", marker);
+ }
+#endif
+
fclose(file);
//create shader object