diff options
Diffstat (limited to 'indra')
49 files changed, 443 insertions, 162 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 674d6dcf7e..3b6cc084b1 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -51,6 +51,7 @@ using std::string; GLhandleARB LLGLSLShader::sCurBoundShader = 0; LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; +S32 LLGLSLShader::sIndexedTextureChannels = NULL; bool LLGLSLShader::sNoFixedFunction = false; //UI shader -- declared here so llui_libtest will link properly @@ -125,13 +126,6 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes, // Create program mProgramObject = glCreateProgramObjectARB(); -#if !LL_DARWIN - if (gGLManager.mGLVersion < 3.1f) - { //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support) - mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); - } -#endif // !LL_DARWIN - //compile new source vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 04dc594d87..beef57796d 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -69,7 +69,7 @@ public: static GLhandleARB sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; - + static S32 sIndexedTextureChannels; static bool sNoFixedFunction; void unload(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 7dde24a437..16180c6831 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -81,7 +81,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) // NOTE order of shader object attaching is VERY IMPORTANT!!! if (features->calculatesAtmospherics) { - if (!shader->attachObject("windlight/atmosphericsVarsV.glsl")) + if (features->hasWaterFog) + { + if (!shader->attachObject("windlight/atmosphericsVarsWaterV.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("windlight/atmosphericsVarsV.glsl")) { return FALSE; } @@ -161,7 +168,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if(features->calculatesAtmospherics) { - if (!shader->attachObject("windlight/atmosphericsVarsF.glsl")) + if (features->hasWaterFog) + { + if (!shader->attachObject("windlight/atmosphericsVarsWaterF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("windlight/atmosphericsVarsF.glsl")) { return FALSE; } @@ -241,7 +255,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -280,7 +294,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } } @@ -304,7 +318,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } else if (features->hasWaterFog) @@ -336,7 +350,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -355,7 +369,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -395,7 +409,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } } @@ -419,7 +433,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -438,10 +452,26 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } } + + if (features->mIndexedTextureChannels <= 1) + { + if (!shader->attachObject("objects/nonindexedTextureV.glsl")) + { + return FALSE; + } + } + else + { + if (!shader->attachObject("objects/indexedTextureV.glsl")) + { + return FALSE; + } + } + return TRUE; } @@ -631,7 +661,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup(decl.c_str()); } - text[count++] = strdup("VARYING float vary_texture_index;\n"); + if (texture_index_channels > 1) + { + text[count++] = strdup("VARYING float vary_texture_index;\n"); + } + text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); text[count++] = strdup("{\n"); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ddc4f4ddd2..727851b4da 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7796,7 +7796,7 @@ <key>Type</key> <string>U32</string> <key>Value</key> - <integer>6</integer> + <integer>32</integer> </map> <key>RenderDebugTextureBind</key> <map> diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index cf939e2df8..2901e18db8 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -31,7 +31,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -59,8 +59,6 @@ void main() gl_Position = projection_matrix * pos; - fog_depth = length(pos.xyz); - calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 15781bc92d..b09441f7eb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -49,7 +49,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; @@ -135,7 +135,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 74ee082bed..93b1a114db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -50,10 +50,10 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_light; VARYING vec3 vary_pointlight_col; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -98,7 +98,7 @@ void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -138,7 +138,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index 12e88ca5dd..acbc3f7e15 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -48,7 +48,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; @@ -137,7 +137,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl index 7ed41cbcb9..9461e3e32e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl @@ -32,7 +32,7 @@ ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; VARYING vec3 vary_normal; -VARYING float vary_texture_index; + VARYING vec2 vary_texcoord0; void main() diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 908f3abcd0..76d29b1df7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -28,23 +28,24 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; VARYING vec3 vary_normal; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +void passTextureIndex(); + void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vary_texture_index = texture_index; + passTextureIndex(); vary_normal = normalize(normal_matrix * normal); vertex_color = diffuse_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 7b108e4562..115b04797f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; @@ -39,17 +39,17 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); vec4 pos = (modelview_matrix * vert); - vary_texture_index = texture_index; + passTextureIndex(); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -59,5 +59,5 @@ void main() vertex_color = emissive; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index ab638991f7..2e6982d101 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -40,17 +40,17 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); vec4 pos = (modelview_matrix * vert); - vary_texture_index = texture_index; + passTextureIndex(); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -60,5 +60,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index 57b3a6d001..45bd5c8b42 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -24,7 +24,7 @@ */ -VARYING float fog_depth; + uniform vec4 waterFogColor; uniform float waterFogEnd; diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index 8c38d5df2a..8494ffba52 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -54,5 +54,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl index 35feacb7b1..e984deb0c8 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; @@ -37,13 +37,13 @@ VARYING vec2 vary_texcoord0; void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; -VARYING float fog_depth; + + void main() { //transform vertex - vary_texture_index = texture_index; + passTextureIndex(); gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; @@ -52,5 +52,5 @@ void main() vertex_color = emissive; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl index f73760bfd4..5d6f14230c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec3 normal; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -49,5 +49,5 @@ void main() vertex_color = vec4(1,1,1,1); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index 69cd858b4d..79b552ee1a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -63,5 +63,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index a8e640018d..8d1bbf350d 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -37,7 +37,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -59,5 +59,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index 4de24fd46b..eff75435a9 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -35,7 +35,7 @@ mat4 getObjectSkinnedTransform(); VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { @@ -53,5 +53,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index 7286e5e2f4..8b20c2a860 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -50,5 +50,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl new file mode 100644 index 0000000000..a95c9e0ab9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl @@ -0,0 +1,34 @@ +/** + * @file indexedTextureV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +ATTRIBUTE float texture_index; + +VARYING float vary_texture_index; + +void passTextureIndex() +{ + vary_texture_index = texture_index; +} + diff --git a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl new file mode 100644 index 0000000000..2839171044 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl @@ -0,0 +1,30 @@ +/** + * @file nonindexedTextureV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +void passTextureIndex() +{ + +} + diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 282686a9b0..5dcfa87066 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -53,5 +53,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index 86a78b190c..4ca53a8f30 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec3 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -57,6 +57,6 @@ void main() vary_texcoord0 = (texture_matrix0*vec4(ref,1.0)).xyz; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl index 45a493e4f2..706627e175 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -53,5 +53,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index aea0e25e60..1c6e53b187 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -61,5 +61,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index 4b6b219751..df9111f941 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -53,6 +53,4 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - - fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl index 250d99a9c7..fa01a27ec0 100644 --- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -37,7 +37,7 @@ void calcAtmospherics(vec3 inPositionEye); VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { @@ -56,5 +56,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index 2e41360150..8bdae328bd 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -24,10 +24,7 @@ */ - -VARYING vec3 vary_PositionEye; - vec3 getPositionEye() { - return vary_PositionEye; + return vec3(0,0,0); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index 42f8646f2d..8ec9ae617c 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -25,15 +25,12 @@ -VARYING vec3 vary_PositionEye; - - vec3 getPositionEye() { - return vary_PositionEye; + return vec3(0,0,0); } void setPositionEye(vec3 v) { - vary_PositionEye = v; + } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl new file mode 100644 index 0000000000..636d4af006 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl @@ -0,0 +1,33 @@ +/** + * @file atmosphericVarsWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + + +VARYING vec3 vary_PositionEye; + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl new file mode 100644 index 0000000000..ef34c5c853 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl @@ -0,0 +1,39 @@ +/** + * @file atmosphericVarsWaterV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + + +VARYING vec3 vary_PositionEye; +VARYING float fog_depth; + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; + fog_depth = v.z; +} diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 04d3e2aa1f..5af9f5c902 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -56,7 +56,7 @@ void main() vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index ad353eb624..5a3955ef00 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -50,7 +50,7 @@ VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -140,7 +140,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 6a3777c7c8..9540ddd2e8 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -49,10 +49,10 @@ VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -97,7 +97,7 @@ void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -136,7 +136,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 091a865160..63c7a6b13d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -48,7 +48,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -139,7 +139,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl index 580ef2694f..34bd8d445a 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -34,10 +34,10 @@ void calcAtmospherics(vec3 inPositionEye); uniform vec4 origin; -VARYING float vary_texture_index; + ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -45,13 +45,13 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -64,6 +64,4 @@ void main() calcAtmospherics(pos.xyz); vertex_color = diffuse_color; - - fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl index 09dbd0b6cd..fc20d3270e 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -36,16 +36,16 @@ ATTRIBUTE vec4 diffuse_color; void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; @@ -54,5 +54,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 86c592ea57..fdb3453cc5 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -30,7 +30,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -43,16 +43,13 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; -VARYING float fog_depth; - uniform vec4 origin; void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -64,7 +61,5 @@ void main() calcAtmospherics(pos.xyz); - vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); - - fog_depth = pos.z; + vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl index 6799e43b9a..cb80697d15 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec4 diffuse_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -57,5 +57,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl index 8e8f0664b0..37a20383e2 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -37,16 +37,16 @@ ATTRIBUTE vec4 diffuse_color; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; @@ -60,5 +60,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index 08814b49d8..e8e56e12c1 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -24,25 +24,17 @@ */ - -VARYING vec3 vary_PositionEye; - VARYING vec3 vary_SunlitColor; -VARYING vec3 vary_AmblitColor; VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; +VARYING float vary_AtmosAttenuation; -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return vec3(0,0,0); } vec3 getAmblitColor() { - return vary_AmblitColor; + return vec3(0,0,0); } vec3 getAdditiveColor() { @@ -50,5 +42,5 @@ vec3 getAdditiveColor() } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return vec3(vary_AtmosAttenuation); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 514f009add..01605e5b25 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -24,49 +24,50 @@ */ - -VARYING vec3 vary_PositionEye; - -VARYING vec3 vary_SunlitColor; -VARYING vec3 vary_AmblitColor; VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; +VARYING float vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return sunlit_color; } vec3 getAmblitColor() { - return vary_AmblitColor; + return amblit_color; } + vec3 getAdditiveColor() { return vary_AdditiveColor; } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return atmos_attenuation; } +vec3 getPositionEye() +{ + return position_eye; +} void setPositionEye(vec3 v) { - vary_PositionEye = v; + position_eye = v; } void setSunlitColor(vec3 v) { - vary_SunlitColor = v; + sunlit_color = v; } void setAmblitColor(vec3 v) { - vary_AmblitColor = v; + amblit_color = v; } void setAdditiveColor(vec3 v) @@ -76,5 +77,6 @@ void setAdditiveColor(vec3 v) void setAtmosAttenuation(vec3 v) { - vary_AtmosAttenuation = v; + atmos_attenuation = v; + vary_AtmosAttenuation = v.r; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl new file mode 100644 index 0000000000..23046f990d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl @@ -0,0 +1,51 @@ +/** + * @file atmosphericVarsWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +VARYING vec3 vary_PositionEye; +VARYING vec3 vary_SunlitColor; +VARYING vec3 vary_AdditiveColor; +VARYING float vary_AtmosAttenuation; + +vec3 getSunlitColor() +{ + return vec3(0,0,0); +} +vec3 getAmblitColor() +{ + return vec3(0,0,0); +} +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return vec3(vary_AtmosAttenuation); +} +vec3 getPositionEye() +{ + return vary_PositionEye; +} + diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl new file mode 100644 index 0000000000..279c4dd981 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl @@ -0,0 +1,81 @@ +/** + * @file atmosphericVarsWaterV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, 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$ + */ + +VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING float vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() +{ + return sunlit_color; +} +vec3 getAmblitColor() +{ + return amblit_color; +} + +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return atmos_attenuation; +} + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ + sunlit_color = v; +} + +void setAmblitColor(vec3 v) +{ + amblit_color = v; +} + +void setAdditiveColor(vec3 v) +{ + vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ + atmos_attenuation = v; + vary_AtmosAttenuation = v.r; +} diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index e12c2f7853..ca66ae989c 100755 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -292,6 +292,7 @@ RenderVBOEnable 1 0 list OpenGLPre30 RenderDeferred 0 0 +RenderMaxTextureIndex 1 1 list Intel RenderAnisotropic 1 0 diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index a0245f5369..e855b2c569 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -290,6 +290,7 @@ RenderVBOEnable 1 0 list OpenGLPre30 RenderDeferred 0 0 +RenderMaxTextureIndex 1 1 list Intel RenderAnisotropic 1 0 diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index f521d93e03..563a63287e 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -594,7 +594,7 @@ void settings_setup_listeners() gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); - gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 17cce3069e..94b7451f0e 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -444,6 +444,9 @@ void LLViewerShaderMgr::setShaders() return; } + LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) gSavedSettings.getU32("RenderMaxTextureIndex")), 1); + + if (LLRender::sGLCoreProfile) { if (!gSavedSettings.getBOOL("VertexShaderEnable")) @@ -826,8 +829,8 @@ BOOL LLViewerShaderMgr::loadBasicShaders() // (in order of shader function call depth for reference purposes, deepest level first) vector< pair<string, S32> > shaders; - shaders.reserve(10); shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); shaders.push_back( make_pair( "lighting/lightFuncV.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); shaders.push_back( make_pair( "lighting/sumLightsV.glsl", sum_lights_class ) ); @@ -838,6 +841,8 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.push_back( make_pair( "windlight/atmosphericsV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); shaders.push_back( make_pair( "avatar/avatarSkinV.glsl", 1 ) ); shaders.push_back( make_pair( "avatar/objectSkinV.glsl", 1 ) ); + shaders.push_back( make_pair( "objects/indexedTextureV.glsl", 1 ) ); + shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) ); // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now. for (U32 i = 0; i < shaders.size(); i++) @@ -853,8 +858,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() // (in order of shader function call depth for reference purposes, deepest level first) shaders.clear(); - shaders.reserve(13); - S32 ch = gGLManager.mNumTextureImageUnits-1; + S32 ch = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); if (gGLManager.mGLVersion < 3.1f) { //force to 1 texture index channel for old drivers @@ -863,6 +867,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() std::vector<S32> index_channels; index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); @@ -1186,7 +1191,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseProgram.mShaderFiles.clear(); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredDiffuseProgram.createShader(NULL, NULL); } @@ -1197,7 +1202,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseAlphaMaskProgram.mShaderFiles.clear(); gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL); } @@ -1394,11 +1399,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels if (mVertexShaderLevel[SHADER_DEFERRED] < 1) { - gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; } else { //shave off some texture units for shadow maps - gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits - 6; + gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels - 6, 1); } gDeferredAlphaProgram.mShaderFiles.clear(); @@ -1428,7 +1433,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true; gDeferredFullbrightProgram.mFeatures.hasGamma = true; gDeferredFullbrightProgram.mFeatures.hasTransport = true; - gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredFullbrightProgram.mShaderFiles.clear(); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1442,7 +1447,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true; gDeferredEmissiveProgram.mFeatures.hasGamma = true; gDeferredEmissiveProgram.mFeatures.hasTransport = true; - gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredEmissiveProgram.mShaderFiles.clear(); gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB)); |