Permalink
Browse files

Minor cleanup.

  • Loading branch information...
Shyotl committed Mar 14, 2017
1 parent 75c47e9 commit d42e380698765b690dc828367d41442c1d2ae0e4
Showing with 101 additions and 142 deletions.
  1. +1 −0 indra/llrender/llglslshader.cpp
  2. +1 −1 indra/llrender/llrender.cpp
  3. +35 −27 indra/llrender/llvertexbuffer.cpp
  4. +1 −1 indra/newview/app_settings/shaders/class1/deferred/SSAOF.glsl
  5. +1 −1 indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
  6. +3 −3 indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
  7. +1 −1 indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
  8. +1 −1 indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
  9. +1 −1 indra/newview/app_settings/shaders/class1/deferred/downsampleDepthNearestF.glsl
  10. +1 −1 indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
  11. +1 −1 indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
  12. +0 −3 indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
  13. +0 −1 indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
  14. +1 −1 indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
  15. +3 −4 indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
  16. +1 −1 indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
  17. +1 −1 indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
  18. +1 −1 indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
  19. +1 −1 indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrectF.glsl
  20. +1 −1 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
  21. +0 −2 indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
  22. +0 −2 indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
  23. +1 −1 indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
  24. +1 −1 indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
  25. +1 −1 indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl
  26. +1 −5 indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
  27. +1 −1 indra/newview/app_settings/shaders/class1/effects/MotionBlurF.glsl
  28. +1 −1 indra/newview/app_settings/shaders/class1/effects/PosterizeF.glsl
  29. +1 −1 indra/newview/app_settings/shaders/class1/effects/VignetteF.glsl
  30. +1 −1 indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
  31. +1 −1 indra/newview/app_settings/shaders/class1/effects/gaussBlurF.glsl
  32. +1 −1 indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
  33. +1 −1 indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
  34. +1 −1 indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
  35. +1 −1 indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
  36. +1 −1 indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
  37. +0 −2 indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
  38. +1 −1 indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
  39. +1 −3 indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
  40. +1 −1 indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
  41. +1 −1 indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
  42. +3 −3 indra/newview/llglsandbox.cpp
  43. +24 −55 indra/newview/pipeline.cpp
  44. +0 −2 indra/newview/pipeline.h
@@ -313,6 +313,7 @@ LLGLSLShader::LLGLSLShader(S32 shader_class)
mShaderGroup(SG_DEFAULT),
mUniformsDirty(FALSE),
mTimerQuery(0),
+ mLightHash(0),
mSamplesQuery(0)
{
@@ -1214,7 +1214,7 @@ void LLRender::syncMatrices()
{
stop_glerror();
- U32 name[] =
+ static const U32 name[] =
{
LLShaderMgr::MODELVIEW_MATRIX,
LLShaderMgr::PROJECTION_MATRIX,
@@ -1309,7 +1309,7 @@ void LLVertexBuffer::setupVertexArray()
return;
}
- LLFastTimer t(FTM_SETUP_VERTEX_ARRAY);
+ //LLFastTimer t(FTM_SETUP_VERTEX_ARRAY);
#if GL_ARB_vertex_array_object
glBindVertexArray(mGLArray);
#endif
@@ -1536,7 +1536,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
if (map_range)
{
#ifdef GL_ARB_map_buffer_range
- LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE);
+ //LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE);
S32 offset = mOffsets[type] + sTypeSize[type]*index;
S32 length = (sTypeSize[type]*count+0xF) & ~0xF;
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length,
@@ -1560,7 +1560,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
}
}
- LLFastTimer t(FTM_VBO_MAP_BUFFER);
+ //LLFastTimer t(FTM_VBO_MAP_BUFFER);
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize,
GL_MAP_WRITE_BIT |
GL_MAP_FLUSH_EXPLICIT_BIT);
@@ -1723,7 +1723,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
if (map_range)
{
#ifdef GL_ARB_map_buffer_range
- LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE);
+ //LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE);
S32 offset = sizeof(U16)*index;
S32 length = sizeof(U16)*count;
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length,
@@ -1735,7 +1735,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
else
{
#ifdef GL_ARB_map_buffer_range
- LLFastTimer t(FTM_VBO_MAP_INDEX);
+ //LLFastTimer t(FTM_VBO_MAP_INDEX);
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices,
GL_MAP_WRITE_BIT |
GL_MAP_FLUSH_EXPLICIT_BIT);
@@ -1757,7 +1757,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
}
else
{
- LLFastTimer t(FTM_VBO_MAP_INDEX);
+ //LLFastTimer t(FTM_VBO_MAP_INDEX);
map_range = false;
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
}
@@ -1826,7 +1826,7 @@ void LLVertexBuffer::unmapBuffer()
if (mMappedData && mVertexLocked)
{
- LLFastTimer t(FTM_VBO_UNMAP);
+ //LLFastTimer t(FTM_VBO_UNMAP);
bindGLBuffer(true);
updated_all = mIndexLocked; //both vertex and index buffers done updating
@@ -1868,7 +1868,7 @@ void LLVertexBuffer::unmapBuffer()
S32 length = sTypeSize[region.mType]*region.mCount;
if (gGLManager.mHasMapBufferRange)
{
- LLFastTimer t(FTM_VBO_FLUSH_RANGE);
+ //LLFastTimer t(FTM_VBO_FLUSH_RANGE);
#ifdef GL_ARB_map_buffer_range
glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length);
#endif
@@ -1896,7 +1896,7 @@ void LLVertexBuffer::unmapBuffer()
if (mMappedIndexData && mIndexLocked)
{
- LLFastTimer t(FTM_IBO_UNMAP);
+ //LLFastTimer t(FTM_IBO_UNMAP);
bindGLIndices();
if(!mMappable)
{
@@ -1934,7 +1934,7 @@ void LLVertexBuffer::unmapBuffer()
S32 length = sizeof(U16)*region.mCount;
if (gGLManager.mHasMapBufferRange)
{
- LLFastTimer t(FTM_IBO_FLUSH_RANGE);
+ //LLFastTimer t(FTM_IBO_FLUSH_RANGE);
#ifdef GL_ARB_map_buffer_range
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
#endif
@@ -1977,21 +1977,7 @@ template <class T,S32 type> struct VertexBufferStrider
strider_t& strider,
S32 index, S32 count, bool map_range)
{
- if (type == LLVertexBuffer::TYPE_INDEX)
- {
- volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
-
- if (ptr == NULL)
- {
- LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
- return false;
- }
-
- strider = (T*)ptr;
- strider.setStride(0);
- return true;
- }
- else if (vbo.hasDataType(type))
+ if (vbo.hasDataType(type))
{
S32 stride = LLVertexBuffer::sTypeSize[type];
@@ -2015,6 +2001,28 @@ template <class T,S32 type> struct VertexBufferStrider
}
};
+template<class T>
+struct VertexBufferStrider<T, LLVertexBuffer::TYPE_INDEX>
+{
+ typedef LLStrider<T> strider_t;
+ static bool get(LLVertexBuffer& vbo,
+ strider_t& strider,
+ S32 index, S32 count, bool map_range)
+ {
+ volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
+
+ if (ptr == NULL)
+ {
+ LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
+ return false;
+ }
+
+ strider = (T*) ptr;
+ strider.setStride(0);
+ return true;
+ }
+};
+
bool LLVertexBuffer::getVertexStrider(LLStrider<LLVector3>& strider, S32 index, S32 count, bool map_range)
{
return VertexBufferStrider<LLVector3,TYPE_VERTEX>::get(*this, strider, index, count, map_range);
@@ -2086,7 +2094,7 @@ bool LLVertexBuffer::bindGLArray()
if (mGLArray && sGLRenderArray != mGLArray)
{
{
- LLFastTimer t(FTM_BIND_GL_ARRAY);
+ //LLFastTimer t(FTM_BIND_GL_ARRAY);
#if GL_ARB_vertex_array_object
glBindVertexArray(mGLArray);
#endif
@@ -2144,7 +2152,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)
bool ret = false;
if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive))))
{
- LLFastTimer t(FTM_BIND_GL_INDICES);
+ //LLFastTimer t(FTM_BIND_GL_INDICES);
/*if (sMapped)
{
LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#define INDEXED 1
#define NON_INDEXED 2
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -86,7 +86,7 @@ vec3 decode_normal (vec2 enc)
void main()
{
- vec2 tc = vary_fragcoord.xy;
+ vec2 tc = vary_fragcoord.xy;
vec3 norm = texture2D(normalMap, tc).xyz;
norm = decode_normal(norm.xy); // unpack norm
@@ -110,7 +110,7 @@ void main()
for (int i = 1; i < 4; i++)
{
vec2 samptc = (tc + i * dlt);
- vec3 samppos = getPosition(samptc).xyz;
+ vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -22,9 +22,6 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-//#extension GL_ARB_texture_rectangle : enable
-//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -29,7 +29,6 @@
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
uniform float emissive_brightness;
-//uniform float display_gamma;
vec3 srgb_to_linear(vec3 cs)
{
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -31,8 +31,6 @@ out vec4 frag_color;
//class 1 -- no shadows
-//#extension GL_ARB_texture_rectangle : enable
-//#extension GL_ARB_shader_texture_lod : enable
uniform sampler2D diffuseRect;
uniform sampler2D specularRect;
@@ -286,11 +284,12 @@ void main()
if (ds < 0.0)
{
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-
+
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
- stc /= stc.w;
+
if (stc.z > 0.0)
{
+ stc /= stc.w;
float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
-//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-//#extension GL_ARB_texture_rectangle : enable
-//#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -25,7 +25,7 @@
//class 1, no shadow, no SSAO, should never be called
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
@@ -23,7 +23,7 @@
*/
-//#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
Oops, something went wrong.

0 comments on commit d42e380

Please sign in to comment.