diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llglslshader.cpp | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/linden/indra/newview/llglslshader.cpp b/linden/indra/newview/llglslshader.cpp index 2a688e4..f0ad565 100644 --- a/linden/indra/newview/llglslshader.cpp +++ b/linden/indra/newview/llglslshader.cpp | |||
@@ -114,6 +114,9 @@ LLGLSLShader gGlowExtractProgram; | |||
114 | LLGLSLShader gPostColorFilterProgram; | 114 | LLGLSLShader gPostColorFilterProgram; |
115 | LLGLSLShader gPostNightVisionProgram; | 115 | LLGLSLShader gPostNightVisionProgram; |
116 | 116 | ||
117 | // Deferred rendering shaders | ||
118 | LLGLSLShader gDeferredDiffuseProgram; | ||
119 | |||
117 | //current avatar shader parameter pointer | 120 | //current avatar shader parameter pointer |
118 | GLint gAvatarMatrixParam; | 121 | GLint gAvatarMatrixParam; |
119 | 122 | ||
@@ -732,7 +735,7 @@ void LLShaderMgr::setShaders() | |||
732 | if (gGLManager.mHasFramebufferObject && | 735 | if (gGLManager.mHasFramebufferObject && |
733 | gSavedSettings.getBOOL("VertexShaderEnable")) | 736 | gSavedSettings.getBOOL("VertexShaderEnable")) |
734 | { | 737 | { |
735 | LLPipeline::sDynamicReflections = gSavedSettings.getBOOL("RenderDynamicReflections") && gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap"); | 738 | LLPipeline::sDynamicReflections = gSavedSettings.getBOOL("RenderDynamicReflections") && gGLManager.mHasCubeMap && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap"); |
736 | LLPipeline::sWaterReflections = gGLManager.mHasCubeMap; | 739 | LLPipeline::sWaterReflections = gGLManager.mHasCubeMap; |
737 | LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); | 740 | LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); |
738 | } | 741 | } |
@@ -762,7 +765,7 @@ void LLShaderMgr::setShaders() | |||
762 | } | 765 | } |
763 | sMaxAvatarShaderLevel = 0; | 766 | sMaxAvatarShaderLevel = 0; |
764 | 767 | ||
765 | if (gFeatureManagerp->isFeatureAvailable("VertexShaderEnable") | 768 | if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") |
766 | && gSavedSettings.getBOOL("VertexShaderEnable")) | 769 | && gSavedSettings.getBOOL("VertexShaderEnable")) |
767 | { | 770 | { |
768 | S32 light_class = 2; | 771 | S32 light_class = 2; |
@@ -771,7 +774,7 @@ void LLShaderMgr::setShaders() | |||
771 | S32 effect_class = 2; | 774 | S32 effect_class = 2; |
772 | S32 wl_class = 2; | 775 | S32 wl_class = 2; |
773 | S32 water_class = 2; | 776 | S32 water_class = 2; |
774 | 777 | S32 deferred_class = 0; | |
775 | if (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")) | 778 | if (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")) |
776 | { | 779 | { |
777 | // user has disabled WindLight in their settings, downgrade | 780 | // user has disabled WindLight in their settings, downgrade |
@@ -784,7 +787,7 @@ void LLShaderMgr::setShaders() | |||
784 | // but class one would | 787 | // but class one would |
785 | // TODO: Make water on class one cards color things | 788 | // TODO: Make water on class one cards color things |
786 | // beneath it properly | 789 | // beneath it properly |
787 | if(gFeatureManagerp->getGPUClass() < GPU_CLASS_2) | 790 | if(LLFeatureManager::getInstance()->getGPUClass() < GPU_CLASS_2) |
788 | { | 791 | { |
789 | // use lesser water and other stuff | 792 | // use lesser water and other stuff |
790 | light_class = 2; | 793 | light_class = 2; |
@@ -795,6 +798,16 @@ void LLShaderMgr::setShaders() | |||
795 | } | 798 | } |
796 | } | 799 | } |
797 | 800 | ||
801 | if (gSavedSettings.getBOOL("RenderDeferred")) | ||
802 | { | ||
803 | light_class = 1; | ||
804 | env_class = 0; | ||
805 | obj_class = 0; | ||
806 | water_class = 1; | ||
807 | effect_class = 1; | ||
808 | deferred_class = 1; | ||
809 | } | ||
810 | |||
798 | if(!gSavedSettings.getBOOL("EnableRippleWater")) | 811 | if(!gSavedSettings.getBOOL("EnableRippleWater")) |
799 | { | 812 | { |
800 | water_class = 0; | 813 | water_class = 0; |
@@ -814,6 +827,7 @@ void LLShaderMgr::setShaders() | |||
814 | sVertexShaderLevel[SHADER_OBJECT] = obj_class; | 827 | sVertexShaderLevel[SHADER_OBJECT] = obj_class; |
815 | sVertexShaderLevel[SHADER_EFFECT] = effect_class; | 828 | sVertexShaderLevel[SHADER_EFFECT] = effect_class; |
816 | sVertexShaderLevel[SHADER_WINDLIGHT] = wl_class; | 829 | sVertexShaderLevel[SHADER_WINDLIGHT] = wl_class; |
830 | sVertexShaderLevel[SHADER_DEFERRED] = deferred_class; | ||
817 | 831 | ||
818 | BOOL loaded = loadBasicShaders(); | 832 | BOOL loaded = loadBasicShaders(); |
819 | 833 | ||
@@ -829,6 +843,7 @@ void LLShaderMgr::setShaders() | |||
829 | loadShadersWindLight(); | 843 | loadShadersWindLight(); |
830 | loadShadersEffects(); | 844 | loadShadersEffects(); |
831 | loadShadersInterface(); | 845 | loadShadersInterface(); |
846 | loadShadersDeferred(); | ||
832 | 847 | ||
833 | // Load max avatar shaders to set the max level | 848 | // Load max avatar shaders to set the max level |
834 | sVertexShaderLevel[SHADER_AVATAR] = 3; | 849 | sVertexShaderLevel[SHADER_AVATAR] = 3; |
@@ -939,6 +954,8 @@ void LLShaderMgr::unloadShaders() | |||
939 | gPostColorFilterProgram.unload(); | 954 | gPostColorFilterProgram.unload(); |
940 | gPostNightVisionProgram.unload(); | 955 | gPostNightVisionProgram.unload(); |
941 | 956 | ||
957 | gDeferredDiffuseProgram.unload(); | ||
958 | |||
942 | sVertexShaderLevel[SHADER_LIGHTING] = 0; | 959 | sVertexShaderLevel[SHADER_LIGHTING] = 0; |
943 | sVertexShaderLevel[SHADER_OBJECT] = 0; | 960 | sVertexShaderLevel[SHADER_OBJECT] = 0; |
944 | sVertexShaderLevel[SHADER_AVATAR] = 0; | 961 | sVertexShaderLevel[SHADER_AVATAR] = 0; |
@@ -963,7 +980,7 @@ BOOL LLShaderMgr::loadBasicShaders() | |||
963 | // class zero we're not going to think about | 980 | // class zero we're not going to think about |
964 | // since a class zero card COULD be a ridiculous new card | 981 | // since a class zero card COULD be a ridiculous new card |
965 | // and old cards should have the features masked | 982 | // and old cards should have the features masked |
966 | if(gFeatureManagerp->getGPUClass() == GPU_CLASS_1) | 983 | if(LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_1) |
967 | { | 984 | { |
968 | sum_lights_class = 2; | 985 | sum_lights_class = 2; |
969 | } | 986 | } |
@@ -1061,10 +1078,7 @@ BOOL LLShaderMgr::loadShadersEnvironment() | |||
1061 | return FALSE; | 1078 | return FALSE; |
1062 | } | 1079 | } |
1063 | 1080 | ||
1064 | if (gWorldPointer) | 1081 | LLWorld::getInstance()->updateWaterObjects(); |
1065 | { | ||
1066 | gWorldPointer->updateWaterObjects(); | ||
1067 | } | ||
1068 | 1082 | ||
1069 | return TRUE; | 1083 | return TRUE; |
1070 | } | 1084 | } |
@@ -1147,10 +1161,8 @@ BOOL LLShaderMgr::loadShadersWater() | |||
1147 | return loadShadersWater(); | 1161 | return loadShadersWater(); |
1148 | } | 1162 | } |
1149 | 1163 | ||
1150 | if (gWorldPointer) | 1164 | LLWorld::getInstance()->updateWaterObjects(); |
1151 | { | 1165 | |
1152 | gWorldPointer->updateWaterObjects(); | ||
1153 | } | ||
1154 | return TRUE; | 1166 | return TRUE; |
1155 | } | 1167 | } |
1156 | 1168 | ||
@@ -1244,6 +1256,29 @@ BOOL LLShaderMgr::loadShadersEffects() | |||
1244 | 1256 | ||
1245 | } | 1257 | } |
1246 | 1258 | ||
1259 | BOOL LLShaderMgr::loadShadersDeferred() | ||
1260 | { | ||
1261 | if (sVertexShaderLevel[SHADER_DEFERRED] == 0) | ||
1262 | { | ||
1263 | gDeferredDiffuseProgram.unload(); | ||
1264 | return FALSE; | ||
1265 | } | ||
1266 | |||
1267 | BOOL success = TRUE; | ||
1268 | |||
1269 | if (success) | ||
1270 | { | ||
1271 | gDeferredDiffuseProgram.mName = "Deffered Diffuse Shader"; | ||
1272 | gDeferredDiffuseProgram.mShaderFiles.clear(); | ||
1273 | gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); | ||
1274 | gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
1275 | gDeferredDiffuseProgram.mShaderLevel = sVertexShaderLevel[SHADER_DEFERRED]; | ||
1276 | success = gDeferredDiffuseProgram.createShader(NULL, NULL); | ||
1277 | } | ||
1278 | |||
1279 | return success; | ||
1280 | } | ||
1281 | |||
1247 | BOOL LLShaderMgr::loadShadersObject() | 1282 | BOOL LLShaderMgr::loadShadersObject() |
1248 | { | 1283 | { |
1249 | BOOL success = TRUE; | 1284 | BOOL success = TRUE; |