summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-02-14 12:08:33 +0100
committerMarek Olšák <[email protected]>2013-02-18 17:57:41 +0100
commit40ee93c4e885f868af68381b0a8542b6439ae774 (patch)
treedc32fd4b7b8677db7698baa9287231c73c318598 /src/mesa/main
parent6520a86c6755f52a1364fcd21dc36a5cb8381a0e (diff)
st/mesa: simplify and improve CopyTexSubImage
It has become a bit messy. Changes: - finally correct checking for transfer ops depending on the base format - making sure the base internal format and the texture format match (we were ignoring it, but it's important for correctness) - the way-too-strict rule that both src and dst base formats must be the same was dropped; ensuring the simpler and more permissive rule mentioned above is enough - stop using util_blit_pixels; pipe->blit is flexible enough, and now that we have RGBX and red-alpha formats, pipe->blit can be used for more cases Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texstore.c37
-rw-r--r--src/mesa/main/texstore.h4
2 files changed, 25 insertions, 16 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 77222d6dfb6..0e13d8903f9 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3792,26 +3792,21 @@ _mesa_get_texstore_func(gl_format format)
GLboolean
-_mesa_texstore_can_use_memcpy(struct gl_context *ctx,
- GLenum baseInternalFormat, gl_format dstFormat,
- GLenum srcFormat, GLenum srcType,
- const struct gl_pixelstore_attrib *srcPacking)
+_mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
+ GLenum baseInternalFormat,
+ gl_format dstFormat)
{
GLenum dstType;
- /* There are different restrictions depending on the base format... */
+ /* There are different rules depending on the base format. */
switch (baseInternalFormat) {
case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL:
- /* Depth scale and bias are not allowed. */
- if (ctx->Pixel.DepthScale != 1.0f ||
- ctx->Pixel.DepthBias != 0.0f) {
- return GL_FALSE;
- }
- break;
+ return ctx->Pixel.DepthScale != 1.0f ||
+ ctx->Pixel.DepthBias != 0.0f;
case GL_STENCIL_INDEX:
- break;
+ return GL_FALSE;
default:
/* Color formats.
@@ -3820,10 +3815,20 @@ _mesa_texstore_can_use_memcpy(struct gl_context *ctx,
*/
dstType = _mesa_get_format_datatype(dstFormat);
- if (dstType != GL_INT && dstType != GL_UNSIGNED_INT &&
- ctx->_ImageTransferState) {
- return GL_FALSE;
- }
+ return dstType != GL_INT && dstType != GL_UNSIGNED_INT &&
+ ctx->_ImageTransferState;
+ }
+}
+
+
+GLboolean
+_mesa_texstore_can_use_memcpy(struct gl_context *ctx,
+ GLenum baseInternalFormat, gl_format dstFormat,
+ GLenum srcFormat, GLenum srcType,
+ const struct gl_pixelstore_attrib *srcPacking)
+{
+ if (_mesa_texstore_needs_transfer_ops(ctx, baseInternalFormat, dstFormat)) {
+ return GL_FALSE;
}
/* The base internal format and the base Mesa format must match. */
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index 107f2130015..75f24bd45ac 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -69,6 +69,10 @@
extern GLboolean
_mesa_texstore(TEXSTORE_PARAMS);
+extern GLboolean
+_mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
+ GLenum baseInternalFormat,
+ gl_format dstFormat);
extern GLboolean
_mesa_texstore_can_use_memcpy(struct gl_context *ctx,