diff options
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 | 29 | ||||
-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 | 3 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/xlib_sw_winsys.h | 2 |
6 files changed, 82 insertions, 79 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 0e53aef6d2e..589cac2ddd3 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 dacabed891a..f5af15ff9ff 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, diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 912631242f5..850eb84a3c8 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 fc6dba346da..226ae8667b7 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 565a09614a4..1c2148b78f2 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; }; /** diff --git a/src/gallium/include/state_tracker/xlib_sw_winsys.h b/src/gallium/include/state_tracker/xlib_sw_winsys.h index f22c22bb620..4e7ccc13ac8 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(). |