summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-13 13:18:15 +0800
committerChia-I Wu <[email protected]>2013-06-14 08:46:04 +0800
commit399548b17fcc679d293920f1088c50004babfc92 (patch)
treed686f225d62809ed934e739f69da2ce7854f3152 /src/mesa
parent5507c11f85dda4fbcdc9b36494551c933471a070 (diff)
st/mesa: fix temp texture bindings in st_CopyPixels()
The temporary texture should have either PIPE_BIND_RENDER_TARGET or PIPE_BIND_DEPTH_STENCIL set in addition to PIPE_BIND_SAMPLER_VIEW. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 1c26315097f..0200a627025 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -460,12 +460,12 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
*/
static struct pipe_resource *
alloc_texture(struct st_context *st, GLsizei width, GLsizei height,
- enum pipe_format texFormat)
+ enum pipe_format texFormat, unsigned bind)
{
struct pipe_resource *pt;
pt = st_texture_create(st, st->internal_target, texFormat, 0,
- width, height, 1, 1, 0, PIPE_BIND_SAMPLER_VIEW);
+ width, height, 1, 1, 0, bind);
return pt;
}
@@ -515,7 +515,7 @@ make_texture(struct st_context *st,
return NULL;
/* alloc temporary texture */
- pt = alloc_texture(st, width, height, pipeFormat);
+ pt = alloc_texture(st, width, height, pipeFormat, PIPE_BIND_SAMPLER_VIEW);
if (!pt) {
_mesa_unmap_pbo_source(ctx, unpack);
return NULL;
@@ -1475,6 +1475,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
int num_sampler_view = 1;
GLfloat *color;
enum pipe_format srcFormat;
+ unsigned srcBind;
GLboolean invertTex = GL_FALSE;
GLint readX, readY, readW, readH;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
@@ -1540,16 +1541,15 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* Choose the format for the temporary texture. */
srcFormat = rbRead->texture->format;
+ srcBind = PIPE_BIND_SAMPLER_VIEW |
+ (type == GL_COLOR ? PIPE_BIND_RENDER_TARGET : PIPE_BIND_DEPTH_STENCIL);
if (!screen->is_format_supported(screen, srcFormat, st->internal_target, 0,
- PIPE_BIND_SAMPLER_VIEW |
- (type == GL_COLOR ? PIPE_BIND_RENDER_TARGET
- : PIPE_BIND_DEPTH_STENCIL))) {
+ srcBind)) {
if (type == GL_DEPTH) {
srcFormat = st_choose_format(st, GL_DEPTH_COMPONENT, GL_NONE,
GL_NONE, st->internal_target, 0,
- PIPE_BIND_SAMPLER_VIEW |
- PIPE_BIND_DEPTH_STENCIL, FALSE);
+ srcBind, FALSE);
}
else {
assert(type == GL_COLOR);
@@ -1557,26 +1557,22 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
if (util_format_is_float(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA32F, GL_NONE,
GL_NONE, st->internal_target, 0,
- PIPE_BIND_SAMPLER_VIEW |
- PIPE_BIND_RENDER_TARGET, FALSE);
+ srcBind, FALSE);
}
else if (util_format_is_pure_sint(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA32I, GL_NONE,
GL_NONE, st->internal_target, 0,
- PIPE_BIND_SAMPLER_VIEW |
- PIPE_BIND_RENDER_TARGET, FALSE);
+ srcBind, FALSE);
}
else if (util_format_is_pure_uint(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA32UI, GL_NONE,
GL_NONE, st->internal_target, 0,
- PIPE_BIND_SAMPLER_VIEW |
- PIPE_BIND_RENDER_TARGET, FALSE);
+ srcBind, FALSE);
}
else {
srcFormat = st_choose_format(st, GL_RGBA, GL_NONE,
GL_NONE, st->internal_target, 0,
- PIPE_BIND_SAMPLER_VIEW |
- PIPE_BIND_RENDER_TARGET, FALSE);
+ srcBind, FALSE);
}
}
@@ -1615,7 +1611,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
readH = MAX2(0, readH);
/* Allocate the temporary texture. */
- pt = alloc_texture(st, width, height, srcFormat);
+ pt = alloc_texture(st, width, height, srcFormat, srcBind);
if (!pt)
return;