aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewershadermgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewershadermgr.cpp106
1 files changed, 101 insertions, 5 deletions
diff --git a/linden/indra/newview/llviewershadermgr.cpp b/linden/indra/newview/llviewershadermgr.cpp
index 69f7bd8..8648271 100644
--- a/linden/indra/newview/llviewershadermgr.cpp
+++ b/linden/indra/newview/llviewershadermgr.cpp
@@ -113,6 +113,8 @@ LLGLSLShader gDeferredAvatarProgram;
113LLGLSLShader gDeferredAvatarAlphaProgram; 113LLGLSLShader gDeferredAvatarAlphaProgram;
114LLGLSLShader gDeferredLightProgram; 114LLGLSLShader gDeferredLightProgram;
115LLGLSLShader gDeferredMultiLightProgram; 115LLGLSLShader gDeferredMultiLightProgram;
116LLGLSLShader gDeferredSpotLightProgram;
117LLGLSLShader gDeferredMultiSpotLightProgram;
116LLGLSLShader gDeferredSunProgram; 118LLGLSLShader gDeferredSunProgram;
117LLGLSLShader gDeferredBlurLightProgram; 119LLGLSLShader gDeferredBlurLightProgram;
118LLGLSLShader gDeferredSoftenProgram; 120LLGLSLShader gDeferredSoftenProgram;
@@ -120,6 +122,12 @@ LLGLSLShader gDeferredShadowProgram;
120LLGLSLShader gDeferredAvatarShadowProgram; 122LLGLSLShader gDeferredAvatarShadowProgram;
121LLGLSLShader gDeferredAlphaProgram; 123LLGLSLShader gDeferredAlphaProgram;
122LLGLSLShader gDeferredFullbrightProgram; 124LLGLSLShader gDeferredFullbrightProgram;
125LLGLSLShader gDeferredGIProgram;
126LLGLSLShader gDeferredPostGIProgram;
127LLGLSLShader gDeferredPostProgram;
128
129LLGLSLShader gLuminanceGatherProgram;
130
123 131
124//current avatar shader parameter pointer 132//current avatar shader parameter pointer
125GLint gAvatarMatrixParam; 133GLint gAvatarMatrixParam;
@@ -151,6 +159,9 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
151 mShaderList.push_back(&gDeferredMultiLightProgram); 159 mShaderList.push_back(&gDeferredMultiLightProgram);
152 mShaderList.push_back(&gDeferredAlphaProgram); 160 mShaderList.push_back(&gDeferredAlphaProgram);
153 mShaderList.push_back(&gDeferredFullbrightProgram); 161 mShaderList.push_back(&gDeferredFullbrightProgram);
162 mShaderList.push_back(&gDeferredPostGIProgram);
163 mShaderList.push_back(&gDeferredPostProgram);
164 mShaderList.push_back(&gDeferredGIProgram);
154 mShaderList.push_back(&gDeferredWaterProgram); 165 mShaderList.push_back(&gDeferredWaterProgram);
155 mShaderList.push_back(&gDeferredAvatarAlphaProgram); 166 mShaderList.push_back(&gDeferredAvatarAlphaProgram);
156} 167}
@@ -220,13 +231,32 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
220 mReservedUniforms.push_back("shadowMap1"); 231 mReservedUniforms.push_back("shadowMap1");
221 mReservedUniforms.push_back("shadowMap2"); 232 mReservedUniforms.push_back("shadowMap2");
222 mReservedUniforms.push_back("shadowMap3"); 233 mReservedUniforms.push_back("shadowMap3");
234 mReservedUniforms.push_back("shadowMap4");
235 mReservedUniforms.push_back("shadowMap5");
236
223 mReservedUniforms.push_back("normalMap"); 237 mReservedUniforms.push_back("normalMap");
224 mReservedUniforms.push_back("positionMap"); 238 mReservedUniforms.push_back("positionMap");
225 mReservedUniforms.push_back("diffuseRect"); 239 mReservedUniforms.push_back("diffuseRect");
226 mReservedUniforms.push_back("specularRect"); 240 mReservedUniforms.push_back("specularRect");
227 mReservedUniforms.push_back("noiseMap"); 241 mReservedUniforms.push_back("noiseMap");
242 mReservedUniforms.push_back("lightFunc");
228 mReservedUniforms.push_back("lightMap"); 243 mReservedUniforms.push_back("lightMap");
229 244 mReservedUniforms.push_back("luminanceMap");
245 mReservedUniforms.push_back("giLightMap");
246 mReservedUniforms.push_back("sunLightMap");
247 mReservedUniforms.push_back("localLightMap");
248 mReservedUniforms.push_back("projectionMap");
249 mReservedUniforms.push_back("diffuseGIMap");
250 mReservedUniforms.push_back("specularGIMap");
251 mReservedUniforms.push_back("normalGIMap");
252 mReservedUniforms.push_back("minpGIMap");
253 mReservedUniforms.push_back("maxpGIMap");
254 mReservedUniforms.push_back("depthGIMap");
255 mReservedUniforms.push_back("lastDiffuseGIMap");
256 mReservedUniforms.push_back("lastNormalGIMap");
257 mReservedUniforms.push_back("lastMinpGIMap");
258 mReservedUniforms.push_back("lastMaxpGIMap");
259
230 mWLUniforms.push_back("camPosLocal"); 260 mWLUniforms.push_back("camPosLocal");
231 261
232 mTerrainUniforms.reserve(5); 262 mTerrainUniforms.reserve(5);
@@ -754,9 +784,9 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
754 } 784 }
755 } 785 }
756 786
757#if 0 787
758 // disabling loading of postprocess shaders until we fix 788 // KL enabling loading of postprocess shaders until we fix
759 // ATI sampler2DRect compatibility. 789 // ATI may still have issues
760 790
761 //load Color Filter Shader 791 //load Color Filter Shader
762 if (success) 792 if (success)
@@ -797,7 +827,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
797 gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; 827 gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
798 success = gPostNightVisionProgram.createShader(NULL, &shaderUniforms); 828 success = gPostNightVisionProgram.createShader(NULL, &shaderUniforms);
799 } 829 }
800 #endif 830
801 831
802 return success; 832 return success;
803 833
@@ -814,6 +844,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
814 gDeferredTerrainProgram.unload(); 844 gDeferredTerrainProgram.unload();
815 gDeferredLightProgram.unload(); 845 gDeferredLightProgram.unload();
816 gDeferredMultiLightProgram.unload(); 846 gDeferredMultiLightProgram.unload();
847 gDeferredSpotLightProgram.unload();
848 gDeferredMultiSpotLightProgram.unload();
817 gDeferredSunProgram.unload(); 849 gDeferredSunProgram.unload();
818 gDeferredBlurLightProgram.unload(); 850 gDeferredBlurLightProgram.unload();
819 gDeferredSoftenProgram.unload(); 851 gDeferredSoftenProgram.unload();
@@ -823,6 +855,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
823 gDeferredAvatarAlphaProgram.unload(); 855 gDeferredAvatarAlphaProgram.unload();
824 gDeferredAlphaProgram.unload(); 856 gDeferredAlphaProgram.unload();
825 gDeferredFullbrightProgram.unload(); 857 gDeferredFullbrightProgram.unload();
858 gDeferredPostGIProgram.unload();
859 gDeferredPostProgram.unload();
860 gLuminanceGatherProgram.unload();
861 gDeferredGIProgram.unload();
826 gDeferredWaterProgram.unload(); 862 gDeferredWaterProgram.unload();
827 return FALSE; 863 return FALSE;
828 } 864 }
@@ -893,6 +929,26 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
893 929
894 if (success) 930 if (success)
895 { 931 {
932 gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader";
933 gDeferredSpotLightProgram.mShaderFiles.clear();
934 gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
935 gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
936 gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
937 success = gDeferredSpotLightProgram.createShader(NULL, NULL);
938 }
939
940 if (success)
941 {
942 gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
943 gDeferredMultiSpotLightProgram.mShaderFiles.clear();
944 gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
945 gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
946 gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
947 success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
948 }
949
950 if (success)
951 {
896 gDeferredSunProgram.mName = "Deferred Sun Shader"; 952 gDeferredSunProgram.mName = "Deferred Sun Shader";
897 gDeferredSunProgram.mShaderFiles.clear(); 953 gDeferredSunProgram.mShaderFiles.clear();
898 gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB)); 954 gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB));
@@ -942,6 +998,36 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
942 998
943 if (success) 999 if (success)
944 { 1000 {
1001 gDeferredPostGIProgram.mName = "Deferred Post GI Shader";
1002 gDeferredPostGIProgram.mShaderFiles.clear();
1003 gDeferredPostGIProgram.mShaderFiles.push_back(make_pair("deferred/postgiV.glsl", GL_VERTEX_SHADER_ARB));
1004 gDeferredPostGIProgram.mShaderFiles.push_back(make_pair("deferred/postgiF.glsl", GL_FRAGMENT_SHADER_ARB));
1005 gDeferredPostGIProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
1006 success = gDeferredPostGIProgram.createShader(NULL, NULL);
1007 }
1008
1009 if (success)
1010 {
1011 gDeferredPostProgram.mName = "Deferred Post Shader";
1012 gDeferredPostProgram.mShaderFiles.clear();
1013 gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB));
1014 gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER_ARB));
1015 gDeferredPostProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
1016 success = gDeferredPostProgram.createShader(NULL, NULL);
1017 }
1018
1019 if (success)
1020 {
1021 gDeferredGIProgram.mName = "Deferred GI Shader";
1022 gDeferredGIProgram.mShaderFiles.clear();
1023 gDeferredGIProgram.mShaderFiles.push_back(make_pair("deferred/giV.glsl", GL_VERTEX_SHADER_ARB));
1024 gDeferredGIProgram.mShaderFiles.push_back(make_pair("deferred/giF.glsl", GL_FRAGMENT_SHADER_ARB));
1025 gDeferredGIProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
1026 success = gDeferredGIProgram.createShader(NULL, NULL);
1027 }
1028
1029 if (success)
1030 {
945 // load water shader 1031 // load water shader
946 gDeferredWaterProgram.mName = "Deferred Water Shader"; 1032 gDeferredWaterProgram.mName = "Deferred Water Shader";
947 gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true; 1033 gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true;
@@ -1022,6 +1108,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
1022 success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); 1108 success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
1023 } 1109 }
1024 1110
1111 if (success)
1112 {
1113 gLuminanceGatherProgram.mName = "Luminance Gather Shader";
1114 gLuminanceGatherProgram.mShaderFiles.clear();
1115 gLuminanceGatherProgram.mShaderFiles.push_back(make_pair("deferred/luminanceV.glsl", GL_VERTEX_SHADER_ARB));
1116 gLuminanceGatherProgram.mShaderFiles.push_back(make_pair("deferred/luminanceF.glsl", GL_FRAGMENT_SHADER_ARB));
1117 gLuminanceGatherProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
1118 success = gLuminanceGatherProgram.createShader(NULL, NULL);
1119 }
1120
1025 return success; 1121 return success;
1026} 1122}
1027 1123