[Mesa-dev] [RFC PATCH 06/65] mesa: refuse to update tex parameters when a handle is allocated

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri May 19 16:52:11 UTC 2017


The ARB_bindless_texture spec says:

   "The ARB_bindless_texture spec says: "The error INVALID_OPERATION
    is generated by TexImage*, CopyTexImage*, CompressedTexImage*,
    TexBuffer*, TexParameter*, as well as other functions defined in
    terms of these, if the texture object to be modified is referenced
    by one or more texture or image handles."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/texparam.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 0156bbd275..c73cf8bf83 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1026,6 +1026,9 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
    if (!texObj)
       return;
 
+   if (texObj->HandleAllocated)
+      return;
+
    _mesa_texture_parameterf(ctx, texObj, pname, param, false);
 }
 
@@ -1039,6 +1042,9 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
    if (!texObj)
       return;
 
+   if (texObj->HandleAllocated)
+      return;
+
    _mesa_texture_parameterfv(ctx, texObj, pname, params, false);
 }
 
@@ -1052,6 +1058,9 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
    if (!texObj)
       return;
 
+   if (texObj->HandleAllocated)
+      return;
+
    _mesa_texture_parameteri(ctx, texObj, pname, param, false);
 }
 
@@ -1065,6 +1074,9 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
    if (!texObj)
       return;
 
+   if (texObj->HandleAllocated)
+      return;
+
    _mesa_texture_parameteriv(ctx, texObj, pname, params, false);
 }
 
@@ -1083,6 +1095,9 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
    if (!texObj)
       return;
 
+   if (texObj->HandleAllocated)
+      return;
+
    _mesa_texture_parameterIiv(ctx, texObj, pname, params, false);
 }
 
@@ -1101,6 +1116,9 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
    if (!texObj)
       return;
 
+   if (texObj->HandleAllocated)
+      return;
+
    _mesa_texture_parameterIuiv(ctx, texObj, pname, params, false);
 }
 
@@ -1118,6 +1136,19 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params)
       return;
    }
 
+   if (texObj->HandleAllocated) {
+      /* The ARB_bindless_texture spec says:
+       *
+       * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
+       *  CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
+       *  functions defined in terms of these, if the texture object to be
+       *  modified is referenced by one or more texture or image handles."
+       */
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTextureParameterfv(immutable texture)");
+      return;
+   }
+
    _mesa_texture_parameterfv(ctx, texObj, pname, params, true);
 }
 
@@ -1134,6 +1165,12 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
       return;
    }
 
+   if (texObj->HandleAllocated) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTextureParameterf(immutable texture)");
+      return;
+   }
+
    _mesa_texture_parameterf(ctx, texObj, pname, param, true);
 }
 
@@ -1150,6 +1187,12 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param)
       return;
    }
 
+   if (texObj->HandleAllocated) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTextureParameteri(immutable texture)");
+      return;
+   }
+
    _mesa_texture_parameteri(ctx, texObj, pname, param, true);
 }
 
@@ -1167,6 +1210,12 @@ _mesa_TextureParameteriv(GLuint texture, GLenum pname,
       return;
    }
 
+   if (texObj->HandleAllocated) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTextureParameteriv(immutable texture)");
+      return;
+   }
+
    _mesa_texture_parameteriv(ctx, texObj, pname, params, true);
 }
 
@@ -1185,6 +1234,12 @@ _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
       return;
    }
 
+   if (texObj->HandleAllocated) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTextureParameterIiv(immutable texture)");
+      return;
+   }
+
    _mesa_texture_parameterIiv(ctx, texObj, pname, params, true);
 }
 
@@ -1202,6 +1257,12 @@ _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
       return;
    }
 
+   if (texObj->HandleAllocated) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTextureParameterIuv(immutable texture)");
+      return;
+   }
+
    _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true);
 }
 
-- 
2.13.0



More information about the mesa-dev mailing list