00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Gavin Bell (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifndef _SO_CACHE_CONTEXT_ELEMENT 00051 #define _SO_CACHE_CONTEXT_ELEMENT 00052 00053 #include <Inventor/elements/SoSubElement.h> 00054 #include <Inventor/helpers/SbGlContextHelper.h> 00055 #include <Inventor/threads/SbThreadMutex.h> 00056 #include <SoDeprecationRules.h> 00057 00058 class SbIntList; 00059 class SoGLDisplayList; 00060 00100 (9620, "SoGLCacheContextElement is no longer supported. See section http://oivdoc96.vsg3d.com/content/compatibility-notes-4#Deprecation of the Reference Manual.") SoGLCacheContextElement : public SoElement 00101 { 00102 SO_ELEMENT_HEADER(SoGLCacheContextElement); 00103 00104 public: 00105 00119 static void set(SoState *state, int context, 00120 SbBool is2PassTransparency, 00121 SbBool isRemoteRendering); 00122 00124 static int get(SoState *state); 00125 00132 static int getExtID(const char *str); 00133 00135 static SbBool extSupported(SoState *state, int ext); 00136 00138 static SbBool areMipMapsFast(SoState *state); 00139 00141 static SbBool isCompileModeFaster( SoState *state ); 00142 00143 // 00144 // Methods used to improve auto-caching algorithm: 00145 // 00146 00155 enum AutoCacheMode{ 00156 DO_AUTO_CACHE = 1, 00157 DONT_AUTO_CACHE = 2 00158 }; 00159 SoDEPRECATED 00166 static void shouldAutoCache(SoState* state, AutoCacheMode mode); 00167 00173 static void shouldAutoCache(SoState *state, int bits); 00174 00176 static void setAutoCacheBits(SoState *state, int bits); 00177 00179 static int resetAutoCacheBits(SoState *state); 00180 00181 static SbBool getIsRemoteRendering(SoState *state); 00182 00183 // 00184 // Standard element stuff: 00185 // 00186 00188 virtual void print(FILE *fp) const; 00189 00190 private: 00191 00193 virtual void init(SoState *state); 00194 00196 virtual SbBool matches(const SoElement* elt) const; 00197 00199 virtual SoElement* copyMatchInfo() const; 00200 00201 private: 00203 static void initClass(); 00205 static void exitClass(); 00207 static void deleteContextResources(int ctxSharedId); 00208 00210 static SbGlContextHelper::GLContext getGlContext(SoState *state); 00211 00213 static int getUniqId(SoState *state); 00214 00215 private: 00216 SbGlContextHelper::GLContext m_contextGL; 00217 int m_sharedGroup; 00218 SbBool is2PassTransp; 00219 SbBool isRemoteRendering; 00220 int autoCacheBits; 00221 00223 virtual ~SoGLCacheContextElement(); 00224 00225 private: 00226 // Frees up the given display lists right away, if possible. If 00227 // not possible (because the state passed in is NULL or has a 00228 // different cache context than the display lists' state), this 00229 // adds the given display list/count to the list of display lists 00230 // that need to be freed the next time the given context is valid. 00231 // This method is necessary because nodes with caches can be 00232 // deleted at any time, but we can't necessarily send GL commands 00233 // to free up a display list at any time. 00234 static void freeList(SoState *state, SoGLDisplayList *list); 00235 00236 static SbPList* waitingToBeFreed; // Allocated in ::init 00237 static SbIntList* mipmapSupportList; // Allocated in ::init 00238 00239 // listMutex is a mutex to protect the access to waitingToBeFreed. 00240 static SbThreadMutex listMutex; 00241 00242 friend class SoGLDisplayList; 00243 00244 }; 00245 #endif /* _SO_CACHE_CONTEXT_ELEMENT */ 00246 00247 00248