Minor cleanup.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -151,7 +151,7 @@ void main()
|
||||
|
||||
vec4 fb = texture2D(screenTex, distort);
|
||||
|
||||
frag_data[0] = vec4(/*linear_to_srgb*/(fb.rgb), 1.0); // diffuse
|
||||
frag_data[0] = vec4(fb.rgb, 1.0); // diffuse
|
||||
frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec
|
||||
frag_data[2] = vec4(encode_normal(wavef), 0.0, 0.0); // normalxyz, displace
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_data[3];
|
||||
@@ -37,10 +37,6 @@ vec3 atmosTransport(vec3 inColor);
|
||||
uniform sampler2D bumpMap;
|
||||
uniform sampler2D screenTex;
|
||||
uniform sampler2D refTex;
|
||||
uniform sampler2DRectShadow shadowMap0;
|
||||
uniform sampler2DRectShadow shadowMap1;
|
||||
uniform sampler2DRectShadow shadowMap2;
|
||||
uniform sampler2DRectShadow shadowMap3;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform mat4 shadow_matrix[6];
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* $License$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* $License$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* $License$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* $License$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#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;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* $License$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -29,7 +29,7 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
uniform sampler2D glowMap;
|
||||
uniform sampler2D screenMap;
|
||||
|
||||
@@ -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,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;
|
||||
@@ -230,7 +228,7 @@ void main()
|
||||
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b; // This is probably wrong
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
if (proj_tc.z > 0.0 &&
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -515,8 +515,8 @@ void LLViewerParcelMgr::renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 hei
|
||||
if (clamped_y2 > BORDER) clamped_y2 = BORDER;
|
||||
|
||||
F32 z;
|
||||
F32 z1 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x1, clamped_y1, 0.f ) );;
|
||||
F32 z2 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x2, clamped_y2, 0.f ) );;
|
||||
F32 z1 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x1, clamped_y1, 0.f ) );
|
||||
F32 z2 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x2, clamped_y2, 0.f ) );
|
||||
|
||||
// Convert x1 and x2 from region-local to agent coords.
|
||||
LLVector3 origin = regionp->getOriginAgent();
|
||||
@@ -908,7 +908,7 @@ void LLViewerObjectList::renderObjectBeacons()
|
||||
for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
|
||||
{
|
||||
LLDebugBeacon &debug_beacon = *iter;
|
||||
if (debug_beacon.mString == "")
|
||||
if (debug_beacon.mString.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -565,6 +565,7 @@ void LLPipeline::cleanup()
|
||||
mInitialized = FALSE;
|
||||
|
||||
mAuxScreenRectVB = NULL;
|
||||
|
||||
mCubeVB = NULL;
|
||||
}
|
||||
|
||||
@@ -791,7 +792,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
//allocate deferred rendering color buffers
|
||||
if (!mDeferredScreen.allocate(resX, resY, GL_SRGB8_ALPHA8, TRUE, TRUE, LLTexUnit::TT_TEXTURE, FALSE)) return false;
|
||||
if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE, FALSE)) return false;
|
||||
if (!mOcclusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE, FALSE)) return false;
|
||||
if (!addDeferredAttachments(mDeferredScreen)) return false;
|
||||
|
||||
GLuint screenFormat = GL_RGBA16;
|
||||
@@ -838,7 +838,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
{
|
||||
if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
|
||||
if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -846,7 +845,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
{
|
||||
mShadow[i].release();
|
||||
mShadowOcclusion[i].release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,7 +857,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
for (U32 i = 4; i < 6; i++)
|
||||
{
|
||||
if (!mShadow[i].allocate(spot_shadow_map_width, height, 0, TRUE, FALSE)) return false;
|
||||
if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE)) return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -867,7 +864,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
for (U32 i = 4; i < 6; i++)
|
||||
{
|
||||
mShadow[i].release();
|
||||
mShadowOcclusion[i].release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,7 +880,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
for (U32 i = 0; i < 6; i++)
|
||||
{
|
||||
mShadow[i].release();
|
||||
mShadowOcclusion[i].release();
|
||||
}
|
||||
mFXAABuffer.release();
|
||||
mScreen.release();
|
||||
@@ -892,7 +887,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
||||
mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
|
||||
mDeferredDepth.release();
|
||||
mDeferredDownsampledDepth.release();
|
||||
mOcclusionDepth.release();
|
||||
|
||||
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_TEXTURE, FALSE)) return false;
|
||||
if(samples > 1 && mScreen.getFBO())
|
||||
@@ -1019,17 +1013,11 @@ void LLPipeline::releaseScreenBuffers()
|
||||
mDeferredDepth.release();
|
||||
mDeferredDownsampledDepth.release();
|
||||
mDeferredLight.release();
|
||||
mOcclusionDepth.release();
|
||||
|
||||
//mHighlight.release();
|
||||
|
||||
for (U32 i = 0; i < 6; i++)
|
||||
{
|
||||
mShadow[i].release();
|
||||
mShadowOcclusion[i].release();
|
||||
}
|
||||
|
||||
mSampleBuffer.release();
|
||||
}
|
||||
|
||||
|
||||
@@ -2262,14 +2250,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
|
||||
|
||||
if (to_texture)
|
||||
{
|
||||
/*if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
mOcclusionDepth.bindTarget();
|
||||
}
|
||||
else*/
|
||||
{
|
||||
mScreen.bindTarget();
|
||||
}
|
||||
mScreen.bindTarget();
|
||||
}
|
||||
|
||||
if (sUseOcclusion > 1)
|
||||
@@ -2408,14 +2389,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
|
||||
|
||||
if (to_texture)
|
||||
{
|
||||
/*if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
mOcclusionDepth.flush();
|
||||
}
|
||||
else*/
|
||||
{
|
||||
mScreen.flush();
|
||||
}
|
||||
mScreen.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4400,7 +4374,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
|
||||
gGLLastMatrix = NULL;
|
||||
gGL.loadMatrix(glh_get_current_modelview());
|
||||
LLGLSLShader::bindNoShader();
|
||||
doOcclusion(camera/*, mScreen, mOcclusionDepth, &mDeferredDepth*/);
|
||||
doOcclusion(camera);
|
||||
gGL.setColorMask(true, false);
|
||||
}
|
||||
|
||||
@@ -7641,7 +7615,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* diffus
|
||||
|
||||
F32 ssao_factor = RenderSSAOFactor;
|
||||
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor);
|
||||
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0/ssao_factor);
|
||||
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.f/ssao_factor);
|
||||
|
||||
LLVector3 ssao_effect = RenderSSAOEffect;
|
||||
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_EFFECT, ssao_effect[0]);
|
||||
@@ -7838,9 +7812,6 @@ void LLPipeline::renderDeferredLighting()
|
||||
F32 blur_size = RenderShadowBlurSize;
|
||||
F32 dist_factor = RenderShadowBlurDistFactor;
|
||||
|
||||
// sample symmetrically with the middle sample falling exactly on 0.0
|
||||
//F32 x = 0.f;
|
||||
|
||||
gDeferredBlurLightProgram.uniform2f(sDelta, (blur_size * (kern_length / 2.f - 0.5f)) / mScreen.getWidth(), 0.f);
|
||||
gDeferredBlurLightProgram.uniform1f(sDistFactor, dist_factor);
|
||||
|
||||
@@ -7999,13 +7970,14 @@ void LLPipeline::renderDeferredLighting()
|
||||
}
|
||||
|
||||
sVisibleLightCount++;
|
||||
|
||||
if (camera->getOrigin().mV[0] > c[0] + s + 0.2f ||
|
||||
camera->getOrigin().mV[0] < c[0] - s - 0.2f ||
|
||||
camera->getOrigin().mV[1] > c[1] + s + 0.2f ||
|
||||
camera->getOrigin().mV[1] < c[1] - s - 0.2f ||
|
||||
camera->getOrigin().mV[2] > c[2] + s + 0.2f ||
|
||||
camera->getOrigin().mV[2] < c[2] - s - 0.2f)
|
||||
|
||||
const auto& camera_origin = camera->getOrigin();
|
||||
if (camera_origin.mV[0] > c[0] + s + 0.2f ||
|
||||
camera_origin.mV[0] < c[0] - s - 0.2f ||
|
||||
camera_origin.mV[1] > c[1] + s + 0.2f ||
|
||||
camera_origin.mV[1] < c[1] - s - 0.2f ||
|
||||
camera_origin.mV[2] > c[2] + s + 0.2f ||
|
||||
camera_origin.mV[2] < c[2] - s - 0.2f)
|
||||
{ //draw box if camera is outside box
|
||||
if (render_local)
|
||||
{
|
||||
@@ -8197,8 +8169,7 @@ void LLPipeline::renderDeferredLighting()
|
||||
mFinalScreen.bindTarget();
|
||||
// Apply gamma correction to the frame here.
|
||||
gDeferredPostGammaCorrectProgram.bind();
|
||||
S32 channel = 0;
|
||||
channel = gDeferredPostGammaCorrectProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
|
||||
S32 channel = gDeferredPostGammaCorrectProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
|
||||
if (channel > -1)
|
||||
{
|
||||
mScreen.bindTexture(0,channel);
|
||||
@@ -8541,13 +8512,14 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
|
||||
}
|
||||
|
||||
sVisibleLightCount++;
|
||||
|
||||
if (camera->getOrigin().mV[0] > c[0] + s + 0.2f ||
|
||||
camera->getOrigin().mV[0] < c[0] - s - 0.2f ||
|
||||
camera->getOrigin().mV[1] > c[1] + s + 0.2f ||
|
||||
camera->getOrigin().mV[1] < c[1] - s - 0.2f ||
|
||||
camera->getOrigin().mV[2] > c[2] + s + 0.2f ||
|
||||
camera->getOrigin().mV[2] < c[2] - s - 0.2f)
|
||||
|
||||
const auto& camera_origin = camera->getOrigin();
|
||||
if (camera_origin.mV[0] > c[0] + s + 0.2f ||
|
||||
camera_origin.mV[0] < c[0] - s - 0.2f ||
|
||||
camera_origin.mV[1] > c[1] + s + 0.2f ||
|
||||
camera_origin.mV[1] < c[1] - s - 0.2f ||
|
||||
camera_origin.mV[2] > c[2] + s + 0.2f ||
|
||||
camera_origin.mV[2] < c[2] - s - 0.2f)
|
||||
{ //draw box if camera is outside box
|
||||
if (render_local)
|
||||
{
|
||||
@@ -9350,11 +9322,7 @@ void LLPipeline::renderShadow(const LLMatrix4a& view, const LLMatrix4a& proj, LL
|
||||
gDeferredShadowCubeProgram.bind();
|
||||
}
|
||||
|
||||
//LLRenderTarget& occlusion_target = mShadowOcclusion[LLViewerCamera::sCurCameraID-1];
|
||||
|
||||
//occlusion_target.bindTarget();
|
||||
updateCull(shadow_cam, result);
|
||||
//occlusion_target.flush();
|
||||
|
||||
stateSort(shadow_cam, result);
|
||||
|
||||
@@ -9448,7 +9416,7 @@ void LLPipeline::renderShadow(const LLMatrix4a& view, const LLMatrix4a& proj, LL
|
||||
|
||||
//LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID-1];
|
||||
|
||||
doOcclusion(shadow_cam/*, occlusion_source, occlusion_target*/);
|
||||
doOcclusion(shadow_cam);
|
||||
|
||||
if (use_shader)
|
||||
{
|
||||
@@ -10777,6 +10745,7 @@ BOOL LLPipeline::hasAnyRenderType(U32 type, ...) const
|
||||
{
|
||||
if (mRenderTypeEnabled[type])
|
||||
{
|
||||
va_end(args);
|
||||
return TRUE;
|
||||
}
|
||||
type = va_arg(args, U32);
|
||||
|
||||
@@ -594,7 +594,6 @@ public:
|
||||
LLRenderTarget mDeferredDepth;
|
||||
private:
|
||||
LLRenderTarget mDeferredDownsampledDepth;
|
||||
LLRenderTarget mOcclusionDepth;
|
||||
LLRenderTarget mDeferredLight;
|
||||
public:
|
||||
LLMultisampleBuffer mSampleBuffer;
|
||||
@@ -611,7 +610,6 @@ public:
|
||||
private:
|
||||
//sun shadow map
|
||||
LLRenderTarget mShadow[6];
|
||||
LLRenderTarget mShadowOcclusion[6];
|
||||
std::vector<LLVector3> mShadowFrustPoints[4];
|
||||
public:
|
||||
LLCamera mShadowCamera[8];
|
||||
|
||||
Reference in New Issue
Block a user