st/egl: use a helper to get st_api from the loader
authorChia-I Wu <olv@lunarg.com>
Fri, 24 Jun 2011 03:12:39 +0000 (12:12 +0900)
committerChia-I Wu <olv@lunarg.com>
Fri, 24 Jun 2011 03:18:52 +0000 (12:18 +0900)
src/gallium/state_trackers/egl/common/egl_g3d.h
src/gallium/state_trackers/egl/common/egl_g3d_api.c

index 301db3128ff16da79902a17d9676075af0eec372..5989a023573eac95ed75c29ef3cdd03668c03252 100644 (file)
@@ -126,4 +126,12 @@ _EGL_DRIVER_TYPECAST(egl_g3d_screen, _EGLScreen, obj)
 
 #endif /* EGL_MESA_screen_surface */
 
+static INLINE struct st_api *
+egl_g3d_get_st_api(_EGLDriver *drv, enum st_api_type api)
+{
+   struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
+
+   return gdrv->loader->get_st_api(api);
+}
+
 #endif /* _EGL_G3D_H_ */
index 8b1821e0055e23efccb61ccb42c95f475d256dca..1d49c30a61ea1e1ee582cf87763f0bc8cd66bbb7 100644 (file)
@@ -37,7 +37,6 @@
 #include "egl_g3d_image.h"
 #include "egl_g3d_sync.h"
 #include "egl_g3d_st.h"
-#include "egl_g3d_loader.h"
 #include "native.h"
 
 /**
@@ -47,7 +46,6 @@ static struct st_api *
 egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
                   enum st_profile_type *profile)
 {
-   struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
    struct st_api *stapi;
    EGLint api = -1;
 
@@ -81,17 +79,7 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
       break;
    }
 
-   switch (api) {
-   case ST_API_OPENGL:
-      stapi = gdrv->loader->guess_gl_api(*profile);
-      break;
-   case ST_API_OPENVG:
-      stapi = gdrv->loader->get_st_api(api);
-      break;
-   default:
-      stapi = NULL;
-      break;
-   }
+   stapi = egl_g3d_get_st_api(drv, api);
    if (stapi && !(stapi->profile_mask & (1 << *profile)))
       stapi = NULL;