Merge commit 'origin/master' into gallium-msaa
authorRoland Scheidegger <sroland@vmware.com>
Tue, 4 May 2010 13:58:29 +0000 (15:58 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Tue, 4 May 2010 13:58:29 +0000 (15:58 +0200)
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/cso_cache/cso_context.h
src/gallium/docs/source/context.rst
src/gallium/docs/source/screen.rst
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_state.h

index 75bf8d5..20a8612 100644 (file)
@@ -99,6 +99,7 @@ struct cso_context {
    struct pipe_framebuffer_state fb, fb_saved;
    struct pipe_viewport_state vp, vp_saved;
    struct pipe_blend_color blend_color;
+   unsigned sample_mask;
    struct pipe_stencil_ref stencil_ref, stencil_ref_saved;
 };
 
@@ -953,6 +954,16 @@ enum pipe_error cso_set_blend_color(struct cso_context *ctx,
    return PIPE_OK;
 }
 
+enum pipe_error cso_set_sample_mask(struct cso_context *ctx,
+                                    unsigned sample_mask)
+{
+   if (ctx->sample_mask != sample_mask) {
+      ctx->sample_mask = sample_mask;
+      ctx->pipe->set_sample_mask(ctx->pipe, sample_mask);
+   }
+   return PIPE_OK;
+}
+
 enum pipe_error cso_set_stencil_ref(struct cso_context *ctx,
                                     const struct pipe_stencil_ref *sr)
 {
index d6bcb1f..f0b07f7 100644 (file)
@@ -159,6 +159,8 @@ void cso_restore_viewport(struct cso_context *cso);
 enum pipe_error cso_set_blend_color(struct cso_context *cso,
                                     const struct pipe_blend_color *bc);
 
+enum pipe_error cso_set_sample_mask(struct cso_context *cso,
+                                    unsigned stencil_mask);
 
 enum pipe_error cso_set_stencil_ref(struct cso_context *cso,
                                     const struct pipe_stencil_ref *sr);
index c82e681..374711b 100644 (file)
@@ -54,6 +54,7 @@ objects. They all follow simple, one-method binding calls, e.g.
 * ``set_stencil_ref`` sets the stencil front and back reference values
   which are used as comparison values in stencil test.
 * ``set_blend_color``
+* ``set_sample_mask``
 * ``set_clip_state``
 * ``set_polygon_stipple``
 * ``set_scissor_state`` sets the bounds for the scissor test, which culls
@@ -255,15 +256,20 @@ Blitting
 These methods emulate classic blitter controls. They are not guaranteed to be
 available; if they are set to NULL, then they are not present.
 
-These methods operate directly on ``pipe_surface`` objects, and stand
+These methods operate directly on ``pipe_resource`` objects, and stand
 apart from any 3D state in the context.  Blitting functionality may be
 moved to a separate abstraction at some point in the future.
 
-``surface_fill`` performs a fill operation on a section of a surface.
+``resource_fill_region`` performs a fill operation on a section of a resource.
 
-``surface_copy`` blits a region of a surface to a region of another surface,
-provided that both surfaces are the same format. The source and destination
-may be the same surface, and overlapping blits are permitted.
+``resource_copy_region`` blits a region of a subresource of a resource to a
+region of another subresource of a resource, provided that both resources have the
+same format. The source and destination may be the same resource, and overlapping
+blits are permitted.
+
+``resource_resolve`` resolves a multisampled resource into a non-multisampled
+one. Formats and dimensions must match. This function must be present if a driver
+supports multisampling.
 
 The interfaces to these calls are likely to change to make it easier
 for a driver to batch multiple blits with the same source and
index c5815f8..2a8f696 100644 (file)
@@ -128,9 +128,6 @@ resources might be created and handled quite differently.
 * ``PIPE_BIND_VERTEX_BUFFER``: A vertex buffer.
 * ``PIPE_BIND_INDEX_BUFFER``: An vertex index/element buffer.
 * ``PIPE_BIND_CONSTANT_BUFFER``: A buffer of shader constants.
-* ``PIPE_BIND_BLIT_SOURCE``: A blit source, as given to surface_copy.
-* ``PIPE_BIND_BLIT_DESTINATION``: A blit destination, as given to surface_copy
-  and surface_fill.
 * ``PIPE_BIND_TRANSFER_WRITE``: A transfer object which will be written to.
 * ``PIPE_BIND_TRANSFER_READ``: A transfer object which will be read from.
 * ``PIPE_BIND_CUSTOM``:
@@ -223,6 +220,16 @@ Determine if a resource in the given format can be used in a specific manner.
 
 Returns TRUE if all usages can be satisfied.
 
+is_msaa_supported
+^^^^^^^^^^^^^^^^^
+
+Determine if a format supports multisampling with a given number of samples.
+
+**format** the resource format
+
+**sample_count** the number of samples. Valid query range is 2-32.
+
+Returns TRUE if sample_count number of samples is supported with this format.
 
 .. _resource_create:
 
index 6f47845..6ce8ba9 100644 (file)
@@ -198,6 +198,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 * );
 
@@ -233,32 +236,49 @@ struct pipe_context {
 
 
    /**
-    * 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.
+    * Fill a region of a resource with a constant value.
+    * Resources with nr_samples > 1 are not allowed.
     */
-   void (*surface_fill)(struct pipe_context *pipe,
-                       struct pipe_surface *dst,
-                       unsigned dstx, unsigned dsty,
-                       unsigned width, unsigned height,
-                       unsigned value);
+   void (*resource_fill_region)(struct pipe_context *pipe,
+                                struct pipe_resource *dst,
+                                struct pipe_subresource subdst,
+                                unsigned dstx, unsigned dsty, unsigned dstz,
+                                unsigned width, unsigned height,
+                                unsigned value);
+
+   /**
+    * Resolve a multisampled resource into a non-multisampled one.
+    * Source and destination must have the same size and same format.
+    */
+   void (*resource_resolve)(struct pipe_context *pipe,
+                            struct pipe_resource *dst,
+                            struct pipe_subresource subdst,
+                            struct pipe_resource *src,
+                            struct pipe_subresource subsrc);
+
    /*@}*/
 
    /**
index 1aa54f1..a852ad9 100644 (file)
@@ -284,8 +284,6 @@ 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 */
index beff1ae..1bad045 100644 (file)
@@ -99,10 +99,19 @@ struct pipe_screen {
    boolean (*is_format_supported)( struct pipe_screen *,
                                    enum pipe_format format,
                                    enum pipe_texture_target target,
-                                   unsigned bindings, 
+                                   unsigned bindings,
                                    unsigned geom_flags );
 
    /**
+    * Check if the given pipe_format is supported with a requested
+    * number of samples for msaa.
+    * \param sample_count number of samples for multisampling
+    */
+   boolean (*is_msaa_supported)( struct pipe_screen *,
+                                 enum pipe_format format,
+                                 unsigned sample_count );
+
+   /**
     * Create a new texture object, using the given template info.
     */
    struct pipe_resource * (*resource_create)(struct pipe_screen *,
index a504757..f9ad07d 100644 (file)
@@ -218,6 +218,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];
 };