aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/pipeline.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/pipeline.h')
-rw-r--r--linden/indra/newview/pipeline.h678
1 files changed, 678 insertions, 0 deletions
diff --git a/linden/indra/newview/pipeline.h b/linden/indra/newview/pipeline.h
new file mode 100644
index 0000000..5d00959
--- /dev/null
+++ b/linden/indra/newview/pipeline.h
@@ -0,0 +1,678 @@
1/**
2 * @file pipeline.h
3 * @brief Rendering pipeline definitions
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_PIPELINE_H
29#define LL_PIPELINE_H
30
31#include "llagparray.h"
32#include "lldarrayptr.h"
33#include "lldqueueptr.h"
34#include "llstat.h"
35#include "lllinkedqueue.h"
36#include "llskiplist.h"
37#include "lldrawpool.h"
38#include "llspatialpartition.h"
39#include "m4math.h"
40#include "llmemory.h"
41#include "lldrawpool.h"
42#include "llgl.h"
43
44class LLViewerImage;
45class LLDrawable;
46class LLEdge;
47class LLFace;
48class LLViewerObject;
49class LLAgent;
50class LLDisplayPrimitive;
51class LLTextureEntry;
52class LLRenderFunc;
53class LLAGPMemPool;
54class LLAGPMemBlock;
55
56typedef enum e_avatar_skinning_method
57{
58 SKIN_METHOD_SOFTWARE,
59 SKIN_METHOD_VERTEX_PROGRAM
60} EAvatarSkinningMethod;
61
62BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn't be defined here!
63bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0);
64BOOL LLLineSegmentAABB(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size);
65
66class LLGLSLShader
67{
68public:
69 LLGLSLShader();
70
71 void unload();
72 void attachObject(GLhandleARB object);
73 void attachObjects(GLhandleARB* objects = NULL, S32 count = 0);
74 BOOL mapAttributes(const char** attrib_names = NULL, S32 count = 0);
75 BOOL mapUniforms(const char** uniform_names = NULL, S32 count = 0);
76 void mapUniform(GLint index, const char** uniform_names = NULL, S32 count = 0);
77 void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
78 void vertexAttrib4fv(U32 index, GLfloat* v);
79
80 GLint mapUniformTextureChannel(GLint location, GLenum type);
81
82
83 //enable/disable texture channel for specified uniform
84 //if given texture uniform is active in the shader,
85 //the corresponding channel will be active upon return
86 //returns channel texture is enabled in from [0-MAX)
87 S32 enableTexture(S32 uniform, S32 mode = GL_TEXTURE_2D);
88 S32 disableTexture(S32 uniform, S32 mode = GL_TEXTURE_2D);
89
90 BOOL link(BOOL suppress_errors = FALSE);
91 void bind();
92 void unbind();
93
94
95 GLhandleARB mProgramObject;
96 std::vector<GLint> mAttribute;
97 std::vector<GLint> mUniform;
98 std::vector<GLint> mTexture;
99 S32 mActiveTextureChannels;
100};
101
102class LLPipeline
103{
104public:
105 LLPipeline();
106 ~LLPipeline();
107
108 void destroyGL();
109 void restoreGL();
110
111 void init();
112 void cleanup();
113
114 /// @brief Get a draw pool from pool type (POOL_SIMPLE, POOL_MEDIA) and texture.
115 /// @return Draw pool, or NULL if not found.
116 LLDrawPool *findPool(const U32 pool_type, LLViewerImage *tex0 = NULL);
117
118 /// @brief Get a draw pool for faces of the appropriate type and texture. Create if necessary.
119 /// @return Always returns a draw pool.
120 LLDrawPool *getPool(const U32 pool_type, LLViewerImage *tex0 = NULL);
121
122 /// @brief Figures out draw pool type from texture entry. Creates pool if necessary.
123 static LLDrawPool* getPoolFromTE(const LLTextureEntry* te, LLViewerImage* te_image);
124
125 void addPool(LLDrawPool *poolp); // Only to be used by LLDrawPool classes for splitting pools!
126 void removePool( LLDrawPool* poolp );
127
128 void allocDrawable(LLViewerObject *obj);
129
130 void unlinkDrawable(LLDrawable*);
131
132 // Object related methods
133 void markVisible(LLDrawable *drawablep);
134 void doOcclusion();
135 void markNotCulled(LLDrawable* drawablep, LLCamera& camera);
136 void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE);
137 void markShift(LLDrawable *drawablep);
138 void markTextured(LLDrawable *drawablep);
139 void markMaterialed(LLDrawable *drawablep);
140 void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE);
141 void markRelight(LLDrawable *drawablep, const BOOL now = FALSE);
142
143 //get the object between start and end that's closest to start. Return the point of collision in collision.
144 LLViewerObject* pickObject(const LLVector3 &start, const LLVector3 &end, LLVector3 &collision);
145
146 void dirtyPoolObjectTextures(const LLViewerImage *texture); // Something about this texture has changed. Dirty it.
147
148 void resetDrawOrders();
149
150 U32 addObject(LLViewerObject *obj);
151
152 BOOL usingAGP() const;
153 void setUseAGP(const BOOL use_agp); // Attempt to use AGP;
154
155 void enableShadows(const BOOL enable_shadows);
156
157// void setLocalLighting(const BOOL local_lighting);
158// BOOL isLocalLightingEnabled() const;
159 S32 setLightingDetail(S32 level);
160 S32 getLightingDetail() const { return mLightingDetail; }
161 S32 getMaxLightingDetail() const;
162
163 void setUseVertexShaders(BOOL use_shaders);
164 BOOL getUseVertexShaders() const { return mVertexShadersEnabled; }
165 BOOL canUseVertexShaders();
166 BOOL setVertexShaderLevel(S32 type, S32 level);
167 S32 getVertexShaderLevel(S32 type) const { return mVertexShaderLevel[type]; }
168 S32 getMaxVertexShaderLevel(S32 type) const { return mMaxVertexShaderLevel[type]; }
169
170 void setShaders();
171
172 void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
173 BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
174 BOOL validateProgramObject(GLhandleARB obj);
175 GLhandleARB loadShader(const LLString& filename, S32 cls, GLenum type);
176
177 void setUseOcclusionCulling(BOOL b) { mUseOcclusionCulling = b; }
178 BOOL getUseOcclusionCulling() const { return mUseOcclusionCulling; }
179
180 BOOL initAGP();
181 void cleanupAGP();
182 LLAGPMemBlock *allocAGPFromPool(const S32 bytes, const U32 target); // Static flag is ignored for now.
183 void flushAGPMemory(); // Clear all AGP memory blocks (to pack & reduce fragmentation)
184
185 // phases
186 void resetFrameStats();
187
188 void updateMoveDampedAsync(LLDrawable* drawablep);
189 void updateMoveNormalAsync(LLDrawable* drawablep);
190 void updateMove();
191 void updateCull();
192 void updateGeom(F32 max_dtime);
193
194 void stateSort();
195
196 void renderGeom();
197 void renderHighlights();
198 void renderDebug();
199
200 void renderForSelect();
201 void renderFaceForUVSelect(LLFace* facep);
202 void rebuildPools(); // Rebuild pools
203
204 // bindAGP and unbindAGP are used to bind AGP memory.
205 // AGP should never be bound if you're writing/copying data to AGP.
206 // bindAGP will do the correct thing if AGP rendering has been disabled globally.
207 void bindAGP();
208 void unbindAGP();
209 inline BOOL isAGPBound() const { return mAGPBound; }
210
211 void setupVisibility();
212 void computeVisibility();
213
214 LLViewerObject *nearestObjectAt(F32 yaw, F32 pitch); // CCW yaw from +X = 0 radians, pitch down from +Y = 0 radians, NULL if no object
215
216 void displayPools();
217 void displayAGP();
218 void displayMap();
219 void displaySSBB();
220 void displayQueues();
221 void printPools();
222
223 void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object
224 BOOL verify(); // Verify that all data in the pipeline is "correct"
225
226 // just the AGP part
227 S32 getAGPMemUsage();
228
229 // all pools
230 S32 getMemUsage(const BOOL print = FALSE);
231
232 S32 getVisibleCount() const { return mVisibleList.size(); }
233 S32 getLightCount() const { return mLights.size(); }
234
235 void calcNearbyLights();
236 void setupHWLights(LLDrawPool* pool);
237 void setupAvatarLights(BOOL for_edit = FALSE);
238 void enableLights(U32 mask, F32 shadow_factor);
239 void enableLightsStatic(F32 shadow_factor);
240 void enableLightsDynamic(F32 shadow_factor);
241 void enableLightsAvatar(F32 shadow_factor);
242 void enableLightsAvatarEdit(const LLColor4& color);
243 void enableLightsFullbright(const LLColor4& color);
244 void disableLights();
245 void setAmbient(const LLColor4& ambient);
246
247 void shiftObjects(const LLVector3 &offset);
248
249 void setLight(LLDrawable *drawablep, BOOL is_light);
250 void setActive(LLDrawable *drawablep, BOOL active);
251
252 BOOL hasRenderType(const U32 type) const { return (type && (mRenderTypeMask & (1<<type))) ? TRUE : FALSE; }
253 BOOL hasRenderDebugFeatureMask(const U32 mask) const { return (mRenderDebugFeatureMask & mask) ? TRUE : FALSE; }
254 BOOL hasRenderFeatureMask(const U32 mask) const { return (mRenderFeatureMask & mask) ? TRUE : FALSE; }
255 BOOL hasRenderDebugMask(const U32 mask) const { return (mRenderDebugMask & mask) ? TRUE : FALSE; }
256
257 // Vertex buffer stuff?
258 U8* bufferGetScratchMemory(void);
259 void bufferWaitFence(void);
260 void bufferSendFence(void);
261 void bufferRotate(void);
262
263 // For UI control of render features
264 static void toggleRenderType(void* data);
265 static void toggleRenderDebug(void* data);
266 static void toggleRenderDebugFeature(void* data);
267 static BOOL toggleRenderTypeControl(void* data);
268 static BOOL toggleRenderTypeControlNegated(void* data);
269 static BOOL toggleRenderDebugControl(void* data);
270 static BOOL toggleRenderDebugFeatureControl(void* data);
271
272 static void toggleRenderParticleBeacons(void* data);
273 static BOOL getRenderParticleBeacons(void* data);
274
275 static void toggleRenderSoundBeacons(void* data);
276 static BOOL getRenderSoundBeacons(void* data);
277
278 static void toggleRenderPhysicalBeacons(void* data);
279 static BOOL getRenderPhysicalBeacons(void* data);
280
281 static void toggleRenderScriptedBeacons(void* data);
282 static BOOL getRenderScriptedBeacons(void* data);
283
284private:
285 void initShaders(BOOL force);
286 void unloadShaders();
287 BOOL loadShaders();
288 BOOL loadShadersLighting();
289 BOOL loadShadersObject();
290 BOOL loadShadersAvatar();
291 BOOL loadShadersEnvironment();
292 BOOL loadShadersInterface();
293 void saveVertexShaderLevel(S32 type, S32 level, S32 max);
294 void addToQuickLookup( LLDrawPool* new_poolp );
295 void removeFromQuickLookup( LLDrawPool* poolp );
296 BOOL updateDrawableGeom(LLDrawable* drawable, BOOL priority);
297
298public:
299 enum {GPU_CLASS_MAX = 3 };
300 enum EShaderClass
301 {
302 SHADER_LIGHTING,
303 SHADER_OBJECT,
304 SHADER_AVATAR,
305 SHADER_ENVIRONMENT,
306 SHADER_INTERFACE,
307 SHADER_COUNT
308 };
309 enum LLRenderTypeMask
310 {
311 // Following are pool types (some are also object types)
312 RENDER_TYPE_SKY = LLDrawPool::POOL_SKY,
313 RENDER_TYPE_STARS = LLDrawPool::POOL_STARS,
314 RENDER_TYPE_GROUND = LLDrawPool::POOL_GROUND,
315 RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN,
316 RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE,
317 RENDER_TYPE_MEDIA = LLDrawPool::POOL_MEDIA,
318 RENDER_TYPE_BUMP = LLDrawPool::POOL_BUMP,
319 RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR,
320 RENDER_TYPE_TREE = LLDrawPool::POOL_TREE,
321 RENDER_TYPE_TREE_NEW = LLDrawPool::POOL_TREE_NEW,
322 RENDER_TYPE_WATER = LLDrawPool::POOL_WATER,
323 RENDER_TYPE_CLOUDS = LLDrawPool::POOL_CLOUDS,
324 RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA,
325 RENDER_TYPE_HUD = LLDrawPool::POOL_HUD,
326
327 // Following are object types (only used in drawable mRenderType)
328 RENDER_TYPE_VOLUME,
329 RENDER_TYPE_GRASS,
330 RENDER_TYPE_PARTICLES,
331 };
332
333 enum LLRenderDebugFeatureMask
334 {
335 RENDER_DEBUG_FEATURE_UI = 0x0001,
336 RENDER_DEBUG_FEATURE_SELECTED = 0x0002,
337 RENDER_DEBUG_FEATURE_HIGHLIGHTED = 0x0004,
338 RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES = 0x0008,
339// RENDER_DEBUG_FEATURE_HW_LIGHTING = 0x0010,
340 RENDER_DEBUG_FEATURE_FLEXIBLE = 0x0010,
341 RENDER_DEBUG_FEATURE_FOG = 0x0020,
342 RENDER_DEBUG_FEATURE_PALETTE = 0x0040,
343 RENDER_DEBUG_FEATURE_FR_INFO = 0x0080,
344 RENDER_DEBUG_FEATURE_CHAIN_FACES = 0x0100
345 };
346
347 enum LLRenderFeatureMask
348 {
349 RENDER_FEATURE_AGP = 0x01,
350// RENDER_FEATURE_LOCAL_LIGHTING = 0x02,
351 RENDER_FEATURE_OBJECT_BUMP = 0x04,
352 RENDER_FEATURE_AVATAR_BUMP = 0x08,
353// RENDER_FEATURE_SHADOWS = 0x10,
354 RENDER_FEATURE_RIPPLE_WATER = 0X20
355 };
356
357 enum LLRenderDebugMask
358 {
359 RENDER_DEBUG_LIGHT_TRACE = 0x0001,
360 RENDER_DEBUG_POOLS = 0x0002,
361 RENDER_DEBUG_MAP = 0x0004,
362 RENDER_DEBUG_AGP_MEM = 0x0008,
363 RENDER_DEBUG_QUEUES = 0x0010,
364 RENDER_DEBUG_COMPOSITION = 0x0020,
365 RENDER_DEBUG_SSBB = 0x0040,
366 RENDER_DEBUG_VERIFY = 0x0080,
367 RENDER_DEBUG_SHADOW_MAP = 0x0100,
368 RENDER_DEBUG_BBOXES = 0x0200,
369 RENDER_DEBUG_OCTREE = 0x0400,
370 RENDER_DEBUG_FACE_CHAINS = 0x0800,
371 RENDER_DEBUG_OCCLUSION = 0x1000,
372 RENDER_DEBUG_POINTS = 0x2000,
373 RENDER_DEBUG_TEXTURE_PRIORITY = 0x4000,
374 };
375
376 LLPointer<LLViewerImage> mAlphaSizzleImagep;
377
378 LLSpatialPartition *mObjectPartition;
379
380 BOOL mBackfaceCull;
381 S32 mTrianglesDrawn;
382 LLStat mTrianglesDrawnStat;
383 LLStat mCompilesStat;
384 S32 mVerticesRelit;
385 LLStat mVerticesRelitStat;
386
387 S32 mLightingChanges;
388 LLStat mLightingChangesStat;
389 S32 mGeometryChanges;
390 LLStat mGeometryChangesStat;
391 LLStat mMoveChangesStat;
392
393 S32 mNumVisibleFaces;
394 LLStat mNumVisibleFacesStat;
395 LLStat mNumVisibleDrawablesStat;
396
397 static S32 sAGPMaxPoolSize;
398 static S32 sCompiles;
399
400 BOOL mUseVBO; // Use ARB vertex buffer objects, if available
401
402 class LLScatterShader
403 {
404 public:
405 static void init(GLhandleARB shader, int map_stage);
406 };
407
408 //utility shader objects (not shader programs)
409 GLhandleARB mLightVertex;
410 GLhandleARB mLightFragment;
411 GLhandleARB mScatterVertex;
412 GLhandleARB mScatterFragment;
413
414 //global (reserved slot) shader parameters
415 static const char* sReservedAttribs[];
416 static U32 sReservedAttribCount;
417
418 typedef enum
419 {
420 GLSL_MATERIAL_COLOR = 0,
421 GLSL_SPECULAR_COLOR,
422 GLSL_BINORMAL,
423 GLSL_END_RESERVED_ATTRIBS
424 } eGLSLReservedAttribs;
425
426 static const char* sReservedUniforms[];
427 static U32 sReservedUniformCount;
428
429 typedef enum
430 {
431 GLSL_DIFFUSE_MAP = 0,
432 GLSL_SPECULAR_MAP,
433 GLSL_BUMP_MAP,
434 GLSL_ENVIRONMENT_MAP,
435 GLSL_SCATTER_MAP,
436 GLSL_END_RESERVED_UNIFORMS
437 } eGLSLReservedUniforms;
438
439 //object shaders
440 LLGLSLShader mObjectSimpleProgram;
441 LLGLSLShader mObjectAlphaProgram;
442 LLGLSLShader mObjectBumpProgram;
443
444 //water parameters
445 static const char* sWaterUniforms[];
446 static U32 sWaterUniformCount;
447
448 typedef enum
449 {
450 GLSL_WATER_SCREENTEX = GLSL_END_RESERVED_UNIFORMS,
451 GLSL_WATER_EYEVEC,
452 GLSL_WATER_TIME,
453 GLSL_WATER_WAVE_DIR1,
454 GLSL_WATER_WAVE_DIR2,
455 GLSL_WATER_LIGHT_DIR,
456 GLSL_WATER_SPECULAR,
457 GLSL_WATER_SPECULAR_EXP,
458 GLSL_WATER_FBSCALE,
459 GLSL_WATER_REFSCALE
460 } eWaterUniforms;
461
462
463 //terrain parameters
464 static const char* sTerrainUniforms[];
465 static U32 sTerrainUniformCount;
466
467 typedef enum
468 {
469 GLSL_TERRAIN_DETAIL0 = GLSL_END_RESERVED_UNIFORMS,
470 GLSL_TERRAIN_DETAIL1,
471 GLSL_TERRAIN_ALPHARAMP
472 } eTerrainUniforms;
473
474 //environment shaders
475 LLGLSLShader mTerrainProgram;
476 LLGLSLShader mGroundProgram;
477 LLGLSLShader mWaterProgram;
478
479 //interface shaders
480 LLGLSLShader mHighlightProgram;
481
482 //avatar shader parameter tables
483 static const char* sAvatarAttribs[];
484 static U32 sAvatarAttribCount;
485
486 typedef enum
487 {
488 GLSL_AVATAR_WEIGHT = GLSL_END_RESERVED_ATTRIBS,
489 GLSL_AVATAR_CLOTHING,
490 GLSL_AVATAR_WIND,
491 GLSL_AVATAR_SINWAVE,
492 GLSL_AVATAR_GRAVITY
493 } eAvatarAttribs;
494
495 static const char* sAvatarUniforms[];
496 static U32 sAvatarUniformCount;
497
498 typedef enum
499 {
500 GLSL_AVATAR_MATRIX = GLSL_END_RESERVED_UNIFORMS
501 } eAvatarUniforms;
502
503 //avatar skinning utility shader object
504 GLhandleARB mAvatarSkinVertex;
505
506 //avatar shader handles
507 LLGLSLShader mAvatarProgram;
508 LLGLSLShader mAvatarEyeballProgram;
509 LLGLSLShader mAvatarPickProgram;
510
511 //current avatar shader parameter pointer
512 GLint mAvatarMatrixParam;
513 GLint mMaterialIndex;
514 GLint mSpecularIndex;
515
516 LLColor4 mSunDiffuse;
517 LLVector3 mSunDir;
518
519protected:
520 class SelectedFaceInfo
521 {
522 public:
523 LLFace *mFacep;
524 S32 mTE;
525 };
526
527 BOOL mVertexShadersEnabled;
528 S32 mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed
529 S32 mVertexShaderLevel[SHADER_COUNT];
530 S32 mMaxVertexShaderLevel[SHADER_COUNT];
531
532 U32 mRenderTypeMask;
533 U32 mRenderFeatureMask;
534 U32 mRenderDebugFeatureMask;
535 U32 mRenderDebugMask;
536
537 /////////////////////////////////////////////
538 //
539 //
540 LLDrawable::drawable_vector_t mVisibleList;
541 LLDrawable::drawable_set_t mMovedList;
542
543 LLDrawable::drawable_vector_t mShiftList;
544
545 /////////////////////////////////////////////
546 //
547 //
548 struct Light
549 {
550 Light(LLDrawable* ptr, F32 d, F32 f = 0.0f)
551 : drawable(ptr),
552 dist(d),
553 fade(f)
554 {}
555 LLPointer<LLDrawable> drawable;
556 F32 dist;
557 F32 fade;
558 struct compare
559 {
560 bool operator()(const Light& a, const Light& b) const
561 {
562 if ( a.dist < b.dist )
563 return true;
564 else if ( a.dist > b.dist )
565 return false;
566 else
567 return a.drawable < b.drawable;
568 }
569 };
570 };
571 typedef std::set< Light, Light::compare > light_set_t;
572
573 LLDrawable::drawable_set_t mLights;
574 light_set_t mNearbyLights; // lights near camera
575 LLColor4 mHWLightColors[8];
576
577 /////////////////////////////////////////////
578 //
579 // Different queues of drawables being processed.
580 //
581 LLDrawable::drawable_set_t mBuildQ1; // priority
582 LLDrawable::drawable_list_t mBuildQ2; // non-priority
583
584 LLDrawable::drawable_set_t mActiveQ;
585
586 LLDrawable::drawable_set_t mRetexturedList;
587 LLDrawable::drawable_set_t mRematerialedList;
588
589 //////////////////////////////////////////////////
590 //
591 // Draw pools are responsible for storing all rendered data,
592 // and performing the actual rendering of objects.
593 //
594 struct compare_pools
595 {
596 bool operator()(const LLDrawPool* a, const LLDrawPool* b) const
597 {
598 if (!a)
599 return true;
600 else if (!b)
601 return false;
602 else
603 {
604 S32 atype = a->getType();
605 S32 btype = b->getType();
606 if (atype < btype)
607 return true;
608 else if (atype > btype)
609 return false;
610 else
611 return a->getId() < b->getId();
612 }
613 }
614 };
615 typedef std::set<LLDrawPool*, compare_pools > pool_set_t;
616 pool_set_t mPools;
617 LLDrawPool* mLastRebuildPool;
618
619 // For quick-lookups into mPools (mapped by texture pointer)
620 std::map<uintptr_t, LLDrawPool*> mSimplePools;
621 std::map<uintptr_t, LLDrawPool*> mTerrainPools;
622 std::map<uintptr_t, LLDrawPool*> mTreePools;
623 std::map<uintptr_t, LLDrawPool*> mTreeNewPools;
624 std::map<uintptr_t, LLDrawPool*> mBumpPools;
625 std::map<uintptr_t, LLDrawPool*> mMediaPools;
626 LLDrawPool* mAlphaPool;
627 LLDrawPool* mSkyPool;
628 LLDrawPool* mStarsPool;
629 LLDrawPool* mCloudsPool;
630 LLDrawPool* mTerrainPool;
631 LLDrawPool* mWaterPool;
632 LLDrawPool* mGroundPool;
633 LLDrawPool* mHUDPool;
634 // Note: no need to keep an quick-lookup to avatar pools, since there's only one per avatar
635
636
637 LLDynamicArray<LLFace*> mHighlightFaces; // highlight faces on physical objects
638 LLDynamicArray<SelectedFaceInfo> mSelectedFaces;
639
640 LLPointer<LLViewerImage> mFaceSelectImagep;
641 LLPointer<LLViewerImage> mBloomImagep;
642 LLPointer<LLViewerImage> mBloomImage2p;
643
644 BOOL mAGPBound;
645 LLAGPMemPool *mAGPMemPool;
646 U32 mGlobalFence;
647
648 // Round-robin AGP buffers for use by the software skinner
649 enum
650 {
651 kMaxBufferCount = 4
652 };
653
654 S32 mBufferIndex;
655 S32 mBufferCount;
656 LLAGPArray<U8> *mBufferMemory[kMaxBufferCount];
657 U32 mBufferFence[kMaxBufferCount];
658 BOOL mUseOcclusionCulling; // object-object occlusion culling
659 U32 mLightMask;
660 U32 mLightMovingMask;
661 S32 mLightingDetail;
662 F32 mSunShadowFactor;
663
664 static BOOL sRenderPhysicalBeacons;
665 static BOOL sRenderScriptedBeacons;
666 static BOOL sRenderParticleBeacons;
667 static BOOL sRenderSoundBeacons;
668};
669
670void render_bbox(const LLVector3 &min, const LLVector3 &max);
671
672extern LLPipeline gPipeline;
673extern BOOL gRenderForSelect;
674extern F32 gPickAlphaThreshold;
675extern F32 gPickAlphaTargetThreshold;
676extern BOOL gUsePickAlpha;
677
678#endif