aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-09 17:12:32 +0100
committermarha <marha@users.sourceforge.net>2012-01-09 17:12:32 +0100
commit63c3a3a61863ccdc2ff3ab6a9f34d4a6fb72a8c8 (patch)
treec2ec625befefca3759575095264161ffc2267572 /mesalib/src/mesa/main
parent2ae775fec514a032da4e6ec7528c2ef98c3913ee (diff)
parenta1e97828c89278770cb249039ec92d959440c640 (diff)
downloadvcxsrv-63c3a3a61863ccdc2ff3ab6a9f34d4a6fb72a8c8.tar.gz
vcxsrv-63c3a3a61863ccdc2ff3ab6a9f34d4a6fb72a8c8.tar.bz2
vcxsrv-63c3a3a61863ccdc2ff3ab6a9f34d4a6fb72a8c8.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/attrib.c2
-rw-r--r--mesalib/src/mesa/main/bufferobj.c5
-rw-r--r--mesalib/src/mesa/main/dd.h42
-rw-r--r--mesalib/src/mesa/main/format_pack.c8
-rw-r--r--mesalib/src/mesa/main/format_unpack.h5
-rw-r--r--mesalib/src/mesa/main/framebuffer.c6
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/shaderobj.h3
-rw-r--r--mesalib/src/mesa/main/teximage.c46
9 files changed, 69 insertions, 54 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 6f4a91b1f..1c1ee5dde 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1068,7 +1068,7 @@ _mesa_PopAttrib(void)
p[0] = l->QuadraticAttenuation;
_mesa_light(ctx, i, GL_QUADRATIC_ATTENUATION, p);
}
- }
+ }
/* light model */
_mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT,
light->Model.Ambient);
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 63eb6faaa..b2a74f322 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -504,7 +504,7 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
{
void *srcPtr, *dstPtr;
- /* buffer should not already be mapped */
+ /* the buffers should not be mapped */
assert(!_mesa_bufferobj_mapped(src));
assert(!_mesa_bufferobj_mapped(dst));
@@ -514,6 +514,9 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
(GL_MAP_WRITE_BIT |
GL_MAP_INVALIDATE_RANGE_BIT), dst);
+ /* Note: the src and dst regions will never overlap. Trying to do so
+ * would generate GL_INVALID_VALUE earlier.
+ */
if (srcPtr && dstPtr)
memcpy(dstPtr, srcPtr, size);
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 6707e785d..24f3d4ca5 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -283,31 +283,33 @@ struct dd_function_table {
struct gl_texture_image *texImage );
/**
- * Called by glCopyTexSubImage1D().
- *
- * Drivers should use a fallback routine from texstore.c if needed.
+ * Called by glCopyTexSubImage1D() and glCopyTexImage1D().
*/
- void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset,
- GLint x, GLint y, GLsizei width );
+ void (*CopyTexSubImage1D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y, GLsizei width);
+
/**
- * Called by glCopyTexSubImage2D().
- *
- * Drivers should use a fallback routine from texstore.c if needed.
+ * Called by glCopyTexSubImage2D() and glCopyTexImage2D().
*/
- void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
+ void (*CopyTexSubImage2D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height);
+
/**
- * Called by glCopyTexSubImage3D().
- *
- * Drivers should use a fallback routine from texstore.c if needed.
+ * Called by glCopyTexSubImage3D() and glCopyTexImage3D().
*/
- void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
+ void (*CopyTexSubImage3D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height);
/**
* Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index 43677117e..0982c9af4 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -2532,10 +2532,10 @@ _mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst)
GLuint i;
/* this should put non-zero values into the channels of dst */
- maskColor[0] = colorMask[0] ? -1.0 : 0.0;
- maskColor[1] = colorMask[1] ? -1.0 : 0.0;
- maskColor[2] = colorMask[2] ? -1.0 : 0.0;
- maskColor[3] = colorMask[3] ? -1.0 : 0.0;
+ maskColor[0] = colorMask[0] ? -1.0f : 0.0f;
+ maskColor[1] = colorMask[1] ? -1.0f : 0.0f;
+ maskColor[2] = colorMask[2] ? -1.0f : 0.0f;
+ maskColor[3] = colorMask[3] ? -1.0f : 0.0f;
_mesa_pack_float_rgba_row(format, 1,
(const GLfloat (*)[4]) maskColor, dst);
diff --git a/mesalib/src/mesa/main/format_unpack.h b/mesalib/src/mesa/main/format_unpack.h
index 0d13a2d39..c5348d30d 100644
--- a/mesalib/src/mesa/main/format_unpack.h
+++ b/mesalib/src/mesa/main/format_unpack.h
@@ -40,11 +40,6 @@ _mesa_unpack_rgba_block(gl_format format,
GLuint x, GLuint y, GLuint width, GLuint height);
extern void
-_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
- const void *src, GLuint dst[][4]);
-
-
-extern void
_mesa_unpack_float_z_row(gl_format format, GLuint n,
const void *src, GLfloat *dst);
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index 6d5e4524a..730de6206 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -222,10 +222,6 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
ASSERT(!att->Texture);
att->Type = GL_NONE;
}
-
- /* unbind _Depth/_StencilBuffer to decr ref counts */
- _mesa_reference_renderbuffer(&fb->_DepthBuffer, NULL);
- _mesa_reference_renderbuffer(&fb->_StencilBuffer, NULL);
}
@@ -681,8 +677,6 @@ update_color_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
* _ColorDrawBuffers
* _NumColorDrawBuffers
* _ColorReadBuffer
- * _DepthBuffer
- * _StencilBuffer
*
* If the framebuffer is user-created, make sure it's complete.
*
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index dcb987116..64d8c8d3f 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2673,12 +2673,6 @@ struct gl_framebuffer
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
struct gl_renderbuffer *_ColorReadBuffer;
- /** Wrappers to make combined depth/stencil buffers look like separate
- * buffers. Only used by swrast. Will be removed in the future.
- */
- struct gl_renderbuffer *_DepthBuffer;
- struct gl_renderbuffer *_StencilBuffer;
-
/** Delete this framebuffer */
void (*Delete)(struct gl_framebuffer *fb);
};
diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h
index 941841d43..5470b51d7 100644
--- a/mesalib/src/mesa/main/shaderobj.h
+++ b/mesalib/src/mesa/main/shaderobj.h
@@ -32,9 +32,12 @@
#include "main/mtypes.h"
#include "program/ir_to_mesa.h"
+
#ifdef __cplusplus
extern "C" {
#endif
+
+
/**
* Internal functions
*/
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 6dd70b96c..9475e84f5 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -2752,6 +2752,25 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
/**
+ * For glCopyTexSubImage, return the source renderbuffer to copy texel data
+ * from. This depends on whether the texture contains color or depth values.
+ */
+static struct gl_renderbuffer *
+get_copy_tex_image_source(struct gl_context *ctx, gl_format texFormat)
+{
+ if (_mesa_get_format_bits(texFormat, GL_DEPTH_BITS) > 0) {
+ /* reading from depth/stencil buffer */
+ return ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
+ }
+ else {
+ /* copying from color buffer */
+ return ctx->ReadBuffer->_ColorReadBuffer;
+ }
+}
+
+
+
+/**
* Implement the glCopyTexImage1/2D() functions.
*/
static void
@@ -2828,13 +2847,16 @@ copyteximage(struct gl_context *ctx, GLuint dims,
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
&width, &height)) {
+ struct gl_renderbuffer *srcRb =
+ get_copy_tex_image_source(ctx, texImage->TexFormat);
+
if (dims == 1)
- ctx->Driver.CopyTexSubImage1D(ctx, target, level, dstX,
- srcX, srcY, width);
+ ctx->Driver.CopyTexSubImage1D(ctx, texImage, dstX,
+ srcRb, srcX, srcY, width);
else
- ctx->Driver.CopyTexSubImage2D(ctx, target, level, dstX, dstY,
- srcX, srcY, width, height);
+ ctx->Driver.CopyTexSubImage2D(ctx, texImage, dstX, dstY,
+ srcRb, srcX, srcY, width, height);
}
check_gen_mipmap(ctx, target, texObj, level);
@@ -2930,20 +2952,22 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
&width, &height)) {
+ struct gl_renderbuffer *srcRb =
+ get_copy_tex_image_source(ctx, texImage->TexFormat);
+
switch (dims) {
case 1:
- ctx->Driver.CopyTexSubImage1D(ctx, target, level,
- xoffset, x, y, width);
+ ctx->Driver.CopyTexSubImage1D(ctx, texImage, xoffset,
+ srcRb, x, y, width);
break;
case 2:
- ctx->Driver.CopyTexSubImage2D(ctx, target, level,
- xoffset, yoffset,
- x, y, width, height);
+ ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset,
+ srcRb, x, y, width, height);
break;
case 3:
- ctx->Driver.CopyTexSubImage3D(ctx, target, level,
+ ctx->Driver.CopyTexSubImage3D(ctx, texImage,
xoffset, yoffset, zoffset,
- x, y, width, height);
+ srcRb, x, y, width, height);
break;
default:
_mesa_problem(ctx, "bad dims in copytexsubimage()");