summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2015-02-03 16:50:57 -0800
committerAnuj Phogat <[email protected]>2015-02-25 14:11:14 -0800
commit618c4c4b6ab82c606cd2c8f139372502baa06c5f (patch)
treedd44f72251f539b111ccf0b84b1a0575baa2d4e6 /src/mesa
parent8d6ae49a8b18ad8006ff8f22caf06bad83b96e6b (diff)
meta: Use GL_STREAM_READ for pbo created with GL_PIXEL_PACK_BUFFER
create_texture_for_pbo() is used by both _mesa_meta_pbo_GetTexSubImage() and _mesa_meta_pbo_TexSubImage() functions with different PBO targets. Use GL_STREAM_READ with GL_PIXEL_PACK_BUFFER and GL_STREAM_DRAW with GL_PIXEL_UNPACK_BUFFER. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Neil Roberts <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/meta_tex_subimage.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
index ffbbacd8fd8..ca6fb6a5f21 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -79,6 +79,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,
buffer_obj = packing->BufferObj;
} else {
assert(create_pbo);
+ bool is_pixel_pack = pbo_target == GL_PIXEL_PACK_BUFFER;
_mesa_GenBuffers(1, tmp_pbo);
@@ -88,7 +89,12 @@ create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,
*/
_mesa_BindBuffer(pbo_target, *tmp_pbo);
- _mesa_BufferData(pbo_target, row_stride * height, pixels, GL_STREAM_DRAW);
+ if (is_pixel_pack)
+ _mesa_BufferData(pbo_target, row_stride * height, pixels,
+ GL_STREAM_READ);
+ else
+ _mesa_BufferData(pbo_target, row_stride * height, pixels,
+ GL_STREAM_DRAW);
buffer_obj = ctx->Unpack.BufferObj;
pixels = NULL;