aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/include
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-02-24 07:45:14 +0100
committermarha <marha@users.sourceforge.net>2015-02-24 07:45:14 +0100
commiteef70231353a6103f47fcae88a6e89e765e5cd47 (patch)
treeff91167b1dc242aa72f083a95e0f1152bcd3de38 /mesalib/src/gallium/include
parentac2c8a704aac7569f4ae85b890a546644bd86c60 (diff)
downloadvcxsrv-eef70231353a6103f47fcae88a6e89e765e5cd47.tar.gz
vcxsrv-eef70231353a6103f47fcae88a6e89e765e5cd47.tar.bz2
vcxsrv-eef70231353a6103f47fcae88a6e89e765e5cd47.zip
Added missing files for mesa
Diffstat (limited to 'mesalib/src/gallium/include')
-rw-r--r--mesalib/src/gallium/include/pipe/p_compiler.h267
-rw-r--r--mesalib/src/gallium/include/pipe/p_config.h275
-rw-r--r--mesalib/src/gallium/include/pipe/p_context.h572
-rw-r--r--mesalib/src/gallium/include/pipe/p_defines.h760
-rw-r--r--mesalib/src/gallium/include/pipe/p_format.h454
-rw-r--r--mesalib/src/gallium/include/pipe/p_screen.h238
-rw-r--r--mesalib/src/gallium/include/pipe/p_shader_tokens.h720
-rw-r--r--mesalib/src/gallium/include/pipe/p_state.h644
-rw-r--r--mesalib/src/gallium/include/pipe/p_video_codec.h170
-rw-r--r--mesalib/src/gallium/include/pipe/p_video_enums.h83
-rw-r--r--mesalib/src/gallium/include/pipe/p_video_state.h382
-rw-r--r--mesalib/src/gallium/include/state_tracker/drisw_api.h25
-rw-r--r--mesalib/src/gallium/include/state_tracker/drm_driver.h126
-rw-r--r--mesalib/src/gallium/include/state_tracker/graw.h96
-rw-r--r--mesalib/src/gallium/include/state_tracker/st_api.h541
-rw-r--r--mesalib/src/gallium/include/state_tracker/sw_winsys.h146
-rw-r--r--mesalib/src/gallium/include/state_tracker/vdpau_interop.h49
-rw-r--r--mesalib/src/gallium/include/state_tracker/xlibsw_api.h19
18 files changed, 5567 insertions, 0 deletions
diff --git a/mesalib/src/gallium/include/pipe/p_compiler.h b/mesalib/src/gallium/include/pipe/p_compiler.h
new file mode 100644
index 000000000..fb018bf05
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_compiler.h
@@ -0,0 +1,267 @@
+/**************************************************************************
+ *
+ * Copyright 2007-2008 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef P_COMPILER_H
+#define P_COMPILER_H
+
+
+#include "c99_compat.h" /* inline, __func__, etc. */
+
+#include "p_config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <limits.h>
+
+
+#if defined(_WIN32) && !defined(__WIN32__)
+#define __WIN32__
+#endif
+
+#if defined(_MSC_VER)
+
+/* Avoid 'expression is always true' warning */
+#pragma warning(disable: 4296)
+
+#endif /* _MSC_VER */
+
+
+/*
+ * Alternative stdint.h and stdbool.h headers are supplied in include/c99 for
+ * systems that lack it.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+#include <stdint.h>
+#include <stdbool.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if !defined(__HAIKU__) && !defined(__USE_MISC)
+#if !defined(PIPE_OS_ANDROID)
+typedef unsigned int uint;
+#endif
+typedef unsigned short ushort;
+#endif
+typedef unsigned char ubyte;
+
+typedef unsigned char boolean;
+#ifndef TRUE
+#define TRUE true
+#endif
+#ifndef FALSE
+#define FALSE false
+#endif
+
+#ifndef va_copy
+#ifdef __va_copy
+#define va_copy(dest, src) __va_copy((dest), (src))
+#else
+#define va_copy(dest, src) (dest) = (src)
+#endif
+#endif
+
+/* XXX: Use standard `inline` keyword instead */
+#ifndef INLINE
+# define INLINE inline
+#endif
+
+/* Forced function inlining */
+#ifndef ALWAYS_INLINE
+# ifdef __GNUC__
+# define ALWAYS_INLINE inline __attribute__((always_inline))
+# elif defined(_MSC_VER)
+# define ALWAYS_INLINE __forceinline
+# else
+# define ALWAYS_INLINE INLINE
+# endif
+#endif
+
+
+/* Function visibility */
+#ifndef PUBLIC
+# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define PUBLIC __attribute__((visibility("default")))
+# elif defined(_MSC_VER)
+# define PUBLIC __declspec(dllexport)
+# else
+# define PUBLIC
+# endif
+#endif
+
+
+/* XXX: Use standard `__func__` instead */
+#ifndef __FUNCTION__
+# define __FUNCTION__ __func__
+#endif
+
+
+/* This should match linux gcc cdecl semantics everywhere, so that we
+ * just codegen one calling convention on all platforms.
+ */
+#ifdef _MSC_VER
+#define PIPE_CDECL __cdecl
+#else
+#define PIPE_CDECL
+#endif
+
+
+
+#if defined(__GNUC__)
+#define PIPE_DEPRECATED __attribute__((__deprecated__))
+#else
+#define PIPE_DEPRECATED
+#endif
+
+
+
+/* Macros for data alignment. */
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) || defined(__SUNPRO_CC)
+
+/* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Type-Attributes.html */
+#define PIPE_ALIGN_TYPE(_alignment, _type) _type __attribute__((aligned(_alignment)))
+
+/* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Variable-Attributes.html */
+#define PIPE_ALIGN_VAR(_alignment) __attribute__((aligned(_alignment)))
+
+#if defined(__GNUC__) && !defined(PIPE_ARCH_X86_64)
+#define PIPE_ALIGN_STACK __attribute__((force_align_arg_pointer))
+#else
+#define PIPE_ALIGN_STACK
+#endif
+
+#elif defined(_MSC_VER)
+
+/* See http://msdn.microsoft.com/en-us/library/83ythb65.aspx */
+#define PIPE_ALIGN_TYPE(_alignment, _type) __declspec(align(_alignment)) _type
+#define PIPE_ALIGN_VAR(_alignment) __declspec(align(_alignment))
+
+#define PIPE_ALIGN_STACK
+
+#elif defined(SWIG)
+
+#define PIPE_ALIGN_TYPE(_alignment, _type) _type
+#define PIPE_ALIGN_VAR(_alignment)
+
+#define PIPE_ALIGN_STACK
+
+#else
+
+#error "Unsupported compiler"
+
+#endif
+
+
+#if defined(__GNUC__)
+
+#define PIPE_READ_WRITE_BARRIER() __asm__("":::"memory")
+
+#elif defined(_MSC_VER)
+
+void _ReadWriteBarrier(void);
+#pragma intrinsic(_ReadWriteBarrier)
+#define PIPE_READ_WRITE_BARRIER() _ReadWriteBarrier()
+
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+
+#define PIPE_READ_WRITE_BARRIER() __machine_rw_barrier()
+
+#else
+
+#warning "Unsupported compiler"
+#define PIPE_READ_WRITE_BARRIER() /* */
+
+#endif
+
+
+/* You should use these macros to mark if blocks where the if condition
+ * is either likely to be true, or unlikely to be true.
+ *
+ * This will inform human readers of this fact, and will also inform
+ * the compiler, who will in turn inform the CPU.
+ *
+ * CPUs often start executing code inside the if or the else blocks
+ * without knowing whether the condition is true or not, and will have
+ * to throw the work away if they find out later they executed the
+ * wrong part of the if.
+ *
+ * If these macros are used, the CPU is more likely to correctly predict
+ * the right path, and will avoid speculatively executing the wrong branch,
+ * thus not throwing away work, resulting in better performance.
+ *
+ * In light of this, it is also a good idea to mark as "likely" a path
+ * which is not necessarily always more likely, but that will benefit much
+ * more from performance improvements since it is already much faster than
+ * the other path, or viceversa with "unlikely".
+ *
+ * Example usage:
+ * if(unlikely(do_we_need_a_software_fallback()))
+ * do_software_fallback();
+ * else
+ * render_with_gpu();
+ *
+ * The macros follow the Linux kernel convention, and more examples can
+ * be found there.
+ *
+ * Note that profile guided optimization can offer better results, but
+ * needs an appropriate coverage suite and does not inform human readers.
+ */
+#ifndef likely
+# if defined(__GNUC__)
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
+#endif
+
+
+/**
+ * Static (compile-time) assertion.
+ * Basically, use COND to dimension an array. If COND is false/zero the
+ * array size will be -1 and we'll get a compilation error.
+ */
+#define STATIC_ASSERT(COND) \
+ do { \
+ (void) sizeof(char [1 - 2*!(COND)]); \
+ } while (0)
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+
+#endif /* P_COMPILER_H */
diff --git a/mesalib/src/gallium/include/pipe/p_config.h b/mesalib/src/gallium/include/pipe/p_config.h
new file mode 100644
index 000000000..5b6db7dcc
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_config.h
@@ -0,0 +1,275 @@
+/**************************************************************************
+ *
+ * Copyright 2008 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Gallium configuration defines.
+ *
+ * This header file sets several defines based on the compiler, processor
+ * architecture, and operating system being used. These defines should be used
+ * throughout the code to facilitate porting to new platforms. It is likely that
+ * this file is auto-generated by an autoconf-like tool at some point, as some
+ * things cannot be determined by pre-defined environment alone.
+ *
+ * See also:
+ * - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
+ * - echo | gcc -dM -E - | sort
+ * - http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+ *
+ * @author José Fonseca <jfonseca@vmware.com>
+ */
+
+#ifndef P_CONFIG_H_
+#define P_CONFIG_H_
+
+#include <limits.h>
+/*
+ * Compiler
+ */
+
+#if defined(__GNUC__)
+#define PIPE_CC_GCC
+#define PIPE_CC_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+#endif
+
+/*
+ * Meaning of _MSC_VER value:
+ * - 1800: Visual Studio 2013
+ * - 1700: Visual Studio 2012
+ * - 1600: Visual Studio 2010
+ * - 1500: Visual Studio 2008
+ * - 1400: Visual C++ 2005
+ * - 1310: Visual C++ .NET 2003
+ * - 1300: Visual C++ .NET 2002
+ *
+ * __MSC__ seems to be an old macro -- it is not pre-defined on recent MSVC
+ * versions.
+ */
+#if defined(_MSC_VER) || defined(__MSC__)
+#define PIPE_CC_MSVC
+#endif
+
+#if defined(__ICL)
+#define PIPE_CC_ICL
+#endif
+
+#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#define PIPE_CC_SUNPRO
+#endif
+
+
+/*
+ * Processor architecture
+ */
+
+#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */
+#define PIPE_ARCH_X86
+#endif
+
+#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */
+#define PIPE_ARCH_X86_64
+#endif
+
+#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
+#if defined(PIPE_CC_GCC) && !defined(__SSE2__)
+/* #warning SSE2 support requires -msse -msse2 compiler options */
+#else
+#define PIPE_ARCH_SSE
+#endif
+#if defined(PIPE_CC_GCC) && !defined(__SSSE3__)
+/* #warning SSE3 support requires -msse3 compiler options */
+#else
+#define PIPE_ARCH_SSSE3
+#endif
+#endif
+
+#if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__)
+#define PIPE_ARCH_PPC
+#if defined(__ppc64__) || defined(__PPC64__)
+#define PIPE_ARCH_PPC_64
+#endif
+#endif
+
+#if defined(__s390x__)
+#define PIPE_ARCH_S390
+#endif
+
+#if defined(__arm__)
+#define PIPE_ARCH_ARM
+#endif
+
+#if defined(__aarch64__)
+#define PIPE_ARCH_AARCH64
+#endif
+
+/*
+ * Endian detection.
+ */
+
+#ifdef __GLIBC__
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define PIPE_ARCH_LITTLE_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define PIPE_ARCH_BIG_ENDIAN
+#endif
+
+#elif defined(__APPLE__)
+#include <machine/endian.h>
+
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+# define PIPE_ARCH_LITTLE_ENDIAN
+#elif __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
+# define PIPE_ARCH_BIG_ENDIAN
+#endif
+
+#elif defined(__sun)
+#include <sys/isa_defs.h>
+
+#if defined(_LITTLE_ENDIAN)
+# define PIPE_ARCH_LITTLE_ENDIAN
+#elif defined(_BIG_ENDIAN)
+# define PIPE_ARCH_BIG_ENDIAN
+#endif
+
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#include <machine/endian.h>
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+# define PIPE_ARCH_LITTLE_ENDIAN
+#elif _BYTE_ORDER == _BIG_ENDIAN
+# define PIPE_ARCH_BIG_ENDIAN
+#endif
+
+#else
+
+#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
+#define PIPE_ARCH_LITTLE_ENDIAN
+#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
+#define PIPE_ARCH_BIG_ENDIAN
+#endif
+
+#endif
+
+#if !defined(PIPE_ARCH_LITTLE_ENDIAN) && !defined(PIPE_ARCH_BIG_ENDIAN)
+#error Unknown Endianness
+#endif
+
+/*
+ * Auto-detect the operating system family.
+ *
+ * See subsystem below for a more fine-grained distinction.
+ */
+
+#if defined(__linux__)
+#define PIPE_OS_LINUX
+#define PIPE_OS_UNIX
+#endif
+
+/*
+ * Android defines __linux__ so PIPE_OS_LINUX and PIPE_OS_UNIX will also be
+ * defined.
+ */
+#if defined(ANDROID)
+#define PIPE_OS_ANDROID
+#endif
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#define PIPE_OS_FREEBSD
+#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__OpenBSD__)
+#define PIPE_OS_OPENBSD
+#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__NetBSD__)
+#define PIPE_OS_NETBSD
+#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__DragonFly__)
+#define PIPE_OS_DRAGONFLY
+#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__GNU__)
+#define PIPE_OS_HURD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__sun)
+#define PIPE_OS_SOLARIS
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__APPLE__)
+#define PIPE_OS_APPLE
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(_WIN32) || defined(WIN32)
+#define PIPE_OS_WINDOWS
+#endif
+
+#if defined(__HAIKU__)
+#define PIPE_OS_HAIKU
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__CYGWIN__)
+#define PIPE_OS_CYGWIN
+#define PIPE_OS_UNIX
+#endif
+
+/*
+ * Try to auto-detect the subsystem.
+ *
+ * NOTE: There is no way to auto-detect most of these.
+ */
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
+#define PIPE_SUBSYSTEM_DRI
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
+
+#if defined(PIPE_OS_WINDOWS)
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+/* Windows User-space Library */
+#else
+#define PIPE_SUBSYSTEM_WINDOWS_USER
+#endif
+#endif /* PIPE_OS_WINDOWS */
+
+
+#endif /* P_CONFIG_H_ */
diff --git a/mesalib/src/gallium/include/pipe/p_context.h b/mesalib/src/gallium/include/pipe/p_context.h
new file mode 100644
index 000000000..a4cae8eaf
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_context.h
@@ -0,0 +1,572 @@
+/**************************************************************************
+ *
+ * Copyright 2007 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_CONTEXT_H
+#define PIPE_CONTEXT_H
+
+#include "p_compiler.h"
+#include "p_format.h"
+#include "p_video_enums.h"
+#include "p_defines.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct pipe_blend_color;
+struct pipe_blend_state;
+struct pipe_blit_info;
+struct pipe_box;
+struct pipe_clip_state;
+struct pipe_constant_buffer;
+struct pipe_depth_stencil_alpha_state;
+struct pipe_draw_info;
+struct pipe_fence_handle;
+struct pipe_framebuffer_state;
+struct pipe_index_buffer;
+struct pipe_query;
+struct pipe_poly_stipple;
+struct pipe_rasterizer_state;
+struct pipe_resolve_info;
+struct pipe_resource;
+struct pipe_sampler_state;
+struct pipe_sampler_view;
+struct pipe_scissor_state;
+struct pipe_shader_state;
+struct pipe_stencil_ref;
+struct pipe_stream_output_target;
+struct pipe_surface;
+struct pipe_transfer;
+struct pipe_vertex_buffer;
+struct pipe_vertex_element;
+struct pipe_video_buffer;
+struct pipe_video_codec;
+struct pipe_viewport_state;
+struct pipe_compute_state;
+union pipe_color_union;
+union pipe_query_result;
+
+/**
+ * Gallium rendering context. Basically:
+ * - state setting functions
+ * - VBO drawing functions
+ * - surface functions
+ */
+struct pipe_context {
+ struct pipe_screen *screen;
+
+ void *priv; /**< context private data (for DRI for example) */
+ void *draw; /**< private, for draw module (temporary?) */
+
+ void (*destroy)( struct pipe_context * );
+
+ /**
+ * VBO drawing
+ */
+ /*@{*/
+ void (*draw_vbo)( struct pipe_context *pipe,
+ const struct pipe_draw_info *info );
+ /*@}*/
+
+ /**
+ * Predicate subsequent rendering on occlusion query result
+ * \param query the query predicate, or NULL if no predicate
+ * \param condition whether to skip on FALSE or TRUE query results
+ * \param mode one of PIPE_RENDER_COND_x
+ */
+ void (*render_condition)( struct pipe_context *pipe,
+ struct pipe_query *query,
+ boolean condition,
+ uint mode );
+
+ /**
+ * Query objects
+ */
+ /*@{*/
+ struct pipe_query *(*create_query)( struct pipe_context *pipe,
+ unsigned query_type,
+ unsigned index );
+
+ void (*destroy_query)(struct pipe_context *pipe,
+ struct pipe_query *q);
+
+ void (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
+ void (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
+
+ /**
+ * Get results of a query.
+ * \param wait if true, this query will block until the result is ready
+ * \return TRUE if results are ready, FALSE otherwise
+ */
+ boolean (*get_query_result)(struct pipe_context *pipe,
+ struct pipe_query *q,
+ boolean wait,
+ union pipe_query_result *result);
+ /*@}*/
+
+ /**
+ * State functions (create/bind/destroy state objects)
+ */
+ /*@{*/
+ void * (*create_blend_state)(struct pipe_context *,
+ const struct pipe_blend_state *);
+ void (*bind_blend_state)(struct pipe_context *, void *);
+ void (*delete_blend_state)(struct pipe_context *, void *);
+
+ void * (*create_sampler_state)(struct pipe_context *,
+ const struct pipe_sampler_state *);
+ void (*bind_sampler_states)(struct pipe_context *,
+ unsigned shader, unsigned start_slot,
+ unsigned num_samplers, void **samplers);
+ void (*delete_sampler_state)(struct pipe_context *, void *);
+
+ void * (*create_rasterizer_state)(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+ void (*bind_rasterizer_state)(struct pipe_context *, void *);
+ void (*delete_rasterizer_state)(struct pipe_context *, void *);
+
+ void * (*create_depth_stencil_alpha_state)(struct pipe_context *,
+ const struct pipe_depth_stencil_alpha_state *);
+ void (*bind_depth_stencil_alpha_state)(struct pipe_context *, void *);
+ void (*delete_depth_stencil_alpha_state)(struct pipe_context *, void *);
+
+ void * (*create_fs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_fs_state)(struct pipe_context *, void *);
+ void (*delete_fs_state)(struct pipe_context *, void *);
+
+ void * (*create_vs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_vs_state)(struct pipe_context *, void *);
+ void (*delete_vs_state)(struct pipe_context *, void *);
+
+ void * (*create_gs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_gs_state)(struct pipe_context *, void *);
+ void (*delete_gs_state)(struct pipe_context *, void *);
+
+ void * (*create_vertex_elements_state)(struct pipe_context *,
+ unsigned num_elements,
+ const struct pipe_vertex_element *);
+ void (*bind_vertex_elements_state)(struct pipe_context *, void *);
+ void (*delete_vertex_elements_state)(struct pipe_context *, void *);
+
+ /*@}*/
+
+ /**
+ * Parameter-like state (or properties)
+ */
+ /*@{*/
+ void (*set_blend_color)( struct pipe_context *,
+ const struct pipe_blend_color * );
+
+ void (*set_stencil_ref)( struct pipe_context *,
+ const struct pipe_stencil_ref * );
+
+ void (*set_sample_mask)( struct pipe_context *,
+ unsigned sample_mask );
+
+ void (*set_min_samples)( struct pipe_context *,
+ unsigned min_samples );
+
+ void (*set_clip_state)( struct pipe_context *,
+ const struct pipe_clip_state * );
+
+ void (*set_constant_buffer)( struct pipe_context *,
+ uint shader, uint index,
+ struct pipe_constant_buffer *buf );
+
+ void (*set_framebuffer_state)( struct pipe_context *,
+ const struct pipe_framebuffer_state * );
+
+ void (*set_polygon_stipple)( struct pipe_context *,
+ const struct pipe_poly_stipple * );
+
+ void (*set_scissor_states)( struct pipe_context *,
+ unsigned start_slot,
+ unsigned num_scissors,
+ const struct pipe_scissor_state * );
+
+ void (*set_viewport_states)( struct pipe_context *,
+ unsigned start_slot,
+ unsigned num_viewports,
+ const struct pipe_viewport_state *);
+
+ void (*set_sampler_views)(struct pipe_context *, unsigned shader,
+ unsigned start_slot, unsigned num_views,
+ struct pipe_sampler_view **);
+
+ /**
+ * Bind an array of shader resources that will be used by the
+ * graphics pipeline. Any resources that were previously bound to
+ * the specified range will be unbound after this call.
+ *
+ * \param start first resource to bind.
+ * \param count number of consecutive resources to bind.
+ * \param resources array of pointers to the resources to bind, it
+ * should contain at least \a count elements
+ * unless it's NULL, in which case no new
+ * resources will be bound.
+ */
+ void (*set_shader_resources)(struct pipe_context *,
+ unsigned start, unsigned count,
+ struct pipe_surface **resources);
+
+ void (*set_vertex_buffers)( struct pipe_context *,
+ unsigned start_slot,
+ unsigned num_buffers,
+ const struct pipe_vertex_buffer * );
+
+ void (*set_index_buffer)( struct pipe_context *pipe,
+ const struct pipe_index_buffer * );
+
+ /*@}*/
+
+ /**
+ * Stream output functions.
+ */
+ /*@{*/
+
+ struct pipe_stream_output_target *(*create_stream_output_target)(
+ struct pipe_context *,
+ struct pipe_resource *,
+ unsigned buffer_offset,
+ unsigned buffer_size);
+
+ void (*stream_output_target_destroy)(struct pipe_context *,
+ struct pipe_stream_output_target *);
+
+ void (*set_stream_output_targets)(struct pipe_context *,
+ unsigned num_targets,
+ struct pipe_stream_output_target **targets,
+ const unsigned *offsets);
+
+ /*@}*/
+
+
+ /**
+ * Resource functions for blit-like functionality
+ *
+ * If a driver supports multisampling, blit must implement color resolve.
+ */
+ /*@{*/
+
+ /**
+ * Copy a block of pixels from one resource to another.
+ * The resource must be of the same format.
+ * Resources with nr_samples > 1 are not allowed.
+ */
+ void (*resource_copy_region)(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ unsigned dst_level,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ struct pipe_resource *src,
+ unsigned src_level,
+ const struct pipe_box *src_box);
+
+ /* Optimal hardware path for blitting pixels.
+ * Scaling, format conversion, up- and downsampling (resolve) are allowed.
+ */
+ void (*blit)(struct pipe_context *pipe,
+ const struct pipe_blit_info *info);
+
+ /*@}*/
+
+ /**
+ * Clear the specified set of currently bound buffers to specified values.
+ * The entire buffers are cleared (no scissor, no colormask, etc).
+ *
+ * \param buffers bitfield of PIPE_CLEAR_* values.
+ * \param color pointer to a union of fiu array for each of r, g, b, a.
+ * \param depth depth clear value in [0,1].
+ * \param stencil stencil clear value
+ */
+ void (*clear)(struct pipe_context *pipe,
+ unsigned buffers,
+ const union pipe_color_union *color,
+ double depth,
+ unsigned stencil);
+
+ /**
+ * Clear a color rendertarget surface.
+ * \param color pointer to an union of fiu array for each of r, g, b, a.
+ */
+ void (*clear_render_target)(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ const union pipe_color_union *color,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height);
+
+ /**
+ * Clear a depth-stencil surface.
+ * \param clear_flags bitfield of PIPE_CLEAR_DEPTH/STENCIL values.
+ * \param depth depth clear value in [0,1].
+ * \param stencil stencil clear value
+ */
+ void (*clear_depth_stencil)(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ unsigned clear_flags,
+ double depth,
+ unsigned stencil,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height);
+
+ /**
+ * Clear a buffer. Runs a memset over the specified region with the element
+ * value passed in through clear_value of size clear_value_size.
+ */
+ void (*clear_buffer)(struct pipe_context *pipe,
+ struct pipe_resource *res,
+ unsigned offset,
+ unsigned size,
+ const void *clear_value,
+ int clear_value_size);
+
+ /** Flush draw commands
+ *
+ * \param flags bitfield of enum pipe_flush_flags values.
+ */
+ void (*flush)(struct pipe_context *pipe,
+ struct pipe_fence_handle **fence,
+ unsigned flags);
+
+ /**
+ * Create a view on a texture to be used by a shader stage.
+ */
+ struct pipe_sampler_view * (*create_sampler_view)(struct pipe_context *ctx,
+ struct pipe_resource *texture,
+ const struct pipe_sampler_view *templat);
+
+ void (*sampler_view_destroy)(struct pipe_context *ctx,
+ struct pipe_sampler_view *view);
+
+
+ /**
+ * Get a surface which is a "view" into a resource, used by
+ * render target / depth stencil stages.
+ */
+ struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
+ struct pipe_resource *resource,
+ const struct pipe_surface *templat);
+
+ void (*surface_destroy)(struct pipe_context *ctx,
+ struct pipe_surface *);
+
+ /**
+ * Map a resource.
+ *
+ * Transfers are (by default) context-private and allow uploads to be
+ * interleaved with rendering.
+ *
+ * out_transfer will contain the transfer object that must be passed
+ * to all the other transfer functions. It also contains useful
+ * information (like texture strides).
+ */
+ void *(*transfer_map)(struct pipe_context *,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage, /* a combination of PIPE_TRANSFER_x */
+ const struct pipe_box *,
+ struct pipe_transfer **out_transfer);
+
+ /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the
+ * regions specified with this call are guaranteed to be written to
+ * the resource.
+ */
+ void (*transfer_flush_region)( struct pipe_context *,
+ struct pipe_transfer *transfer,
+ const struct pipe_box *);
+
+ void (*transfer_unmap)(struct pipe_context *,
+ struct pipe_transfer *transfer);
+
+ /* One-shot transfer operation with data supplied in a user
+ * pointer. XXX: strides??
+ */
+ void (*transfer_inline_write)( struct pipe_context *,
+ struct pipe_resource *,
+ unsigned level,
+ unsigned usage, /* a combination of PIPE_TRANSFER_x */
+ const struct pipe_box *,
+ const void *data,
+ unsigned stride,
+ unsigned layer_stride);
+
+ /**
+ * Flush any pending framebuffer writes and invalidate texture caches.
+ */
+ void (*texture_barrier)(struct pipe_context *);
+
+ /**
+ * Flush caches according to flags.
+ */
+ void (*memory_barrier)(struct pipe_context *, unsigned flags);
+
+ /**
+ * Creates a video codec for a specific video format/profile
+ */
+ struct pipe_video_codec *(*create_video_codec)( struct pipe_context *context,
+ const struct pipe_video_codec *templat );
+
+ /**
+ * Creates a video buffer as decoding target
+ */
+ struct pipe_video_buffer *(*create_video_buffer)( struct pipe_context *context,
+ const struct pipe_video_buffer *templat );
+
+ /**
+ * Compute kernel execution
+ */
+ /*@{*/
+ /**
+ * Define the compute program and parameters to be used by
+ * pipe_context::launch_grid.
+ */
+ void *(*create_compute_state)(struct pipe_context *context,
+ const struct pipe_compute_state *);
+ void (*bind_compute_state)(struct pipe_context *, void *);
+ void (*delete_compute_state)(struct pipe_context *, void *);
+
+ /**
+ * Bind an array of shader resources that will be used by the
+ * compute program. Any resources that were previously bound to
+ * the specified range will be unbound after this call.
+ *
+ * \param start first resource to bind.
+ * \param count number of consecutive resources to bind.
+ * \param resources array of pointers to the resources to bind, it
+ * should contain at least \a count elements
+ * unless it's NULL, in which case no new
+ * resources will be bound.
+ */
+ void (*set_compute_resources)(struct pipe_context *,
+ unsigned start, unsigned count,
+ struct pipe_surface **resources);
+
+ /**
+ * Bind an array of buffers to be mapped into the address space of
+ * the GLOBAL resource. Any buffers that were previously bound
+ * between [first, first + count - 1] are unbound after this call.
+ *
+ * \param first first buffer to map.
+ * \param count number of consecutive buffers to map.
+ * \param resources array of pointers to the buffers to map, it
+ * should contain at least \a count elements
+ * unless it's NULL, in which case no new
+ * resources will be bound.
+ * \param handles array of pointers to the memory locations that
+ * will be updated with the address each buffer
+ * will be mapped to. The base memory address of
+ * each of the buffers will be added to the value
+ * pointed to by its corresponding handle to form
+ * the final address argument. It should contain
+ * at least \a count elements, unless \a
+ * resources is NULL in which case \a handles
+ * should be NULL as well.
+ *
+ * Note that the driver isn't required to make any guarantees about
+ * the contents of the \a handles array being valid anytime except
+ * during the subsequent calls to pipe_context::launch_grid. This
+ * means that the only sensible location handles[i] may point to is
+ * somewhere within the INPUT buffer itself. This is so to
+ * accommodate implementations that lack virtual memory but
+ * nevertheless migrate buffers on the fly, leading to resource
+ * base addresses that change on each kernel invocation or are
+ * unknown to the pipe driver.
+ */
+ void (*set_global_binding)(struct pipe_context *context,
+ unsigned first, unsigned count,
+ struct pipe_resource **resources,
+ uint32_t **handles);
+
+ /**
+ * Launch the compute kernel starting from instruction \a pc of the
+ * currently bound compute program.
+ *
+ * \a grid_layout and \a block_layout are arrays of size \a
+ * PIPE_COMPUTE_CAP_GRID_DIMENSION that determine the layout of the
+ * grid (in block units) and working block (in thread units) to be
+ * used, respectively.
+ *
+ * \a pc For drivers that use PIPE_SHADER_IR_LLVM as their prefered IR,
+ * this value will be the index of the kernel in the opencl.kernels
+ * metadata list.
+ *
+ * \a input will be used to initialize the INPUT resource, and it
+ * should point to a buffer of at least
+ * pipe_compute_state::req_input_mem bytes.
+ */
+ void (*launch_grid)(struct pipe_context *context,
+ const uint *block_layout, const uint *grid_layout,
+ uint32_t pc, const void *input);
+ /*@}*/
+
+ /**
+ * Get sample position for an individual sample point.
+ *
+ * \param sample_count - total number of samples
+ * \param sample_index - sample to get the position values for
+ * \param out_value - return value of 2 floats for x and y position for
+ * requested sample.
+ */
+ void (*get_sample_position)(struct pipe_context *context,
+ unsigned sample_count,
+ unsigned sample_index,
+ float *out_value);
+
+ /**
+ * Flush the resource cache, so that the resource can be used
+ * by an external client. Possible usage:
+ * - flushing a resource before presenting it on the screen
+ * - flushing a resource if some other process or device wants to use it
+ * This shouldn't be used to flush caches if the resource is only managed
+ * by a single pipe_screen and is not shared with another process.
+ * (i.e. you shouldn't use it to flush caches explicitly if you want to e.g.
+ * use the resource for texturing)
+ */
+ void (*flush_resource)(struct pipe_context *ctx,
+ struct pipe_resource *resource);
+
+ /**
+ * Invalidate the contents of the resource.
+ *
+ * This is used to implement EGL's semantic of undefined depth/stencil
+ * contenst after a swapbuffers. This allows a tiled renderer (for
+ * example) to not store the depth buffer.
+ */
+ void (*invalidate_resource)(struct pipe_context *ctx,
+ struct pipe_resource *resource);
+
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPE_CONTEXT_H */
diff --git a/mesalib/src/gallium/include/pipe/p_defines.h b/mesalib/src/gallium/include/pipe/p_defines.h
new file mode 100644
index 000000000..ae173b3c2
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_defines.h
@@ -0,0 +1,760 @@
+/**************************************************************************
+ *
+ * Copyright 2007 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_DEFINES_H
+#define PIPE_DEFINES_H
+
+#include "p_compiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Gallium error codes.
+ *
+ * - A zero value always means success.
+ * - A negative value always means failure.
+ * - The meaning of a positive value is function dependent.
+ */
+enum pipe_error {
+ PIPE_OK = 0,
+ PIPE_ERROR = -1, /**< Generic error */
+ PIPE_ERROR_BAD_INPUT = -2,
+ PIPE_ERROR_OUT_OF_MEMORY = -3,
+ PIPE_ERROR_RETRY = -4
+ /* TODO */
+};
+
+
+#define PIPE_BLENDFACTOR_ONE 0x1
+#define PIPE_BLENDFACTOR_SRC_COLOR 0x2
+#define PIPE_BLENDFACTOR_SRC_ALPHA 0x3
+#define PIPE_BLENDFACTOR_DST_ALPHA 0x4
+#define PIPE_BLENDFACTOR_DST_COLOR 0x5
+#define PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE 0x6
+#define PIPE_BLENDFACTOR_CONST_COLOR 0x7
+#define PIPE_BLENDFACTOR_CONST_ALPHA 0x8
+#define PIPE_BLENDFACTOR_SRC1_COLOR 0x9
+#define PIPE_BLENDFACTOR_SRC1_ALPHA 0x0A
+#define PIPE_BLENDFACTOR_ZERO 0x11
+#define PIPE_BLENDFACTOR_INV_SRC_COLOR 0x12
+#define PIPE_BLENDFACTOR_INV_SRC_ALPHA 0x13
+#define PIPE_BLENDFACTOR_INV_DST_ALPHA 0x14
+#define PIPE_BLENDFACTOR_INV_DST_COLOR 0x15
+#define PIPE_BLENDFACTOR_INV_CONST_COLOR 0x17
+#define PIPE_BLENDFACTOR_INV_CONST_ALPHA 0x18
+#define PIPE_BLENDFACTOR_INV_SRC1_COLOR 0x19
+#define PIPE_BLENDFACTOR_INV_SRC1_ALPHA 0x1A
+
+#define PIPE_BLEND_ADD 0
+#define PIPE_BLEND_SUBTRACT 1
+#define PIPE_BLEND_REVERSE_SUBTRACT 2
+#define PIPE_BLEND_MIN 3
+#define PIPE_BLEND_MAX 4
+
+#define PIPE_LOGICOP_CLEAR 0
+#define PIPE_LOGICOP_NOR 1
+#define PIPE_LOGICOP_AND_INVERTED 2
+#define PIPE_LOGICOP_COPY_INVERTED 3
+#define PIPE_LOGICOP_AND_REVERSE 4
+#define PIPE_LOGICOP_INVERT 5
+#define PIPE_LOGICOP_XOR 6
+#define PIPE_LOGICOP_NAND 7
+#define PIPE_LOGICOP_AND 8
+#define PIPE_LOGICOP_EQUIV 9
+#define PIPE_LOGICOP_NOOP 10
+#define PIPE_LOGICOP_OR_INVERTED 11
+#define PIPE_LOGICOP_COPY 12
+#define PIPE_LOGICOP_OR_REVERSE 13
+#define PIPE_LOGICOP_OR 14
+#define PIPE_LOGICOP_SET 15
+
+#define PIPE_MASK_R 0x1
+#define PIPE_MASK_G 0x2
+#define PIPE_MASK_B 0x4
+#define PIPE_MASK_A 0x8
+#define PIPE_MASK_RGBA 0xf
+#define PIPE_MASK_Z 0x10
+#define PIPE_MASK_S 0x20
+#define PIPE_MASK_ZS 0x30
+#define PIPE_MASK_RGBAZS (PIPE_MASK_RGBA|PIPE_MASK_ZS)
+
+
+/**
+ * Inequality functions. Used for depth test, stencil compare, alpha
+ * test, shadow compare, etc.
+ */
+#define PIPE_FUNC_NEVER 0
+#define PIPE_FUNC_LESS 1
+#define PIPE_FUNC_EQUAL 2
+#define PIPE_FUNC_LEQUAL 3
+#define PIPE_FUNC_GREATER 4
+#define PIPE_FUNC_NOTEQUAL 5
+#define PIPE_FUNC_GEQUAL 6
+#define PIPE_FUNC_ALWAYS 7
+
+/** Polygon fill mode */
+#define PIPE_POLYGON_MODE_FILL 0
+#define PIPE_POLYGON_MODE_LINE 1
+#define PIPE_POLYGON_MODE_POINT 2
+
+/** Polygon face specification, eg for culling */
+#define PIPE_FACE_NONE 0
+#define PIPE_FACE_FRONT 1
+#define PIPE_FACE_BACK 2
+#define PIPE_FACE_FRONT_AND_BACK (PIPE_FACE_FRONT | PIPE_FACE_BACK)
+
+/** Stencil ops */
+#define PIPE_STENCIL_OP_KEEP 0
+#define PIPE_STENCIL_OP_ZERO 1
+#define PIPE_STENCIL_OP_REPLACE 2
+#define PIPE_STENCIL_OP_INCR 3
+#define PIPE_STENCIL_OP_DECR 4
+#define PIPE_STENCIL_OP_INCR_WRAP 5
+#define PIPE_STENCIL_OP_DECR_WRAP 6
+#define PIPE_STENCIL_OP_INVERT 7
+
+/** Texture types.
+ * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D */
+enum pipe_texture_target {
+ PIPE_BUFFER = 0,
+ PIPE_TEXTURE_1D = 1,
+ PIPE_TEXTURE_2D = 2,
+ PIPE_TEXTURE_3D = 3,
+ PIPE_TEXTURE_CUBE = 4,
+ PIPE_TEXTURE_RECT = 5,
+ PIPE_TEXTURE_1D_ARRAY = 6,
+ PIPE_TEXTURE_2D_ARRAY = 7,
+ PIPE_TEXTURE_CUBE_ARRAY = 8,
+ PIPE_MAX_TEXTURE_TYPES
+};
+
+#define PIPE_TEX_FACE_POS_X 0
+#define PIPE_TEX_FACE_NEG_X 1
+#define PIPE_TEX_FACE_POS_Y 2
+#define PIPE_TEX_FACE_NEG_Y 3
+#define PIPE_TEX_FACE_POS_Z 4
+#define PIPE_TEX_FACE_NEG_Z 5
+#define PIPE_TEX_FACE_MAX 6
+
+#define PIPE_TEX_WRAP_REPEAT 0
+#define PIPE_TEX_WRAP_CLAMP 1
+#define PIPE_TEX_WRAP_CLAMP_TO_EDGE 2
+#define PIPE_TEX_WRAP_CLAMP_TO_BORDER 3
+#define PIPE_TEX_WRAP_MIRROR_REPEAT 4
+#define PIPE_TEX_WRAP_MIRROR_CLAMP 5
+#define PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE 6
+#define PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER 7
+
+/* Between mipmaps, ie mipfilter
+ */
+#define PIPE_TEX_MIPFILTER_NEAREST 0
+#define PIPE_TEX_MIPFILTER_LINEAR 1
+#define PIPE_TEX_MIPFILTER_NONE 2
+
+/* Within a mipmap, ie min/mag filter
+ */
+#define PIPE_TEX_FILTER_NEAREST 0
+#define PIPE_TEX_FILTER_LINEAR 1
+
+#define PIPE_TEX_COMPARE_NONE 0
+#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
+
+/**
+ * Clear buffer bits
+ */
+#define PIPE_CLEAR_DEPTH (1 << 0)
+#define PIPE_CLEAR_STENCIL (1 << 1)
+#define PIPE_CLEAR_COLOR0 (1 << 2)
+#define PIPE_CLEAR_COLOR1 (1 << 3)
+#define PIPE_CLEAR_COLOR2 (1 << 4)
+#define PIPE_CLEAR_COLOR3 (1 << 5)
+#define PIPE_CLEAR_COLOR4 (1 << 6)
+#define PIPE_CLEAR_COLOR5 (1 << 7)
+#define PIPE_CLEAR_COLOR6 (1 << 8)
+#define PIPE_CLEAR_COLOR7 (1 << 9)
+/** Combined flags */
+/** All color buffers currently bound */
+#define PIPE_CLEAR_COLOR (PIPE_CLEAR_COLOR0 | PIPE_CLEAR_COLOR1 | \
+ PIPE_CLEAR_COLOR2 | PIPE_CLEAR_COLOR3 | \
+ PIPE_CLEAR_COLOR4 | PIPE_CLEAR_COLOR5 | \
+ PIPE_CLEAR_COLOR6 | PIPE_CLEAR_COLOR7)
+#define PIPE_CLEAR_DEPTHSTENCIL (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)
+
+/**
+ * Transfer object usage flags
+ */
+enum pipe_transfer_usage {
+ /**
+ * Resource contents read back (or accessed directly) at transfer
+ * create time.
+ */
+ PIPE_TRANSFER_READ = (1 << 0),
+
+ /**
+ * Resource contents will be written back at transfer_unmap
+ * time (or modified as a result of being accessed directly).
+ */
+ PIPE_TRANSFER_WRITE = (1 << 1),
+
+ /**
+ * Read/modify/write
+ */
+ PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE,
+
+ /**
+ * The transfer should map the texture storage directly. The driver may
+ * return NULL if that isn't possible, and the state tracker needs to cope
+ * with that and use an alternative path without this flag.
+ *
+ * E.g. the state tracker could have a simpler path which maps textures and
+ * does read/modify/write cycles on them directly, and a more complicated
+ * path which uses minimal read and write transfers.
+ */
+ PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2),
+
+ /**
+ * Discards the memory within the mapped region.
+ *
+ * It should not be used with PIPE_TRANSFER_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
+ */
+ PIPE_TRANSFER_DISCARD_RANGE = (1 << 8),
+
+ /**
+ * Fail if the resource cannot be mapped immediately.
+ *
+ * See also:
+ * - Direct3D's D3DLOCK_DONOTWAIT flag.
+ * - Mesa3D's MESA_MAP_NOWAIT_BIT flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag.
+ */
+ PIPE_TRANSFER_DONTBLOCK = (1 << 9),
+
+ /**
+ * Do not attempt to synchronize pending operations on the resource when mapping.
+ *
+ * It should not be used with PIPE_TRANSFER_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag.
+ * - Direct3D's D3DLOCK_NOOVERWRITE flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag.
+ */
+ PIPE_TRANSFER_UNSYNCHRONIZED = (1 << 10),
+
+ /**
+ * Written ranges will be notified later with
+ * pipe_context::transfer_flush_region.
+ *
+ * It should not be used with PIPE_TRANSFER_READ.
+ *
+ * See also:
+ * - pipe_context::transfer_flush_region
+ * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
+ */
+ PIPE_TRANSFER_FLUSH_EXPLICIT = (1 << 11),
+
+ /**
+ * Discards all memory backing the resource.
+ *
+ * It should not be used with PIPE_TRANSFER_READ.
+ *
+ * This is equivalent to:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_BUFFER_BIT
+ * - BufferData(NULL) on a GL buffer
+ * - Direct3D's D3DLOCK_DISCARD flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.Discard flag.
+ * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
+ * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
+ */
+ PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1 << 12),
+
+ /**
+ * Allows the resource to be used for rendering while mapped.
+ *
+ * PIPE_RESOURCE_FLAG_MAP_PERSISTENT must be set when creating
+ * the resource.
+ *
+ * If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
+ * must be called to ensure the device can see what the CPU has written.
+ */
+ PIPE_TRANSFER_PERSISTENT = (1 << 13),
+
+ /**
+ * If PERSISTENT is set, this ensures any writes done by the device are
+ * immediately visible to the CPU and vice versa.
+ *
+ * PIPE_RESOURCE_FLAG_MAP_COHERENT must be set when creating
+ * the resource.
+ */
+ PIPE_TRANSFER_COHERENT = (1 << 14)
+};
+
+/**
+ * Flags for the flush function.
+ */
+enum pipe_flush_flags {
+ PIPE_FLUSH_END_OF_FRAME = (1 << 0)
+};
+
+/**
+ * Flags for pipe_context::memory_barrier.
+ */
+#define PIPE_BARRIER_MAPPED_BUFFER (1 << 0)
+
+/*
+ * Resource binding flags -- state tracker must specify in advance all
+ * the ways a resource might be used.
+ */
+#define PIPE_BIND_DEPTH_STENCIL (1 << 0) /* create_surface */
+#define PIPE_BIND_RENDER_TARGET (1 << 1) /* create_surface */
+#define PIPE_BIND_BLENDABLE (1 << 2) /* create_surface */
+#define PIPE_BIND_SAMPLER_VIEW (1 << 3) /* create_sampler_view */
+#define PIPE_BIND_VERTEX_BUFFER (1 << 4) /* set_vertex_buffers */
+#define PIPE_BIND_INDEX_BUFFER (1 << 5) /* draw_elements */
+#define PIPE_BIND_CONSTANT_BUFFER (1 << 6) /* set_constant_buffer */
+#define PIPE_BIND_DISPLAY_TARGET (1 << 8) /* flush_front_buffer */
+#define PIPE_BIND_TRANSFER_WRITE (1 << 9) /* transfer_map */
+#define PIPE_BIND_TRANSFER_READ (1 << 10) /* transfer_map */
+#define PIPE_BIND_STREAM_OUTPUT (1 << 11) /* set_stream_output_buffers */
+#define PIPE_BIND_CURSOR (1 << 16) /* mouse cursor */
+#define PIPE_BIND_CUSTOM (1 << 17) /* state-tracker/winsys usages */
+#define PIPE_BIND_GLOBAL (1 << 18) /* set_global_binding */
+#define PIPE_BIND_SHADER_RESOURCE (1 << 19) /* set_shader_resources */
+#define PIPE_BIND_COMPUTE_RESOURCE (1 << 20) /* set_compute_resources */
+#define PIPE_BIND_COMMAND_ARGS_BUFFER (1 << 21) /* pipe_draw_info.indirect */
+
+/* The first two flags above were previously part of the amorphous
+ * TEXTURE_USAGE, most of which are now descriptions of the ways a
+ * particular texture can be bound to the gallium pipeline. The two flags
+ * below do not fit within that and probably need to be migrated to some
+ * other place.
+ *
+ * It seems like scanout is used by the Xorg state tracker to ask for
+ * a texture suitable for actual scanout (hence the name), which
+ * implies extra layout constraints on some hardware. It may also
+ * have some special meaning regarding mouse cursor images.
+ *
+ * The shared flag is quite underspecified, but certainly isn't a
+ * binding flag - it seems more like a message to the winsys to create
+ * a shareable allocation.
+ *
+ * The third flag has been added to be able to force textures to be created
+ * in linear mode (no tiling).
+ */
+#define PIPE_BIND_SCANOUT (1 << 14) /* */
+#define PIPE_BIND_SHARED (1 << 15) /* get_texture_handle ??? */
+#define PIPE_BIND_LINEAR (1 << 21)
+
+
+/* Flags for the driver about resource behaviour:
+ */
+#define PIPE_RESOURCE_FLAG_MAP_PERSISTENT (1 << 0)
+#define PIPE_RESOURCE_FLAG_MAP_COHERENT (1 << 1)
+#define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 16) /* driver/winsys private */
+#define PIPE_RESOURCE_FLAG_ST_PRIV (1 << 24) /* state-tracker/winsys private */
+
+/* Hint about the expected lifecycle of a resource.
+ * Sorted according to GPU vs CPU access.
+ */
+#define PIPE_USAGE_DEFAULT 0 /* fast GPU access */
+#define PIPE_USAGE_IMMUTABLE 1 /* fast GPU access, immutable */
+#define PIPE_USAGE_DYNAMIC 2 /* uploaded data is used multiple times */
+#define PIPE_USAGE_STREAM 3 /* uploaded data is used once */
+#define PIPE_USAGE_STAGING 4 /* fast CPU access */
+
+
+/**
+ * Shaders
+ */
+#define PIPE_SHADER_VERTEX 0
+#define PIPE_SHADER_FRAGMENT 1
+#define PIPE_SHADER_GEOMETRY 2
+#define PIPE_SHADER_COMPUTE 3
+#define PIPE_SHADER_TYPES 4
+
+
+/**
+ * Primitive types:
+ */
+#define PIPE_PRIM_POINTS 0
+#define PIPE_PRIM_LINES 1
+#define PIPE_PRIM_LINE_LOOP 2
+#define PIPE_PRIM_LINE_STRIP 3
+#define PIPE_PRIM_TRIANGLES 4
+#define PIPE_PRIM_TRIANGLE_STRIP 5
+#define PIPE_PRIM_TRIANGLE_FAN 6
+#define PIPE_PRIM_QUADS 7
+#define PIPE_PRIM_QUAD_STRIP 8
+#define PIPE_PRIM_POLYGON 9
+#define PIPE_PRIM_LINES_ADJACENCY 10
+#define PIPE_PRIM_LINE_STRIP_ADJACENCY 11
+#define PIPE_PRIM_TRIANGLES_ADJACENCY 12
+#define PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY 13
+#define PIPE_PRIM_MAX 14
+
+
+/**
+ * Query object types
+ */
+#define PIPE_QUERY_OCCLUSION_COUNTER 0
+#define PIPE_QUERY_OCCLUSION_PREDICATE 1
+#define PIPE_QUERY_TIMESTAMP 2
+#define PIPE_QUERY_TIMESTAMP_DISJOINT 3
+#define PIPE_QUERY_TIME_ELAPSED 4
+#define PIPE_QUERY_PRIMITIVES_GENERATED 5
+#define PIPE_QUERY_PRIMITIVES_EMITTED 6
+#define PIPE_QUERY_SO_STATISTICS 7
+#define PIPE_QUERY_SO_OVERFLOW_PREDICATE 8
+#define PIPE_QUERY_GPU_FINISHED 9
+#define PIPE_QUERY_PIPELINE_STATISTICS 10
+#define PIPE_QUERY_TYPES 11
+
+/* start of driver queries,
+ * see pipe_screen::get_driver_query_info */
+#define PIPE_QUERY_DRIVER_SPECIFIC 256
+
+
+/**
+ * Conditional rendering modes
+ */
+#define PIPE_RENDER_COND_WAIT 0
+#define PIPE_RENDER_COND_NO_WAIT 1
+#define PIPE_RENDER_COND_BY_REGION_WAIT 2
+#define PIPE_RENDER_COND_BY_REGION_NO_WAIT 3
+
+
+/**
+ * Point sprite coord modes
+ */
+#define PIPE_SPRITE_COORD_UPPER_LEFT 0
+#define PIPE_SPRITE_COORD_LOWER_LEFT 1
+
+
+/**
+ * Texture swizzles
+ */
+#define PIPE_SWIZZLE_RED 0
+#define PIPE_SWIZZLE_GREEN 1
+#define PIPE_SWIZZLE_BLUE 2
+#define PIPE_SWIZZLE_ALPHA 3
+#define PIPE_SWIZZLE_ZERO 4
+#define PIPE_SWIZZLE_ONE 5
+
+
+#define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull
+
+/**
+ * Implementation capabilities/limits which are queried through
+ * pipe_screen::get_param()
+ */
+enum pipe_cap {
+ PIPE_CAP_NPOT_TEXTURES = 1,
+ PIPE_CAP_TWO_SIDED_STENCIL = 2,
+ PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS = 4,
+ PIPE_CAP_ANISOTROPIC_FILTER = 5,
+ PIPE_CAP_POINT_SPRITE = 6,
+ PIPE_CAP_MAX_RENDER_TARGETS = 7,
+ PIPE_CAP_OCCLUSION_QUERY = 8,
+ PIPE_CAP_QUERY_TIME_ELAPSED = 9,
+ PIPE_CAP_TEXTURE_SHADOW_MAP = 10,
+ PIPE_CAP_TEXTURE_SWIZZLE = 11,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS = 12,
+ PIPE_CAP_MAX_TEXTURE_3D_LEVELS = 13,
+ PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS = 14,
+ PIPE_CAP_TEXTURE_MIRROR_CLAMP = 25,
+ PIPE_CAP_BLEND_EQUATION_SEPARATE = 28,
+ PIPE_CAP_SM3 = 29, /*< Shader Model, supported */
+ PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS = 30,
+ PIPE_CAP_PRIMITIVE_RESTART = 31,
+ /** blend enables and write masks per rendertarget */
+ PIPE_CAP_INDEP_BLEND_ENABLE = 33,
+ /** different blend funcs per rendertarget */
+ PIPE_CAP_INDEP_BLEND_FUNC = 34,
+ PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS = 36,
+ PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT = 37,
+ PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT = 38,
+ PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER = 39,
+ PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER = 40,
+ PIPE_CAP_DEPTH_CLIP_DISABLE = 41,
+ PIPE_CAP_SHADER_STENCIL_EXPORT = 42,
+ PIPE_CAP_TGSI_INSTANCEID = 43,
+ PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR = 44,
+ PIPE_CAP_FRAGMENT_COLOR_CLAMPED = 45,
+ PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46,
+ PIPE_CAP_SEAMLESS_CUBE_MAP = 47,
+ PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE = 48,
+ PIPE_CAP_MIN_TEXEL_OFFSET = 50,
+ PIPE_CAP_MAX_TEXEL_OFFSET = 51,
+ PIPE_CAP_CONDITIONAL_RENDER = 52,
+ PIPE_CAP_TEXTURE_BARRIER = 53,
+ PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS = 55,
+ PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS = 56,
+ PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME = 57,
+ PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS = 59, /* temporary */
+ PIPE_CAP_VERTEX_COLOR_UNCLAMPED = 60,
+ PIPE_CAP_VERTEX_COLOR_CLAMPED = 61,
+ PIPE_CAP_GLSL_FEATURE_LEVEL = 62,
+ PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 63,
+ PIPE_CAP_USER_VERTEX_BUFFERS = 64,
+ PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY = 65,
+ PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY = 66,
+ PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY = 67,
+ PIPE_CAP_COMPUTE = 68,
+ PIPE_CAP_USER_INDEX_BUFFERS = 69,
+ PIPE_CAP_USER_CONSTANT_BUFFERS = 70,
+ PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 71,
+ PIPE_CAP_START_INSTANCE = 72,
+ PIPE_CAP_QUERY_TIMESTAMP = 73,
+ PIPE_CAP_TEXTURE_MULTISAMPLE = 74,
+ PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT = 75,
+ PIPE_CAP_CUBE_MAP_ARRAY = 76,
+ PIPE_CAP_TEXTURE_BUFFER_OBJECTS = 77,
+ PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 78,
+ PIPE_CAP_TGSI_TEXCOORD = 79,
+ PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER = 80,
+ PIPE_CAP_QUERY_PIPELINE_STATISTICS = 81,
+ PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82,
+ PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83,
+ PIPE_CAP_MAX_VIEWPORTS = 84,
+ PIPE_CAP_ENDIANNESS = 85,
+ PIPE_CAP_MIXED_FRAMEBUFFER_SIZES = 86,
+ PIPE_CAP_TGSI_VS_LAYER_VIEWPORT = 87,
+ PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES = 88,
+ PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 89,
+ PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS = 90,
+ PIPE_CAP_TEXTURE_GATHER_SM5 = 91,
+ PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT = 92,
+ PIPE_CAP_FAKE_SW_MSAA = 93,
+ PIPE_CAP_TEXTURE_QUERY_LOD = 94,
+ PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET = 95,
+ PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET = 96,
+ PIPE_CAP_SAMPLE_SHADING = 97,
+ PIPE_CAP_TEXTURE_GATHER_OFFSETS = 98,
+ PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION = 99,
+ PIPE_CAP_MAX_VERTEX_STREAMS = 100,
+ PIPE_CAP_DRAW_INDIRECT = 101,
+ PIPE_CAP_TGSI_FS_FINE_DERIVATIVE = 102,
+ PIPE_CAP_VENDOR_ID = 103,
+ PIPE_CAP_DEVICE_ID = 104,
+ PIPE_CAP_ACCELERATED = 105,
+ PIPE_CAP_VIDEO_MEMORY = 106,
+ PIPE_CAP_UMA = 107,
+ PIPE_CAP_CONDITIONAL_RENDER_INVERTED = 108,
+ PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE = 109,
+ PIPE_CAP_SAMPLER_VIEW_TARGET = 110,
+ PIPE_CAP_CLIP_HALFZ = 111,
+ PIPE_CAP_VERTEXID_NOBASE = 112,
+ PIPE_CAP_POLYGON_OFFSET_CLAMP = 113,
+ PIPE_CAP_MULTISAMPLE_Z_RESOLVE = 114,
+ PIPE_CAP_RESOURCE_FROM_USER_MEMORY = 115,
+};
+
+#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
+#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600 (1 << 1)
+
+enum pipe_endian {
+ PIPE_ENDIAN_LITTLE = 0,
+ PIPE_ENDIAN_BIG = 1,
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+ PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+ PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
+#endif
+};
+
+/**
+ * Implementation limits which are queried through
+ * pipe_screen::get_paramf()
+ */
+enum pipe_capf
+{
+ PIPE_CAPF_MAX_LINE_WIDTH,
+ PIPE_CAPF_MAX_LINE_WIDTH_AA,
+ PIPE_CAPF_MAX_POINT_WIDTH,
+ PIPE_CAPF_MAX_POINT_WIDTH_AA,
+ PIPE_CAPF_MAX_TEXTURE_ANISOTROPY,
+ PIPE_CAPF_MAX_TEXTURE_LOD_BIAS,
+ PIPE_CAPF_GUARD_BAND_LEFT,
+ PIPE_CAPF_GUARD_BAND_TOP,
+ PIPE_CAPF_GUARD_BAND_RIGHT,
+ PIPE_CAPF_GUARD_BAND_BOTTOM
+};
+
+/* Shader caps not specific to any single stage */
+enum pipe_shader_cap
+{
+ PIPE_SHADER_CAP_MAX_INSTRUCTIONS, /* if 0, it means the stage is unsupported */
+ PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS,
+ PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS,
+ PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS,
+ PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH,
+ PIPE_SHADER_CAP_MAX_INPUTS,
+ PIPE_SHADER_CAP_MAX_OUTPUTS,
+ PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE,
+ PIPE_SHADER_CAP_MAX_CONST_BUFFERS,
+ PIPE_SHADER_CAP_MAX_TEMPS,
+ PIPE_SHADER_CAP_MAX_PREDS,
+ /* boolean caps */
+ PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED,
+ PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR,
+ PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR,
+ PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR,
+ PIPE_SHADER_CAP_INDIRECT_CONST_ADDR,
+ PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */
+ PIPE_SHADER_CAP_INTEGERS,
+ PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS,
+ PIPE_SHADER_CAP_PREFERRED_IR,
+ PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED,
+ PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS,
+ PIPE_SHADER_CAP_DOUBLES,
+ PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED, /* all rounding modes */
+ PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED,
+};
+
+/**
+ * Shader intermediate representation.
+ */
+enum pipe_shader_ir
+{
+ PIPE_SHADER_IR_TGSI,
+ PIPE_SHADER_IR_LLVM,
+ PIPE_SHADER_IR_NATIVE
+};
+
+/**
+ * Compute-specific implementation capability. They can be queried
+ * using pipe_screen::get_compute_param.
+ */
+enum pipe_compute_cap
+{
+ PIPE_COMPUTE_CAP_IR_TARGET,
+ PIPE_COMPUTE_CAP_GRID_DIMENSION,
+ PIPE_COMPUTE_CAP_MAX_GRID_SIZE,
+ PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE,
+ PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK,
+ PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE,
+ PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE,
+ PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE,
+ PIPE_COMPUTE_CAP_MAX_INPUT_SIZE,
+ PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE,
+ PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY,
+ PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS,
+ PIPE_COMPUTE_CAP_IMAGES_SUPPORTED
+};
+
+/**
+ * Composite query types
+ */
+
+/**
+ * Query result for PIPE_QUERY_SO_STATISTICS.
+ */
+struct pipe_query_data_so_statistics
+{
+ uint64_t num_primitives_written;
+ uint64_t primitives_storage_needed;
+};
+
+/**
+ * Query result for PIPE_QUERY_TIMESTAMP_DISJOINT.
+ */
+struct pipe_query_data_timestamp_disjoint
+{
+ uint64_t frequency;
+ boolean disjoint;
+};
+
+/**
+ * Query result for PIPE_QUERY_PIPELINE_STATISTICS.
+ */
+struct pipe_query_data_pipeline_statistics
+{
+ uint64_t ia_vertices; /**< Num vertices read by the vertex fetcher. */
+ uint64_t ia_primitives; /**< Num primitives read by the vertex fetcher. */
+ uint64_t vs_invocations; /**< Num vertex shader invocations. */
+ uint64_t gs_invocations; /**< Num geometry shader invocations. */
+ uint64_t gs_primitives; /**< Num primitives output by a geometry shader. */
+ uint64_t c_invocations; /**< Num primitives sent to the rasterizer. */
+ uint64_t c_primitives; /**< Num primitives that were rendered. */
+ uint64_t ps_invocations; /**< Num pixel shader invocations. */
+ uint64_t hs_invocations; /**< Num hull shader invocations. */
+ uint64_t ds_invocations; /**< Num domain shader invocations. */
+ uint64_t cs_invocations; /**< Num compute shader invocations. */
+};
+
+/**
+ * Query result (returned by pipe_context::get_query_result).
+ */
+union pipe_query_result
+{
+ /* PIPE_QUERY_OCCLUSION_PREDICATE */
+ /* PIPE_QUERY_SO_OVERFLOW_PREDICATE */
+ /* PIPE_QUERY_GPU_FINISHED */
+ boolean b;
+
+ /* PIPE_QUERY_OCCLUSION_COUNTER */
+ /* PIPE_QUERY_TIMESTAMP */
+ /* PIPE_QUERY_TIME_ELAPSED */
+ /* PIPE_QUERY_PRIMITIVES_GENERATED */
+ /* PIPE_QUERY_PRIMITIVES_EMITTED */
+ uint64_t u64;
+
+ /* PIPE_QUERY_SO_STATISTICS */
+ struct pipe_query_data_so_statistics so_statistics;
+
+ /* PIPE_QUERY_TIMESTAMP_DISJOINT */
+ struct pipe_query_data_timestamp_disjoint timestamp_disjoint;
+
+ /* PIPE_QUERY_PIPELINE_STATISTICS */
+ struct pipe_query_data_pipeline_statistics pipeline_statistics;
+};
+
+union pipe_color_union
+{
+ float f[4];
+ int i[4];
+ unsigned int ui[4];
+};
+
+struct pipe_driver_query_info
+{
+ const char *name;
+ unsigned query_type; /* PIPE_QUERY_DRIVER_SPECIFIC + i */
+ uint64_t max_value; /* max value that can be returned */
+ boolean uses_byte_units; /* whether the result is in bytes */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mesalib/src/gallium/include/pipe/p_format.h b/mesalib/src/gallium/include/pipe/p_format.h
new file mode 100644
index 000000000..b2646d44c
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_format.h
@@ -0,0 +1,454 @@
+/**************************************************************************
+ *
+ * Copyright 2007 VMware, Inc.
+ * Copyright (c) 2008 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_FORMAT_H
+#define PIPE_FORMAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "p_config.h"
+
+/**
+ * Formats for textures, surfaces and vertex data
+ */
+enum pipe_format {
+ PIPE_FORMAT_NONE = 0,
+ PIPE_FORMAT_B8G8R8A8_UNORM = 1,
+ PIPE_FORMAT_B8G8R8X8_UNORM = 2,
+ PIPE_FORMAT_A8R8G8B8_UNORM = 3,
+ PIPE_FORMAT_X8R8G8B8_UNORM = 4,
+ PIPE_FORMAT_B5G5R5A1_UNORM = 5,
+ PIPE_FORMAT_B4G4R4A4_UNORM = 6,
+ PIPE_FORMAT_B5G6R5_UNORM = 7,
+ PIPE_FORMAT_R10G10B10A2_UNORM = 8,
+ PIPE_FORMAT_L8_UNORM = 9, /**< ubyte luminance */
+ PIPE_FORMAT_A8_UNORM = 10, /**< ubyte alpha */
+ PIPE_FORMAT_I8_UNORM = 11, /**< ubyte intensity */
+ PIPE_FORMAT_L8A8_UNORM = 12, /**< ubyte alpha, luminance */
+ PIPE_FORMAT_L16_UNORM = 13, /**< ushort luminance */
+ PIPE_FORMAT_UYVY = 14,
+ PIPE_FORMAT_YUYV = 15,
+ PIPE_FORMAT_Z16_UNORM = 16,
+ PIPE_FORMAT_Z32_UNORM = 17,
+ PIPE_FORMAT_Z32_FLOAT = 18,
+ PIPE_FORMAT_Z24_UNORM_S8_UINT = 19,
+ PIPE_FORMAT_S8_UINT_Z24_UNORM = 20,
+ PIPE_FORMAT_Z24X8_UNORM = 21,
+ PIPE_FORMAT_X8Z24_UNORM = 22,
+ PIPE_FORMAT_S8_UINT = 23, /**< ubyte stencil */
+ PIPE_FORMAT_R64_FLOAT = 24,
+ PIPE_FORMAT_R64G64_FLOAT = 25,
+ PIPE_FORMAT_R64G64B64_FLOAT = 26,
+ PIPE_FORMAT_R64G64B64A64_FLOAT = 27,
+ PIPE_FORMAT_R32_FLOAT = 28,
+ PIPE_FORMAT_R32G32_FLOAT = 29,
+ PIPE_FORMAT_R32G32B32_FLOAT = 30,
+ PIPE_FORMAT_R32G32B32A32_FLOAT = 31,
+ PIPE_FORMAT_R32_UNORM = 32,
+ PIPE_FORMAT_R32G32_UNORM = 33,
+ PIPE_FORMAT_R32G32B32_UNORM = 34,
+ PIPE_FORMAT_R32G32B32A32_UNORM = 35,
+ PIPE_FORMAT_R32_USCALED = 36,
+ PIPE_FORMAT_R32G32_USCALED = 37,
+ PIPE_FORMAT_R32G32B32_USCALED = 38,
+ PIPE_FORMAT_R32G32B32A32_USCALED = 39,
+ PIPE_FORMAT_R32_SNORM = 40,
+ PIPE_FORMAT_R32G32_SNORM = 41,
+ PIPE_FORMAT_R32G32B32_SNORM = 42,
+ PIPE_FORMAT_R32G32B32A32_SNORM = 43,
+ PIPE_FORMAT_R32_SSCALED = 44,
+ PIPE_FORMAT_R32G32_SSCALED = 45,
+ PIPE_FORMAT_R32G32B32_SSCALED = 46,
+ PIPE_FORMAT_R32G32B32A32_SSCALED = 47,
+ PIPE_FORMAT_R16_UNORM = 48,
+ PIPE_FORMAT_R16G16_UNORM = 49,
+ PIPE_FORMAT_R16G16B16_UNORM = 50,
+ PIPE_FORMAT_R16G16B16A16_UNORM = 51,
+ PIPE_FORMAT_R16_USCALED = 52,
+ PIPE_FORMAT_R16G16_USCALED = 53,
+ PIPE_FORMAT_R16G16B16_USCALED = 54,
+ PIPE_FORMAT_R16G16B16A16_USCALED = 55,
+ PIPE_FORMAT_R16_SNORM = 56,
+ PIPE_FORMAT_R16G16_SNORM = 57,
+ PIPE_FORMAT_R16G16B16_SNORM = 58,
+ PIPE_FORMAT_R16G16B16A16_SNORM = 59,
+ PIPE_FORMAT_R16_SSCALED = 60,
+ PIPE_FORMAT_R16G16_SSCALED = 61,
+ PIPE_FORMAT_R16G16B16_SSCALED = 62,
+ PIPE_FORMAT_R16G16B16A16_SSCALED = 63,
+ PIPE_FORMAT_R8_UNORM = 64,
+ PIPE_FORMAT_R8G8_UNORM = 65,
+ PIPE_FORMAT_R8G8B8_UNORM = 66,
+ PIPE_FORMAT_R8G8B8A8_UNORM = 67,
+ PIPE_FORMAT_X8B8G8R8_UNORM = 68,
+ PIPE_FORMAT_R8_USCALED = 69,
+ PIPE_FORMAT_R8G8_USCALED = 70,
+ PIPE_FORMAT_R8G8B8_USCALED = 71,
+ PIPE_FORMAT_R8G8B8A8_USCALED = 72,
+ PIPE_FORMAT_R8_SNORM = 74,
+ PIPE_FORMAT_R8G8_SNORM = 75,
+ PIPE_FORMAT_R8G8B8_SNORM = 76,
+ PIPE_FORMAT_R8G8B8A8_SNORM = 77,
+ PIPE_FORMAT_R8_SSCALED = 82,
+ PIPE_FORMAT_R8G8_SSCALED = 83,
+ PIPE_FORMAT_R8G8B8_SSCALED = 84,
+ PIPE_FORMAT_R8G8B8A8_SSCALED = 85,
+ PIPE_FORMAT_R32_FIXED = 87,
+ PIPE_FORMAT_R32G32_FIXED = 88,
+ PIPE_FORMAT_R32G32B32_FIXED = 89,
+ PIPE_FORMAT_R32G32B32A32_FIXED = 90,
+ PIPE_FORMAT_R16_FLOAT = 91,
+ PIPE_FORMAT_R16G16_FLOAT = 92,
+ PIPE_FORMAT_R16G16B16_FLOAT = 93,
+ PIPE_FORMAT_R16G16B16A16_FLOAT = 94,
+
+ /* sRGB formats */
+ PIPE_FORMAT_L8_SRGB = 95,
+ PIPE_FORMAT_L8A8_SRGB = 96,
+ PIPE_FORMAT_R8G8B8_SRGB = 97,
+ PIPE_FORMAT_A8B8G8R8_SRGB = 98,
+ PIPE_FORMAT_X8B8G8R8_SRGB = 99,
+ PIPE_FORMAT_B8G8R8A8_SRGB = 100,
+ PIPE_FORMAT_B8G8R8X8_SRGB = 101,
+ PIPE_FORMAT_A8R8G8B8_SRGB = 102,
+ PIPE_FORMAT_X8R8G8B8_SRGB = 103,
+ PIPE_FORMAT_R8G8B8A8_SRGB = 104,
+
+ /* compressed formats */
+ PIPE_FORMAT_DXT1_RGB = 105,
+ PIPE_FORMAT_DXT1_RGBA = 106,
+ PIPE_FORMAT_DXT3_RGBA = 107,
+ PIPE_FORMAT_DXT5_RGBA = 108,
+
+ /* sRGB, compressed */
+ PIPE_FORMAT_DXT1_SRGB = 109,
+ PIPE_FORMAT_DXT1_SRGBA = 110,
+ PIPE_FORMAT_DXT3_SRGBA = 111,
+ PIPE_FORMAT_DXT5_SRGBA = 112,
+
+ /* rgtc compressed */
+ PIPE_FORMAT_RGTC1_UNORM = 113,
+ PIPE_FORMAT_RGTC1_SNORM = 114,
+ PIPE_FORMAT_RGTC2_UNORM = 115,
+ PIPE_FORMAT_RGTC2_SNORM = 116,
+
+ PIPE_FORMAT_R8G8_B8G8_UNORM = 117,
+ PIPE_FORMAT_G8R8_G8B8_UNORM = 118,
+
+ /* mixed formats */
+ PIPE_FORMAT_R8SG8SB8UX8U_NORM = 119,
+ PIPE_FORMAT_R5SG5SB6U_NORM = 120,
+
+ /* TODO: re-order these */
+ PIPE_FORMAT_A8B8G8R8_UNORM = 121,
+ PIPE_FORMAT_B5G5R5X1_UNORM = 122,
+ PIPE_FORMAT_R10G10B10A2_USCALED = 123,
+ PIPE_FORMAT_R11G11B10_FLOAT = 124,
+ PIPE_FORMAT_R9G9B9E5_FLOAT = 125,
+ PIPE_FORMAT_Z32_FLOAT_S8X24_UINT = 126,
+ PIPE_FORMAT_R1_UNORM = 127,
+ PIPE_FORMAT_R10G10B10X2_USCALED = 128,
+ PIPE_FORMAT_R10G10B10X2_SNORM = 129,
+ PIPE_FORMAT_L4A4_UNORM = 130,
+ PIPE_FORMAT_B10G10R10A2_UNORM = 131,
+ PIPE_FORMAT_R10SG10SB10SA2U_NORM = 132,
+ PIPE_FORMAT_R8G8Bx_SNORM = 133,
+ PIPE_FORMAT_R8G8B8X8_UNORM = 134,
+ PIPE_FORMAT_B4G4R4X4_UNORM = 135,
+
+ /* some stencil samplers formats */
+ PIPE_FORMAT_X24S8_UINT = 136,
+ PIPE_FORMAT_S8X24_UINT = 137,
+ PIPE_FORMAT_X32_S8X24_UINT = 138,
+
+ PIPE_FORMAT_B2G3R3_UNORM = 139,
+ PIPE_FORMAT_L16A16_UNORM = 140,
+ PIPE_FORMAT_A16_UNORM = 141,
+ PIPE_FORMAT_I16_UNORM = 142,
+
+ PIPE_FORMAT_LATC1_UNORM = 143,
+ PIPE_FORMAT_LATC1_SNORM = 144,
+ PIPE_FORMAT_LATC2_UNORM = 145,
+ PIPE_FORMAT_LATC2_SNORM = 146,
+
+ PIPE_FORMAT_A8_SNORM = 147,
+ PIPE_FORMAT_L8_SNORM = 148,
+ PIPE_FORMAT_L8A8_SNORM = 149,
+ PIPE_FORMAT_I8_SNORM = 150,
+ PIPE_FORMAT_A16_SNORM = 151,
+ PIPE_FORMAT_L16_SNORM = 152,
+ PIPE_FORMAT_L16A16_SNORM = 153,
+ PIPE_FORMAT_I16_SNORM = 154,
+
+ PIPE_FORMAT_A16_FLOAT = 155,
+ PIPE_FORMAT_L16_FLOAT = 156,
+ PIPE_FORMAT_L16A16_FLOAT = 157,
+ PIPE_FORMAT_I16_FLOAT = 158,
+ PIPE_FORMAT_A32_FLOAT = 159,
+ PIPE_FORMAT_L32_FLOAT = 160,
+ PIPE_FORMAT_L32A32_FLOAT = 161,
+ PIPE_FORMAT_I32_FLOAT = 162,
+
+ PIPE_FORMAT_YV12 = 163,
+ PIPE_FORMAT_YV16 = 164,
+ PIPE_FORMAT_IYUV = 165, /**< aka I420 */
+ PIPE_FORMAT_NV12 = 166,
+ PIPE_FORMAT_NV21 = 167,
+
+ PIPE_FORMAT_A4R4_UNORM = 168,
+ PIPE_FORMAT_R4A4_UNORM = 169,
+ PIPE_FORMAT_R8A8_UNORM = 170,
+ PIPE_FORMAT_A8R8_UNORM = 171,
+
+ PIPE_FORMAT_R10G10B10A2_SSCALED = 172,
+ PIPE_FORMAT_R10G10B10A2_SNORM = 173,
+
+ PIPE_FORMAT_B10G10R10A2_USCALED = 174,
+ PIPE_FORMAT_B10G10R10A2_SSCALED = 175,
+ PIPE_FORMAT_B10G10R10A2_SNORM = 176,
+
+ PIPE_FORMAT_R8_UINT = 177,
+ PIPE_FORMAT_R8G8_UINT = 178,
+ PIPE_FORMAT_R8G8B8_UINT = 179,
+ PIPE_FORMAT_R8G8B8A8_UINT = 180,
+
+ PIPE_FORMAT_R8_SINT = 181,
+ PIPE_FORMAT_R8G8_SINT = 182,
+ PIPE_FORMAT_R8G8B8_SINT = 183,
+ PIPE_FORMAT_R8G8B8A8_SINT = 184,
+
+ PIPE_FORMAT_R16_UINT = 185,
+ PIPE_FORMAT_R16G16_UINT = 186,
+ PIPE_FORMAT_R16G16B16_UINT = 187,
+ PIPE_FORMAT_R16G16B16A16_UINT = 188,
+
+ PIPE_FORMAT_R16_SINT = 189,
+ PIPE_FORMAT_R16G16_SINT = 190,
+ PIPE_FORMAT_R16G16B16_SINT = 191,
+ PIPE_FORMAT_R16G16B16A16_SINT = 192,
+
+ PIPE_FORMAT_R32_UINT = 193,
+ PIPE_FORMAT_R32G32_UINT = 194,
+ PIPE_FORMAT_R32G32B32_UINT = 195,
+ PIPE_FORMAT_R32G32B32A32_UINT = 196,
+
+ PIPE_FORMAT_R32_SINT = 197,
+ PIPE_FORMAT_R32G32_SINT = 198,
+ PIPE_FORMAT_R32G32B32_SINT = 199,
+ PIPE_FORMAT_R32G32B32A32_SINT = 200,
+
+ PIPE_FORMAT_A8_UINT = 201,
+ PIPE_FORMAT_I8_UINT = 202,
+ PIPE_FORMAT_L8_UINT = 203,
+ PIPE_FORMAT_L8A8_UINT = 204,
+
+ PIPE_FORMAT_A8_SINT = 205,
+ PIPE_FORMAT_I8_SINT = 206,
+ PIPE_FORMAT_L8_SINT = 207,
+ PIPE_FORMAT_L8A8_SINT = 208,
+
+ PIPE_FORMAT_A16_UINT = 209,
+ PIPE_FORMAT_I16_UINT = 210,
+ PIPE_FORMAT_L16_UINT = 211,
+ PIPE_FORMAT_L16A16_UINT = 212,
+
+ PIPE_FORMAT_A16_SINT = 213,
+ PIPE_FORMAT_I16_SINT = 214,
+ PIPE_FORMAT_L16_SINT = 215,
+ PIPE_FORMAT_L16A16_SINT = 216,
+
+ PIPE_FORMAT_A32_UINT = 217,
+ PIPE_FORMAT_I32_UINT = 218,
+ PIPE_FORMAT_L32_UINT = 219,
+ PIPE_FORMAT_L32A32_UINT = 220,
+
+ PIPE_FORMAT_A32_SINT = 221,
+ PIPE_FORMAT_I32_SINT = 222,
+ PIPE_FORMAT_L32_SINT = 223,
+ PIPE_FORMAT_L32A32_SINT = 224,
+
+ PIPE_FORMAT_B10G10R10A2_UINT = 225,
+
+ PIPE_FORMAT_ETC1_RGB8 = 226,
+
+ PIPE_FORMAT_R8G8_R8B8_UNORM = 227,
+ PIPE_FORMAT_G8R8_B8R8_UNORM = 228,
+
+ PIPE_FORMAT_R8G8B8X8_SNORM = 229,
+ PIPE_FORMAT_R8G8B8X8_SRGB = 230,
+ PIPE_FORMAT_R8G8B8X8_UINT = 231,
+ PIPE_FORMAT_R8G8B8X8_SINT = 232,
+ PIPE_FORMAT_B10G10R10X2_UNORM = 233,
+ PIPE_FORMAT_R16G16B16X16_UNORM = 234,
+ PIPE_FORMAT_R16G16B16X16_SNORM = 235,
+ PIPE_FORMAT_R16G16B16X16_FLOAT = 236,
+ PIPE_FORMAT_R16G16B16X16_UINT = 237,
+ PIPE_FORMAT_R16G16B16X16_SINT = 238,
+ PIPE_FORMAT_R32G32B32X32_FLOAT = 239,
+ PIPE_FORMAT_R32G32B32X32_UINT = 240,
+ PIPE_FORMAT_R32G32B32X32_SINT = 241,
+
+ PIPE_FORMAT_R8A8_SNORM = 242,
+ PIPE_FORMAT_R16A16_UNORM = 243,
+ PIPE_FORMAT_R16A16_SNORM = 244,
+ PIPE_FORMAT_R16A16_FLOAT = 245,
+ PIPE_FORMAT_R32A32_FLOAT = 246,
+ PIPE_FORMAT_R8A8_UINT = 247,
+ PIPE_FORMAT_R8A8_SINT = 248,
+ PIPE_FORMAT_R16A16_UINT = 249,
+ PIPE_FORMAT_R16A16_SINT = 250,
+ PIPE_FORMAT_R32A32_UINT = 251,
+ PIPE_FORMAT_R32A32_SINT = 252,
+ PIPE_FORMAT_R10G10B10A2_UINT = 253,
+
+ PIPE_FORMAT_B5G6R5_SRGB = 254,
+
+ PIPE_FORMAT_BPTC_RGBA_UNORM = 255,
+ PIPE_FORMAT_BPTC_SRGBA = 256,
+ PIPE_FORMAT_BPTC_RGB_FLOAT = 257,
+ PIPE_FORMAT_BPTC_RGB_UFLOAT = 258,
+
+ PIPE_FORMAT_A8L8_UNORM = 259,
+ PIPE_FORMAT_A8L8_SNORM = 260,
+ PIPE_FORMAT_A8L8_SRGB = 261,
+ PIPE_FORMAT_A16L16_UNORM = 262,
+
+ PIPE_FORMAT_G8R8_UNORM = 263,
+ PIPE_FORMAT_G8R8_SNORM = 264,
+ PIPE_FORMAT_G16R16_UNORM = 265,
+ PIPE_FORMAT_G16R16_SNORM = 266,
+
+ PIPE_FORMAT_A8B8G8R8_SNORM = 267,
+ PIPE_FORMAT_X8B8G8R8_SNORM = 268,
+
+ PIPE_FORMAT_ETC2_RGB8 = 269,
+ PIPE_FORMAT_ETC2_SRGB8 = 270,
+ PIPE_FORMAT_ETC2_RGB8A1 = 271,
+ PIPE_FORMAT_ETC2_SRGB8A1 = 272,
+ PIPE_FORMAT_ETC2_RGBA8 = 273,
+ PIPE_FORMAT_ETC2_SRGBA8 = 274,
+ PIPE_FORMAT_ETC2_R11_UNORM = 275,
+ PIPE_FORMAT_ETC2_R11_SNORM = 276,
+ PIPE_FORMAT_ETC2_RG11_UNORM = 277,
+ PIPE_FORMAT_ETC2_RG11_SNORM = 278,
+
+ PIPE_FORMAT_COUNT
+};
+
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+#define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
+#define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
+#define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
+#define PIPE_FORMAT_BGRX8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
+#define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
+#define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
+#define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
+#define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
+#define PIPE_FORMAT_RGBA8888_SNORM PIPE_FORMAT_R8G8B8A8_SNORM
+#define PIPE_FORMAT_RGBX8888_SNORM PIPE_FORMAT_R8G8B8X8_SNORM
+#define PIPE_FORMAT_ABGR8888_SNORM PIPE_FORMAT_A8B8G8R8_SNORM
+#define PIPE_FORMAT_XBGR8888_SNORM PIPE_FORMAT_X8B8G8R8_SNORM
+#define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_R8G8B8A8_SRGB
+#define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_R8G8B8X8_SRGB
+#define PIPE_FORMAT_BGRA8888_SRGB PIPE_FORMAT_B8G8R8A8_SRGB
+#define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_B8G8R8X8_SRGB
+#define PIPE_FORMAT_ARGB8888_SRGB PIPE_FORMAT_A8R8G8B8_SRGB
+#define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB
+#define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB
+#define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB
+#define PIPE_FORMAT_LA88_UNORM PIPE_FORMAT_L8A8_UNORM
+#define PIPE_FORMAT_AL88_UNORM PIPE_FORMAT_A8L8_UNORM
+#define PIPE_FORMAT_LA88_SNORM PIPE_FORMAT_L8A8_SNORM
+#define PIPE_FORMAT_AL88_SNORM PIPE_FORMAT_A8L8_SNORM
+#define PIPE_FORMAT_LA88_SRGB PIPE_FORMAT_L8A8_SRGB
+#define PIPE_FORMAT_AL88_SRGB PIPE_FORMAT_A8L8_SRGB
+#define PIPE_FORMAT_LA1616_UNORM PIPE_FORMAT_L16A16_UNORM
+#define PIPE_FORMAT_AL1616_UNORM PIPE_FORMAT_A16L16_UNORM
+#define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_R8G8_UNORM
+#define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_G8R8_UNORM
+#define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_R8G8_SNORM
+#define PIPE_FORMAT_GR88_SNORM PIPE_FORMAT_G8R8_SNORM
+#define PIPE_FORMAT_RG1616_UNORM PIPE_FORMAT_R16G16_UNORM
+#define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_G16R16_UNORM
+#define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_R16G16_SNORM
+#define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_G16R16_SNORM
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+#define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
+#define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
+#define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
+#define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
+#define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
+#define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
+#define PIPE_FORMAT_BGRX8888_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
+#define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
+#define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
+#define PIPE_FORMAT_ABGR8888_SNORM PIPE_FORMAT_R8G8B8A8_SNORM
+#define PIPE_FORMAT_XBGR8888_SNORM PIPE_FORMAT_R8G8B8X8_SNORM
+#define PIPE_FORMAT_RGBA8888_SNORM PIPE_FORMAT_A8B8G8R8_SNORM
+#define PIPE_FORMAT_RGBX8888_SNORM PIPE_FORMAT_X8B8G8R8_SNORM
+#define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_R8G8B8A8_SRGB
+#define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_R8G8B8X8_SRGB
+#define PIPE_FORMAT_ARGB8888_SRGB PIPE_FORMAT_B8G8R8A8_SRGB
+#define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_B8G8R8X8_SRGB
+#define PIPE_FORMAT_BGRA8888_SRGB PIPE_FORMAT_A8R8G8B8_SRGB
+#define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB
+#define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB
+#define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB
+#define PIPE_FORMAT_LA88_UNORM PIPE_FORMAT_A8L8_UNORM
+#define PIPE_FORMAT_AL88_UNORM PIPE_FORMAT_L8A8_UNORM
+#define PIPE_FORMAT_LA88_SNORM PIPE_FORMAT_A8L8_SNORM
+#define PIPE_FORMAT_AL88_SNORM PIPE_FORMAT_L8A8_SNORM
+#define PIPE_FORMAT_LA88_SRGB PIPE_FORMAT_A8L8_SRGB
+#define PIPE_FORMAT_AL88_SRGB PIPE_FORMAT_L8A8_SRGB
+#define PIPE_FORMAT_LA1616_UNORM PIPE_FORMAT_A16L16_UNORM
+#define PIPE_FORMAT_AL1616_UNORM PIPE_FORMAT_L16A16_UNORM
+#define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_G8R8_UNORM
+#define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_R8G8_UNORM
+#define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_G8R8_SNORM
+#define PIPE_FORMAT_GR88_SNORM PIPE_FORMAT_R8G8_SNORM
+#define PIPE_FORMAT_RG1616_UNORM PIPE_FORMAT_G16R16_UNORM
+#define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_R16G16_UNORM
+#define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_G16R16_SNORM
+#define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_R16G16_SNORM
+#endif
+
+enum pipe_video_chroma_format
+{
+ PIPE_VIDEO_CHROMA_FORMAT_400,
+ PIPE_VIDEO_CHROMA_FORMAT_420,
+ PIPE_VIDEO_CHROMA_FORMAT_422,
+ PIPE_VIDEO_CHROMA_FORMAT_444
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mesalib/src/gallium/include/pipe/p_screen.h b/mesalib/src/gallium/include/pipe/p_screen.h
new file mode 100644
index 000000000..ac885068a
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_screen.h
@@ -0,0 +1,238 @@
+/**************************************************************************
+ *
+ * Copyright 2007 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ *
+ * Screen, Adapter or GPU
+ *
+ * These are driver functions/facilities that are context independent.
+ */
+
+
+#ifndef P_SCREEN_H
+#define P_SCREEN_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_video_enums.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** Opaque types */
+struct winsys_handle;
+struct pipe_fence_handle;
+struct pipe_resource;
+struct pipe_surface;
+struct pipe_transfer;
+struct pipe_box;
+
+
+/**
+ * Gallium screen/adapter context. Basically everything
+ * hardware-specific that doesn't actually require a rendering
+ * context.
+ */
+struct pipe_screen {
+ void (*destroy)( struct pipe_screen * );
+
+ const char *(*get_name)( struct pipe_screen * );
+
+ const char *(*get_vendor)( struct pipe_screen * );
+
+ /**
+ * Query an integer-valued capability/parameter/limit
+ * \param param one of PIPE_CAP_x
+ */
+ int (*get_param)( struct pipe_screen *, enum pipe_cap param );
+
+ /**
+ * Query a float-valued capability/parameter/limit
+ * \param param one of PIPE_CAP_x
+ */
+ float (*get_paramf)( struct pipe_screen *, enum pipe_capf param );
+
+ /**
+ * Query a per-shader-stage integer-valued capability/parameter/limit
+ * \param param one of PIPE_CAP_x
+ */
+ int (*get_shader_param)( struct pipe_screen *, unsigned shader, enum pipe_shader_cap param );
+
+ /**
+ * Query an integer-valued capability/parameter/limit for a codec/profile
+ * \param param one of PIPE_VIDEO_CAP_x
+ */
+ int (*get_video_param)( struct pipe_screen *,
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint,
+ enum pipe_video_cap param );
+
+ /**
+ * Query a compute-specific capability/parameter/limit.
+ * \param param one of PIPE_COMPUTE_CAP_x
+ * \param ret pointer to a preallocated buffer that will be
+ * initialized to the parameter value, or NULL.
+ * \return size in bytes of the parameter value that would be
+ * returned.
+ */
+ int (*get_compute_param)(struct pipe_screen *,
+ enum pipe_compute_cap param,
+ void *ret);
+
+ /**
+ * Query a timestamp in nanoseconds. The returned value should match
+ * PIPE_QUERY_TIMESTAMP. This function returns immediately and doesn't
+ * wait for rendering to complete (which cannot be achieved with queries).
+ */
+ uint64_t (*get_timestamp)(struct pipe_screen *);
+
+ struct pipe_context * (*context_create)( struct pipe_screen *,
+ void *priv );
+
+ /**
+ * Check if the given pipe_format is supported as a texture or
+ * drawing surface.
+ * \param bindings bitmask of PIPE_BIND_*
+ */
+ boolean (*is_format_supported)( struct pipe_screen *,
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned sample_count,
+ unsigned bindings );
+
+ /**
+ * Check if the given pipe_format is supported as output for this codec/profile.
+ * \param profile profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN
+ */
+ boolean (*is_video_format_supported)( struct pipe_screen *,
+ enum pipe_format format,
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint );
+
+ /**
+ * Check if we can actually create the given resource (test the dimension,
+ * overall size, etc). Used to implement proxy textures.
+ * \return TRUE if size is OK, FALSE if too large.
+ */
+ boolean (*can_create_resource)(struct pipe_screen *screen,
+ const struct pipe_resource *templat);
+
+ /**
+ * Create a new texture object, using the given template info.
+ */
+ struct pipe_resource * (*resource_create)(struct pipe_screen *,
+ const struct pipe_resource *templat);
+
+ /**
+ * Create a texture from a winsys_handle. The handle is often created in
+ * another process by first creating a pipe texture and then calling
+ * resource_get_handle.
+ */
+ struct pipe_resource * (*resource_from_handle)(struct pipe_screen *,
+ const struct pipe_resource *templat,
+ struct winsys_handle *handle);
+
+ /**
+ * Create a resource from user memory. This maps the user memory into
+ * the device address space.
+ */
+ struct pipe_resource * (*resource_from_user_memory)(struct pipe_screen *,
+ const struct pipe_resource *t,
+ void *user_memory);
+
+ /**
+ * Get a winsys_handle from a texture. Some platforms/winsys requires
+ * that the texture is created with a special usage flag like
+ * DISPLAYTARGET or PRIMARY.
+ */
+ boolean (*resource_get_handle)(struct pipe_screen *,
+ struct pipe_resource *tex,
+ struct winsys_handle *handle);
+
+
+ void (*resource_destroy)(struct pipe_screen *,
+ struct pipe_resource *pt);
+
+
+ /**
+ * Do any special operations to ensure frontbuffer contents are
+ * displayed, eg copy fake frontbuffer.
+ * \param winsys_drawable_handle an opaque handle that the calling context
+ * gets out-of-band
+ * \param subbox an optional sub region to flush
+ */
+ void (*flush_frontbuffer)( struct pipe_screen *screen,
+ struct pipe_resource *resource,
+ unsigned level, unsigned layer,
+ void *winsys_drawable_handle,
+ struct pipe_box *subbox );
+
+ /** Set ptr = fence, with reference counting */
+ void (*fence_reference)( struct pipe_screen *screen,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence );
+
+ /**
+ * Checks whether the fence has been signalled.
+ */
+ boolean (*fence_signalled)( struct pipe_screen *screen,
+ struct pipe_fence_handle *fence );
+
+ /**
+ * Wait for the fence to finish.
+ * \param timeout in nanoseconds (may be PIPE_TIMEOUT_INFINITE).
+ */
+ boolean (*fence_finish)( struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ uint64_t timeout );
+
+ /**
+ * Returns a driver-specific query.
+ *
+ * If \p info is NULL, the number of available queries is returned.
+ * Otherwise, the driver query at the specified \p index is returned
+ * in \p info. The function returns non-zero on success.
+ */
+ int (*get_driver_query_info)(struct pipe_screen *screen,
+ unsigned index,
+ struct pipe_driver_query_info *info);
+
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* P_SCREEN_H */
diff --git a/mesalib/src/gallium/include/pipe/p_shader_tokens.h b/mesalib/src/gallium/include/pipe/p_shader_tokens.h
new file mode 100644
index 000000000..95ac5900f
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_shader_tokens.h
@@ -0,0 +1,720 @@
+/**************************************************************************
+ *
+ * Copyright 2008 VMware, Inc.
+ * Copyright 2009-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef P_SHADER_TOKENS_H
+#define P_SHADER_TOKENS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct tgsi_header
+{
+ unsigned HeaderSize : 8;
+ unsigned BodySize : 24;
+};
+
+#define TGSI_PROCESSOR_FRAGMENT 0
+#define TGSI_PROCESSOR_VERTEX 1
+#define TGSI_PROCESSOR_GEOMETRY 2
+#define TGSI_PROCESSOR_COMPUTE 3
+
+struct tgsi_processor
+{
+ unsigned Processor : 4; /* TGSI_PROCESSOR_ */
+ unsigned Padding : 28;
+};
+
+#define TGSI_TOKEN_TYPE_DECLARATION 0
+#define TGSI_TOKEN_TYPE_IMMEDIATE 1
+#define TGSI_TOKEN_TYPE_INSTRUCTION 2
+#define TGSI_TOKEN_TYPE_PROPERTY 3
+
+struct tgsi_token
+{
+ unsigned Type : 4; /**< TGSI_TOKEN_TYPE_x */
+ unsigned NrTokens : 8; /**< UINT */
+ unsigned Padding : 20;
+};
+
+enum tgsi_file_type {
+ TGSI_FILE_NULL =0,
+ TGSI_FILE_CONSTANT =1,
+ TGSI_FILE_INPUT =2,
+ TGSI_FILE_OUTPUT =3,
+ TGSI_FILE_TEMPORARY =4,
+ TGSI_FILE_SAMPLER =5,
+ TGSI_FILE_ADDRESS =6,
+ TGSI_FILE_IMMEDIATE =7,
+ TGSI_FILE_PREDICATE =8,
+ TGSI_FILE_SYSTEM_VALUE =9,
+ TGSI_FILE_RESOURCE =10,
+ TGSI_FILE_SAMPLER_VIEW =11,
+ TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
+};
+
+
+#define TGSI_WRITEMASK_NONE 0x00
+#define TGSI_WRITEMASK_X 0x01
+#define TGSI_WRITEMASK_Y 0x02
+#define TGSI_WRITEMASK_XY 0x03
+#define TGSI_WRITEMASK_Z 0x04
+#define TGSI_WRITEMASK_XZ 0x05
+#define TGSI_WRITEMASK_YZ 0x06
+#define TGSI_WRITEMASK_XYZ 0x07
+#define TGSI_WRITEMASK_W 0x08
+#define TGSI_WRITEMASK_XW 0x09
+#define TGSI_WRITEMASK_YW 0x0A
+#define TGSI_WRITEMASK_XYW 0x0B
+#define TGSI_WRITEMASK_ZW 0x0C
+#define TGSI_WRITEMASK_XZW 0x0D
+#define TGSI_WRITEMASK_YZW 0x0E
+#define TGSI_WRITEMASK_XYZW 0x0F
+
+#define TGSI_INTERPOLATE_CONSTANT 0
+#define TGSI_INTERPOLATE_LINEAR 1
+#define TGSI_INTERPOLATE_PERSPECTIVE 2
+#define TGSI_INTERPOLATE_COLOR 3 /* special color case for smooth/flat */
+#define TGSI_INTERPOLATE_COUNT 4
+
+#define TGSI_INTERPOLATE_LOC_CENTER 0
+#define TGSI_INTERPOLATE_LOC_CENTROID 1
+#define TGSI_INTERPOLATE_LOC_SAMPLE 2
+#define TGSI_INTERPOLATE_LOC_COUNT 3
+
+#define TGSI_CYLINDRICAL_WRAP_X (1 << 0)
+#define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
+#define TGSI_CYLINDRICAL_WRAP_Z (1 << 2)
+#define TGSI_CYLINDRICAL_WRAP_W (1 << 3)
+
+struct tgsi_declaration
+{
+ unsigned Type : 4; /**< TGSI_TOKEN_TYPE_DECLARATION */
+ unsigned NrTokens : 8; /**< UINT */
+ unsigned File : 4; /**< one of TGSI_FILE_x */
+ unsigned UsageMask : 4; /**< bitmask of TGSI_WRITEMASK_x flags */
+ unsigned Dimension : 1; /**< any extra dimension info? */
+ unsigned Semantic : 1; /**< BOOL, any semantic info? */
+ unsigned Interpolate : 1; /**< any interpolation info? */
+ unsigned Invariant : 1; /**< invariant optimization? */
+ unsigned Local : 1; /**< optimize as subroutine local variable? */
+ unsigned Array : 1; /**< extra array info? */
+ unsigned Padding : 6;
+};
+
+struct tgsi_declaration_range
+{
+ unsigned First : 16; /**< UINT */
+ unsigned Last : 16; /**< UINT */
+};
+
+struct tgsi_declaration_dimension
+{
+ unsigned Index2D:16; /**< UINT */
+ unsigned Padding:16;
+};
+
+struct tgsi_declaration_interp
+{
+ unsigned Interpolate : 4; /**< one of TGSI_INTERPOLATE_x */
+ unsigned Location : 2; /**< one of TGSI_INTERPOLATE_LOC_x */
+ unsigned CylindricalWrap:4; /**< TGSI_CYLINDRICAL_WRAP_x flags */
+ unsigned Padding : 22;
+};
+
+#define TGSI_SEMANTIC_POSITION 0
+#define TGSI_SEMANTIC_COLOR 1
+#define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
+#define TGSI_SEMANTIC_FOG 3
+#define TGSI_SEMANTIC_PSIZE 4
+#define TGSI_SEMANTIC_GENERIC 5
+#define TGSI_SEMANTIC_NORMAL 6
+#define TGSI_SEMANTIC_FACE 7
+#define TGSI_SEMANTIC_EDGEFLAG 8
+#define TGSI_SEMANTIC_PRIMID 9
+#define TGSI_SEMANTIC_INSTANCEID 10 /**< doesn't include start_instance */
+#define TGSI_SEMANTIC_VERTEXID 11
+#define TGSI_SEMANTIC_STENCIL 12
+#define TGSI_SEMANTIC_CLIPDIST 13
+#define TGSI_SEMANTIC_CLIPVERTEX 14
+#define TGSI_SEMANTIC_GRID_SIZE 15 /**< grid size in blocks */
+#define TGSI_SEMANTIC_BLOCK_ID 16 /**< id of the current block */
+#define TGSI_SEMANTIC_BLOCK_SIZE 17 /**< block size in threads */
+#define TGSI_SEMANTIC_THREAD_ID 18 /**< block-relative id of the current thread */
+#define TGSI_SEMANTIC_TEXCOORD 19 /**< texture or sprite coordinates */
+#define TGSI_SEMANTIC_PCOORD 20 /**< point sprite coordinate */
+#define TGSI_SEMANTIC_VIEWPORT_INDEX 21 /**< viewport index */
+#define TGSI_SEMANTIC_LAYER 22 /**< layer (rendertarget index) */
+#define TGSI_SEMANTIC_CULLDIST 23
+#define TGSI_SEMANTIC_SAMPLEID 24
+#define TGSI_SEMANTIC_SAMPLEPOS 25
+#define TGSI_SEMANTIC_SAMPLEMASK 26
+#define TGSI_SEMANTIC_INVOCATIONID 27
+#define TGSI_SEMANTIC_VERTEXID_NOBASE 28
+#define TGSI_SEMANTIC_BASEVERTEX 29
+#define TGSI_SEMANTIC_COUNT 30 /**< number of semantic values */
+
+struct tgsi_declaration_semantic
+{
+ unsigned Name : 8; /**< one of TGSI_SEMANTIC_x */
+ unsigned Index : 16; /**< UINT */
+ unsigned Padding : 8;
+};
+
+struct tgsi_declaration_resource {
+ unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */
+ unsigned Raw : 1;
+ unsigned Writable : 1;
+ unsigned Padding : 22;
+};
+
+enum tgsi_return_type {
+ TGSI_RETURN_TYPE_UNORM = 0,
+ TGSI_RETURN_TYPE_SNORM,
+ TGSI_RETURN_TYPE_SINT,
+ TGSI_RETURN_TYPE_UINT,
+ TGSI_RETURN_TYPE_FLOAT,
+ TGSI_RETURN_TYPE_COUNT
+};
+
+struct tgsi_declaration_sampler_view {
+ unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */
+ unsigned ReturnTypeX : 6; /**< one of enum tgsi_return_type */
+ unsigned ReturnTypeY : 6; /**< one of enum tgsi_return_type */
+ unsigned ReturnTypeZ : 6; /**< one of enum tgsi_return_type */
+ unsigned ReturnTypeW : 6; /**< one of enum tgsi_return_type */
+};
+
+struct tgsi_declaration_array {
+ unsigned ArrayID : 10;
+ unsigned Padding : 22;
+};
+
+/*
+ * Special resources that don't need to be declared. They map to the
+ * GLOBAL/LOCAL/PRIVATE/INPUT compute memory spaces.
+ */
+#define TGSI_RESOURCE_GLOBAL 0x7fff
+#define TGSI_RESOURCE_LOCAL 0x7ffe
+#define TGSI_RESOURCE_PRIVATE 0x7ffd
+#define TGSI_RESOURCE_INPUT 0x7ffc
+
+#define TGSI_IMM_FLOAT32 0
+#define TGSI_IMM_UINT32 1
+#define TGSI_IMM_INT32 2
+#define TGSI_IMM_FLOAT64 3
+
+struct tgsi_immediate
+{
+ unsigned Type : 4; /**< TGSI_TOKEN_TYPE_IMMEDIATE */
+ unsigned NrTokens : 14; /**< UINT */
+ unsigned DataType : 4; /**< one of TGSI_IMM_x */
+ unsigned Padding : 10;
+};
+
+union tgsi_immediate_data
+{
+ float Float;
+ unsigned Uint;
+ int Int;
+};
+
+#define TGSI_PROPERTY_GS_INPUT_PRIM 0
+#define TGSI_PROPERTY_GS_OUTPUT_PRIM 1
+#define TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES 2
+#define TGSI_PROPERTY_FS_COORD_ORIGIN 3
+#define TGSI_PROPERTY_FS_COORD_PIXEL_CENTER 4
+#define TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS 5
+#define TGSI_PROPERTY_FS_DEPTH_LAYOUT 6
+#define TGSI_PROPERTY_VS_PROHIBIT_UCPS 7
+#define TGSI_PROPERTY_GS_INVOCATIONS 8
+#define TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION 9
+#define TGSI_PROPERTY_COUNT 10
+
+struct tgsi_property {
+ unsigned Type : 4; /**< TGSI_TOKEN_TYPE_PROPERTY */
+ unsigned NrTokens : 8; /**< UINT */
+ unsigned PropertyName : 8; /**< one of TGSI_PROPERTY */
+ unsigned Padding : 12;
+};
+
+#define TGSI_FS_COORD_ORIGIN_UPPER_LEFT 0
+#define TGSI_FS_COORD_ORIGIN_LOWER_LEFT 1
+
+#define TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 0
+#define TGSI_FS_COORD_PIXEL_CENTER_INTEGER 1
+
+#define TGSI_FS_DEPTH_LAYOUT_NONE 0
+#define TGSI_FS_DEPTH_LAYOUT_ANY 1
+#define TGSI_FS_DEPTH_LAYOUT_GREATER 2
+#define TGSI_FS_DEPTH_LAYOUT_LESS 3
+#define TGSI_FS_DEPTH_LAYOUT_UNCHANGED 4
+
+
+struct tgsi_property_data {
+ unsigned Data;
+};
+
+/* TGSI opcodes.
+ *
+ * For more information on semantics of opcodes and
+ * which APIs are known to use which opcodes, see
+ * gallium/docs/source/tgsi.rst
+ */
+#define TGSI_OPCODE_ARL 0
+#define TGSI_OPCODE_MOV 1
+#define TGSI_OPCODE_LIT 2
+#define TGSI_OPCODE_RCP 3
+#define TGSI_OPCODE_RSQ 4
+#define TGSI_OPCODE_EXP 5
+#define TGSI_OPCODE_LOG 6
+#define TGSI_OPCODE_MUL 7
+#define TGSI_OPCODE_ADD 8
+#define TGSI_OPCODE_DP3 9
+#define TGSI_OPCODE_DP4 10
+#define TGSI_OPCODE_DST 11
+#define TGSI_OPCODE_MIN 12
+#define TGSI_OPCODE_MAX 13
+#define TGSI_OPCODE_SLT 14
+#define TGSI_OPCODE_SGE 15
+#define TGSI_OPCODE_MAD 16
+#define TGSI_OPCODE_SUB 17
+#define TGSI_OPCODE_LRP 18
+ /* gap */
+#define TGSI_OPCODE_SQRT 20
+#define TGSI_OPCODE_DP2A 21
+ /* gap */
+#define TGSI_OPCODE_FRC 24
+#define TGSI_OPCODE_CLAMP 25
+#define TGSI_OPCODE_FLR 26
+#define TGSI_OPCODE_ROUND 27
+#define TGSI_OPCODE_EX2 28
+#define TGSI_OPCODE_LG2 29
+#define TGSI_OPCODE_POW 30
+#define TGSI_OPCODE_XPD 31
+ /* gap */
+#define TGSI_OPCODE_ABS 33
+ /* gap */
+#define TGSI_OPCODE_DPH 35
+#define TGSI_OPCODE_COS 36
+#define TGSI_OPCODE_DDX 37
+#define TGSI_OPCODE_DDY 38
+#define TGSI_OPCODE_KILL 39 /* unconditional */
+#define TGSI_OPCODE_PK2H 40
+#define TGSI_OPCODE_PK2US 41
+#define TGSI_OPCODE_PK4B 42
+#define TGSI_OPCODE_PK4UB 43
+ /* gap */
+#define TGSI_OPCODE_SEQ 45
+ /* gap */
+#define TGSI_OPCODE_SGT 47
+#define TGSI_OPCODE_SIN 48
+#define TGSI_OPCODE_SLE 49
+#define TGSI_OPCODE_SNE 50
+ /* gap */
+#define TGSI_OPCODE_TEX 52
+#define TGSI_OPCODE_TXD 53
+#define TGSI_OPCODE_TXP 54
+#define TGSI_OPCODE_UP2H 55
+#define TGSI_OPCODE_UP2US 56
+#define TGSI_OPCODE_UP4B 57
+#define TGSI_OPCODE_UP4UB 58
+ /* gap */
+#define TGSI_OPCODE_ARR 61
+ /* gap */
+#define TGSI_OPCODE_CAL 63
+#define TGSI_OPCODE_RET 64
+#define TGSI_OPCODE_SSG 65 /* SGN */
+#define TGSI_OPCODE_CMP 66
+#define TGSI_OPCODE_SCS 67
+#define TGSI_OPCODE_TXB 68
+ /* gap */
+#define TGSI_OPCODE_DIV 70
+#define TGSI_OPCODE_DP2 71
+#define TGSI_OPCODE_TXL 72
+#define TGSI_OPCODE_BRK 73
+#define TGSI_OPCODE_IF 74
+#define TGSI_OPCODE_UIF 75
+#define TGSI_OPCODE_ELSE 77
+#define TGSI_OPCODE_ENDIF 78
+
+#define TGSI_OPCODE_DDX_FINE 79
+#define TGSI_OPCODE_DDY_FINE 80
+
+#define TGSI_OPCODE_PUSHA 81
+#define TGSI_OPCODE_POPA 82
+#define TGSI_OPCODE_CEIL 83
+#define TGSI_OPCODE_I2F 84
+#define TGSI_OPCODE_NOT 85
+#define TGSI_OPCODE_TRUNC 86
+#define TGSI_OPCODE_SHL 87
+ /* gap */
+#define TGSI_OPCODE_AND 89
+#define TGSI_OPCODE_OR 90
+#define TGSI_OPCODE_MOD 91
+#define TGSI_OPCODE_XOR 92
+#define TGSI_OPCODE_SAD 93
+#define TGSI_OPCODE_TXF 94
+#define TGSI_OPCODE_TXQ 95
+#define TGSI_OPCODE_CONT 96
+#define TGSI_OPCODE_EMIT 97
+#define TGSI_OPCODE_ENDPRIM 98
+#define TGSI_OPCODE_BGNLOOP 99
+#define TGSI_OPCODE_BGNSUB 100
+#define TGSI_OPCODE_ENDLOOP 101
+#define TGSI_OPCODE_ENDSUB 102
+#define TGSI_OPCODE_TXQ_LZ 103 /* TXQ for mipmap level 0 */
+ /* gap */
+#define TGSI_OPCODE_NOP 107
+
+#define TGSI_OPCODE_FSEQ 108
+#define TGSI_OPCODE_FSGE 109
+#define TGSI_OPCODE_FSLT 110
+#define TGSI_OPCODE_FSNE 111
+
+ /* gap */
+#define TGSI_OPCODE_CALLNZ 113
+ /* gap */
+#define TGSI_OPCODE_BREAKC 115
+#define TGSI_OPCODE_KILL_IF 116 /* conditional kill */
+#define TGSI_OPCODE_END 117 /* aka HALT */
+ /* gap */
+#define TGSI_OPCODE_F2I 119
+#define TGSI_OPCODE_IDIV 120
+#define TGSI_OPCODE_IMAX 121
+#define TGSI_OPCODE_IMIN 122
+#define TGSI_OPCODE_INEG 123
+#define TGSI_OPCODE_ISGE 124
+#define TGSI_OPCODE_ISHR 125
+#define TGSI_OPCODE_ISLT 126
+#define TGSI_OPCODE_F2U 127
+#define TGSI_OPCODE_U2F 128
+#define TGSI_OPCODE_UADD 129
+#define TGSI_OPCODE_UDIV 130
+#define TGSI_OPCODE_UMAD 131
+#define TGSI_OPCODE_UMAX 132
+#define TGSI_OPCODE_UMIN 133
+#define TGSI_OPCODE_UMOD 134
+#define TGSI_OPCODE_UMUL 135
+#define TGSI_OPCODE_USEQ 136
+#define TGSI_OPCODE_USGE 137
+#define TGSI_OPCODE_USHR 138
+#define TGSI_OPCODE_USLT 139
+#define TGSI_OPCODE_USNE 140
+#define TGSI_OPCODE_SWITCH 141
+#define TGSI_OPCODE_CASE 142
+#define TGSI_OPCODE_DEFAULT 143
+#define TGSI_OPCODE_ENDSWITCH 144
+
+/* resource related opcodes */
+#define TGSI_OPCODE_SAMPLE 145
+#define TGSI_OPCODE_SAMPLE_I 146
+#define TGSI_OPCODE_SAMPLE_I_MS 147
+#define TGSI_OPCODE_SAMPLE_B 148
+#define TGSI_OPCODE_SAMPLE_C 149
+#define TGSI_OPCODE_SAMPLE_C_LZ 150
+#define TGSI_OPCODE_SAMPLE_D 151
+#define TGSI_OPCODE_SAMPLE_L 152
+#define TGSI_OPCODE_GATHER4 153
+#define TGSI_OPCODE_SVIEWINFO 154
+#define TGSI_OPCODE_SAMPLE_POS 155
+#define TGSI_OPCODE_SAMPLE_INFO 156
+
+#define TGSI_OPCODE_UARL 157
+#define TGSI_OPCODE_UCMP 158
+#define TGSI_OPCODE_IABS 159
+#define TGSI_OPCODE_ISSG 160
+
+#define TGSI_OPCODE_LOAD 161
+#define TGSI_OPCODE_STORE 162
+
+#define TGSI_OPCODE_MFENCE 163
+#define TGSI_OPCODE_LFENCE 164
+#define TGSI_OPCODE_SFENCE 165
+#define TGSI_OPCODE_BARRIER 166
+
+#define TGSI_OPCODE_ATOMUADD 167
+#define TGSI_OPCODE_ATOMXCHG 168
+#define TGSI_OPCODE_ATOMCAS 169
+#define TGSI_OPCODE_ATOMAND 170
+#define TGSI_OPCODE_ATOMOR 171
+#define TGSI_OPCODE_ATOMXOR 172
+#define TGSI_OPCODE_ATOMUMIN 173
+#define TGSI_OPCODE_ATOMUMAX 174
+#define TGSI_OPCODE_ATOMIMIN 175
+#define TGSI_OPCODE_ATOMIMAX 176
+
+/* to be used for shadow cube map compares */
+#define TGSI_OPCODE_TEX2 177
+#define TGSI_OPCODE_TXB2 178
+#define TGSI_OPCODE_TXL2 179
+
+#define TGSI_OPCODE_IMUL_HI 180
+#define TGSI_OPCODE_UMUL_HI 181
+
+#define TGSI_OPCODE_TG4 182
+
+#define TGSI_OPCODE_LODQ 183
+
+#define TGSI_OPCODE_IBFE 184
+#define TGSI_OPCODE_UBFE 185
+#define TGSI_OPCODE_BFI 186
+#define TGSI_OPCODE_BREV 187
+#define TGSI_OPCODE_POPC 188
+#define TGSI_OPCODE_LSB 189
+#define TGSI_OPCODE_IMSB 190
+#define TGSI_OPCODE_UMSB 191
+
+#define TGSI_OPCODE_INTERP_CENTROID 192
+#define TGSI_OPCODE_INTERP_SAMPLE 193
+#define TGSI_OPCODE_INTERP_OFFSET 194
+
+/* sm5 marked opcodes are supported in D3D11 optionally - also DMOV, DMOVC */
+#define TGSI_OPCODE_F2D 195 /* SM5 */
+#define TGSI_OPCODE_D2F 196
+#define TGSI_OPCODE_DABS 197
+#define TGSI_OPCODE_DNEG 198 /* SM5 */
+#define TGSI_OPCODE_DADD 199 /* SM5 */
+#define TGSI_OPCODE_DMUL 200 /* SM5 */
+#define TGSI_OPCODE_DMAX 201 /* SM5 */
+#define TGSI_OPCODE_DMIN 202 /* SM5 */
+#define TGSI_OPCODE_DSLT 203 /* SM5 */
+#define TGSI_OPCODE_DSGE 204 /* SM5 */
+#define TGSI_OPCODE_DSEQ 205 /* SM5 */
+#define TGSI_OPCODE_DSNE 206 /* SM5 */
+#define TGSI_OPCODE_DRCP 207 /* eg, cayman */
+#define TGSI_OPCODE_DSQRT 208 /* eg, cayman also has DRSQ */
+#define TGSI_OPCODE_DMAD 209 /* DFMA? */
+#define TGSI_OPCODE_DFRAC 210 /* eg, cayman */
+#define TGSI_OPCODE_DLDEXP 211 /* eg, cayman */
+#define TGSI_OPCODE_DFRACEXP 212 /* eg, cayman */
+#define TGSI_OPCODE_D2I 213
+#define TGSI_OPCODE_I2D 214
+#define TGSI_OPCODE_D2U 215
+#define TGSI_OPCODE_U2D 216
+#define TGSI_OPCODE_DRSQ 217 /* eg, cayman also has DRSQ */
+#define TGSI_OPCODE_DTRUNC 218 /* nvc0 */
+#define TGSI_OPCODE_DCEIL 219 /* nvc0 */
+#define TGSI_OPCODE_DFLR 220 /* nvc0 */
+#define TGSI_OPCODE_DROUND 221 /* nvc0 */
+#define TGSI_OPCODE_DSSG 222
+#define TGSI_OPCODE_LAST 223
+
+#define TGSI_SAT_NONE 0 /* do not saturate */
+#define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
+#define TGSI_SAT_MINUS_PLUS_ONE 2 /* clamp to [-1,1] */
+
+/**
+ * Opcode is the operation code to execute. A given operation defines the
+ * semantics how the source registers (if any) are interpreted and what is
+ * written to the destination registers (if any) as a result of execution.
+ *
+ * NumDstRegs and NumSrcRegs is the number of destination and source registers,
+ * respectively. For a given operation code, those numbers are fixed and are
+ * present here only for convenience.
+ *
+ * If Predicate is TRUE, tgsi_instruction_predicate token immediately follows.
+ *
+ * Saturate controls how are final results in destination registers modified.
+ */
+
+struct tgsi_instruction
+{
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
+ unsigned NrTokens : 8; /* UINT */
+ unsigned Opcode : 8; /* TGSI_OPCODE_ */
+ unsigned Saturate : 2; /* TGSI_SAT_ */
+ unsigned NumDstRegs : 2; /* UINT */
+ unsigned NumSrcRegs : 4; /* UINT */
+ unsigned Predicate : 1; /* BOOL */
+ unsigned Label : 1;
+ unsigned Texture : 1;
+ unsigned Padding : 1;
+};
+
+/*
+ * If tgsi_instruction::Label is TRUE, tgsi_instruction_label follows.
+ *
+ * If tgsi_instruction::Texture is TRUE, tgsi_instruction_texture follows.
+ * if texture instruction has a number of offsets,
+ * then tgsi_instruction::Texture::NumOffset of tgsi_texture_offset follow.
+ *
+ * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
+ *
+ * Then, tgsi_instruction::NumSrcRegs of tgsi_src_register follow.
+ *
+ * tgsi_instruction::NrTokens contains the total number of words that make the
+ * instruction, including the instruction word.
+ */
+
+#define TGSI_SWIZZLE_X 0
+#define TGSI_SWIZZLE_Y 1
+#define TGSI_SWIZZLE_Z 2
+#define TGSI_SWIZZLE_W 3
+
+struct tgsi_instruction_label
+{
+ unsigned Label : 24; /* UINT */
+ unsigned Padding : 8;
+};
+
+#define TGSI_TEXTURE_BUFFER 0
+#define TGSI_TEXTURE_1D 1
+#define TGSI_TEXTURE_2D 2
+#define TGSI_TEXTURE_3D 3
+#define TGSI_TEXTURE_CUBE 4
+#define TGSI_TEXTURE_RECT 5
+#define TGSI_TEXTURE_SHADOW1D 6
+#define TGSI_TEXTURE_SHADOW2D 7
+#define TGSI_TEXTURE_SHADOWRECT 8
+#define TGSI_TEXTURE_1D_ARRAY 9
+#define TGSI_TEXTURE_2D_ARRAY 10
+#define TGSI_TEXTURE_SHADOW1D_ARRAY 11
+#define TGSI_TEXTURE_SHADOW2D_ARRAY 12
+#define TGSI_TEXTURE_SHADOWCUBE 13
+#define TGSI_TEXTURE_2D_MSAA 14
+#define TGSI_TEXTURE_2D_ARRAY_MSAA 15
+#define TGSI_TEXTURE_CUBE_ARRAY 16
+#define TGSI_TEXTURE_SHADOWCUBE_ARRAY 17
+#define TGSI_TEXTURE_UNKNOWN 18
+#define TGSI_TEXTURE_COUNT 19
+
+struct tgsi_instruction_texture
+{
+ unsigned Texture : 8; /* TGSI_TEXTURE_ */
+ unsigned NumOffsets : 4;
+ unsigned Padding : 20;
+};
+
+/* for texture offsets in GLSL and DirectX.
+ * Generally these always come from TGSI_FILE_IMMEDIATE,
+ * however DX11 appears to have the capability to do
+ * non-constant texture offsets.
+ */
+struct tgsi_texture_offset
+{
+ int Index : 16;
+ unsigned File : 4; /**< one of TGSI_FILE_x */
+ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */
+ unsigned Padding : 6;
+};
+
+/*
+ * For SM3, the following constraint applies.
+ * - Swizzle is either set to identity or replicate.
+ */
+struct tgsi_instruction_predicate
+{
+ int Index : 16; /* SINT */
+ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_x */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Padding : 7;
+};
+
+/**
+ * File specifies the register array to access.
+ *
+ * Index specifies the element number of a register in the register file.
+ *
+ * If Indirect is TRUE, Index should be offset by the X component of the indirect
+ * register that follows. The register can be now fetched into local storage
+ * for further processing.
+ *
+ * If Negate is TRUE, all components of the fetched register are negated.
+ *
+ * The fetched register components are swizzled according to SwizzleX, SwizzleY,
+ * SwizzleZ and SwizzleW.
+ *
+ */
+
+struct tgsi_src_register
+{
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned Absolute : 1; /* BOOL */
+ unsigned Negate : 1; /* BOOL */
+};
+
+/**
+ * If tgsi_src_register::Indirect is TRUE, tgsi_ind_register follows.
+ *
+ * File, Index and Swizzle are handled the same as in tgsi_src_register.
+ *
+ * If ArrayID is zero the whole register file might be is indirectly addressed,
+ * if not only the Declaration with this ArrayID is accessed by this operand.
+ *
+ */
+
+struct tgsi_ind_register
+{
+ unsigned File : 4; /* TGSI_FILE_ */
+ int Index : 16; /* SINT */
+ unsigned Swizzle : 2; /* TGSI_SWIZZLE_ */
+ unsigned ArrayID : 10; /* UINT */
+};
+
+/**
+ * If tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
+ */
+
+struct tgsi_dimension
+{
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ unsigned Padding : 14;
+ int Index : 16; /* SINT */
+};
+
+struct tgsi_dst_register
+{
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned Padding : 6;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* P_SHADER_TOKENS_H */
diff --git a/mesalib/src/gallium/include/pipe/p_state.h b/mesalib/src/gallium/include/pipe/p_state.h
new file mode 100644
index 000000000..e15860c4c
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_state.h
@@ -0,0 +1,644 @@
+/**************************************************************************
+ *
+ * Copyright 2007 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+/**
+ * @file
+ *
+ * Abstract graphics pipe state objects.
+ *
+ * Basic notes:
+ * 1. Want compact representations, so we use bitfields.
+ * 2. Put bitfields before other (GLfloat) fields.
+ */
+
+
+#ifndef PIPE_STATE_H
+#define PIPE_STATE_H
+
+#include "p_compiler.h"
+#include "p_defines.h"
+#include "p_format.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Implementation limits
+ */
+#define PIPE_MAX_ATTRIBS 32
+#define PIPE_MAX_CLIP_PLANES 8
+#define PIPE_MAX_COLOR_BUFS 8
+#define PIPE_MAX_CONSTANT_BUFFERS 32
+#define PIPE_MAX_SAMPLERS 18 /* 16 public + 2 driver internal */
+#define PIPE_MAX_SHADER_INPUTS 32
+#define PIPE_MAX_SHADER_OUTPUTS 48 /* 32 GENERICs + POS, PSIZE, FOG, etc. */
+#define PIPE_MAX_SHADER_SAMPLER_VIEWS 32
+#define PIPE_MAX_SHADER_RESOURCES 32
+#define PIPE_MAX_TEXTURE_LEVELS 16
+#define PIPE_MAX_SO_BUFFERS 4
+#define PIPE_MAX_SO_OUTPUTS 64
+#define PIPE_MAX_VIEWPORTS 16
+#define PIPE_MAX_CLIP_OR_CULL_DISTANCE_COUNT 8
+#define PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT 2
+
+
+struct pipe_reference
+{
+ int32_t count; /* atomic */
+};
+
+
+
+/**
+ * Primitive (point/line/tri) rasterization info
+ */
+struct pipe_rasterizer_state
+{
+ unsigned flatshade:1;
+ unsigned light_twoside:1;
+ unsigned clamp_vertex_color:1;
+ unsigned clamp_fragment_color:1;
+ unsigned front_ccw:1;
+ unsigned cull_face:2; /**< PIPE_FACE_x */
+ unsigned fill_front:2; /**< PIPE_POLYGON_MODE_x */
+ unsigned fill_back:2; /**< PIPE_POLYGON_MODE_x */
+ unsigned offset_point:1;
+ unsigned offset_line:1;
+ unsigned offset_tri:1;
+ unsigned scissor:1;
+ unsigned poly_smooth:1;
+ unsigned poly_stipple_enable:1;
+ unsigned point_smooth:1;
+ unsigned sprite_coord_mode:1; /**< PIPE_SPRITE_COORD_ */
+ unsigned point_quad_rasterization:1; /** points rasterized as quads or points */
+ unsigned point_tri_clip:1; /** large points clipped as tris or points */
+ unsigned point_size_per_vertex:1; /**< size computed in vertex shader */
+ unsigned multisample:1; /* XXX maybe more ms state in future */
+ unsigned line_smooth:1;
+ unsigned line_stipple_enable:1;
+ unsigned line_last_pixel:1;
+
+ /**
+ * Use the first vertex of a primitive as the provoking vertex for
+ * flat shading.
+ */
+ unsigned flatshade_first:1;
+
+ unsigned half_pixel_center:1;
+ unsigned bottom_edge_rule:1;
+
+ /**
+ * When true, rasterization is disabled and no pixels are written.
+ * This only makes sense with the Stream Out functionality.
+ */
+ unsigned rasterizer_discard:1;
+
+ /**
+ * When false, depth clipping is disabled and the depth value will be
+ * clamped later at the per-pixel level before depth testing.
+ * This depends on PIPE_CAP_DEPTH_CLIP_DISABLE.
+ */
+ unsigned depth_clip:1;
+
+ /**
+ * When true clip space in the z axis goes from [0..1] (D3D). When false
+ * [-1, 1] (GL).
+ *
+ * NOTE: D3D will always use depth clamping.
+ */
+ unsigned clip_halfz:1;
+
+ /**
+ * Enable bits for clipping half-spaces.
+ * This applies to both user clip planes and shader clip distances.
+ * Note that if the bound shader exports any clip distances, these
+ * replace all user clip planes, and clip half-spaces enabled here
+ * but not written by the shader count as disabled.
+ */
+ unsigned clip_plane_enable:PIPE_MAX_CLIP_PLANES;
+
+ unsigned line_stipple_factor:8; /**< [1..256] actually */
+ unsigned line_stipple_pattern:16;
+
+ uint32_t sprite_coord_enable; /* referring to 32 TEXCOORD/GENERIC inputs */
+
+ float line_width;
+ float point_size; /**< used when no per-vertex size */
+ float offset_units;
+ float offset_scale;
+ float offset_clamp;
+};
+
+
+struct pipe_poly_stipple
+{
+ unsigned stipple[32];
+};
+
+
+struct pipe_viewport_state
+{
+ float scale[3];
+ float translate[3];
+};
+
+
+struct pipe_scissor_state
+{
+ unsigned minx:16;
+ unsigned miny:16;
+ unsigned maxx:16;
+ unsigned maxy:16;
+};
+
+
+struct pipe_clip_state
+{
+ float ucp[PIPE_MAX_CLIP_PLANES][4];
+};
+
+
+/**
+ * Stream output for vertex transform feedback.
+ */
+struct pipe_stream_output_info
+{
+ unsigned num_outputs;
+ /** stride for an entire vertex for each buffer in dwords */
+ unsigned stride[PIPE_MAX_SO_BUFFERS];
+
+ /**
+ * Array of stream outputs, in the order they are to be written in.
+ * Selected components are tightly packed into the output buffer.
+ */
+ struct {
+ unsigned register_index:8; /**< 0 to PIPE_MAX_SHADER_OUTPUTS */
+ unsigned start_component:2; /** 0 to 3 */
+ unsigned num_components:3; /** 1 to 4 */
+ unsigned output_buffer:3; /**< 0 to PIPE_MAX_SO_BUFFERS */
+ unsigned dst_offset:16; /**< offset into the buffer in dwords */
+ unsigned stream:2; /**< 0 to 3 */
+ } output[PIPE_MAX_SO_OUTPUTS];
+};
+
+
+struct pipe_shader_state
+{
+ const struct tgsi_token *tokens;
+ struct pipe_stream_output_info stream_output;
+};
+
+
+struct pipe_depth_state
+{
+ unsigned enabled:1; /**< depth test enabled? */
+ unsigned writemask:1; /**< allow depth buffer writes? */
+ unsigned func:3; /**< depth test func (PIPE_FUNC_x) */
+};
+
+
+struct pipe_stencil_state
+{
+ unsigned enabled:1; /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */
+ unsigned func:3; /**< PIPE_FUNC_x */
+ unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */
+ unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */
+ unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */
+ unsigned valuemask:8;
+ unsigned writemask:8;
+};
+
+
+struct pipe_alpha_state
+{
+ unsigned enabled:1;
+ unsigned func:3; /**< PIPE_FUNC_x */
+ float ref_value; /**< reference value */
+};
+
+
+struct pipe_depth_stencil_alpha_state
+{
+ struct pipe_depth_state depth;
+ struct pipe_stencil_state stencil[2]; /**< [0] = front, [1] = back */
+ struct pipe_alpha_state alpha;
+};
+
+
+struct pipe_rt_blend_state
+{
+ unsigned blend_enable:1;
+
+ unsigned rgb_func:3; /**< PIPE_BLEND_x */
+ unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */
+ unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
+
+ unsigned alpha_func:3; /**< PIPE_BLEND_x */
+ unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */
+ unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
+
+ unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */
+};
+
+struct pipe_blend_state
+{
+ unsigned independent_blend_enable:1;
+ unsigned logicop_enable:1;
+ unsigned logicop_func:4; /**< PIPE_LOGICOP_x */
+ unsigned dither:1;
+ unsigned alpha_to_coverage:1;
+ unsigned alpha_to_one:1;
+ struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS];
+};
+
+
+struct pipe_blend_color
+{
+ float color[4];
+};
+
+struct pipe_stencil_ref
+{
+ ubyte ref_value[2];
+};
+
+struct pipe_framebuffer_state
+{
+ unsigned width, height;
+
+ /** multiple color buffers for multiple render targets */
+ unsigned nr_cbufs;
+ struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
+
+ struct pipe_surface *zsbuf; /**< Z/stencil buffer */
+};
+
+
+/**
+ * Texture sampler state.
+ */
+struct pipe_sampler_state
+{
+ unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */
+ unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */
+ unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */
+ unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */
+ unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */
+ unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */
+ unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */
+ unsigned compare_func:3; /**< PIPE_FUNC_x */
+ unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */
+ unsigned max_anisotropy:6;
+ unsigned seamless_cube_map:1;
+ float lod_bias; /**< LOD/lambda bias */
+ float min_lod, max_lod; /**< LOD clamp range, after bias */
+ union pipe_color_union border_color;
+};
+
+
+/**
+ * A view into a texture that can be bound to a color render target /
+ * depth stencil attachment point.
+ */
+struct pipe_surface
+{
+ struct pipe_reference reference;
+ struct pipe_resource *texture; /**< resource into which this is a view */
+ struct pipe_context *context; /**< context this surface belongs to */
+ enum pipe_format format;
+
+ /* XXX width/height should be removed */
+ unsigned width; /**< logical width in pixels */
+ unsigned height; /**< logical height in pixels */
+
+ unsigned writable:1; /**< writable shader resource */
+
+ union {
+ struct {
+ unsigned level;
+ unsigned first_layer:16;
+ unsigned last_layer:16;
+ } tex;
+ struct {
+ unsigned first_element;
+ unsigned last_element;
+ } buf;
+ } u;
+};
+
+
+/**
+ * A view into a texture that can be bound to a shader stage.
+ */
+struct pipe_sampler_view
+{
+ struct pipe_reference reference;
+ enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
+ enum pipe_format format; /**< typed PIPE_FORMAT_x */
+ struct pipe_resource *texture; /**< texture into which this is a view */
+ struct pipe_context *context; /**< context this view belongs to */
+ union {
+ struct {
+ unsigned first_layer:16; /**< first layer to use for array textures */
+ unsigned last_layer:16; /**< last layer to use for array textures */
+ unsigned first_level:8; /**< first mipmap level to use */
+ unsigned last_level:8; /**< last mipmap level to use */
+ } tex;
+ struct {
+ unsigned first_element;
+ unsigned last_element;
+ } buf;
+ } u;
+ unsigned swizzle_r:3; /**< PIPE_SWIZZLE_x for red component */
+ unsigned swizzle_g:3; /**< PIPE_SWIZZLE_x for green component */
+ unsigned swizzle_b:3; /**< PIPE_SWIZZLE_x for blue component */
+ unsigned swizzle_a:3; /**< PIPE_SWIZZLE_x for alpha component */
+};
+
+
+/**
+ * Subregion of 1D/2D/3D image resource.
+ */
+struct pipe_box
+{
+ int x;
+ int y;
+ int z;
+ int width;
+ int height;
+ int depth;
+};
+
+
+/**
+ * A memory object/resource such as a vertex buffer or texture.
+ */
+struct pipe_resource
+{
+ struct pipe_reference reference;
+ struct pipe_screen *screen; /**< screen that this texture belongs to */
+ enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
+ enum pipe_format format; /**< PIPE_FORMAT_x */
+
+ unsigned width0;
+ unsigned height0;
+ unsigned depth0;
+ unsigned array_size;
+
+ unsigned last_level:8; /**< Index of last mipmap level present/defined */
+ unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */
+ unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */
+
+ unsigned bind; /**< bitmask of PIPE_BIND_x */
+ unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */
+};
+
+
+/**
+ * Transfer object. For data transfer to/from a resource.
+ */
+struct pipe_transfer
+{
+ struct pipe_resource *resource; /**< resource to transfer to/from */
+ unsigned level; /**< texture mipmap level */
+ enum pipe_transfer_usage usage;
+ struct pipe_box box; /**< region of the resource to access */
+ unsigned stride; /**< row stride in bytes */
+ unsigned layer_stride; /**< image/layer stride in bytes */
+};
+
+
+
+/**
+ * A vertex buffer. Typically, all the vertex data/attributes for
+ * drawing something will be in one buffer. But it's also possible, for
+ * example, to put colors in one buffer and texcoords in another.
+ */
+struct pipe_vertex_buffer
+{
+ unsigned stride; /**< stride to same attrib in next vertex, in bytes */
+ unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */
+ struct pipe_resource *buffer; /**< the actual buffer */
+ const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */
+};
+
+
+/**
+ * A constant buffer. A subrange of an existing buffer can be set
+ * as a constant buffer.
+ */
+struct pipe_constant_buffer {
+ struct pipe_resource *buffer; /**< the actual buffer */
+ unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */
+ unsigned buffer_size; /**< how much data can be read in shader */
+ const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */
+};
+
+
+/**
+ * A stream output target. The structure specifies the range vertices can
+ * be written to.
+ *
+ * In addition to that, the structure should internally maintain the offset
+ * into the buffer, which should be incremented everytime something is written
+ * (appended) to it. The internal offset is buffer_offset + how many bytes
+ * have been written. The internal offset can be stored on the device
+ * and the CPU actually doesn't have to query it.
+ *
+ * Note that the buffer_size variable is actually specifying the available
+ * space in the buffer, not the size of the attached buffer.
+ * In other words in majority of cases buffer_size would simply be
+ * 'buffer->width0 - buffer_offset', so buffer_size refers to the size
+ * of the buffer left, after accounting for buffer offset, for stream output
+ * to write to.
+ *
+ * Use PIPE_QUERY_SO_STATISTICS to know how many primitives have
+ * actually been written.
+ */
+struct pipe_stream_output_target
+{
+ struct pipe_reference reference;
+ struct pipe_resource *buffer; /**< the output buffer */
+ struct pipe_context *context; /**< context this SO target belongs to */
+
+ unsigned buffer_offset; /**< offset where data should be written, in bytes */
+ unsigned buffer_size; /**< how much data is allowed to be written */
+};
+
+
+/**
+ * Information to describe a vertex attribute (position, color, etc)
+ */
+struct pipe_vertex_element
+{
+ /** Offset of this attribute, in bytes, from the start of the vertex */
+ unsigned src_offset;
+
+ /** Instance data rate divisor. 0 means this is per-vertex data,
+ * n means per-instance data used for n consecutive instances (n > 0).
+ */
+ unsigned instance_divisor;
+
+ /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
+ * this attribute live in?
+ */
+ unsigned vertex_buffer_index;
+
+ enum pipe_format src_format;
+};
+
+
+/**
+ * An index buffer. When an index buffer is bound, all indices to vertices
+ * will be looked up in the buffer.
+ */
+struct pipe_index_buffer
+{
+ unsigned index_size; /**< size of an index, in bytes */
+ unsigned offset; /**< offset to start of data in buffer, in bytes */
+ struct pipe_resource *buffer; /**< the actual buffer */
+ const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */
+};
+
+
+/**
+ * Information to describe a draw_vbo call.
+ */
+struct pipe_draw_info
+{
+ boolean indexed; /**< use index buffer */
+
+ unsigned mode; /**< the mode of the primitive */
+ unsigned start; /**< the index of the first vertex */
+ unsigned count; /**< number of vertices */
+
+ unsigned start_instance; /**< first instance id */
+ unsigned instance_count; /**< number of instances */
+
+ /**
+ * For indexed drawing, these fields apply after index lookup.
+ */
+ int index_bias; /**< a bias to be added to each index */
+ unsigned min_index; /**< the min index */
+ unsigned max_index; /**< the max index */
+
+ /**
+ * Primitive restart enable/index (only applies to indexed drawing)
+ */
+ boolean primitive_restart;
+ unsigned restart_index;
+
+ /**
+ * Stream output target. If not NULL, it's used to provide the 'count'
+ * parameter based on the number vertices captured by the stream output
+ * stage. (or generally, based on the number of bytes captured)
+ *
+ * Only 'mode', 'start_instance', and 'instance_count' are taken into
+ * account, all the other variables from pipe_draw_info are ignored.
+ *
+ * 'start' is implicitly 0 and 'count' is set as discussed above.
+ * The draw command is non-indexed.
+ *
+ * Note that this only provides the count. The vertex buffers must
+ * be set via set_vertex_buffers manually.
+ */
+ struct pipe_stream_output_target *count_from_stream_output;
+
+ /* Indirect parameters resource: If not NULL, most values are taken
+ * from this buffer instead, which is laid out as follows:
+ *
+ * if indexed is TRUE:
+ * struct {
+ * uint32_t count;
+ * uint32_t instance_count;
+ * uint32_t start;
+ * int32_t index_bias;
+ * uint32_t start_instance;
+ * };
+ * otherwise:
+ * struct {
+ * uint32_t count;
+ * uint32_t instance_count;
+ * uint32_t start;
+ * uint32_t start_instance;
+ * };
+ */
+ struct pipe_resource *indirect;
+ unsigned indirect_offset; /**< must be 4 byte aligned */
+};
+
+
+/**
+ * Information to describe a blit call.
+ */
+struct pipe_blit_info
+{
+ struct {
+ struct pipe_resource *resource;
+ unsigned level;
+ struct pipe_box box; /**< negative width, height only legal for src */
+ /* For pipe_surface-like format casting: */
+ enum pipe_format format; /**< must be supported for sampling (src)
+ or rendering (dst), ZS is always supported */
+ } dst, src;
+
+ unsigned mask; /**< bitmask of PIPE_MASK_R/G/B/A/Z/S */
+ unsigned filter; /**< PIPE_TEX_FILTER_* */
+
+ boolean scissor_enable;
+ struct pipe_scissor_state scissor;
+
+ boolean render_condition_enable; /**< whether the blit should honor the
+ current render condition */
+};
+
+
+/**
+ * Structure used as a header for serialized LLVM programs.
+ */
+struct pipe_llvm_program_header
+{
+ uint32_t num_bytes; /**< Number of bytes in the LLVM bytecode program. */
+};
+
+struct pipe_compute_state
+{
+ const void *prog; /**< Compute program to be executed. */
+ unsigned req_local_mem; /**< Required size of the LOCAL resource. */
+ unsigned req_private_mem; /**< Required size of the PRIVATE resource. */
+ unsigned req_input_mem; /**< Required size of the INPUT resource. */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mesalib/src/gallium/include/pipe/p_video_codec.h b/mesalib/src/gallium/include/pipe/p_video_codec.h
new file mode 100644
index 000000000..196d00bc5
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_video_codec.h
@@ -0,0 +1,170 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_VIDEO_CONTEXT_H
+#define PIPE_VIDEO_CONTEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pipe/p_video_state.h"
+
+struct pipe_screen;
+struct pipe_surface;
+struct pipe_macroblock;
+struct pipe_picture_desc;
+struct pipe_fence_handle;
+
+/**
+ * Gallium video codec for a specific format/profile
+ */
+struct pipe_video_codec
+{
+ struct pipe_context *context;
+
+ enum pipe_video_profile profile;
+ unsigned level;
+ enum pipe_video_entrypoint entrypoint;
+ enum pipe_video_chroma_format chroma_format;
+ unsigned width;
+ unsigned height;
+ unsigned max_references;
+ bool expect_chunked_decode;
+
+ /**
+ * destroy this video decoder
+ */
+ void (*destroy)(struct pipe_video_codec *codec);
+
+ /**
+ * start decoding of a new frame
+ */
+ void (*begin_frame)(struct pipe_video_codec *codec,
+ struct pipe_video_buffer *target,
+ struct pipe_picture_desc *picture);
+
+ /**
+ * decode a macroblock
+ */
+ void (*decode_macroblock)(struct pipe_video_codec *codec,
+ struct pipe_video_buffer *target,
+ struct pipe_picture_desc *picture,
+ const struct pipe_macroblock *macroblocks,
+ unsigned num_macroblocks);
+
+ /**
+ * decode a bitstream
+ */
+ void (*decode_bitstream)(struct pipe_video_codec *codec,
+ struct pipe_video_buffer *target,
+ struct pipe_picture_desc *picture,
+ unsigned num_buffers,
+ const void * const *buffers,
+ const unsigned *sizes);
+
+ /**
+ * encode to a bitstream
+ */
+ void (*encode_bitstream)(struct pipe_video_codec *codec,
+ struct pipe_video_buffer *source,
+ struct pipe_resource *destination,
+ void **feedback);
+
+ /**
+ * end decoding of the current frame
+ */
+ void (*end_frame)(struct pipe_video_codec *codec,
+ struct pipe_video_buffer *target,
+ struct pipe_picture_desc *picture);
+
+ /**
+ * flush any outstanding command buffers to the hardware
+ * should be called before a video_buffer is acessed by the state tracker again
+ */
+ void (*flush)(struct pipe_video_codec *codec);
+
+ /**
+ * get encoder feedback
+ */
+ void (*get_feedback)(struct pipe_video_codec *codec, void *feedback, unsigned *size);
+};
+
+/**
+ * output for decoding / input for displaying
+ */
+struct pipe_video_buffer
+{
+ struct pipe_context *context;
+
+ enum pipe_format buffer_format;
+ enum pipe_video_chroma_format chroma_format;
+ unsigned width;
+ unsigned height;
+ bool interlaced;
+
+ /**
+ * destroy this video buffer
+ */
+ void (*destroy)(struct pipe_video_buffer *buffer);
+
+ /**
+ * get a individual sampler view for each plane
+ */
+ struct pipe_sampler_view **(*get_sampler_view_planes)(struct pipe_video_buffer *buffer);
+
+ /**
+ * get a individual sampler view for each component
+ */
+ struct pipe_sampler_view **(*get_sampler_view_components)(struct pipe_video_buffer *buffer);
+
+ /**
+ * get a individual surfaces for each plane
+ */
+ struct pipe_surface **(*get_surfaces)(struct pipe_video_buffer *buffer);
+
+ /*
+ * auxiliary associated data
+ */
+ void *associated_data;
+
+ /*
+ * codec where the associated data came from
+ */
+ struct pipe_video_codec *codec;
+
+ /*
+ * destroy the associated data
+ */
+ void (*destroy_associated_data)(void *associated_data);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPE_VIDEO_CONTEXT_H */
diff --git a/mesalib/src/gallium/include/pipe/p_video_enums.h b/mesalib/src/gallium/include/pipe/p_video_enums.h
new file mode 100644
index 000000000..e28d57dd3
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_video_enums.h
@@ -0,0 +1,83 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_VIDEO_ENUMS_H
+#define PIPE_VIDEO_ENUMS_H
+
+enum pipe_video_format
+{
+ PIPE_VIDEO_FORMAT_UNKNOWN = 0,
+ PIPE_VIDEO_FORMAT_MPEG12, /**< MPEG1, MPEG2 */
+ PIPE_VIDEO_FORMAT_MPEG4, /**< DIVX, XVID */
+ PIPE_VIDEO_FORMAT_VC1, /**< WMV */
+ PIPE_VIDEO_FORMAT_MPEG4_AVC /**< H.264 */
+};
+
+enum pipe_video_profile
+{
+ PIPE_VIDEO_PROFILE_UNKNOWN,
+ PIPE_VIDEO_PROFILE_MPEG1,
+ PIPE_VIDEO_PROFILE_MPEG2_SIMPLE,
+ PIPE_VIDEO_PROFILE_MPEG2_MAIN,
+ PIPE_VIDEO_PROFILE_MPEG4_SIMPLE,
+ PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE,
+ PIPE_VIDEO_PROFILE_VC1_SIMPLE,
+ PIPE_VIDEO_PROFILE_VC1_MAIN,
+ PIPE_VIDEO_PROFILE_VC1_ADVANCED,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444
+};
+
+/* Video caps, can be different for each codec/profile */
+enum pipe_video_cap
+{
+ PIPE_VIDEO_CAP_SUPPORTED = 0,
+ PIPE_VIDEO_CAP_NPOT_TEXTURES = 1,
+ PIPE_VIDEO_CAP_MAX_WIDTH = 2,
+ PIPE_VIDEO_CAP_MAX_HEIGHT = 3,
+ PIPE_VIDEO_CAP_PREFERED_FORMAT = 4,
+ PIPE_VIDEO_CAP_PREFERS_INTERLACED = 5,
+ PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = 6,
+ PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7,
+ PIPE_VIDEO_CAP_MAX_LEVEL = 8
+};
+
+enum pipe_video_entrypoint
+{
+ PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
+ PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+ PIPE_VIDEO_ENTRYPOINT_IDCT,
+ PIPE_VIDEO_ENTRYPOINT_MC,
+ PIPE_VIDEO_ENTRYPOINT_ENCODE
+};
+
+#endif /* PIPE_VIDEO_ENUMS_H */
diff --git a/mesalib/src/gallium/include/pipe/p_video_state.h b/mesalib/src/gallium/include/pipe/p_video_state.h
new file mode 100644
index 000000000..6621dbdd0
--- /dev/null
+++ b/mesalib/src/gallium/include/pipe/p_video_state.h
@@ -0,0 +1,382 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef PIPE_VIDEO_STATE_H
+#define PIPE_VIDEO_STATE_H
+
+#include "pipe/p_defines.h"
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
+#include "pipe/p_screen.h"
+#include "util/u_inlines.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * see table 6-12 in the spec
+ */
+enum pipe_mpeg12_picture_coding_type
+{
+ PIPE_MPEG12_PICTURE_CODING_TYPE_I = 0x01,
+ PIPE_MPEG12_PICTURE_CODING_TYPE_P = 0x02,
+ PIPE_MPEG12_PICTURE_CODING_TYPE_B = 0x03,
+ PIPE_MPEG12_PICTURE_CODING_TYPE_D = 0x04
+};
+
+/*
+ * see table 6-14 in the spec
+ */
+enum pipe_mpeg12_picture_structure
+{
+ PIPE_MPEG12_PICTURE_STRUCTURE_RESERVED = 0x00,
+ PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_TOP = 0x01,
+ PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_BOTTOM = 0x02,
+ PIPE_MPEG12_PICTURE_STRUCTURE_FRAME = 0x03
+};
+
+/*
+ * flags for macroblock_type, see section 6.3.17.1 in the spec
+ */
+enum pipe_mpeg12_macroblock_type
+{
+ PIPE_MPEG12_MB_TYPE_QUANT = 0x01,
+ PIPE_MPEG12_MB_TYPE_MOTION_FORWARD = 0x02,
+ PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD = 0x04,
+ PIPE_MPEG12_MB_TYPE_PATTERN = 0x08,
+ PIPE_MPEG12_MB_TYPE_INTRA = 0x10
+};
+
+/*
+ * flags for motion_type, see table 6-17 and 6-18 in the spec
+ */
+enum pipe_mpeg12_motion_type
+{
+ PIPE_MPEG12_MO_TYPE_RESERVED = 0x00,
+ PIPE_MPEG12_MO_TYPE_FIELD = 0x01,
+ PIPE_MPEG12_MO_TYPE_FRAME = 0x02,
+ PIPE_MPEG12_MO_TYPE_16x8 = 0x02,
+ PIPE_MPEG12_MO_TYPE_DUAL_PRIME = 0x03
+};
+
+/*
+ * see section 6.3.17.1 and table 6-19 in the spec
+ */
+enum pipe_mpeg12_dct_type
+{
+ PIPE_MPEG12_DCT_TYPE_FRAME = 0,
+ PIPE_MPEG12_DCT_TYPE_FIELD = 1
+};
+
+enum pipe_mpeg12_field_select
+{
+ PIPE_MPEG12_FS_FIRST_FORWARD = 0x01,
+ PIPE_MPEG12_FS_FIRST_BACKWARD = 0x02,
+ PIPE_MPEG12_FS_SECOND_FORWARD = 0x04,
+ PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08
+};
+
+enum pipe_h264_slice_type
+{
+ PIPE_H264_SLICE_TYPE_P = 0x0,
+ PIPE_H264_SLICE_TYPE_B = 0x1,
+ PIPE_H264_SLICE_TYPE_I = 0x2,
+ PIPE_H264_SLICE_TYPE_SP = 0x3,
+ PIPE_H264_SLICE_TYPE_SI = 0x4
+};
+
+enum pipe_h264_enc_picture_type
+{
+ PIPE_H264_ENC_PICTURE_TYPE_P = 0x00,
+ PIPE_H264_ENC_PICTURE_TYPE_B = 0x01,
+ PIPE_H264_ENC_PICTURE_TYPE_I = 0x02,
+ PIPE_H264_ENC_PICTURE_TYPE_IDR = 0x03,
+ PIPE_H264_ENC_PICTURE_TYPE_SKIP = 0x04
+};
+
+enum pipe_h264_enc_rate_control_method
+{
+ PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00,
+ PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01,
+ PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02,
+ PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03,
+ PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04
+};
+
+struct pipe_picture_desc
+{
+ enum pipe_video_profile profile;
+};
+
+struct pipe_quant_matrix
+{
+ enum pipe_video_format codec;
+};
+
+struct pipe_macroblock
+{
+ enum pipe_video_format codec;
+};
+
+struct pipe_mpeg12_picture_desc
+{
+ struct pipe_picture_desc base;
+
+ unsigned picture_coding_type;
+ unsigned picture_structure;
+ unsigned frame_pred_frame_dct;
+ unsigned q_scale_type;
+ unsigned alternate_scan;
+ unsigned intra_vlc_format;
+ unsigned concealment_motion_vectors;
+ unsigned intra_dc_precision;
+ unsigned f_code[2][2];
+ unsigned top_field_first;
+ unsigned full_pel_forward_vector;
+ unsigned full_pel_backward_vector;
+ unsigned num_slices;
+
+ const uint8_t *intra_matrix;
+ const uint8_t *non_intra_matrix;
+
+ struct pipe_video_buffer *ref[2];
+};
+
+struct pipe_mpeg12_macroblock
+{
+ struct pipe_macroblock base;
+
+ /* see section 6.3.17 in the spec */
+ unsigned short x, y;
+
+ /* see section 6.3.17.1 in the spec */
+ unsigned char macroblock_type;
+
+ union {
+ struct {
+ /* see table 6-17 in the spec */
+ unsigned int frame_motion_type:2;
+
+ /* see table 6-18 in the spec */
+ unsigned int field_motion_type:2;
+
+ /* see table 6-19 in the spec */
+ unsigned int dct_type:1;
+ } bits;
+ unsigned int value;
+ } macroblock_modes;
+
+ /* see section 6.3.17.2 in the spec */
+ unsigned char motion_vertical_field_select;
+
+ /* see Table 7-7 in the spec */
+ short PMV[2][2][2];
+
+ /* see figure 6.10-12 in the spec */
+ unsigned short coded_block_pattern;
+
+ /* see figure 6.10-12 in the spec */
+ short *blocks;
+
+ /* Number of skipped macroblocks after this macroblock */
+ unsigned short num_skipped_macroblocks;
+};
+
+struct pipe_mpeg4_picture_desc
+{
+ struct pipe_picture_desc base;
+
+ int32_t trd[2];
+ int32_t trb[2];
+ uint16_t vop_time_increment_resolution;
+ uint8_t vop_coding_type;
+ uint8_t vop_fcode_forward;
+ uint8_t vop_fcode_backward;
+ uint8_t resync_marker_disable;
+ uint8_t interlaced;
+ uint8_t quant_type;
+ uint8_t quarter_sample;
+ uint8_t short_video_header;
+ uint8_t rounding_control;
+ uint8_t alternate_vertical_scan_flag;
+ uint8_t top_field_first;
+
+ const uint8_t *intra_matrix;
+ const uint8_t *non_intra_matrix;
+
+ struct pipe_video_buffer *ref[2];
+};
+
+struct pipe_vc1_picture_desc
+{
+ struct pipe_picture_desc base;
+
+ uint32_t slice_count;
+ uint8_t picture_type;
+ uint8_t frame_coding_mode;
+ uint8_t postprocflag;
+ uint8_t pulldown;
+ uint8_t interlace;
+ uint8_t tfcntrflag;
+ uint8_t finterpflag;
+ uint8_t psf;
+ uint8_t dquant;
+ uint8_t panscan_flag;
+ uint8_t refdist_flag;
+ uint8_t quantizer;
+ uint8_t extended_mv;
+ uint8_t extended_dmv;
+ uint8_t overlap;
+ uint8_t vstransform;
+ uint8_t loopfilter;
+ uint8_t fastuvmc;
+ uint8_t range_mapy_flag;
+ uint8_t range_mapy;
+ uint8_t range_mapuv_flag;
+ uint8_t range_mapuv;
+ uint8_t multires;
+ uint8_t syncmarker;
+ uint8_t rangered;
+ uint8_t maxbframes;
+ uint8_t deblockEnable;
+ uint8_t pquant;
+
+ struct pipe_video_buffer *ref[2];
+};
+
+struct pipe_h264_sps
+{
+ uint8_t chroma_format_idc;
+ uint8_t separate_colour_plane_flag;
+ uint8_t bit_depth_luma_minus8;
+ uint8_t bit_depth_chroma_minus8;
+ uint8_t seq_scaling_matrix_present_flag;
+ uint8_t ScalingList4x4[6][16];
+ uint8_t ScalingList8x8[6][64];
+ uint8_t log2_max_frame_num_minus4;
+ uint8_t pic_order_cnt_type;
+ uint8_t log2_max_pic_order_cnt_lsb_minus4;
+ uint8_t delta_pic_order_always_zero_flag;
+ int32_t offset_for_non_ref_pic;
+ int32_t offset_for_top_to_bottom_field;
+ uint8_t num_ref_frames_in_pic_order_cnt_cycle;
+ int32_t offset_for_ref_frame[256];
+ uint8_t max_num_ref_frames;
+ uint8_t frame_mbs_only_flag;
+ uint8_t mb_adaptive_frame_field_flag;
+ uint8_t direct_8x8_inference_flag;
+};
+
+struct pipe_h264_pps
+{
+ struct pipe_h264_sps *sps;
+
+ uint8_t entropy_coding_mode_flag;
+ uint8_t bottom_field_pic_order_in_frame_present_flag;
+ uint8_t num_slice_groups_minus1;
+ uint8_t slice_group_map_type;
+ uint8_t slice_group_change_rate_minus1;
+ uint8_t num_ref_idx_l0_default_active_minus1;
+ uint8_t num_ref_idx_l1_default_active_minus1;
+ uint8_t weighted_pred_flag;
+ uint8_t weighted_bipred_idc;
+ int8_t pic_init_qp_minus26;
+ int8_t chroma_qp_index_offset;
+ uint8_t deblocking_filter_control_present_flag;
+ uint8_t constrained_intra_pred_flag;
+ uint8_t redundant_pic_cnt_present_flag;
+ uint8_t ScalingList4x4[6][16];
+ uint8_t ScalingList8x8[6][64];
+ uint8_t transform_8x8_mode_flag;
+ int8_t second_chroma_qp_index_offset;
+};
+
+struct pipe_h264_picture_desc
+{
+ struct pipe_picture_desc base;
+
+ struct pipe_h264_pps *pps;
+
+ /* slice header */
+ uint32_t frame_num;
+ uint8_t field_pic_flag;
+ uint8_t bottom_field_flag;
+ uint8_t num_ref_idx_l0_active_minus1;
+ uint8_t num_ref_idx_l1_active_minus1;
+
+ uint32_t slice_count;
+ int32_t field_order_cnt[2];
+ bool is_reference;
+ uint8_t num_ref_frames;
+
+ bool is_long_term[16];
+ bool top_is_reference[16];
+ bool bottom_is_reference[16];
+ uint32_t field_order_cnt_list[16][2];
+ uint32_t frame_num_list[16];
+
+ struct pipe_video_buffer *ref[16];
+};
+
+struct pipe_h264_enc_rate_control
+{
+ enum pipe_h264_enc_rate_control_method rate_ctrl_method;
+ unsigned target_bitrate;
+ unsigned peak_bitrate;
+ unsigned frame_rate_num;
+ unsigned frame_rate_den;
+ unsigned vbv_buffer_size;
+ unsigned target_bits_picture;
+ unsigned peak_bits_picture_integer;
+ unsigned peak_bits_picture_fraction;
+};
+
+struct pipe_h264_enc_picture_desc
+{
+ struct pipe_picture_desc base;
+
+ struct pipe_h264_enc_rate_control rate_ctrl;
+
+ unsigned quant_i_frames;
+ unsigned quant_p_frames;
+ unsigned quant_b_frames;
+
+ enum pipe_h264_enc_picture_type picture_type;
+ unsigned frame_num;
+ unsigned pic_order_cnt;
+ unsigned ref_idx_l0;
+ unsigned ref_idx_l1;
+
+ bool not_referenced;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPE_VIDEO_STATE_H */
diff --git a/mesalib/src/gallium/include/state_tracker/drisw_api.h b/mesalib/src/gallium/include/state_tracker/drisw_api.h
new file mode 100644
index 000000000..328440cf5
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/drisw_api.h
@@ -0,0 +1,25 @@
+#ifndef _DRISW_API_H_
+#define _DRISW_API_H_
+
+#include "pipe/p_compiler.h"
+
+struct pipe_screen;
+struct dri_drawable;
+
+/**
+ * This callback struct is intended for the winsys to call the loader.
+ */
+struct drisw_loader_funcs
+{
+ void (*put_image) (struct dri_drawable *dri_drawable,
+ void *data, unsigned width, unsigned height);
+ void (*put_image2) (struct dri_drawable *dri_drawable,
+ void *data, int x, int y, unsigned width, unsigned height, unsigned stride);
+};
+
+/**
+ * Implemented by the drisw target.
+ */
+struct pipe_screen * drisw_create_screen(struct drisw_loader_funcs *lf);
+
+#endif
diff --git a/mesalib/src/gallium/include/state_tracker/drm_driver.h b/mesalib/src/gallium/include/state_tracker/drm_driver.h
new file mode 100644
index 000000000..740c4bbe1
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/drm_driver.h
@@ -0,0 +1,126 @@
+
+#ifndef _DRM_DRIVER_H_
+#define _DRM_DRIVER_H_
+
+#include "pipe/p_compiler.h"
+
+struct pipe_screen;
+struct pipe_context;
+struct pipe_resource;
+
+#define DRM_API_HANDLE_TYPE_SHARED 0
+#define DRM_API_HANDLE_TYPE_KMS 1
+#define DRM_API_HANDLE_TYPE_FD 2
+
+
+/**
+ * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
+ */
+struct winsys_handle
+{
+ /**
+ * Input for texture_from_handle, valid values are
+ * DRM_API_HANDLE_TYPE_SHARED or DRM_API_HANDLE_TYPE_FD.
+ * Input to texture_get_handle,
+ * to select handle for kms, flink, or prime.
+ */
+ unsigned type;
+ /**
+ * Input to texture_from_handle.
+ * Output for texture_get_handle.
+ */
+ unsigned handle;
+ /**
+ * Input to texture_from_handle.
+ * Output for texture_get_handle.
+ */
+ unsigned stride;
+};
+
+
+
+/**
+ * Configuration queries.
+ */
+enum drm_conf {
+ /* How many frames to allow before throttling. Or -1 to indicate any number */
+ DRM_CONF_THROTTLE, /* DRM_CONF_INT. */
+ /* Can this driver, running on this kernel, import and export dma-buf fds? */
+ DRM_CONF_SHARE_FD, /* DRM_CONF_BOOL. */
+ DRM_CONF_MAX
+};
+
+/**
+ * Type of configuration answer
+ */
+enum drm_conf_type {
+ DRM_CONF_INT,
+ DRM_CONF_BOOL,
+ DRM_CONF_FLOAT,
+ DRM_CONF_POINTER
+};
+
+/**
+ * Return value from the configuration function.
+ */
+struct drm_conf_ret {
+ enum drm_conf_type type;
+ union {
+ int val_int;
+ bool val_bool;
+ float val_float;
+ void *val_pointer;
+ } val;
+};
+
+struct drm_driver_descriptor
+{
+ /**
+ * Identifying sufix/prefix of the binary, used by egl.
+ */
+ const char *name;
+
+ /**
+ * Kernel driver name, as accepted by drmOpenByName.
+ */
+ const char *driver_name;
+
+ /**
+ * Create a pipe srcreen.
+ *
+ * This function does any wrapping of the screen.
+ * For example wrapping trace or rbug debugging drivers around it.
+ */
+ struct pipe_screen* (*create_screen)(int drm_fd);
+
+
+ /**
+ * Return a configuration value.
+ *
+ * If this function is NULL, or if it returns NULL
+ * the state tracker- or state
+ * tracker manager should provide a reasonable default value.
+ */
+ const struct drm_conf_ret *(*configuration) (enum drm_conf conf);
+};
+
+extern struct drm_driver_descriptor driver_descriptor;
+
+/**
+ * Instantiate a drm_driver_descriptor struct.
+ */
+#define DRM_DRIVER_DESCRIPTOR(name_str, driver_name_str, func, conf) \
+struct drm_driver_descriptor driver_descriptor = { \
+ .name = name_str, \
+ .driver_name = driver_name_str, \
+ .create_screen = func, \
+ .configuration = (conf), \
+};
+
+extern struct pipe_screen *dd_create_screen(int fd);
+
+extern const char *dd_driver_name(void);
+
+extern const struct drm_conf_ret *dd_configuration(enum drm_conf conf);
+
+#endif
diff --git a/mesalib/src/gallium/include/state_tracker/graw.h b/mesalib/src/gallium/include/state_tracker/graw.h
new file mode 100644
index 000000000..217fa31ba
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/graw.h
@@ -0,0 +1,96 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef GALLIUM_RAW_H
+#define GALLIUM_RAW_H
+
+/* This is an API for exercising gallium functionality in a
+ * platform-neutral fashion. Whatever platform integration is
+ * necessary to implement this interface is orchestrated by the
+ * individual target building this entity.
+ *
+ * For instance, the graw-xlib target includes code to implent these
+ * interfaces on top of the X window system.
+ *
+ * Programs using this interface may additionally benefit from some of
+ * the utilities currently in the libgallium.a library, especially
+ * those for parsing text representations of TGSI shaders.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+struct pipe_context;
+struct pipe_screen;
+struct pipe_surface;
+
+/* Returns a handle to be used with flush_frontbuffer()/present().
+ *
+ * Query format support with screen::is_format_supported and usage
+ * XXX.
+ */
+PUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
+ int y,
+ unsigned width,
+ unsigned height,
+ enum pipe_format format,
+ void **handle);
+
+PUBLIC void graw_set_display_func( void (*func)( void ) );
+PUBLIC void graw_main_loop( void );
+
+PUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
+ const char *text );
+
+PUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
+ const char *text );
+
+PUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe,
+ const char *text );
+
+/* Parse a single command-line option, if any. Options include:
+ *
+ * -o <filename>
+ *
+ * If an option has been successfully parsed, argi is updated
+ * to point just after the option and return TRUE.
+ */
+PUBLIC boolean graw_parse_args(int *argi, int argc, char *argv[]);
+
+/* Saves surface contents to a file.
+ *
+ * If filename is NULL, the filename provided with the `-o' option
+ * is used. If the option has not been specified, the surface
+ * will not be saved.
+ *
+ * Returns TRUE if the surface has been saved.
+ */
+PUBLIC boolean graw_save_surface_to_file(struct pipe_context *pipe,
+ struct pipe_surface *surface,
+ const char *filename);
+
+#endif
diff --git a/mesalib/src/gallium/include/state_tracker/st_api.h b/mesalib/src/gallium/include/state_tracker/st_api.h
new file mode 100644
index 000000000..86fdc6988
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/st_api.h
@@ -0,0 +1,541 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#ifndef _ST_API_H_
+#define _ST_API_H_
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+/**
+ * \file API for communication between state trackers and state tracker
+ * managers.
+ *
+ * While both are state tackers, we use the term state tracker for rendering
+ * APIs such as OpenGL or OpenVG, and state tracker manager for window system
+ * APIs such as EGL or GLX in this file.
+ *
+ * This file defines an API to be implemented by both state trackers and state
+ * tracker managers.
+ */
+
+/**
+ * The supported rendering API of a state tracker.
+ */
+enum st_api_type {
+ ST_API_OPENGL,
+ ST_API_OPENVG,
+
+ ST_API_COUNT
+};
+
+/**
+ * The profile of a context.
+ */
+enum st_profile_type
+{
+ ST_PROFILE_DEFAULT, /**< OpenGL compatibility profile */
+ ST_PROFILE_OPENGL_CORE, /**< OpenGL 3.2+ core profile */
+ ST_PROFILE_OPENGL_ES1, /**< OpenGL ES 1.x */
+ ST_PROFILE_OPENGL_ES2 /**< OpenGL ES 2.0 */
+};
+
+/* for profile_mask in st_api */
+#define ST_PROFILE_DEFAULT_MASK (1 << ST_PROFILE_DEFAULT)
+#define ST_PROFILE_OPENGL_CORE_MASK (1 << ST_PROFILE_OPENGL_CORE)
+#define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1)
+#define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2)
+
+/**
+ * Optional API/state tracker features.
+ */
+enum st_api_feature
+{
+ ST_API_FEATURE_MS_VISUALS /**< support for multisample visuals */
+};
+
+/* for feature_mask in st_api */
+#define ST_API_FEATURE_MS_VISUALS_MASK (1 << ST_API_FEATURE_MS_VISUALS)
+
+/**
+ * New context flags for GL 3.0 and beyond.
+ *
+ * Profile information (core vs. compatibilty for OpenGL 3.2+) is communicated
+ * through the \c st_profile_type, not through flags.
+ */
+#define ST_CONTEXT_FLAG_DEBUG (1 << 0)
+#define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 1)
+#define ST_CONTEXT_FLAG_ROBUST_ACCESS (1 << 2)
+
+/**
+ * Reasons that context creation might fail.
+ */
+enum st_context_error {
+ ST_CONTEXT_SUCCESS = 0,
+ ST_CONTEXT_ERROR_NO_MEMORY,
+ ST_CONTEXT_ERROR_BAD_API,
+ ST_CONTEXT_ERROR_BAD_VERSION,
+ ST_CONTEXT_ERROR_BAD_FLAG,
+ ST_CONTEXT_ERROR_UNKNOWN_ATTRIBUTE,
+ ST_CONTEXT_ERROR_UNKNOWN_FLAG
+};
+
+/**
+ * Used in st_context_iface->teximage.
+ */
+enum st_texture_type {
+ ST_TEXTURE_1D,
+ ST_TEXTURE_2D,
+ ST_TEXTURE_3D,
+ ST_TEXTURE_RECT
+};
+
+/**
+ * Available attachments of framebuffer.
+ */
+enum st_attachment_type {
+ ST_ATTACHMENT_FRONT_LEFT,
+ ST_ATTACHMENT_BACK_LEFT,
+ ST_ATTACHMENT_FRONT_RIGHT,
+ ST_ATTACHMENT_BACK_RIGHT,
+ ST_ATTACHMENT_DEPTH_STENCIL,
+ ST_ATTACHMENT_ACCUM,
+ ST_ATTACHMENT_SAMPLE,
+
+ ST_ATTACHMENT_COUNT,
+ ST_ATTACHMENT_INVALID = -1
+};
+
+/* for buffer_mask in st_visual */
+#define ST_ATTACHMENT_FRONT_LEFT_MASK (1 << ST_ATTACHMENT_FRONT_LEFT)
+#define ST_ATTACHMENT_BACK_LEFT_MASK (1 << ST_ATTACHMENT_BACK_LEFT)
+#define ST_ATTACHMENT_FRONT_RIGHT_MASK (1 << ST_ATTACHMENT_FRONT_RIGHT)
+#define ST_ATTACHMENT_BACK_RIGHT_MASK (1 << ST_ATTACHMENT_BACK_RIGHT)
+#define ST_ATTACHMENT_DEPTH_STENCIL_MASK (1 << ST_ATTACHMENT_DEPTH_STENCIL)
+#define ST_ATTACHMENT_ACCUM_MASK (1 << ST_ATTACHMENT_ACCUM)
+#define ST_ATTACHMENT_SAMPLE_MASK (1 << ST_ATTACHMENT_SAMPLE)
+
+/**
+ * Enumerations of state tracker context resources.
+ */
+enum st_context_resource_type {
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_2D,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_3D,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_X,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Y,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
+ ST_CONTEXT_RESOURCE_OPENGL_RENDERBUFFER,
+ ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE
+};
+
+/**
+ * Flush flags.
+ */
+#define ST_FLUSH_FRONT (1 << 0)
+#define ST_FLUSH_END_OF_FRAME (1 << 1)
+
+/**
+ * Value to st_manager->get_param function.
+ */
+enum st_manager_param {
+ /**
+ * The dri state tracker on old libGL's doesn't do the right thing
+ * with regards to invalidating the framebuffers.
+ *
+ * For the mesa state tracker that means that it needs to invalidate
+ * the framebuffer in glViewport itself.
+ */
+ ST_MANAGER_BROKEN_INVALIDATE
+};
+
+/**
+ * The return type of st_api->get_proc_address.
+ */
+typedef void (*st_proc_t)(void);
+
+struct pipe_context;
+struct pipe_resource;
+struct pipe_fence_handle;
+
+/**
+ * Used in st_context_iface->get_resource_for_egl_image.
+ */
+struct st_context_resource
+{
+ /* these fields are filled in by the caller */
+ enum st_context_resource_type type;
+ void *resource;
+
+ /* this is owned by the caller */
+ struct pipe_resource *texture;
+};
+
+/**
+ * Used in st_manager_iface->get_egl_image.
+ */
+struct st_egl_image
+{
+ /* this is owned by the caller */
+ struct pipe_resource *texture;
+
+ unsigned level;
+ unsigned layer;
+};
+
+/**
+ * Represent the visual of a framebuffer.
+ */
+struct st_visual
+{
+ /**
+ * Available buffers. Tested with ST_FRAMEBUFFER_*_MASK.
+ */
+ unsigned buffer_mask;
+
+ /**
+ * Buffer formats. The formats are always set even when the buffer is
+ * not available.
+ */
+ enum pipe_format color_format;
+ enum pipe_format depth_stencil_format;
+ enum pipe_format accum_format;
+ int samples;
+
+ /**
+ * Desired render buffer.
+ */
+ enum st_attachment_type render_buffer;
+};
+
+
+/**
+ * Configuration options from driconf
+ */
+struct st_config_options
+{
+ boolean disable_blend_func_extended;
+ boolean disable_glsl_line_continuations;
+ boolean disable_shader_bit_encoding;
+ boolean force_glsl_extensions_warn;
+ unsigned force_glsl_version;
+ boolean force_s3tc_enable;
+ boolean allow_glsl_extension_directive_midshader;
+};
+
+/**
+ * Represent the attributes of a context.
+ */
+struct st_context_attribs
+{
+ /**
+ * The profile and minimal version to support.
+ *
+ * The valid profiles and versions are rendering API dependent. The latest
+ * version satisfying the request should be returned.
+ */
+ enum st_profile_type profile;
+ int major, minor;
+
+ /** Mask of ST_CONTEXT_FLAG_x bits */
+ unsigned flags;
+
+ /**
+ * The visual of the framebuffers the context will be bound to.
+ */
+ struct st_visual visual;
+
+ /**
+ * Configuration options.
+ */
+ struct st_config_options options;
+};
+
+struct st_context_iface;
+
+/**
+ * Represent a windowing system drawable.
+ *
+ * The framebuffer is implemented by the state tracker manager and
+ * used by the state trackers.
+ *
+ * Instead of the winsys poking into the API context to figure
+ * out what buffers that might be needed in the future by the API
+ * context, it calls into the framebuffer to get the textures.
+ *
+ * This structure along with the notify_invalid_framebuffer
+ * allows framebuffers to be shared between different threads
+ * but at the same make the API context free from thread
+ * synchronization primitves, with the exception of a small
+ * atomic flag used for notification of framebuffer dirty status.
+ *
+ * The thread synchronization is put inside the framebuffer
+ * and only called once the framebuffer has become dirty.
+ */
+struct st_framebuffer_iface
+{
+ /**
+ * Atomic stamp which changes when framebuffers need to be updated.
+ */
+ int32_t stamp;
+
+ /**
+ * Available for the state tracker manager to use.
+ */
+ void *st_manager_private;
+
+ /**
+ * The visual of a framebuffer.
+ */
+ const struct st_visual *visual;
+
+ /**
+ * Flush the front buffer.
+ *
+ * On some window systems, changes to the front buffers are not immediately
+ * visible. They need to be flushed.
+ *
+ * @att is one of the front buffer attachments.
+ */
+ boolean (*flush_front)(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt);
+
+ /**
+ * The state tracker asks for the textures it needs.
+ *
+ * It should try to only ask for attachments that it currently renders
+ * to, thus allowing the winsys to delay the allocation of textures not
+ * needed. For example front buffer attachments are not needed if you
+ * only do back buffer rendering.
+ *
+ * The implementor of this function needs to also ensure
+ * thread safty as this call might be done from multiple threads.
+ *
+ * The returned textures are owned by the caller. They should be
+ * unreferenced when no longer used. If this function is called multiple
+ * times with different sets of attachments, those buffers not included in
+ * the last call might be destroyed. This behavior might change in the
+ * future.
+ */
+ boolean (*validate)(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
+ const enum st_attachment_type *statts,
+ unsigned count,
+ struct pipe_resource **out);
+};
+
+/**
+ * Represent a rendering context.
+ *
+ * This entity is created from st_api and used by the state tracker manager.
+ */
+struct st_context_iface
+{
+ /**
+ * Available for the state tracker and the manager to use.
+ */
+ void *st_context_private;
+ void *st_manager_private;
+
+ /**
+ * The CSO context associated with this context in case we need to draw
+ * something before swap buffers.
+ */
+ struct cso_context *cso_context;
+
+ /**
+ * The gallium context.
+ */
+ struct pipe_context *pipe;
+
+ /**
+ * Destroy the context.
+ */
+ void (*destroy)(struct st_context_iface *stctxi);
+
+ /**
+ * Flush all drawing from context to the pipe also flushes the pipe.
+ */
+ void (*flush)(struct st_context_iface *stctxi, unsigned flags,
+ struct pipe_fence_handle **fence);
+
+ /**
+ * Replace the texture image of a texture object at the specified level.
+ *
+ * This function is optional.
+ */
+ boolean (*teximage)(struct st_context_iface *stctxi,
+ enum st_texture_type target,
+ int level, enum pipe_format internal_format,
+ struct pipe_resource *tex, boolean mipmap);
+
+ /**
+ * Used to implement glXCopyContext.
+ */
+ void (*copy)(struct st_context_iface *stctxi,
+ struct st_context_iface *stsrci, unsigned mask);
+
+ /**
+ * Used to implement wglShareLists.
+ */
+ boolean (*share)(struct st_context_iface *stctxi,
+ struct st_context_iface *stsrci);
+
+ /**
+ * Look up and return the info of a resource for EGLImage.
+ *
+ * This function is optional.
+ */
+ boolean (*get_resource_for_egl_image)(struct st_context_iface *stctxi,
+ struct st_context_resource *stres);
+};
+
+
+/**
+ * Represent a state tracker manager.
+ *
+ * This interface is implemented by the state tracker manager. It corresponds
+ * to a "display" in the window system.
+ */
+struct st_manager
+{
+ struct pipe_screen *screen;
+
+ /**
+ * Look up and return the info of an EGLImage.
+ *
+ * This is used to implement for example EGLImageTargetTexture2DOES.
+ * The GLeglImageOES agrument of that call is passed directly to this
+ * function call and the information needed to access this is returned
+ * in the given struct out.
+ *
+ * @smapi: manager owning the caller context
+ * @stctx: caller context
+ * @egl_image: EGLImage that caller recived
+ * @out: return struct filled out with access information.
+ *
+ * This function is optional.
+ */
+ boolean (*get_egl_image)(struct st_manager *smapi,
+ void *egl_image,
+ struct st_egl_image *out);
+
+ /**
+ * Query an manager param.
+ */
+ int (*get_param)(struct st_manager *smapi,
+ enum st_manager_param param);
+};
+
+/**
+ * Represent a rendering API such as OpenGL or OpenVG.
+ *
+ * Implemented by the state tracker and used by the state tracker manager.
+ */
+struct st_api
+{
+ /**
+ * The name of the rendering API. This is informative.
+ */
+ const char *name;
+
+ /**
+ * The supported rendering API.
+ */
+ enum st_api_type api;
+
+ /**
+ * The supported profiles. Tested with ST_PROFILE_*_MASK.
+ */
+ unsigned profile_mask;
+
+ /**
+ * The supported optional features. Tested with ST_FEATURE_*_MASK.
+ */
+ unsigned feature_mask;
+
+ /**
+ * Destroy the API.
+ */
+ void (*destroy)(struct st_api *stapi);
+
+ /**
+ * Query supported OpenGL versions. (if applicable)
+ * The format is (major*10+minor).
+ */
+ void (*query_versions)(struct st_api *stapi, struct st_manager *sm,
+ struct st_config_options *options,
+ int *gl_core_version,
+ int *gl_compat_version,
+ int *gl_es1_version,
+ int *gl_es2_version);
+
+ /**
+ * Return an API entry point.
+ *
+ * For GL this is the same as _glapi_get_proc_address.
+ */
+ st_proc_t (*get_proc_address)(struct st_api *stapi, const char *procname);
+
+ /**
+ * Create a rendering context.
+ */
+ struct st_context_iface *(*create_context)(struct st_api *stapi,
+ struct st_manager *smapi,
+ const struct st_context_attribs *attribs,
+ enum st_context_error *error,
+ struct st_context_iface *stsharei);
+
+ /**
+ * Bind the context to the calling thread with draw and read as drawables.
+ *
+ * The framebuffers might be NULL, or might have different visuals than the
+ * context does.
+ */
+ boolean (*make_current)(struct st_api *stapi,
+ struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stdrawi,
+ struct st_framebuffer_iface *streadi);
+
+ /**
+ * Get the currently bound context in the calling thread.
+ */
+ struct st_context_iface *(*get_current)(struct st_api *stapi);
+};
+
+/**
+ * Return true if the visual has the specified buffers.
+ */
+static INLINE boolean
+st_visual_have_buffers(const struct st_visual *visual, unsigned mask)
+{
+ return ((visual->buffer_mask & mask) == mask);
+}
+
+#endif /* _ST_API_H_ */
diff --git a/mesalib/src/gallium/include/state_tracker/sw_winsys.h b/mesalib/src/gallium/include/state_tracker/sw_winsys.h
new file mode 100644
index 000000000..a3479eb0b
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/sw_winsys.h
@@ -0,0 +1,146 @@
+/**************************************************************************
+ *
+ * Copyright 2007-2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Software rasterizer winsys.
+ */
+
+
+#ifndef SW_WINSYS_H
+#define SW_WINSYS_H
+
+
+#include "pipe/p_compiler.h" /* for boolean */
+#include "pipe/p_format.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct winsys_handle;
+struct pipe_screen;
+struct pipe_context;
+struct pipe_resource;
+struct pipe_box;
+
+/**
+ * Opaque pointer.
+ */
+struct sw_displaytarget;
+
+
+/**
+ * This is the interface that sw expects any window system
+ * hosting it to implement.
+ *
+ * sw is for the most part a self sufficient driver. The only thing it
+ * does not know is how to display a surface.
+ */
+struct sw_winsys
+{
+ void
+ (*destroy)( struct sw_winsys *ws );
+
+ boolean
+ (*is_displaytarget_format_supported)( struct sw_winsys *ws,
+ unsigned tex_usage,
+ enum pipe_format format );
+
+ /**
+ * Allocate storage for a render target.
+ *
+ * Often surfaces which are meant to be blitted to the front screen (i.e.,
+ * display targets) must be allocated with special characteristics, memory
+ * pools, or obtained directly from the windowing system.
+ *
+ * This callback is invoked by the pipe_screen when creating a texture marked
+ * with the PIPE_BIND_DISPLAY_TARGET flag to get the underlying
+ * storage.
+ */
+ struct sw_displaytarget *
+ (*displaytarget_create)( struct sw_winsys *ws,
+ unsigned tex_usage,
+ enum pipe_format format,
+ unsigned width, unsigned height,
+ unsigned alignment,
+ unsigned *stride );
+
+ /**
+ * Used to implement texture_from_handle.
+ */
+ struct sw_displaytarget *
+ (*displaytarget_from_handle)( struct sw_winsys *ws,
+ const struct pipe_resource *templat,
+ struct winsys_handle *whandle,
+ unsigned *stride );
+
+ /**
+ * Used to implement texture_get_handle.
+ */
+ boolean
+ (*displaytarget_get_handle)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle );
+
+ /**
+ * \param flags bitmask of PIPE_TRANSFER_x flags
+ */
+ void *
+ (*displaytarget_map)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ unsigned flags );
+
+ void
+ (*displaytarget_unmap)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt );
+
+ /**
+ * @sa pipe_screen:flush_frontbuffer.
+ *
+ * This call will likely become asynchronous eventually.
+ */
+ void
+ (*displaytarget_display)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ void *context_private,
+ struct pipe_box *box );
+
+ void
+ (*displaytarget_destroy)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt );
+};
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SW_WINSYS_H */
diff --git a/mesalib/src/gallium/include/state_tracker/vdpau_interop.h b/mesalib/src/gallium/include/state_tracker/vdpau_interop.h
new file mode 100644
index 000000000..3ca7c9d4a
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/vdpau_interop.h
@@ -0,0 +1,49 @@
+/**************************************************************************
+ *
+ * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * Authors:
+ * Christian König <christian.koenig@amd.com>
+ *
+ */
+
+#ifndef _VDPAU_INTEROP_H_
+#define _VDPAU_INTEROP_H_
+
+/* driver specific functions for NV_vdpau_interop */
+
+#define VDP_FUNC_ID_BASE_DRIVER 0x2000
+#define VDP_FUNC_ID_VIDEO_SURFACE_GALLIUM (VDP_FUNC_ID_BASE_DRIVER + 0)
+#define VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM (VDP_FUNC_ID_BASE_DRIVER + 1)
+
+struct pipe_resource;
+struct pipe_video_buffer;
+
+typedef struct pipe_video_buffer *VdpVideoSurfaceGallium(uint32_t surface);
+typedef struct pipe_resource *VdpOutputSurfaceGallium(uint32_t surface);
+
+#endif /* _VDPAU_INTEROP_H_ */
diff --git a/mesalib/src/gallium/include/state_tracker/xlibsw_api.h b/mesalib/src/gallium/include/state_tracker/xlibsw_api.h
new file mode 100644
index 000000000..930127981
--- /dev/null
+++ b/mesalib/src/gallium/include/state_tracker/xlibsw_api.h
@@ -0,0 +1,19 @@
+#ifndef XLIB_SW_WINSYS_H
+#define XLIB_SW_WINSYS_H
+
+#include "state_tracker/sw_winsys.h"
+#include <X11/Xlib.h>
+
+
+/* This is what the xlib software winsys expects to find in the
+ * "private" field of flush_frontbuffers().
+ *
+ * Xlib-based state trackers somehow need to know this.
+ */
+struct xlib_drawable {
+ Visual *visual;
+ int depth;
+ Drawable drawable;
+};
+
+#endif