aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-27 10:48:05 +0100
committermarha <marha@users.sourceforge.net>2013-02-27 10:48:05 +0100
commit9bed5520560f553ac8ad4985ed41b31499d903fc (patch)
treee7e6587df3f87e4d5398da78a6b0761171da7d68 /mesalib/src/mesa/main
parentb14c3b05e45201bbbbb3a4beba260c3d6ff31003 (diff)
parentc74ef795c7282681616decc36a9a81cd1b1b6ec7 (diff)
downloadvcxsrv-9bed5520560f553ac8ad4985ed41b31499d903fc.tar.gz
vcxsrv-9bed5520560f553ac8ad4985ed41b31499d903fc.tar.bz2
vcxsrv-9bed5520560f553ac8ad4985ed41b31499d903fc.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 mesa pixman xkeyboard-config
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/context.c1
-rw-r--r--mesalib/src/mesa/main/dd.h4
-rw-r--r--mesalib/src/mesa/main/eval.c11
-rw-r--r--mesalib/src/mesa/main/eval.h4
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/fbobject.c53
-rw-r--r--mesalib/src/mesa/main/fbobject.h4
-rw-r--r--mesalib/src/mesa/main/points.c3
-rw-r--r--mesalib/src/mesa/main/teximage.c6
-rw-r--r--mesalib/src/mesa/main/texparam.c6
-rw-r--r--mesalib/src/mesa/main/texstore.c47
-rw-r--r--mesalib/src/mesa/main/texstore.h11
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c10
13 files changed, 135 insertions, 26 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index e5ed97f00..02acfc2aa 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1073,7 +1073,6 @@ _mesa_initialize_context(struct gl_context *ctx,
case API_OPENGLES2:
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
- ctx->Point.PointSprite = GL_TRUE; /* always on for ES 2.x */
break;
}
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 9a75fd954..9c818ccd8 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -604,7 +604,7 @@ struct dd_function_table {
/*@}*/
/**
- * \name Functions for GL_EXT_framebuffer_{object,blit}.
+ * \name Functions for GL_EXT_framebuffer_{object,blit,discard}.
*/
/*@{*/
struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name);
@@ -628,6 +628,8 @@ struct dd_function_table {
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
+ void (*DiscardFramebuffer)(struct gl_context *ctx,
+ GLenum target, GLsizei numAttachments, const GLenum *attachments);
/**
* \name Query objects
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index 44b57929e..b3c284175 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -824,7 +824,8 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
void
_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
- const GLvertexformat *vfmt)
+ const GLvertexformat *vfmt,
+ bool beginend)
{
SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
@@ -833,8 +834,12 @@ _mesa_install_eval_vtxfmt(struct _glapi_table *disp,
SET_EvalPoint1(disp, vfmt->EvalPoint1);
SET_EvalPoint2(disp, vfmt->EvalPoint2);
- SET_EvalMesh1(disp, vfmt->EvalMesh1);
- SET_EvalMesh2(disp, vfmt->EvalMesh2);
+ /* glEvalMesh1 and glEvalMesh2 are not allowed between glBegin and glEnd.
+ */
+ if (!beginend) {
+ SET_EvalMesh1(disp, vfmt->EvalMesh1);
+ SET_EvalMesh2(disp, vfmt->EvalMesh2);
+ }
}
diff --git a/mesalib/src/mesa/main/eval.h b/mesalib/src/mesa/main/eval.h
index 1b6c704ca..cfde53fd6 100644
--- a/mesalib/src/mesa/main/eval.h
+++ b/mesalib/src/mesa/main/eval.h
@@ -39,6 +39,7 @@
#include "main/mfeatures.h"
#include "main/mtypes.h"
+#include <stdbool.h>
#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) \
@@ -76,7 +77,8 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target,
extern void
_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
- const GLvertexformat *vfmt);
+ const GLvertexformat *vfmt,
+ bool beginend);
extern void _mesa_init_eval( struct gl_context *ctx );
extern void _mesa_free_eval_data( struct gl_context *ctx );
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 04435e0c9..e90a29680 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -168,6 +168,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_blend_color", o(EXT_blend_color), GLL, 1995 },
{ "GL_EXT_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 },
{ "GL_EXT_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 },
+ { "GL_EXT_discard_framebuffer", o(EXT_framebuffer_object), ES1 | ES2, 2009 },
{ "GL_EXT_blend_minmax", o(EXT_blend_minmax), GLL | ES1 | ES2, 1995 },
{ "GL_EXT_blend_subtract", o(dummy_true), GLL, 1995 },
{ "GL_EXT_clip_volume_hint", o(EXT_clip_volume_hint), GL, 1996 },
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 257f839a6..89bc57509 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -3310,3 +3310,56 @@ _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
0, 0, MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT,
"glInvalidateFramebuffer");
}
+
+void GLAPIENTRY
+_mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ struct gl_framebuffer *fb;
+ GLint i;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ fb = get_framebuffer_target(ctx, target);
+ if (!fb) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glDiscardFramebufferEXT(target %s)",
+ _mesa_lookup_enum_by_nr(target));
+ return;
+ }
+
+ if (numAttachments < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDiscardFramebufferEXT(numAttachments < 0)");
+ return;
+ }
+
+ for (i = 0; i < numAttachments; i++) {
+ switch (attachments[i]) {
+ case GL_COLOR:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (_mesa_is_user_fbo(fb))
+ goto invalid_enum;
+ break;
+ case GL_COLOR_ATTACHMENT0:
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ if (_mesa_is_winsys_fbo(fb))
+ goto invalid_enum;
+ break;
+ default:
+ goto invalid_enum;
+ }
+ }
+
+ if (ctx->Driver.DiscardFramebuffer)
+ ctx->Driver.DiscardFramebuffer(ctx, target, numAttachments, attachments);
+
+ return;
+
+invalid_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glDiscardFramebufferEXT(attachment %s)",
+ _mesa_lookup_enum_by_nr(attachments[i]));
+}
diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h
index 9207f59c7..ec8b0afe4 100644
--- a/mesalib/src/mesa/main/fbobject.h
+++ b/mesalib/src/mesa/main/fbobject.h
@@ -214,4 +214,8 @@ extern void GLAPIENTRY
_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
const GLenum *attachments);
+extern void GLAPIENTRY
+_mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments);
+
#endif /* FBOBJECT_H */
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index 17786408c..c925d4cfd 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -253,7 +253,8 @@ _mesa_init_point(struct gl_context *ctx)
* In a core context, the state will default to true, and the setters and
* getters are disabled.
*/
- ctx->Point.PointSprite = (ctx->API == API_OPENGL_CORE);
+ ctx->Point.PointSprite = (ctx->API == API_OPENGL_CORE ||
+ ctx->API == API_OPENGLES2);
ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index f8f517a42..f0de0fb49 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -3187,6 +3187,12 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
return;
}
+ if (!image) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glEGLImageTargetTexture2D(image=%p)", image);
+ return;
+ }
+
if (ctx->NewState & _NEW_PIXEL)
_mesa_update_state(ctx);
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index b6afd35ba..bc66bb36d 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -1444,6 +1444,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = (GLfloat) obj->Immutable;
break;
+ case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
+ if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image_external)
+ goto invalid_pname;
+ *params = obj->RequiredTextureImageUnits;
+ break;
+
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ctx->Extensions.EXT_texture_sRGB_decode)
goto invalid_pname;
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 9281aa9ea..0e13d8903 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -3791,24 +3791,22 @@ _mesa_get_texstore_func(gl_format format)
}
-static GLboolean
-_mesa_texstore_memcpy(TEXSTORE_PARAMS)
+GLboolean
+_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.
@@ -3817,10 +3815,20 @@ _mesa_texstore_memcpy(TEXSTORE_PARAMS)
*/
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. */
@@ -3834,6 +3842,17 @@ _mesa_texstore_memcpy(TEXSTORE_PARAMS)
return GL_FALSE;
}
+ return GL_TRUE;
+}
+
+static GLboolean
+_mesa_texstore_memcpy(TEXSTORE_PARAMS)
+{
+ if (!_mesa_texstore_can_use_memcpy(ctx, baseInternalFormat, dstFormat,
+ srcFormat, srcType, srcPacking)) {
+ return GL_FALSE;
+ }
+
memcpy_texture(ctx, dims,
dstFormat,
dstRowStride, dstSlices,
diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h
index 7af532d65..75f24bd45 100644
--- a/mesalib/src/mesa/main/texstore.h
+++ b/mesalib/src/mesa/main/texstore.h
@@ -69,6 +69,17 @@
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,
+ GLenum baseInternalFormat, gl_format dstFormat,
+ GLenum srcFormat, GLenum srcType,
+ const struct gl_pixelstore_attrib *srcPacking);
+
extern GLubyte *
_mesa_make_temp_ubyte_image(struct gl_context *ctx, GLuint dims,
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 347d07d57..8669c4007 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -45,7 +45,7 @@
*/
static void
install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
- const GLvertexformat *vfmt)
+ const GLvertexformat *vfmt, bool beginend)
{
assert(ctx->Version > 0);
@@ -62,7 +62,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
}
if (ctx->API == API_OPENGL_COMPAT) {
- _mesa_install_eval_vtxfmt(tab, vfmt);
+ _mesa_install_eval_vtxfmt(tab, vfmt, beginend);
}
if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
@@ -251,9 +251,9 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
void
_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{
- install_vtxfmt( ctx, ctx->Exec, vfmt );
+ install_vtxfmt(ctx, ctx->Exec, vfmt, false);
if (ctx->BeginEnd)
- install_vtxfmt( ctx, ctx->BeginEnd, vfmt );
+ install_vtxfmt(ctx, ctx->BeginEnd, vfmt, true);
}
@@ -265,7 +265,7 @@ void
_mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{
if (_mesa_is_desktop_gl(ctx))
- install_vtxfmt( ctx, ctx->Save, vfmt );
+ install_vtxfmt(ctx, ctx->Save, vfmt, false);
}