summaryrefslogtreecommitdiffstats
path: root/src/gallium/include
diff options
context:
space:
mode:
authorChristian König <[email protected]>2010-10-12 23:05:25 +0200
committerChristian König <[email protected]>2010-10-12 23:07:29 +0200
commit695cc370a280a637f411f5ff3877b3fd1c05e424 (patch)
tree69ae2a8fbecfa553faba59274688ffe11ee1a612 /src/gallium/include
parentf3e34ba6fba76870b1c91a27adb706d1b87aeec8 (diff)
parent48156b87bc9d3e09ec34372d69504a787332ea0b (diff)
Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into pipe-video
Conflicts: configure.ac src/gallium/drivers/nvfx/Makefile src/gallium/include/pipe/p_defines.h src/gallium/include/pipe/p_screen.h src/gallium/include/state_tracker/dri1_api.h src/gallium/include/state_tracker/drm_api.h src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_compiler.h51
-rw-r--r--src/gallium/include/pipe/p_config.h15
-rw-r--r--src/gallium/include/pipe/p_context.h170
-rw-r--r--src/gallium/include/pipe/p_defines.h146
-rw-r--r--src/gallium/include/pipe/p_format.h2
-rw-r--r--src/gallium/include/pipe/p_screen.h14
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h33
-rw-r--r--src/gallium/include/pipe/p_state.h75
-rw-r--r--src/gallium/include/state_tracker/dri1_api.h82
-rw-r--r--src/gallium/include/state_tracker/drm_api.h76
-rw-r--r--src/gallium/include/state_tracker/drm_driver.h71
-rw-r--r--src/gallium/include/state_tracker/graw.h54
-rw-r--r--src/gallium/include/state_tracker/st_api.h126
-rw-r--r--src/gallium/include/state_tracker/sw_winsys.h2
-rw-r--r--src/gallium/include/state_tracker/swrast_screen_create.h67
15 files changed, 635 insertions, 349 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 9b31555f1b1..50205995911 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -35,6 +35,7 @@
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
+#include <limits.h>
#if defined(_WIN32) && !defined(__WIN32__)
@@ -60,6 +61,11 @@
#include <stdbool.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
#if !defined(__HAIKU__) && !defined(__USE_MISC)
typedef unsigned int uint;
typedef unsigned short ushort;
@@ -74,6 +80,14 @@ typedef unsigned char boolean;
#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
+
/* Function inlining */
#ifndef INLINE
# ifdef __cplusplus
@@ -97,11 +111,23 @@ typedef unsigned char boolean;
# endif
#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
@@ -182,6 +208,25 @@ typedef unsigned char boolean;
#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()
+
+#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.
*
@@ -222,4 +267,10 @@ typedef unsigned char boolean;
#define unlikely(x) !!(x)
#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+
#endif /* P_COMPILER_H */
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index c5928dde471..74a1fa29781 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -92,6 +92,11 @@
#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__)
@@ -146,6 +151,11 @@
#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
@@ -165,6 +175,11 @@
#define PIPE_OS_UNIX
#endif
+#if defined(__CYGWIN__)
+#define PIPE_OS_CYGWIN
+#define PIPE_OS_UNIX
+#endif
+
/*
* Try to auto-detect the subsystem.
*
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 6f47845f3b8..0e53aef6d2e 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -28,19 +28,37 @@
#ifndef PIPE_CONTEXT_H
#define PIPE_CONTEXT_H
-#include "p_state.h"
-
+#include "p_compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
-
-struct pipe_screen;
+
+struct pipe_blend_color;
+struct pipe_blend_state;
+struct pipe_box;
+struct pipe_clip_state;
+struct pipe_depth_stencil_alpha_state;
+struct pipe_draw_info;
struct pipe_fence_handle;
-struct pipe_state_cache;
+struct pipe_framebuffer_state;
+struct pipe_index_buffer;
struct pipe_query;
-struct pipe_winsys;
+struct pipe_poly_stipple;
+struct pipe_rasterizer_state;
+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_state;
+struct pipe_subresource;
+struct pipe_surface;
+struct pipe_vertex_buffer;
+struct pipe_vertex_element;
+struct pipe_viewport_state;
/**
* Gallium rendering context. Basically:
@@ -61,46 +79,13 @@ struct pipe_context {
* VBO drawing
*/
/*@{*/
- void (*draw_arrays)( struct pipe_context *pipe,
- unsigned mode, unsigned start, unsigned count);
-
- void (*draw_elements)( struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned mode, unsigned start, unsigned count);
-
- void (*draw_arrays_instanced)(struct pipe_context *pipe,
- unsigned mode,
- unsigned start,
- unsigned count,
- unsigned startInstance,
- unsigned instanceCount);
-
- void (*draw_elements_instanced)(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned mode,
- unsigned start,
- unsigned count,
- unsigned startInstance,
- unsigned instanceCount);
-
- /* XXX: this is (probably) a temporary entrypoint, as the range
- * information should be available from the vertex_buffer state.
- * Using this to quickly evaluate a specialized path in the draw
- * module.
+ void (*draw_vbo)( struct pipe_context *pipe,
+ const struct pipe_draw_info *info );
+
+ /**
+ * Draw the stream output buffer at index 0
*/
- void (*draw_range_elements)( struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned minIndex,
- unsigned maxIndex,
- unsigned mode,
- unsigned start,
- unsigned count);
+ void (*draw_stream_output)( struct pipe_context *pipe, unsigned mode );
/*@}*/
/**
@@ -130,10 +115,10 @@ struct pipe_context {
* \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,
+ boolean (*get_query_result)(struct pipe_context *pipe,
struct pipe_query *q,
boolean wait,
- uint64_t *result);
+ void *result);
/*@}*/
/**
@@ -153,6 +138,9 @@ struct pipe_context {
void (*bind_vertex_sampler_states)(struct pipe_context *,
unsigned num_samplers,
void **samplers);
+ void (*bind_geometry_sampler_states)(struct pipe_context *,
+ unsigned num_samplers,
+ void **samplers);
void (*delete_sampler_state)(struct pipe_context *, void *);
void * (*create_rasterizer_state)(struct pipe_context *,
@@ -186,6 +174,11 @@ struct pipe_context {
void (*bind_vertex_elements_state)(struct pipe_context *, void *);
void (*delete_vertex_elements_state)(struct pipe_context *, void *);
+ void * (*create_stream_output_state)(struct pipe_context *,
+ const struct pipe_stream_output_state *);
+ void (*bind_stream_output_state)(struct pipe_context *, void *);
+ void (*delete_stream_output_state)(struct pipe_context*, void*);
+
/*@}*/
/**
@@ -198,6 +191,9 @@ struct pipe_context {
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 * );
@@ -225,40 +221,58 @@ struct pipe_context {
unsigned num_views,
struct pipe_sampler_view **);
+ void (*set_geometry_sampler_views)(struct pipe_context *,
+ unsigned num_views,
+ struct pipe_sampler_view **);
+
void (*set_vertex_buffers)( struct pipe_context *,
unsigned num_buffers,
const struct pipe_vertex_buffer * );
+ void (*set_index_buffer)( struct pipe_context *pipe,
+ const struct pipe_index_buffer * );
+
+ void (*set_stream_output_buffers)(struct pipe_context *,
+ struct pipe_resource **buffers,
+ int *offsets, /*array of offsets
+ from the start of each
+ of the buffers */
+ int num_buffers);
+
/*@}*/
/**
- * Surface functions
+ * Resource functions for blit-like functionality
*
- * The pipe driver is allowed to set these functions to NULL, and in that
- * case, they will not be available.
+ * If a driver supports multisampling, resource_resolve must be available.
*/
/*@{*/
/**
- * Copy a block of pixels from one surface to another.
- * The surfaces must be of the same format.
+ * 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 (*surface_copy)(struct pipe_context *pipe,
- struct pipe_surface *dest,
- unsigned destx, unsigned desty,
- struct pipe_surface *src,
- unsigned srcx, unsigned srcy,
- unsigned width, unsigned height);
+ void (*resource_copy_region)(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ struct pipe_resource *src,
+ struct pipe_subresource subsrc,
+ unsigned srcx, unsigned srcy, unsigned srcz,
+ unsigned width, unsigned height);
/**
- * Fill a region of a surface with a constant value.
+ * Resolve a multisampled resource into a non-multisampled one.
+ * Source and destination must have the same size and same format.
*/
- void (*surface_fill)(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height,
- unsigned value);
+ void (*resource_resolve)(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ struct pipe_resource *src,
+ struct pipe_subresource subsrc);
+
/*@}*/
/**
@@ -272,9 +286,33 @@ struct pipe_context {
*/
void (*clear)(struct pipe_context *pipe,
unsigned buffers,
- const float *rgba,
+ const float *rgba,
double depth,
- unsigned stencil);
+ unsigned stencil);
+
+ /**
+ * Clear a color rendertarget surface.
+ * \param rgba pointer to an array of one float for each of r, g, b, a.
+ */
+ void (*clear_render_target)(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ const float *rgba,
+ 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 rendering
* \param flags bitmask of PIPE_FLUSH_x tokens)
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 28318183183..9d5700ef439 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -28,7 +28,7 @@
#ifndef PIPE_DEFINES_H
#define PIPE_DEFINES_H
-#include "p_format.h"
+#include "p_compiler.h"
#ifdef __cplusplus
extern "C" {
@@ -119,11 +119,11 @@ enum pipe_error {
#define PIPE_POLYGON_MODE_LINE 1
#define PIPE_POLYGON_MODE_POINT 2
-/** Polygon front/back window, also for culling */
-#define PIPE_WINDING_NONE 0
-#define PIPE_WINDING_CW 1
-#define PIPE_WINDING_CCW 2
-#define PIPE_WINDING_BOTH (PIPE_WINDING_CW | PIPE_WINDING_CCW)
+/** 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
@@ -135,13 +135,15 @@ enum pipe_error {
#define PIPE_STENCIL_OP_DECR_WRAP 6
#define PIPE_STENCIL_OP_INVERT 7
-/** Texture types */
+/** 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_MAX_TEXTURE_TYPES
};
@@ -189,9 +191,10 @@ enum pipe_texture_target {
*/
/** All color buffers currently bound */
#define PIPE_CLEAR_COLOR (1 << 0)
+#define PIPE_CLEAR_DEPTH (1 << 1)
+#define PIPE_CLEAR_STENCIL (1 << 2)
/** Depth/stencil combined */
-#define PIPE_CLEAR_DEPTHSTENCIL (1 << 1)
-
+#define PIPE_CLEAR_DEPTHSTENCIL (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)
/**
* Transfer object usage flags
@@ -284,11 +287,10 @@ enum pipe_transfer_usage {
#define PIPE_BIND_VERTEX_BUFFER (1 << 3) /* set_vertex_buffers */
#define PIPE_BIND_INDEX_BUFFER (1 << 4) /* draw_elements */
#define PIPE_BIND_CONSTANT_BUFFER (1 << 5) /* set_constant_buffer */
-#define PIPE_BIND_BLIT_SOURCE (1 << 6) /* surface_copy */
-#define PIPE_BIND_BLIT_DESTINATION (1 << 7) /* surface_copy, fill */
#define PIPE_BIND_DISPLAY_TARGET (1 << 8) /* flush_front_buffer */
#define PIPE_BIND_TRANSFER_WRITE (1 << 9) /* get_transfer */
#define PIPE_BIND_TRANSFER_READ (1 << 10) /* get_transfer */
+#define PIPE_BIND_STREAM_OUTPUT (1 << 11) /* set_stream_output_buffers */
#define PIPE_BIND_CUSTOM (1 << 16) /* state-tracker/winsys usages */
/* The first two flags above were previously part of the amorphous
@@ -323,6 +325,7 @@ enum pipe_transfer_usage {
#define PIPE_USAGE_STATIC 2 /* same as immutable?? */
#define PIPE_USAGE_IMMUTABLE 3 /* no change after first upload */
#define PIPE_USAGE_STREAM 4 /* upload, draw, upload, draw */
+#define PIPE_USAGE_STAGING 5 /* supports data transfers from the GPU to the CPU */
/* These are intended to be used in calls to is_format_supported, but
@@ -379,7 +382,11 @@ enum pipe_transfer_usage {
#define PIPE_QUERY_OCCLUSION_COUNTER 0
#define PIPE_QUERY_PRIMITIVES_GENERATED 1
#define PIPE_QUERY_PRIMITIVES_EMITTED 2
-#define PIPE_QUERY_TYPES 3
+#define PIPE_QUERY_TIME_ELAPSED 3
+#define PIPE_QUERY_SO_STATISTICS 5
+#define PIPE_QUERY_GPU_FINISHED 6
+#define PIPE_QUERY_TIMESTAMP_DISJOINT 7
+#define PIPE_QUERY_TYPES 8
/**
@@ -413,47 +420,69 @@ enum pipe_transfer_usage {
* Implementation capabilities/limits which are queried through
* pipe_screen::get_param() and pipe_screen::get_paramf().
*/
-#define PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS 1
-#define PIPE_CAP_NPOT_TEXTURES 2
-#define PIPE_CAP_TWO_SIDED_STENCIL 3
-#define PIPE_CAP_GLSL 4 /* XXX need something better */
-#define PIPE_CAP_DUAL_SOURCE_BLEND 5
-#define PIPE_CAP_ANISOTROPIC_FILTER 6
-#define PIPE_CAP_POINT_SPRITE 7
-#define PIPE_CAP_MAX_RENDER_TARGETS 8
-#define PIPE_CAP_OCCLUSION_QUERY 9
-#define PIPE_CAP_TEXTURE_SHADOW_MAP 10
-#define PIPE_CAP_MAX_TEXTURE_2D_LEVELS 11
-#define PIPE_CAP_MAX_TEXTURE_3D_LEVELS 12
-#define PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS 13
-#define PIPE_CAP_MAX_LINE_WIDTH 14
-#define PIPE_CAP_MAX_LINE_WIDTH_AA 15
-#define PIPE_CAP_MAX_POINT_WIDTH 16
-#define PIPE_CAP_MAX_POINT_WIDTH_AA 17
-#define PIPE_CAP_MAX_TEXTURE_ANISOTROPY 18
-#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS 19
-#define PIPE_CAP_GUARD_BAND_LEFT 20 /*< float */
-#define PIPE_CAP_GUARD_BAND_TOP 21 /*< float */
-#define PIPE_CAP_GUARD_BAND_RIGHT 22 /*< float */
-#define PIPE_CAP_GUARD_BAND_BOTTOM 23 /*< float */
-#define PIPE_CAP_TEXTURE_MIRROR_CLAMP 24
-#define PIPE_CAP_TEXTURE_MIRROR_REPEAT 25
-#define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26
-#define PIPE_CAP_TGSI_CONT_SUPPORTED 27
-#define PIPE_CAP_BLEND_EQUATION_SEPARATE 28
-#define PIPE_CAP_SM3 29 /*< Shader Model 3 supported */
-#define PIPE_CAP_MAX_PREDICATE_REGISTERS 30
-#define PIPE_CAP_MAX_COMBINED_SAMPLERS 31 /*< Maximum texture image units accessible from vertex
- and fragment shaders combined */
-#define PIPE_CAP_MAX_CONST_BUFFERS 32
-#define PIPE_CAP_MAX_CONST_BUFFER_SIZE 33 /*< In bytes */
-#define PIPE_CAP_INDEP_BLEND_ENABLE 34 /*< blend enables and write masks per rendertarget */
-#define PIPE_CAP_INDEP_BLEND_FUNC 35 /*< different blend funcs per rendertarget */
-#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT 36
-#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT 37
-#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 38
-#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER 39
+enum pipe_cap {
+ PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS,
+ PIPE_CAP_NPOT_TEXTURES,
+ PIPE_CAP_TWO_SIDED_STENCIL,
+ PIPE_CAP_GLSL, /* XXX need something better */
+ PIPE_CAP_DUAL_SOURCE_BLEND,
+ PIPE_CAP_ANISOTROPIC_FILTER,
+ PIPE_CAP_POINT_SPRITE,
+ PIPE_CAP_MAX_RENDER_TARGETS,
+ PIPE_CAP_OCCLUSION_QUERY,
+ PIPE_CAP_TIMER_QUERY,
+ PIPE_CAP_TEXTURE_SHADOW_MAP,
+ PIPE_CAP_TEXTURE_SWIZZLE,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS,
+ PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
+ PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS,
+ PIPE_CAP_MAX_LINE_WIDTH,
+ PIPE_CAP_MAX_LINE_WIDTH_AA,
+ PIPE_CAP_MAX_POINT_WIDTH,
+ PIPE_CAP_MAX_POINT_WIDTH_AA,
+ PIPE_CAP_MAX_TEXTURE_ANISOTROPY,
+ PIPE_CAP_MAX_TEXTURE_LOD_BIAS,
+ PIPE_CAP_GUARD_BAND_LEFT, /*< float */
+ PIPE_CAP_GUARD_BAND_TOP, /*< float */
+ PIPE_CAP_GUARD_BAND_RIGHT, /*< float */
+ PIPE_CAP_GUARD_BAND_BOTTOM, /*< float */
+ PIPE_CAP_TEXTURE_MIRROR_CLAMP,
+ PIPE_CAP_TEXTURE_MIRROR_REPEAT,
+ PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS,
+ PIPE_CAP_BLEND_EQUATION_SEPARATE,
+ PIPE_CAP_SM3, /*< Shader Model, supported */
+ PIPE_CAP_STREAM_OUTPUT,
+ /** Maximum texture image units accessible from vertex and fragment shaders
+ * combined */
+ PIPE_CAP_MAX_COMBINED_SAMPLERS,
+ /** blend enables and write masks per rendertarget */
+ PIPE_CAP_INDEP_BLEND_ENABLE,
+ /** different blend funcs per rendertarget */
+ PIPE_CAP_INDEP_BLEND_FUNC,
+ PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE,
+ PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT,
+ PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
+ PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
+ PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
+ PIPE_CAP_DEPTH_CLAMP
+};
+/* Shader caps not specific to any single stage */
+enum pipe_shader_cap
+{
+ PIPE_SHADER_CAP_MAX_INSTRUCTIONS, /* if 0, it means the stage is unsupported */
+ PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS,
+ PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS,
+ PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS,
+ PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH,
+ PIPE_SHADER_CAP_MAX_INPUTS,
+ PIPE_SHADER_CAP_MAX_CONSTS,
+ PIPE_SHADER_CAP_MAX_CONST_BUFFERS,
+ PIPE_SHADER_CAP_MAX_TEMPS,
+ PIPE_SHADER_CAP_MAX_ADDRS,
+ PIPE_SHADER_CAP_MAX_PREDS,
+ PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED,
+};
/**
* Referenced query flags.
@@ -487,6 +516,19 @@ enum pipe_video_profile
PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
};
+/**
+ * Composite query types
+ */
+struct pipe_query_data_so_statistics
+{
+ uint64_t num_primitives_written;
+ uint64_t primitives_storage_needed;
+};
+struct pipe_query_data_timestamp_disjoint
+{
+ uint64_t frequency;
+ boolean disjoint;
+};
#ifdef __cplusplus
}
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 5ca27b3db28..240e349ba7e 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -29,8 +29,6 @@
#ifndef PIPE_FORMAT_H
#define PIPE_FORMAT_H
-#include "p_compiler.h"
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 919d1628d05..2f22ac22bbf 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -54,7 +54,6 @@ struct winsys_handle;
/** Opaque type */
struct pipe_fence_handle;
struct pipe_winsys;
-struct pipe_texture;
struct pipe_resource;
struct pipe_surface;
struct pipe_transfer;
@@ -79,13 +78,19 @@ struct pipe_screen {
* Query an integer-valued capability/parameter/limit
* \param param one of PIPE_CAP_x
*/
- int (*get_param)( struct pipe_screen *, int param );
+ 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 *, int param );
+ float (*get_paramf)( struct pipe_screen *, enum pipe_cap 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 );
struct pipe_context * (*context_create)( struct pipe_screen *,
void *priv );
@@ -104,7 +109,8 @@ struct pipe_screen {
boolean (*is_format_supported)( struct pipe_screen *,
enum pipe_format format,
enum pipe_texture_target target,
- unsigned bindings,
+ unsigned sample_count,
+ unsigned bindings,
unsigned geom_flags );
/**
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index e21aaacc18a..74488de17eb 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -33,8 +33,6 @@
extern "C" {
#endif
-#include "p_compiler.h"
-
struct tgsi_header
{
@@ -65,17 +63,18 @@ struct tgsi_token
};
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_LOOP =8,
- TGSI_FILE_PREDICATE =9,
- TGSI_FILE_SYSTEM_VALUE =10,
+ 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_IMMEDIATE_ARRAY =10,
+ TGSI_FILE_TEMPORARY_ARRAY =11,
TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
};
@@ -160,9 +159,9 @@ struct tgsi_declaration_semantic
struct tgsi_immediate
{
unsigned Type : 4; /**< TGSI_TOKEN_TYPE_IMMEDIATE */
- unsigned NrTokens : 8; /**< UINT */
+ unsigned NrTokens : 14; /**< UINT */
unsigned DataType : 4; /**< one of TGSI_IMM_x */
- unsigned Padding : 16;
+ unsigned Padding : 10;
};
union tgsi_immediate_data
@@ -174,7 +173,7 @@ union tgsi_immediate_data
#define TGSI_PROPERTY_GS_INPUT_PRIM 0
#define TGSI_PROPERTY_GS_OUTPUT_PRIM 1
-#define TGSI_PROPERTY_GS_MAX_VERTICES 2
+#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_COUNT 5
@@ -200,7 +199,7 @@ struct tgsi_property_data {
*
* For more information on semantics of opcodes and
* which APIs are known to use which opcodes, see
- * auxiliary/tgsi/tgsi-instruction-set.txt
+ * gallium/docs/source/tgsi.rst
*/
#define TGSI_OPCODE_ARL 0
#define TGSI_OPCODE_MOV 1
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index a504757c472..9a2b31da50d 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -43,7 +43,6 @@
#include "p_compiler.h"
#include "p_defines.h"
#include "p_format.h"
-#include "p_screen.h"
#ifdef __cplusplus
@@ -60,9 +59,11 @@ extern "C" {
#define PIPE_MAX_CONSTANT_BUFFERS 32
#define PIPE_MAX_SAMPLERS 16
#define PIPE_MAX_VERTEX_SAMPLERS 16
-#define PIPE_MAX_SHADER_INPUTS 16
-#define PIPE_MAX_SHADER_OUTPUTS 16
+#define PIPE_MAX_GEOMETRY_SAMPLERS 16
+#define PIPE_MAX_SHADER_INPUTS 32
+#define PIPE_MAX_SHADER_OUTPUTS 32
#define PIPE_MAX_TEXTURE_LEVELS 16
+#define PIPE_MAX_SO_BUFFERS 4
struct pipe_reference
@@ -79,12 +80,13 @@ struct pipe_rasterizer_state
{
unsigned flatshade:1;
unsigned light_twoside:1;
- unsigned front_winding:2; /**< PIPE_WINDING_x */
- unsigned cull_mode:2; /**< PIPE_WINDING_x */
- unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */
- unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */
- unsigned offset_cw:1;
- unsigned offset_ccw: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;
@@ -152,6 +154,7 @@ struct pipe_clip_state
{
float ucp[PIPE_MAX_CLIP_PLANES][4];
unsigned nr;
+ unsigned depth_clamp:1;
};
@@ -218,6 +221,8 @@ struct pipe_blend_state
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];
};
@@ -342,6 +347,21 @@ struct pipe_resource
unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */
};
+struct pipe_stream_output_state
+{
+ /**< number of the output buffer to insert each element into */
+ int output_buffer[PIPE_MAX_SHADER_OUTPUTS];
+ /**< which register to grab each output from */
+ int register_index[PIPE_MAX_SHADER_OUTPUTS];
+ /**< TGSI_WRITEMASK signifying which components to output */
+ ubyte register_mask[PIPE_MAX_SHADER_OUTPUTS];
+ /**< number of outputs */
+ int num_outputs;
+
+ /**< stride for an entire vertex, only used if all output_buffers
+ * are 0 */
+ unsigned stride;
+};
/**
* Extra indexing info for (cube) texture resources.
@@ -399,12 +419,47 @@ struct pipe_vertex_element
/** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
* this attribute live in?
*/
- unsigned vertex_buffer_index:8;
+ 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 */
+};
+
+
+/**
+ * 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 */
+};
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h
deleted file mode 100644
index 41a5713a776..00000000000
--- a/src/gallium/include/state_tracker/dri1_api.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef _DRI1_API_H_
-#define _DRI1_API_H_
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_format.h"
-
-#include "state_tracker/drm_api.h"
-
-struct pipe_screen;
-struct pipe_winsys;
-struct pipe_buffer;
-struct pipe_context;
-struct pipe_resource;
-
-struct drm_clip_rect;
-
-struct dri1_api_version
-{
- int major;
- int minor;
- int patch_level;
-};
-
-/**
- * This callback struct is intended for drivers that need to take
- * the hardware lock on command submission.
- */
-
-struct dri1_api_lock_funcs
-{
- void (*lock) (void *pipe_priv);
- void (*unlock) (void *locked_pipe_priv);
- boolean(*is_locked) (void *locked_pipe_priv);
- boolean(*is_lock_lost) (void *locked_pipe_priv);
- void (*clear_lost_lock) (void *locked_pipe_priv);
-};
-
-struct dri1_api
-{
- /**
- * For flushing to the front buffer. A driver should implement one and only
- * one of the functions below. The present_locked functions allows a dri1
- * driver to pageflip.
- */
-
- /*@{ */
-
- struct pipe_surface *(*front_srf_locked) (struct pipe_screen *
- locked_pipe);
-
- void (*present_locked) (struct pipe_context * locked_pipe,
- struct pipe_surface * surf,
- const struct drm_clip_rect * rect,
- unsigned int num_clip,
- int x_draw, int y_draw,
- const struct drm_clip_rect * src_bbox,
- struct pipe_fence_handle ** fence);
- /*@} */
-};
-
-struct dri1_create_screen_arg
-{
- struct drm_create_screen_arg base;
-
- struct dri1_api_lock_funcs *lf;
- void *ddx_info;
- int ddx_info_size;
- void *sarea;
-
- struct dri1_api_version ddx_version;
- struct dri1_api_version dri_version;
- struct dri1_api_version drm_version;
-
- /*
- * out parameters;
- */
-
- struct dri1_api *api;
-};
-
-#endif
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
deleted file mode 100644
index 75131307aad..00000000000
--- a/src/gallium/include/state_tracker/drm_api.h
+++ /dev/null
@@ -1,76 +0,0 @@
-
-#ifndef _DRM_API_H_
-#define _DRM_API_H_
-
-#include "pipe/p_compiler.h"
-
-struct pipe_screen;
-struct pipe_winsys;
-struct pipe_buffer;
-struct pipe_context;
-struct pipe_video_context;
-struct pipe_resource;
-
-enum drm_create_screen_mode {
- DRM_CREATE_NORMAL = 0,
- DRM_CREATE_DRI1,
- DRM_CREATE_DRIVER = 1024,
- DRM_CREATE_MAX
-};
-
-#define DRM_API_HANDLE_TYPE_SHARED 0
-#define DRM_API_HANDLE_TYPE_KMS 1
-
-/**
- * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
- */
-struct winsys_handle
-{
- /**
- * Unused for texture_from_handle, always
- * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle,
- * use TEXTURE_USAGE to select handle for kms or ipc.
- */
- unsigned type;
- /**
- * Input to texture_from_handle.
- * Output for texture_get_handle.
- */
- unsigned handle;
- /**
- * Input to texture_from_handle.
- * Output for texture_get_handle.
- */
- unsigned stride;
-};
-
-/**
- * Modes other than DRM_CREATE_NORMAL derive from this struct.
- */
-/*@{*/
-struct drm_create_screen_arg {
- enum drm_create_screen_mode mode;
-};
-/*@}*/
-
-struct drm_api
-{
- void (*destroy)(struct drm_api *api);
-
- const char *name;
-
- /**
- * Kernel driver name, as accepted by drmOpenByName.
- */
- const char *driver_name;
-
- /**
- * Create a pipe srcreen.
- */
- struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd,
- struct drm_create_screen_arg *arg);
-};
-
-extern struct drm_api * drm_api_create(void);
-
-#endif
diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h
new file mode 100644
index 00000000000..d94c1e6a7cf
--- /dev/null
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -0,0 +1,71 @@
+
+#ifndef _DRM_DRIVER_H_
+#define _DRM_DRIVER_H_
+
+#include "pipe/p_compiler.h"
+
+struct pipe_screen;
+struct pipe_winsys;
+struct pipe_context;
+struct pipe_resource;
+
+#define DRM_API_HANDLE_TYPE_SHARED 0
+#define DRM_API_HANDLE_TYPE_KMS 1
+
+/**
+ * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
+ */
+struct winsys_handle
+{
+ /**
+ * Unused for texture_from_handle, always
+ * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle,
+ * use TEXTURE_USAGE to select handle for kms or ipc.
+ */
+ unsigned type;
+ /**
+ * Input to texture_from_handle.
+ * Output for texture_get_handle.
+ */
+ unsigned handle;
+ /**
+ * Input to texture_from_handle.
+ * Output for texture_get_handle.
+ */
+ unsigned stride;
+};
+
+struct drm_driver_descriptor
+{
+ /**
+ * Identifying sufix/prefix of the binary, used by egl.
+ */
+ const char *name;
+
+ /**
+ * Kernel driver name, as accepted by drmOpenByName.
+ */
+ const char *driver_name;
+
+ /**
+ * Create a pipe srcreen.
+ *
+ * This function does any wrapping of the screen.
+ * For example wrapping trace or rbug debugging drivers around it.
+ */
+ struct pipe_screen* (*create_screen)(int drm_fd);
+};
+
+extern struct drm_driver_descriptor driver_descriptor;
+
+/**
+ * Instantiate a drm_driver_descriptor struct.
+ */
+#define DRM_DRIVER_DESCRIPTOR(name_str, driver_name_str, func) \
+struct drm_driver_descriptor driver_descriptor = { \
+ .name = name_str, \
+ .driver_name = driver_name_str, \
+ .create_screen = func, \
+};
+
+#endif
diff --git a/src/gallium/include/state_tracker/graw.h b/src/gallium/include/state_tracker/graw.h
index a58e18e4739..6a99b234aa5 100644
--- a/src/gallium/include/state_tracker/graw.h
+++ b/src/gallium/include/state_tracker/graw.h
@@ -1,3 +1,30 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
#ifndef GALLIUM_RAW_H
#define GALLIUM_RAW_H
@@ -14,23 +41,34 @@
* those for parsing text representations of TGSI shaders.
*/
+#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
struct pipe_screen;
-
-struct pipe_screen *graw_init( void );
+struct pipe_context;
/* Returns a handle to be used with flush_frontbuffer()/present().
*
* Query format support with screen::is_format_supported and usage
* XXX.
*/
-void *graw_create_window( int x,
- int y,
- unsigned width,
- unsigned height,
- enum pipe_format format );
+PUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
+ int y,
+ unsigned width,
+ unsigned height,
+ enum pipe_format format,
+ void **handle);
+
+PUBLIC void graw_set_display_func( void (*func)( void ) );
+PUBLIC void graw_main_loop( void );
+
+PUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
+ const char *text );
+
+PUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
+ const char *text );
-void graw_destroy_window( void *handle );
+PUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe,
+ const char *text );
#endif
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 002d1c6b840..21e2165ed9e 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -47,21 +47,36 @@
*/
enum st_api_type {
ST_API_OPENGL,
- ST_API_OPENGL_ES1,
- ST_API_OPENGL_ES2,
ST_API_OPENVG,
ST_API_COUNT
};
/**
+ * The profile of a context.
+ */
+enum st_profile_type
+{
+ ST_PROFILE_DEFAULT,
+ ST_PROFILE_OPENGL_CORE,
+ ST_PROFILE_OPENGL_ES1,
+ ST_PROFILE_OPENGL_ES2
+};
+
+/* for profile_mask in st_api */
+#define ST_PROFILE_DEFAULT_MASK (1 << ST_PROFILE_DEFAULT)
+#define ST_PROFILE_OPENGL_CORE_MASK (1 << ST_PROFILE_OPENGL_CORE)
+#define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1)
+#define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2)
+
+/**
* Used in st_context_iface->teximage.
*/
enum st_texture_type {
ST_TEXTURE_1D,
ST_TEXTURE_2D,
ST_TEXTURE_3D,
- ST_TEXTURE_RECT,
+ ST_TEXTURE_RECT
};
/**
@@ -102,7 +117,21 @@ enum st_context_resource_type {
ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Z,
ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
ST_CONTEXT_RESOURCE_OPENGL_RENDERBUFFER,
- ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE,
+ ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE
+};
+
+/**
+ * Value to st_manager->get_param function.
+ */
+enum st_manager_param {
+ /**
+ * The dri state tracker on old libGL's doesn't do the right thing
+ * with regards to invalidating the framebuffers.
+ *
+ * For the mesa state tracker that means that it needs to invalidate
+ * the framebuffer in glViewport itself.
+ */
+ ST_MANAGER_BROKEN_INVALIDATE
};
/**
@@ -132,10 +161,6 @@ struct st_context_resource
*/
struct st_egl_image
{
- /* these fields are filled by the caller */
- struct st_context_iface *stctxi;
- void *egl_image;
-
/* this is owned by the caller */
struct pipe_resource *texture;
@@ -170,6 +195,37 @@ struct st_visual
};
/**
+ * Represent the attributes of a context.
+ */
+struct st_context_attribs
+{
+ /**
+ * The profile and minimal version to support.
+ *
+ * The valid profiles and versions are rendering API dependent. The latest
+ * version satisfying the request should be returned, unless
+ * forward_compatiible is true.
+ */
+ enum st_profile_type profile;
+ int major, minor;
+
+ /**
+ * Enable debugging.
+ */
+ boolean debug;
+
+ /**
+ * Return the exact version and disallow the use of deprecated features.
+ */
+ boolean forward_compatible;
+
+ /**
+ * The visual of the framebuffers the context will be bound to.
+ */
+ struct st_visual visual;
+};
+
+/**
* Represent a windowing system drawable.
*
* The framebuffer is implemented by the state tracker manager and
@@ -315,10 +371,27 @@ struct st_manager
/**
* Look up and return the info of an EGLImage.
*
+ * This is used to implement for example EGLImageTargetTexture2DOES.
+ * The GLeglImageOES agrument of that call is passed directly to this
+ * function call and the information needed to access this is returned
+ * in the given struct out.
+ *
+ * @smapi: manager owning the caller context
+ * @stctx: caller context
+ * @egl_image: EGLImage that caller recived
+ * @out: return struct filled out with access information.
+ *
* This function is optional.
*/
boolean (*get_egl_image)(struct st_manager *smapi,
- struct st_egl_image *stimg);
+ void *egl_image,
+ struct st_egl_image *out);
+
+ /**
+ * Query an manager param.
+ */
+ int (*get_param)(struct st_manager *smapi,
+ enum st_manager_param param);
};
/**
@@ -329,6 +402,16 @@ struct st_manager
struct st_api
{
/**
+ * The supported rendering API.
+ */
+ enum st_api_type api;
+
+ /**
+ * The supported profiles. Tested with ST_PROFILE_*_MASK.
+ */
+ unsigned profile_mask;
+
+ /**
* Destroy the API.
*/
void (*destroy)(struct st_api *stapi);
@@ -341,23 +424,18 @@ struct st_api
st_proc_t (*get_proc_address)(struct st_api *stapi, const char *procname);
/**
- * Return true if the visual is supported by the state tracker.
- */
- boolean (*is_visual_supported)(struct st_api *stapi,
- const struct st_visual *visual);
-
- /**
* Create a rendering context.
*/
struct st_context_iface *(*create_context)(struct st_api *stapi,
struct st_manager *smapi,
- const struct st_visual *visual,
+ const struct st_context_attribs *attribs,
struct st_context_iface *stsharei);
/**
* Bind the context to the calling thread with draw and read as drawables.
*
- * The framebuffers might have different visuals than the context does.
+ * The framebuffers might be NULL, or might have different visuals than the
+ * context does.
*/
boolean (*make_current)(struct st_api *stapi,
struct st_context_iface *stctxi,
@@ -379,18 +457,4 @@ st_visual_have_buffers(const struct st_visual *visual, unsigned mask)
return ((visual->buffer_mask & mask) == mask);
}
-/* these symbols may need to be dynamically lookup up */
-extern PUBLIC struct st_api * st_api_create_OpenGL(void);
-extern PUBLIC struct st_api * st_api_create_OpenGL_ES1(void);
-extern PUBLIC struct st_api * st_api_create_OpenGL_ES2(void);
-extern PUBLIC struct st_api * st_api_create_OpenVG(void);
-
-/**
- * The entry points of the state trackers.
- */
-#define ST_CREATE_OPENGL_SYMBOL "st_api_create_OpenGL"
-#define ST_CREATE_OPENGL_ES1_SYMBOL "st_api_create_OpenGL_ES1"
-#define ST_CREATE_OPENGL_ES2_SYMBOL "st_api_create_OpenGL_ES2"
-#define ST_CREATE_OPENVG_SYMBOL "st_api_create_OpenVG"
-
#endif /* _ST_API_H_ */
diff --git a/src/gallium/include/state_tracker/sw_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h
index d461dedb90e..0b11fe3beb9 100644
--- a/src/gallium/include/state_tracker/sw_winsys.h
+++ b/src/gallium/include/state_tracker/sw_winsys.h
@@ -97,7 +97,7 @@ struct sw_winsys
*/
struct sw_displaytarget *
(*displaytarget_from_handle)( struct sw_winsys *ws,
- const struct pipe_resource *template,
+ const struct pipe_resource *templat,
struct winsys_handle *whandle,
unsigned *stride );
diff --git a/src/gallium/include/state_tracker/swrast_screen_create.h b/src/gallium/include/state_tracker/swrast_screen_create.h
new file mode 100644
index 00000000000..a08f83a3259
--- /dev/null
+++ b/src/gallium/include/state_tracker/swrast_screen_create.h
@@ -0,0 +1,67 @@
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "target-helpers/wrap_screen.h"
+
+struct sw_winsys;
+
+#ifdef GALLIUM_SOFTPIPE
+#include "softpipe/sp_public.h"
+#endif
+
+#ifdef GALLIUM_LLVMPIPE
+#include "llvmpipe/lp_public.h"
+#endif
+
+#ifdef GALLIUM_CELL
+#include "cell/ppu/cell_public.h"
+#endif
+
+/*
+ * Helper function to choose and instantiate one of the software rasterizers:
+ * cell, llvmpipe, softpipe.
+ *
+ * This function could be shared, but currently causes headaches for
+ * the build systems, particularly scons if we try. Long term, want
+ * to avoid having global #defines for things like GALLIUM_LLVMPIPE,
+ * GALLIUM_CELL, etc. Scons already eliminates those #defines, so
+ * things that are painful for it now are likely to be painful for
+ * other build systems in the future.
+ */
+
+static INLINE struct pipe_screen *
+swrast_screen_create(struct sw_winsys *winsys)
+{
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+
+#if defined(GALLIUM_CELL)
+ default_driver = "cell";
+#elif defined(GALLIUM_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(GALLIUM_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#if defined(GALLIUM_CELL)
+ if (screen == NULL && strcmp(driver, "cell") == 0)
+ screen = cell_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_LLVMPIPE)
+ if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
+ screen = llvmpipe_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_SOFTPIPE)
+ if (screen == NULL)
+ screen = softpipe_create_screen( winsys );
+#endif
+
+ return gallium_wrap_screen( screen );
+}
+