The _mesa_swizzle_and_convert path can't do transfer ops, so we should bail if they're needed.
Signed-off-by: Jason Ekstrand <jason.ekstr...@intel.com> --- src/mesa/main/texstore.c | 63 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 42cebbd..50c7dde 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1462,6 +1462,36 @@ invert_swizzle(uint8_t dst[4], const uint8_t src[4]) dst[i] = j; } +GLboolean +_mesa_texstore_needs_transfer_ops(struct gl_context *ctx, + GLenum baseInternalFormat, + mesa_format dstFormat) +{ + GLenum dstType; + + /* There are different rules depending on the base format. */ + switch (baseInternalFormat) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_STENCIL: + return ctx->Pixel.DepthScale != 1.0f || + ctx->Pixel.DepthBias != 0.0f; + + case GL_STENCIL_INDEX: + return GL_FALSE; + + default: + /* Color formats. + * Pixel transfer ops (scale, bias, table lookup) do not apply + * to integer formats. + */ + dstType = _mesa_get_format_datatype(dstFormat); + + return dstType != GL_INT && dstType != GL_UNSIGNED_INT && + ctx->_ImageTransferState; + } +} + + /** Store a texture by per-channel conversions and swizzling. * * This function attempts to perform a texstore operation by doing simple @@ -1495,6 +1525,9 @@ texstore_swizzle(TEXSTORE_PARAMS) if (!is_array) return GL_FALSE; + if (_mesa_texstore_needs_transfer_ops(ctx, baseInternalFormat, dstFormat)) + return GL_FALSE; + switch (srcType) { case GL_FLOAT: case GL_UNSIGNED_BYTE: @@ -1762,36 +1795,6 @@ texstore_rgba(TEXSTORE_PARAMS) } GLboolean -_mesa_texstore_needs_transfer_ops(struct gl_context *ctx, - GLenum baseInternalFormat, - mesa_format dstFormat) -{ - GLenum dstType; - - /* There are different rules depending on the base format. */ - switch (baseInternalFormat) { - case GL_DEPTH_COMPONENT: - case GL_DEPTH_STENCIL: - return ctx->Pixel.DepthScale != 1.0f || - ctx->Pixel.DepthBias != 0.0f; - - case GL_STENCIL_INDEX: - return GL_FALSE; - - default: - /* Color formats. - * Pixel transfer ops (scale, bias, table lookup) do not apply - * to integer formats. - */ - dstType = _mesa_get_format_datatype(dstFormat); - - return dstType != GL_INT && dstType != GL_UNSIGNED_INT && - ctx->_ImageTransferState; - } -} - - -GLboolean _mesa_texstore_can_use_memcpy(struct gl_context *ctx, GLenum baseInternalFormat, mesa_format dstFormat, GLenum srcFormat, GLenum srcType, -- 2.0.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev