aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-04-23 22:47:55 +0200
committermarha <marha@users.sourceforge.net>2014-04-23 22:47:55 +0200
commit24fb0da18f1c44dfa1f76d8cde8efbb958aa7659 (patch)
tree76157bb2f88c9383b0824476a9e3a9f9a1bff9fa /mesalib/src/mesa/main
parent6876c31f186414ce975180af79902314c8cdc82a (diff)
parentd26ea2f474c48afa7d3c261572da5d85b7b62bd8 (diff)
downloadvcxsrv-24fb0da18f1c44dfa1f76d8cde8efbb958aa7659.tar.gz
vcxsrv-24fb0da18f1c44dfa1f76d8cde8efbb958aa7659.tar.bz2
vcxsrv-24fb0da18f1c44dfa1f76d8cde8efbb958aa7659.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/include/GL/glext.h xorg-server/.gitignore xorg-server/glx/glxext.c
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/fbobject.c18
-rw-r--r--mesalib/src/mesa/main/formats.c9
-rw-r--r--mesalib/src/mesa/main/formats.h3
-rw-r--r--mesalib/src/mesa/main/getstring.c2
-rw-r--r--mesalib/src/mesa/main/glformats.c16
-rw-r--r--mesalib/src/mesa/main/mtypes.h3
-rw-r--r--mesalib/src/mesa/main/texgetimage.c5
-rw-r--r--mesalib/src/mesa/main/teximage.c16
-rw-r--r--mesalib/src/mesa/main/texstate.c2
-rw-r--r--mesalib/src/mesa/main/varray.c2
10 files changed, 68 insertions, 8 deletions
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 6c4f1b548..ca16ae1ec 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -2676,8 +2676,7 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
return;
}
else if (rb == &DummyRenderbuffer) {
- /* This is what NVIDIA does */
- _mesa_error(ctx, GL_INVALID_VALUE,
+ _mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferRenderbufferEXT(renderbuffer %u)",
renderbuffer);
return;
@@ -2771,8 +2770,21 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
}
if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
- /* the depth and stencil attachments must point to the same buffer */
const struct gl_renderbuffer_attachment *depthAtt, *stencilAtt;
+ if (pname == GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) {
+ /* This behavior is first specified in OpenGL 4.4 specification.
+ *
+ * From the OpenGL 4.4 spec page 275:
+ * "This query cannot be performed for a combined depth+stencil
+ * attachment, since it does not have a single format."
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetFramebufferAttachmentParameteriv("
+ "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE"
+ " is invalid for depth+stencil attachment)");
+ return;
+ }
+ /* the depth and stencil attachments must point to the same buffer */
depthAtt = get_attachment(ctx, buffer, GL_DEPTH_ATTACHMENT);
stencilAtt = get_attachment(ctx, buffer, GL_STENCIL_ATTACHMENT);
if (depthAtt->Renderbuffer != stencilAtt->Renderbuffer) {
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index fb2501c69..5c670115e 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -2035,6 +2035,15 @@ _mesa_is_format_signed(mesa_format format)
}
}
+/**
+ * Is the given format an integer format?
+ */
+GLboolean
+_mesa_is_format_integer(mesa_format format)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ return (info->DataType == GL_INT || info->DataType == GL_UNSIGNED_INT);
+}
/**
* Return color encoding for given format.
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h
index 89bd0219e..185010e02 100644
--- a/mesalib/src/mesa/main/formats.h
+++ b/mesalib/src/mesa/main/formats.h
@@ -445,6 +445,9 @@ _mesa_is_format_unsigned(mesa_format format);
extern GLboolean
_mesa_is_format_signed(mesa_format format);
+extern GLboolean
+_mesa_is_format_integer(mesa_format format);
+
extern GLenum
_mesa_get_format_color_encoding(mesa_format format);
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index 3ac62d402..b0bd3190b 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -166,7 +166,7 @@ _mesa_GetStringi(GLenum name, GLuint index)
}
return _mesa_get_enabled_extension(ctx, index);
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetStringi");
return (const GLubyte *) 0;
}
}
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index 77cf26337..9bb341cc0 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -1238,6 +1238,22 @@ GLenum
_mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type)
{
+ /* From OpenGL 3.3 spec, page 220:
+ * "If the format is DEPTH_STENCIL, then values are taken from
+ * both the depth buffer and the stencil buffer. If there is no
+ * depth buffer or if there is no stencil buffer, then the error
+ * INVALID_OPERATION occurs. If the type parameter is not
+ * UNSIGNED_INT_24_8 or FLOAT_32_UNSIGNED_INT_24_8_REV, then the
+ * error INVALID_ENUM occurs."
+ *
+ * OpenGL ES still generates GL_INVALID_OPERATION because glReadPixels
+ * cannot be used to read depth or stencil in that API.
+ */
+ if (_mesa_is_desktop_gl(ctx) && format == GL_DEPTH_STENCIL
+ && type != GL_UNSIGNED_INT_24_8
+ && type != GL_FLOAT_32_UNSIGNED_INT_24_8_REV)
+ return GL_INVALID_ENUM;
+
/* special type-based checks (see glReadPixels, glDrawPixels error lists) */
switch (type) {
case GL_BITMAP:
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 4d014d1ee..66943836c 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1402,6 +1402,9 @@ struct gl_texture_attrib
/** Bitwise-OR of all Texture.Unit[i]._GenFlags */
GLbitfield _GenFlags;
+
+ /** Upper bound on _ReallyEnabled texunits. */
+ GLint _MaxEnabledTexImageUnit;
};
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index daabf2e81..2beb0abe6 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -853,6 +853,11 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
return GL_TRUE;
}
+ else if (_mesa_is_enum_format_integer(format) !=
+ _mesa_is_format_integer(texImage->TexFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+ return GL_TRUE;
+ }
if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width,
texImage->Height, texImage->Depth,
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 57a766f99..c7f301cbd 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -4374,7 +4374,7 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLboolean sizeOK, dimensionsOK;
+ GLboolean sizeOK, dimensionsOK, samplesOK;
mesa_format texFormat;
GLenum sample_count_error;
@@ -4411,7 +4411,17 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
sample_count_error = _mesa_check_sample_count(ctx, target,
internalformat, samples);
- if (sample_count_error != GL_NO_ERROR) {
+ samplesOK = sample_count_error == GL_NO_ERROR;
+
+ /* Page 254 of OpenGL 4.4 spec says:
+ * "Proxy arrays for two-dimensional multisample and two-dimensional
+ * multisample array textures are operated on in the same way when
+ * TexImage2DMultisample is called with target specified as
+ * PROXY_TEXTURE_2D_MULTISAMPLE, or TexImage3DMultisample is called
+ * with target specified as PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY.
+ * However, if samples is not supported, then no error is generated.
+ */
+ if (!samplesOK && !_mesa_is_proxy_texture(target)) {
_mesa_error(ctx, sample_count_error, "%s(samples)", func);
return;
}
@@ -4443,7 +4453,7 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
width, height, depth, 0);
if (_mesa_is_proxy_texture(target)) {
- if (dimensionsOK && sizeOK) {
+ if (samplesOK && dimensionsOK && sizeOK) {
init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
internalformat, texFormat,
samples, fixedsamplelocations);
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index fcae878cf..b68920ce1 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -550,6 +550,7 @@ update_texture_state( struct gl_context *ctx )
ctx->Texture._GenFlags = 0x0;
ctx->Texture._TexMatEnabled = 0x0;
ctx->Texture._TexGenEnabled = 0x0;
+ ctx->Texture._MaxEnabledTexImageUnit = -1;
/*
* Update texture unit state.
@@ -636,6 +637,7 @@ update_texture_state( struct gl_context *ctx )
/* if we get here, we know this texture unit is enabled */
ctx->Texture._EnabledUnits |= (1 << unit);
+ ctx->Texture._MaxEnabledTexImageUnit = unit;
if (enabledTargetsByStage[MESA_SHADER_FRAGMENT])
enabledFragUnits |= (1 << unit);
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index b88d70018..66a3ef119 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -738,7 +738,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
return array->Enabled;
case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
- return array->Size;
+ return (array->Format == GL_BGRA) ? GL_BGRA : array->Size;
case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
return array->Stride;
case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: