aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-22 08:51:58 +0100
committermarha <marha@users.sourceforge.net>2013-11-22 08:51:58 +0100
commit7dbaa1cffdf176f803f2c7069fb6810e16a86f72 (patch)
treee12bbf56a362758517fa9c26e46eca212448aca7 /mesalib/src/mesa/main
parent4887502815f54a96dce04c1f503f9e5f6ea7408a (diff)
parent697f071e3dcd3b01dba050d6c5316f2a23ee82f8 (diff)
downloadvcxsrv-7dbaa1cffdf176f803f2c7069fb6810e16a86f72.tar.gz
vcxsrv-7dbaa1cffdf176f803f2c7069fb6810e16a86f72.tar.bz2
vcxsrv-7dbaa1cffdf176f803f2c7069fb6810e16a86f72.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libxtrans mesa git update 22 nov 2013
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/debug.c10
-rw-r--r--mesalib/src/mesa/main/debug.h2
-rw-r--r--mesalib/src/mesa/main/fbobject.c84
-rw-r--r--mesalib/src/mesa/main/mtypes.h8
-rw-r--r--mesalib/src/mesa/main/texparam.c16
6 files changed, 94 insertions, 28 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index e0aee7a35..50c2f385a 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1535,7 +1535,7 @@ _mesa_make_current( struct gl_context *newCtx,
* information.
*/
if (_mesa_getenv("MESA_INFO")) {
- _mesa_print_info();
+ _mesa_print_info(newCtx);
}
newCtx->FirstTimeCurrent = GL_FALSE;
diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c
index 9434c1ea2..99b214789 100644
--- a/mesalib/src/mesa/main/debug.c
+++ b/mesalib/src/mesa/main/debug.c
@@ -103,7 +103,7 @@ _mesa_print_state( const char *msg, GLuint state )
/**
* Print information about this Mesa version and build options.
*/
-void _mesa_print_info( void )
+void _mesa_print_info( struct gl_context *ctx )
{
_mesa_debug(NULL, "Mesa GL_VERSION = %s\n",
(char *) _mesa_GetString(GL_VERSION));
@@ -111,8 +111,12 @@ void _mesa_print_info( void )
(char *) _mesa_GetString(GL_RENDERER));
_mesa_debug(NULL, "Mesa GL_VENDOR = %s\n",
(char *) _mesa_GetString(GL_VENDOR));
- _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n",
- (char *) _mesa_GetString(GL_EXTENSIONS));
+
+ /* use ctx as GL_EXTENSIONS will not work on 3.0 or higher
+ * core contexts.
+ */
+ _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", ctx->Extensions.String);
+
#if defined(THREADS)
_mesa_debug(NULL, "Mesa thread-safe: YES\n");
#else
diff --git a/mesalib/src/mesa/main/debug.h b/mesalib/src/mesa/main/debug.h
index 8414c5ebd..902f59538 100644
--- a/mesalib/src/mesa/main/debug.h
+++ b/mesalib/src/mesa/main/debug.h
@@ -43,7 +43,7 @@ struct gl_texture_image;
extern void _mesa_print_enable_flags( const char *msg, GLuint flags );
extern void _mesa_print_state( const char *msg, GLuint state );
-extern void _mesa_print_info( void );
+extern void _mesa_print_info( struct gl_context *ctx );
extern void _mesa_init_debug( struct gl_context *ctx );
extern void
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 9dd71612f..365062729 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -905,6 +905,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att;
GLenum f;
gl_format attFormat;
+ GLenum att_tex_target = GL_NONE;
/*
* XXX for ARB_fbo, only check color buffers that are named by
@@ -945,6 +946,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
*/
if (att->Type == GL_TEXTURE) {
const struct gl_texture_image *texImg = att->Renderbuffer->TexImage;
+ att_tex_target = att->Texture->Target;
minWidth = MIN2(minWidth, texImg->Width);
maxWidth = MAX2(maxWidth, texImg->Width);
minHeight = MIN2(minHeight, texImg->Height);
@@ -1057,7 +1059,14 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
}
/* Check that layered rendering is consistent. */
- att_layer_count = att->Layered ? att->Renderbuffer->Depth : 0;
+ if (att->Layered) {
+ if (att_tex_target == GL_TEXTURE_CUBE_MAP)
+ att_layer_count = 6;
+ else
+ att_layer_count = att->Renderbuffer->Depth;
+ } else {
+ att_layer_count = 0;
+ }
if (!layer_count_valid) {
layer_count = att_layer_count;
layer_count_valid = true;
@@ -1073,7 +1082,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
}
}
- fb->Layered = layer_count > 0;
+ fb->NumLayers = layer_count;
if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) {
/* Check that all DrawBuffers are present */
@@ -2298,8 +2307,13 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb,
/**
* Common code called by glFramebufferTexture1D/2D/3DEXT() and
* glFramebufferTextureLayerEXT().
- * Note: glFramebufferTextureLayerEXT() has no textarget parameter so we'll
- * get textarget=0 in that case.
+ *
+ * \param textarget is the textarget that was passed to the
+ * glFramebufferTexture...() function, or 0 if the corresponding function
+ * doesn't have a textarget parameter.
+ *
+ * \param layered is true if this function was called from
+ * glFramebufferTexture(), false otherwise.
*/
static void
framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
@@ -2334,16 +2348,46 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
texObj = _mesa_lookup_texture(ctx, texture);
if (texObj != NULL) {
if (textarget == 0) {
- /* If textarget == 0 it means we're being called by
- * glFramebufferTextureLayer() and textarget is not used.
- * The only legal texture types for that function are 3D and
- * 1D/2D arrays textures.
- */
- err = (texObj->Target != GL_TEXTURE_3D) &&
- (texObj->Target != GL_TEXTURE_1D_ARRAY_EXT) &&
- (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT) &&
- (texObj->Target != GL_TEXTURE_CUBE_MAP_ARRAY) &&
- (texObj->Target != GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
+ if (layered) {
+ /* We're being called by glFramebufferTexture() and textarget
+ * is not used.
+ */
+ switch (texObj->Target) {
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ err = false;
+ break;
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ /* These texture types are valid to pass to
+ * glFramebufferTexture(), but since they aren't layered, it
+ * is equivalent to calling glFramebufferTexture{1D,2D}().
+ */
+ err = false;
+ layered = false;
+ textarget = texObj->Target;
+ break;
+ default:
+ err = true;
+ break;
+ }
+ } else {
+ /* We're being called by glFramebufferTextureLayer() and
+ * textarget is not used. The only legal texture types for
+ * that function are 3D and 1D/2D arrays textures.
+ */
+ err = (texObj->Target != GL_TEXTURE_3D) &&
+ (texObj->Target != GL_TEXTURE_1D_ARRAY_EXT) &&
+ (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT) &&
+ (texObj->Target != GL_TEXTURE_CUBE_MAP_ARRAY) &&
+ (texObj->Target != GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
+ }
}
else {
/* Make sure textarget is consistent with the texture's type */
@@ -2920,6 +2964,18 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
" invalid FBO attachment structure");
}
return;
+ case GL_FRAMEBUFFER_ATTACHMENT_LAYERED:
+ if (!_mesa_has_geometry_shaders(ctx)) {
+ goto invalid_pname_enum;
+ } else if (att->Type == GL_TEXTURE) {
+ *params = att->Layered;
+ } else if (att->Type == GL_NONE) {
+ _mesa_error(ctx, err,
+ "glGetFramebufferAttachmentParameteriv(pname)");
+ } else {
+ goto invalid_pname_enum;
+ }
+ return;
default:
goto invalid_pname_enum;
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 8801d6f61..ecfb5e08f 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2994,7 +2994,13 @@ struct gl_framebuffer
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
struct gl_renderbuffer *_ColorReadBuffer;
- GLboolean Layered;
+ /**
+ * The number of layers in the framebuffer, or 0 if the framebuffer is not
+ * layered. For cube maps, this value is 6. For cube map arrays, this
+ * value is the "depth" value passed to TexImage3D (always a multiple of
+ * 6).
+ */
+ GLuint NumLayers;
/** Delete this framebuffer */
void (*Delete)(struct gl_framebuffer *fb);
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index d56b7d9d7..7092c630b 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -684,11 +684,8 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_LOD_BIAS:
- /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias.
- * It was removed in core-profile, and it has never existed in OpenGL
- * ES.
- */
- if (ctx->API != API_OPENGL_COMPAT)
+ /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias. */
+ if (_mesa_is_gles(ctx))
goto invalid_pname;
if (!target_allows_setting_sampler_parameters(texObj->Target))
@@ -1513,7 +1510,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = (GLfloat) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
- if (ctx->API != API_OPENGL_COMPAT)
+ if (_mesa_is_gles(ctx))
goto invalid_pname;
*params = obj->Sampler.LodBias;
@@ -1701,10 +1698,13 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
- if (ctx->API != API_OPENGL_COMPAT)
+ if (_mesa_is_gles(ctx))
goto invalid_pname;
- *params = (GLint) obj->Sampler.LodBias;
+ /* GL spec 'Data Conversions' section specifies that floating-point
+ * value in integer Get function is rounded to nearest integer
+ */
+ *params = IROUND(obj->Sampler.LodBias);
break;
case GL_TEXTURE_CROP_RECT_OES:
if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)