Merge branch 'gallium-msaa'
authorRoland Scheidegger <sroland@vmware.com>
Fri, 21 May 2010 18:02:22 +0000 (20:02 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Fri, 21 May 2010 18:02:22 +0000 (20:02 +0200)
Conflicts:
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_texture.c

112 files changed:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/cso_cache/cso_context.h
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blit.h
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_caps.c
src/gallium/auxiliary/util/u_clear.h
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/auxiliary/util/u_surface.c
src/gallium/auxiliary/util/u_surface.h
src/gallium/docs/d3d11ddi.txt
src/gallium/docs/source/context.rst
src/gallium/docs/source/screen.rst
src/gallium/drivers/cell/ppu/cell_pipe_state.c
src/gallium/drivers/cell/ppu/cell_screen.c
src/gallium/drivers/cell/ppu/cell_surface.c
src/gallium/drivers/failover/fo_context.c
src/gallium/drivers/failover/fo_context.h
src/gallium/drivers/failover/fo_state.c
src/gallium/drivers/failover/fo_state_emit.c
src/gallium/drivers/i915/i915_blit.c
src/gallium/drivers/i915/i915_blit.h
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i915/i915_surface.c
src/gallium/drivers/i965/brw_pipe_depth.c
src/gallium/drivers/i965/brw_resource.c
src/gallium/drivers/i965/brw_resource.h
src/gallium/drivers/i965/brw_resource_texture.c
src/gallium/drivers/i965/brw_screen.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/identity/id_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_state_blend.c
src/gallium/drivers/llvmpipe/lp_surface.c
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/nv50/nv50_surface.c
src/gallium/drivers/nvfx/nv04_surface_2d.c
src/gallium/drivers/nvfx/nvfx_miptree.c
src/gallium/drivers/nvfx/nvfx_screen.c
src/gallium/drivers/nvfx/nvfx_state.c
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_blit.h
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/softpipe/sp_state_blend.c
src/gallium/drivers/softpipe/sp_surface.c
src/gallium/drivers/svga/svga_pipe_blit.c
src/gallium/drivers/svga/svga_pipe_depthstencil.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_screen.c
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
src/gallium/state_trackers/dri/common/dri1_helper.c
src/gallium/state_trackers/dri/common/dri_screen.c
src/gallium/state_trackers/dri/drm/dri1.c
src/gallium/state_trackers/egl/common/egl_g3d.c
src/gallium/state_trackers/egl/common/egl_g3d_api.c
src/gallium/state_trackers/egl/kms/native_kms.c
src/gallium/state_trackers/egl/x11/native_dri2.c
src/gallium/state_trackers/glx/xlib/xm_api.c
src/gallium/state_trackers/glx/xlib/xm_st.c
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/python/p_device.i
src/gallium/state_trackers/vega/image.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_manager.c
src/gallium/state_trackers/wgl/stw_pixelformat.c
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xorg/xorg_exa.h
src/gallium/state_trackers/xorg/xorg_renderer.c
src/gallium/tests/python/retrace/interpreter.py
src/gallium/tests/python/tests/surface_copy.py
src/gallium/tests/python/tests/texture_blit.py
src/gallium/tests/python/tests/texture_transfer.py
src/mesa/SConscript
src/mesa/sources.mak
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom.h
src/mesa/state_tracker/st_atom_blend.c
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_atom_msaa.c [new file with mode: 0644]
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_bufferobjects.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_eglimage.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_fbo.h
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_format.h
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_texture.c

index 75bf8d5d4074265209b3732f78797ea0659fe151..20a8612dcae7e3a403b91f049d7269565213f82f 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 d6bcb1fe8f761efa44d4b5f5844822187288703d..f0b07f7376564451dfda2067660370f588e9f9e1 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 f6f6e481d9467bd7341195c75881e674d574d51f..d4fbd658f40394af34fc650558feb3d95c66f908 100644 (file)
@@ -190,7 +190,6 @@ get_next_slot( struct blit_state *ctx )
    
    return ctx->vbuf_slot++ * sizeof ctx->vertices;
 }
-                               
 
 
 
@@ -277,10 +276,11 @@ regions_overlap(int srcX0, int srcY0,
  */
 void
 util_blit_pixels_writemask(struct blit_state *ctx,
-                           struct pipe_surface *src,
-                           struct pipe_sampler_view *src_sampler_view,
+                           struct pipe_resource *src_tex,
+                           struct pipe_subresource srcsub,
                            int srcX0, int srcY0,
                            int srcX1, int srcY1,
+                           int srcZ0,
                            struct pipe_surface *dst,
                            int dstX0, int dstY0,
                            int dstX1, int dstY1,
@@ -290,6 +290,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
    struct pipe_context *pipe = ctx->pipe;
    struct pipe_screen *screen = pipe->screen;
    struct pipe_sampler_view *sampler_view = NULL;
+   struct pipe_sampler_view sv_templ;
    struct pipe_framebuffer_state fb;
    const int srcW = abs(srcX1 - srcX0);
    const int srcH = abs(srcY1 - srcY0);
@@ -300,13 +301,13 @@ util_blit_pixels_writemask(struct blit_state *ctx,
    assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
           filter == PIPE_TEX_MIPFILTER_LINEAR);
 
-   assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
-   assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_RENDER_TARGET, 0));
+   assert(srcsub.level <= src_tex->last_level);
 
    /* do the regions overlap? */
-   overlap = util_same_surface(src, dst) &&
+   overlap = src_tex == dst->texture &&
+             dst->face == srcsub.face &&
+             dst->level == srcsub.level &&
+             dst->zslice == srcZ0 &&
       regions_overlap(srcX0, srcY0, srcX1, srcY1,
                       dstX0, dstY0, dstX1, dstY1);
 
@@ -315,8 +316,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
     * no overlapping.
     * Filter mode should not matter since there's no stretching.
     */
-   if (pipe->surface_copy &&
-       dst->format == src->format &&
+   if (dst->format == src_tex->format &&
        srcX0 < srcX1 &&
        dstX0 < dstX1 &&
        srcY0 < srcY1 &&
@@ -324,29 +324,36 @@ util_blit_pixels_writemask(struct blit_state *ctx,
        (dstX1 - dstX0) == (srcX1 - srcX0) &&
        (dstY1 - dstY0) == (srcY1 - srcY0) &&
        !overlap) {
-      pipe->surface_copy(pipe,
-                        dst, dstX0, dstY0, /* dest */
-                        src, srcX0, srcY0, /* src */
-                        srcW, srcH);       /* size */
+      struct pipe_subresource subdst;
+      subdst.face = dst->face;
+      subdst.level = dst->level;
+      pipe->resource_copy_region(pipe,
+                                 dst->texture, subdst,
+                                 dstX0, dstY0, dst->zslice,/* dest */
+                                 src_tex, srcsub,
+                                 srcX0, srcY0, srcZ0,/* src */
+                                 srcW, srcH);       /* size */
       return;
    }
-   
-   assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_RENDER_TARGET, 0));
+
 
    /* Create a temporary texture when src and dest alias or when src
-    * is anything other than a single-level 2d texture.
+    * is anything other than a 2d texture.
+    * XXX should just use appropriate shader to access 1d / 3d slice / cube face,
+    * much like the u_blitter code does (should be pretty trivial).
     * 
     * This can still be improved upon.
     */
-   if (util_same_surface(src, dst) ||
-       src->texture->target != PIPE_TEXTURE_2D ||
-       src->texture->last_level != 0)
+   if ((src_tex == dst->texture &&
+       dst->face == srcsub.face &&
+       dst->level == srcsub.level &&
+       dst->zslice == srcZ0) ||
+       src_tex->target != PIPE_TEXTURE_2D)
    {
       struct pipe_resource texTemp;
       struct pipe_resource *tex;
       struct pipe_sampler_view sv_templ;
-      struct pipe_surface *texSurf;
+      struct pipe_subresource texsub;
       const int srcLeft = MIN2(srcX0, srcX1);
       const int srcTop = MIN2(srcY0, srcY1);
 
@@ -367,7 +374,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
       /* create temp texture */
       memset(&texTemp, 0, sizeof(texTemp));
       texTemp.target = PIPE_TEXTURE_2D;
-      texTemp.format = src->format;
+      texTemp.format = src_tex->format;
       texTemp.last_level = 0;
       texTemp.width0 = srcW;
       texTemp.height0 = srcH;
@@ -378,49 +385,50 @@ util_blit_pixels_writemask(struct blit_state *ctx,
       if (!tex)
          return;
 
-      u_sampler_view_default_template(&sv_templ, tex, tex->format);
-
-      sampler_view = ctx->pipe->create_sampler_view(ctx->pipe, tex, &sv_templ);
-      if (!sampler_view) {
-         pipe_resource_reference(&tex, NULL);
-         return;
-      }
-
-      texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, 
-                                        PIPE_BIND_BLIT_DESTINATION);
-
+      texsub.face = 0;
+      texsub.level = 0;
       /* load temp texture */
-      if (pipe->surface_copy) {
-         pipe->surface_copy(pipe,
-                            texSurf, 0, 0,   /* dest */
-                            src, srcLeft, srcTop, /* src */
-                            srcW, srcH);     /* size */
-      } else {
-         util_surface_copy(pipe, FALSE,
-                           texSurf, 0, 0,   /* dest */
-                           src, srcLeft, srcTop, /* src */
-                           srcW, srcH);     /* size */
-      }
+      pipe->resource_copy_region(pipe,
+                                 tex, texsub, 0, 0, 0,  /* dest */
+                                 src_tex, srcsub, srcLeft, srcTop, srcZ0, /* src */
+                                 srcW, srcH);     /* size */
 
-      /* free the surface, update the texture if necessary.
-       */
-      pipe_surface_reference(&texSurf, NULL);
       s0 = 0.0f; 
       s1 = 1.0f;
       t0 = 0.0f;
       t1 = 1.0f;
 
+      u_sampler_view_default_template(&sv_templ, tex, tex->format);
+      sampler_view = pipe->create_sampler_view(pipe, tex, &sv_templ);
+
+      if (!sampler_view) {
+         pipe_resource_reference(&tex, NULL);
+         return;
+      }
       pipe_resource_reference(&tex, NULL);
    }
    else {
-      pipe_sampler_view_reference(&sampler_view, src_sampler_view);
-      s0 = srcX0 / (float)src->texture->width0;
-      s1 = srcX1 / (float)src->texture->width0;
-      t0 = srcY0 / (float)src->texture->height0;
-      t1 = srcY1 / (float)src->texture->height0;
+      u_sampler_view_default_template(&sv_templ, src_tex, src_tex->format);
+      sv_templ.first_level = sv_templ.last_level = srcsub.level;
+      sampler_view = pipe->create_sampler_view(pipe, src_tex, &sv_templ);
+
+      if (!sampler_view) {
+         return;
+      }
+
+      s0 = srcX0 / (float)(u_minify(sampler_view->texture->width0, srcsub.level));
+      s1 = srcX1 / (float)(u_minify(sampler_view->texture->width0, srcsub.level));
+      t0 = srcY0 / (float)(u_minify(sampler_view->texture->height0, srcsub.level));
+      t1 = srcY1 / (float)(u_minify(sampler_view->texture->height0, srcsub.level));
    }
 
-   
+
+   assert(screen->is_format_supported(screen, sampler_view->format, PIPE_TEXTURE_2D,
+                                      sampler_view->texture->nr_samples,
+                                      PIPE_BIND_SAMPLER_VIEW, 0));
+   assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
+                                      dst->texture->nr_samples,
+                                      PIPE_BIND_RENDER_TARGET, 0));
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
@@ -445,6 +453,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
    /* sampler */
    ctx->sampler.min_img_filter = filter;
    ctx->sampler.mag_img_filter = filter;
+   /* we've limited this already with the sampler view but you never know... */
+   ctx->sampler.min_lod = srcsub.level;
+   ctx->sampler.max_lod = srcsub.level;
    cso_single_sampler(ctx->cso, 0, &ctx->sampler);
    cso_single_sampler_done(ctx->cso);
 
@@ -513,18 +524,21 @@ util_blit_pixels_writemask(struct blit_state *ctx,
 
 void
 util_blit_pixels(struct blit_state *ctx,
-                 struct pipe_surface *src,
-                 struct pipe_sampler_view *src_sampler_view,
+                 struct pipe_resource *src_tex,
+                 struct pipe_subresource srcsub,
                  int srcX0, int srcY0,
                  int srcX1, int srcY1,
+                 int srcZ,
                  struct pipe_surface *dst,
                  int dstX0, int dstY0,
                  int dstX1, int dstY1,
                  float z, uint filter )
 {
-   util_blit_pixels_writemask( ctx, src, src_sampler_view,
+   util_blit_pixels_writemask( ctx, src_tex,
+                               srcsub,
                                srcX0, srcY0,
                                srcX1, srcY1,
+                               srcZ,
                                dst,
                                dstX0, dstY0,
                                dstX1, dstY1,
@@ -546,7 +560,6 @@ void util_blit_flush( struct blit_state *ctx )
 
 /**
  * Copy pixel block from src texture to dst surface.
- * Overlapping regions are acceptable.
  *
  * XXX Should support selection of level.
  * XXX need some control over blitting Z and/or stencil.
@@ -580,6 +593,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
 
    assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
                                                  PIPE_TEXTURE_2D,
+                                                 dst->texture->nr_samples,
                                                  PIPE_BIND_RENDER_TARGET,
                                                  0));
 
index 464ff9aaced628f7664e7440b2870758188b111c..ef95134f3248ad570bfed407cb75360175af78ae 100644 (file)
@@ -52,10 +52,11 @@ util_destroy_blit(struct blit_state *ctx);
 
 extern void
 util_blit_pixels(struct blit_state *ctx,
-                 struct pipe_surface *src,
-                 struct pipe_sampler_view *src_sampler_view,
+                 struct pipe_resource *src_tex,
+                 struct pipe_subresource srcsub,
                  int srcX0, int srcY0,
                  int srcX1, int srcY1,
+                 int srcZ0,
                  struct pipe_surface *dst,
                  int dstX0, int dstY0,
                  int dstX1, int dstY1,
@@ -63,10 +64,11 @@ util_blit_pixels(struct blit_state *ctx,
 
 void
 util_blit_pixels_writemask(struct blit_state *ctx,
-                           struct pipe_surface *src,
-                           struct pipe_sampler_view *src_sampler_view,
+                           struct pipe_resource *src_tex,
+                           struct pipe_subresource srcsub,
                            int srcX0, int srcY0,
                            int srcX1, int srcY1,
+                           int srcZ0,
                            struct pipe_surface *dst,
                            int dstX0, int dstY0,
                            int dstX1, int dstY1,
index 3a7c4db6f3445aac7ddbc4f69e48758e8cf3438c..e0bd89154cb1883ded0a8bd83adfe5df6028cc8f 100644 (file)
@@ -26,8 +26,8 @@
 
 /**
  * @file
- * Blitter utility to facilitate acceleration of the clear, surface_copy,
- * and surface_fill functions.
+ * Blitter utility to facilitate acceleration of the clear, resource_copy_region,
+ * and resource_fill_region functions.
  *
  * @author Marek Olšák
  */
@@ -709,53 +709,6 @@ static void util_blitter_do_copy(struct blitter_context *blitter,
 
 }
 
-static void util_blitter_overlap_copy(struct blitter_context *blitter,
-                                     struct pipe_surface *dst,
-                                     unsigned dstx, unsigned dsty,
-                                     struct pipe_surface *src,
-                                     unsigned srcx, unsigned srcy,
-                                     unsigned width, unsigned height)
-{
-   struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
-   struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
-
-   struct pipe_resource texTemp;
-   struct pipe_resource *texture;
-   struct pipe_surface *tex_surf;
-
-   /* check whether the states are properly saved */
-   blitter_check_saved_CSOs(ctx);
-
-   memset(&texTemp, 0, sizeof(texTemp));
-   texTemp.target = PIPE_TEXTURE_2D;
-   texTemp.format = dst->texture->format; /* XXX verify supported by driver! */
-   texTemp.last_level = 0;
-   texTemp.width0 = width;
-   texTemp.height0 = height;
-   texTemp.depth0 = 1;
-
-   texture = screen->resource_create(screen, &texTemp);
-   if (!texture)
-      return;
-
-   tex_surf = screen->get_tex_surface(screen, texture, 0, 0, 0,
-                                     PIPE_BIND_BLIT_SOURCE | 
-                                     PIPE_BIND_BLIT_DESTINATION);
-
-   /* blit from the src to the temp */
-   util_blitter_do_copy(blitter, tex_surf, 0, 0,
-                       src, srcx, srcy,
-                       width, height,
-                       FALSE);
-   util_blitter_do_copy(blitter, dst, dstx, dsty,
-                       tex_surf, 0, 0,
-                       width, height,
-                       FALSE);
-   pipe_surface_reference(&tex_surf, NULL);
-   pipe_resource_reference(&texture, NULL);
-   blitter_restore_CSOs(ctx);
-}
 
 void util_blitter_copy(struct blitter_context *blitter,
                        struct pipe_surface *dst,
@@ -777,14 +730,10 @@ void util_blitter_copy(struct blitter_context *blitter,
       return;
 
    if (dst->texture == src->texture) {
-      if (is_overlap(srcx, srcx + width, srcy, srcy + height,
-                            dstx, dstx + width, dsty, dsty + height)) {
-         util_blitter_overlap_copy(blitter, dst, dstx, dsty, src, srcx, srcy,
-                                   width, height);
-         return;
-      }
+      assert(!is_overlap(srcx, srcx + width, srcy, srcy + height,
+             dstx, dstx + width, dsty, dsty + height));
    }
-                  
+
    is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
    is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0;
    dst_tex_usage = is_depth || is_stencil ? PIPE_BIND_DEPTH_STENCIL :
@@ -794,11 +743,17 @@ void util_blitter_copy(struct blitter_context *blitter,
    /* (assuming copying a stencil buffer is not possible) */
    if ((!ignore_stencil && is_stencil) ||
        !screen->is_format_supported(screen, dst->format, dst->texture->target,
-                                    dst_tex_usage, 0) ||
+                                    dst->texture->nr_samples, dst_tex_usage, 0) ||
        !screen->is_format_supported(screen, src->format, src->texture->target,
-                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
-      util_surface_copy(pipe, FALSE, dst, dstx, dsty, src, srcx, srcy,
-                        width, height);
+                                    src->texture->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)) {
+      struct pipe_subresource subdst, subsrc;
+      subdst.face = dst->face;
+      subdst.level = dst->level;
+      subsrc.face = src->face;
+      subsrc.level = src->level;
+      util_resource_copy_region(pipe, dst->texture, subdst, dstx, dsty, dst->zslice,
+                                src->texture, subsrc, srcx, srcy, src->zslice,
+                                width, height);
       return;
    }
 
@@ -833,8 +788,13 @@ void util_blitter_fill(struct blitter_context *blitter,
    /* check if we can render to the surface */
    if (util_format_is_depth_or_stencil(dst->format) || /* unlikely, but you never know */
        !screen->is_format_supported(screen, dst->format, dst->texture->target,
+                                    dst->texture->nr_samples,
                                     PIPE_BIND_RENDER_TARGET, 0)) {
-      util_surface_fill(pipe, dst, dstx, dsty, width, height, value);
+      struct pipe_subresource subdst;
+      subdst.face = dst->face;
+      subdst.level = dst->level;
+      util_resource_fill_region(pipe, dst->texture, subdst, dstx, dsty,
+                                dst->zslice, width, height, value);
       return;
    }
 
index c7c1e830e013ee0a3e660f4bd2a268f92db57b0d..294ee37033d65499df0a3bcd690450e340166561 100644 (file)
@@ -68,6 +68,7 @@ util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out)
          if (!screen->is_format_supported(screen,
                                           list[i++],
                                           PIPE_TEXTURE_2D,
+                                          0,
                                           PIPE_BIND_SAMPLER_VIEW,
                                           0)) {
             *out = i - 2;
index 40da2d75a724405a85b9d6cce944172e6cac819f..31f7fb2169a46e24de6e9a7ad66bba0866a7214f 100644 (file)
@@ -47,25 +47,24 @@ util_clear(struct pipe_context *pipe,
 {
    if (buffers & PIPE_CLEAR_COLOR) {
       struct pipe_surface *ps = framebuffer->cbufs[0];
+      struct pipe_subresource subdst;
       union util_color uc;
 
+      subdst.face = ps->face;
+      subdst.level = ps->level;
       util_pack_color(rgba, ps->format, &uc);
-      if (pipe->surface_fill) {
-         pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
-      } else {
-         util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
-      }
+      pipe->resource_fill_region(pipe, ps->texture, subdst, 0, 0, ps->zslice,
+                                 ps->width, ps->height, uc.ui);
    }
 
    if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
       struct pipe_surface *ps = framebuffer->zsbuf;
+      struct pipe_subresource subdst;
 
-      if (pipe->surface_fill) {
-         pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
-                            util_pack_z_stencil(ps->format, depth, stencil));
-      } else {
-         util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
-                           util_pack_z_stencil(ps->format, depth, stencil));
-      }
+      subdst.face = ps->face;
+      subdst.level = ps->level;
+      pipe->resource_fill_region(pipe, ps->texture, subdst, 0, 0, ps->zslice,
+                                 ps->width, ps->height,
+                                 util_pack_z_stencil(ps->format, depth, stencil));
    }
 }
index 1553e08d6cec9b3b02cca4c582bb93f2131fc7af..d19267be72fd932adc015a63ffe6d6c85067a91a 100644 (file)
@@ -1493,7 +1493,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
 
    /* check if we can render in the texture's format */
    if (!screen->is_format_supported(screen, psv->format, PIPE_TEXTURE_2D,
-                                    PIPE_BIND_RENDER_TARGET, 0)) {
+                                    pt->nr_samples, PIPE_BIND_RENDER_TARGET, 0)) {
       fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
       return;
    }
index 377c48c026602200f84f5f76a1c928488e938fd5..9adf22c471e86f740313aa25fcdd98557f511e36 100644 (file)
@@ -69,7 +69,7 @@ util_create_rgba_surface(struct pipe_screen *screen,
    /* Choose surface format */
    for (i = 0; rgbaFormats[i]; i++) {
       if (screen->is_format_supported(screen, rgbaFormats[i],
-                                      target, bind, 0)) {
+                                      target, 0, bind, 0)) {
          format = rgbaFormats[i];
          break;
       }
@@ -119,44 +119,44 @@ util_destroy_rgba_surface(struct pipe_resource *texture,
 
 
 /**
- * Fallback function for pipe->surface_copy().
+ * Fallback function for pipe->resource_copy_region().
  * Note: (X,Y)=(0,0) is always the upper-left corner.
- * if do_flip, flip the image vertically on its way from src rect to dst rect.
  */
 void
-util_surface_copy(struct pipe_context *pipe,
-                  boolean do_flip,
-                  struct pipe_surface *dst,
-                  unsigned dst_x, unsigned dst_y,
-                  struct pipe_surface *src,
-                  unsigned src_x, unsigned src_y, 
-                  unsigned w, unsigned h)
+util_resource_copy_region(struct pipe_context *pipe,
+                          struct pipe_resource *dst,
+                          struct pipe_subresource subdst,
+                          unsigned dst_x, unsigned dst_y, unsigned dst_z,
+                          struct pipe_resource *src,
+                          struct pipe_subresource subsrc,
+                          unsigned src_x, unsigned src_y, unsigned src_z,
+                          unsigned w, unsigned h)
 {
    struct pipe_transfer *src_trans, *dst_trans;
    void *dst_map;
    const void *src_map;
    enum pipe_format src_format, dst_format;
 
-   assert(src->texture && dst->texture);
-   if (!src->texture || !dst->texture)
+   assert(src && dst);
+   if (!src || !dst)
       return;
 
-   src_format = src->texture->format;
-   dst_format = dst->texture->format;
+   src_format = src->format;
+   dst_format = dst->format;
 
    src_trans = pipe_get_transfer(pipe,
-                                src->texture,
-                                src->face,
-                                src->level,
-                                src->zslice,
+                                src,
+                                subsrc.face,
+                                subsrc.level,
+                                src_z,
                                 PIPE_TRANSFER_READ,
                                 src_x, src_y, w, h);
 
    dst_trans = pipe_get_transfer(pipe,
-                                dst->texture,
-                                dst->face,
-                                dst->level,
-                                dst->zslice,
+                                dst,
+                                subdst.face,
+                                subdst.level,
+                                src_z,
                                 PIPE_TRANSFER_WRITE,
                                 dst_x, dst_y, w, h);
 
@@ -171,16 +171,15 @@ util_surface_copy(struct pipe_context *pipe,
    assert(dst_map);
 
    if (src_map && dst_map) {
-      /* If do_flip, invert src_y position and pass negative src stride */
       util_copy_rect(dst_map,
                      dst_format,
                      dst_trans->stride,
                      0, 0,
                      w, h,
                      src_map,
-                     do_flip ? -(int) src_trans->stride : src_trans->stride,
+                     src_trans->stride,
                      0,
-                     do_flip ? h - 1 : 0);
+                     0);
    }
 
    pipe->transfer_unmap(pipe, src_trans);
@@ -196,25 +195,26 @@ util_surface_copy(struct pipe_context *pipe,
 
 
 /**
- * Fallback for pipe->surface_fill() function.
+ * Fallback for pipe->resource_fill_region() function.
  */
 void
-util_surface_fill(struct pipe_context *pipe,
-                  struct pipe_surface *dst,
-                  unsigned dstx, unsigned dsty,
-                  unsigned width, unsigned height, unsigned value)
+util_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)
 {
    struct pipe_transfer *dst_trans;
    void *dst_map;
 
-   assert(dst->texture);
-   if (!dst->texture)
+   assert(dst);
+   if (!dst)
       return;
    dst_trans = pipe_get_transfer(pipe,
-                                dst->texture,
-                                dst->face,
-                                dst->level,
-                                dst->zslice,
+                                dst,
+                                subdst.face,
+                                subdst.level,
+                                dstz,
                                 PIPE_TRANSFER_WRITE,
                                 dstx, dsty, width, height);
 
@@ -225,11 +225,11 @@ util_surface_fill(struct pipe_context *pipe,
    if (dst_map) {
       assert(dst_trans->stride > 0);
 
-      switch (util_format_get_blocksize(dst->texture->format)) {
+      switch (util_format_get_blocksize(dst->format)) {
       case 1:
       case 2:
       case 4:
-         util_fill_rect(dst_map, dst->texture->format,
+         util_fill_rect(dst_map, dst->format,
                        dst_trans->stride,
                         0, 0, width, height, value);
          break;
index c43169b5278552ddc2b19ff81b28288f0e068710..ccde738ca409bd1cdb8e1885d3222b5bf48d2d10 100644 (file)
 #include "pipe/p_state.h"
 
 
-/**
- * Are s1 and s2 the same surface?
- * Surfaces are basically views into textures so check if the two surfaces
- * name the same part of the same texture.
- */
-static INLINE boolean
-util_same_surface(const struct pipe_surface *s1, const struct pipe_surface *s2)
-{
-   return (s1->texture == s2->texture &&
-           s1->face == s2->face &&
-           s1->level == s2->level &&
-           s1->zslice == s2->zslice);
-}
-
-
-
-
 extern boolean
 util_create_rgba_surface(struct pipe_screen *screen,
                          uint width, uint height, uint bind,
@@ -64,19 +47,21 @@ util_destroy_rgba_surface(struct pipe_resource *texture,
 
 
 extern void
-util_surface_copy(struct pipe_context *pipe,
-                  boolean do_flip,
-                  struct pipe_surface *dst,
-                  unsigned dst_x, unsigned dst_y,
-                  struct pipe_surface *src,
-                  unsigned src_x, unsigned src_y, 
-                  unsigned w, unsigned h);
+util_resource_copy_region(struct pipe_context *pipe,
+                          struct pipe_resource *dst,
+                          struct pipe_subresource subdst,
+                          unsigned dst_x, unsigned dst_y, unsigned dst_z,
+                          struct pipe_resource *src,
+                          struct pipe_subresource subsrc,
+                          unsigned src_x, unsigned src_y, unsigned src_z,
+                          unsigned w, unsigned h);
 
 extern void
-util_surface_fill(struct pipe_context *pipe,
-                  struct pipe_surface *dst,
-                  unsigned dstx, unsigned dsty,
-                  unsigned width, unsigned height, unsigned value);
+util_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);
 
 
 
index 8f2509ce035ab4ad2f8e3806fd3752469ffb5ae1..d9c2b441a943f01e1e8546169098d6591f426f7b 100644 (file)
@@ -79,7 +79,7 @@ set_clip_state
 set_polygon_stipple
        + Gallium supports polygon stipple
 
-surface_fill
+resource_fill_region
        + Gallium supports subrectangle fills of surfaces, D3D10 only supports full clears of views
 
 * DirectX 10/11 DDI functions and Gallium equivalents
@@ -114,11 +114,10 @@ CheckDeferredContextHandleSizes (D3D11 only)
 CheckFormatSupport -> screen->is_format_supported
        ! Gallium passes usages to this function, D3D11 returns them
        - Gallium does not differentiate between blendable and non-blendable render targets
-       - Gallium lacks multisampled-texture and multisampled-render-target usages
+       ! Gallium includes sample count directly, D3D11 uses additional query 
 
 CheckMultisampleQualityLevels
-       * could merge this with is_format_supported
-       - Gallium lacks multisampling support
+       ! is merged with is_format_supported
 
 CommandListExecute (D3D11 only)
        - Gallium does not support command lists
@@ -139,7 +138,6 @@ ClearUnorderedAccessViewUint (D3D11 only)
 
 CreateBlendState (extended in D3D10.1) -> create_blend_state
        # D3D10 does not support per-RT blend modes (but per-RT blending), only D3D10.1 does
-       - Gallium lacks alpha-to-coverage
        + Gallium supports logic ops
        + Gallium supports dithering
        + Gallium supports using the broadcast alpha component of the blend constant color
@@ -198,7 +196,6 @@ CreateQuery -> create_query
 CreateRasterizerState
        - Gallium lacks clamping of polygon offset depth biases
        - Gallium lacks support to disable depth clipping
-       - Gallium lacks multisampling
        + Gallium, like OpenGL, supports PIPE_POLYGON_MODE_POINT
        + Gallium, like OpenGL, supports per-face polygon fill modes
        + Gallium, like OpenGL, supports culling everything
@@ -228,7 +225,6 @@ CreateResource -> texture_create or buffer_create
        ! D3D11 specifies mapping flags (i.e. read/write/discard);:it's unclear what they are used for here
        - D3D11 supports odd things in the D3D10_DDI_RESOURCE_MISC_FLAG enum (D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT, D3D11_DDI_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS, D3D11_DDI_RESOURCE_MISC_BUFFER_STRUCTURED)
        - Gallium does not support indirect draw call parameter buffers
-       - Gallium lacks multisampling
        - Gallium lacks array textures
        ! D3D11 supports specifying hardware modes and other stuff here for scanout resources
        + Gallium allows specifying minimum buffer alignment
@@ -400,7 +396,7 @@ ResourceCopy
 ResourceCopyRegion
 ResourceConvert (D3D10.1+ only)
 ResourceConvertRegion (D3D10.1+ only)
-       -> surface_copy
+       -> resource_copy_region
        - Gallium does not support hardware buffer copies
        - Gallium does not support copying 3D texture subregions in a single call
 
@@ -410,8 +406,7 @@ ResourceIsStagingBusy -> is_texture_referenced, is_buffer_referenced
 ResourceReadAfterWriteHazard
        ! Gallium specifies hides this, except for the render and texture caches
 
-ResourceResolveSubresource
-       - Gallium does not support multisample sample resolution
+ResourceResolveSubresource -> resource_resolve
 
 ResourceMap
 ResourceUnmap
@@ -433,9 +428,8 @@ StagingResourceUnmap
 ResourceUpdateSubresourceUP -> transfer functionality, transfer_inline_write in gallium-resources
 DefaultConstantBufferUpdateSubresourceUP -> transfer functionality, transfer_inline_write in gallium-resources
 
-SetBlendState -> bind_blend_state and set_blend_color
-       ! D3D11 fuses bind_blend_state and set_blend_color in a single function
-       - Gallium lacks the sample mask
+SetBlendState -> bind_blend_state, set_blend_color and set_sample_mask
+       ! D3D11 fuses bind_blend_state, set_blend_color and set_sample_mask in a single function
 
 SetDepthStencilState -> bind_depth_stencil_alpha_state and set_stencil_ref
        ! D3D11 fuses bind_depth_stencil_alpha_state and set_stencil_ref in a single function
index ec358e34545c31b50a7526dada590b00829db88e..89c02b1b703c3467be66405e83ee60b95dba4248 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
@@ -259,18 +260,22 @@ Resource Busy Queries
 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 emulate classic blitter controls.
 
-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, but overlapping
+blits are not 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 96257f93df9161b953fcb975964249ea03498876..48d9d570b6fcfc9f581e071634786c90e8a4bf23 100644 (file)
@@ -147,9 +147,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``:
@@ -236,13 +233,15 @@ Determine if a resource in the given format can be used in a specific manner.
 
 **target** one of the PIPE_TEXTURE_x flags
 
+**sample_count** the number of samples. 0 and 1 mean no multisampling,
+the maximum allowed legal value is 32.
+
 **bindings** is a bitmask of :ref:`PIPE_BIND` flags.
 
 **geom_flags** is a bitmask of PIPE_TEXTURE_GEOM_x flags.
 
 Returns TRUE if all usages can be satisfied.
 
-
 .. _resource_create:
 
 resource_create
index f4c614eef950073ac4e729fcdc2a7b213a9e9f1b..03f84d295b50b63a0cd7d63719807e3ced435fdf 100644 (file)
@@ -125,6 +125,7 @@ cell_set_stencil_ref(struct pipe_context *pipe,
    cell->dirty |= CELL_NEW_DEPTH_STENCIL;
 }
 
+
 static void
 cell_set_clip_state(struct pipe_context *pipe,
                     const struct pipe_clip_state *clip)
@@ -136,6 +137,12 @@ cell_set_clip_state(struct pipe_context *pipe,
 }
 
 
+static void
+cell_set_sample_mask(struct pipe_context *pipe,
+                     unsigned sample_mask)
+{
+}
+
 
 /* Called when driver state tracker notices changes to the viewport
  * matrix:
@@ -430,7 +437,6 @@ cell_set_framebuffer_state(struct pipe_context *pipe,
 }
 
 
-
 void
 cell_init_state_functions(struct cell_context *cell)
 {
@@ -457,6 +463,7 @@ cell_init_state_functions(struct cell_context *cell)
    cell->pipe.set_blend_color = cell_set_blend_color;
    cell->pipe.set_stencil_ref = cell_set_stencil_ref;
    cell->pipe.set_clip_state = cell_set_clip_state;
+   cell->pipe.set_sample_mask = cell_set_sample_mask;
 
    cell->pipe.set_framebuffer_state = cell_set_framebuffer_state;
 
index 750f0aa98ab1add428d876fc9b2e8e4218bf24cd..0f12e0667eb93e28512f048c63674de5b67b08c3 100644 (file)
@@ -134,13 +134,17 @@ cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
 
 static boolean
 cell_is_format_supported( struct pipe_screen *screen,
-                          enum pipe_format format, 
+                          enum pipe_format format,
                           enum pipe_texture_target target,
-                          unsigned tex_usage, 
+                          unsigned sample_count,
+                          unsigned tex_usage,
                           unsigned geom_flags )
 {
    struct sw_winsys *winsys = cell_screen(screen)->winsys;
 
+   if (sample_count > 1)
+      return FALSE;
+
    if (tex_usage & (PIPE_BIND_DISPLAY_TARGET |
                     PIPE_BIND_SCANOUT |
                     PIPE_BIND_SHARED)) {
index 6696a4591c1adb5fddeaf097aca23688bd8ff338..8000eee88a3d817f661a2ca04ce2b3d250348f87 100644 (file)
 #include "cell_surface.h"
 
 
-static void
-cell_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)
-{
-   util_surface_copy(pipe, FALSE,
-                     dest, destx, desty,
-                     src, srcx, srcy,
-                     width, height);
-}
-
 void
 cell_init_surface_functions(struct cell_context *cell)
 {
-   cell->pipe.surface_copy = cell_surface_copy;
-   cell->pipe.surface_fill = util_surface_fill;
+   cell->pipe.resource_copy_region = util_resource_copy_region;
+   cell->pipe.resource_fill_region = util_resource_fill_region;
 }
index 9515cd8938c5d76449c6b02889870bb036561f25..2246c1468ca9b1e2277393b85b0f4cc38bd0c8a5 100644 (file)
@@ -156,8 +156,8 @@ struct pipe_context *failover_create( struct pipe_context *hw,
 
    failover_init_state_functions( failover );
 
-   failover->pipe.surface_copy = hw->surface_copy;
-   failover->pipe.surface_fill = hw->surface_fill;
+   failover->pipe.resource_copy_region = hw->resource_copy_region;
+   failover->pipe.resource_fill_region = hw->resource_fill_region;
 
 #if 0
    failover->pipe.texture_create = hw->texture_create;
index 88ae5ad60d538722759d6f08345b63008d3c1629..9d3e0d0dba0d24c7509e2ed5376dd1fb1ca2a9fb 100644 (file)
@@ -55,6 +55,7 @@
 #define FO_NEW_CLEAR_COLOR     0x20000
 #define FO_NEW_VERTEX_BUFFER   0x40000
 #define FO_NEW_VERTEX_ELEMENT  0x80000
+#define FO_NEW_SAMPLE_MASK     0x100000
 
 
 
@@ -90,6 +91,7 @@ struct failover_context {
    struct pipe_blend_color blend_color;
    struct pipe_stencil_ref stencil_ref;
    struct pipe_clip_state clip;
+   unsigned sample_mask;
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
index 272e683067e5a0d97608d7c3a6aef048fb625b51..12e42379f98b95c345657bbd54da6e4c77f85c98 100644 (file)
@@ -125,6 +125,19 @@ failover_set_clip_state( struct pipe_context *pipe,
    failover->hw->set_clip_state( failover->hw, clip );
 }
 
+static void
+failover_set_sample_mask(struct pipe_context *pipe,
+                         unsigned sample_mask)
+{
+   struct failover_context *failover = failover_context(pipe);
+
+   failover->sample_mask = sample_mask;
+   failover->dirty |= FO_NEW_SAMPLE_MASK;
+   failover->sw->set_sample_mask( failover->sw, sample_mask );
+   failover->hw->set_sample_mask( failover->hw, sample_mask );
+
+}
+
 
 static void *
 failover_create_depth_stencil_state(struct pipe_context *pipe,
@@ -614,6 +627,7 @@ failover_init_state_functions( struct failover_context *failover )
    failover->pipe.set_blend_color = failover_set_blend_color;
    failover->pipe.set_stencil_ref = failover_set_stencil_ref;
    failover->pipe.set_clip_state = failover_set_clip_state;
+   failover->pipe.set_sample_mask = failover_set_sample_mask;
    failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
    failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
    failover->pipe.set_scissor_state = failover_set_scissor_state;
index 42bd6929a7fbe3433d66d9cbc31a28a589148b3c..147f23269ca252698eda843ad7a3eea373d309fe 100644 (file)
@@ -63,6 +63,9 @@ failover_state_emit( struct failover_context *failover )
    if (failover->dirty & FO_NEW_CLIP)
       failover->sw->set_clip_state( failover->sw, &failover->clip );
 
+   if (failover->dirty & FO_NEW_SAMPLE_MASK)
+      failover->sw->set_sample_mask( failover->sw, failover->sample_mask );
+
    if (failover->dirty & FO_NEW_DEPTH_STENCIL)
       failover->sw->bind_depth_stencil_alpha_state( failover->sw,
                                                     failover->depth_stencil->sw_state );
index 533fa81219b062d9158f9ee4c50020807867b172..6717e46e1b4a92d518308f21717d45d64bfeae50 100644 (file)
@@ -84,7 +84,6 @@ i915_fill_blit(struct i915_context *i915,
 
 void
 i915_copy_blit(struct i915_context *i915,
-               unsigned do_flip,
                unsigned cpp,
                unsigned short src_pitch,
                struct i915_winsys_buffer *src_buffer,
index db576ed4c901564714bf55b6c1653ca9bdedb5c0..43f8e7c9aadb68f9ba73ba096079850f0a61a9c4 100644 (file)
@@ -31,7 +31,6 @@
 #include "i915_context.h"
 
 extern void i915_copy_blit(struct i915_context *i915,
-                           unsigned do_flip,
                            unsigned cpp,
                            unsigned short src_pitch,
                            struct i915_winsys_buffer *src_buffer,
index 7cf627d975bfa15bd713604844e0796cd837397e..0897a863dbd2ba01597b03b139006d5223853cc5 100644 (file)
@@ -161,9 +161,10 @@ i915_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
 
 static boolean
 i915_is_format_supported(struct pipe_screen *screen,
-                         enum pipe_format format, 
+                         enum pipe_format format,
                          enum pipe_texture_target target,
-                         unsigned tex_usage, 
+                         unsigned sample_count,
+                         unsigned tex_usage,
                          unsigned geom_flags)
 {
    static const enum pipe_format tex_supported[] = {
@@ -183,17 +184,25 @@ i915_is_format_supported(struct pipe_screen *screen,
       PIPE_FORMAT_Z24_UNORM_S8_USCALED,
       PIPE_FORMAT_NONE  /* list terminator */
    };
-   static const enum pipe_format surface_supported[] = {
+   static const enum pipe_format render_supported[] = {
       PIPE_FORMAT_B8G8R8A8_UNORM,
       PIPE_FORMAT_B5G6R5_UNORM,
+      PIPE_FORMAT_NONE  /* list terminator */
+   };
+   static const enum pipe_format depth_supported[] = {
       PIPE_FORMAT_Z24_UNORM_S8_USCALED,
       PIPE_FORMAT_NONE  /* list terminator */
    };
    const enum pipe_format *list;
    uint i;
 
-   if(tex_usage & PIPE_BIND_RENDER_TARGET)
-      list = surface_supported;
+   if (sample_count > 1)
+      return FALSE;
+
+   if(tex_usage & PIPE_BIND_DEPTH_STENCIL)
+      list = depth_supported;
+   else if (tex_usage & PIPE_BIND_RENDER_TARGET)
+      list = render_supported;
    else
       list = tex_supported;
 
index cd963e4df75f5fb64f801f51966f7cb4ef2f68b5..e767aa9f8f09f174198bdb3bfe09afff452fb572 100644 (file)
@@ -812,6 +812,12 @@ i915_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
    FREE( velems );
 }
 
+static void
+i915_set_sample_mask(struct pipe_context *pipe,
+                     unsigned sample_mask)
+{
+}
+
 void
 i915_init_state_functions( struct i915_context *i915 )
 {
@@ -843,6 +849,7 @@ i915_init_state_functions( struct i915_context *i915 )
    i915->base.set_blend_color = i915_set_blend_color;
    i915->base.set_stencil_ref = i915_set_stencil_ref;
    i915->base.set_clip_state = i915_set_clip_state;
+   i915->base.set_sample_mask = i915_set_sample_mask;
    i915->base.set_constant_buffer = i915_set_constant_buffer;
    i915->base.set_framebuffer_state = i915_set_framebuffer_state;
 
index 453437b8090a5138d36f29fce15406478c4c8f10..41b1fed36d0b9aa5440084bf9032a1a18686d9d5 100644 (file)
  */
 static void
 i915_surface_copy(struct pipe_context *pipe,
-                 struct pipe_surface *dst,
-                 unsigned dstx, unsigned dsty,
-                 struct pipe_surface *src,
-                 unsigned srcx, unsigned srcy, unsigned width, unsigned height)
+                 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)
 {
-   struct i915_texture *dst_tex = i915_texture(dst->texture);
-   struct i915_texture *src_tex = i915_texture(src->texture);
+   struct i915_texture *dst_tex = i915_texture(dst);
+   struct i915_texture *src_tex = i915_texture(src);
    struct pipe_resource *dpt = &dst_tex->b.b;
    struct pipe_resource *spt = &src_tex->b.b;
+   unsigned dst_offset, src_offset;  /* in bytes */
+
+   if (dst->target == PIPE_TEXTURE_CUBE) {
+      dst_offset = dst_tex->image_offset[subdst.level][subdst.face];
+   }
+   else if (dst->target == PIPE_TEXTURE_3D) {
+      dst_offset = dst_tex->image_offset[subdst.level][dstz];
+   }
+   else {
+      dst_offset = dst_tex->image_offset[subdst.level][0];
+      assert(subdst.face == 0);
+      assert(dstz == 0);
+   }
+   if (src->target == PIPE_TEXTURE_CUBE) {
+      src_offset = src_tex->image_offset[subsrc.level][subsrc.face];
+   }
+   else if (src->target == PIPE_TEXTURE_3D) {
+      src_offset = src_tex->image_offset[subsrc.level][srcz];
+   }
+   else {
+      src_offset = src_tex->image_offset[subsrc.level][0];
+      assert(subsrc.face == 0);
+      assert(srcz == 0);
+   }
+
 
    assert( dst != src );
    assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) );
@@ -59,22 +85,34 @@ i915_surface_copy(struct pipe_context *pipe,
    assert( util_format_get_blockheight(dpt->format) == 1 );
 
    i915_copy_blit( i915_context(pipe),
-                   FALSE,
                    util_format_get_blocksize(dpt->format),
-                   (unsigned short) src_tex->stride, src_tex->buffer, src->offset,
-                   (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset,
+                   (unsigned short) src_tex->stride, src_tex->buffer, src_offset,
+                   (unsigned short) dst_tex->stride, dst_tex->buffer, dst_offset,
                    (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
 }
 
 
 static void
 i915_surface_fill(struct pipe_context *pipe,
-                 struct pipe_surface *dst,
-                 unsigned dstx, unsigned dsty,
+                 struct pipe_resource *dst, struct pipe_subresource subdst,
+                 unsigned dstx, unsigned dsty, unsigned dstz,
                  unsigned width, unsigned height, unsigned value)
 {
-   struct i915_texture *tex = i915_texture(dst->texture);
+   struct i915_texture *tex = i915_texture(dst);
    struct pipe_resource *pt = &tex->b.b;
+   unsigned dst_offset;  /* in bytes */
+
+   if (dst->target == PIPE_TEXTURE_CUBE) {
+      dst_offset = tex->image_offset[subdst.level][subdst.face];
+   }
+   else if (dst->target == PIPE_TEXTURE_3D) {
+      dst_offset = tex->image_offset[subdst.level][dstz];
+   }
+   else {
+      dst_offset = tex->image_offset[subdst.level][0];
+      assert(subdst.face == 0);
+      assert(dstz == 0);
+   }
 
    assert(util_format_get_blockwidth(pt->format) == 1);
    assert(util_format_get_blockheight(pt->format) == 1);
@@ -82,7 +120,7 @@ i915_surface_fill(struct pipe_context *pipe,
    i915_fill_blit( i915_context(pipe),
                    util_format_get_blocksize(pt->format),
                    (unsigned short) tex->stride,
-                   tex->buffer, dst->offset,
+                   tex->buffer, dst_offset,
                    (short) dstx, (short) dsty,
                    (short) width, (short) height,
                    value );
@@ -137,13 +175,11 @@ i915_tex_surface_destroy(struct pipe_surface *surf)
 }
 
 
-/* Probably going to make blits work on textures rather than surfaces.
- */
 void
 i915_init_surface_functions(struct i915_context *i915)
 {
-   i915->base.surface_copy = i915_surface_copy;
-   i915->base.surface_fill = i915_surface_fill;
+   i915->base.resource_copy_region = i915_surface_copy;
+   i915->base.resource_fill_region = i915_surface_fill;
 }
 
 /* No good reason for these to be in the screen.
index b7000d5e3344ea0103a9f140be3903ba303e208f..31c2c343d89489dbfb813176d11513f7f70955ec 100644 (file)
@@ -167,12 +167,19 @@ static void brw_set_stencil_ref(struct pipe_context *pipe,
    brw->state.dirty.mesa |= PIPE_NEW_DEPTH_STENCIL_ALPHA;
 }
 
+static void
+brw_set_sample_mask(struct pipe_context *pipe,
+                    unsigned sample_mask)
+{
+}
+
 void brw_pipe_depth_stencil_init( struct brw_context *brw )
 {
    brw->base.set_stencil_ref = brw_set_stencil_ref;
    brw->base.create_depth_stencil_alpha_state = brw_create_depth_stencil_state;
    brw->base.bind_depth_stencil_alpha_state = brw_bind_depth_stencil_state;
    brw->base.delete_depth_stencil_alpha_state = brw_delete_depth_stencil_state;
+   brw->base.set_sample_mask = brw_set_sample_mask;
 }
 
 void brw_pipe_depth_stencil_cleanup( struct brw_context *brw )
index 069a12b27f7b78762ded1b8ca9f443a4cd68d044..1efdb1e0b4d110e08ffc04e29c1bd8942e13a7d6 100644 (file)
@@ -1,4 +1,5 @@
 #include "util/u_debug.h"
+#include "util/u_surface.h"
 
 #include "brw_resource.h"
 #include "brw_context.h"
@@ -37,6 +38,8 @@ brw_init_resource_functions(struct brw_context *brw )
    brw->base.transfer_unmap = u_transfer_unmap_vtbl;
    brw->base.transfer_destroy = u_transfer_destroy_vtbl;
    brw->base.transfer_inline_write = u_transfer_inline_write_vtbl;
+   brw->base.resource_copy_region = util_resource_copy_region;
+   brw->base.resource_fill_region = util_resource_fill_region;
 }
 
 void
index 3390c270d429ae288b843416b11a60251249095f..78defb37b2a4f32b906422e42ec6d971e9e097da 100644 (file)
@@ -124,7 +124,8 @@ boolean
 brw_is_format_supported( struct pipe_screen *screen,
                         enum pipe_format format,
                         enum pipe_texture_target target,
-                        unsigned tex_usage, 
+                        unsigned sample_count,
+                        unsigned tex_usage,
                         unsigned geom_flags );
 */
 
index ca09d88fd1203f6808bef8f6e9d0057207d91914..ffd0f38672c7e7b32121fea8796d1571c4b72262 100644 (file)
@@ -594,7 +594,8 @@ fail:
 boolean brw_is_format_supported( struct pipe_screen *screen,
                                 enum pipe_format format,
                                 enum pipe_texture_target target,
-                                unsigned tex_usage, 
+                                unsigned sample_count,
+                                unsigned tex_usage,
                                 unsigned geom_flags )
 {
    return translate_tex_format(format) != BRW_SURFACEFORMAT_INVALID;
index 1890b640e908469b47d108a71657e3217229e58a..7a7b9c1a5a962b42a1d72e34eeee10476e8495bc 100644 (file)
@@ -220,9 +220,10 @@ brw_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
 
 static boolean
 brw_is_format_supported(struct pipe_screen *screen,
-                         enum pipe_format format, 
+                         enum pipe_format format,
                          enum pipe_texture_target target,
-                         unsigned tex_usage, 
+                         unsigned sample_count,
+                         unsigned tex_usage,
                          unsigned geom_flags)
 {
    static const enum pipe_format tex_supported[] = {
@@ -278,6 +279,9 @@ brw_is_format_supported(struct pipe_screen *screen,
    const enum pipe_format *list;
    uint i;
 
+   if (sample_count > 1)
+      return FALSE;
+
    if (tex_usage & PIPE_BIND_DEPTH_STENCIL)
       list = depth_supported;
    else if (tex_usage & PIPE_BIND_RENDER_TARGET)
index 7e62213597c5241f0d123b86aeeeedc566fbf75e..9813170fb18d2c8fceadb0ae284ebdbb2f11b0ac 100644 (file)
@@ -451,6 +451,17 @@ identity_set_clip_state(struct pipe_context *_pipe,
                         clip);
 }
 
+static void
+identity_set_sample_mask(struct pipe_context *_pipe,
+                         unsigned sample_mask)
+{
+   struct identity_context *id_pipe = identity_context(_pipe);
+   struct pipe_context *pipe = id_pipe->pipe;
+
+   pipe->set_sample_mask(pipe,
+                         sample_mask);
+}
+
 static void
 identity_set_constant_buffer(struct pipe_context *_pipe,
                              uint shader,
@@ -601,55 +612,67 @@ identity_set_vertex_buffers(struct pipe_context *_pipe,
                             buffers);
 }
 static void
-identity_surface_copy(struct pipe_context *_pipe,
-                      struct pipe_surface *_dst,
-                      unsigned dstx,
-                      unsigned dsty,
-                      struct pipe_surface *_src,
-                      unsigned srcx,
-                      unsigned srcy,
-                      unsigned width,
-                      unsigned height)
+identity_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)
 {
    struct identity_context *id_pipe = identity_context(_pipe);
-   struct identity_surface *id_surface_dst = identity_surface(_dst);
-   struct identity_surface *id_surface_src = identity_surface(_src);
+   struct identity_resource *id_resource_dst = identity_resource(_dst);
+   struct identity_resource *id_resource_src = identity_resource(_src);
    struct pipe_context *pipe = id_pipe->pipe;
-   struct pipe_surface *dst = id_surface_dst->surface;
-   struct pipe_surface *src = id_surface_src->surface;
+   struct pipe_resource *dst = id_resource_dst->resource;
+   struct pipe_resource *src = id_resource_src->resource;
 
-   pipe->surface_copy(pipe,
-                      dst,
-                      dstx,
-                      dsty,
-                      src,
-                      srcx,
-                      srcy,
-                      width,
-                      height);
+   pipe->resource_copy_region(pipe,
+                              dst,
+                              subdst,
+                              dstx,
+                              dsty,
+                              dstz,
+                              src,
+                              subsrc,
+                              srcx,
+                              srcy,
+                              srcz,
+                              width,
+                              height);
 }
 
 static void
-identity_surface_fill(struct pipe_context *_pipe,
-                      struct pipe_surface *_dst,
-                      unsigned dstx,
-                      unsigned dsty,
-                      unsigned width,
-                      unsigned height,
-                      unsigned value)
+identity_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)
 {
    struct identity_context *id_pipe = identity_context(_pipe);
-   struct identity_surface *id_surface_dst = identity_surface(_dst);
+   struct identity_resource *id_resource_dst = identity_resource(_dst);
    struct pipe_context *pipe = id_pipe->pipe;
-   struct pipe_surface *dst = id_surface_dst->surface;
+   struct pipe_resource *dst = id_resource_dst->resource;
 
-   pipe->surface_fill(pipe,
-                      dst,
-                      dstx,
-                      dsty,
-                      width,
-                      height,
-                      value);
+   pipe->resource_fill_region(pipe,
+                              dst,
+                              subdst,
+                              dstx,
+                              dsty,
+                              dstz,
+                              width,
+                              height,
+                              value);
 }
 
 static void
@@ -880,6 +903,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    id_pipe->base.set_blend_color = identity_set_blend_color;
    id_pipe->base.set_stencil_ref = identity_set_stencil_ref;
    id_pipe->base.set_clip_state = identity_set_clip_state;
+   id_pipe->base.set_sample_mask = identity_set_sample_mask;
    id_pipe->base.set_constant_buffer = identity_set_constant_buffer;
    id_pipe->base.set_framebuffer_state = identity_set_framebuffer_state;
    id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
@@ -888,8 +912,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    id_pipe->base.set_fragment_sampler_views = identity_set_fragment_sampler_views;
    id_pipe->base.set_vertex_sampler_views = identity_set_vertex_sampler_views;
    id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
-   id_pipe->base.surface_copy = identity_surface_copy;
-   id_pipe->base.surface_fill = identity_surface_fill;
+   id_pipe->base.resource_copy_region = identity_resource_copy_region;
+   id_pipe->base.resource_fill_region = identity_resource_fill_region;
    id_pipe->base.clear = identity_clear;
    id_pipe->base.flush = identity_flush;
    id_pipe->base.is_resource_referenced = identity_is_resource_referenced;
index 3c94e04a7a831736e47f17e0914e2b811ffbb1e6..f71585e06f81c7f0a399ec605b2e8c722b6e37ba 100644 (file)
@@ -91,6 +91,7 @@ static boolean
 identity_screen_is_format_supported(struct pipe_screen *_screen,
                                     enum pipe_format format,
                                     enum pipe_texture_target target,
+                                    unsigned sample_count,
                                     unsigned tex_usage,
                                     unsigned geom_flags)
 {
@@ -100,6 +101,7 @@ identity_screen_is_format_supported(struct pipe_screen *_screen,
    return screen->is_format_supported(screen,
                                       format,
                                       target,
+                                      sample_count,
                                       tex_usage,
                                       geom_flags);
 }
index 22fbf381ae0da8af5e2286fb095617523c8549b7..cedc08e9292225eecf8e008455da4b1f44056017 100644 (file)
@@ -204,8 +204,9 @@ llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
  */
 static boolean
 llvmpipe_is_format_supported( struct pipe_screen *_screen,
-                              enum pipe_format format, 
+                              enum pipe_format format,
                               enum pipe_texture_target target,
+                              unsigned sample_count,
                               unsigned bind,
                               unsigned geom_flags )
 {
@@ -222,6 +223,9 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
           target == PIPE_TEXTURE_3D ||
           target == PIPE_TEXTURE_CUBE);
 
+   if (sample_count > 1)
+      return FALSE;
+
    if (bind & PIPE_BIND_RENDER_TARGET) {
       if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
          return FALSE;
index 8569507f4e5e94c4860e654e91587dd82061b938..5b39d9d1a91aa4a599e7f6f28db56ff80921a9b4 100644 (file)
@@ -148,6 +148,11 @@ llvmpipe_set_stencil_ref(struct pipe_context *pipe,
    llvmpipe->dirty |= LP_NEW_DEPTH_STENCIL_ALPHA;
 }
 
+static void
+llvmpipe_set_sample_mask(struct pipe_context *pipe,
+                         unsigned sample_mask)
+{
+}
 
 void
 llvmpipe_init_blend_funcs(struct llvmpipe_context *llvmpipe)
@@ -163,4 +168,5 @@ llvmpipe_init_blend_funcs(struct llvmpipe_context *llvmpipe)
    llvmpipe->pipe.set_blend_color = llvmpipe_set_blend_color;
 
    llvmpipe->pipe.set_stencil_ref = llvmpipe_set_stencil_ref;
+   llvmpipe->pipe.set_sample_mask = llvmpipe_set_sample_mask;
 }
index 245171120dd09b5f58a5c7c4d852a1888f9c1622..85687ada1c495925a43c27260ab5436e9234e426 100644 (file)
@@ -51,24 +51,27 @@ adjust_to_tile_bounds(unsigned x, unsigned y, unsigned width, unsigned height,
 
 
 static void
-lp_surface_copy(struct pipe_context *pipe,
-                struct pipe_surface *dst, unsigned dstx, unsigned dsty,
-                struct pipe_surface *src, unsigned srcx, unsigned srcy,
-                unsigned width, unsigned height)
+lp_resource_copy(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)
 {
-   struct llvmpipe_resource *src_tex = llvmpipe_resource(src->texture);
-   struct llvmpipe_resource *dst_tex = llvmpipe_resource(dst->texture);
+   /* XXX what about the dstz/srcz parameters - zslice wasn't used... */
+   struct llvmpipe_resource *src_tex = llvmpipe_resource(src);
+   struct llvmpipe_resource *dst_tex = llvmpipe_resource(dst);
    const enum pipe_format format = src_tex->base.format;
 
    llvmpipe_flush_resource(pipe,
-                           dst->texture, dst->face, dst->level,
+                           dst, subdst.face, subdst.level,
                            0, /* flush_flags */
                            FALSE, /* read_only */
                            FALSE, /* cpu_access */
                            FALSE); /* do_not_block */
 
    llvmpipe_flush_resource(pipe,
-                           src->texture, src->face, src->level,
+                           src, subsrc.face, subsrc.level,
                            0, /* flush_flags */
                            TRUE, /* read_only */
                            FALSE, /* cpu_access */
@@ -90,8 +93,8 @@ lp_surface_copy(struct pipe_context *pipe,
       for (y = 0; y < th; y += TILE_SIZE) {
          for (x = 0; x < tw; x += TILE_SIZE) {
             (void) llvmpipe_get_texture_tile_linear(src_tex,
-                                                    src->face, src->level,
-                                                       LP_TEX_USAGE_READ,
+                                                    subsrc.face, subsrc.level,
+                                                    LP_TEX_USAGE_READ,
                                                     tx + x, ty + y);
          }
       }
@@ -117,7 +120,7 @@ lp_surface_copy(struct pipe_context *pipe,
       for (y = 0; y < th; y += TILE_SIZE) {
          for (x = 0; x < tw; x += TILE_SIZE) {
             (void) llvmpipe_get_texture_tile_linear(dst_tex,
-                                                    dst->face, dst->level,
+                                                    subdst.face, subdst.level,
                                                     usage,
                                                     tx + x, ty + y);
          }
@@ -127,20 +130,20 @@ lp_surface_copy(struct pipe_context *pipe,
    /* copy */
    {
       const ubyte *src_linear_ptr
-         = llvmpipe_get_texture_image_address(src_tex, src->face,
-                                              src->level,
+         = llvmpipe_get_texture_image_address(src_tex, subsrc.face,
+                                              subsrc.level,
                                               LP_TEX_LAYOUT_LINEAR);
       ubyte *dst_linear_ptr
-         = llvmpipe_get_texture_image_address(dst_tex, dst->face,
-                                              dst->level,
+         = llvmpipe_get_texture_image_address(dst_tex, subdst.face,
+                                              subdst.level,
                                               LP_TEX_LAYOUT_LINEAR);
 
       util_copy_rect(dst_linear_ptr, format,
-                     llvmpipe_resource_stride(&dst_tex->base, dst->level),
+                     llvmpipe_resource_stride(&dst_tex->base, subdst.level),
                      dstx, dsty,
                      width, height,
                      src_linear_ptr,
-                     llvmpipe_resource_stride(&src_tex->base, src->level),
+                     llvmpipe_resource_stride(&src_tex->base, subsrc.level),
                      srcx, srcy);
    }
 }
@@ -149,6 +152,6 @@ lp_surface_copy(struct pipe_context *pipe,
 void
 llvmpipe_init_surface_functions(struct llvmpipe_context *lp)
 {
-   lp->pipe.surface_copy = lp_surface_copy;
-   lp->pipe.surface_fill = util_surface_fill;
+   lp->pipe.resource_copy_region = lp_resource_copy;
+   lp->pipe.resource_fill_region = util_resource_fill_region;
 }
index a91b00b5adafc51ed540a8a7bbe07067ad40c8c1..60bdd7276aa5b9b65126314f581473b8d514cd7e 100644 (file)
@@ -52,8 +52,6 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
 
        if (bind & (PIPE_BIND_RENDER_TARGET |
                        PIPE_BIND_DEPTH_STENCIL |
-                       PIPE_BIND_BLIT_SOURCE |
-                       PIPE_BIND_BLIT_DESTINATION |
                        PIPE_BIND_SCANOUT |
                        PIPE_BIND_DISPLAY_TARGET |
                        PIPE_BIND_SAMPLER_VIEW))
index 757f13b640a6d429d29024fcc1e7cde479bab8d5..2c0caada3664c81cbf234ee831ad4bd4469ceaa7 100644 (file)
@@ -33,8 +33,12 @@ static boolean
 nv50_screen_is_format_supported(struct pipe_screen *pscreen,
                                enum pipe_format format,
                                enum pipe_texture_target target,
+                               unsigned sample_count,
                                unsigned tex_usage, unsigned geom_flags)
 {
+       if (sample_count > 1)
+               return FALSE;
+
        if (tex_usage & PIPE_BIND_RENDER_TARGET) {
                switch (format) {
                case PIPE_FORMAT_B8G8R8X8_UNORM:
index b20781fa1fbdd6808f86c43c34ce80072cf7a1e9..f8bff764f27ab2ac626b5c5ff9a5e93fc8cc2d81 100644 (file)
@@ -660,6 +660,12 @@ nv50_set_clip_state(struct pipe_context *pipe,
 {
 }
 
+static void
+nv50_set_sample_mask(struct pipe_context *pipe,
+                    unsigned sample_mask)
+{
+}
+
 static void
 nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
                         struct pipe_resource *buf )
@@ -805,6 +811,7 @@ nv50_init_state_functions(struct nv50_context *nv50)
        nv50->pipe.set_blend_color = nv50_set_blend_color;
         nv50->pipe.set_stencil_ref = nv50_set_stencil_ref;
        nv50->pipe.set_clip_state = nv50_set_clip_state;
+       nv50->pipe.set_sample_mask = nv50_set_sample_mask;
        nv50->pipe.set_constant_buffer = nv50_set_constant_buffer;
        nv50->pipe.set_framebuffer_state = nv50_set_framebuffer_state;
        nv50->pipe.set_polygon_stipple = nv50_set_polygon_stipple;
index d905d95354f96d20381c8b5e13645c936a7d7caf..40b8d255335f3ea5e66a6297a81f63e827a2074b 100644 (file)
@@ -195,27 +195,40 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst,
 
 static void
 nv50_surface_copy(struct pipe_context *pipe,
-                 struct pipe_surface *dest, unsigned destx, unsigned desty,
-                 struct pipe_surface *src, unsigned srcx, unsigned srcy,
+                 struct pipe_resource *dest, struct pipe_subresource subdst,
+                 unsigned destx, unsigned desty, unsigned destz,
+                 struct pipe_resource *src, struct pipe_subresource subsrc,
+                 unsigned srcx, unsigned srcy, unsigned srcz,
                  unsigned width, unsigned height)
 {
        struct nv50_context *nv50 = nv50_context(pipe);
        struct nv50_screen *screen = nv50->screen;
+       struct pipe_surface *ps_dst, *ps_src;
 
        assert((src->format == dest->format) ||
               (nv50_2d_format_faithful(src->format) &&
                nv50_2d_format_faithful(dest->format)));
 
-       nv50_surface_do_copy(screen, dest, destx, desty, src, srcx,
-                                    srcy, width, height);
+       ps_src = nv50_miptree_surface_new(pipe->screen, dest, subsrc.face,
+                                         subsrc.level, srcz, 0 /* bind flags */);
+       ps_dst = nv50_miptree_surface_new(pipe->screen, dest, subdst.face,
+                                         subdst.level, destz, 0 /* bindflags */);
+
+       nv50_surface_do_copy(screen, ps_dst, destx, desty, ps_src, srcx,
+                            srcy, width, height);
+
+       nv50_miptree_surface_del(ps_src);
+       nv50_miptree_surface_del(ps_dst);
 }
 
 static void
-nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
-                 unsigned destx, unsigned desty, unsigned width,
-                 unsigned height, unsigned value)
+nv50_surface_fill(struct pipe_context *pipe, struct pipe_resource *dest,
+                 struct pipe_subresource subdst,
+                 unsigned destx, unsigned desty, unsigned destz,
+                 unsigned width, unsigned height, unsigned value)
 {
        struct nv50_context *nv50 = nv50_context(pipe);
+       struct pipe_surface *ps;
        struct nv50_screen *screen = nv50->screen;
        struct nouveau_channel *chan = screen->eng2d->channel;
        struct nouveau_grobj *eng2d = screen->eng2d;
@@ -225,9 +238,12 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
        if (format < 0)
                return;
 
+       ps = nv50_miptree_surface_new(pipe->screen, dest, subdst.face,
+                                     subdst.level, destz, 0 /* bind flags */);
+       
        WAIT_RING (chan, 32);
 
-       ret = nv50_surface_set(screen, dest, 1);
+       ret = nv50_surface_set(screen, ps, 1);
        if (ret)
                return;
 
@@ -240,13 +256,15 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
        OUT_RING  (chan, desty);
        OUT_RING  (chan, width);
        OUT_RING  (chan, height);
+
+       nv50_miptree_surface_del(ps);
 }
 
 void
 nv50_init_surface_functions(struct nv50_context *nv50)
 {
-       nv50->pipe.surface_copy = nv50_surface_copy;
-       nv50->pipe.surface_fill = nv50_surface_fill;
+       nv50->pipe.resource_copy_region = nv50_surface_copy;
+       nv50->pipe.resource_fill_region = nv50_surface_fill;
 }
 
 
index 4ed574227d6ea87afc92114a673a58be1b109001..7acbb505df3387ffda7418a01862170fd395ab8a 100644 (file)
@@ -502,12 +502,9 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen,
        struct nv04_surface* temp_ns;
        int temp_flags;
 
-       temp_flags = (ns->base.usage |
-                     PIPE_BIND_BLIT_SOURCE |
-                     PIPE_BIND_BLIT_DESTINATION);
+       temp_flags = ns->base.usage;
 
-       ns->base.usage = (PIPE_BIND_BLIT_SOURCE |
-                        PIPE_BIND_BLIT_DESTINATION);
+       ns->base.usage = 0;
 
        memset(&templ, 0, sizeof(templ));
        templ.format = ns->base.texture->format;
@@ -526,7 +523,7 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen,
        temp_ns = (struct nv04_surface*)pscreen->get_tex_surface(pscreen, temp_tex, 0, 0, 0, temp_flags);
        temp_ns->backing = ns;
 
-       if(ns->base.usage & PIPE_BIND_BLIT_SOURCE)
+       if(1) /* hmm */
                eng2d->copy(eng2d, &temp_ns->backing->base,
                            0, 0, &ns->base,
                            0, 0, ns->base.width, ns->base.height);
index aeb88e9ac96851cd5741ab8527a0a056d929322c..b5639bb46455ead6fc3f3829a9f3a0d171bed171 100644 (file)
@@ -300,7 +300,7 @@ nvfx_miptree_surface_del(struct pipe_surface *ps)
        if(ns->backing)
        {
                struct nvfx_screen* screen = (struct nvfx_screen*)ps->texture->screen;
-               if(ns->backing->base.usage & PIPE_BIND_BLIT_DESTINATION)
+               if(1 /*ns->backing->base.usage & PIPE_BIND_BLIT_DESTINATION*/)
                        screen->eng2d->copy(screen->eng2d, &ns->backing->base, 0, 0, ps, 0, 0, ns->base.width, ns->base.height);
                nvfx_miptree_surface_del(&ns->backing->base);
        }
index 6cb8428e4b618856be802dadd4a21c39e9d76763..7e534a0c738bd048cc0067bbba062f70dc457732 100644 (file)
@@ -157,11 +157,15 @@ static boolean
 nvfx_screen_surface_format_supported(struct pipe_screen *pscreen,
                                     enum pipe_format format,
                                     enum pipe_texture_target target,
+                                    unsigned sample_count,
                                     unsigned tex_usage, unsigned geom_flags)
 {
        struct nvfx_screen *screen = nvfx_screen(pscreen);
        struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front;
 
+        if (sample_count > 1)
+               return FALSE;
+
        if (tex_usage & PIPE_BIND_RENDER_TARGET) {
                switch (format) {
                case PIPE_FORMAT_B8G8R8A8_UNORM:
index 17f3f701406ea3360081e6986f262a160bd80fc5..30322d46d934df0a1e8867f41408aaac2f4ce265 100644 (file)
@@ -478,6 +478,12 @@ nvfx_set_clip_state(struct pipe_context *pipe,
        nvfx->draw_dirty |= NVFX_NEW_UCP;
 }
 
+static void
+nvfx_set_sample_mask(struct pipe_context *pipe,
+                    unsigned sample_mask)
+{
+}
+
 static void
 nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
                         struct pipe_resource *buf )
@@ -617,6 +623,7 @@ nvfx_init_state_functions(struct nvfx_context *nvfx)
        nvfx->pipe.set_blend_color = nvfx_set_blend_color;
         nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref;
        nvfx->pipe.set_clip_state = nvfx_set_clip_state;
+       nvfx->pipe.set_sample_mask = nvfx_set_sample_mask;
        nvfx->pipe.set_constant_buffer = nvfx_set_constant_buffer;
        nvfx->pipe.set_framebuffer_state = nvfx_set_framebuffer_state;
        nvfx->pipe.set_polygon_stipple = nvfx_set_polygon_stipple;
index 2e115650aeb4065d3e4c53eb543bd88df40e543d..fc3a670d4005bb4c678584d727ed56e8078c751c 100644 (file)
  **************************************************************************/
 
 #include "nvfx_context.h"
+#include "nvfx_resource.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 
 static void
 nvfx_surface_copy(struct pipe_context *pipe,
-                 struct pipe_surface *dest, unsigned destx, unsigned desty,
-                 struct pipe_surface *src, unsigned srcx, unsigned srcy,
+                 struct pipe_resource *dest, struct pipe_subresource subdst,
+                 unsigned destx, unsigned desty, unsigned destz,
+                 struct pipe_resource *src, struct pipe_subresource subsrc,
+                 unsigned srcx, unsigned srcy, unsigned srcz,
                  unsigned width, unsigned height)
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
        struct nv04_surface_2d *eng2d = nvfx->screen->eng2d;
+       struct pipe_surface *ps_dst, *ps_src;
 
-       eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
+       ps_src = nvfx_miptree_surface_new(pipe->screen, dest, subsrc.face,
+                                         subsrc.level, srcz, 0 /* bind flags */);
+       ps_dst = nvfx_miptree_surface_new(pipe->screen, dest, subdst.face,
+                                         subdst.level, destz, 0 /* bindflags */);
+
+       eng2d->copy(eng2d, ps_dst, destx, desty, ps_src, srcx, srcy, width, height);
+
+       nvfx_miptree_surface_del(ps_src);
+       nvfx_miptree_surface_del(ps_dst);
 }
 
 static void
-nvfx_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
-                 unsigned destx, unsigned desty, unsigned width,
-                 unsigned height, unsigned value)
+nvfx_surface_fill(struct pipe_context *pipe, struct pipe_resource *dest,
+                 struct pipe_subresource subdst,
+                 unsigned destx, unsigned desty, unsigned destz,
+                 unsigned width, unsigned height, unsigned value)
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
+       struct pipe_surface *ps;
        struct nv04_surface_2d *eng2d = nvfx->screen->eng2d;
 
-       eng2d->fill(eng2d, dest, destx, desty, width, height, value);
+       ps = nvfx_miptree_surface_new(pipe->screen, dest, subdst.face,
+                                     subdst.level, destz, 0 /* bind flags */);
+       
+       eng2d->fill(eng2d, ps, destx, desty, width, height, value);
+
+       nvfx_miptree_surface_del(ps);
 }
 
 void
 nvfx_init_surface_functions(struct nvfx_context *nvfx)
 {
-       nvfx->pipe.surface_copy = nvfx_surface_copy;
-       nvfx->pipe.surface_fill = nvfx_surface_fill;
+       nvfx->pipe.resource_copy_region = nvfx_surface_copy;
+       nvfx->pipe.resource_fill_region = nvfx_surface_fill;
 }
index b2ef27cf57917461bc03b6c4ba5c063e7fe2e7be..9ff0a93d3077d5b9805457f4ad4eba19002c8bf0 100644 (file)
@@ -40,11 +40,13 @@ static unsigned nvfx_transfer_bind_flags( unsigned transfer_usage )
 {
        unsigned bind = 0;
 
+#if 0
        if (transfer_usage & PIPE_TRANSFER_WRITE)
                bind |= PIPE_BIND_BLIT_SOURCE;
 
        if (transfer_usage & PIPE_TRANSFER_READ)
                bind |= PIPE_BIND_BLIT_DESTINATION;
+#endif
 
        return bind;
 }
@@ -128,7 +130,7 @@ nvfx_miptree_transfer_new(struct pipe_context *pipe,
 
                src = pscreen->get_tex_surface(pscreen, pt,
                                               sr.face, sr.level, box->z,
-                                              PIPE_BIND_BLIT_SOURCE);
+                                              0 /*PIPE_BIND_BLIT_SOURCE*/);
 
                /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
                /* TODO: Check if SIFM can un-swizzle */
@@ -160,7 +162,7 @@ nvfx_miptree_transfer_del(struct pipe_context *pipe,
                                               ptx->sr.face,
                                               ptx->sr.level,
                                               ptx->box.z,
-                                              PIPE_BIND_BLIT_DESTINATION);
+                                              0 /*PIPE_BIND_BLIT_DESTINATION*/);
 
                /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
                nvscreen->eng2d->copy(nvscreen->eng2d,
index 85c2c1490167cfc8fcc7730364229342748d0758..2bf9317803e793ef379d8a36f60ff76e1c3e76d8 100644 (file)
@@ -117,25 +117,36 @@ static void r300_hw_copy(struct pipe_context* pipe,
 
 /* Copy a block of pixels from one surface to another. */
 void r300_surface_copy(struct pipe_context* pipe,
-                       struct pipe_surface* dst,
-                       unsigned dstx, unsigned dsty,
-                       struct pipe_surface* src,
-                       unsigned srcx, unsigned srcy,
+                       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)
 {
-    enum pipe_format old_format = dst->texture->format;
+    struct pipe_screen *screen = pipe->screen;
+    enum pipe_format old_format = dst->format;
     enum pipe_format new_format = old_format;
+    struct pipe_surface *srcsurf, *dstsurf;
+    unsigned bind;
 
-    if (dst->texture->format != src->texture->format) {
+    if (util_format_is_depth_or_stencil(dst->format))
+       bind = PIPE_BIND_DEPTH_STENCIL;
+    else
+       bind = PIPE_BIND_RENDER_TARGET;
+
+    if (dst->format != src->format) {
         debug_printf("r300: Implementation error: Format mismatch in %s\n"
             "    : src: %s dst: %s\n", __FUNCTION__,
-            util_format_short_name(src->texture->format),
-            util_format_short_name(dst->texture->format));
+            util_format_short_name(src->format),
+            util_format_short_name(dst->format));
         debug_assert(0);
     }
 
     if (!pipe->screen->is_format_supported(pipe->screen,
-                                           old_format, src->texture->target,
+                                           old_format, src->target,
+                                           src->nr_samples,
                                            PIPE_BIND_RENDER_TARGET |
                                            PIPE_BIND_SAMPLER_VIEW, 0) &&
         util_format_is_plain(old_format)) {
@@ -164,36 +175,64 @@ void r300_surface_copy(struct pipe_context* pipe,
         src->format = new_format;
 
         r300_texture_reinterpret_format(pipe->screen,
-                                        dst->texture, new_format);
+                                        dst, new_format);
         r300_texture_reinterpret_format(pipe->screen,
-                                        src->texture, new_format);
+                                        src, new_format);
     }
 
-    r300_hw_copy(pipe, dst, dstx, dsty, src, srcx, srcy, width, height);
+    srcsurf = screen->get_tex_surface(screen, src,
+                                      subsrc.face, subsrc.level, srcz,
+                                      PIPE_BIND_SAMPLER_VIEW);
+
+    dstsurf = screen->get_tex_surface(screen, dst,
+                                      subdst.face, subdst.level, dstz,
+                                      bind);
+
+    r300_hw_copy(pipe, dstsurf, dstx, dsty, srcsurf, srcx, srcy, width, height);
+
+    pipe_surface_reference(&srcsurf, NULL);
+    pipe_surface_reference(&dstsurf, NULL);
 
     if (old_format != new_format) {
         dst->format = old_format;
         src->format = old_format;
 
         r300_texture_reinterpret_format(pipe->screen,
-                                        dst->texture, old_format);
+                                        dst, old_format);
         r300_texture_reinterpret_format(pipe->screen,
-                                        src->texture, old_format);
+                                        src, old_format);
     }
 }
 
 /* Fill a region of a surface with a constant value. */
 void r300_surface_fill(struct pipe_context* pipe,
-                       struct pipe_surface* dst,
-                       unsigned dstx, unsigned dsty,
+                       struct pipe_resource* dst,
+                       struct pipe_subresource subdst,
+                       unsigned dstx, unsigned dsty, unsigned dstz,
                        unsigned width, unsigned height,
                        unsigned value)
 {
+    struct pipe_screen *screen = pipe->screen;
     struct r300_context* r300 = r300_context(pipe);
+    struct pipe_surface *dstsurf;
+    unsigned bind;
+
+    if (util_format_is_depth_or_stencil(dst->format))
+       bind = PIPE_BIND_DEPTH_STENCIL;
+    else
+       bind = PIPE_BIND_RENDER_TARGET;
+
+    dstsurf = screen->get_tex_surface(screen, dst,
+                                      subdst.face,
+                                      subdst.level,
+                                      dstz,
+                                      bind);
 
     r300_blitter_save_states(r300);
     util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
 
     util_blitter_fill(r300->blitter,
-                      dst, dstx, dsty, width, height, value);
+                      dstsurf, dstx, dsty, width, height, value);
+
+    pipe_surface_reference(&dstsurf, NULL);
 }
index 029e4f98e7d0f632cb9dd21d88d6b5be4b01e785..c97872662aa9404f5c8f8eb4ac291919d13bafa6 100644 (file)
@@ -24,7 +24,8 @@
 #define R300_BLIT_H
 
 struct pipe_context;
-struct pipe_surface;
+struct pipe_resource;
+struct pipe_subresource;
 
 void r300_clear(struct pipe_context* pipe,
                 unsigned buffers,
@@ -33,15 +34,18 @@ void r300_clear(struct pipe_context* pipe,
                 unsigned stencil);
 
 void r300_surface_copy(struct pipe_context* pipe,
-                       struct pipe_surface* dst,
-                       unsigned dstx, unsigned dsty,
-                       struct pipe_surface* src,
-                       unsigned srcx, unsigned srcy,
+                       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);
 
 void r300_surface_fill(struct pipe_context* pipe,
-                       struct pipe_surface* dst,
-                       unsigned dstx, unsigned dsty,
+                       struct pipe_resource* dst,
+                       struct pipe_subresource subdst,
+                       unsigned dstx, unsigned dsty, unsigned dstz,
                        unsigned width, unsigned height,
                        unsigned value);
 
index 9837deaa5e31b6a3a134403516b4b5b82ef651a8..f771e10c64ee6c5fb27400f7a70c26df074ccd54 100644 (file)
@@ -186,8 +186,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300->context.destroy = r300_destroy_context;
 
     r300->context.clear = r300_clear;
-    r300->context.surface_copy = r300_surface_copy;
-    r300->context.surface_fill = r300_surface_fill;
+    r300->context.resource_copy_region = r300_surface_copy;
+    r300->context.resource_fill_region = r300_surface_fill;
 
     if (r300screen->caps.has_tcl) {
         r300->context.draw_arrays = r300_draw_arrays;
index 640b3d346887fbd6f70d5d69cb87e46b025ca74c..ef0255066b798061a30f74924c5c2557e5ba3d1a 100644 (file)
@@ -241,6 +241,7 @@ static float r300_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
 static boolean r300_is_format_supported(struct pipe_screen* screen,
                                         enum pipe_format format,
                                         enum pipe_texture_target target,
+                                        unsigned sample_count,
                                         unsigned usage,
                                         unsigned geom_flags)
 {
@@ -264,6 +265,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
         return FALSE;
     }
 
+   if (sample_count > 1)
+      return FALSE;
+
     /* Check sampler format support. */
     if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
         /* Z24 cannot be sampled from on non-r5xx. */
index 11c10e2f2a85e360835334c7f46827e3910a3785..67e09362d8e38fbef6ef8ce270c42f8d40d289b6 100644 (file)
@@ -404,6 +404,13 @@ static void r300_set_clip_state(struct pipe_context* pipe,
     }
 }
 
+static void
+r300_set_sample_mask(struct pipe_context *pipe,
+                     unsigned sample_mask)
+{
+}
+
+
 /* Create a new depth, stencil, and alpha state based on the CSO dsa state.
  *
  * This contains the depth buffer, stencil buffer, alpha test, and such.
@@ -1561,6 +1568,7 @@ void r300_init_state_functions(struct r300_context* r300)
     r300->context.set_blend_color = r300_set_blend_color;
 
     r300->context.set_clip_state = r300_set_clip_state;
+    r300->context.set_sample_mask = r300_set_sample_mask;
 
     r300->context.set_constant_buffer = r300_set_constant_buffer;
 
index 14a9bfd86501f0e52abb4023fa8e64cf55fa38f2..beb321cb2380a683d7986cc6871da80b4d1d9032 100644 (file)
@@ -56,63 +56,44 @@ r300_transfer(struct pipe_transfer* transfer)
 static void r300_copy_from_tiled_texture(struct pipe_context *ctx,
                                          struct r300_transfer *r300transfer)
 {
-    struct pipe_screen *screen = ctx->screen;
     struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
     struct pipe_resource *tex = transfer->resource;
-    struct pipe_surface *src, *dst;
+    struct pipe_subresource subdst;
 
-    src = screen->get_tex_surface(screen, tex,
-                                 transfer->sr.face,
-                                  transfer->sr.level,
-                                 transfer->box.z,
-                                 PIPE_BIND_BLIT_SOURCE);
+    subdst.face = 0;
+    subdst.level = 0;
 
-    dst = screen->get_tex_surface(screen, &r300transfer->detiled_texture->b.b,
-                                  0, 0, 0,
-                                  PIPE_BIND_BLIT_DESTINATION);
-
-    ctx->surface_copy(ctx, dst, 0, 0, src, 
-                     transfer->box.x, transfer->box.y,
-                      transfer->box.width, transfer->box.height);
-
-    pipe_surface_reference(&src, NULL);
-    pipe_surface_reference(&dst, NULL);
+    ctx->resource_copy_region(ctx, &r300transfer->detiled_texture->b.b, subdst,
+                             0, 0, 0,
+                             tex, transfer->sr,
+                             transfer->box.x, transfer->box.y, transfer->box.z,
+                             transfer->box.width, transfer->box.height);
 }
 
 /* Copy a detiled texture to a tiled one. */
 static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
                                          struct r300_transfer *r300transfer)
 {
-    struct pipe_screen *screen = ctx->screen;
     struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
     struct pipe_resource *tex = transfer->resource;
-    struct pipe_surface *src, *dst;
+    struct pipe_subresource subsrc;
 
-    src = screen->get_tex_surface(screen, &r300transfer->detiled_texture->b.b,
-                                  0, 0, 0,
-                                  PIPE_BIND_BLIT_SOURCE);
-
-    dst = screen->get_tex_surface(screen, tex,
-                                 transfer->sr.face,
-                                  transfer->sr.level,
-                                 transfer->box.z,
-                                  PIPE_BIND_BLIT_DESTINATION);
+    subsrc.face = 0;
+    subsrc.level = 0;
 
     /* XXX this flush prevents the following DRM error from occuring:
      * [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation !
      * Reproducible with perf/copytex. */
     ctx->flush(ctx, 0, NULL);
 
-    ctx->surface_copy(ctx, dst,
-                     transfer->box.x, transfer->box.y,
-                     src, 0, 0,
-                      transfer->box.width, transfer->box.height);
+    ctx->resource_copy_region(ctx, tex, transfer->sr,
+                             transfer->box.x, transfer->box.y, transfer->box.z,
+                             &r300transfer->detiled_texture->b.b, subsrc,
+                             0, 0, 0,
+                             transfer->box.width, transfer->box.height);
 
     /* XXX this flush fixes a few piglit tests (e.g. glean/pixelFormats). */
     ctx->flush(ctx, 0, NULL);
-
-    pipe_surface_reference(&src, NULL);
-    pipe_surface_reference(&dst, NULL);
 }
 
 struct pipe_transfer*
index fea3520fa56a1b82921654d4aabb9a061f685536..2f10b46e9898e3c916646a894aa4f044f2f7e964 100644 (file)
@@ -254,6 +254,7 @@ softpipe_create_context( struct pipe_screen *screen,
    softpipe->pipe.set_blend_color = softpipe_set_blend_color;
    softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref;
    softpipe->pipe.set_clip_state = softpipe_set_clip_state;
+   softpipe->pipe.set_sample_mask = softpipe_set_sample_mask;
    softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer;
    softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
    softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
index 8c33efa1987104bad3c69d9f7723f68bca0b2000..73987c913e5d4367a0170d8622afa694afce795b 100644 (file)
@@ -178,8 +178,9 @@ softpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
  */
 static boolean
 softpipe_is_format_supported( struct pipe_screen *screen,
-                              enum pipe_format format, 
+                              enum pipe_format format,
                               enum pipe_texture_target target,
+                              unsigned sample_count,
                               unsigned bind,
                               unsigned geom_flags )
 {
@@ -195,6 +196,9 @@ softpipe_is_format_supported( struct pipe_screen *screen,
    if (!format_desc)
       return FALSE;
 
+   if (sample_count > 1)
+      return FALSE;
+
    if (bind & (PIPE_BIND_DISPLAY_TARGET |
                PIPE_BIND_SCANOUT |
                PIPE_BIND_SHARED)) {
index f97fc6eca8ffe028ee1e8c9ca4a2678dc040a8e1..5b0faabeaef48d2db2ff542da11ccb86ebd20723 100644 (file)
@@ -148,6 +148,9 @@ void softpipe_set_stencil_ref( struct pipe_context *pipe,
 void softpipe_set_clip_state( struct pipe_context *,
                               const struct pipe_clip_state * );
 
+void softpipe_set_sample_mask( struct pipe_context *,
+                               unsigned sample_mask );
+
 void softpipe_set_constant_buffer(struct pipe_context *,
                                   uint shader, uint index,
                                   struct pipe_resource *buf);
index c63a49e90b0ac99d3669b3ced7092059cb921c92..2a203f44e50de451b4ec26ff3c2954784b6de5b2 100644 (file)
@@ -111,3 +111,10 @@ void softpipe_set_stencil_ref( struct pipe_context *pipe,
 
    softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA;
 }
+
+void
+softpipe_set_sample_mask(struct pipe_context *pipe,
+                         unsigned sample_mask)
+{
+}
+
index 32cab06004f0342a36cddecf65a18ca86df247c8..0296c26ad261651ae4b8ebf77ce3b9f6b34bafa1 100644 (file)
 #include "sp_context.h"
 #include "sp_surface.h"
 
-
-static void
-sp_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)
-{
-   util_surface_copy(pipe, FALSE,
-                     dest, destx, desty,
-                     src, srcx, srcy,
-                     width, height);
-}
-
 void
 sp_init_surface_functions(struct softpipe_context *sp)
 {
-   sp->pipe.surface_copy = sp_surface_copy;
-   sp->pipe.surface_fill = util_surface_fill;
+   sp->pipe.resource_copy_region = util_resource_copy_region;
+   sp->pipe.resource_fill_region = util_resource_fill_region;
 }
index 889da29e28b720a9016457906af86b873162205d..2dd99b46316b805544b175f69345535f6aa2f545 100644 (file)
 #include "svga_debug.h"
 #include "svga_cmd.h"
 #include "svga_surface.h"
+#include "util/u_surface.h"
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
 
+/* XXX I got my doubts about this, should maybe use svga_texture_copy_handle directly? */
 static void svga_surface_copy(struct pipe_context *pipe,
-                              struct pipe_surface *dest,
-                              unsigned destx, unsigned desty,
-                              struct pipe_surface *src,
-                              unsigned srcx, unsigned srcy,
+                              struct pipe_resource* dst_tex,
+                              struct pipe_subresource subdst,
+                              unsigned dstx, unsigned dsty, unsigned dstz,
+                              struct pipe_resource* src_tex,
+                              struct pipe_subresource subsrc,
+                              unsigned srcx, unsigned srcy, unsigned srcz,
                               unsigned width, unsigned height)
 {
    struct svga_context *svga = svga_context(pipe);
+   struct pipe_screen *screen = pipe->screen;
    SVGA3dCopyBox *box;
    enum pipe_error ret;
+   struct pipe_surface *srcsurf, *dstsurf;
 
    svga_hwtnl_flush_retry( svga );
 
+   srcsurf = screen->get_tex_surface(screen, src_tex,
+                                     subsrc.face, subsrc.level, srcz,
+                                     PIPE_BIND_SAMPLER_VIEW);
+
+   dstsurf = screen->get_tex_surface(screen, dst_tex,
+                                     subdst.face, subdst.level, dstz,
+                                     PIPE_BIND_RENDER_TARGET);
+
    SVGA_DBG(DEBUG_DMA, "blit to sid %p (%d,%d), from sid %p (%d,%d) sz %dx%d\n",
-            svga_surface(dest)->handle,
-            destx, desty,
-            svga_surface(src)->handle,
+            svga_surface(dstsurf)->handle,
+            dstx, dsty,
+            svga_surface(srcsurf)->handle,
             srcx, srcy,
             width, height);
 
    ret = SVGA3D_BeginSurfaceCopy(svga->swc,
-                                 src,
-                                 dest,
+                                 srcsurf,
+                                 dstsurf,
                                  &box,
                                  1);
    if(ret != PIPE_OK) {
@@ -62,15 +76,15 @@ static void svga_surface_copy(struct pipe_context *pipe,
       svga_context_flush(svga, NULL);
 
       ret = SVGA3D_BeginSurfaceCopy(svga->swc,
-                                    src,
-                                    dest,
+                                    srcsurf,
+                                    dstsurf,
                                     &box,
                                     1);
       assert(ret == PIPE_OK);
    }
 
-   box->x = destx;
-   box->y = desty;
+   box->x = dstx;
+   box->y = dsty;
    box->z = 0;
    box->w = width;
    box->h = height;
@@ -81,13 +95,18 @@ static void svga_surface_copy(struct pipe_context *pipe,
 
    SVGA_FIFOCommitAll(svga->swc);
 
-   svga_surface(dest)->dirty = TRUE;
-   svga_propagate_surface(pipe, dest);
+   svga_surface(dstsurf)->dirty = TRUE;
+   svga_propagate_surface(pipe, dstsurf);
+
+   pipe_surface_reference(&srcsurf, NULL);
+   pipe_surface_reference(&dstsurf, NULL);
+
 }
 
 
 void
 svga_init_blit_functions(struct svga_context *svga)
 {
-   svga->pipe.surface_copy = svga_surface_copy;
+   svga->pipe.resource_copy_region = svga_surface_copy;
+   svga->pipe.resource_fill_region = util_resource_fill_region;
 }
index c317bec6d57d02707eef9b2f59523d1714d71b94..c84615a1f3bdc7a013e0ff5dae04514e3b161b53 100644 (file)
@@ -147,6 +147,12 @@ static void svga_set_stencil_ref( struct pipe_context *pipe,
    svga->dirty |= SVGA_NEW_STENCIL_REF;
 }
 
+static void
+svga_set_sample_mask(struct pipe_context *pipe,
+                     unsigned sample_mask)
+{
+}
+
 
 void svga_init_depth_stencil_functions( struct svga_context *svga )
 {
@@ -155,6 +161,7 @@ void svga_init_depth_stencil_functions( struct svga_context *svga )
    svga->pipe.delete_depth_stencil_alpha_state = svga_delete_depth_stencil_state;
 
    svga->pipe.set_stencil_ref = svga_set_stencil_ref;
+   svga->pipe.set_sample_mask = svga_set_sample_mask;
 }
 
 
index bef22f41ae5d2bdf5d44014c3c93bbec28bf3938..99b419178b0b3db2fc6631ca2fd5bb9ad5851b69 100644 (file)
@@ -290,17 +290,21 @@ svga_translate_format_cap(enum pipe_format format)
 
 static boolean
 svga_is_format_supported( struct pipe_screen *screen,
-                          enum pipe_format format, 
+                          enum pipe_format format,
                           enum pipe_texture_target target,
-                          unsigned tex_usage, 
+                          unsigned sample_count,
+                          unsigned tex_usage,
                           unsigned geom_flags )
 {
    struct svga_winsys_screen *sws = svga_screen(screen)->sws;
    SVGA3dDevCapIndex index;
    SVGA3dDevCapResult result;
-   
+
    assert(tex_usage);
 
+   if (sample_count > 1)
+      return FALSE;
+
    /* Override host capabilities */
    if (tex_usage & PIPE_BIND_RENDER_TARGET) {
       switch(format) { 
index 066fa6b9ac9cc21c159f7c9ed027eaa3e906a627..5cc244d4b779ea0bd73cad4b40660b567cbe4767 100644 (file)
@@ -764,6 +764,22 @@ trace_context_set_clip_state(struct pipe_context *_pipe,
    trace_dump_call_end();
 }
 
+static INLINE void
+trace_context_set_sample_mask(struct pipe_context *_pipe,
+                              unsigned sample_mask)
+{
+   struct trace_context *tr_ctx = trace_context(_pipe);
+   struct pipe_context *pipe = tr_ctx->pipe;
+
+   trace_dump_call_begin("pipe_context", "set_sample_mask");
+
+   trace_dump_arg(ptr, pipe);
+   trace_dump_arg(uint, sample_mask);
+
+   pipe->set_sample_mask(pipe, sample_mask);
+
+   trace_dump_call_end();
+}
 
 static INLINE void
 trace_context_set_constant_buffer(struct pipe_context *_pipe,
@@ -1029,61 +1045,72 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_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)
+trace_context_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)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
 
-   dest = trace_surface_unwrap(tr_ctx, dest);
-   src = trace_surface_unwrap(tr_ctx, src);
+   dst = trace_resource_unwrap(tr_ctx, dst);
+   src = trace_resource_unwrap(tr_ctx, src);
 
-   trace_dump_call_begin("pipe_context", "surface_copy");
+   trace_dump_call_begin("pipe_context", "resource_copy_region");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(ptr, dest);
-   trace_dump_arg(uint, destx);
-   trace_dump_arg(uint, desty);
+   trace_dump_arg(ptr, dst);
+   trace_dump_arg_struct(subresource, subdst);
+   trace_dump_arg(uint, dstx);
+   trace_dump_arg(uint, dsty);
+   trace_dump_arg(uint, dstz);
    trace_dump_arg(ptr, src);
+   trace_dump_arg_struct(subresource, subsrc);
    trace_dump_arg(uint, srcx);
    trace_dump_arg(uint, srcy);
+   trace_dump_arg(uint, srcz);
    trace_dump_arg(uint, width);
    trace_dump_arg(uint, height);
 
-   pipe->surface_copy(pipe,
-                      dest, destx, desty,
-                      src, srcx, srcy, width, height);
+   pipe->resource_copy_region(pipe,
+                              dst, subdst, dstx, dsty, dstz,
+                              src, subsrc, srcx, srcy, srcz, width, height);
 
    trace_dump_call_end();
 }
 
 
 static INLINE void
-trace_context_surface_fill(struct pipe_context *_pipe,
-                           struct pipe_surface *dst,
-                           unsigned dstx, unsigned dsty,
-                           unsigned width, unsigned height,
-                           unsigned value)
+trace_context_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)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
 
-   dst = trace_surface_unwrap(tr_ctx, dst);
+   dst = trace_resource_unwrap(tr_ctx, dst);
 
-   trace_dump_call_begin("pipe_context", "surface_fill");
+   trace_dump_call_begin("pipe_context", "resource_fill_region");
 
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(ptr, dst);
+   trace_dump_arg_struct(subresource, subdst);
    trace_dump_arg(uint, dstx);
    trace_dump_arg(uint, dsty);
+   trace_dump_arg(uint, dstz);
    trace_dump_arg(uint, width);
    trace_dump_arg(uint, height);
+   trace_dump_arg(uint, value);
 
-   pipe->surface_fill(pipe, dst, dstx, dsty, width, height, value);
+   pipe->resource_fill_region(pipe, dst, subdst, dstx, dsty, dstz,
+                              width, height, value);
 
    trace_dump_call_end();
 }
@@ -1412,6 +1439,7 @@ trace_context_create(struct trace_screen *tr_scr,
    tr_ctx->base.set_blend_color = trace_context_set_blend_color;
    tr_ctx->base.set_stencil_ref = trace_context_set_stencil_ref;
    tr_ctx->base.set_clip_state = trace_context_set_clip_state;
+   tr_ctx->base.set_sample_mask = trace_context_set_sample_mask;
    tr_ctx->base.set_constant_buffer = trace_context_set_constant_buffer;
    tr_ctx->base.set_framebuffer_state = trace_context_set_framebuffer_state;
    tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple;
@@ -1422,10 +1450,8 @@ trace_context_create(struct trace_screen *tr_scr,
    tr_ctx->base.create_sampler_view = trace_create_sampler_view;
    tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy;
    tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers;
-   if (pipe->surface_copy)
-      tr_ctx->base.surface_copy = trace_context_surface_copy;
-   if (pipe->surface_fill)
-      tr_ctx->base.surface_fill = trace_context_surface_fill;
+   tr_ctx->base.resource_copy_region = trace_context_resource_copy_region;
+   tr_ctx->base.resource_fill_region = trace_context_resource_fill_region;
    tr_ctx->base.clear = trace_context_clear;
    tr_ctx->base.flush = trace_context_flush;
    tr_ctx->base.is_resource_referenced = trace_is_resource_referenced;
index ac0b906000137ba095365936cf77632ce4de4a9f..32e519a68a094e0263ef50aa145f74d4605ac94a 100644 (file)
@@ -133,6 +133,7 @@ static boolean
 trace_screen_is_format_supported(struct pipe_screen *_screen,
                                  enum pipe_format format,
                                  enum pipe_texture_target target,
+                                 unsigned sample_count,
                                  unsigned tex_usage,
                                  unsigned geom_flags)
 {
@@ -145,10 +146,12 @@ trace_screen_is_format_supported(struct pipe_screen *_screen,
    trace_dump_arg(ptr, screen);
    trace_dump_arg(format, format);
    trace_dump_arg(int, target);
+   trace_dump_arg(uint, sample_count);
    trace_dump_arg(uint, tex_usage);
    trace_dump_arg(uint, geom_flags);
 
-   result = screen->is_format_supported(screen, format, target, tex_usage, geom_flags);
+   result = screen->is_format_supported(screen, format, target, sample_count,
+                                        tex_usage, geom_flags);
 
    trace_dump_ret(bool, result);
 
index 6f47845f3b805869774e22614f4f0ef7e75552a4..6b729831768041dcbc3299e42457701cfb475468 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,47 @@ 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 8201c29ac7622a312251b708d02d823101fbbc2a..b54a6ef8247d8f0308c4aa6bf2a1dfd3224fe4bb 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 0d9de48c9094a9fbd2ad0241cd6d3dd031905ea0..21f428ed4af0862b1e1e0bd050188de68d5fc326 100644 (file)
@@ -88,7 +88,7 @@ struct pipe_screen {
 
    struct pipe_context * (*context_create)( struct pipe_screen *,
                                            void *priv );
-   
+
    /**
     * Check if the given pipe_format is supported as a texture or
     * drawing surface.
@@ -98,7 +98,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 );
 
    /**
index a01698d7674c47da78835df6b45fc8c49471fe5b..5255b2003f8d5b0d823af80bcffb31467058b65d 100644 (file)
@@ -219,6 +219,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];
 };
 
index f641b41ff8b5b618a6e0cab243c0b41bf0a7651e..ad6c7d375047d1c875865937f11d54034f6897b6 100644 (file)
@@ -93,7 +93,7 @@ dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex)
       pipe_surface_reference(&drawable->dri1_surface, NULL);
 
       drawable->dri1_surface = pipe_screen->get_tex_surface(pipe_screen,
-            ptex, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
+            ptex, 0, 0, 0, 0/* no bind flag???*/);
 
       psurf = drawable->dri1_surface;
    }
index 064c73f54c2eafc96803ac3ab4f85902f1059c5c..81523b82ba9efcab74dd13a6f9dc1d6e8d7f9efd 100644 (file)
@@ -72,13 +72,13 @@ dri_fill_in_modes(struct dri_screen *screen,
    __DRIconfig **configs_r5g6b5 = NULL;
    __DRIconfig **configs_a8r8g8b8 = NULL;
    __DRIconfig **configs_x8r8g8b8 = NULL;
-   unsigned num_modes;
    uint8_t depth_bits_array[5];
    uint8_t stencil_bits_array[5];
-   uint8_t msaa_samples_array[2];
+   uint8_t msaa_samples_array[5];
    unsigned depth_buffer_factor;
    unsigned back_buffer_factor;
    unsigned msaa_samples_factor;
+   unsigned i;
    struct pipe_screen *p_screen = screen->base.screen;
    boolean pf_r5g6b5, pf_a8r8g8b8, pf_x8r8g8b8;
    boolean pf_z16, pf_x8z24, pf_z24x8, pf_s8z24, pf_z24s8, pf_z32;
@@ -92,34 +92,34 @@ dri_fill_in_modes(struct dri_screen *screen,
    depth_buffer_factor = 1;
 
    pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM,
-                                           PIPE_TEXTURE_2D,
+                                           PIPE_TEXTURE_2D, 0,
                                            PIPE_BIND_DEPTH_STENCIL, 0);
    pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM,
-                                           PIPE_TEXTURE_2D,
+                                           PIPE_TEXTURE_2D, 0,
                                            PIPE_BIND_DEPTH_STENCIL, 0);
    pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
-                                           PIPE_TEXTURE_2D,
+                                           PIPE_TEXTURE_2D, 0,
                                            PIPE_BIND_DEPTH_STENCIL, 0);
    pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
-                                           PIPE_TEXTURE_2D,
+                                           PIPE_TEXTURE_2D, 0,
                                            PIPE_BIND_DEPTH_STENCIL, 0);
    pf_a8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
-                                              PIPE_TEXTURE_2D,
+                                              PIPE_TEXTURE_2D, 0,
                                               PIPE_BIND_RENDER_TARGET, 0);
    pf_x8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM,
-                                              PIPE_TEXTURE_2D,
+                                              PIPE_TEXTURE_2D, 0,
                                               PIPE_BIND_RENDER_TARGET, 0);
    pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM,
-                                            PIPE_TEXTURE_2D,
+                                            PIPE_TEXTURE_2D, 0,
                                             PIPE_BIND_RENDER_TARGET, 0);
 
    /* We can only get a 16 or 32 bit depth buffer with getBuffersWithFormat */
    if (dri_with_format(screen->sPriv)) {
       pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
-                                             PIPE_TEXTURE_2D,
+                                             PIPE_TEXTURE_2D, 0,
                                              PIPE_BIND_DEPTH_STENCIL, 0);
       pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM,
-                                             PIPE_TEXTURE_2D,
+                                             PIPE_TEXTURE_2D, 0,
                                              PIPE_BIND_DEPTH_STENCIL, 0);
    } else {
       pf_z16 = FALSE;
@@ -146,22 +146,39 @@ dri_fill_in_modes(struct dri_screen *screen,
    }
 
    msaa_samples_array[0] = 0;
-   msaa_samples_array[1] = 4;
    back_buffer_factor = 3;
-   msaa_samples_factor = 2;
 
-   num_modes =
-      depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
+   /* also test color for msaa 2/4/6/8 - just assume it'll work for all depth buffers */
+   if (pf_r5g6b5) {
+      msaa_samples_factor = 1;
+      for (i = 1; i < 5; i++) {
+         if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM,
+                                                  PIPE_TEXTURE_2D, i*2,
+                                                  PIPE_BIND_RENDER_TARGET, 0)) {
+            msaa_samples_array[msaa_samples_factor] = i * 2;
+            msaa_samples_factor++;
+         }
+      }
 
-   if (pf_r5g6b5)
       configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
                                         depth_bits_array, stencil_bits_array,
                                         depth_buffer_factor, back_buffer_modes,
                                         back_buffer_factor,
                                         msaa_samples_array, msaa_samples_factor,
                                         GL_TRUE);
+   }
+
+   if (pf_a8r8g8b8) {
+      msaa_samples_factor = 1;
+      for (i = 1; i < 5; i++) {
+         if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
+                                                  PIPE_TEXTURE_2D, i*2,
+                                                  PIPE_BIND_RENDER_TARGET, 0)) {
+            msaa_samples_array[msaa_samples_factor] = i * 2;
+            msaa_samples_factor++;
+         }
+      }
 
-   if (pf_a8r8g8b8)
       configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
                                           depth_bits_array,
                                           stencil_bits_array,
@@ -171,8 +188,19 @@ dri_fill_in_modes(struct dri_screen *screen,
                                           msaa_samples_array,
                                           msaa_samples_factor,
                                           GL_TRUE);
+   }
+
+   if (pf_x8r8g8b8) {
+      msaa_samples_factor = 1;
+      for (i = 1; i < 5; i++) {
+         if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM,
+                                                  PIPE_TEXTURE_2D, i*2,
+                                                  PIPE_BIND_RENDER_TARGET, 0)) {
+            msaa_samples_array[msaa_samples_factor] = i * 2;
+            msaa_samples_factor++;
+         }
+      }
 
-   if (pf_x8r8g8b8)
       configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV,
                                           depth_bits_array,
                                           stencil_bits_array,
@@ -182,6 +210,7 @@ dri_fill_in_modes(struct dri_screen *screen,
                                           msaa_samples_array,
                                           msaa_samples_factor,
                                           GL_TRUE);
+   }
 
    if (pixel_bits == 16) {
       configs = configs_r5g6b5;
index 326ff8bcadaa60c0ca9cd22307e39f5345c62cb9..9f0b925731232d86da34442473171135d60a0398 100644 (file)
@@ -156,24 +156,22 @@ dri1_swap_copy(struct pipe_context *pipe,
    struct drm_clip_rect clip;
    struct drm_clip_rect *cur;
    int i;
+   struct pipe_subresource subdst, subsrc;
+   subsrc.face = 0;
+   subsrc.level = 0;
+   subdst.face = 0;
+   subdst.level = 0;
 
    cur = dPriv->pClipRects;
 
    for (i = 0; i < dPriv->numClipRects; ++i) {
       if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) {
-         if (pipe->surface_copy) {
-            pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
-                               src,
-                               (int)clip.x1 - dPriv->x,
-                               (int)clip.y1 - dPriv->y,
-                               clip.x2 - clip.x1, clip.y2 - clip.y1);
-         } else {
-            util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1,
-                              src,
-                              (int)clip.x1 - dPriv->x,
-                              (int)clip.y1 - dPriv->y,
-                              clip.x2 - clip.x1, clip.y2 - clip.y1);
-         }
+         pipe->resource_copy_region(pipe, dst->texture, subdst,
+                                    clip.x1, clip.y1, 0,
+                                    src->texture, subsrc,
+                                    (int)clip.x1 - dPriv->x,
+                                    (int)clip.y1 - dPriv->y, 0,
+                                    clip.x2 - clip.x1, clip.y2 - clip.y1);
       }
    }
 }
@@ -204,6 +202,8 @@ dri1_present_texture_locked(__DRIdrawable * dPriv,
       return;
 
    pipe = dri1_get_pipe_context(screen);
+   /* XXX should probably use resources instead of surfaces in the api
+      - we get surface but only use the texture from it it seems... */
    psurf = dri1_get_pipe_surface(drawable, ptex);
    if (!pipe || !psurf)
       return;
index 5c6fe97922a7bf0944b29121f2eb07a71cddb7ad..d63b81a1c59b868a55a9cbf8416b8b4129bbe00c 100644 (file)
@@ -351,7 +351,7 @@ egl_g3d_fill_depth_stencil_formats(_EGLDisplay *dpy,
       /* pick the first supported format */
       for (i = 0; i < n; i++) {
          if (screen->is_format_supported(screen, fmt[i],
-                  PIPE_TEXTURE_2D, PIPE_BIND_DEPTH_STENCIL, 0)) {
+                  PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) {
             formats[count++] = fmt[i];
             break;
          }
index 478516453cef98797d4f3bfbab1058434070dc40..4615a5829a665a6b9a148f6b01d3a63e2d7966dc 100644 (file)
@@ -407,24 +407,16 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
 /**
  * Get the pipe surface of the given attachment of the native surface.
  */
-static struct pipe_surface *
-get_pipe_surface(struct native_display *ndpy, struct native_surface *nsurf,
-                 enum native_attachment natt,
-                unsigned bind)
+static struct pipe_resource *
+get_pipe_resource(struct native_display *ndpy, struct native_surface *nsurf,
+                  enum native_attachment natt)
 {
    struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
-   struct pipe_surface *psurf;
 
    textures[natt] = NULL;
    nsurf->validate(nsurf, 1 << natt, NULL, textures, NULL, NULL);
-   if (!textures[natt])
-      return NULL;
-
-   psurf = ndpy->screen->get_tex_surface(ndpy->screen, textures[natt],
-         0, 0, 0, bind);
-   pipe_resource_reference(&textures[natt], NULL);
 
-   return psurf;
+   return textures[natt];
 }
 
 static EGLBoolean
@@ -437,7 +429,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
    struct egl_g3d_config *gconf;
    struct native_surface *nsurf;
    struct pipe_screen *screen = gdpy->native->screen;
-   struct pipe_surface *psurf;
+   struct pipe_resource *ptex;
 
    if (!gsurf->render_texture)
       return EGL_TRUE;
@@ -466,22 +458,23 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
          return EGL_FALSE;
    }
 
-   psurf = get_pipe_surface(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT,
-                           PIPE_BIND_BLIT_DESTINATION);
-   if (psurf) {
+   ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
+   if (ptex) {
       struct pipe_surface *psrc;
+      struct pipe_subresource subsrc, subdst;
+      subsrc.face = 0;
+      subsrc.level = 0;
+      subdst.face = 0;
+      subdst.level = 0;
 
-      psrc = screen->get_tex_surface(screen, gsurf->render_texture,
-            0, 0, 0, PIPE_BIND_BLIT_SOURCE);
       if (psrc) {
-         gdpy->pipe->surface_copy(gdpy->pipe, psurf, 0, 0,
-               psrc, 0, 0, psurf->width, psurf->height);
-         pipe_surface_reference(&psrc, NULL);
+         gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, subdst, 0, 0, 0,
+               gsurf->render_texture, subsrc, 0, 0, 0, ptex->width0, ptex->height0);
 
          nsurf->flush_frontbuffer(nsurf);
       }
 
-      pipe_surface_reference(&psurf, NULL);
+      pipe_resource_reference(&ptex, NULL);
    }
 
    nsurf->destroy(nsurf);
index cf7188dfdb79b5050cd13a8b0021bcb0f3665686..d81178e559262a5f3d1f722efaac6740ebab81a7 100644 (file)
@@ -563,7 +563,7 @@ kms_display_is_format_supported(struct native_display *ndpy,
                                 enum pipe_format fmt, boolean is_color)
 {
    return ndpy->screen->is_format_supported(ndpy->screen,
-         fmt, PIPE_TEXTURE_2D,
+         fmt, PIPE_TEXTURE_2D, 0,
          (is_color) ? PIPE_BIND_RENDER_TARGET :
          PIPE_BIND_DEPTH_STENCIL, 0);
 }
index d37f66da07e479c9cfff82a725a8b0000f117951..63877ed5e51f6181711c95b57cacbbfe0ec50b76 100644 (file)
@@ -498,9 +498,9 @@ choose_color_format(const __GLcontextModes *mode, enum pipe_format formats[32])
 
 static boolean
 is_format_supported(struct pipe_screen *screen,
-                    enum pipe_format fmt, boolean is_color)
+                    enum pipe_format fmt, unsigned sample_count, boolean is_color)
 {
-   return screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D,
+   return screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, sample_count,
          (is_color) ? PIPE_BIND_RENDER_TARGET :
          PIPE_BIND_DEPTH_STENCIL, 0);
 }
@@ -512,6 +512,7 @@ dri2_display_convert_config(struct native_display *ndpy,
 {
    enum pipe_format formats[32];
    int num_formats, i;
+   int sample_count = 0;
 
    if (!(mode->renderType & GLX_RGBA_BIT) || !mode->rgbMode)
       return FALSE;
@@ -536,7 +537,7 @@ dri2_display_convert_config(struct native_display *ndpy,
    /* choose color format */
    num_formats = choose_color_format(mode, formats);
    for (i = 0; i < num_formats; i++) {
-      if (is_format_supported(ndpy->screen, formats[i], TRUE)) {
+      if (is_format_supported(ndpy->screen, formats[i], sample_count, TRUE)) {
          nconf->color_format = formats[i];
          break;
       }
index f3b0617f76b7b55390115fbde7b043541f9621fe..a6f808bc9641c4661ba7e29b5c32db7e1453757a 100644 (file)
@@ -342,6 +342,7 @@ choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil)
    const unsigned tex_usage = PIPE_BIND_DEPTH_STENCIL;
    const unsigned geom_flags = (PIPE_TEXTURE_GEOM_NON_SQUARE |
                                 PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO);
+   const unsigned sample_count = 0;
    enum pipe_format formats[8], fmt;
    int count, i;
 
@@ -365,7 +366,8 @@ choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil)
    fmt = PIPE_FORMAT_NONE;
    for (i = 0; i < count; i++) {
       if (xmdpy->screen->is_format_supported(xmdpy->screen, formats[i],
-                                      target, tex_usage, geom_flags)) {
+                                             target, sample_count,
+                                             tex_usage, geom_flags)) {
          fmt = formats[i];
          break;
       }
index 1c678b4f76054c548b4597481f6fe93238a69257..c62eb8bfbd1d3bbb651f406c49758ce0aa759fcf 100644 (file)
@@ -96,7 +96,7 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
    struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
    struct pipe_resource *src_ptex = xstfb->textures[src_statt];
    struct pipe_resource *dst_ptex = xstfb->textures[dst_statt];
-   struct pipe_surface *src, *dst;
+   struct pipe_subresource subsrc, subdst;
    struct pipe_context *pipe;
 
    if (!src_ptex || !dst_ptex)
@@ -110,16 +110,14 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
       xstfb->display->pipe = pipe;
    }
 
-   src = xstfb->screen->get_tex_surface(xstfb->screen,
-         src_ptex, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
-   dst = xstfb->screen->get_tex_surface(xstfb->screen,
-         dst_ptex, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION);
+   subsrc.face = 0;
+   subsrc.level = 0;
+   subdst.face = 0;
+   subdst.level = 0;
 
-   if (src && dst)
-      pipe->surface_copy(pipe, dst, x, y, src, x, y, width, height);
-
-   pipe_surface_reference(&src, NULL);
-   pipe_surface_reference(&dst, NULL);
+   if (src_ptex && dst_ptex)
+      pipe->resource_copy_region(pipe, dst_ptex, subdst, x, y, 0,
+                                 src_ptex, subsrc, x, y, 0, width, height);
 }
 
 /**
index 3c5509cb5e427c0fc3e06c836907099d1e3ec776..3d7b640b47281ea1ddc6b703cbda318ac1a46ee8 100644 (file)
@@ -413,16 +413,17 @@ error1:
    /*
     * Surface functions
     */
-   
+
    void surface_copy(struct st_surface *dst,
                      unsigned destx, unsigned desty,
                      struct st_surface *src,
                      unsigned srcx, unsigned srcy,
                      unsigned width, unsigned height) 
    {
+/* XXX
       struct pipe_surface *_dst = NULL;
       struct pipe_surface *_src = NULL;
-      
+
       _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION);
       if(!_dst)
          SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
@@ -430,12 +431,20 @@ error1:
       _src = st_pipe_surface(src, PIPE_BIND_BLIT_SOURCE);
       if(!_src)
          SWIG_exception(SWIG_ValueError, "couldn't acquire source surface for reading");
-      
+
       $self->pipe->surface_copy($self->pipe, _dst, destx, desty, _src, srcx, srcy, width, height);
-      
+
    fail:
       pipe_surface_reference(&_src, NULL);
       pipe_surface_reference(&_dst, NULL);
+*/
+   struct pipe_subresource subdst, subsrc;
+   subsrc.face = src->face;
+   subsrc.level = src->level;
+   subdst.face = dst->face;
+   subdst.level = dst->level;
+   $self->pipe->resource_copy_region($self->pipe, dst->texture, subdst, destx, desty, dst->zslice,
+                                     src->texture, subsrc, srcx, srcy, src->zslice, width, height);
    }
 
    void surface_fill(struct st_surface *dst,
@@ -443,16 +452,23 @@ error1:
                      unsigned width, unsigned height,
                      unsigned value) 
    {
+/* XXX
       struct pipe_surface *_dst = NULL;
-      
-      _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION);
+
+     _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION);
       if(!_dst)
          SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
 
       $self->pipe->surface_fill($self->pipe, _dst, x, y, width, height, value);
-      
+
    fail:
       pipe_surface_reference(&_dst, NULL);
+*/
+   struct pipe_subresource subdst;
+   subdst.face = dst->face;
+   subdst.level = dst->level;
+   $self->pipe->resource_fill_region($self->pipe, dst->texture, subdst, x, y, dst->zslice,
+                                     width, height, value);
    }
 
    %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
index 959c13f54d9fae53de33c5ee6fe74defb2f4f582..d55086fefd54b8b4756f1abcd694990d29256f67 100644 (file)
@@ -85,16 +85,18 @@ struct st_device {
     */
    int is_format_supported( enum pipe_format format, 
                             enum pipe_texture_target target,
+                            unsigned sample_count,
                             unsigned bind, 
                             unsigned geom_flags ) {
       /* We can't really display surfaces with the python statetracker so mask
        * out that usage */
       bind &= ~PIPE_BIND_DISPLAY_TARGET;
 
-      return $self->screen->is_format_supported( $self->screen, 
-                                                 format, 
-                                                 target, 
-                                                 bind, 
+      return $self->screen->is_format_supported( $self->screen,
+                                                 format,
+                                                 target,
+                                                 sample_count,
+                                                 bind,
                                                  geom_flags );
    }
 
index 9c323b1809cc4646f83bccde6cf71bd7522372d5..7c421dfcd4e028e314c90a8a1281ed398a84fbb7 100644 (file)
@@ -270,7 +270,7 @@ struct vg_image * image_create(VGImageFormat format,
    image->sampler.normalized_coords = 1;
 
    assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
+                                      0, PIPE_BIND_SAMPLER_VIEW, 0));
 
    memset(&pt, 0, sizeof(pt));
    pt.target = PIPE_TEXTURE_2D;
@@ -576,7 +576,7 @@ void image_set_pixels(VGint dx, VGint dy,
    pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
    surf = screen->get_tex_surface(screen, image_texture(src),  0, 0, 0,
-                                  PIPE_BIND_BLIT_SOURCE);
+                                  0 /* no bind flags as surf isn't actually used??? */);
 
    vg_copy_surface(ctx, strb->surface, dx, dy,
                    surf, sx+src->x, sy+src->y, width, height);
@@ -601,7 +601,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
    pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
    surf = screen->get_tex_surface(screen, image_texture(dst),  0, 0, 0,
-                                  PIPE_BIND_BLIT_SOURCE);
+                                  0 /* no bind flags as surf isn't actually used??? */);
 
    vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
                    strb->surface, sx, sy, width, height);
index e6aea482a761ca4b5ecea8d02a7a426516ba1e9b..fe0f166e88532bfb6e847d131069a303ba69a4ea 100644 (file)
@@ -308,7 +308,7 @@ void renderer_copy_texture(struct renderer *ctx,
 #endif
 
    assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_RENDER_TARGET, 0));
+                                      0, PIPE_BIND_RENDER_TARGET, 0));
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
@@ -415,7 +415,7 @@ void renderer_copy_surface(struct renderer *ctx,
    struct pipe_sampler_view view_templ;
    struct pipe_sampler_view *view;
    struct pipe_resource texTemp, *tex;
-   struct pipe_surface *texSurf;
+   struct pipe_subresource subsrc, subdst;
    struct pipe_framebuffer_state fb;
    struct st_framebuffer *stfb = ctx->owner->draw_buffer;
    const int srcW = abs(srcX1 - srcX0);
@@ -441,11 +441,11 @@ void renderer_copy_surface(struct renderer *ctx,
    }
 
    assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
+                                      0, PIPE_BIND_SAMPLER_VIEW, 0));
    assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
+                                      0, PIPE_BIND_SAMPLER_VIEW, 0));
    assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_RENDER_TARGET, 0));
+                                      0, PIPE_BIND_RENDER_TARGET, 0));
 
    /*
     * XXX for now we're always creating a temporary texture.
@@ -460,6 +460,7 @@ void renderer_copy_surface(struct renderer *ctx,
    texTemp.width0 = srcW;
    texTemp.height0 = srcH;
    texTemp.depth0 = 1;
+   texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &texTemp);
    if (!tex)
@@ -471,24 +472,15 @@ void renderer_copy_surface(struct renderer *ctx,
    if (!view)
       return;
 
-   texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                     PIPE_BIND_RENDER_TARGET);
-
-   /* load temp texture */
-   if (pipe->surface_copy) {
-      pipe->surface_copy(pipe,
-                         texSurf, 0, 0,   /* dest */
-                         src, srcLeft, srcTop, /* src */
-                         srcW, srcH);     /* size */
-   } else {
-      util_surface_copy(pipe, FALSE,
-                        texSurf, 0, 0,   /* dest */
-                        src, srcLeft, srcTop, /* src */
-                        srcW, srcH);     /* size */
-   }
+   subdst.face = 0;
+   subdst.level = 0;
+   subsrc.face = src->face;
+   subsrc.level = src->level;
 
-   /* free the surface, update the texture if necessary.*/
-   screen->tex_surface_destroy(texSurf);
+   pipe->resource_copy_region(pipe,
+                              tex, subdst, 0, 0, 0,  /* dest */
+                              src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */
+                              srcW, srcH);     /* size */
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
index f6b07f2109f92d1a5fed941bf105085d38db4a45..f02db8949df3884307fac872545a98ab83200485 100644 (file)
@@ -457,8 +457,7 @@ void vg_prepare_blend_surface(struct vg_context *ctx)
    dest_surface = pipe->screen->get_tex_surface(pipe->screen,
                                                 stfb->blend_texture_view->texture,
                                                 0, 0, 0,
-                                                PIPE_BIND_BLIT_DESTINATION |
-                                               PIPE_BIND_RENDER_TARGET);
+                                                PIPE_BIND_RENDER_TARGET);
    /* flip it, because we want to use it as a sampler */
    util_blit_pixels_tex(ctx->blit,
                         view,
@@ -494,8 +493,7 @@ void vg_prepare_blend_surface_from_mask(struct vg_context *ctx)
    dest_surface = pipe->screen->get_tex_surface(pipe->screen,
                                                 stfb->blend_texture_view->texture,
                                                 0, 0, 0,
-                                                PIPE_BIND_BLIT_DESTINATION |
-                                               PIPE_BIND_RENDER_TARGET);
+                                                PIPE_BIND_RENDER_TARGET);
 
    /* flip it, because we want to use it as a sampler */
    util_blit_pixels_tex(ctx->blit,
index f1bc57878557b22f7cd3eeb489af7dfbdabfc62e..3b04816df04dfc8533040b92aa88e5356307e799 100644 (file)
@@ -124,28 +124,22 @@ setup_new_alpha_mask(struct vg_context *ctx, struct st_framebuffer *stfb)
 
    /* if we had an old surface copy it over */
    if (old_sampler_view) {
-      struct pipe_surface *surface = pipe->screen->get_tex_surface(
-         pipe->screen,
-         stfb->alpha_mask_view->texture,
-         0, 0, 0,
-         PIPE_BIND_RENDER_TARGET |
-         PIPE_BIND_BLIT_DESTINATION);
-      struct pipe_surface *old_surface = pipe->screen->get_tex_surface(
-         pipe->screen,
-         old_sampler_view->texture,
-         0, 0, 0,
-         PIPE_BIND_BLIT_SOURCE);
-      pipe->surface_copy(pipe,
-                         surface,
-                         0, 0,
-                         old_surface,
-                         0, 0,
-                         MIN2(old_surface->width, surface->width),
-                         MIN2(old_surface->height, surface->height));
-      if (surface)
-         pipe_surface_reference(&surface, NULL);
-      if (old_surface)
-         pipe_surface_reference(&old_surface, NULL);
+      struct pipe_subresource subsurf, subold_surf;
+      subsurf.face = 0;
+      subsurf.level = 0;
+      subold_surf.face = 0;
+      subold_surf.level = 0;
+      pipe->resource_copy_region(pipe,
+                                 stfb->alpha_mask_view->texture,
+                                 subsurf,
+                                 0, 0, 0,
+                                 old_sampler_view->texture,
+                                 subold_surf,
+                                 0, 0, 0,
+                                 MIN2(old_sampler_view->texture->width0,
+                                      stfb->alpha_mask_view->texture->width0),
+                                 MIN2(old_sampler_view->texture->height0,
+                                      stfb->alpha_mask_view->texture->height0));
    }
 
    /* Free the old texture
@@ -172,9 +166,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
 
    /* Probably need dedicated flags for surface usage too:
     */
-   surface_usage = (PIPE_BIND_RENDER_TARGET |
-                    PIPE_BIND_BLIT_SOURCE |
-                    PIPE_BIND_BLIT_DESTINATION);
+   surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */
 
    dsrb->texture = create_texture(pipe, dsrb->format, width, height);
    if (!dsrb->texture)
@@ -216,9 +208,7 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
 
    strb->texture = pt;
    strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
-         PIPE_BIND_RENDER_TARGET |
-         PIPE_BIND_BLIT_SOURCE |
-         PIPE_BIND_BLIT_DESTINATION);
+                                           PIPE_BIND_RENDER_TARGET);
    if (!strb->surface) {
       pipe_resource_reference(&strb->texture, NULL);
       return TRUE;
index 11e779d25f8e1bb387ea0fe00cf113e98f25811f..e606477e975fb6d02c698273a1a4ec89ea3f4dd0 100644 (file)
@@ -225,8 +225,8 @@ stw_pixelformat_init( void )
       for(j = 0; j < Elements(stw_pf_color); ++j) {
          const struct stw_pf_color_info *color = &stw_pf_color[j];
          
-         if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D, 
-                                         PIPE_BIND_RENDER_TARGET |
+         if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D,
+                                         0, PIPE_BIND_RENDER_TARGET |
                                          PIPE_BIND_DISPLAY_TARGET, 0))
             continue;
          
@@ -237,7 +237,7 @@ stw_pixelformat_init( void )
                const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[l];
                
                if(!screen->is_format_supported(screen, depth->format, PIPE_TEXTURE_2D, 
-                                               PIPE_BIND_DEPTH_STENCIL, 0))
+                                               0, PIPE_BIND_DEPTH_STENCIL, 0))
                   continue;
 
                stw_pixelformat_add( stw_dev, color, depth,  0, doublebuffer, samples );
index 921b6900fcd7cbdfb9c12a6677b2a0e7dd087725..e719644d340c5ab3ff226b172789f8df176d3f7e 100644 (file)
@@ -437,10 +437,12 @@ xorg_dri2_init(ScreenPtr pScreen)
     ms->d_depth_bits_last =
         ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM,
                                         PIPE_TEXTURE_2D,
+                                        0,
                                         PIPE_BIND_DEPTH_STENCIL, 0);
     ms->ds_depth_bits_last =
         ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
                                         PIPE_TEXTURE_2D,
+                                        0,
                                         PIPE_BIND_DEPTH_STENCIL, 0);
 
     return DRI2ScreenInit(pScreen, &dri2info);
index 31140f13bb4d2a389f32aca5098d28054c64d72d..ee40bc8ccbd363faa35fff7f809ca13e5cba1bfd 100644 (file)
@@ -347,7 +347,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
        XORG_FALLBACK("not GXcopy");
 
     if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
-                                        priv->tex->target,
+                                        priv->tex->target, 0,
                                         PIPE_BIND_RENDER_TARGET, 0)) {
        XORG_FALLBACK("format %s", util_format_name(priv->tex->format));
     }
@@ -428,39 +428,26 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
        XORG_FALLBACK("alu not GXcopy");
 
     if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
-                                        priv->tex->target,
+                                        priv->tex->target, 0,
                                         PIPE_BIND_RENDER_TARGET, 0))
        XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));
 
     if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
-                                        src_priv->tex->target,
+                                        src_priv->tex->target, 0,
                                         PIPE_BIND_SAMPLER_VIEW, 0))
        XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));
 
     exa->copy.src = src_priv;
     exa->copy.dst = priv;
 
-    /* For same-surface copies, the pipe->surface_copy path is clearly
-     * superior, providing it is implemented.  In other cases it's not
-     * clear what the better path would be, and eventually we'd
-     * probably want to gather timings and choose dynamically.
+    /* XXX this used to use resource_copy_region for same-surface copies,
+     * but they were redefined to not allow overlaps (some of the util code
+     * always assumed this anyway).
+     * Drivers should implement accelerated resource_copy_region or it will
+     * be slow - disable for now.
      */
-    if (exa->pipe->surface_copy &&
-        exa->copy.src == exa->copy.dst) {
-
+    if (0 && exa->copy.src != exa->copy.dst) {
        exa->copy.use_surface_copy = TRUE;
-       
-       exa->copy.src_surface =
-          exa->scrn->get_tex_surface( exa->scrn,
-                                      exa->copy.src->tex,
-                                      0, 0, 0,
-                                      PIPE_BIND_BLIT_SOURCE);
-
-       exa->copy.dst_surface =
-          exa->scrn->get_tex_surface( exa->scrn, 
-                                      exa->copy.dst->tex,
-                                      0, 0, 0, 
-                                      PIPE_BIND_BLIT_DESTINATION );
     }
     else {
        exa->copy.use_surface_copy = FALSE;
@@ -476,7 +463,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
           exa->scrn->get_tex_surface(exa->scrn,
                                      exa->copy.dst->tex,
                                      0, 0, 0,
-                                     PIPE_BIND_BLIT_DESTINATION);
+                                     PIPE_BIND_RENDER_TARGET);
 
 
        renderer_copy_prepare(exa->renderer, 
@@ -506,14 +493,19 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
    (void) priv;
 
    if (exa->copy.use_surface_copy) {
-      /* XXX: consider exposing >1 box in surface_copy interface.
-       */
-      exa->pipe->surface_copy( exa->pipe,
-                             exa->copy.dst_surface,
-                             dstX, dstY,
-                             exa->copy.src_surface,
-                             srcX, srcY,
-                             width, height );
+      struct pipe_subresource subdst, subsrc;
+      subdst.face = 0;
+      subdst.level = 0;
+      subsrc.face = 0;
+      subsrc.level = 0;
+      exa->pipe->resource_copy_region( exa->pipe,
+                                       exa->copy.dst->tex,
+                                       subdst,
+                                       dstX, dstY, 0,
+                                       exa->copy.src->tex,
+                                       subsrc,
+                                       srcX, srcY, 0,
+                                       width, height );
    }
    else {
       renderer_copy_pixmap(exa->renderer, 
@@ -540,7 +532,6 @@ ExaDoneCopy(PixmapPtr pPixmap)
 
    exa->copy.src = NULL;
    exa->copy.dst = NULL;
-   pipe_surface_reference(&exa->copy.src_surface, NULL);
    pipe_surface_reference(&exa->copy.dst_surface, NULL);
    pipe_resource_reference(&exa->copy.src_texture, NULL);
 }
@@ -639,7 +630,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
       XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");
 
    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
-                                       priv->tex->target,
+                                       priv->tex->target, 0,
                                        PIPE_BIND_RENDER_TARGET, 0))
       XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format));
 
@@ -654,7 +645,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
          XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex");
 
       if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
-                                          priv->tex->target,
+                                          priv->tex->target, 0,
                                           PIPE_BIND_SAMPLER_VIEW, 0))
          XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format));
 
@@ -671,7 +662,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
          XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex");
 
       if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
-                                          priv->tex->target,
+                                          priv->tex->target, 0,
                                           PIPE_BIND_SAMPLER_VIEW, 0))
          XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format));
 
@@ -890,23 +881,19 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
        texture = exa->scrn->resource_create(exa->scrn, &template);
 
        if (priv->tex) {
-           struct pipe_surface *dst_surf;
+           struct pipe_subresource subdst, subsrc;
            struct pipe_surface *src_surf;
 
-           dst_surf = exa->scrn->get_tex_surface(
-               exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION);
-           src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
-            if (exa->pipe->surface_copy) {
-               exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
-                                       0, 0, min(width, texture->width0),
-                                       min(height, texture->height0));
-            } else {
-               util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf,
-                                 0, 0, min(width, texture->width0),
-                                 min(height, texture->height0));
-            }
-           exa->scrn->tex_surface_destroy(dst_surf);
-           exa->scrn->tex_surface_destroy(src_surf);
+           subdst.face = 0;
+           subdst.level = 0;
+           subsrc.face = 0;
+           subsrc.level = 0;
+            exa->pipe->resource_copy_region(exa->pipe, texture,
+                                            subdst, 0, 0, 0,
+                                            priv->tex,
+                                            subsrc, 0, 0, 0,
+                                            min(width, texture->width0),
+                                            min(height, texture->height0));
        }
 
        pipe_resource_reference(&priv->tex, texture);
@@ -1076,11 +1063,7 @@ out_err:
 struct pipe_surface *
 xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv)
 {
-   
-   /* seems to get called both for blits and render target usage */
    return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
-                                PIPE_BIND_BLIT_SOURCE |
-                                PIPE_BIND_BLIT_DESTINATION |
                                 PIPE_BIND_RENDER_TARGET);
 
 }
index a35e9a5c9012d6d27fdbb7e4d0fe2abfeea90501..86a1afc06e660cac1750744899a77b69459e8d32 100644 (file)
@@ -40,7 +40,6 @@ struct exa_context
       struct exa_pixmap_priv *src;
       struct exa_pixmap_priv *dst;
 
-      struct pipe_surface *src_surface;
       struct pipe_surface *dst_surface;
 
       struct pipe_resource *src_texture;
index a9610a8678079c5e79517c5cae3f8806db97b8af..e5def3e2edd5a5b7e2b12d850674e6a00eafe2d7 100644 (file)
@@ -448,7 +448,7 @@ void renderer_copy_prepare(struct xorg_renderer *r,
    struct xorg_shader shader;
 
    assert(screen->is_format_supported(screen, dst_surface->format,
-                                      PIPE_TEXTURE_2D,
+                                      PIPE_TEXTURE_2D, 0,
                                       PIPE_BIND_RENDER_TARGET,
                                       0));
    (void) screen;
@@ -524,7 +524,7 @@ renderer_clone_texture(struct xorg_renderer *r,
 
    /* the coming in texture should already have that invariance */
    debug_assert(screen->is_format_supported(screen, src->format,
-                                            PIPE_TEXTURE_2D,
+                                            PIPE_TEXTURE_2D, 0,
                                             PIPE_BIND_SAMPLER_VIEW, 0));
 
    format = src->format;
@@ -547,25 +547,19 @@ renderer_clone_texture(struct xorg_renderer *r,
 
    {
       /* copy source framebuffer surface into texture */
-      struct pipe_surface *ps_read = screen->get_tex_surface(
-         screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
-      struct pipe_surface *ps_tex = screen->get_tex_surface(
-         screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION );
-      if (pipe->surface_copy) {
-         pipe->surface_copy(pipe,
-                ps_tex, /* dest */
-                0, 0, /* destx/y */
-                ps_read,
-                0, 0, src->width0, src->height0);
-      } else {
-          util_surface_copy(pipe, FALSE,
-                ps_tex, /* dest */
-                0, 0, /* destx/y */
-                ps_read,
-                0, 0, src->width0, src->height0);
-      }
-      pipe_surface_reference(&ps_read, NULL);
-      pipe_surface_reference(&ps_tex, NULL);
+      struct pipe_subresource subsrc, subdst;
+      subsrc.face = 0;
+      subsrc.level = 0;
+      subdst.face = 0;
+      subdst.level = 0;
+      pipe->resource_copy_region(pipe,
+                                 pt, /* dest */
+                                 subdst,
+                                 0, 0, 0, /* destx/y/z */
+                                 src,
+                                 subsrc,
+                                 0, 0, 0,
+                                 src->width0, src->height0);
    }
 
    return pt;
index e58a69322eaa302ffc981372e65fdf21fb2015a4..4599d68d7d593d8cf63b68059565220bcdb50635 100755 (executable)
@@ -230,8 +230,8 @@ class Screen(Object):
         context = self.real.context_create()
         return Context(self.interpreter, context)
     
-    def is_format_supported(self, format, target, bind, geom_flags):
-        return self.real.is_format_supported(format, target, bind, geom_flags)
+    def is_format_supported(self, format, target, sample_count, bind, geom_flags):
+        return self.real.is_format_supported(format, target, sample_count, bind, geom_flags)
     
     def resource_create(self, templat):
         return self.real.resource_create(
index 8d841644035d6ba6311981292755fd9543f63110..7a6ede38044bdde96f525c72a413d16e87363b5f 100755 (executable)
@@ -70,13 +70,14 @@ class TextureTest(TestCase):
         face = self.face
         level = self.level
         zslice = self.zslice
-        
+
         bind = PIPE_BIND_SAMPLER_VIEW
         geom_flags = 0
-        if not dev.is_format_supported(format, target, bind, geom_flags):
+        sample_count = 0
+        if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
             raise TestSkip
 
-        if not dev.is_format_supported(format, target, bind, geom_flags):
+        if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
             raise TestSkip
 
         #  textures
index 77f006ea04e00842893901d630e634f0fd6140bb..58706dab93d10fdf2c1db1012ba6011030f558db 100755 (executable)
@@ -130,17 +130,18 @@ class TextureColorSampleTest(TestCase):
         zslice = self.zslice
         minz = 0.0
         maxz = 1.0
-        
+
         bind = PIPE_BIND_SAMPLER_VIEW
         geom_flags = 0
+        sample_count = 0
         if width != height:
             geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
         if not is_pot(width) or not is_pot(height) or not is_pot(depth):
             geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
-        
-        if not dev.is_format_supported(format, target, bind, geom_flags):
+
+        if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
             raise TestSkip
-        
+
         # disabled blending/masking
         blend = Blend()
         blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
@@ -348,17 +349,18 @@ class TextureDepthSampleTest(TestCase):
         zslice = self.zslice
         minz = 0.0
         maxz = 1.0
-        
+
         bind = PIPE_BIND_SAMPLER_VIEW
         geom_flags = 0
+        sample_count = 0
         if width != height:
             geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
         if not is_pot(width) or not is_pot(height) or not is_pot(depth):
             geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
-        
-        if not dev.is_format_supported(format, target, bind, geom_flags):
+
+        if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
             raise TestSkip
-        
+
         # disabled blending/masking
         blend = Blend()
         blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
index 4aa3d6c709bd8a39e3b89008e1558952a852a03e..65c919bc64d72ad4ca8e8f88b0b2c3fa3613ce56 100755 (executable)
@@ -71,12 +71,13 @@ class TextureTest(TestCase):
         face = self.face
         level = self.level
         zslice = self.zslice
-        
+
         bind = PIPE_BIND_SAMPLER_VIEW
         geom_flags = 0
-        if not dev.is_format_supported(format, target, bind, geom_flags):
+        sample_count = 0
+        if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
             raise TestSkip
-        
+
         #  textures
         texture = dev.resource_create(
             target = target,
index 9408e2d2f69f8e1ef13b931bf41c0eb19a549ee2..b553804fcdc838cf07432d3c6d82b72c76e32d24 100644 (file)
@@ -151,6 +151,7 @@ if env['platform'] != 'winddk':
                'state_tracker/st_atom_constbuf.c',
                'state_tracker/st_atom_depth.c',
                'state_tracker/st_atom_framebuffer.c',
+               'state_tracker/st_atom_msaa.c',
                'state_tracker/st_atom_pixeltransfer.c',
                'state_tracker/st_atom_sampler.c',
                'state_tracker/st_atom_scissor.c',
index af125d79aa0b711ab3f65870dace6341f279f6ea..74563bcf96e683c9e487b6c70ad4397f3b7f1c87 100644 (file)
@@ -182,6 +182,7 @@ STATETRACKER_SOURCES = \
        state_tracker/st_atom_constbuf.c \
        state_tracker/st_atom_depth.c \
        state_tracker/st_atom_framebuffer.c \
+       state_tracker/st_atom_msaa.c \
        state_tracker/st_atom_pixeltransfer.c \
        state_tracker/st_atom_sampler.c \
        state_tracker/st_atom_scissor.c \
index cf391f1f91f593d27e561991f0a02560401fb0ce..6f293128d3acb865269f98e4874ac2f469bc6132 100644 (file)
@@ -57,6 +57,7 @@ static const struct st_tracked_state *atoms[] =
    &st_update_sampler,
    &st_update_texture,
    &st_update_framebuffer,
+   &st_update_msaa,
    &st_update_vs_constants,
    &st_update_fs_constants,
    &st_update_pixel_transfer
index f34b49203b226f4c8f2ea03417687d9c15aa4c15..0c25269e0a42c7f9ab7a13525927a379f3a15b7d 100644 (file)
@@ -54,6 +54,7 @@ extern const struct st_tracked_state st_update_polygon_stipple;
 extern const struct st_tracked_state st_update_viewport;
 extern const struct st_tracked_state st_update_scissor;
 extern const struct st_tracked_state st_update_blend;
+extern const struct st_tracked_state st_update_msaa;
 extern const struct st_tracked_state st_update_sampler;
 extern const struct st_tracked_state st_update_texture;
 extern const struct st_tracked_state st_finalize_textures;
index 1511b88dd1fd1233166d5ea67d7cd7b0c7928105..214036058057a1aa7b9dc7a823d27b3feba59152 100644 (file)
@@ -257,6 +257,15 @@ update_blend( struct st_context *st )
    if (st->ctx->Color.DitherFlag)
       blend->dither = 1;
 
+   if (st->ctx->Multisample.Enabled) {
+      /* unlike in gallium/d3d10 these operations are only performed
+         if msaa is enabled */
+      if (st->ctx->Multisample.SampleAlphaToCoverage)
+         blend->alpha_to_coverage = 1;
+      if (st->ctx->Multisample.SampleAlphaToOne)
+         blend->alpha_to_one = 1;
+   }
+
    cso_set_blend(st->cso_context, blend);
 
    {
@@ -270,7 +279,7 @@ update_blend( struct st_context *st )
 const struct st_tracked_state st_update_blend = {
    "st_update_blend",                                  /* name */
    {                                                   /* dirty */
-      (_NEW_COLOR),  /* XXX _NEW_BLEND someday? */     /* mesa */
+      (_NEW_COLOR | _NEW_MULTISAMPLE),  /* XXX _NEW_BLEND someday? */  /* mesa */
       0,                                               /* st */
    },
    update_blend,                                       /* update */
index 52c507da3b3d2948051b5b67446c84ed133190e4..036bc60049abb044281d2a26e1a31d5b40b75fc5 100644 (file)
@@ -73,9 +73,7 @@ update_renderbuffer_surface(struct st_context *st,
                                                    strb->rtt_face,
                                                    level,
                                                    strb->rtt_slice,
-                                                   PIPE_BIND_RENDER_TARGET |
-                                                   PIPE_BIND_BLIT_SOURCE |
-                                                   PIPE_BIND_BLIT_DESTINATION );
+                                                   PIPE_BIND_RENDER_TARGET);
 #if 0
             printf("-- alloc new surface %d x %d into tex %p\n",
                    strb->surface->width, strb->surface->height,
diff --git a/src/mesa/state_tracker/st_atom_msaa.c b/src/mesa/state_tracker/st_atom_msaa.c
new file mode 100644 (file)
index 0000000..ea9eb9a
--- /dev/null
@@ -0,0 +1,83 @@
+/**************************************************************************
+ * 
+ * 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 THE AUTHORS 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.
+ * 
+ **************************************************************************/
+
+
+#include "st_context.h"
+#include "pipe/p_context.h"
+#include "st_atom.h"
+
+#include "cso_cache/cso_context.h"
+
+
+/* Second state atom for user clip planes:
+ */
+static void update_sample_mask( struct st_context *st )
+{
+   unsigned sample_mask = 0xffffffff;
+   unsigned sample_count = 1;
+   struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer;
+
+   /* dependency here on bound surface (or rather, sample count) is worrying */
+   if (framebuffer->zsbuf)
+      sample_count = framebuffer->zsbuf->texture->nr_samples;
+   else if (framebuffer->cbufs[0])
+      sample_count = framebuffer->cbufs[0]->texture->nr_samples;
+
+   if (st->ctx->Multisample.Enabled && sample_count > 1) {
+   /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */
+      if (st->ctx->Multisample.SampleCoverage) {
+         unsigned nr_bits;
+         nr_bits = st->ctx->Multisample.SampleCoverageValue * (float)sample_count;
+         /* there's lot of ways how to do this. We just use first few bits,
+            since we have no knowledge of sample positions here. When
+            app-supplied mask though is used too might need to be smarter.
+            Also, there's a interface restriction here in theory it is
+            encouraged this mask not be the same at each pixel. */
+         sample_mask = (1 << nr_bits) - 1;
+         if (st->ctx->Multisample.SampleCoverageInvert)
+            sample_mask = ~sample_mask;
+      }
+      /* TODO merge with app-supplied sample mask */
+   }
+
+   /* mask off unused bits or don't care? */
+
+   if (sample_mask != st->state.sample_mask) {
+      st->state.sample_mask = sample_mask;
+      cso_set_sample_mask(st->cso_context, sample_mask);
+   }
+}
+
+
+const struct st_tracked_state st_update_msaa = {
+   "st_update_msaa",                                   /* name */
+   {                                                   /* dirty */
+      (_NEW_MULTISAMPLE | _NEW_BUFFERS),               /* mesa */
+      ST_NEW_FRAMEBUFFER,                              /* st */
+   },
+   update_sample_mask                                  /* update */
+};
index 14865e601a07451700de3187cb1d6d99c8aafaf6..b8644faaf8375ebeee0f707fcd1a1570ad7bf8ab 100644 (file)
@@ -123,7 +123,7 @@ create_color_map_texture(GLcontext *ctx)
 
    /* find an RGBA texture format */
    format = st_choose_format(pipe->screen, GL_RGBA,
-                             PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
+                             PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW);
 
    /* create texture for color map/table */
    pt = st_texture_create(st, PIPE_TEXTURE_2D, format, 0,
index 3e3076f721977ead0b3ae47e97bc63ffaa37d750..5aca1105eeb7a26c05cf6b9791112d1d9d1e5540 100644 (file)
@@ -807,15 +807,15 @@ st_init_bitmap(struct st_context *st)
    st->bitmap.rasterizer.gl_rasterization_rules = 1;
 
    /* find a usable texture format */
-   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 
+   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
    }
-   else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 0,
                                         PIPE_BIND_SAMPLER_VIEW, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
    }
-   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 0,
                                         PIPE_BIND_SAMPLER_VIEW, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
    }
index 97b19b20c3535149002127be9d30102f11894ce0..fb7b48a7bf642423b0717ec66ed0e43448e761f0 100644 (file)
@@ -113,33 +113,23 @@ st_BlitFramebuffer(GLcontext *ctx,
          &readFB->Attachment[readFB->_ColorReadBufferIndex];
 
       if(srcAtt->Type == GL_TEXTURE) {
-         struct pipe_screen *screen = pipe->screen;
          struct st_texture_object *srcObj =
             st_texture_object(srcAtt->Texture);
          struct st_renderbuffer *dstRb =
             st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
-         struct pipe_surface *srcSurf;
+         struct pipe_subresource srcSub;
          struct pipe_surface *dstSurf = dstRb->surface;
 
          if (!srcObj->pt)
             return;
 
-         srcSurf = screen->get_tex_surface(screen,
-                                           srcObj->pt,
-                                           srcAtt->CubeMapFace,
-                                           srcAtt->TextureLevel,
-                                           srcAtt->Zoffset,
-                                           PIPE_BIND_BLIT_SOURCE);
-         if(!srcSurf)
-            return;
+         srcSub.face = srcAtt->CubeMapFace;
+         srcSub.level = srcAtt->TextureLevel;
 
-         util_blit_pixels(st->blit,
-                          srcSurf, st_get_texture_sampler_view(srcObj, pipe),
-                          srcX0, srcY0, srcX1, srcY1,
+         util_blit_pixels(st->blit, srcObj->pt, srcSub,
+                          srcX0, srcY0, srcX1, srcY1, srcAtt->Zoffset,
                           dstSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
-
-         pipe_surface_reference(&srcSurf, NULL);
       }
       else {
          struct st_renderbuffer *srcRb =
@@ -147,11 +137,15 @@ st_BlitFramebuffer(GLcontext *ctx,
          struct st_renderbuffer *dstRb =
             st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
          struct pipe_surface *srcSurf = srcRb->surface;
-         struct pipe_sampler_view *srcView = st_get_renderbuffer_sampler_view(srcRb, pipe);
          struct pipe_surface *dstSurf = dstRb->surface;
+         struct pipe_subresource srcSub;
+
+         srcSub.face = srcSurf->face;
+         srcSub.level = srcSurf->level;
 
          util_blit_pixels(st->blit,
-                          srcSurf, srcView, srcX0, srcY0, srcX1, srcY1,
+                          srcRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
+                          srcSurf->zslice,
                           dstSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
       }
@@ -183,13 +177,17 @@ st_BlitFramebuffer(GLcontext *ctx,
       if ((mask & depthStencil) == depthStencil &&
           srcDepthSurf == srcStencilSurf &&
           dstDepthSurf == dstStencilSurf) {
-         struct pipe_sampler_view *srcView = st_get_renderbuffer_sampler_view(srcDepthRb, pipe);
+         struct pipe_subresource srcSub;
+
+         srcSub.face = srcDepthRb->surface->face;
+         srcSub.level = srcDepthRb->surface->level;
 
          /* Blitting depth and stencil values between combined
           * depth/stencil buffers.  This is the ideal case for such buffers.
           */
          util_blit_pixels(st->blit,
-                          srcDepthSurf, srcView, srcX0, srcY0, srcX1, srcY1,
+                          srcDepthRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
+                          srcDepthRb->surface->zslice,
                           dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
       }
index 900deaf46ded682abe817cd3ffec357d2d73bf34..7991a93a1e6b04383a7b01edc403fc3aab1d6160 100644 (file)
@@ -179,9 +179,7 @@ st_bufferobj_data(GLcontext *ctx,
    switch(target) {
    case GL_PIXEL_PACK_BUFFER_ARB:
    case GL_PIXEL_UNPACK_BUFFER_ARB:
-      buffer_usage = (PIPE_BIND_RENDER_TARGET |
-                     PIPE_BIND_BLIT_SOURCE |
-                     PIPE_BIND_BLIT_DESTINATION);
+      buffer_usage = PIPE_BIND_RENDER_TARGET;
       break;
    case GL_ARRAY_BUFFER_ARB:
       buffer_usage = PIPE_BIND_VERTEX_BUFFER;
index 932e8edb2504a855ebfe47e97e84b247ee453468..f74d8cd42d046cb98e832efae13208171f4b5e00 100644 (file)
@@ -969,6 +969,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
    enum pipe_format srcFormat, texFormat;
    GLboolean invertTex = GL_FALSE;
    GLint readX, readY, readW, readH;
+   GLuint sample_count;
    struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
 
    st_validate_state(st);
@@ -993,9 +994,15 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
       driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
    }
 
+   sample_count = rbRead->texture->nr_samples;
+   /* I believe this would be legal, presumably would need to do a resolve
+      for color, and for depth/stencil spec says to just use one of the
+      depth/stencil samples per pixel? Need some transfer clarifications. */
+   assert(sample_count < 2);
+
    srcFormat = rbRead->texture->format;
 
-   if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D, 
+   if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D, sample_count,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       texFormat = srcFormat;
    }
@@ -1003,14 +1010,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
       /* srcFormat can't be used as a texture format */
       if (type == GL_DEPTH) {
          texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT,
-                                      PIPE_TEXTURE_2D, 
+                                      PIPE_TEXTURE_2D, sample_count,
                                       PIPE_BIND_DEPTH_STENCIL);
          assert(texFormat != PIPE_FORMAT_NONE);
       }
       else {
          /* default color format */
          texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D, 
-                                      PIPE_BIND_SAMPLER_VIEW);
+                                      sample_count, PIPE_BIND_SAMPLER_VIEW);
          assert(texFormat != PIPE_FORMAT_NONE);
       }
    }
@@ -1049,27 +1056,20 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
    /* Make temporary texture which is a copy of the src region.
     */
    if (srcFormat == texFormat) {
+      struct pipe_subresource srcsub, dstsub;
+      srcsub.face = 0;
+      srcsub.level = 0;
+      dstsub.face = 0;
+      dstsub.level = 0;
       /* copy source framebuffer surface into mipmap/texture */
-      struct pipe_surface *psRead = screen->get_tex_surface(screen,
-                                       rbRead->texture, 0, 0, 0,
-                                       PIPE_BIND_BLIT_SOURCE);
-      struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, 
-                                       PIPE_BIND_RENDER_TARGET |
-                                       PIPE_BIND_BLIT_DESTINATION);
-      pipe->surface_copy(pipe,
-                         psTex,                               /* dest surf */
-                         pack.SkipPixels, pack.SkipRows,      /* dest pos */
-                         psRead,                              /* src surf */
-                         readX, readY, readW, readH);         /* src region */
-
-      if (0) {
-         /* debug */
-         debug_dump_surface(pipe, "copypixsrcsurf", psRead);
-         debug_dump_surface(pipe, "copypixtemptex", psTex);
-      }
+      pipe->resource_copy_region(pipe,
+                                 pt,                                /* dest tex */
+                                 dstsub,
+                                 pack.SkipPixels, pack.SkipRows, 0, /* dest pos */
+                                 rbRead->texture,                   /* src tex */
+                                 srcsub,
+                                 readX, readY, 0, readW, readH);    /* src region */
 
-      pipe_surface_reference(&psRead, NULL); 
-      pipe_surface_reference(&psTex, NULL);
    }
    else {
       /* CPU-based fallback/conversion */
index 00861a6ff36834dfa7961892070e8b4afdba0ff4..4aaf91d5a19dd6188a7ed5524f98a0b10c130696 100644 (file)
@@ -79,7 +79,7 @@ st_egl_image_target_renderbuffer_storage(GLcontext *ctx,
    struct pipe_surface *ps;
    unsigned usage;
 
-   usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_BLIT_SOURCE | PIPE_BIND_BLIT_DESTINATION;
+   usage = PIPE_BIND_RENDER_TARGET;
    ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
    if (ps) {
       strb->Base.Width = ps->width;
@@ -146,7 +146,7 @@ st_egl_image_target_texture_2d(GLcontext *ctx, GLenum target,
    struct pipe_surface *ps;
    unsigned usage;
 
-   usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_BLIT_DESTINATION | PIPE_BIND_BLIT_SOURCE;
+   usage = PIPE_BIND_SAMPLER_VIEW;
    ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
    if (ps) {
       st_bind_surface(ctx, target, texObj, texImage, ps);
index c02121fbd1a9a41c860ccff4ef6fce3438aeb285..46f27ced6c38537c868d68c2e916f7cd47381ba3 100644 (file)
@@ -72,7 +72,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
    if (strb->format != PIPE_FORMAT_NONE)
       format = strb->format;
    else
-      format = st_choose_renderbuffer_format(screen, internalFormat);
+      format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples);
       
    /* init renderbuffer fields */
    strb->Base.Width  = width;
@@ -442,7 +442,8 @@ st_validate_attachment(struct pipe_screen *screen,
       return GL_FALSE;
 
    return screen->is_format_supported(screen, stObj->pt->format,
-                                     PIPE_TEXTURE_2D, bindings, 0);
+                                      PIPE_TEXTURE_2D,
+                                      stObj->pt->nr_samples, bindings, 0);
 }
 
 
@@ -545,6 +546,7 @@ void st_init_fbo_functions(struct dd_function_table *functions)
    functions->ReadBuffer = st_ReadBuffer;
 }
 
+/* XXX unused ? */
 struct pipe_sampler_view *
 st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb,
                                  struct pipe_context *pipe)
index beb26ab4da168dc10bffb910ad7b56493d2dc772..43b6c1e75f4f20b5f6bbd1523bf3062925bc35eb 100644 (file)
@@ -73,6 +73,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw);
 extern void
 st_init_fbo_functions(struct dd_function_table *functions);
 
+/* XXX unused ? */
 extern struct pipe_sampler_view *
 st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb,
                                  struct pipe_context *pipe);
index e34fd09dcb753f468310695d74e11f2668d30e6d..647898ef7c9a1c840f914799f35ecf6fe944197a 100644 (file)
@@ -221,7 +221,7 @@ default_bindings(struct st_context *st, enum pipe_format format)
    else
       bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
 
-   if (screen->is_format_supported(screen, format, target, bindings, geom))
+   if (screen->is_format_supported(screen, format, target, 0, bindings, geom))
       return bindings;
    else
       return PIPE_BIND_SAMPLER_VIEW;
@@ -433,7 +433,7 @@ compress_with_blit(GLcontext * ctx,
    /* get destination surface (in the compressed texture) */
    dst_surface = screen->get_tex_surface(screen, stImage->pt,
                                          stImage->face, stImage->level, 0,
-                                         PIPE_BIND_BLIT_DESTINATION);
+                                         0 /* flags */);
    if (!dst_surface) {
       /* can't render into this format (or other problem) */
       return GL_FALSE;
@@ -655,7 +655,7 @@ st_TexImage(GLcontext * ctx,
        _mesa_is_format_compressed(texImage->TexFormat) &&
        screen->is_format_supported(screen,
                                    stImage->pt->format,
-                                   stImage->pt->target,
+                                   stImage->pt->target, 0,
                                    PIPE_BIND_RENDER_TARGET, 0)) {
       if (!pixels)
          goto done;
@@ -851,8 +851,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
    struct pipe_surface *dst_surface;
    struct pipe_resource *dst_texture;
    struct pipe_transfer *tex_xfer;
-   unsigned bind = (PIPE_BIND_BLIT_DESTINATION |
-                   PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
+   unsigned bind = (PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
                    PIPE_BIND_TRANSFER_READ);
 
    /* create temp / dest surface */
@@ -1078,7 +1077,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
        _mesa_is_format_compressed(texImage->TexFormat) &&
        screen->is_format_supported(screen,
                                    stImage->pt->format,
-                                   stImage->pt->target,
+                                   stImage->pt->target, 0,
                                    PIPE_BIND_RENDER_TARGET, 0)) {
       if (compress_with_blit(ctx, target, level,
                              xoffset, yoffset, zoffset,
@@ -1496,7 +1495,7 @@ st_copy_texsubimage(GLcontext *ctx,
    enum pipe_format dest_format, src_format;
    GLboolean use_fallback = GL_TRUE;
    GLboolean matching_base_formats;
-   GLuint format_writemask;
+   GLuint format_writemask, sample_count;
    struct pipe_surface *dest_surface = NULL;
    GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
 
@@ -1519,6 +1518,12 @@ st_copy_texsubimage(GLcontext *ctx,
       return;
    }
 
+   sample_count = strb->surface->texture->nr_samples;
+   /* I believe this would be legal, presumably would need to do a resolve
+      for color, and for depth/stencil spec says to just use one of the
+      depth/stencil samples per pixel? Need some transfer clarifications. */
+   assert(sample_count < 2);
+
    if (srcX < 0) {
       width -= -srcX;
       destX += -srcX;
@@ -1574,42 +1579,45 @@ st_copy_texsubimage(GLcontext *ctx,
           !do_flip) 
       {
          /* use surface_copy() / blit */
-
-         dest_surface = screen->get_tex_surface(screen, stImage->pt,
-                                                stImage->face, stImage->level,
-                                                destZ,
-                                                PIPE_BIND_BLIT_DESTINATION);
-
-         /* for surface_copy(), y=0=top, always */
-         pipe->surface_copy(pipe,
-                            /* dest */
-                            dest_surface,
-                            destX, destY,
-                            /* src */
-                            strb->surface,
-                            srcX, srcY,
-                            /* size */
-                            width, height);
+         struct pipe_subresource subdst, subsrc;
+         subdst.face = stImage->face;
+         subdst.level = stImage->level;
+         subsrc.face = strb->surface->face;
+         subsrc.level = strb->surface->level;
+
+         /* for resource_copy_region(), y=0=top, always */
+         pipe->resource_copy_region(pipe,
+                                    /* dest */
+                                    stImage->pt,
+                                    subdst,
+                                    destX, destY, destZ,
+                                    /* src */
+                                    strb->texture,
+                                    subsrc,
+                                    srcX, srcY, strb->surface->zslice,
+                                    /* size */
+                                    width, height);
          use_fallback = GL_FALSE;
       }
       else if (format_writemask &&
                texBaseFormat != GL_DEPTH_COMPONENT &&
                texBaseFormat != GL_DEPTH_STENCIL &&
                screen->is_format_supported(screen, src_format,
-                                           PIPE_TEXTURE_2D, 
+                                           PIPE_TEXTURE_2D, sample_count,
                                            PIPE_BIND_SAMPLER_VIEW,
                                            0) &&
                screen->is_format_supported(screen, dest_format,
-                                           PIPE_TEXTURE_2D, 
+                                           PIPE_TEXTURE_2D, 0,
                                            PIPE_BIND_RENDER_TARGET,
                                            0)) {
          /* draw textured quad to do the copy */
          GLint srcY0, srcY1;
+         struct pipe_subresource subsrc;
 
          dest_surface = screen->get_tex_surface(screen, stImage->pt,
                                                 stImage->face, stImage->level,
                                                 destZ,
-                                                PIPE_BIND_BLIT_DESTINATION);
+                                                PIPE_BIND_RENDER_TARGET);
 
          if (do_flip) {
             srcY1 = strb->Base.Height - srcY - height;
@@ -1619,11 +1627,15 @@ st_copy_texsubimage(GLcontext *ctx,
             srcY0 = srcY;
             srcY1 = srcY0 + height;
          }
+         subsrc.face = strb->surface->face;
+         subsrc.level = strb->surface->level;
+
          util_blit_pixels_writemask(st->blit,
-                                    strb->surface,
-                                    st_get_renderbuffer_sampler_view(strb, pipe),
+                                    strb->texture,
+                                    subsrc,
                                     srcX, srcY0,
                                     srcX + width, srcY1,
+                                    strb->surface->zslice,
                                     dest_surface,
                                     destX, destY,
                                     destX + width, destY + height,
index 21d0fa96e1698c21083f388af9cc563d2d02d856..2070f14a5a64893ccad18ff78ca70b4b35f4e9e2 100644 (file)
@@ -93,19 +93,6 @@ st_get_msaa(void)
 }
 
 
-/** Default method for pipe_context::surface_copy() */
-static void
-st_surface_copy(struct pipe_context *pipe,
-                struct pipe_surface *dst,
-                unsigned dst_x, unsigned dst_y,
-                struct pipe_surface *src,
-                unsigned src_x, unsigned src_y, 
-                unsigned w, unsigned h)
-{
-   util_surface_copy(pipe, FALSE, dst, dst_x, dst_y, src, src_x, src_y, w, h);
-}
-
-
 static struct st_context *
 st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
 {
@@ -163,10 +150,6 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
    st_init_limits(st);
    st_init_extensions(st);
 
-   /* plug in helper driver functions if needed */
-   if (!pipe->surface_copy)
-      pipe->surface_copy = st_surface_copy;
-
    return st;
 }
 
index 3637f6e75f01af73c53d267746b9491477abda58..987516f248200cc12325a44132c960a76d52c2cc 100644 (file)
@@ -94,6 +94,7 @@ struct st_context
       struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
       struct pipe_scissor_state scissor;
       struct pipe_viewport_state viewport;
+      unsigned sample_mask;
 
       GLuint num_samplers;
       GLuint num_textures;
index 459e924cca39ddd919a52c4b9c004a6c78dc1082..810a0635b50842484e1c52e22e7b0452efb735fb 100644 (file)
@@ -311,39 +311,39 @@ void st_init_extensions(struct st_context *st)
     * a depth/stencil buffer and texture from depth/stencil source.
     */
    if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
-                                   PIPE_TEXTURE_2D, 
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_DEPTH_STENCIL, 0) &&
        screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
-                                   PIPE_TEXTURE_2D, 
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
    }
    else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
-                                        PIPE_TEXTURE_2D, 
+                                        PIPE_TEXTURE_2D, 0,
                                         PIPE_BIND_DEPTH_STENCIL, 0) &&
             screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
-                                        PIPE_TEXTURE_2D, 
+                                        PIPE_TEXTURE_2D, 0,
                                         PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
    }
 
    /* sRGB support */
    if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB,
-                                   PIPE_TEXTURE_2D, 
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0) ||
       screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB,
-                                   PIPE_TEXTURE_2D, 
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
    }
 
    /* s3tc support */
    if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
-                                   PIPE_TEXTURE_2D,
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0) &&
        (ctx->Mesa_DXTn ||
         screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
-                                    PIPE_TEXTURE_2D,
+                                    PIPE_TEXTURE_2D, 0,
                                     PIPE_BIND_RENDER_TARGET, 0))) {
       ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
       ctx->Extensions.S3_s3tc = GL_TRUE;
@@ -351,10 +351,10 @@ void st_init_extensions(struct st_context *st)
 
    /* ycbcr support */
    if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY, 
-                                   PIPE_TEXTURE_2D, 
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0) ||
        screen->is_format_supported(screen, PIPE_FORMAT_YUYV, 
-                                   PIPE_TEXTURE_2D, 
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
    }
index d7d2be6d45496e79bd8138d88193df35a1333fc6..f7b10ea243aadad645552263bee2f130f2763be9 100644 (file)
@@ -311,13 +311,14 @@ find_supported_format(struct pipe_screen *screen,
                       const enum pipe_format formats[],
                       uint num_formats,
                       enum pipe_texture_target target,
-                      unsigned tex_usage, 
+                      unsigned sample_count,
+                      unsigned tex_usage,
                       unsigned geom_flags)
 {
    uint i;
    for (i = 0; i < num_formats; i++) {
       if (screen->is_format_supported(screen, formats[i], target,
-                                      tex_usage, geom_flags)) {
+                                      sample_count, tex_usage, geom_flags)) {
          return formats[i];
       }
    }
@@ -331,7 +332,8 @@ find_supported_format(struct pipe_screen *screen,
 static enum pipe_format
 default_rgba_format(struct pipe_screen *screen, 
                     enum pipe_texture_target target,
-                    unsigned tex_usage, 
+                    unsigned sample_count,
+                    unsigned tex_usage,
                     unsigned geom_flags)
 {
    static const enum pipe_format colorFormats[] = {
@@ -341,7 +343,7 @@ default_rgba_format(struct pipe_screen *screen,
       PIPE_FORMAT_B5G6R5_UNORM
    };
    return find_supported_format(screen, colorFormats, Elements(colorFormats),
-                                target, tex_usage, geom_flags);
+                                target, sample_count, tex_usage, geom_flags);
 }
 
 
@@ -351,7 +353,8 @@ default_rgba_format(struct pipe_screen *screen,
 static enum pipe_format
 default_rgb_format(struct pipe_screen *screen, 
                    enum pipe_texture_target target,
-                   unsigned tex_usage, 
+                   unsigned sample_count,
+                   unsigned tex_usage,
                    unsigned geom_flags)
 {
    static const enum pipe_format colorFormats[] = {
@@ -364,7 +367,7 @@ default_rgb_format(struct pipe_screen *screen,
       PIPE_FORMAT_B5G6R5_UNORM
    };
    return find_supported_format(screen, colorFormats, Elements(colorFormats),
-                                target, tex_usage, geom_flags);
+                                target, sample_count, tex_usage, geom_flags);
 }
 
 /**
@@ -373,7 +376,8 @@ default_rgb_format(struct pipe_screen *screen,
 static enum pipe_format
 default_srgba_format(struct pipe_screen *screen, 
                     enum pipe_texture_target target,
-                    unsigned tex_usage, 
+                    unsigned sample_count,
+                    unsigned tex_usage,
                     unsigned geom_flags)
 {
    static const enum pipe_format colorFormats[] = {
@@ -382,7 +386,7 @@ default_srgba_format(struct pipe_screen *screen,
       PIPE_FORMAT_A8B8G8R8_SRGB,
    };
    return find_supported_format(screen, colorFormats, Elements(colorFormats),
-                                target, tex_usage, geom_flags);
+                                target, sample_count, tex_usage, geom_flags);
 }
 
 
@@ -401,7 +405,8 @@ default_srgba_format(struct pipe_screen *screen,
  */
 enum pipe_format
 st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
-                 enum pipe_texture_target target, unsigned bindings)
+                 enum pipe_texture_target target, unsigned sample_count,
+                 unsigned bindings)
 {
    unsigned geom_flags = 0; /* we don't care about POT vs. NPOT here, yet */
 
@@ -411,42 +416,53 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_RGBA8:
    case GL_RGB10_A2:
    case GL_RGBA12:
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
    case 3:
    case GL_RGB:
-      return default_rgb_format( screen, target, bindings, geom_flags );
+      return default_rgb_format( screen, target, sample_count, bindings,
+                                 geom_flags );
    case GL_RGBA16:
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case GL_RGBA4:
    case GL_RGBA2:
       if (screen->is_format_supported( screen, PIPE_FORMAT_B4G4R4A4_UNORM,
-                                       target, bindings, geom_flags ))
+                                       target, sample_count, bindings,
+                                       geom_flags ))
          return PIPE_FORMAT_B4G4R4A4_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case GL_RGB5_A1:
       if (screen->is_format_supported( screen, PIPE_FORMAT_B5G5R5A1_UNORM,
-                                       target, bindings, geom_flags ))
+                                       target, sample_count, bindings,
+                                       geom_flags ))
          return PIPE_FORMAT_B5G5R5A1_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case GL_RGB8:
    case GL_RGB10:
    case GL_RGB12:
    case GL_RGB16:
-      return default_rgb_format( screen, target, bindings, geom_flags );
+      return default_rgb_format( screen, target, sample_count, bindings,
+                                 geom_flags );
 
    case GL_RGB5:
    case GL_RGB4:
    case GL_R3_G3_B2:
       if (screen->is_format_supported( screen, PIPE_FORMAT_B5G6R5_UNORM,
-                                       target, bindings, geom_flags ))
+                                       target, sample_count, bindings,
+                                       geom_flags ))
          return PIPE_FORMAT_B5G6R5_UNORM;
       if (screen->is_format_supported( screen, PIPE_FORMAT_B5G5R5A1_UNORM,
-                                       target, bindings, geom_flags ))
+                                       target, sample_count, bindings,
+                                       geom_flags ))
          return PIPE_FORMAT_B5G5R5A1_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case GL_ALPHA:
    case GL_ALPHA4:
@@ -455,9 +471,10 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_ALPHA16:
    case GL_COMPRESSED_ALPHA:
       if (screen->is_format_supported( screen, PIPE_FORMAT_A8_UNORM, target,
-                                       bindings, geom_flags ))
+                                       sample_count, bindings, geom_flags ))
          return PIPE_FORMAT_A8_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case 1:
    case GL_LUMINANCE:
@@ -467,9 +484,10 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_LUMINANCE16:
    case GL_COMPRESSED_LUMINANCE:
       if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, target,
-                                       bindings, geom_flags ))
+                                       sample_count, bindings, geom_flags ))
          return PIPE_FORMAT_L8_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case 2:
    case GL_LUMINANCE_ALPHA:
@@ -481,9 +499,10 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_LUMINANCE16_ALPHA16:
    case GL_COMPRESSED_LUMINANCE_ALPHA:
       if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target,
-                                       bindings, geom_flags ))
+                                       sample_count, bindings, geom_flags ))
          return PIPE_FORMAT_L8A8_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case GL_INTENSITY:
    case GL_INTENSITY4:
@@ -492,17 +511,18 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_INTENSITY16:
    case GL_COMPRESSED_INTENSITY:
       if (screen->is_format_supported( screen, PIPE_FORMAT_I8_UNORM, target,
-                                       bindings, geom_flags ))
+                                       sample_count, bindings, geom_flags ))
          return PIPE_FORMAT_I8_UNORM;
-      return default_rgba_format( screen, target, bindings, geom_flags );
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
 
    case GL_YCBCR_MESA:
-      if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY,
-                                      target, bindings, geom_flags)) {
+      if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY, target,
+                                      sample_count, bindings, geom_flags)) {
          return PIPE_FORMAT_UYVY;
       }
-      if (screen->is_format_supported(screen, PIPE_FORMAT_YUYV,
-                                      target, bindings, geom_flags)) {
+      if (screen->is_format_supported(screen, PIPE_FORMAT_YUYV, target,
+                                      sample_count, bindings, geom_flags)) {
          return PIPE_FORMAT_YUYV;
       }
       return PIPE_FORMAT_NONE;
@@ -512,33 +532,39 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       if (bindings & ~PIPE_BIND_SAMPLER_VIEW)
          return PIPE_FORMAT_NONE;
       else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB,
-                                           target, bindings, geom_flags))
+                                           target, sample_count, bindings,
+                                           geom_flags))
          return PIPE_FORMAT_DXT1_RGB;
       else
-         return default_rgb_format(screen, target, bindings, geom_flags);
+         return default_rgb_format(screen, target, sample_count, bindings,
+                                   geom_flags);
 
    case GL_COMPRESSED_RGBA:
       /* can only sample from compressed formats */
       if (bindings & ~PIPE_BIND_SAMPLER_VIEW)
          return PIPE_FORMAT_NONE;
       else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA,
-                                           target, bindings, geom_flags))
+                                           target, sample_count, bindings,
+                                           geom_flags))
          return PIPE_FORMAT_DXT3_RGBA;
       else
-         return default_rgba_format(screen, target, bindings, geom_flags);
+         return default_rgba_format(screen, target, sample_count, bindings,
+                                    geom_flags);
 
    case GL_RGB_S3TC:
    case GL_RGB4_S3TC:
    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
       if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB,
-                                      target, bindings, geom_flags))
+                                      target, sample_count, bindings,
+                                      geom_flags))
          return PIPE_FORMAT_DXT1_RGB;
       else
          return PIPE_FORMAT_NONE;
 
    case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
       if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGBA,
-                                      target, bindings, geom_flags))
+                                      target, sample_count, bindings,
+                                      geom_flags))
          return PIPE_FORMAT_DXT1_RGBA;
       else
          return PIPE_FORMAT_NONE;
@@ -547,14 +573,16 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_RGBA4_S3TC:
    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
       if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA,
-                                      target, bindings, geom_flags))
+                                      target, sample_count, bindings,
+                                      geom_flags))
          return PIPE_FORMAT_DXT3_RGBA;
       else
          return PIPE_FORMAT_NONE;
 
    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
       if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
-                                      target, bindings, geom_flags))
+                                      target, sample_count, bindings,
+                                      geom_flags))
          return PIPE_FORMAT_DXT5_RGBA;
       else
          return PIPE_FORMAT_NONE;
@@ -568,20 +596,20 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
 
    case GL_DEPTH_COMPONENT16:
       if (screen->is_format_supported(screen, PIPE_FORMAT_Z16_UNORM, target,
-                                      bindings, geom_flags))
+                                      sample_count, bindings, geom_flags))
          return PIPE_FORMAT_Z16_UNORM;
       /* fall-through */
    case GL_DEPTH_COMPONENT24:
       if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
-                                      target, bindings, geom_flags))
+                                      target, sample_count, bindings, geom_flags))
          return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
       if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
-                                      target, bindings, geom_flags))
+                                      target, sample_count, bindings, geom_flags))
          return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
       /* fall-through */
    case GL_DEPTH_COMPONENT32:
-      if (screen->is_format_supported(screen, PIPE_FORMAT_Z32_UNORM,
-                                      target, bindings, geom_flags))
+      if (screen->is_format_supported(screen, PIPE_FORMAT_Z32_UNORM, target,
+                                      sample_count, bindings, geom_flags))
          return PIPE_FORMAT_Z32_UNORM;
       /* fall-through */
    case GL_DEPTH_COMPONENT:
@@ -593,7 +621,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
             PIPE_FORMAT_S8_USCALED_Z24_UNORM
          };
          return find_supported_format(screen, formats, Elements(formats),
-                                      target, bindings, geom_flags);
+                                      target, sample_count, bindings, geom_flags);
       }
 
    case GL_STENCIL_INDEX:
@@ -608,7 +636,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
             PIPE_FORMAT_S8_USCALED_Z24_UNORM
          };
          return find_supported_format(screen, formats, Elements(formats),
-                                      target, bindings, geom_flags);
+                                      target, sample_count, bindings, geom_flags);
       }
 
    case GL_DEPTH_STENCIL_EXT:
@@ -619,7 +647,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
             PIPE_FORMAT_S8_USCALED_Z24_UNORM
          };
          return find_supported_format(screen, formats, Elements(formats),
-                                      target, bindings, geom_flags);
+                                      target, sample_count, bindings, geom_flags);
       }
 
    case GL_SRGB_EXT:
@@ -628,7 +656,8 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_COMPRESSED_SRGB_ALPHA_EXT:
    case GL_SRGB_ALPHA_EXT:
    case GL_SRGB8_ALPHA8_EXT:
-      return default_srgba_format( screen, target, bindings, geom_flags );
+      return default_srgba_format( screen, target, sample_count, bindings,
+                                   geom_flags );
    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
       return PIPE_FORMAT_DXT1_SRGB;
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
@@ -642,17 +671,19 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_SLUMINANCE8_ALPHA8_EXT:
    case GL_COMPRESSED_SLUMINANCE_EXT:
    case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
-      if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_SRGB,
-                                      target, bindings, geom_flags))
+      if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_SRGB, target,
+                                      sample_count, bindings, geom_flags))
          return PIPE_FORMAT_L8A8_SRGB;
-      return default_srgba_format( screen, target, bindings, geom_flags );
+      return default_srgba_format( screen, target, sample_count, bindings,
+                                   geom_flags );
 
    case GL_SLUMINANCE_EXT:
    case GL_SLUMINANCE8_EXT:
-      if (screen->is_format_supported(screen, PIPE_FORMAT_L8_SRGB,
-                                      target, bindings, geom_flags))
+      if (screen->is_format_supported(screen, PIPE_FORMAT_L8_SRGB, target,
+                                      sample_count, bindings, geom_flags))
          return PIPE_FORMAT_L8_SRGB;
-      return default_srgba_format( screen, target, bindings, geom_flags );
+      return default_srgba_format( screen, target, sample_count, bindings,
+                                   geom_flags );
 
    default:
       return PIPE_FORMAT_NONE;
@@ -665,14 +696,15 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
  */
 enum pipe_format
 st_choose_renderbuffer_format(struct pipe_screen *screen,
-                              GLenum internalFormat)
+                              GLenum internalFormat, unsigned sample_count)
 {
    uint usage;
    if (_mesa_is_depth_or_stencil_format(internalFormat))
       usage = PIPE_BIND_DEPTH_STENCIL;
    else
       usage = PIPE_BIND_RENDER_TARGET;
-   return st_choose_format(screen, internalFormat, PIPE_TEXTURE_2D, usage);
+   return st_choose_format(screen, internalFormat, PIPE_TEXTURE_2D,
+                           sample_count, usage);
 }
 
 
@@ -700,12 +732,12 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
       bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
 
    pFormat = st_choose_format(screen, internalFormat,
-                              PIPE_TEXTURE_2D, bindings);
+                              PIPE_TEXTURE_2D, 0, bindings);
 
    if (pFormat == PIPE_FORMAT_NONE) {
       /* try choosing format again, this time without render target bindings */
       pFormat = st_choose_format(screen, internalFormat,
-                                 PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
+                                 PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW);
    }
 
    if (pFormat == PIPE_FORMAT_NONE) {
index a6cf7025a92789c64425f2e95264316637180ec5..3288225d5d40c1b9673e5a544e411515a850b5c4 100644 (file)
@@ -46,11 +46,12 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat);
 
 extern enum pipe_format
 st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
-                 enum pipe_texture_target target, unsigned tex_usage);
+                 enum pipe_texture_target target, unsigned sample_count,
+                 unsigned tex_usage);
 
 extern enum pipe_format
 st_choose_renderbuffer_format(struct pipe_screen *screen,
-                              GLenum internalFormat);
+                              GLenum internalFormat, unsigned sample_count);
 
 
 extern gl_format
index e656908bedec0cb6a2cd47cdf29d974cc88339b0..2d587df6055a1c37414567b187551e8f41f43d43 100644 (file)
@@ -83,7 +83,7 @@ st_render_mipmap(struct st_context *st,
    assert(target != GL_TEXTURE_3D); /* not done yet */
 
    /* check if we can render in the texture's format */
-   if (!screen->is_format_supported(screen, psv->format, psv->texture->target,
+   if (!screen->is_format_supported(screen, psv->format, psv->texture->target, 0,
                                     PIPE_BIND_RENDER_TARGET, 0)) {
       return FALSE;
    }
@@ -324,7 +324,11 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
    if (!pt)
       return;
 
-   /* find expected last mipmap level to generate */
+   /* not sure if this ultimately actually should work,
+      but we're not supporting multisampled textures yet. */
+   assert(pt->nr_samples < 2);
+
+   /* find expected last mipmap level to generate*/
    lastLevel = compute_num_levels(ctx, texObj, target) - 1;
 
    if (lastLevel == 0)
index 2d364737cb0eace58369ac1803266a365a5407d1..dbdf1ea1ad0420037b4e48bfeede0f4fceaabef0 100644 (file)
@@ -74,7 +74,7 @@ st_texture_create(struct st_context *st,
        _mesa_lookup_enum_by_nr(format), last_level);
 
    assert(format);
-   assert(screen->is_format_supported(screen, format, target, 
+   assert(screen->is_format_supported(screen, format, target, 0,
                                       PIPE_BIND_SAMPLER_VIEW, 0));
 
    memset(&pt, 0, sizeof(pt));
@@ -282,18 +282,20 @@ st_texture_image_copy(struct pipe_context *pipe,
                       struct pipe_resource *src, GLuint srcLevel,
                       GLuint face)
 {
-   struct pipe_screen *screen = pipe->screen;
    GLuint width = u_minify(dst->width0, dstLevel); 
    GLuint height = u_minify(dst->height0, dstLevel); 
    GLuint depth = u_minify(dst->depth0, dstLevel); 
-   struct pipe_surface *src_surface;
-   struct pipe_surface *dst_surface;
+   struct pipe_subresource dstsub, srcsub;
    GLuint i;
 
    assert(u_minify(src->width0, srcLevel) == width);
    assert(u_minify(src->height0, srcLevel) == height);
    assert(u_minify(src->depth0, srcLevel) == depth);
 
+   dstsub.face = face;
+   dstsub.level = dstLevel;
+   srcsub.face = face;
+   srcsub.level = srcLevel;
    /* Loop over 3D image slices */
    for (i = 0; i < depth; i++) {
 
@@ -301,21 +303,14 @@ st_texture_image_copy(struct pipe_context *pipe,
          print_center_pixel(pipe, src);
       }
 
-      dst_surface = screen->get_tex_surface(screen, dst, face, dstLevel, i,
-                                            PIPE_BIND_BLIT_DESTINATION);
-
-      src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i,
-                                            PIPE_BIND_BLIT_SOURCE);
-
-      pipe->surface_copy(pipe,
-                         dst_surface,
-                         0, 0, /* destX, Y */
-                         src_surface,
-                         0, 0, /* srcX, Y */
-                         width, height);
-
-      pipe_surface_reference(&src_surface, NULL);
-      pipe_surface_reference(&dst_surface, NULL);
+      pipe->resource_copy_region(pipe,
+                                 dst,
+                                 dstsub,
+                                 0, 0, i,/* destX, Y, Z */
+                                 src,
+                                 srcsub,
+                                 0, 0, i,/* srcX, Y, Z */
+                                 width, height);
    }
 }