aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-12-23 10:01:52 +0100
committermarha <marha@users.sourceforge.net>2011-12-23 10:01:52 +0100
commite22891346b85a7db40dec7260a100f90b451cbc8 (patch)
treea7dd2d6757253947bcc821abbf68fd24d3301e89 /mesalib/src/mesa/main
parentabacebe06d9f3d2fe1b7d256bd86cddbfa592a85 (diff)
downloadvcxsrv-e22891346b85a7db40dec7260a100f90b451cbc8.tar.gz
vcxsrv-e22891346b85a7db40dec7260a100f90b451cbc8.tar.bz2
vcxsrv-e22891346b85a7db40dec7260a100f90b451cbc8.zip
git mesa pixman xserver xkeyboard-config update 24 dec 2011
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/accum.c2
-rw-r--r--mesalib/src/mesa/main/clear.c14
-rw-r--r--mesalib/src/mesa/main/drawpix.c6
-rw-r--r--mesalib/src/mesa/main/enable.c8
-rw-r--r--mesalib/src/mesa/main/format_unpack.c134
-rw-r--r--mesalib/src/mesa/main/get.c2
-rw-r--r--mesalib/src/mesa/main/imports.h2
-rw-r--r--mesalib/src/mesa/main/mtypes.h20
-rw-r--r--mesalib/src/mesa/main/teximage.c15
-rw-r--r--mesalib/src/mesa/main/teximage.h6
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c8
11 files changed, 183 insertions, 34 deletions
diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c
index eb06bbb6e..a8c30c223 100644
--- a/mesalib/src/mesa/main/accum.c
+++ b/mesalib/src/mesa/main/accum.c
@@ -100,7 +100,7 @@ _mesa_Accum( GLenum op, GLfloat value )
return;
}
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->RenderMode == GL_RENDER) {
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index 2e27c951b..bd5c01224 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -200,7 +200,7 @@ _mesa_Clear( GLbitfield mask )
ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax)
return;
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->RenderMode == GL_RENDER) {
@@ -338,7 +338,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
drawbuffer);
return;
}
- else if (!ctx->TransformFeedback.RasterDiscard) {
+ else if (!ctx->RasterDiscard) {
/* Save current stencil clear value, set to 'value', do the
* stencil clear and restore the clear value.
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
@@ -362,7 +362,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
drawbuffer);
return;
}
- else if (mask && !ctx->TransformFeedback.RasterDiscard) {
+ else if (mask && !ctx->RasterDiscard) {
union gl_color_union clearSave;
/* save color */
@@ -432,7 +432,7 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
drawbuffer);
return;
}
- else if (mask && !ctx->TransformFeedback.RasterDiscard) {
+ else if (mask && !ctx->RasterDiscard) {
union gl_color_union clearSave;
/* save color */
@@ -513,7 +513,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
drawbuffer);
return;
}
- else if (!ctx->TransformFeedback.RasterDiscard) {
+ else if (!ctx->RasterDiscard) {
/* Save current depth clear value, set to 'value', do the
* depth clear and restore the clear value.
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
@@ -538,7 +538,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
drawbuffer);
return;
}
- else if (mask && !ctx->TransformFeedback.RasterDiscard) {
+ else if (mask && !ctx->RasterDiscard) {
union gl_color_union clearSave;
/* save color */
@@ -615,7 +615,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
return;
}
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->NewState) {
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index c9e714b21..9f5b0b36e 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -98,7 +98,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
goto end; /* the error code was recorded */
}
- if (ctx->TransformFeedback.RasterDiscard) {
+ if (ctx->RasterDiscard) {
goto end;
}
@@ -210,7 +210,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
goto end;
}
- if (ctx->TransformFeedback.RasterDiscard) {
+ if (ctx->RasterDiscard) {
goto end;
}
@@ -268,7 +268,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
return;
}
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->RenderMode == GL_RENDER) {
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 6461ac1b3..270b24045 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -889,9 +889,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
#if FEATURE_EXT_transform_feedback
case GL_RASTERIZER_DISCARD:
CHECK_EXTENSION(EXT_transform_feedback, cap);
- if (ctx->TransformFeedback.RasterDiscard != state) {
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->TransformFeedback.RasterDiscard = state;
+ if (ctx->RasterDiscard != state) {
+ FLUSH_VERTICES(ctx, _NEW_RASTERIZER_DISCARD);
+ ctx->RasterDiscard = state;
}
break;
#endif
@@ -1403,7 +1403,7 @@ _mesa_IsEnabled( GLenum cap )
#if FEATURE_EXT_transform_feedback
case GL_RASTERIZER_DISCARD:
CHECK_EXTENSION(EXT_transform_feedback);
- return ctx->TransformFeedback.RasterDiscard;
+ return ctx->RasterDiscard;
#endif
/* GL_NV_primitive_restart */
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 32d198ce8..a22ff5a61 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -1581,6 +1581,58 @@ unpack_int_rgba_RGBA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
}
static void
+unpack_int_rgba_RGBA_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = src[i * 4 + 3];
+ }
+}
+
+static void
+unpack_int_rgba_RGBA_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = src[i * 4 + 3];
+ }
+}
+
+static void
+unpack_int_rgba_RGBA_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = src[i * 4 + 3];
+ }
+}
+
+static void
+unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = src[i * 4 + 3];
+ }
+}
+
+static void
unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
unsigned int i;
@@ -1594,6 +1646,58 @@ unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
}
static void
+unpack_int_rgba_RGB_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 3 + 0];
+ dst[i][1] = src[i * 3 + 1];
+ dst[i][2] = src[i * 3 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RGB_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 3 + 0];
+ dst[i][1] = src[i * 3 + 1];
+ dst[i][2] = src[i * 3 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RGB_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 3 + 0];
+ dst[i][1] = src[i * 3 + 1];
+ dst[i][2] = src[i * 3 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RGB_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 3 + 0];
+ dst[i][1] = src[i * 3 + 1];
+ dst[i][2] = src[i * 3 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
unpack_int_rgba_RG_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
unsigned int i;
@@ -1677,10 +1781,40 @@ _mesa_unpack_int_rgba_row(gl_format format, GLuint n,
case MESA_FORMAT_RGBA_INT32:
unpack_int_rgba_RGBA_UINT32(src, dst, n);
break;
+
+ case MESA_FORMAT_RGBA_UINT16:
+ unpack_int_rgba_RGBA_UINT16(src, dst, n);
+ break;
+ case MESA_FORMAT_RGBA_INT16:
+ unpack_int_rgba_RGBA_INT16(src, dst, n);
+ break;
+
+ case MESA_FORMAT_RGBA_UINT8:
+ unpack_int_rgba_RGBA_UINT8(src, dst, n);
+ break;
+ case MESA_FORMAT_RGBA_INT8:
+ unpack_int_rgba_RGBA_INT8(src, dst, n);
+ break;
+
case MESA_FORMAT_RGB_UINT32:
case MESA_FORMAT_RGB_INT32:
unpack_int_rgba_RGB_UINT32(src, dst, n);
break;
+
+ case MESA_FORMAT_RGB_UINT16:
+ unpack_int_rgba_RGB_UINT16(src, dst, n);
+ break;
+ case MESA_FORMAT_RGB_INT16:
+ unpack_int_rgba_RGB_INT16(src, dst, n);
+ break;
+
+ case MESA_FORMAT_RGB_UINT8:
+ unpack_int_rgba_RGB_UINT8(src, dst, n);
+ break;
+ case MESA_FORMAT_RGB_INT8:
+ unpack_int_rgba_RGB_INT8(src, dst, n);
+ break;
+
case MESA_FORMAT_RG_UINT32:
case MESA_FORMAT_RG_INT32:
unpack_int_rgba_RG_UINT32(src, dst, n);
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 4df6afe36..0c9d6b391 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1204,7 +1204,7 @@ static const struct value_desc values[] = {
/* GL_EXT_transform_feedback */
{ GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0,
extra_EXT_transform_feedback },
- { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(TransformFeedback.RasterDiscard),
+ { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(RasterDiscard),
extra_EXT_transform_feedback },
{ GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,
CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents),
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index 797f35742..d5e3859f8 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -568,7 +568,7 @@ _mesa_init_sqrt_table(void);
#ifdef __GNUC__
-#if defined(__MINGW32__) || defined(ANDROID)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID)
#define ffs __builtin_ffs
#define ffsll __builtin_ffsll
#endif
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 0e29dc0dc..3d3b006d5 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1821,7 +1821,17 @@ struct gl_transform_feedback_info {
unsigned OutputRegister;
unsigned OutputBuffer;
unsigned NumComponents;
+
+ /** offset (in DWORDs) of this output within the interleaved structure */
+ unsigned DstOffset;
} Outputs[MAX_PROGRAM_OUTPUTS];
+
+ /**
+ * Total number of components stored in each buffer. This may be used by
+ * hardware back-ends to determine the correct stride when interleaving
+ * multiple transform feedback outputs in the same buffer.
+ */
+ unsigned BufferStride[MAX_FEEDBACK_ATTRIBS];
};
/**
@@ -2376,8 +2386,6 @@ struct gl_transform_feedback
{
GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */
- GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
-
/** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */
struct gl_buffer_object *CurrentBuffer;
@@ -3065,6 +3073,12 @@ struct gl_matrix_stack
#define _NEW_FRAG_CLAMP (1 << 29)
#define _NEW_TRANSFORM_FEEDBACK (1 << 30) /**< gl_context::TransformFeedback */
#define _NEW_ALL ~0
+
+/**
+ * We use _NEW_TRANSFORM for GL_RASTERIZER_DISCARD. This #define is for
+ * clarity.
+ */
+#define _NEW_RASTERIZER_DISCARD _NEW_TRANSFORM
/*@}*/
@@ -3397,6 +3411,8 @@ struct gl_context
*/
GLboolean mvp_with_dp4;
+ GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
+
/**
* \name Hooks for module contexts.
*
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index eccc0fd39..18a7b87c0 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -541,18 +541,18 @@ _mesa_tex_target_to_face(GLenum target)
/**
- * Store a gl_texture_image pointer in a gl_texture_object structure
- * according to the target and level parameters.
+ * Install gl_texture_image in a gl_texture_object according to the target
+ * and level parameters.
*
* \param tObj texture object.
* \param target texture target.
* \param level image level.
* \param texImage texture image.
*/
-void
-_mesa_set_tex_image(struct gl_texture_object *tObj,
- GLenum target, GLint level,
- struct gl_texture_image *texImage)
+static void
+set_tex_image(struct gl_texture_object *tObj,
+ GLenum target, GLint level,
+ struct gl_texture_image *texImage)
{
const GLuint face = _mesa_tex_target_to_face(target);
@@ -604,6 +604,7 @@ _mesa_delete_texture_image(struct gl_context *ctx,
*/
ASSERT(ctx->Driver.FreeTextureImageBuffer);
ctx->Driver.FreeTextureImageBuffer( ctx, texImage );
+ free(texImage);
}
@@ -804,7 +805,7 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
return NULL;
}
- _mesa_set_tex_image(texObj, target, level, texImage);
+ set_tex_image(texObj, target, level, texImage);
}
return texImage;
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h
index d756646ce..0354c9ac5 100644
--- a/mesalib/src/mesa/main/teximage.h
+++ b/mesalib/src/mesa/main/teximage.h
@@ -90,12 +90,6 @@ _mesa_clear_texture_image(struct gl_context *ctx,
struct gl_texture_image *texImage);
-extern void
-_mesa_set_tex_image(struct gl_texture_object *tObj,
- GLenum target, GLint level,
- struct gl_texture_image *texImage);
-
-
extern struct gl_texture_object *
_mesa_select_tex_object(struct gl_context *ctx,
const struct gl_texture_unit *texUnit,
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index 824f66a35..53c09e265 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -404,7 +404,11 @@ bind_buffer_range(struct gl_context *ctx, GLuint index,
{
struct gl_transform_feedback_object *obj =
ctx->TransformFeedback.CurrentObject;
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+
+ /* Note: no need to FLUSH_VERTICES or flag _NEW_TRANSFORM_FEEDBACK, because
+ * transform feedback buffers can't be changed while transform feedback is
+ * active.
+ */
/* The general binding point */
_mesa_reference_buffer_object(ctx,
@@ -473,7 +477,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
return;
}
- if (offset + size >= bufObj->Size) {
+ if (offset + size > bufObj->Size) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glBindBufferRange(offset + size %d > buffer size %d)",
(int) (offset + size), (int) (bufObj->Size));