return GL_TRUE;
}
+ if (!texture_formats_agree(texImage->InternalFormat, format)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(incompatible internalFormat = %s, format = %s)",
+ callerName,
+ _mesa_enum_to_string(texImage->InternalFormat),
+ _mesa_enum_to_string(format));
+ return GL_TRUE;
+ }
+
GLenum internalFormat = _mesa_is_gles(ctx) ?
oes_float_internal_format(ctx, texImage->InternalFormat, type) :
texImage->InternalFormat;
internalFormat = override_internal_format(internalFormat, width, height);
+ if (!no_error &&
+ /* target error checking */
+ !legal_teximage_target(ctx, dims, target)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s%uD(target=%s)",
+ func, dims, _mesa_enum_to_string(target));
+ return;
+ }
+
if (!texObj)
texObj = _mesa_get_current_tex_object(ctx, target);
if (!no_error) {
- /* target error checking */
- if (!legal_teximage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s%uD(target=%s)",
- func, dims, _mesa_enum_to_string(target));
- return;
- }
-
/* general error checking */
if (compressed) {
if (compressed_texture_error_check(ctx, dims, target, texObj,
}
+void GLAPIENTRY
+_mesa_CopyMultiTexImage1DEXT( GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y,
+ GLsizei width, GLint border )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_object* texObj =
+ _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ false,
+ "glCopyMultiTexImage1DEXT");
+ if (!texObj)
+ return;
+ copyteximage(ctx, 1, texObj, target, level, internalFormat, x, y, width, 1,
+ border, false);
+}
+
+
void GLAPIENTRY
_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
}
+void GLAPIENTRY
+_mesa_CopyMultiTexImage2DEXT( GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_object* texObj =
+ _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ false,
+ "glCopyMultiTexImage2DEXT");
+ if (!texObj)
+ return;
+ copyteximage(ctx, 2, texObj, target, level, internalFormat, x, y, width, height,
+ border, false);
+}
+
+
void GLAPIENTRY
_mesa_CopyTexImage1D_no_error(GLenum target, GLint level, GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLint border)
}
+void GLAPIENTRY
+_mesa_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y, GLsizei width)
+{
+ struct gl_texture_object* texObj;
+ const char *self = "glCopyMultiTexSubImage1DEXT";
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ false, self);
+ if (!texObj)
+ return;
+
+ copy_texture_sub_image_err(ctx, 1, texObj, texObj->Target, level, xoffset, 0,
+ 0, x, y, width, 1, self);
+}
+
+
void GLAPIENTRY
_mesa_CopyTextureSubImage2D(GLuint texture, GLint level,
GLint xoffset, GLint yoffset,
}
+void GLAPIENTRY
+_mesa_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ struct gl_texture_object* texObj;
+ const char *self = "glCopyMultiTexSubImage2DEXT";
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ false, self);
+ if (!texObj)
+ return;
+
+ copy_texture_sub_image_err(ctx, 2, texObj, texObj->Target, level, xoffset,
+ yoffset, 0, x, y, width, height, self);
+}
+
void GLAPIENTRY
_mesa_CopyTextureSubImage3D(GLuint texture, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
}
+void GLAPIENTRY
+_mesa_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ struct gl_texture_object* texObj;
+ const char *self = "glCopyMultiTexSubImage3D";
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ false, self);
+ if (!texObj)
+ return;
+
+ if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ /* Act like CopyTexSubImage2D */
+ copy_texture_sub_image_err(ctx, 2, texObj,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset,
+ level, xoffset, yoffset, 0, x, y, width, height,
+ self);
+ }
+ else
+ copy_texture_sub_image_err(ctx, 3, texObj, texObj->Target, level, xoffset,
+ yoffset, zoffset, x, y, width, height, self);
+}
+
+
void GLAPIENTRY
_mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset,
GLint x, GLint y, GLsizei width)
}
+void GLAPIENTRY
+_mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+ "glCompressedTextureImage1DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 1, texObj, target, level, internalFormat,
+ width, 1, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glCompressedMultiTexImage1DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 1, texObj, target, level, internalFormat,
+ width, 1, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
void GLAPIENTRY
_mesa_CompressedTexImage2D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
}
+void GLAPIENTRY
+_mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+ "glCompressedTextureImage2DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 2, texObj, target, level, internalFormat,
+ width, height, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glCompressedMultiTexImage2DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 2, texObj, target, level, internalFormat,
+ width, height, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
void GLAPIENTRY
_mesa_CompressedTexImage3D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
}
+void GLAPIENTRY
+_mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+ "glCompressedTextureImage3DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 3, texObj, target, level, internalFormat,
+ width, height, depth, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glCompressedMultiTexImage3DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 3, texObj, target, level, internalFormat,
+ width, height, depth, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
void GLAPIENTRY
_mesa_CompressedTexImage1D_no_error(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
}
-static ALWAYS_INLINE void
-compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
+enum tex_mode {
+ /* Use bound texture to current unit */
+ TEX_MODE_CURRENT_NO_ERROR = 0,
+ TEX_MODE_CURRENT_ERROR,
+ /* Use the specified texture name */
+ TEX_MODE_DSA_NO_ERROR,
+ TEX_MODE_DSA_ERROR,
+ /* Use the specified texture name + target */
+ TEX_MODE_EXT_DSA_TEXTURE,
+ /* Use the specified texture unit + target */
+ TEX_MODE_EXT_DSA_TEXUNIT,
+};
+
+
+static void
+compressed_tex_sub_image(unsigned dim, GLenum target, GLuint textureOrIndex,
GLint level, GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width, GLsizei height,
GLsizei depth, GLenum format, GLsizei imageSize,
- const GLvoid *data, bool dsa, bool ext_dsa,
- bool no_error, const char *caller)
+ const GLvoid *data, enum tex_mode mode,
+ const char *caller)
{
struct gl_texture_object *texObj = NULL;
struct gl_texture_image *texImage;
-
+ bool no_error = false;
GET_CURRENT_CONTEXT(ctx);
- if (dsa) {
- if (no_error) {
- texObj = _mesa_lookup_texture(ctx, texture);
- target = texObj->Target;
- } else {
- if (!ext_dsa) {
- texObj = _mesa_lookup_texture_err(ctx, texture, caller);
- if (!texObj)
- return;
-
+ switch (mode) {
+ case TEX_MODE_DSA_ERROR:
+ assert(target == 0);
+ texObj = _mesa_lookup_texture_err(ctx, textureOrIndex, caller);
+ if (texObj)
target = texObj->Target;
- } else {
- texObj = lookup_texture_ext_dsa(ctx, target, texture, caller);
- if (!texObj)
- return;
- }
- }
+ break;
+ case TEX_MODE_DSA_NO_ERROR:
+ assert(target == 0);
+ texObj = _mesa_lookup_texture(ctx, textureOrIndex);
+ if (texObj)
+ target = texObj->Target;
+ no_error = true;
+ break;
+ case TEX_MODE_EXT_DSA_TEXTURE:
+ texObj = _mesa_lookup_or_create_texture(ctx, target, textureOrIndex,
+ false, true, caller);
+ break;
+ case TEX_MODE_EXT_DSA_TEXUNIT:
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ textureOrIndex,
+ false,
+ caller);
+ break;
+ case TEX_MODE_CURRENT_NO_ERROR:
+ no_error = true;
+ case TEX_MODE_CURRENT_ERROR:
+ default:
+ assert(textureOrIndex == 0);
+ break;
}
if (!no_error &&
- compressed_subtexture_target_check(ctx, target, dim, format, dsa,
+ compressed_subtexture_target_check(ctx, target, dim, format,
+ mode == TEX_MODE_DSA_ERROR,
caller)) {
return;
}
- if (!dsa) {
+ if (mode == TEX_MODE_CURRENT_NO_ERROR ||
+ mode == TEX_MODE_CURRENT_ERROR) {
texObj = _mesa_get_current_tex_object(ctx, target);
- if (!no_error && !texObj)
- return;
}
+ if (!texObj)
+ return;
+
if (!no_error &&
compressed_subtexture_error_check(ctx, dim, texObj, target, level,
xoffset, yoffset, zoffset, width,
}
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
- if (dim == 3 && dsa && texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ if (dim == 3 &&
+ (mode == TEX_MODE_DSA_ERROR || mode == TEX_MODE_DSA_NO_ERROR) &&
+ texObj->Target == GL_TEXTURE_CUBE_MAP) {
const char *pixels = data;
GLint image_stride;
}
}
-static void
-compressed_tex_sub_image_error(unsigned dim, GLenum target, GLuint texture,
- GLint level, GLint xoffset, GLint yoffset,
- GLint zoffset, GLsizei width, GLsizei height,
- GLsizei depth, GLenum format, GLsizei imageSize,
- const GLvoid *data, bool dsa, bool ext_dsa,
- const char *caller)
-{
- compressed_tex_sub_image(dim, target, texture, level, xoffset, yoffset,
- zoffset, width, height, depth, format, imageSize,
- data, dsa, ext_dsa, false, caller);
-}
-
-static void
-compressed_tex_sub_image_no_error(unsigned dim, GLenum target, GLuint texture,
- GLint level, GLint xoffset, GLint yoffset,
- GLint zoffset, GLsizei width, GLsizei height,
- GLsizei depth, GLenum format, GLsizei imageSize,
- const GLvoid *data, bool dsa, bool ext_dsa,
- const char *caller)
-{
- compressed_tex_sub_image(dim, target, texture, level, xoffset, yoffset,
- zoffset, width, height, depth, format, imageSize,
- data, dsa, ext_dsa, true, caller);
-}
void GLAPIENTRY
_mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level,
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_no_error(1, target, 0, level, xoffset, 0, 0, width,
- 1, 1, format, imageSize, data, false,
- false, "glCompressedTexSubImage1D");
+ compressed_tex_sub_image(1, target, 0,
+ level, xoffset, 0, 0, width,
+ 1, 1, format, imageSize, data,
+ TEX_MODE_CURRENT_NO_ERROR,
+ "glCompressedTexSubImage1D");
}
GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
- compressed_tex_sub_image_error(1, target, 0, level, xoffset, 0, 0, width, 1,
- 1, format, imageSize, data, false, false,
- "glCompressedTexSubImage1D");
+ compressed_tex_sub_image(1, target, 0,
+ level, xoffset, 0, 0, width,
+ 1, 1, format, imageSize, data,
+ TEX_MODE_CURRENT_ERROR,
+ "glCompressedTexSubImage1D");
}
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_no_error(1, 0, texture, level, xoffset, 0, 0,
- width, 1, 1, format, imageSize, data,
- true, false,
- "glCompressedTextureSubImage1D");
+ compressed_tex_sub_image(1, 0, texture,
+ level, xoffset, 0, 0,
+ width, 1, 1, format, imageSize, data,
+ TEX_MODE_DSA_NO_ERROR,
+ "glCompressedTextureSubImage1D");
}
GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
- compressed_tex_sub_image_error(1, 0, texture, level, xoffset, 0, 0, width,
- 1, 1, format, imageSize, data, true, false,
- "glCompressedTextureSubImage1D");
+ compressed_tex_sub_image(1, 0, texture,
+ level, xoffset, 0, 0,
+ width, 1, 1, format, imageSize, data,
+ TEX_MODE_DSA_ERROR,
+ "glCompressedTextureSubImage1D");
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target,
+ GLint level, GLint xoffset,
+ GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(1, target, texture, level, xoffset, 0,
+ 0, width, 1, 1, format, imageSize,
+ data,
+ TEX_MODE_EXT_DSA_TEXTURE,
+ "glCompressedTextureSubImage1DEXT");
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset,
+ GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(1, target, texunit - GL_TEXTURE0, level,
+ xoffset, 0, 0, width, 1, 1, format, imageSize,
+ data,
+ TEX_MODE_EXT_DSA_TEXUNIT,
+ "glCompressedMultiTexSubImage1DEXT");
}
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_no_error(2, target, 0, level, xoffset, yoffset, 0,
- width, height, 1, format, imageSize, data,
- false, false,
- "glCompressedTexSubImage2D");
+ compressed_tex_sub_image(2, target, 0, level,
+ xoffset, yoffset, 0,
+ width, height, 1, format, imageSize, data,
+ TEX_MODE_CURRENT_NO_ERROR,
+ "glCompressedTexSubImage2D");
}
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_error(2, target, 0, level, xoffset, yoffset, 0,
- width, height, 1, format, imageSize, data,
- false, false,
- "glCompressedTexSubImage2D");
+ compressed_tex_sub_image(2, target, 0, level,
+ xoffset, yoffset, 0,
+ width, height, 1, format, imageSize, data,
+ TEX_MODE_CURRENT_ERROR,
+ "glCompressedTexSubImage2D");
}
GLsizei height, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
- compressed_tex_sub_image_error(2, target, texture, level, xoffset, yoffset,
- 0, width, height, 1, format, imageSize,
- data, true, true,
- "glCompressedTextureSubImage2DEXT");
+ compressed_tex_sub_image(2, target, texture, level, xoffset,
+ yoffset, 0, width, height, 1, format,
+ imageSize, data,
+ TEX_MODE_EXT_DSA_TEXTURE,
+ "glCompressedTextureSubImage2DEXT");
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(2, target, texunit - GL_TEXTURE0, level,
+ xoffset, yoffset, 0, width, height, 1, format,
+ imageSize, data,
+ TEX_MODE_EXT_DSA_TEXUNIT,
+ "glCompressedMultiTexSubImage2DEXT");
}
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_no_error(2, 0, texture, level, xoffset, yoffset, 0,
- width, height, 1, format, imageSize, data,
- true, false,
- "glCompressedTextureSubImage2D");
+ compressed_tex_sub_image(2, 0, texture, level, xoffset, yoffset, 0,
+ width, height, 1, format, imageSize, data,
+ TEX_MODE_DSA_NO_ERROR,
+ "glCompressedTextureSubImage2D");
}
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_error(2, 0, texture, level, xoffset, yoffset, 0,
- width, height, 1, format, imageSize, data,
- true, false,
- "glCompressedTextureSubImage2D");
+ compressed_tex_sub_image(2, 0, texture, level, xoffset, yoffset, 0,
+ width, height, 1, format, imageSize, data,
+ TEX_MODE_DSA_ERROR,
+ "glCompressedTextureSubImage2D");
}
void GLAPIENTRY
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_no_error(3, target, 0, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, data, false, false,
- "glCompressedTexSubImage3D");
+ compressed_tex_sub_image(3, target, 0, level, xoffset, yoffset,
+ zoffset, width, height, depth, format,
+ imageSize, data,
+ TEX_MODE_CURRENT_NO_ERROR,
+ "glCompressedTexSubImage3D");
}
void GLAPIENTRY
GLsizei height, GLsizei depth, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
- compressed_tex_sub_image_error(3, target, 0, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, data, false, false,
- "glCompressedTexSubImage3D");
+ compressed_tex_sub_image(3, target, 0, level, xoffset, yoffset,
+ zoffset, width, height, depth, format,
+ imageSize, data,
+ TEX_MODE_CURRENT_ERROR,
+ "glCompressedTexSubImage3D");
}
void GLAPIENTRY
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_no_error(3, 0, texture, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, data, true, false,
- "glCompressedTextureSubImage3D");
+ compressed_tex_sub_image(3, 0, texture, level, xoffset, yoffset,
+ zoffset, width, height, depth, format,
+ imageSize, data,
+ TEX_MODE_DSA_NO_ERROR,
+ "glCompressedTextureSubImage3D");
}
void GLAPIENTRY
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- compressed_tex_sub_image_error(3, 0, texture, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, data, true, false,
- "glCompressedTextureSubImage3D");
+ compressed_tex_sub_image(3, 0, texture, level, xoffset, yoffset,
+ zoffset, width, height, depth, format,
+ imageSize, data,
+ TEX_MODE_DSA_ERROR,
+ "glCompressedTextureSubImage3D");
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
+ GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height,
+ GLsizei depth, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(3, target, texture, level, xoffset, yoffset,
+ zoffset, width, height, depth, format,
+ imageSize, data,
+ TEX_MODE_EXT_DSA_TEXTURE,
+ "glCompressedTextureSubImage3DEXT");
}
+
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width, GLsizei height,
+ GLsizei depth, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(3, target, texunit - GL_TEXTURE0, level,
+ xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data,
+ TEX_MODE_EXT_DSA_TEXUNIT,
+ "glCompressedMultiTexSubImage3DEXT");
+}
+
+
mesa_format
_mesa_get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
{
case GL_LUMINANCE32UI_EXT:
return MESA_FORMAT_L_UINT32;
case GL_LUMINANCE8_ALPHA8:
- return MESA_FORMAT_L8A8_UNORM;
+ return MESA_FORMAT_LA_UNORM8;
case GL_LUMINANCE16_ALPHA16:
- return MESA_FORMAT_L16A16_UNORM;
+ return MESA_FORMAT_LA_UNORM16;
case GL_LUMINANCE_ALPHA16F_ARB:
return MESA_FORMAT_LA_FLOAT16;
case GL_LUMINANCE_ALPHA32F_ARB:
return MESA_FORMAT_RGBA_UINT32;
case GL_RG8:
- return MESA_FORMAT_R8G8_UNORM;
+ return MESA_FORMAT_RG_UNORM8;
case GL_RG16:
if (_mesa_is_gles(ctx) && !_mesa_has_EXT_texture_norm16(ctx))
return MESA_FORMAT_NONE;
- return MESA_FORMAT_R16G16_UNORM;
+ return MESA_FORMAT_RG_UNORM16;
case GL_RG16F:
return MESA_FORMAT_RG_FLOAT16;
case GL_RG32F:
offset, size, "glTexBufferRange");
}
+
+/** GL_ARB_texture_buffer_range + GL_EXT_direct_state_access */
+void GLAPIENTRY
+_mesa_TextureBufferRangeEXT(GLuint texture, GLenum target, GLenum internalFormat,
+ GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ struct gl_texture_object *texObj;
+ struct gl_buffer_object *bufObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+ "glTextureBufferRangeEXT");
+ if (!texObj)
+ return;
+
+ if (!check_texture_buffer_target(ctx, target, "glTextureBufferRangeEXT"))
+ return;
+
+ if (buffer) {
+ bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBufferRangeEXT");
+ if (!bufObj)
+ return;
+
+ if (!check_texture_buffer_range(ctx, bufObj, offset, size,
+ "glTextureBufferRangeEXT"))
+ return;
+
+ } else {
+ /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
+ * Textures (PDF page 254):
+ * "If buffer is zero, then any buffer object attached to the buffer
+ * texture is detached, the values offset and size are ignored and
+ * the state for offset and size for the buffer texture are reset to
+ * zero."
+ */
+ offset = 0;
+ size = 0;
+ bufObj = NULL;
+ }
+
+ texture_buffer_range(ctx, texObj, internalFormat, bufObj,
+ offset, size, "glTextureBufferRangeEXT");
+}
+
+
void GLAPIENTRY
_mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
{
bufObj, 0, buffer ? -1 : 0, "glTextureBuffer");
}
+void GLAPIENTRY
+_mesa_TextureBufferEXT(GLuint texture, GLenum target,
+ GLenum internalFormat, GLuint buffer)
+{
+ struct gl_texture_object *texObj;
+ struct gl_buffer_object *bufObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (buffer) {
+ bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBuffer");
+ if (!bufObj)
+ return;
+ } else
+ bufObj = NULL;
+
+ /* Get the texture object by Name. */
+ texObj = _mesa_lookup_or_create_texture(ctx, target, texture,
+ false, true,
+ "glTextureBufferEXT");
+
+ if (!texObj ||
+ !check_texture_buffer_target(ctx, texObj->Target, "glTextureBufferEXT"))
+ return;
+
+ texture_buffer_range(ctx, texObj, internalFormat,
+ bufObj, 0, buffer ? -1 : 0, "glTextureBufferEXT");
+}
+
+void GLAPIENTRY
+_mesa_MultiTexBufferEXT(GLenum texunit, GLenum target,
+ GLenum internalFormat, GLuint buffer)
+{
+ struct gl_texture_object *texObj;
+ struct gl_buffer_object *bufObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (buffer) {
+ bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMultiTexBufferEXT");
+ if (!bufObj)
+ return;
+ } else
+ bufObj = NULL;
+
+ /* Get the texture object */
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glMultiTexBufferEXT");
+
+ if (!texObj ||
+ !check_texture_buffer_target(ctx, texObj->Target, "glMultiTexBufferEXT"))
+ return;
+
+ texture_buffer_range(ctx, texObj, internalFormat,
+ bufObj, 0, buffer ? -1 : 0, "glMultiTexBufferEXT");
+}
+
void GLAPIENTRY
_mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
GLintptr offset, GLsizeiptr size)