diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvectorperfoptions.cpp | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/linden/indra/newview/llvectorperfoptions.cpp b/linden/indra/newview/llvectorperfoptions.cpp new file mode 100644 index 0000000..f8b8dd5 --- /dev/null +++ b/linden/indra/newview/llvectorperfoptions.cpp | |||
@@ -0,0 +1,121 @@ | |||
1 | /** | ||
2 | * @file llvectorperfoptions.cpp | ||
3 | * @brief Control of vector perfomance options. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2001&license=internal$ | ||
6 | * | ||
7 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
8 | * | ||
9 | * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of | ||
10 | * this source code is governed by the Linden Lab Source Code Disclosure | ||
11 | * Agreement ("Agreement") previously entered between you and Linden | ||
12 | * Lab. By accessing, using, copying, modifying or distributing this | ||
13 | * software, you acknowledge that you have been informed of your | ||
14 | * obligations under the Agreement and agree to abide by those obligations. | ||
15 | * | ||
16 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
17 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
18 | * COMPLETENESS OR PERFORMANCE. | ||
19 | * $/LicenseInfo$ | ||
20 | */ | ||
21 | |||
22 | #include "llviewerprecompiledheaders.h" | ||
23 | |||
24 | #include "llvectorperfoptions.h" | ||
25 | #include "llviewerjointmesh.h" | ||
26 | #include "llviewercontrol.h" | ||
27 | |||
28 | // Initially, we test the performance of the vectorization code, then | ||
29 | // turn it off if it ends up being slower. JC | ||
30 | BOOL gVectorizePerfTest = TRUE; | ||
31 | BOOL gVectorizeEnable = FALSE; | ||
32 | U32 gVectorizeProcessor = 0; | ||
33 | BOOL gVectorizeSkin = FALSE; | ||
34 | |||
35 | void update_vector_performances(void) | ||
36 | { | ||
37 | char *vp; | ||
38 | |||
39 | switch(gVectorizeProcessor) | ||
40 | { | ||
41 | case 2: vp = "SSE2"; break; // *TODO: replace the magic #s | ||
42 | case 1: vp = "SSE"; break; | ||
43 | default: vp = "COMPILER DEFAULT"; break; | ||
44 | } | ||
45 | llinfos << "Vectorization : " << ( gVectorizeEnable ? "ENABLED" : "DISABLED" ) << llendl ; | ||
46 | llinfos << "Vector Processor : " << vp << llendl ; | ||
47 | llinfos << "Vectorized Skinning : " << ( gVectorizeSkin ? "ENABLED" : "DISABLED" ) << llendl ; | ||
48 | |||
49 | if(gVectorizeEnable && gVectorizeSkin) | ||
50 | { | ||
51 | switch(gVectorizeProcessor) | ||
52 | { | ||
53 | case 2: | ||
54 | LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometrySSE2; | ||
55 | break; | ||
56 | case 1: | ||
57 | LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometrySSE; | ||
58 | break; | ||
59 | default: | ||
60 | LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometryVectorized; | ||
61 | break; | ||
62 | } | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometryOriginal; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | |||
71 | class LLVectorizationEnableListener: public LLSimpleListener | ||
72 | { | ||
73 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
74 | { | ||
75 | gVectorizeEnable = event->getValue().asBoolean(); | ||
76 | update_vector_performances(); | ||
77 | return true; | ||
78 | } | ||
79 | }; | ||
80 | static LLVectorizationEnableListener vectorization_enable_listener; | ||
81 | |||
82 | class LLVectorizeSkinListener: public LLSimpleListener | ||
83 | { | ||
84 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
85 | { | ||
86 | gVectorizeSkin = event->getValue().asBoolean(); | ||
87 | update_vector_performances(); | ||
88 | return true; | ||
89 | } | ||
90 | }; | ||
91 | static LLVectorizeSkinListener vectorize_skin_listener; | ||
92 | |||
93 | class LLVectorProcessorListener: public LLSimpleListener | ||
94 | { | ||
95 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
96 | { | ||
97 | gVectorizeProcessor = event->getValue().asInteger(); | ||
98 | update_vector_performances(); | ||
99 | return true; | ||
100 | } | ||
101 | }; | ||
102 | static LLVectorProcessorListener vector_processor_listener; | ||
103 | |||
104 | void LLVectorPerformanceOptions::initClass() | ||
105 | { | ||
106 | gVectorizePerfTest = gSavedSettings.getBOOL("VectorizePerfTest"); | ||
107 | gVectorizeEnable = gSavedSettings.getBOOL("VectorizeEnable"); | ||
108 | gVectorizeProcessor = gSavedSettings.getU32("VectorizeProcessor"); | ||
109 | gVectorizeSkin = gSavedSettings.getBOOL("VectorizeSkin"); | ||
110 | update_vector_performances(); | ||
111 | |||
112 | // these are currently static in this file, so they can't move to settings_setup_listeners | ||
113 | gSavedSettings.getControl("VectorizeEnable")->addListener(&vectorization_enable_listener); | ||
114 | gSavedSettings.getControl("VectorizeProcessor")->addListener(&vector_processor_listener); | ||
115 | gSavedSettings.getControl("VectorizeSkin")->addListener(&vectorize_skin_listener); | ||
116 | } | ||
117 | |||
118 | void LLVectorPerformanceOptions::cleanupClass() | ||
119 | { | ||
120 | } | ||
121 | |||