[Mesa-dev] [PATCH 03/11] glapi/glx: skip that which is marked for skipping

Ian Romanick idr at freedesktop.org
Mon Mar 28 18:14:56 UTC 2016


I am confused by this patch.  Mesa drivers doesn't support
GL_NV_vertex_program, but the library still supports the protocol for it
for compatibility with other server implementations.
src/glx/glxextensions.c still tries to advertise support.  I'm guess
that these aren't getting stuffed in the dispatch table, so something is
already broken.

On 03/24/2016 11:09 AM, Adam Jackson wrote:
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/glx/indirect_vertex_array.c   |  39 --------
>  src/glx/indirect_vertex_program.c | 202 --------------------------------------
>  src/glx/tests/indirect_api.cpp    |   2 -
>  src/mapi/glapi/gen/glX_XML.py     |   6 +-
>  4 files changed, 4 insertions(+), 245 deletions(-)
> 
> diff --git a/src/glx/indirect_vertex_array.c b/src/glx/indirect_vertex_array.c
> index 2bf2ff1..1fb5137 100644
> --- a/src/glx/indirect_vertex_array.c
> +++ b/src/glx/indirect_vertex_array.c
> @@ -1691,45 +1691,6 @@ __indirect_glVertexAttribPointer(GLuint index, GLint size,
>  }
>  
>  
> -/**
> - * I don't have 100% confidence that this is correct.  The different rules
> - * about whether or not generic vertex attributes alias "classic" vertex
> - * attributes (i.e., attrib1 ?= primary color) between ARB_vertex_program,
> - * ARB_vertex_shader, and NV_vertex_program are a bit confusing.  My
> - * feeling is that the client-side doesn't have to worry about it.  The
> - * client just sends all the data to the server and lets the server deal
> - * with it.
> - */
> -void
> -__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
> -                                   GLenum type, GLsizei stride,
> -                                   const GLvoid * pointer)
> -{
> -   struct glx_context *gc = __glXGetCurrentContext();
> -   GLboolean normalized = GL_FALSE;
> -
> -
> -   switch (type) {
> -   case GL_UNSIGNED_BYTE:
> -      if (size != 4) {
> -         __glXSetError(gc, GL_INVALID_VALUE);
> -         return;
> -      }
> -      normalized = GL_TRUE;
> -
> -   case GL_SHORT:
> -   case GL_FLOAT:
> -   case GL_DOUBLE:
> -      __indirect_glVertexAttribPointer(index, size, type,
> -                                          normalized, stride, pointer);
> -      return;
> -   default:
> -      __glXSetError(gc, GL_INVALID_ENUM);
> -      return;
> -   }
> -}
> -
> -
>  void
>  __indirect_glClientActiveTexture(GLenum texture)
>  {
> diff --git a/src/glx/indirect_vertex_program.c b/src/glx/indirect_vertex_program.c
> index 54a936d..e3f57c5 100644
> --- a/src/glx/indirect_vertex_program.c
> +++ b/src/glx/indirect_vertex_program.c
> @@ -35,33 +35,6 @@
>  #endif
>  
>  static void
> -do_vertex_attrib_enable(GLuint index, GLboolean val)
> -{
> -   struct glx_context *gc = __glXGetCurrentContext();
> -   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
> -
> -   if (!__glXSetArrayEnable(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
> -                            index, val)) {
> -      __glXSetError(gc, GL_INVALID_ENUM);
> -   }
> -}
> -
> -
> -void
> -__indirect_glEnableVertexAttribArray(GLuint index)
> -{
> -   do_vertex_attrib_enable(index, GL_TRUE);
> -}
> -
> -
> -void
> -__indirect_glDisableVertexAttribArray(GLuint index)
> -{
> -   do_vertex_attrib_enable(index, GL_FALSE);
> -}
> -
> -
> -static void
>  get_parameter(unsigned opcode, unsigned size, GLenum target, GLuint index,
>                void *params)
>  {
> @@ -116,178 +89,3 @@ __indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index,
>  {
>     get_parameter(1306, 8, target, index, params);
>  }
> -
> -
> -void
> -__indirect_glGetVertexAttribPointerv(GLuint index, GLenum pname,
> -                                       GLvoid ** pointer)
> -{
> -   struct glx_context *const gc = __glXGetCurrentContext();
> -   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
> -
> -   if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
> -      __glXSetError(gc, GL_INVALID_ENUM);
> -   }
> -
> -   if (!__glXGetArrayPointer(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
> -                             index, pointer)) {
> -      __glXSetError(gc, GL_INVALID_VALUE);
> -   }
> -}
> -
> -
> -/**
> - * Get the selected attribute from the vertex array state vector.
> - * 
> - * \returns
> - * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
> - */
> -static GLboolean
> -get_attrib_array_data(__GLXattribute * state, GLuint index, GLenum cap,
> -                      GLintptr * data)
> -{
> -   GLboolean retval = GL_FALSE;
> -   const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
> -
> -   switch (cap) {
> -   case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
> -      retval = __glXGetArrayEnable(state, attrib, index, data);
> -      break;
> -
> -   case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
> -      retval = __glXGetArraySize(state, attrib, index, data);
> -      break;
> -
> -   case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
> -      retval = __glXGetArrayStride(state, attrib, index, data);
> -      break;
> -
> -   case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
> -      retval = __glXGetArrayType(state, attrib, index, data);
> -      break;
> -
> -   case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
> -      retval = __glXGetArrayNormalized(state, attrib, index, data);
> -      break;
> -   }
> -
> -
> -   return retval;
> -}
> -
> -
> -static void
> -get_vertex_attrib(struct glx_context * gc, unsigned vop,
> -                  GLuint index, GLenum pname, xReply * reply)
> -{
> -   Display *const dpy = gc->currentDpy;
> -   GLubyte *const pc = __glXSetupVendorRequest(gc,
> -                                               X_GLXVendorPrivateWithReply,
> -                                               vop, 8);
> -
> -   *((uint32_t *) (pc + 0)) = index;
> -   *((uint32_t *) (pc + 4)) = pname;
> -
> -   (void) _XReply(dpy, reply, 0, False);
> -}
> -
> -
> -void
> -__indirect_glGetVertexAttribiv(GLuint index, GLenum pname, GLint * params)
> -{
> -   struct glx_context *const gc = __glXGetCurrentContext();
> -   Display *const dpy = gc->currentDpy;
> -   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
> -   xGLXSingleReply reply;
> -
> -
> -   get_vertex_attrib(gc, 1303, index, pname, (xReply *) & reply);
> -
> -   if (reply.size != 0) {
> -      GLintptr data;
> -
> -
> -      if (get_attrib_array_data(state, index, pname, &data)) {
> -         *params = (GLint) data;
> -      }
> -      else {
> -         if (reply.size == 1) {
> -            *params = (GLint) reply.pad3;
> -         }
> -         else {
> -            _XRead(dpy, (void *) params, 4 * reply.size);
> -         }
> -      }
> -   }
> -
> -   UnlockDisplay(dpy);
> -   SyncHandle();
> -}
> -
> -
> -void
> -__indirect_glGetVertexAttribfv(GLuint index, GLenum pname,
> -                                  GLfloat * params)
> -{
> -   struct glx_context *const gc = __glXGetCurrentContext();
> -   Display *const dpy = gc->currentDpy;
> -   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
> -   xGLXSingleReply reply;
> -
> -
> -   get_vertex_attrib(gc, 1302, index, pname, (xReply *) & reply);
> -
> -   if (reply.size != 0) {
> -      GLintptr data;
> -
> -
> -      if (get_attrib_array_data(state, index, pname, &data)) {
> -         *params = (GLfloat) data;
> -      }
> -      else {
> -         if (reply.size == 1) {
> -            (void) memcpy(params, &reply.pad3, sizeof(GLfloat));
> -         }
> -         else {
> -            _XRead(dpy, (void *) params, 4 * reply.size);
> -         }
> -      }
> -   }
> -
> -   UnlockDisplay(dpy);
> -   SyncHandle();
> -}
> -
> -
> -void
> -__indirect_glGetVertexAttribdv(GLuint index, GLenum pname,
> -                                  GLdouble * params)
> -{
> -   struct glx_context *const gc = __glXGetCurrentContext();
> -   Display *const dpy = gc->currentDpy;
> -   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
> -   xGLXSingleReply reply;
> -
> -
> -   get_vertex_attrib(gc, 1301, index, pname, (xReply *) & reply);
> -
> -   if (reply.size != 0) {
> -      GLintptr data;
> -
> -
> -      if (get_attrib_array_data(state, index, pname, &data)) {
> -         *params = (GLdouble) data;
> -      }
> -      else {
> -         if (reply.size == 1) {
> -            (void) memcpy(params, &reply.pad3, sizeof(GLdouble));
> -         }
> -         else {
> -            _XRead(dpy, (void *) params, 8 * reply.size);
> -         }
> -      }
> -   }
> -
> -   UnlockDisplay(dpy);
> -   SyncHandle();
> -}
> diff --git a/src/glx/tests/indirect_api.cpp b/src/glx/tests/indirect_api.cpp
> index 34304a1..39fd610 100644
> --- a/src/glx/tests/indirect_api.cpp
> +++ b/src/glx/tests/indirect_api.cpp
> @@ -657,7 +657,6 @@ void __indirect_glVertexAttrib4sNV(void) { }
>  void __indirect_glVertexAttrib4svNV(void) { }
>  void __indirect_glVertexAttrib4ubNV(void) { }
>  void __indirect_glVertexAttrib4ubvNV(void) { }
> -void __indirect_glVertexAttribPointerNV(void) { }
>  void __indirect_glVertexAttribs1dvNV(void) { }
>  void __indirect_glVertexAttribs1fvNV(void) { }
>  void __indirect_glVertexAttribs1svNV(void) { }
> @@ -1444,7 +1443,6 @@ TEST_F(IndirectAPI, NV_vertex_program)
>     EXPECT_EQ((_glapi_proc) __indirect_glVertexAttrib4svNV, table[_glapi_get_proc_offset("glVertexAttrib4svNV")]);
>     EXPECT_EQ((_glapi_proc) __indirect_glVertexAttrib4ubNV, table[_glapi_get_proc_offset("glVertexAttrib4ubNV")]);
>     EXPECT_EQ((_glapi_proc) __indirect_glVertexAttrib4ubvNV, table[_glapi_get_proc_offset("glVertexAttrib4ubvNV")]);
> -   EXPECT_EQ((_glapi_proc) __indirect_glVertexAttribPointerNV, table[_glapi_get_proc_offset("glVertexAttribPointerNV")]);
>     EXPECT_EQ((_glapi_proc) __indirect_glVertexAttribs1dvNV, table[_glapi_get_proc_offset("glVertexAttribs1dvNV")]);
>     EXPECT_EQ((_glapi_proc) __indirect_glVertexAttribs1fvNV, table[_glapi_get_proc_offset("glVertexAttribs1fvNV")]);
>     EXPECT_EQ((_glapi_proc) __indirect_glVertexAttribs1svNV, table[_glapi_get_proc_offset("glVertexAttribs1svNV")]);
> diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py
> index 12ff291..166dbc1 100644
> --- a/src/mapi/glapi/gen/glX_XML.py
> +++ b/src/mapi/glapi/gen/glX_XML.py
> @@ -97,14 +97,16 @@ class glx_function(gl_XML.gl_function):
>  
>          self.server_handcode = 0
>          self.client_handcode = 0
> -        self.ignore = 0
>  
>          self.count_parameter_list = []
>          self.counter_list = []
>          self.parameters_by_name = {}
>          self.offsets_calculated = 0
>  
> +        self.ignore = 0
>          gl_XML.gl_function.__init__(self, element, context)
> +        self.ignore = self.ignore or self.exec_flavor == 'skip'
> +
>          return
>  
>  
> @@ -168,7 +170,7 @@ class glx_function(gl_XML.gl_function):
>                  else:
>                      raise RuntimeError('Invalid handcode mode "%s" in function "%s".' % (handcode, self.name))
>  
> -                self.ignore               = gl_XML.is_attr_true( child, 'ignore' )
> +                self.ignore               = self.ignore or gl_XML.is_attr_true( child, 'ignore' )
>                  self.can_be_large         = gl_XML.is_attr_true( child, 'large' )
>                  self.glx_doubles_in_order = gl_XML.is_attr_true( child, 'doubles_in_order' )
>                  self.reply_always_array   = gl_XML.is_attr_true( child, 'always_array' )
> 



More information about the mesa-dev mailing list