diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-04-26 11:33:33 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-05-18 10:19:28 -0500 |
commit | e4e653c67548465cabb51490c7214893547a1eaa (patch) | |
tree | cf220357d21a8c0a5d927dd22565c4026925d178 | |
parent | 85bebf6650026b7e2ec11e18e1ee83be73b8fced (diff) |
st/mesa: hook up a no-op try_pbo_readpixels
For better bisectability given that the order of some of the fallback tests
in the blit path are rearranged.
-rw-r--r-- | src/mesa/state_tracker/st_cb_readpixels.c | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 393b881ea4..62ddc99a94 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -25,6 +25,7 @@ * **************************************************************************/ +#include "main/bufferobj.h" #include "main/image.h" #include "main/pbo.h" #include "main/imports.h" @@ -68,6 +69,15 @@ needs_integer_signed_unsigned_conversion(const struct gl_context *ctx, return FALSE; } +static bool +try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb, + GLint x, GLint y, GLsizei width, GLsizei height, + enum pipe_format src_format, enum pipe_format dst_format, + const struct gl_pixelstore_attrib *pack, void *pixels) +{ + return false; +} + /** * This uses a blit to copy the read buffer to a texture format which matches * the format and type combo and then a fast read-back is done using memcpy. @@ -120,14 +130,6 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y, goto fallback; } - /* We are creating a texture of the size of the region being read back. - * Need to check for NPOT texture support. */ - if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES) && - (!util_is_power_of_two(width) || - !util_is_power_of_two(height))) { - goto fallback; - } - /* If the base internal format and the texture format don't match, we have * to use the slow path. */ if (rb->_BaseFormat != @@ -135,22 +137,10 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y, goto fallback; } - /* See if the texture format already matches the format and type, - * in which case the memcpy-based fast path will likely be used and - * we don't have to blit. */ - if (_mesa_format_matches_format_and_type(rb->Format, format, - type, pack->SwapBytes, NULL)) { - goto fallback; - } - if (_mesa_readpixels_needs_slow_path(ctx, format, type, GL_TRUE)) { goto fallback; } - if (needs_integer_signed_unsigned_conversion(ctx, format, type)) { - goto fallback; - } - /* Convert the source format to what is expected by ReadPixels * and see if it's supported. */ src_format = util_format_linear(src->format); @@ -177,6 +167,33 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y, goto fallback; } + if (_mesa_is_bufferobj(pack->BufferObj)) { + if (try_pbo_readpixels(st, strb, x, y, width, height, + src_format, dst_format, + pack, pixels)) + return; + } + + /* We are creating a texture of the size of the region being read back. + * Need to check for NPOT texture support. */ + if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES) && + (!util_is_power_of_two(width) || + !util_is_power_of_two(height))) { + goto fallback; + } + + /* See if the texture format already matches the format and type, + * in which case the memcpy-based fast path will likely be used and + * we don't have to blit. */ + if (_mesa_format_matches_format_and_type(rb->Format, format, + type, pack->SwapBytes, NULL)) { + goto fallback; + } + + if (needs_integer_signed_unsigned_conversion(ctx, format, type)) { + goto fallback; + } + /* create the destination texture */ memset(&dst_templ, 0, sizeof(dst_templ)); dst_templ.target = PIPE_TEXTURE_2D; |