aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-27 08:17:50 +0200
committermarha <marha@users.sourceforge.net>2012-09-04 14:23:00 +0200
commit02b914d3b9b658a16e17cf2d95deede75dbbacc9 (patch)
tree3757711ab3e1db8e1b59877354096503d9635112 /mesalib/src/mesa/main/texobj.c
parentf479a5fc7f844d96b169c399cb1e8ac085de6c2b (diff)
downloadvcxsrv-02b914d3b9b658a16e17cf2d95deede75dbbacc9.tar.gz
vcxsrv-02b914d3b9b658a16e17cf2d95deede75dbbacc9.tar.bz2
vcxsrv-02b914d3b9b658a16e17cf2d95deede75dbbacc9.zip
xwininfo fontconfig libX11 libXau libXext libxcb mesa pixman
xkeyboard-config git update 27 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main/texobj.c')
-rw-r--r--mesalib/src/mesa/main/texobj.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 1d905b608..638e418da 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -577,7 +577,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
GLint i;
const GLint minLevel = baseLevel;
const GLint maxLevel = t->_MaxLevel;
- const GLuint numFaces = t->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(t->Target);
GLuint width, height, depth, face;
if (minLevel > maxLevel) {
@@ -783,7 +783,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
texObj->Sampler.MinFilter = GL_NEAREST;
texObj->Sampler.MagFilter = GL_NEAREST;
- texFormat = ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA,
+ texFormat = ctx->Driver.ChooseTextureFormat(ctx, target,
+ GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE);
/* need a loop here just for cube maps */
@@ -826,7 +827,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
static GLuint
texture_size(const struct gl_texture_object *texObj)
{
- const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
GLuint face, level, size = 0;
for (face = 0; face < numFaces; face++) {
@@ -1118,27 +1119,39 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
* \return TEXTURE_x_INDEX or -1 if target is invalid
*/
static GLint
-target_enum_to_index(GLenum target)
+target_enum_to_index(struct gl_context *ctx, GLenum target)
{
switch (target) {
case GL_TEXTURE_1D:
- return TEXTURE_1D_INDEX;
+ return _mesa_is_desktop_gl(ctx) ? TEXTURE_1D_INDEX : -1;
case GL_TEXTURE_2D:
return TEXTURE_2D_INDEX;
case GL_TEXTURE_3D:
return TEXTURE_3D_INDEX;
case GL_TEXTURE_CUBE_MAP_ARB:
- return TEXTURE_CUBE_INDEX;
+ return ctx->Extensions.ARB_texture_cube_map
+ ? TEXTURE_CUBE_INDEX : -1;
case GL_TEXTURE_RECTANGLE_NV:
- return TEXTURE_RECT_INDEX;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle
+ ? TEXTURE_RECT_INDEX : -1;
case GL_TEXTURE_1D_ARRAY_EXT:
- return TEXTURE_1D_ARRAY_INDEX;
+ return _mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.EXT_texture_array
+ || ctx->Extensions.MESA_texture_array)
+ ? TEXTURE_1D_ARRAY_INDEX : -1;
case GL_TEXTURE_2D_ARRAY_EXT:
- return TEXTURE_2D_ARRAY_INDEX;
+ return (_mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.EXT_texture_array
+ || ctx->Extensions.MESA_texture_array))
+ || _mesa_is_gles3(ctx)
+ ? TEXTURE_2D_ARRAY_INDEX : -1;
case GL_TEXTURE_BUFFER_ARB:
- return TEXTURE_BUFFER_INDEX;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_buffer_object
+ ? TEXTURE_BUFFER_INDEX : -1;
case GL_TEXTURE_EXTERNAL_OES:
- return TEXTURE_EXTERNAL_INDEX;
+ return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
+ ? TEXTURE_EXTERNAL_INDEX : -1;
default:
return -1;
}
@@ -1173,7 +1186,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
_mesa_debug(ctx, "glBindTexture %s %d\n",
_mesa_lookup_enum_by_nr(target), (GLint) texName);
- targetIndex = target_enum_to_index(target);
+ targetIndex = target_enum_to_index(ctx, target);
if (targetIndex < 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)");
return;