diff options
Diffstat (limited to 'src/gallium/include/pipe')
-rw-r--r-- | src/gallium/include/pipe/p_compiler.h | 51 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_config.h | 15 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_context.h | 170 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 146 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_format.h | 2 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 14 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_shader_tokens.h | 33 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 75 |
8 files changed, 355 insertions, 151 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 |