[haiku-commits] r37900 - haiku/trunk/src/kits/opengl

  • From: philippe.houdoin@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 4 Aug 2010 16:06:00 +0200 (CEST)

Author: phoudoin
Date: 2010-08-04 16:05:59 +0200 (Wed, 04 Aug 2010)
New Revision: 37900
Changeset: http://dev.haiku-os.org/changeset/37900

Modified:
   haiku/trunk/src/kits/opengl/GLRendererRoster.cpp
   haiku/trunk/src/kits/opengl/GLRendererRoster.h
Log:
Add support for non-native ABI on hybrid build,
by following the steps taken by TranslatorRoster and LocaleRoster.


Modified: haiku/trunk/src/kits/opengl/GLRendererRoster.cpp
===================================================================
--- haiku/trunk/src/kits/opengl/GLRendererRoster.cpp    2010-08-04 13:19:20 UTC 
(rev 37899)
+++ haiku/trunk/src/kits/opengl/GLRendererRoster.cpp    2010-08-04 14:05:59 UTC 
(rev 37900)
@@ -33,7 +33,8 @@
        : fNextID(0),
        fView(view),
        fOptions(options),
-       fSafeMode(false)
+       fSafeMode(false),
+       fABISubDirectory(NULL)
 {
        char parameter[32];
        size_t parameterLength = sizeof(parameter);
@@ -49,7 +50,7 @@
                        || !strcasecmp(parameter, "enable") || 
!strcmp(parameter, "1"))
                        fSafeMode = true;
        }
-       
+
 #ifdef HAIKU_TARGET_PLATFORM_HAIKU
        if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, 
parameter, &parameterLength) == B_OK)
 #else
@@ -61,7 +62,24 @@
                        || !strcasecmp(parameter, "enable") || 
!strcmp(parameter, "1"))
                        fSafeMode = true;
        }
-       
+
+       // We might run in compatibility mode on a system with a different ABI. 
The
+       // renderers matching our ABI can usually be found in respective
+       // subdirectories of the opengl add-ons directories.
+       system_info info;
+       if (get_system_info(&info) == B_OK
+               && (info.abi & B_HAIKU_ABI_MAJOR)
+                       != (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR)) {
+                       switch (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR) {
+                               case B_HAIKU_ABI_GCC_2:
+                                       fABISubDirectory = "gcc2";
+                                       break;
+                               case B_HAIKU_ABI_GCC_4:
+                                       fABISubDirectory = "gcc4";
+                                       break;
+                       }
+       }
+
        AddDefaultPaths();
 }
 
@@ -111,6 +129,16 @@
        if (status < B_OK)
                return status;
 
+       // if a subdirectory for our ABI exists, use that instead
+       if (fABISubDirectory != NULL) {
+               BEntry entry(&directory, fABISubDirectory);
+               if (entry.IsDirectory()) {
+                       status = directory.SetTo(&entry);
+                       if (status != B_OK)
+                               return status;
+               }
+       }
+
        node_ref nodeRef;
        status = directory.GetNodeRef(&nodeRef);
        if (status < B_OK)
@@ -181,7 +209,7 @@
                        unload_add_on(image);
                        return B_UNSUPPORTED;
                }
-               
+
                if (AddRenderer(renderer, image, &ref, nodeRef.node) != B_OK) {
                        renderer->Release();
                        // this will delete the renderer

Modified: haiku/trunk/src/kits/opengl/GLRendererRoster.h
===================================================================
--- haiku/trunk/src/kits/opengl/GLRendererRoster.h      2010-08-04 13:19:20 UTC 
(rev 37899)
+++ haiku/trunk/src/kits/opengl/GLRendererRoster.h      2010-08-04 14:05:59 UTC 
(rev 37900)
@@ -27,7 +27,7 @@
        private:
                void AddDefaultPaths();
                status_t AddPath(const char* path);
-               status_t AddRenderer(BGLRenderer* renderer, 
+               status_t AddRenderer(BGLRenderer* renderer,
                        image_id image, const entry_ref* ref, ino_t node);
                status_t CreateRenderer(const entry_ref& ref);
 
@@ -36,6 +36,8 @@
                BGLView         *fView;
                ulong           fOptions;
                bool            fSafeMode;
+               const char*     fABISubDirectory;
+
 };
 
 #endif /* _GLRENDERER_ROSTER_H */


Other related posts:

  • » [haiku-commits] r37900 - haiku/trunk/src/kits/opengl - philippe . houdoin