aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/fbobject.c8
-rw-r--r--mesalib/src/mesa/main/mipmap.c17
-rw-r--r--mesalib/src/mesa/main/mtypes.h7
-rw-r--r--mesalib/src/mesa/main/shaderapi.c19
-rw-r--r--mesalib/src/mesa/main/teximage.c10
-rw-r--r--mesalib/src/mesa/main/texobj.c11
-rw-r--r--mesalib/src/mesa/main/texobj.h3
-rw-r--r--mesalib/src/mesa/main/texparam.c2
-rw-r--r--mesalib/src/mesa/main/texstate.c6
-rw-r--r--mesalib/src/mesa/main/texstorage.c4
11 files changed, 59 insertions, 29 deletions
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 4e46cf095..1a040ee3b 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -275,6 +275,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_stencil4", o(dummy_false), DISABLE, 2005 },
{ "GL_OES_stencil8", o(dummy_true), ES1 | ES2, 2005 },
{ "GL_OES_stencil_wrap", o(dummy_true), ES1, 2002 },
+ { "GL_OES_surfaceless_context", o(dummy_true), ES1 | ES2, 2012 },
{ "GL_OES_texture_3D", o(EXT_texture3D), ES2, 2005 },
{ "GL_OES_texture_cube_map", o(ARB_texture_cube_map), ES1, 2007 },
{ "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1, 2005 },
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index a29f1ab13..bf7e85c88 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -2141,8 +2141,12 @@ _mesa_CheckFramebufferStatus(GLenum target)
}
if (_mesa_is_winsys_fbo(buffer)) {
- /* The window system / default framebuffer is always complete */
- return GL_FRAMEBUFFER_COMPLETE_EXT;
+ /* EGL_KHR_surfaceless_context allows the winsys FBO to be incomplete. */
+ if (buffer != &IncompleteFramebuffer) {
+ return GL_FRAMEBUFFER_COMPLETE_EXT;
+ } else {
+ return GL_FRAMEBUFFER_UNDEFINED;
+ }
}
/* No need to flush here */
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 583963232..180f89116 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -2024,7 +2024,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
GLubyte *temp_src = NULL, *temp_dst = NULL;
GLenum temp_datatype;
GLenum temp_base_format;
- GLubyte **temp_src_slices, **temp_dst_slices;
+ GLubyte **temp_src_slices = NULL, **temp_dst_slices = NULL;
/* only two types of compressed textures at this time */
assert(texObj->Target == GL_TEXTURE_2D ||
@@ -2063,11 +2063,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
temp_dst_slices = malloc(srcImage->Depth * sizeof(GLubyte *));
if (!temp_src || !temp_src_slices || !temp_dst_slices) {
- free(temp_src);
- free(temp_src_slices);
- free(temp_dst_slices);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- return;
+ goto end;
}
/* decompress base image to the temporary src buffer */
@@ -2119,7 +2116,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
temp_dst = malloc(temp_dst_img_stride * dstDepth);
if (!temp_dst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- break;
+ goto end;
}
}
@@ -2127,8 +2124,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
dstImage = _mesa_get_tex_image(ctx, texObj, target, level + 1);
if (!dstImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- free(temp_dst);
- return;
+ goto end;
}
/* for 2D arrays, setup array[depth] of slice pointers */
@@ -2153,8 +2149,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
dstWidth, dstHeight, dstDepth,
border, srcImage->InternalFormat,
srcImage->TexFormat)) {
- free(temp_dst);
- return;
+ /* all done */
+ goto end;
}
/* The image space was allocated above so use glTexSubImage now */
@@ -2173,6 +2169,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
}
} /* loop over mipmap levels */
+end:
free(temp_src);
free(temp_dst);
free(temp_src_slices);
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index aba7d845b..5bb680745 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2402,6 +2402,7 @@ struct gl_shader_program
#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */
#define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */
#define GLSL_REPORT_ERRORS 0x100 /**< Print compilation errors */
+#define GLSL_DUMP_ON_ERROR 0x200 /**< Dump shaders to stderr on compile error */
/**
@@ -2873,6 +2874,12 @@ struct gl_constants
GLboolean ForceGLSLExtensionsWarn;
/**
+ * If non-zero, forces GLSL shaders without the #version directive to behave
+ * as if they began with "#version ForceGLSLVersion".
+ */
+ GLuint ForceGLSLVersion;
+
+ /**
* Does the driver support real 32-bit integers? (Otherwise, integers are
* simulated via floats.)
*/
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 4cc0357b1..c349b0cb5 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -71,7 +71,9 @@ get_shader_flags(void)
const char *env = _mesa_getenv("MESA_GLSL");
if (env) {
- if (strstr(env, "dump"))
+ if (strstr(env, "dump_on_error"))
+ flags |= GLSL_DUMP_ON_ERROR;
+ else if (strstr(env, "dump"))
flags |= GLSL_DUMP;
if (strstr(env, "log"))
flags |= GLSL_LOG;
@@ -783,10 +785,17 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
}
- if (sh->CompileStatus == GL_FALSE &&
- (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) {
- _mesa_debug(ctx, "Error compiling shader %u:\n%s\n",
- sh->Name, sh->InfoLog);
+ if (!sh->CompileStatus) {
+ if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) {
+ fprintf(stderr, "GLSL source for %s shader %d:\n",
+ _mesa_glsl_shader_target_name(sh->Type), sh->Name);
+ fprintf(stderr, "%s\n", sh->Source);
+ }
+
+ if (ctx->Shader.Flags & GLSL_REPORT_ERRORS) {
+ _mesa_debug(ctx, "Error compiling shader %u:\n%s\n",
+ sh->Name, sh->InfoLog);
+ }
}
}
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 111849655..b719fc856 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1097,24 +1097,34 @@ _mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height,
switch (target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
+ case GL_PROXY_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_1D_ARRAY:
size = width;
break;
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
ASSERT(width == height);
size = width;
break;
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_ARRAY:
+ case GL_PROXY_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_2D_ARRAY:
size = MAX2(width, height);
break;
case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
size = MAX3(width, height, depth);
break;
case GL_TEXTURE_RECTANGLE:
case GL_TEXTURE_EXTERNAL_OES:
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ case GL_PROXY_TEXTURE_RECTANGLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return 1;
default:
assert(0);
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 2168bffb1..334dee77b 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -83,7 +83,7 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
struct gl_texture_object *obj;
(void) ctx;
obj = MALLOC_STRUCT(gl_texture_object);
- _mesa_initialize_texture_object(obj, name, target);
+ _mesa_initialize_texture_object(ctx, obj, name, target);
return obj;
}
@@ -95,7 +95,8 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
* \param target the texture target
*/
void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+ struct gl_texture_object *obj,
GLuint name, GLenum target )
{
ASSERT(target == 0 ||
@@ -146,7 +147,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Sampler.MaxAnisotropy = 1.0;
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
- obj->DepthMode = GL_LUMINANCE;
+ obj->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Swizzle[0] = GL_RED;
obj->Swizzle[1] = GL_GREEN;
@@ -154,8 +155,8 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Swizzle[3] = GL_ALPHA;
obj->_Swizzle = SWIZZLE_NOOP;
obj->Sampler.sRGBDecode = GL_DECODE_EXT;
- obj->BufferObjectFormat = GL_LUMINANCE8;
- obj->_BufferObjectFormat = MESA_FORMAT_L8;
+ obj->BufferObjectFormat = GL_R8;
+ obj->_BufferObjectFormat = MESA_FORMAT_R8;
}
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index a99f45bfa..0df088ce4 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -50,7 +50,8 @@ extern struct gl_texture_object *
_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
extern void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+ struct gl_texture_object *obj,
GLuint name, GLenum target );
extern void
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 141cbe3ab..32109951c 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -1048,6 +1048,8 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target)
return ctx->API == API_OPENGL_CORE && ctx->Version >= 31;
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return ctx->Extensions.ARB_texture_multisample;
default:
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 741985c46..afff01359 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -594,8 +594,8 @@ update_texture_state( struct gl_context *ctx )
/* Look for the highest priority texture target that's enabled (or used
* by the vert/frag shaders) and "complete". That's the one we'll use
- * for texturing. If we're using vert/frag program we're guaranteed
- * that bitcount(enabledBits) <= 1.
+ * for texturing.
+ *
* Note that the TEXTURE_x_INDEX values are in high to low priority.
*/
for (texIndex = 0; texIndex < NUM_TEXTURE_TARGETS; texIndex++) {
@@ -624,8 +624,6 @@ update_texture_state( struct gl_context *ctx )
struct gl_texture_object *texObj;
gl_texture_index texTarget;
- assert(_mesa_bitcount(enabledTargets) == 1);
-
texTarget = (gl_texture_index) (ffs(enabledTargets) - 1);
texObj = _mesa_get_fallback_texture(ctx, texTarget);
diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c
index 0a53726fe..7bd8652b5 100644
--- a/mesalib/src/mesa/main/texstorage.c
+++ b/mesalib/src/mesa/main/texstorage.c
@@ -335,14 +335,14 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
/* non-default texture object check */
texObj = _mesa_get_current_tex_object(ctx, target);
- if (!texObj || (texObj->Name == 0)) {
+ if (!_mesa_is_proxy_texture(target) && (!texObj || (texObj->Name == 0))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexStorage%uD(texture object 0)", dims);
return GL_TRUE;
}
/* Check if texObj->Immutable is set */
- if (texObj->Immutable) {
+ if (!_mesa_is_proxy_texture(target) && texObj->Immutable) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)",
dims);
return GL_TRUE;