diff options
author | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2010-12-19 21:46:33 +0100 |
---|---|---|
committer | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2010-12-19 21:46:33 +0100 |
commit | 0f68236a2487dbeb0396b996debcda595b0b54a1 (patch) | |
tree | 938ae3b779349b6dba6f5a891550604f9a9ca895 /src/gallium/include | |
parent | d047168d81cfeb39a98f3ae16416872facc6237c (diff) | |
parent | 237880463d5168cad8df0bae6018b5fd76617777 (diff) |
Merge remote branch 'origin/master' into nvc0-new
Diffstat (limited to 'src/gallium/include')
-rw-r--r-- | src/gallium/include/pipe/p_context.h | 56 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 30 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 17 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 54 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/st_api.h | 14 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/swrast_screen_create.h | 67 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/xlib_sw_winsys.h | 2 |
7 files changed, 94 insertions, 146 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 0e53aef6d2..589cac2ddd 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -54,7 +54,6 @@ 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; @@ -256,12 +255,11 @@ struct pipe_context { */ void (*resource_copy_region)(struct pipe_context *pipe, struct pipe_resource *dst, - struct pipe_subresource subdst, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - struct pipe_subresource subsrc, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height); + unsigned src_level, + const struct pipe_box *src_box); /** * Resolve a multisampled resource into a non-multisampled one. @@ -269,9 +267,9 @@ struct pipe_context { */ void (*resource_resolve)(struct pipe_context *pipe, struct pipe_resource *dst, - struct pipe_subresource subdst, + unsigned dst_layer, struct pipe_resource *src, - struct pipe_subresource subsrc); + unsigned src_layer); /*@}*/ @@ -328,13 +326,13 @@ struct pipe_context { * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE. * \param pipe context whose unflushed hw commands will be checked. * \param texture texture to check. - * \param face cubemap face. Use 0 for non-cubemap texture. * \param level mipmap level. + * \param layer cubemap face, 2d array or 3d slice, 0 otherwise. Use -1 for any layer. * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED */ unsigned int (*is_resource_referenced)(struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned face, unsigned level); + struct pipe_resource *texture, + unsigned level, int layer); /** * Create a view on a texture to be used by a shader stage. @@ -348,20 +346,32 @@ struct pipe_context { /** + * Get a surface which is a "view" into a resource, used by + * render target / depth stencil stages. + * \param usage bitmaks of PIPE_BIND_* flags + */ + 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 *); + + /** * Get a transfer object for transferring data to/from a texture. * * Transfers are (by default) context-private and allow uploads to be * interleaved with */ struct pipe_transfer *(*get_transfer)(struct pipe_context *, - struct pipe_resource *resource, - struct pipe_subresource, - unsigned usage, /* a combination of PIPE_TRANSFER_x */ - const struct pipe_box *); + struct pipe_resource *resource, + unsigned level, + unsigned usage, /* a combination of PIPE_TRANSFER_x */ + const struct pipe_box *); void (*transfer_destroy)(struct pipe_context *, - struct pipe_transfer *); - + struct pipe_transfer *); + void *(*transfer_map)( struct pipe_context *, struct pipe_transfer *transfer ); @@ -381,13 +391,13 @@ struct pipe_context { * pointer. XXX: strides?? */ void (*transfer_inline_write)( struct pipe_context *, - struct pipe_resource *, - struct pipe_subresource, - unsigned usage, /* a combination of PIPE_TRANSFER_x */ - const struct pipe_box *, - const void *data, - unsigned stride, - unsigned slice_stride); + 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); }; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 6cca301ccc..f5af15ff9f 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -138,12 +138,14 @@ enum pipe_error { /** 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_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_MAX_TEXTURE_TYPES }; @@ -178,14 +180,6 @@ enum pipe_texture_target { #define PIPE_TEX_COMPARE_NONE 0 #define PIPE_TEX_COMPARE_R_TO_TEXTURE 1 - -/** - * Surface layout -- a hint? Or some driver-internal poking out into - * the interface? - */ -#define PIPE_SURFACE_LAYOUT_LINEAR 0 - - /** * Clear buffer bits */ @@ -281,9 +275,9 @@ enum pipe_transfer_usage { * Resource binding flags -- state tracker must specify in advance all * the ways a resource might be used. */ -#define PIPE_BIND_DEPTH_STENCIL (1 << 0) /* get_tex_surface */ -#define PIPE_BIND_RENDER_TARGET (1 << 1) /* get_tex_surface */ -#define PIPE_BIND_SAMPLER_VIEW (1 << 2) /* get_sampler_view */ +#define PIPE_BIND_DEPTH_STENCIL (1 << 0) /* create_surface */ +#define PIPE_BIND_RENDER_TARGET (1 << 1) /* create_surface */ +#define PIPE_BIND_SAMPLER_VIEW (1 << 2) /* create_sampler_view */ #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 */ @@ -461,6 +455,7 @@ enum pipe_cap { /** different blend funcs per rendertarget */ PIPE_CAP_INDEP_BLEND_FUNC, PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE, + PIPE_CAP_ARRAY_TEXTURES, 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, @@ -489,6 +484,7 @@ enum pipe_shader_cap PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR, PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR, PIPE_SHADER_CAP_INDIRECT_CONST_ADDR, + PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */ }; /** diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 912631242f..850eb84a3c 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -117,7 +117,7 @@ struct pipe_screen { /** * Create a texture from a winsys_handle. The handle is often created in * another process by first creating a pipe texture and then calling - * texture_get_handle. + * resource_get_handle. */ struct pipe_resource * (*resource_from_handle)(struct pipe_screen *, const struct pipe_resource *templat, @@ -136,18 +136,6 @@ struct pipe_screen { void (*resource_destroy)(struct pipe_screen *, struct pipe_resource *pt); - /** Get a 2D surface which is a "view" into a texture - * \param usage bitmaks of PIPE_BIND_* flags - */ - struct pipe_surface *(*get_tex_surface)(struct pipe_screen *, - struct pipe_resource *resource, - unsigned face, unsigned level, - unsigned zslice, - unsigned usage ); - - void (*tex_surface_destroy)(struct pipe_surface *); - - /** * Create a buffer that wraps user-space data. @@ -182,7 +170,8 @@ struct pipe_screen { * gets out-of-band */ void (*flush_frontbuffer)( struct pipe_screen *screen, - struct pipe_surface *surf, + struct pipe_resource *resource, + unsigned level, unsigned layer, void *winsys_drawable_handle ); diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index fc6dba346d..226ae8667b 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -271,25 +271,33 @@ struct pipe_sampler_state /** - * 2D surface. This is basically a view into a memory buffer. - * May be a renderbuffer, texture mipmap level, etc. + * 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 view 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 layout; /**< PIPE_SURFACE_LAYOUT_x */ - unsigned offset; /**< offset from start of buffer, in bytes */ unsigned usage; /**< bitmask of PIPE_BIND_x */ - unsigned zslice; - unsigned face; - unsigned level; + union { + struct { + unsigned level; + unsigned first_layer:16; + unsigned last_layer:16; + } tex; + struct { + unsigned first_element; + unsigned last_element; + } buf; + } u; }; @@ -302,8 +310,18 @@ struct pipe_sampler_view 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 */ - unsigned first_level:8; /**< first mipmap level */ - unsigned last_level:8; /**< last mipmap level */ + 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 */ @@ -338,13 +356,14 @@ struct pipe_resource 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 */ + unsigned bind; /**< bitmask of PIPE_BIND_x */ + unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */ }; struct pipe_stream_output_state @@ -363,15 +382,6 @@ struct pipe_stream_output_state unsigned stride; }; -/** - * Extra indexing info for (cube) texture resources. - */ -struct pipe_subresource -{ - unsigned face:16; - unsigned level:16; -}; - /** * Transfer object. For data transfer to/from a resource. @@ -379,11 +389,11 @@ struct pipe_subresource struct pipe_transfer { struct pipe_resource *resource; /**< resource to transfer to/from */ - struct pipe_subresource sr; + unsigned level; enum pipe_transfer_usage usage; struct pipe_box box; unsigned stride; - unsigned slice_stride; + unsigned layer_stride; void *data; }; diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 21e2165ed9..1c2148b78f 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -164,9 +164,8 @@ struct st_egl_image /* this is owned by the caller */ struct pipe_resource *texture; - unsigned face; unsigned level; - unsigned zslice; + unsigned layer; }; /** @@ -349,6 +348,12 @@ struct st_context_iface struct st_context_iface *stsrci, unsigned mask); /** + * Used to implement wglShareLists. + */ + boolean (*share)(struct st_context_iface *stctxi, + struct st_context_iface *stsrci); + + /** * Look up and return the info of a resource for EGLImage. * * This function is optional. @@ -402,6 +407,11 @@ struct st_manager struct st_api { /** + * The name of the rendering API. This is informative. + */ + const char *name; + + /** * The supported rendering API. */ enum st_api_type api; diff --git a/src/gallium/include/state_tracker/swrast_screen_create.h b/src/gallium/include/state_tracker/swrast_screen_create.h deleted file mode 100644 index a08f83a325..0000000000 --- a/src/gallium/include/state_tracker/swrast_screen_create.h +++ /dev/null @@ -1,67 +0,0 @@ -#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 ); -} - diff --git a/src/gallium/include/state_tracker/xlib_sw_winsys.h b/src/gallium/include/state_tracker/xlib_sw_winsys.h index f22c22bb62..4e7ccc13ac 100644 --- a/src/gallium/include/state_tracker/xlib_sw_winsys.h +++ b/src/gallium/include/state_tracker/xlib_sw_winsys.h @@ -6,7 +6,7 @@ struct pipe_screen; -struct pipe_surface; +struct pipe_resource; /* This is what the xlib software winsys expects to find in the * "private" field of flush_frontbuffers(). |