texstorage_memory_ms(GLuint dims, GLenum target, GLsizei samples,
GLenum internalFormat, GLsizei width, GLsizei height,
GLsizei depth, GLboolean fixedSampleLocations,
- GLuint memory, GLuint64 offset)
+ GLuint memory, GLuint64 offset, const char* func)
{
+ struct gl_texture_object *texObj;
+ struct gl_memory_object *memObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_current_tex_object(ctx, target);
+ if (!texObj)
+ return;
+
+ memObj = lookup_memory_object_err(ctx, memory, func);
+ if (!memObj)
+ return;
+ _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, target, samples,
+ internalFormat, width, height, depth,
+ fixedSampleLocations, offset, func);
}
/**
texturestorage_memory_ms(GLuint dims, GLuint texture, GLsizei samples,
GLenum internalFormat, GLsizei width, GLsizei height,
GLsizei depth, GLboolean fixedSampleLocations,
- GLuint memory, GLuint64 offset)
+ GLuint memory, GLuint64 offset, const char* func)
{
+ struct gl_texture_object *texObj;
+ struct gl_memory_object *memObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_lookup_texture(ctx, texture);
+ if (!texObj)
+ return;
+
+ memObj = lookup_memory_object_err(ctx, memory, func);
+ if (!memObj)
+ return;
+ _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, texObj->Target,
+ samples, internalFormat, width, height,
+ depth, fixedSampleLocations, offset, func);
}
void GLAPIENTRY
GLuint64 offset)
{
texstorage_memory_ms(2, target, samples, internalFormat, width, height, 1,
- fixedSampleLocations, memory, offset);
+ fixedSampleLocations, memory, offset,
+ "glTexStorageMem2DMultisampleEXT");
}
void GLAPIENTRY
GLuint64 offset)
{
texstorage_memory_ms(3, target, samples, internalFormat, width, height,
- depth, fixedSampleLocations, memory, offset);
+ depth, fixedSampleLocations, memory, offset,
+ "glTexStorageMem3DMultisampleEXT");
}
void GLAPIENTRY
GLuint64 offset)
{
texturestorage_memory_ms(2, texture, samples, internalFormat, width, height,
- 1, fixedSampleLocations, memory, offset);
+ 1, fixedSampleLocations, memory, offset,
+ "glTextureStorageMem2DMultisampleEXT");
}
void GLAPIENTRY
GLuint64 offset)
{
texturestorage_memory_ms(3, texture, samples, internalFormat, width, height,
- depth, fixedSampleLocations, memory, offset);
+ depth, fixedSampleLocations, memory, offset,
+ "glTextureStorageMem3DMultisampleEXT");
}
void GLAPIENTRY
static void
texture_image_multisample(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
+ struct gl_memory_object *memObj,
GLenum target, GLsizei samples,
GLint internalformat, GLsizei width,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations,
- GLboolean immutable, const char *func)
+ GLboolean immutable, GLuint64 offset,
+ const char *func)
{
struct gl_texture_image *texImage;
GLboolean sizeOK, dimensionsOK, samplesOK;
samples, fixedsamplelocations);
if (width > 0 && height > 0 && depth > 0) {
- if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1,
- width, height, depth)) {
- /* tidy up the texture image state. strictly speaking,
- * we're allowed to just leave this in whatever state we
- * like, but being tidy is good.
- */
- _mesa_init_teximage_fields(ctx, texImage,
- 0, 0, 0, 0, internalformat, texFormat);
+ if (memObj) {
+ if (!ctx->Driver.SetTextureStorageForMemoryObject(ctx, texObj,
+ memObj, 1, width,
+ height, depth,
+ offset)) {
+
+ _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0,
+ internalformat, texFormat);
+ }
+ } else {
+ if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1,
+ width, height, depth)) {
+ /* tidy up the texture image state. strictly speaking,
+ * we're allowed to just leave this in whatever state we
+ * like, but being tidy is good.
+ */
+ _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0,
+ internalformat, texFormat);
+ }
}
}
if (!texObj)
return;
- texture_image_multisample(ctx, 2, texObj, target, samples,
+ texture_image_multisample(ctx, 2, texObj, NULL, target, samples,
internalformat, width, height, 1,
- fixedsamplelocations, GL_FALSE,
+ fixedsamplelocations, GL_FALSE, 0,
"glTexImage2DMultisample");
}
if (!texObj)
return;
- texture_image_multisample(ctx, 3, texObj, target, samples,
+ texture_image_multisample(ctx, 3, texObj, NULL, target, samples,
internalformat, width, height, depth,
- fixedsamplelocations, GL_FALSE,
+ fixedsamplelocations, GL_FALSE, 0,
"glTexImage3DMultisample");
}
if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
return;
- texture_image_multisample(ctx, 2, texObj, target, samples,
+ texture_image_multisample(ctx, 2, texObj, NULL, target, samples,
internalformat, width, height, 1,
- fixedsamplelocations, GL_TRUE,
+ fixedsamplelocations, GL_TRUE, 0,
"glTexStorage2DMultisample");
}
if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
return;
- texture_image_multisample(ctx, 3, texObj, target, samples,
+ texture_image_multisample(ctx, 3, texObj, NULL, target, samples,
internalformat, width, height, depth,
- fixedsamplelocations, GL_TRUE,
+ fixedsamplelocations, GL_TRUE, 0,
"glTexStorage3DMultisample");
}
if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
return;
- texture_image_multisample(ctx, 2, texObj, texObj->Target, samples,
- internalformat, width, height, 1,
- fixedsamplelocations, GL_TRUE,
+ texture_image_multisample(ctx, 2, texObj, NULL, texObj->Target,
+ samples, internalformat, width, height, 1,
+ fixedsamplelocations, GL_TRUE, 0,
"glTextureStorage2DMultisample");
}
if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
return;
- texture_image_multisample(ctx, 3, texObj, texObj->Target, samples,
+ texture_image_multisample(ctx, 3, texObj, NULL, texObj->Target, samples,
internalformat, width, height, depth,
- fixedsamplelocations, GL_TRUE,
+ fixedsamplelocations, GL_TRUE, 0,
"glTextureStorage3DMultisample");
}
+
+void
+_mesa_texture_storage_ms_memory(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_object *texObj,
+ struct gl_memory_object *memObj,
+ GLenum target, GLsizei samples,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint64 offset, const char* func)
+{
+ assert(memObj);
+
+ texture_image_multisample(ctx, dims, texObj, memObj, target, samples,
+ internalFormat, width, height, depth,
+ fixedSampleLocations, GL_TRUE, offset,
+ func);
+}