add pipe includes

macos/master
Dave Airlie 10 years ago
parent 96b360b936
commit b44c76bfdd
  1. 266
      src/gallium/include/pipe/p_compiler.h
  2. 259
      src/gallium/include/pipe/p_config.h
  3. 546
      src/gallium/include/pipe/p_context.h
  4. 729
      src/gallium/include/pipe/p_defines.h
  5. 381
      src/gallium/include/pipe/p_format.h
  6. 230
      src/gallium/include/pipe/p_screen.h
  7. 651
      src/gallium/include/pipe/p_shader_tokens.h
  8. 617
      src/gallium/include/pipe/p_state.h
  9. 79
      src/gallium/include/pipe/p_video_enums.h

@ -0,0 +1,266 @@
/**************************************************************************
*
* 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 "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 (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !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 */

@ -0,0 +1,259 @@
/**************************************************************************
*
* 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
#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(__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_ */

@ -0,0 +1,546 @@
/**************************************************************************
*
* 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 );
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_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,
unsigned append_bitmask);
/*@}*/
/**
* 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);
/** 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);
};
#ifdef __cplusplus
}
#endif
#endif /* PIPE_CONTEXT_H */

@ -0,0 +1,729 @@
/**************************************************************************
*
* 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 */
/* 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 = 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
};
#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 = 15,
PIPE_CAPF_MAX_LINE_WIDTH_AA = 16,
PIPE_CAPF_MAX_POINT_WIDTH = 17,
PIPE_CAPF_MAX_POINT_WIDTH_AA = 18,
PIPE_CAPF_MAX_TEXTURE_ANISOTROPY = 19,
PIPE_CAPF_MAX_TEXTURE_LOD_BIAS = 20,
PIPE_CAPF_GUARD_BAND_LEFT = 21,
PIPE_CAPF_GUARD_BAND_TOP = 22,
PIPE_CAPF_GUARD_BAND_RIGHT = 23,
PIPE_CAPF_GUARD_BAND_BOTTOM = 24
};
/* Shader caps not specific to any single stage */
enum pipe_shader_cap
{
PIPE_SHADER_CAP_MAX_INSTRUCTIONS = 0, /* if 0, it means the stage is unsupported */
PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS = 1,
PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS = 2,
PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS = 3,
PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH = 4,
PIPE_SHADER_CAP_MAX_INPUTS = 5,
PIPE_SHADER_CAP_MAX_CONSTS = 6,
PIPE_SHADER_CAP_MAX_CONST_BUFFERS = 7,
PIPE_SHADER_CAP_MAX_TEMPS = 8,
PIPE_SHADER_CAP_MAX_ADDRS = 9,
PIPE_SHADER_CAP_MAX_PREDS = 10,
/* boolean caps */
PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED = 11,
PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR = 12,
PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR = 13,
PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR = 14,
PIPE_SHADER_CAP_INDIRECT_CONST_ADDR = 15,
PIPE_SHADER_CAP_SUBROUTINES = 16, /* BGNSUB, ENDSUB, CAL, RET */
PIPE_SHADER_CAP_INTEGERS = 17,
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18,
PIPE_SHADER_CAP_PREFERRED_IR = 19,
PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED = 20,
PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS = 21
};
/**
* Shader intermediate representation.
*/
enum pipe_shader_ir
{
PIPE_SHADER_IR_TGSI,
PIPE_SHADER_IR_LLVM
};
/**
* 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
};
/**
* 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

@ -0,0 +1,381 @@
/**************************************************************************
*
* 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"
enum pipe_type {
PIPE_TYPE_UNORM = 0,
PIPE_TYPE_SNORM,
PIPE_TYPE_SINT,
PIPE_TYPE_UINT,
PIPE_TYPE_FLOAT,
PIPE_TYPE_COUNT
};
/**
* Texture/surface image formats (preliminary)
*/
/* KW: Added lots of surface formats to support vertex element layout
* definitions, and eventually render-to-vertex-buffer.
*/
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_R4A4_UNORM = 168,
PIPE_FORMAT_A4R4_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_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
#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
#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

@ -0,0 +1,230 @@
/**************************************************************************
*
* 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);
/**
* 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 */

@ -0,0 +1,651 @@
/**************************************************************************
*
* 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_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 Centroid : 1; /**< centroid sampling? */
unsigned CylindricalWrap:4; /**< TGSI_CYLINDRICAL_WRAP_x flags */
unsigned Padding : 23;
};
#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_COUNT 24 /**< 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;
};
struct tgsi_declaration_sampler_view {
unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */
unsigned ReturnTypeX : 6; /**< one of enum pipe_type */
unsigned ReturnTypeY : 6; /**< one of enum pipe_type */
unsigned ReturnTypeZ : 6; /**< one of enum pipe_type */
unsigned ReturnTypeW : 6; /**< one of enum pipe_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
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_COUNT 8
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
#define TGSI_OPCODE_CND 19
#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
#define TGSI_OPCODE_RCC 34
#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
#define TGSI_OPCODE_RFL 44
#define TGSI_OPCODE_SEQ 45
#define TGSI_OPCODE_SFL 46
#define TGSI_OPCODE_SGT 47
#define TGSI_OPCODE_SIN 48
#define TGSI_OPCODE_SLE 49
#define TGSI_OPCODE_SNE 50
#define TGSI_OPCODE_STR 51
#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
#define TGSI_OPCODE_X2D 59
#define TGSI_OPCODE_ARA 60
#define TGSI_OPCODE_ARR 61
#define TGSI_OPCODE_BRA 62
#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
#define TGSI_OPCODE_NRM 69
#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
/* gap */
#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
#define TGSI_OPCODE_NRM4 112
#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_LAST 183
#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 */

@ -0,0 +1,617 @@
/**************************************************************************
*
* 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 16
#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[4];
float translate[4];
};
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 */
} 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_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;
};
/**
* 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;
};
/**
* 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

@ -0,0 +1,79 @@
/**************************************************************************
*
* 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_HIGH
};
/* 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 */
Loading…
Cancel
Save