summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
blob: 0b4e740403400f828982d8f83d9c13877b41c1b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#ifndef INLINE_WRAPPER_SW_HELPER_H
#define INLINE_WRAPPER_SW_HELPER_H

#include "target-helpers/inline_sw_helper.h"
#include "sw/wrapper/wrapper_sw_winsys.h"

/**
 * Try to wrap a hw screen with a software screen.
 * On failure will return given screen.
 */
static INLINE struct pipe_screen *
sw_screen_wrap(struct pipe_screen *screen)
{
   struct sw_winsys *sws;
   struct pipe_screen *sw_screen;

   sws = wrapper_sw_winsys_warp_pipe_screen(screen);
   if (!sws)
      goto err;

   sw_screen = sw_screen_create(sws);
   if (sw_screen == screen)
      goto err_winsys;

   return sw_screen;

err_winsys:
   sws->destroy(sws);
err:
  return screen;
}

#endif