summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h')
-rw-r--r--src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
new file mode 100644
index 0000000000..0b4e740403
--- /dev/null
+++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
@@ -0,0 +1,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