Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1.  
  2. #ifndef INLINE_SW_HELPER_H
  3. #define INLINE_SW_HELPER_H
  4.  
  5. #include "pipe/p_compiler.h"
  6. #include "util/u_debug.h"
  7. #include "state_tracker/sw_winsys.h"
  8.  
  9.  
  10. /* Helper function to choose and instantiate one of the software rasterizers:
  11.  * llvmpipe, softpipe.
  12.  */
  13.  
  14. #ifdef GALLIUM_SOFTPIPE
  15. #include "softpipe/sp_public.h"
  16. #endif
  17.  
  18. #ifdef GALLIUM_LLVMPIPE
  19. #include "llvmpipe/lp_public.h"
  20. #endif
  21.  
  22.  
  23. static INLINE struct pipe_screen *
  24. sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
  25. {
  26.    struct pipe_screen *screen = NULL;
  27.  
  28. #if defined(GALLIUM_LLVMPIPE)
  29.    if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
  30.       screen = llvmpipe_create_screen(winsys);
  31. #endif
  32.  
  33. #if defined(GALLIUM_SOFTPIPE)
  34.    if (screen == NULL)
  35.       screen = softpipe_create_screen(winsys);
  36. #endif
  37.  
  38.    return screen;
  39. }
  40.  
  41.  
  42. static INLINE struct pipe_screen *
  43. sw_screen_create(struct sw_winsys *winsys)
  44. {
  45.    const char *default_driver;
  46.    const char *driver;
  47.  
  48. #if defined(GALLIUM_LLVMPIPE)
  49.    default_driver = "llvmpipe";
  50. #elif defined(GALLIUM_SOFTPIPE)
  51.    default_driver = "softpipe";
  52. #else
  53.    default_driver = "";
  54. #endif
  55.  
  56.    driver = debug_get_option("GALLIUM_DRIVER", default_driver);
  57.    return sw_screen_create_named(winsys, driver);
  58. }
  59.  
  60. #if defined(GALLIUM_SOFTPIPE)
  61. #if defined(DRI_TARGET)
  62. #include "target-helpers/inline_debug_helper.h"
  63. #include "sw/dri/dri_sw_winsys.h"
  64. #include "dri_screen.h"
  65.  
  66. const __DRIextension **__driDriverGetExtensions_swrast(void);
  67.  
  68. PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
  69. {
  70.    globalDriverAPI = &galliumsw_driver_api;
  71.    return galliumsw_driver_extensions;
  72. }
  73.  
  74. INLINE struct pipe_screen *
  75. drisw_create_screen(struct drisw_loader_funcs *lf)
  76. {
  77.    struct sw_winsys *winsys = NULL;
  78.    struct pipe_screen *screen = NULL;
  79.  
  80.    winsys = dri_create_sw_winsys(lf);
  81.    if (winsys == NULL)
  82.       return NULL;
  83.  
  84.    screen = sw_screen_create(winsys);
  85.    if (screen == NULL) {
  86.       winsys->destroy(winsys);
  87.       return NULL;
  88.    }
  89.  
  90.    screen = debug_screen_wrap(screen);
  91.    return screen;
  92. }
  93. #endif // DRI_TARGET
  94.  
  95. #if defined(NINE_TARGET)
  96. #include "sw/wrapper/wrapper_sw_winsys.h"
  97. #include "target-helpers/inline_debug_helper.h"
  98.  
  99. extern struct pipe_screen *ninesw_create_screen(struct pipe_screen *screen);
  100.  
  101. INLINE struct pipe_screen *
  102. ninesw_create_screen(struct pipe_screen *pscreen)
  103. {
  104.    struct sw_winsys *winsys = NULL;
  105.    struct pipe_screen *screen = NULL;
  106.  
  107.    winsys = wrapper_sw_winsys_wrap_pipe_screen(pscreen);
  108.    if (winsys == NULL)
  109.       return NULL;
  110.  
  111.    screen = sw_screen_create(winsys);
  112.    if (screen == NULL) {
  113.       winsys->destroy(winsys);
  114.       return NULL;
  115.    }
  116.  
  117.    screen = debug_screen_wrap(screen);
  118.    return screen;
  119. }
  120. #endif // NINE_TARGET
  121.  
  122. #endif // GALLIUM_SOFTPIPE
  123.  
  124.  
  125. #endif
  126.