#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
+#include "texstorage.h"
#include "mtypes.h"
#include "glformats.h"
static void
teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
GLint internalformat, GLsizei width, GLsizei height,
- GLsizei depth, GLboolean fixedsamplelocations)
+ GLsizei depth, GLboolean fixedsamplelocations,
+ GLboolean immutable)
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
* refer GL3.1 spec 4.4.4
*/
+ if (immutable && !_mesa_is_legal_tex_storage_format(ctx, internalformat)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(internalformat=%s not legal for immutable-format)",
+ func, _mesa_lookup_enum_by_nr(internalformat));
+ return;
+ }
+
if (!is_renderable_texture_format(ctx, internalformat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexImage%uDMultisample(internalformat=%s)",
}
texObj = _mesa_get_current_tex_object(ctx, target);
+
+ if (immutable && (!texObj || (texObj->Name == 0))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(texture object 0)",
+ func);
+ return;
+ }
+
texImage = _mesa_get_tex_image(ctx, texObj, 0, 0);
if (texImage == NULL) {
return;
}
+ /* Check if texObj->Immutable is set */
+ if (texObj->Immutable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%uDMultisample(immutable)",
+ dims);
+ return;
+ }
+
ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
_mesa_init_teximage_fields(ctx, texImage,
}
}
+ texObj->Immutable = immutable;
_mesa_update_fbo_texture(ctx, texObj, 0, 0);
}
}
GLsizei height, GLboolean fixedsamplelocations)
{
teximagemultisample(2, target, samples, internalformat,
- width, height, 1, fixedsamplelocations);
+ width, height, 1, fixedsamplelocations, GL_FALSE);
}
void GLAPIENTRY
GLboolean fixedsamplelocations)
{
teximagemultisample(3, target, samples, internalformat,
- width, height, depth, fixedsamplelocations);
+ width, height, depth, fixedsamplelocations, GL_FALSE);
}