diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llviewerdisplay.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llviewerdisplay.cpp')
-rw-r--r-- | linden/indra/newview/llviewerdisplay.cpp | 122 |
1 files changed, 99 insertions, 23 deletions
diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp index 96591a2..54c6f0a 100644 --- a/linden/indra/newview/llviewerdisplay.cpp +++ b/linden/indra/newview/llviewerdisplay.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -107,7 +108,7 @@ LLFrameTimer gRecentMemoryTime; | |||
107 | // Rendering stuff | 108 | // Rendering stuff |
108 | void pre_show_depth_buffer(); | 109 | void pre_show_depth_buffer(); |
109 | void post_show_depth_buffer(); | 110 | void post_show_depth_buffer(); |
110 | void render_ui(); | 111 | void render_ui(F32 zoom_factor = 1.f, int subfield = 0); |
111 | void render_hud_attachments(); | 112 | void render_hud_attachments(); |
112 | void render_ui_3d(); | 113 | void render_ui_3d(); |
113 | void render_ui_2d(); | 114 | void render_ui_2d(); |
@@ -160,9 +161,9 @@ void display_startup() | |||
160 | glClear(GL_DEPTH_BUFFER_BIT); | 161 | glClear(GL_DEPTH_BUFFER_BIT); |
161 | } | 162 | } |
162 | 163 | ||
163 | |||
164 | void display_update_camera() | 164 | void display_update_camera() |
165 | { | 165 | { |
166 | llpushcallstacks ; | ||
166 | // TODO: cut draw distance down if customizing avatar? | 167 | // TODO: cut draw distance down if customizing avatar? |
167 | // TODO: cut draw distance on per-parcel basis? | 168 | // TODO: cut draw distance on per-parcel basis? |
168 | 169 | ||
@@ -499,12 +500,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
499 | if (LLDynamicTexture::updateAllInstances()) | 500 | if (LLDynamicTexture::updateAllInstances()) |
500 | { | 501 | { |
501 | gGL.setColorMask(true, true); | 502 | gGL.setColorMask(true, true); |
502 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | 503 | glClear(GL_DEPTH_BUFFER_BIT); |
503 | } | 504 | } |
504 | } | 505 | } |
505 | 506 | ||
506 | gViewerWindow->setupViewport(); | 507 | gViewerWindow->setupViewport(); |
507 | 508 | ||
509 | gPipeline.resetFrameStats(); // Reset per-frame statistics. | ||
508 | if (!gDisconnected) | 510 | if (!gDisconnected) |
509 | { | 511 | { |
510 | LLAppViewer::instance()->pingMainloopTimeout("Display:Update"); | 512 | LLAppViewer::instance()->pingMainloopTimeout("Display:Update"); |
@@ -527,6 +529,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
527 | 529 | ||
528 | gFrameStats.start(LLFrameStats::UPDATE_GEOM); | 530 | gFrameStats.start(LLFrameStats::UPDATE_GEOM); |
529 | const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time | 531 | const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time |
532 | gPipeline.createObjects(max_geom_update_time); | ||
530 | gPipeline.updateGeom(max_geom_update_time); | 533 | gPipeline.updateGeom(max_geom_update_time); |
531 | stop_glerror(); | 534 | stop_glerror(); |
532 | 535 | ||
@@ -556,10 +559,17 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
556 | && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") | 559 | && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") |
557 | && gSavedSettings.getBOOL("UseOcclusion") | 560 | && gSavedSettings.getBOOL("UseOcclusion") |
558 | && gGLManager.mHasOcclusionQuery) ? 2 : 0; | 561 | && gGLManager.mHasOcclusionQuery) ? 2 : 0; |
562 | |||
563 | if (LLPipeline::sUseOcclusion && LLPipeline::sRenderDeferred) | ||
564 | { //force occlusion on for all render types if doing deferred render | ||
565 | LLPipeline::sUseOcclusion = 3; | ||
566 | } | ||
567 | |||
559 | LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha"); | 568 | LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha"); |
560 | LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip"); | 569 | LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip"); |
561 | LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible"); | 570 | LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible"); |
562 | 571 | LLPipeline::sDelayVBUpdate = gSavedSettings.getBOOL("RenderDelayVBUpdate"); | |
572 | |||
563 | S32 occlusion = LLPipeline::sUseOcclusion; | 573 | S32 occlusion = LLPipeline::sUseOcclusion; |
564 | if (gDepthDirty) | 574 | if (gDepthDirty) |
565 | { //depth buffer is invalid, don't overwrite occlusion state | 575 | { //depth buffer is invalid, don't overwrite occlusion state |
@@ -567,18 +577,25 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
567 | } | 577 | } |
568 | gDepthDirty = FALSE; | 578 | gDepthDirty = FALSE; |
569 | 579 | ||
580 | LLGLState::checkStates(); | ||
581 | LLGLState::checkTextureChannels(); | ||
582 | LLGLState::checkClientArrays(); | ||
583 | |||
570 | static LLCullResult result; | 584 | static LLCullResult result; |
571 | gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip); | 585 | gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip); |
572 | stop_glerror(); | 586 | stop_glerror(); |
573 | 587 | ||
588 | LLGLState::checkStates(); | ||
589 | LLGLState::checkTextureChannels(); | ||
590 | LLGLState::checkClientArrays(); | ||
591 | |||
574 | BOOL to_texture = !for_snapshot && | 592 | BOOL to_texture = !for_snapshot && |
575 | gPipeline.canUseVertexShaders() && | 593 | gPipeline.canUseVertexShaders() && |
576 | LLPipeline::sRenderGlow; | 594 | LLPipeline::sRenderGlow; |
577 | 595 | ||
578 | LLAppViewer::instance()->pingMainloopTimeout("Display:Swap"); | 596 | LLAppViewer::instance()->pingMainloopTimeout("Display:Swap"); |
579 | 597 | ||
580 | // now do the swap buffer (just before rendering to framebuffer) | 598 | { |
581 | { //swap and flush state from previous frame | ||
582 | { | 599 | { |
583 | LLFastTimer ftm(LLFastTimer::FTM_CLIENT_COPY); | 600 | LLFastTimer ftm(LLFastTimer::FTM_CLIENT_COPY); |
584 | LLVertexBuffer::clientCopy(0.016); | 601 | LLVertexBuffer::clientCopy(0.016); |
@@ -592,14 +609,29 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
592 | 609 | ||
593 | gGL.setColorMask(true, true); | 610 | gGL.setColorMask(true, true); |
594 | glClearColor(0,0,0,0); | 611 | glClearColor(0,0,0,0); |
595 | 612 | ||
613 | LLGLState::checkStates(); | ||
614 | LLGLState::checkTextureChannels(); | ||
615 | LLGLState::checkClientArrays(); | ||
616 | |||
596 | if (!for_snapshot) | 617 | if (!for_snapshot) |
597 | { | 618 | { |
619 | if (gFrameCount > 1) | ||
620 | { //for some reason, ATI 4800 series will error out if you | ||
621 | //try to generate a shadow before the first frame is through | ||
622 | gPipeline.generateSunShadow(*LLViewerCamera::getInstance()); | ||
623 | } | ||
624 | |||
625 | LLGLState::checkStates(); | ||
626 | LLGLState::checkTextureChannels(); | ||
627 | LLGLState::checkClientArrays(); | ||
628 | |||
598 | glh::matrix4f proj = glh_get_current_projection(); | 629 | glh::matrix4f proj = glh_get_current_projection(); |
599 | glh::matrix4f mod = glh_get_current_modelview(); | 630 | glh::matrix4f mod = glh_get_current_modelview(); |
600 | glViewport(0,0,512,512); | 631 | glViewport(0,0,512,512); |
601 | LLVOAvatar::updateFreezeCounter() ; | 632 | LLVOAvatar::updateFreezeCounter() ; |
602 | LLVOAvatar::updateImpostors(); | 633 | LLVOAvatar::updateImpostors(); |
634 | |||
603 | glh_set_current_projection(proj); | 635 | glh_set_current_projection(proj); |
604 | glh_set_current_modelview(mod); | 636 | glh_set_current_modelview(mod); |
605 | glMatrixMode(GL_PROJECTION); | 637 | glMatrixMode(GL_PROJECTION); |
@@ -607,8 +639,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
607 | glMatrixMode(GL_MODELVIEW); | 639 | glMatrixMode(GL_MODELVIEW); |
608 | glLoadMatrixf(mod.m); | 640 | glLoadMatrixf(mod.m); |
609 | gViewerWindow->setupViewport(); | 641 | gViewerWindow->setupViewport(); |
642 | |||
643 | LLGLState::checkStates(); | ||
644 | LLGLState::checkTextureChannels(); | ||
645 | LLGLState::checkClientArrays(); | ||
646 | |||
610 | } | 647 | } |
611 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 648 | glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
612 | } | 649 | } |
613 | 650 | ||
614 | if (!for_snapshot) | 651 | if (!for_snapshot) |
@@ -625,6 +662,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
625 | // | 662 | // |
626 | // Doing this here gives hardware occlusion queries extra time to complete | 663 | // Doing this here gives hardware occlusion queries extra time to complete |
627 | LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages"); | 664 | LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages"); |
665 | LLError::LLCallStacks::clear() ; | ||
666 | llpushcallstacks ; | ||
628 | gFrameStats.start(LLFrameStats::IMAGE_UPDATE); | 667 | gFrameStats.start(LLFrameStats::IMAGE_UPDATE); |
629 | 668 | ||
630 | { | 669 | { |
@@ -639,7 +678,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
639 | gImageList.updateImages(max_image_decode_time); | 678 | gImageList.updateImages(max_image_decode_time); |
640 | stop_glerror(); | 679 | stop_glerror(); |
641 | } | 680 | } |
642 | 681 | llpushcallstacks ; | |
643 | /////////////////////////////////// | 682 | /////////////////////////////////// |
644 | // | 683 | // |
645 | // StateSort | 684 | // StateSort |
@@ -721,11 +760,25 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
721 | // glPopMatrix(); | 760 | // glPopMatrix(); |
722 | //} | 761 | //} |
723 | 762 | ||
763 | LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; | ||
764 | LLPipeline::updateRenderDeferred(); | ||
765 | |||
766 | stop_glerror(); | ||
767 | |||
724 | if (to_texture) | 768 | if (to_texture) |
725 | { | 769 | { |
726 | gGL.setColorMask(true, true); | 770 | gGL.setColorMask(true, true); |
727 | gPipeline.mScreen.bindTarget(); | 771 | if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) |
728 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 772 | { |
773 | gPipeline.mDeferredScreen.bindTarget(); | ||
774 | gPipeline.mDeferredScreen.clear(); | ||
775 | } | ||
776 | else | ||
777 | { | ||
778 | gPipeline.mScreen.bindTarget(); | ||
779 | gPipeline.mScreen.clear(); | ||
780 | } | ||
781 | |||
729 | gGL.setColorMask(true, false); | 782 | gGL.setColorMask(true, false); |
730 | } | 783 | } |
731 | 784 | ||
@@ -736,9 +789,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
736 | { | 789 | { |
737 | 790 | ||
738 | gGL.setColorMask(true, false); | 791 | gGL.setColorMask(true, false); |
739 | LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; | 792 | if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) |
740 | gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE); | 793 | { |
741 | LLPipeline::sUnderWaterRender = FALSE; | 794 | gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance()); |
795 | } | ||
796 | else | ||
797 | { | ||
798 | gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE); | ||
799 | } | ||
800 | |||
742 | gGL.setColorMask(true, true); | 801 | gGL.setColorMask(true, true); |
743 | 802 | ||
744 | //store this frame's modelview matrix for use | 803 | //store this frame's modelview matrix for use |
@@ -754,8 +813,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
754 | 813 | ||
755 | if (to_texture) | 814 | if (to_texture) |
756 | { | 815 | { |
757 | 816 | if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) | |
758 | gPipeline.mScreen.flush(); | 817 | { |
818 | gPipeline.mDeferredScreen.flush(); | ||
819 | } | ||
820 | else | ||
821 | { | ||
822 | gPipeline.mScreen.flush(); | ||
823 | } | ||
759 | } | 824 | } |
760 | 825 | ||
761 | /// We copy the frame buffer straight into a texture here, | 826 | /// We copy the frame buffer straight into a texture here, |
@@ -764,8 +829,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
764 | /// grasp of their full display stack just yet. | 829 | /// grasp of their full display stack just yet. |
765 | // gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); | 830 | // gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); |
766 | 831 | ||
832 | if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) | ||
833 | { | ||
834 | gPipeline.renderDeferredLighting(); | ||
835 | } | ||
836 | |||
837 | LLPipeline::sUnderWaterRender = FALSE; | ||
838 | |||
767 | LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); | 839 | LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); |
768 | |||
769 | if (!for_snapshot) | 840 | if (!for_snapshot) |
770 | { | 841 | { |
771 | gFrameStats.start(LLFrameStats::RENDER_UI); | 842 | gFrameStats.start(LLFrameStats::RENDER_UI); |
@@ -817,7 +888,10 @@ void render_hud_attachments() | |||
817 | //only render hud objects | 888 | //only render hud objects |
818 | U32 mask = gPipeline.getRenderTypeMask(); | 889 | U32 mask = gPipeline.getRenderTypeMask(); |
819 | gPipeline.setRenderTypeMask(0); | 890 | gPipeline.setRenderTypeMask(0); |
820 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD); | 891 | if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) |
892 | { | ||
893 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD); | ||
894 | } | ||
821 | 895 | ||
822 | BOOL has_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); | 896 | BOOL has_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); |
823 | if (has_ui) | 897 | if (has_ui) |
@@ -828,16 +902,18 @@ void render_hud_attachments() | |||
828 | S32 use_occlusion = LLPipeline::sUseOcclusion; | 902 | S32 use_occlusion = LLPipeline::sUseOcclusion; |
829 | LLPipeline::sUseOcclusion = 0; | 903 | LLPipeline::sUseOcclusion = 0; |
830 | LLPipeline::sDisableShaders = TRUE; | 904 | LLPipeline::sDisableShaders = TRUE; |
831 | 905 | ||
832 | //cull, sort, and render hud objects | 906 | //cull, sort, and render hud objects |
833 | static LLCullResult result; | 907 | static LLCullResult result; |
834 | LLSpatialGroup::sNoDelete = TRUE; | 908 | LLSpatialGroup::sNoDelete = TRUE; |
909 | |||
835 | gPipeline.updateCull(hud_cam, result); | 910 | gPipeline.updateCull(hud_cam, result); |
836 | 911 | ||
837 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP); | 912 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP); |
838 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE); | 913 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE); |
839 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); | 914 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); |
840 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); | 915 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); |
916 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT); | ||
841 | 917 | ||
842 | gPipeline.stateSort(hud_cam, result); | 918 | gPipeline.stateSort(hud_cam, result); |
843 | 919 | ||
@@ -934,7 +1010,7 @@ BOOL setup_hud_matrices(const LLRect& screen_region) | |||
934 | } | 1010 | } |
935 | 1011 | ||
936 | 1012 | ||
937 | void render_ui() | 1013 | void render_ui(F32 zoom_factor, int subfield) |
938 | { | 1014 | { |
939 | LLGLState::checkStates(); | 1015 | LLGLState::checkStates(); |
940 | 1016 | ||
@@ -949,7 +1025,7 @@ void render_ui() | |||
949 | 1025 | ||
950 | if (to_texture) | 1026 | if (to_texture) |
951 | { | 1027 | { |
952 | gPipeline.renderBloom(gSnapshot); | 1028 | gPipeline.renderBloom(gSnapshot, zoom_factor, subfield); |
953 | } | 1029 | } |
954 | 1030 | ||
955 | render_hud_elements(); | 1031 | render_hud_elements(); |