Re: [Mesa-dev] [PATCH 07/24] mesa: hook up memory object multisamples tex(ture)storage api

2017-07-28 Thread Samuel Pitoiset

Reviewed-by: Samuel Pitoiset 

On 07/27/2017 03:08 PM, Timothy Arceri wrote:

From: Andres Rodriguez 

Signed-off-by: Andres Rodriguez 
Reviewed-by: Timothy Arceri 
---
  src/mesa/main/externalobjects.c | 52 
  src/mesa/main/teximage.c| 75 +
  src/mesa/main/teximage.h| 10 ++
  3 files changed, 109 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 25ed176aaa..82946121b3 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -275,23 +275,41 @@ texstorage_memory(GLuint dims, GLenum target, GLsizei 
levels,
  
 _mesa_texture_storage_memory(ctx, dims, texObj, memObj, target,

  levels, internalFormat,
  width, height, depth, offset, false);
  }
  
  static void

  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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
  
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, target, samples,

+   internalFormat, width, height, depth,
+   fixedSampleLocations, offset, func);
  }
  
  /**

   * Helper used by _mesa_TextureStorageMem1/2/3DEXT().
   */
  static void
  texturestorage_memory(GLuint dims, GLuint texture, GLsizei levels,
GLenum internalFormat, GLsizei width, GLsizei height,
GLsizei depth, GLuint memory, GLuint64 offset,
const char *func)
@@ -314,23 +332,41 @@ texturestorage_memory(GLuint dims, GLuint texture, 
GLsizei levels,
  
 _mesa_texture_storage_memory(ctx, dims, texObj, memObj, texObj->Target,

  levels, internalFormat,
  width, height, depth, offset, true);
  }
  
  static void

  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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
  
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, texObj->Target,

+   samples, internalFormat, width, height,
+   depth, fixedSampleLocations, offset, func);
  }
  
  void GLAPIENTRY

  _mesa_TexStorageMem2DEXT(GLenum target,
   GLsizei levels,
   GLenum internalFormat,
   GLsizei width,
   GLsizei height,
   GLuint memory,
   GLuint64 offset)
@@ -343,21 +379,22 @@ void GLAPIENTRY
  _mesa_TexStorageMem2DMultisampleEXT(GLenum target,
  GLsizei samples,
  GLenum internalFormat,
  GLsizei width,
  GLsizei height,
  GLboolean fixedSampleLocations,
  GLuint memory,
  GLuint64 offset)
  {
 texstorage_memory_ms(2, target, samples, internalFormat, width, height, 1,
-fixedSampleLocations, memory, offset);
+fixedSampleLocations, memory, offset,
+"glTexStorageMem2DMultisampleEXT");
  }
  
  void GLAPIENTRY

  _mesa_TexStorageMem3DEXT(GLenum target,
   GLsizei levels,
   GLenum internalFormat,
   GLsizei width,
   GLsizei height,
   GLsizei depth,
   GLuint memory,
@@ -372,21 +409,22 @@ _mesa_TexStorageMem3DMultisampleEXT(GLenum target,
 

[Mesa-dev] [PATCH 07/24] mesa: hook up memory object multisamples tex(ture)storage api

2017-07-27 Thread Timothy Arceri
From: Andres Rodriguez 

Signed-off-by: Andres Rodriguez 
Reviewed-by: Timothy Arceri 
---
 src/mesa/main/externalobjects.c | 52 
 src/mesa/main/teximage.c| 75 +
 src/mesa/main/teximage.h| 10 ++
 3 files changed, 109 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 25ed176aaa..82946121b3 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -275,23 +275,41 @@ texstorage_memory(GLuint dims, GLenum target, GLsizei 
levels,
 
_mesa_texture_storage_memory(ctx, dims, texObj, memObj, target,
 levels, internalFormat,
 width, height, depth, offset, false);
 }
 
 static void
 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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
 
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, target, samples,
+   internalFormat, width, height, depth,
+   fixedSampleLocations, offset, func);
 }
 
 /**
  * Helper used by _mesa_TextureStorageMem1/2/3DEXT().
  */
 static void
 texturestorage_memory(GLuint dims, GLuint texture, GLsizei levels,
   GLenum internalFormat, GLsizei width, GLsizei height,
   GLsizei depth, GLuint memory, GLuint64 offset,
   const char *func)
@@ -314,23 +332,41 @@ texturestorage_memory(GLuint dims, GLuint texture, 
GLsizei levels,
 
_mesa_texture_storage_memory(ctx, dims, texObj, memObj, texObj->Target,
 levels, internalFormat,
 width, height, depth, offset, true);
 }
 
 static void
 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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
 
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, texObj->Target,
+   samples, internalFormat, width, height,
+   depth, fixedSampleLocations, offset, func);
 }
 
 void GLAPIENTRY
 _mesa_TexStorageMem2DEXT(GLenum target,
  GLsizei levels,
  GLenum internalFormat,
  GLsizei width,
  GLsizei height,
  GLuint memory,
  GLuint64 offset)
@@ -343,21 +379,22 @@ void GLAPIENTRY
 _mesa_TexStorageMem2DMultisampleEXT(GLenum target,
 GLsizei samples,
 GLenum internalFormat,
 GLsizei width,
 GLsizei height,
 GLboolean fixedSampleLocations,
 GLuint memory,
 GLuint64 offset)
 {
texstorage_memory_ms(2, target, samples, internalFormat, width, height, 1,
-fixedSampleLocations, memory, offset);
+fixedSampleLocations, memory, offset,
+"glTexStorageMem2DMultisampleEXT");
 }
 
 void GLAPIENTRY
 _mesa_TexStorageMem3DEXT(GLenum target,
  GLsizei levels,
  GLenum internalFormat,
  GLsizei width,
  GLsizei height,
  GLsizei depth,
  GLuint memory,
@@ -372,21 +409,22 @@ _mesa_TexStorageMem3DMultisampleEXT(GLenum target,
 GLsizei samples,
 GLenum internalFormat,
 GLsizei width,
   

Re: [Mesa-dev] [PATCH 07/24] mesa: hook up memory object multisamples tex(ture)storage api

2017-07-26 Thread Samuel Pitoiset



On 07/26/2017 01:46 PM, Timothy Arceri wrote:

From: Andres Rodriguez 

Signed-off-by: Andres Rodriguez 
Reviewed-by: Timothy Arceri 
---
  src/mesa/main/externalobjects.c | 52 
  src/mesa/main/teximage.c| 75 +
  src/mesa/main/teximage.h| 10 ++
  3 files changed, 109 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 879c2bb..1c6ba18 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -280,9 +280,27 @@ static void
  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 = _mesa_lookup_memory_object(ctx, memory);


See my comment on the previous patch (this applies everywhere this 
function is called anyway).



+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
  
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, target, samples,

+   internalFormat, width, height, depth,
+   fixedSampleLocations, offset, func);
  }
  
  /**

@@ -319,9 +337,27 @@ static void
  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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
  
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, texObj->Target,

+   samples, internalFormat, width, height,
+   depth, fixedSampleLocations, offset, func);
  }
  
  void GLAPIENTRY

@@ -348,7 +384,8 @@ _mesa_TexStorageMem2DMultisampleEXT(GLenum target,
  GLuint64 offset)
  {
 texstorage_memory_ms(2, target, samples, internalFormat, width, height, 1,
-fixedSampleLocations, memory, offset);
+fixedSampleLocations, memory, offset,
+"glTexStorageMem2DMultisampleEXT");
  }
  
  void GLAPIENTRY

@@ -377,7 +414,8 @@ _mesa_TexStorageMem3DMultisampleEXT(GLenum target,
  GLuint64 offset)
  {
 texstorage_memory_ms(3, target, samples, internalFormat, width, height,
-depth, fixedSampleLocations, memory, offset);
+depth, fixedSampleLocations, memory, offset,
+"glTexStorageMem3DMultisampleEXT");
  }
  
  void GLAPIENTRY

@@ -404,7 +442,8 @@ _mesa_TextureStorageMem2DMultisampleEXT(GLuint texture,
  GLuint64 offset)
  {
 texturestorage_memory_ms(2, texture, samples, internalFormat, width, 
height,
-1, fixedSampleLocations, memory, offset);
+1, fixedSampleLocations, memory, offset,
+"glTextureStorageMem2DMultisampleEXT");
  }
  
  void GLAPIENTRY

@@ -433,7 +472,8 @@ _mesa_TextureStorageMem3DMultisampleEXT(GLuint texture,
  GLuint64 offset)
  {
 texturestorage_memory_ms(3, texture, samples, internalFormat, width, 
height,
-depth, fixedSampleLocations, memory, offset);
+depth, fixedSampleLocations, memory, offset,
+"glTextureStorageMem3DMultisampleEXT");
  }
  
  void GLAPIENTRY

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 1de40b0..868abcc 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5651,11 +5651,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, GLs

[Mesa-dev] [PATCH 07/24] mesa: hook up memory object multisamples tex(ture)storage api

2017-07-26 Thread Timothy Arceri
From: Andres Rodriguez 

Signed-off-by: Andres Rodriguez 
Reviewed-by: Timothy Arceri 
---
 src/mesa/main/externalobjects.c | 52 
 src/mesa/main/teximage.c| 75 +
 src/mesa/main/teximage.h| 10 ++
 3 files changed, 109 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 879c2bb..1c6ba18 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -280,9 +280,27 @@ static void
 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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
 
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, target, samples,
+   internalFormat, width, height, depth,
+   fixedSampleLocations, offset, func);
 }
 
 /**
@@ -319,9 +337,27 @@ static void
 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 = _mesa_lookup_memory_object(ctx, memory);
+   if (!memObj)
+  return;
+
+   if (texstorage_validate(ctx, memObj, func))
+  return;
 
+   _mesa_texture_storage_ms_memory(ctx, dims, texObj, memObj, texObj->Target,
+   samples, internalFormat, width, height,
+   depth, fixedSampleLocations, offset, func);
 }
 
 void GLAPIENTRY
@@ -348,7 +384,8 @@ _mesa_TexStorageMem2DMultisampleEXT(GLenum target,
 GLuint64 offset)
 {
texstorage_memory_ms(2, target, samples, internalFormat, width, height, 1,
-fixedSampleLocations, memory, offset);
+fixedSampleLocations, memory, offset,
+"glTexStorageMem2DMultisampleEXT");
 }
 
 void GLAPIENTRY
@@ -377,7 +414,8 @@ _mesa_TexStorageMem3DMultisampleEXT(GLenum target,
 GLuint64 offset)
 {
texstorage_memory_ms(3, target, samples, internalFormat, width, height,
-depth, fixedSampleLocations, memory, offset);
+depth, fixedSampleLocations, memory, offset,
+"glTexStorageMem3DMultisampleEXT");
 }
 
 void GLAPIENTRY
@@ -404,7 +442,8 @@ _mesa_TextureStorageMem2DMultisampleEXT(GLuint texture,
 GLuint64 offset)
 {
texturestorage_memory_ms(2, texture, samples, internalFormat, width, height,
-1, fixedSampleLocations, memory, offset);
+1, fixedSampleLocations, memory, offset,
+"glTextureStorageMem2DMultisampleEXT");
 }
 
 void GLAPIENTRY
@@ -433,7 +472,8 @@ _mesa_TextureStorageMem3DMultisampleEXT(GLuint texture,
 GLuint64 offset)
 {
texturestorage_memory_ms(3, texture, samples, internalFormat, width, height,
-depth, fixedSampleLocations, memory, offset);
+depth, fixedSampleLocations, memory, offset,
+"glTextureStorageMem3DMultisampleEXT");
 }
 
 void GLAPIENTRY
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 1de40b0..868abcc 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5651,11 +5651,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)
+