summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_drawpixels.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2010-05-21 20:02:22 +0200
committerRoland Scheidegger <sroland@vmware.com>2010-05-21 20:02:22 +0200
commit3293bcdc80cdfa20a2381aae2b94505bdf95d857 (patch)
tree16ab1ae66010f6d8b1325dbfa9006126a8e95771 /src/mesa/state_tracker/st_cb_drawpixels.c
parent8504c5d931e47765a15fdaec2df2cb6502a1bd5c (diff)
parentce65caba846b03b5ef4144e311b85cfd48ab9bbb (diff)
Merge branch 'gallium-msaa'
Conflicts: src/mesa/state_tracker/st_gen_mipmap.c src/mesa/state_tracker/st_texture.c
Diffstat (limited to 'src/mesa/state_tracker/st_cb_drawpixels.c')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 932e8edb25..f74d8cd42d 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -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 */