* Fills in the fields of \p img with the given information.
* Note: width, height and depth include the border.
*/
-static void
-init_teximage_fields_ms(struct gl_context *ctx,
+void
+_mesa_init_teximage_fields_ms(struct gl_context *ctx,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat,
mesa_format format,
GLuint numSamples, GLboolean fixedSampleLocations)
{
+ const GLint base_format =_mesa_base_tex_format(ctx, internalFormat);
GLenum target;
assert(img);
assert(width >= 0);
assert(depth >= 0);
target = img->TexObject->Target;
- img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
- assert(img->_BaseFormat != -1);
+ assert(base_format != -1);
+ img->_BaseFormat = (GLenum16)base_format;
img->InternalFormat = internalFormat;
img->Border = border;
img->Width = width;
GLint border, GLenum internalFormat,
mesa_format format)
{
- init_teximage_fields_ms(ctx, img, width, height, depth, border,
- internalFormat, format, 0, GL_TRUE);
+ _mesa_init_teximage_fields_ms(ctx, img, width, height, depth, border,
+ internalFormat, format, 0, GL_TRUE);
}
*/
GLboolean
_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target,
- GLuint numLevels, GLint level,
+ GLuint numLevels, MAYBE_UNUSED GLint level,
mesa_format format, GLuint numSamples,
GLint width, GLint height, GLint depth)
{
* Return true if the format is only valid for glCompressedTexImage.
*/
static bool
-compressedteximage_only_format(const struct gl_context *ctx, GLenum format)
+compressedteximage_only_format(GLenum format)
{
switch (format) {
case GL_PALETTE4_RGB8_OES:
* Return true if the format doesn't support online compression.
*/
bool
-_mesa_format_no_online_compression(const struct gl_context *ctx, GLenum format)
+_mesa_format_no_online_compression(GLenum format)
{
return _mesa_is_astc_format(format) ||
_mesa_is_etc2_format(format) ||
- compressedteximage_only_format(ctx, format);
+ compressedteximage_only_format(format);
}
/* Writes to an GL error pointer if non-null and returns whether or not the
* requires GL_OES_texture_float) are filtered elsewhere.
*/
char bufCallerName[20];
- snprintf(bufCallerName, 20, "glTexImage%dD", dimensions);
+ _mesa_snprintf(bufCallerName, 20, "glTexImage%dD", dimensions);
if (_mesa_is_gles(ctx) &&
texture_format_error_check_gles(ctx, format, type,
internalFormat, bufCallerName)) {
"glTexImage%dD(target can't be compressed)", dimensions);
return GL_TRUE;
}
- if (_mesa_format_no_online_compression(ctx, internalFormat)) {
+ if (_mesa_format_no_online_compression(internalFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexImage%dD(no compression for format)", dimensions);
return GL_TRUE;
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const GLvoid *pixels,
- bool dsa, const char *callerName)
+ const char *callerName)
{
struct gl_texture_image *texImage;
GLenum err;
}
if (_mesa_is_format_compressed(texImage->TexFormat)) {
- if (_mesa_format_no_online_compression(ctx, texImage->InternalFormat)) {
+ if (_mesa_format_no_online_compression(texImage->InternalFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no compression for format)", callerName);
return GL_TRUE;
static GLboolean
copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level, GLint internalFormat,
- GLint width, GLint height, GLint border )
+ GLint border )
{
GLint baseFormat;
GLint rb_base_format;
"glCopyTexImage%dD(target can't be compressed)", dimensions);
return GL_TRUE;
}
- if (_mesa_format_no_online_compression(ctx, internalFormat)) {
+ if (_mesa_format_no_online_compression(internalFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexImage%dD(no compression for format)", dimensions);
return GL_TRUE;
}
if (_mesa_is_format_compressed(texImage->TexFormat)) {
- if (_mesa_format_no_online_compression(ctx, texImage->InternalFormat)) {
+ if (_mesa_format_no_online_compression(texImage->InternalFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no compression for format)", caller);
return GL_TRUE;
return GL_TRUE;
}
+ /* From OpenGL ES 3.2 spec, section 8.6:
+ *
+ * "An INVALID_OPERATION error is generated by CopyTexSubImage3D,
+ * CopyTexImage2D, or CopyTexSubImage2D if the internalformat of the
+ * texture image being (re)specified is RGB9_E5"
+ */
+ if (texImage->InternalFormat == GL_RGB9_E5 &&
+ !_mesa_is_desktop_gl(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(invalid internal format %s)", caller,
+ _mesa_enum_to_string(texImage->InternalFormat));
+ return GL_TRUE;
+ }
+
if (!_mesa_source_buffer_exists(ctx, texImage->_BaseFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(missing readbuffer, format=%s)", caller,
* Check render to texture callback. Called from _mesa_HashWalk().
*/
static void
-check_rtt_cb(GLuint key, void *data, void *userData)
+check_rtt_cb(UNUSED GLuint key, void *data, void *userData)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
const struct cb_info *info = (struct cb_info *) userData;
/** Debug helper: override the user-requested internal format */
static GLenum
-override_internal_format(GLenum internalFormat, GLint width, GLint height)
+override_internal_format(GLenum internalFormat, UNUSED GLint width,
+ UNUSED GLint height)
{
#if 0
if (internalFormat == GL_RGBA16F_ARB ||
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- bool dsa)
+ GLenum format, GLenum type, const GLvoid *pixels)
{
FLUSH_VERTICES(ctx, 0);
if (texsubimage_error_check(ctx, dims, texObj, target, level,
xoffset, yoffset, zoffset,
width, height, depth, format, type,
- pixels, false, callerName)) {
+ pixels, callerName)) {
return; /* error was detected */
}
texture_sub_image(ctx, dims, texObj, texImage, target, level,
xoffset, yoffset, zoffset, width, height, depth,
- format, type, pixels, false);
+ format, type, pixels);
}
texture_sub_image(ctx, dims, texObj, texImage, target, level,
xoffset, yoffset, zoffset, width, height, depth,
- format, type, pixels, false);
+ format, type, pixels);
}
if (texsubimage_error_check(ctx, dims, texObj, texObj->Target, level,
xoffset, yoffset, zoffset,
width, height, depth, format, type,
- pixels, true, callerName)) {
+ pixels, callerName)) {
return; /* error was detected */
}
}
texture_sub_image(ctx, 3, texObj, texImage, texObj->Target,
level, xoffset, yoffset, 0,
width, height, 1, format,
- type, pixels, true);
+ type, pixels);
pixels = (GLubyte *) pixels + imageStride;
}
}
texture_sub_image(ctx, dims, texObj, texImage, texObj->Target,
level, xoffset, yoffset, zoffset,
width, height, depth, format,
- type, pixels, true);
+ type, pixels);
}
}
static bool
can_avoid_reallocation(const struct gl_texture_image *texImage,
GLenum internalFormat,
- mesa_format texFormat, GLint x, GLint y, GLsizei width,
+ mesa_format texFormat, GLsizei width,
GLsizei height, GLint border)
{
if (texImage->InternalFormat != internalFormat)
if (!no_error) {
if (copytexture_error_check(ctx, dims, target, level, internalFormat,
- width, height, border))
+ border))
return;
if (!_mesa_legal_texture_dimensions(ctx, target, level, width, height,
{
texImage = _mesa_select_tex_image(texObj, target, level);
if (texImage && can_avoid_reallocation(texImage, internalFormat, texFormat,
- x, y, width, height, border)) {
+ width, height, border)) {
_mesa_unlock_texture(ctx, texObj);
if (no_error) {
copy_texture_sub_image_no_error(ctx, dims, texObj, target, level, 0,
*/
else if (formats_differ_in_component_sizes (texFormat, rb->Format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%uD(componenet size changed in"
+ "glCopyTexImage%uD(component size changed in"
" internal format)", dims);
return;
}
return GL_TRUE;
}
- if (compressedteximage_only_format(ctx, format)) {
+ if (compressedteximage_only_format(format)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(format=%s cannot be updated)",
callerName, _mesa_enum_to_string(format));
return GL_TRUE;
case GL_RGBA8:
return MESA_FORMAT_R8G8B8A8_UNORM;
case GL_RGBA16:
- if (_mesa_is_gles(ctx))
+ if (_mesa_is_gles(ctx) && !_mesa_has_EXT_texture_norm16(ctx))
return MESA_FORMAT_NONE;
return MESA_FORMAT_RGBA_UNORM16;
case GL_RGBA16F_ARB:
case GL_RG8:
return MESA_FORMAT_R8G8_UNORM;
case GL_RG16:
- if (_mesa_is_gles(ctx))
+ if (_mesa_is_gles(ctx) && !_mesa_has_EXT_texture_norm16(ctx))
return MESA_FORMAT_NONE;
return MESA_FORMAT_R16G16_UNORM;
case GL_RG16F:
case GL_R8:
return MESA_FORMAT_R_UNORM8;
case GL_R16:
- if (_mesa_is_gles(ctx))
+ if (_mesa_is_gles(ctx) && !_mesa_has_EXT_texture_norm16(ctx))
return MESA_FORMAT_NONE;
return MESA_FORMAT_R_UNORM16;
case GL_R16F:
GLsizeiptr oldSize = texObj->BufferSize;
mesa_format format;
- /* NOTE: ARB_texture_buffer_object has interactions with
- * the compatibility profile that are not implemented.
+ /* NOTE: ARB_texture_buffer_object might not be supported in
+ * the compatibility profile.
*/
if (!_mesa_has_ARB_texture_buffer_object(ctx) &&
!_mesa_has_OES_texture_buffer(ctx)) {
}
sample_count_error = _mesa_check_sample_count(ctx, target,
- internalformat, samples);
+ internalformat, samples, samples);
samplesOK = sample_count_error == GL_NO_ERROR;
/* Page 254 of OpenGL 4.4 spec says:
if (_mesa_is_proxy_texture(target)) {
if (samplesOK && dimensionsOK && sizeOK) {
- init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
- internalformat, texFormat,
- samples, fixedsamplelocations);
+ _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
}
else {
/* clear all image fields */
ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
- init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
- internalformat, texFormat,
- samples, fixedsamplelocations);
+ _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
if (width > 0 && height > 0 && depth > 0) {
if (memObj) {
static bool
valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei depth,
- GLsizei samples, unsigned dims)
+ unsigned dims)
{
GET_CURRENT_CONTEXT(ctx);
if (!texObj)
return;
- if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+ if (!valid_texstorage_ms_parameters(width, height, 1, 2))
return;
texture_image_multisample(ctx, 2, texObj, NULL, target, samples,
if (!texObj)
return;
- if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+ if (!valid_texstorage_ms_parameters(width, height, depth, 3))
return;
texture_image_multisample(ctx, 3, texObj, NULL, target, samples,
if (!texObj)
return;
- if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+ if (!valid_texstorage_ms_parameters(width, height, 1, 2))
return;
texture_image_multisample(ctx, 2, texObj, NULL, texObj->Target,
if (!texObj)
return;
- if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+ if (!valid_texstorage_ms_parameters(width, height, depth, 3))
return;
texture_image_multisample(ctx, 3, texObj, NULL, texObj->Target, samples,