summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorAndres Rodriguez <[email protected]>2017-07-12 18:45:12 -0400
committerTimothy Arceri <[email protected]>2017-08-06 12:42:06 +1000
commitd0aac1b0aaef483c4bb8601e941438dfdb37b93f (patch)
tree9b17e5536a38c783d1dfd81ac45abd5caad1f292 /src/mesa/main/teximage.c
parentfc790c50ccb060cf8d07a5be59d8b3868a627784 (diff)
mesa: hook up memory object multisamples tex(ture)storage api
V2 (Timothy): - error check memory == 0 before lookup Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c75
1 files changed, 53 insertions, 22 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 04d0d6f911d..7bcd734204c 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5718,11 +5718,13 @@ check_multisample_target(GLuint dims, GLenum target, bool dsa)
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;
@@ -5859,14 +5861,25 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
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);
+ }
}
}
@@ -5893,9 +5906,9 @@ _mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
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");
}
@@ -5913,9 +5926,9 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei samples,
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");
}
@@ -5949,9 +5962,9 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
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");
}
@@ -5971,9 +5984,9 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples,
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");
}
@@ -5994,9 +6007,9 @@ _mesa_TextureStorage2DMultisample(GLuint texture, GLsizei samples,
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");
}
@@ -6018,8 +6031,26 @@ _mesa_TextureStorage3DMultisample(GLuint texture, GLsizei samples,
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);
+}