Permalink
Browse files

Removed TT_RECT_TEXTURE and removed unnecessary shaders.

  • Loading branch information...
Shyotl committed Feb 18, 2017
1 parent 983a7e3 commit 5e501b961199c4c726417701387efa0ebb6dbb28
Showing with 334 additions and 953 deletions.
  1. +30 −17 indra/llrender/llpostprocess.cpp
  2. +0 −3 indra/llrender/llrender.cpp
  3. +0 −1 indra/llrender/llrender.h
  4. +2 −11 indra/llrender/llrendertarget.cpp
  5. +1 −4 indra/llrender/llshadermgr.cpp
  6. +1 −3 indra/llrender/llshadermgr.h
  7. +10 −12 indra/newview/app_settings/shaders/class1/deferred/SSAOF.glsl
  8. +0 −2 indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
  9. +13 −16 indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
  10. +0 −39 indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
  11. +5 −6 indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
  12. +9 −10 indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
  13. +2 −2 indra/newview/app_settings/shaders/class1/deferred/downsampleDepthNearestF.glsl
  14. +3 −2 indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
  15. +0 −39 indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
  16. +0 −45 indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
  17. +0 −2 indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
  18. +1 −2 indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
  19. +9 −11 indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
  20. +8 −11 indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
  21. +9 −13 indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
  22. +4 −5 indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
  23. +2 −3 ...settings/shaders/class1/deferred/{postDeferredGammaCorrect.glsl → postDeferredGammaCorrectF.glsl}
  24. +3 −4 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
  25. +1 −3 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
  26. +0 −44 indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
  27. +11 −14 indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
  28. +0 −40 indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
  29. +8 −11 indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
  30. +0 −2 indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl
  31. +4 −6 indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
  32. +0 −41 indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
  33. +0 −1 indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
  34. +6 −8 indra/newview/app_settings/shaders/class1/effects/MotionBlurF.glsl
  35. +2 −2 indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl
  36. +6 −8 indra/newview/app_settings/shaders/class1/effects/VignetteF.glsl
  37. +2 −2 indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
  38. +9 −19 indra/newview/app_settings/shaders/class1/effects/gaussBlurF.glsl
  39. +2 −2 indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
  40. +2 −2 indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
  41. +0 −67 indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
  42. +1 −3 indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl
  43. +2 −2 indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
  44. +2 −3 indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
  45. +2 −2 indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
  46. +0 −62 indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
  47. +38 −47 indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
  48. +57 −59 indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
  49. +0 −42 indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
  50. +11 −14 indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
  51. +4 −6 indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
  52. +6 −10 indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
  53. +0 −41 indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
  54. +1 −1 indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl
  55. +0 −8 indra/newview/lldrawpoolwater.cpp
  56. +10 −21 indra/newview/llviewershadermgr.cpp
  57. +0 −1 indra/newview/llviewershadermgr.h
  58. +33 −96 indra/newview/pipeline.cpp
  59. +2 −0 indra/newview/pipeline.h
@@ -67,9 +67,9 @@ static LLStaticHashedString sVignettRadius("vignette_radius");
static LLStaticHashedString sVignetteDarkness("vignette_darkness");
static LLStaticHashedString sVignetteDesaturation("vignette_desaturation");
static LLStaticHashedString sVignetteChromaticAberration("vignette_chromatic_aberration");
-static LLStaticHashedString sScreenRes("screen_res");
static LLStaticHashedString sHorizontalPass("horizontalPass");
+static LLStaticHashedString sKern("kern");
static LLStaticHashedString sPrevProj("prev_proj");
static LLStaticHashedString sInvProj("inv_proj");
@@ -262,7 +262,6 @@ class LLVignetteShader : public LLPostProcessSinglePassColorShader
getShader().uniform1f(sVignetteDarkness, mDarkness);
getShader().uniform1f(sVignetteDesaturation, mDesaturation);
getShader().uniform1f(sVignetteChromaticAberration, mChromaticAberration);
- getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
return QUAD_NORMAL;
}
};
@@ -284,7 +283,11 @@ class LLGaussBlurShader : public LLPostProcessShader
/*virtual*/ S32 getDepthChannel() const { return -1; }
/*virtual*/ QuadType preDraw()
{
+ LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
+
mPassLoc = getShader().getUniformLocation(sHorizontalPass);
+ LLVector4 vec[] = { LLVector4(1.3846153846, 3.2307692308, 0, 0) / screen_rect.mV[VX], LLVector4( 0,0, 1.3846153846, 3.2307692308 ) / screen_rect.mV[VY] };
+ getShader().uniform4fv(sKern, LL_ARRAY_SIZE(vec), (GLfloat*)vec);
return QUAD_NORMAL;
}
/*virtual*/ bool draw(U32 pass)
@@ -322,7 +325,6 @@ class LLMotionShader : public LLPostProcessShader
getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.getF32ptr());
getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.getF32ptr());
- getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
getShader().uniform1i(sBlurStrength, mStrength);
return QUAD_NORMAL;
@@ -411,11 +413,22 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
mVBO->getVertexStrider(v);
mVBO->getTexCoord0Strider(uv1);
mVBO->getTexCoord1Strider(uv2);
-
- v[0] = LLVector3( uv2[0] = uv1[0] = LLVector2(0, 0) );
- v[1] = LLVector3( uv2[1] = uv1[1] = LLVector2(0, mScreenHeight) );
- v[2] = LLVector3( uv2[2] = uv1[2] = LLVector2(mScreenWidth, 0) );
- v[3] = LLVector3( uv2[3] = uv1[3] = LLVector2(mScreenWidth, mScreenHeight) );
+
+ uv2[0] = uv1[0] = LLVector2(0, 0);
+ uv2[1] = uv1[1] = LLVector2(0, 1);
+ uv2[2] = uv1[2] = LLVector2(1, 0);
+ uv2[3] = uv1[3] = LLVector2(1, 1);
+
+ LLVector3 vec1[4] = {
+ LLVector3(0, 0, 0),
+ LLVector3(0, mScreenHeight, 0),
+ LLVector3(mScreenWidth, 0, 0),
+ LLVector3(mScreenWidth, mScreenHeight, 0) };
+
+ v[0] = vec1[0];
+ v[1] = vec1[1];
+ v[2] = vec1[2];
+ v[3] = vec1[3];
mVBO->flush();
}
@@ -424,7 +437,7 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
void LLPostProcess::createScreenTextures()
{
- const LLTexUnit::eTextureType type = LLTexUnit::TT_RECT_TEXTURE;
+ const LLTexUnit::eTextureType type = LLTexUnit::TT_TEXTURE;
mRenderTarget[0].allocate(mScreenWidth,mScreenHeight,GL_RGBA,FALSE,FALSE,type,FALSE);
if(mRenderTarget[0].getFBO())//Only need pingpong between two rendertargets if FBOs are supported.
@@ -504,7 +517,7 @@ void LLPostProcess::destroyGL()
void LLPostProcess::copyFrameBuffer()
{
mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0);
- glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,mScreenWidth, mScreenHeight);
stop_glerror();
if(mDepthTexture)
@@ -513,8 +526,8 @@ void LLPostProcess::copyFrameBuffer()
{
if((*it)->isEnabled() && (*it)->getDepthChannel()>=0)
{
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
- glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mDepthTexture);
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,mScreenWidth, mScreenHeight);
stop_glerror();
break;
}
@@ -594,7 +607,7 @@ void LLPostProcess::applyShaders(void)
S32 color_channel = (*it)->getColorChannel();
S32 depth_channel = (*it)->getDepthChannel();
if(depth_channel >= 0)
- gGL.getTexUnit(depth_channel)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
+ gGL.getTexUnit(depth_channel)->bindManual(LLTexUnit::TT_TEXTURE, mDepthTexture);
U32 pass = 1;
(*it)->bindShader();
@@ -639,11 +652,11 @@ void LLPostProcess::drawOrthoQuad(QuadType type)
mVBO->getTexCoord1Strider(uv2);
float offs[2] = {
- /*ll_round*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE),
- /*ll_round*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) };
+ /*ll_round*/((float) rand() / (float) RAND_MAX),
+ /*ll_round*/((float) rand() / (float) RAND_MAX) };
float scale[2] = {
- (float)mScreenWidth * mNoiseTextureScale,
- (float)mScreenHeight * mNoiseTextureScale };
+ ((float)mScreenWidth * mNoiseTextureScale),
+ ((float)mScreenHeight * mNoiseTextureScale) };
uv2[0] = LLVector2(offs[0],offs[1]);
uv2[1] = LLVector2(offs[0],offs[1]+scale[1]);
@@ -2442,9 +2442,6 @@ void LLRender::debugTexUnits(void)
case LLTexUnit::TT_TEXTURE:
LL_CONT << "Texture 2D";
break;
- case LLTexUnit::TT_RECT_TEXTURE:
- LL_CONT << "Texture Rectangle";
- break;
case LLTexUnit::TT_CUBE_MAP:
LL_CONT << "Cube Map";
break;
@@ -64,7 +64,6 @@ class LLTexUnit
typedef enum
{
TT_TEXTURE = 0, // Standard 2D Texture
- TT_RECT_TEXTURE, // Non power of 2 texture
TT_CUBE_MAP, // 6-sided cube map texture
//TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample Do not use
TT_NONE // No texture type is currently enabled
@@ -228,17 +228,8 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
stop_glerror();
}
- if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
- {
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
- stop_glerror();
- }
- else
- {
- // ATI doesn't support mirrored repeat for rectangular textures.
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- stop_glerror();
- }
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
+ stop_glerror();
if (mFBO)
{
@@ -1124,8 +1124,6 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("object_plane_t");
llassert(mReservedUniforms.size() == LLShaderMgr::OBJECT_PLANE_T+1);
- mReservedUniforms.push_back("viewport");
-
mReservedUniforms.push_back("light_position");
mReservedUniforms.push_back("light_direction");
mReservedUniforms.push_back("light_attenuation");
@@ -1216,7 +1214,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("ssao_factor");
mReservedUniforms.push_back("ssao_factor_inv");
mReservedUniforms.push_back("ssao_effect");
- mReservedUniforms.push_back("screen_res");
+ mReservedUniforms.push_back("kern_scale");
mReservedUniforms.push_back("near_clip");
mReservedUniforms.push_back("shadow_offset");
mReservedUniforms.push_back("shadow_bias");
@@ -1232,7 +1230,6 @@ void LLShaderMgr::initAttribsAndUniforms()
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_DOWNSAMPLED_DEPTH_SCALE+1);
- mReservedUniforms.push_back("tc_scale");
mReservedUniforms.push_back("rcp_screen_res");
mReservedUniforms.push_back("rcp_frame_opt");
mReservedUniforms.push_back("rcp_frame_opt2");
@@ -49,7 +49,6 @@ class LLShaderMgr
TEXTURE_MATRIX3,
OBJECT_PLANE_S,
OBJECT_PLANE_T,
- VIEWPORT,
LIGHT_POSITION,
LIGHT_DIRECTION,
LIGHT_ATTENUATION,
@@ -124,7 +123,7 @@ class LLShaderMgr
DEFERRED_SSAO_FACTOR,
DEFERRED_SSAO_FACTOR_INV,
DEFERRED_SSAO_EFFECT,
- DEFERRED_SCREEN_RES,
+ DEFERRED_KERN_SCALE,
DEFERRED_NEAR_CLIP,
DEFERRED_SHADOW_OFFSET,
DEFERRED_SHADOW_BIAS,
@@ -138,7 +137,6 @@ class LLShaderMgr
DEFERRED_SHADOW_TARGET_WIDTH,
DEFERRED_DOWNSAMPLED_DEPTH_SCALE,
- FXAA_TC_SCALE,
FXAA_RCP_SCREEN_RES,
FXAA_RCP_FRAME_OPT,
FXAA_RCP_FRAME_OPT2,
@@ -33,18 +33,16 @@ out vec4 frag_color;
VARYING vec2 vary_fragcoord;
-uniform sampler2DRect depthMapDownsampled;
-uniform sampler2DRect normalMap;
+uniform sampler2D depthMapDownsampled;
+uniform sampler2D normalMap;
uniform sampler2D noiseMap;
-uniform vec2 screen_res;
uniform mat4 inv_proj;
-uniform float downsampled_depth_scale;
-
uniform float ssao_radius;
uniform float ssao_max_radius;
uniform float ssao_factor;
+uniform vec2 kern_scale;
vec3 decode_normal (vec2 enc)
{
@@ -59,9 +57,8 @@ vec3 decode_normal (vec2 enc)
vec4 getPosition(vec2 pos_screen)
{
- float depth = texture2DRect(depthMapDownsampled, pos_screen.xy*downsampled_depth_scale).r;
+ float depth = texture2D(depthMapDownsampled, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
- sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
@@ -90,21 +87,21 @@ vec2 getKern(int i)
float calcAmbientOcclusion(vec4 pos, vec3 norm)
{
vec2 pos_screen = vary_fragcoord.xy;
- vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
+ vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy / kern_scale / 128).xy;
// We treat the first sample as the origin, which definitely doesn't obscure itself thanks to being visible for sampling in the first place.
float points = 1.0;
float angle_hidden = 0.0;
// use a kernel scale that diminishes with distance.
// a scale of less than 32 is just wasting good samples, though.
- float scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius));
+ vec2 scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius)) * kern_scale;
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
for (int i = 0; i < 8; i++)
{
vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
- vec3 samppos_world = getPosition(samppos_screen).xyz;
+ vec3 samppos_world = getPosition(samppos_screen).xyz;
vec3 diff = samppos_world - pos.xyz;
@@ -119,8 +116,9 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
points += 1.0;
}
}
-
+
angle_hidden /= points;
+
float rtn = (1.0 - angle_hidden);
return (rtn * rtn) * (rtn * rtn); //Pow2 to increase darkness to match previous behavior.
}
@@ -133,7 +131,7 @@ void main()
vec4 pos = getPosition(pos_screen);
- vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
+ vec3 norm = texture2D(normalMap, pos_screen).xyz;
norm = decode_normal(norm.xy);
frag_color = vec4(calcAmbientOcclusion(pos,norm),0,0,0);
@@ -93,7 +93,6 @@ vec3 vary_AdditiveColor;
vec3 vary_AtmosAttenuation;
uniform mat4 inv_proj;
-uniform vec2 screen_res;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
@@ -486,7 +485,6 @@ void main()
#if HAS_SHADOW
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
- frag *= screen_res;
vec4 spos = pos;
if (spos.z > -shadow_clip.w)
@@ -31,20 +31,18 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
-uniform sampler2DRect lightMap;
+uniform sampler2D depthMap;
+uniform sampler2D normalMap;
+uniform sampler2D lightMap;
uniform float dist_factor;
uniform float blur_size;
uniform vec2 delta;
-//uniform vec3 kern[4];
-uniform float kern_scale;
+uniform vec2 kern_scale;
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
-uniform vec2 screen_res;
vec2 getKern(int i)
{
@@ -59,9 +57,8 @@ vec2 getKern(int i)
vec4 getPosition(vec2 pos_screen)
{
- float depth = texture2DRect(depthMap, pos_screen.xy).r;
+ float depth = texture2D(depthMap, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
- sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
@@ -90,13 +87,13 @@ vec3 decode_normal (vec2 enc)
void main()
{
vec2 tc = vary_fragcoord.xy;
- vec3 norm = texture2DRect(normalMap, tc).xyz;
+ vec3 norm = texture2D(normalMap, tc).xyz;
norm = decode_normal(norm.xy); // unpack norm
vec3 pos = getPosition(tc).xyz;
- vec4 ccol = texture2DRect(lightMap, tc).rgba;
-
- vec2 dlt = kern_scale * delta / (vec2(1.0)+norm.xy*norm.xy);
+ vec4 ccol = texture2D(lightMap, tc).rgba;
+
+ vec2 dlt = delta / (vec2(1.0)+norm.xy*norm.xy);
dlt /= max(-pos.z*dist_factor, 1.0);
vec2 defined_weight = getKern(0).xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
@@ -106,9 +103,9 @@ void main()
float pointplanedist_tolerance_pow2 = pos.z*-0.001;
// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
- vec2 tc_v = fract(0.5 * tc.xy); // we now have floor(mod(tc,2.0))*0.5
+ vec2 tc_v = fract(0.5 * tc.xy / kern_scale); // we now have floor(mod(tc,2.0))*0.5
float tc_mod = 2.0 * abs(tc_v.x - tc_v.y); // diff of x,y makes checkerboard
- tc += ( (tc_mod - 0.5) * dlt * 0.5 );
+ tc += ( (tc_mod - 0.5) * dlt * 0.5 ) * kern_scale;
for (int i = 1; i < 4; i++)
{
@@ -119,7 +116,7 @@ void main()
if (d*d <= pointplanedist_tolerance_pow2)
{
vec4 weight = getKern(i).xyxx;
- col += texture2DRect(lightMap, samptc)*weight;
+ col += texture2D(lightMap, samptc)*weight;
defined_weight += weight.xy;
}
}
@@ -132,7 +129,7 @@ void main()
if (d*d <= pointplanedist_tolerance_pow2)
{
vec4 weight = getKern(i).xyxx;
- col += texture2DRect(lightMap, samptc)*weight;
+ col += texture2D(lightMap, samptc)*weight;
defined_weight += weight.xy;
}
}
Oops, something went wrong.

0 comments on commit 5e501b9

Please sign in to comment.