* NUM_TEXTURE_TARGETS should match number of terms below, except there's no
* proxy for GL_TEXTURE_BUFFER and GL_TEXTURE_EXTERNAL_OES.
*/
- assert(NUM_TEXTURE_TARGETS == 7 + 2);
+ assert(NUM_TEXTURE_TARGETS == 8 + 2);
return (target == GL_PROXY_TEXTURE_1D ||
target == GL_PROXY_TEXTURE_2D ||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_1D_ARRAY_EXT ||
- target == GL_PROXY_TEXTURE_2D_ARRAY_EXT);
+ target == GL_PROXY_TEXTURE_2D_ARRAY_EXT ||
+ target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY);
}
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
return GL_PROXY_TEXTURE_2D_ARRAY_EXT;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ return GL_PROXY_TEXTURE_CUBE_MAP_ARRAY;
default:
_mesa_problem(NULL, "unexpected target in _mesa_get_proxy_target()");
return 0;
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
return ctx->Extensions.ARB_texture_cube_map
? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array
+ ? texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX] : NULL;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array
+ ? ctx->Texture.ProxyTex[TEXTURE_CUBE_ARRAY_INDEX] : NULL;
case GL_TEXTURE_RECTANGLE_NV:
return ctx->Extensions.NV_texture_rectangle
? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL;
return NULL;
texIndex = TEXTURE_2D_ARRAY_INDEX;
break;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ if (level >= ctx->Const.MaxCubeTextureLevels)
+ return NULL;
+ texIndex = TEXTURE_CUBE_ARRAY_INDEX;
+ break;
default:
return NULL;
}
return (ctx->Extensions.MESA_texture_array ||
ctx->Extensions.EXT_texture_array)
? ctx->Const.MaxTextureLevels : 0;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array
+ ? ctx->Const.MaxCubeTextureLevels : 0;
case GL_TEXTURE_BUFFER:
return _mesa_is_desktop_gl(ctx)
&& ctx->Extensions.ARB_texture_buffer_object
case GL_PROXY_TEXTURE_3D:
case GL_TEXTURE_2D_ARRAY:
case GL_PROXY_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
return 3;
case GL_TEXTURE_BUFFER:
/* fall-through */
break;
case GL_TEXTURE_2D_ARRAY:
case GL_PROXY_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
img->HeightLog2 = _mesa_logbase2(img->Height2);
img->Depth2 = depth; /* no border */
}
return GL_TRUE;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
+ if (width < 2 * border || width > 2 * border + maxSize)
+ return GL_FALSE;
+ if (height < 2 * border || height > 2 * border + maxSize)
+ return GL_FALSE;
+ if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
+ return GL_FALSE;
+ if (level >= ctx->Const.MaxCubeTextureLevels)
+ return GL_FALSE;
+ if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+ if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+ return GL_FALSE;
+ if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+ return GL_FALSE;
+ }
+ return GL_TRUE;
default:
_mesa_problem(ctx, "Invalid target in _mesa_legal_texture_dimensions()");
return GL_FALSE;
case GL_TEXTURE_2D_ARRAY_EXT:
return (ctx->Extensions.MESA_texture_array ||
ctx->Extensions.EXT_texture_array);
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array;
default:
return GL_FALSE;
}
return _mesa_is_desktop_gl(ctx)
&& (ctx->Extensions.MESA_texture_array ||
ctx->Extensions.EXT_texture_array);
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array;
default:
return GL_FALSE;
}
&& (ctx->Extensions.MESA_texture_array ||
ctx->Extensions.EXT_texture_array))
|| _mesa_is_gles3(ctx);
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+ return ctx->Extensions.ARB_texture_cube_map_array;
default:
return GL_FALSE;
}
* Formats and types that require additional extensions (e.g., GL_FLOAT
* requires GL_OES_texture_float) are filtered elsewhere.
*/
+
if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
if (format != internalFormat) {
_mesa_error(ctx, GL_INVALID_OPERATION,
return GL_TRUE;
}
+ if ((target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY ||
+ target == GL_TEXTURE_CUBE_MAP_ARRAY) && width != height) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage3D(cube array width != height)");
+ return GL_TRUE;
+ }
+
+ if ((target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY ||
+ target == GL_TEXTURE_CUBE_MAP_ARRAY) && (depth % 6)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage3D(cube array depth not multiple of 6)");
+ return GL_TRUE;
+ }
+
/* Check internalFormat */
if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
- (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))) {
+ (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4)) &&
+ !((target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+ target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) &&
+ ctx->Extensions.ARB_texture_cube_map_array)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage%dD(bad target for depth texture)",
dimensions);
*height = *height - 2; /* reduce the height by two border pixels */
}
- if (*depth >= 3 && target != GL_TEXTURE_2D_ARRAY) {
+ if (*depth >= 3 && target != GL_TEXTURE_2D_ARRAY && target != GL_TEXTURE_CUBE_MAP_ARRAY) {
unpackNew->SkipImages++; /* skip the border */
*depth = *depth - 2; /* reduce the depth by two border pixels */
}
target == GL_TEXTURE_1D_ARRAY_EXT ||
target == GL_TEXTURE_2D_ARRAY_EXT ||
target == GL_TEXTURE_EXTERNAL_OES ||
+ target == GL_TEXTURE_CUBE_MAP_ARRAY ||
target == GL_TEXTURE_BUFFER);
memset(obj, 0, sizeof(*obj));
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_TEXTURE_BUFFER:
case GL_TEXTURE_EXTERNAL_OES:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
return GL_TRUE;
case 0x99:
_mesa_problem(NULL, "invalid reference to a deleted texture object");
maxLevels = ctx->Const.Max3DTextureLevels;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
maxLog2 = MAX2(baseImage->WidthLog2,
baseImage->HeightLog2);
maxLevels = ctx->Const.MaxCubeTextureLevels;
if (height > 1 && t->Target != GL_TEXTURE_1D_ARRAY) {
height /= 2;
}
- if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY) {
+ if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY && t->Target != GL_TEXTURE_CUBE_MAP_ARRAY) {
depth /= 2;
}
dims = 0;
target = GL_TEXTURE_BUFFER;
break;
+ case TEXTURE_CUBE_ARRAY_INDEX:
+ dims = 3;
+ target = GL_TEXTURE_CUBE_MAP_ARRAY;
+ break;
case TEXTURE_EXTERNAL_INDEX:
dims = 2;
target = GL_TEXTURE_EXTERNAL_OES;
case GL_TEXTURE_EXTERNAL_OES:
return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
? TEXTURE_EXTERNAL_INDEX : -1;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ return TEXTURE_CUBE_ARRAY_INDEX;
default:
return -1;
}