diff options
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 16 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/common/dri_util.c | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/swrast/swrast.c | 19 |
3 files changed, 42 insertions, 13 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index d36b1a3b8..ca01a3301 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -74,6 +74,8 @@ #include "program/program.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" +#include "main/enums.h" +#include "main/glformats.h" /** Return offset in bytes of the field within a vertex struct */ @@ -3158,8 +3160,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, * ReadPixels() and passed to Tex[Sub]Image(). */ static GLenum -get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) +get_temp_image_type(struct gl_context *ctx, gl_format format) { + GLenum baseFormat, type; + + baseFormat = _mesa_get_format_base_format(format); + switch (baseFormat) { case GL_RGBA: case GL_RGB: @@ -3174,7 +3180,7 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) else if (ctx->DrawBuffer->Visual.redBits <= 16) return GL_UNSIGNED_SHORT; else - return GL_FLOAT; + return _mesa_get_format_datatype(format); case GL_DEPTH_COMPONENT: return GL_UNSIGNED_INT; case GL_DEPTH_STENCIL: @@ -3216,12 +3222,10 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, format = GL_RGBA; } + type = get_temp_image_type(ctx, texImage->TexFormat); if (_mesa_is_format_integer_color(texImage->TexFormat)) { - _mesa_problem(ctx, "unsupported integer color copyteximage"); - return; + format = _mesa_base_format_to_integer_format(format); } - - type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { _mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()"); diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index 91ae186fe..86409dd06 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api, mesa_api = API_OPENGLES2; break; case __DRI_API_OPENGL_CORE: + mesa_api = API_OPENGL_CORE; + break; default: *error = __DRI_CTX_ERROR_BAD_API; return NULL; @@ -218,6 +220,20 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api, } } + /* Mesa does not support the GL_ARB_compatibilty extension or the + * compatibility profile. This means that we treat a API_OPENGL 3.1 as + * API_OPENGL_CORE and reject API_OPENGL 3.2+. + */ + if (mesa_api == API_OPENGL && major_version == 3 && minor_version == 1) + mesa_api = API_OPENGL_CORE; + + if (mesa_api == API_OPENGL + && ((major_version > 3) + || (major_version == 3 && minor_version >= 2))) { + *error = __DRI_CTX_ERROR_BAD_API; + return NULL; + } + /* The EGL_KHR_create_context spec says: * * "Flags are only defined for OpenGL context creation, and specifying @@ -228,8 +244,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api, * anything specific about this case. However, none of the known flags * have any meaning in an ES context, so this seems safe. */ - if (mesa_api != __DRI_API_OPENGL - && mesa_api != __DRI_API_OPENGL_CORE + if (mesa_api != API_OPENGL + && mesa_api != API_OPENGL_CORE && flags != 0) { *error = __DRI_CTX_ERROR_BAD_FLAG; return NULL; diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index 61cbb6add..28177cbe0 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -724,11 +724,20 @@ dri_create_context(gl_api api, */ (void) flags; - if (api == API_OPENGL - && (major_version > 2 - || (major_version == 2 && minor_version > 1))) { - *error = __DRI_CTX_ERROR_BAD_VERSION; - goto context_fail; + switch (api) { + case API_OPENGL: + if (major_version > 2 + || (major_version == 2 && minor_version > 1)) { + *error = __DRI_CTX_ERROR_BAD_VERSION; + return GL_FALSE; + } + break; + case API_OPENGLES: + case API_OPENGLES2: + break; + case API_OPENGL_CORE: + *error = __DRI_CTX_ERROR_BAD_API; + return GL_FALSE; } ctx = CALLOC_STRUCT(dri_context); |