[Mesa-dev] [PATCH] mesa: add APPLE_vertex_array_object stubs

Timothy Arceri tarceri at itsqueeze.com
Mon May 22 23:01:26 UTC 2017


On 23/05/17 03:26, Ian Romanick wrote:
> WTF?  I gave review feedback on IRC, and you said you were going to send
> a different patch... yet this patch landed.  If you're not going to take
> review feedback, why do you ask for it
idr> tarceri: You should be able to just put the functions back in the 
XML and 'exec="skip"' to the functions.
<idr> tarceri: That will let libGL have entry points, but the drivers 
don't need to know anything about them.
idr> The real test is to see if a *_dri.so built before your original 
patch loads on a libGL built with later patches.

As I mentioned in the other thread I took your advice and tested an old 
branch but could not get it to fail. Given that I couldn't reproduce the 
failure, and you seem to be very busy (which sometimes results in Mesa 
inquiries to you going missing) I decided to push this version before I 
forgot about the problem.

Maybe I should have just sent the other patch and waited on feedback but 
it honestly didn't seem like a big deal.

> 
> On 05/18/2017 07:50 PM, Timothy Arceri wrote:
>> APPLE_vertex_array_object support was removed in 7927d0378fc7.
>> However it turns out we can't remove the functions because this
>> can cause issues when libglapi is used together with DRI1 drivers
>> which were branched off from master a few years ago.
>> ---
>>   src/mapi/glapi/gen/APPLE_vertex_array_object.xml | 27 ++++++++++++++++++++++++
>>   src/mapi/glapi/gen/Makefile.am                   |  1 +
>>   src/mapi/glapi/gen/gl_API.xml                    |  2 +-
>>   src/mapi/glapi/tests/check_table.cpp             |  2 ++
>>   src/mesa/main/arrayobj.c                         | 16 ++++++++++++++
>>   src/mesa/main/arrayobj.h                         |  4 ++++
>>   src/mesa/main/tests/dispatch_sanity.cpp          |  2 ++
>>   7 files changed, 53 insertions(+), 1 deletion(-)
>>   create mode 100644 src/mapi/glapi/gen/APPLE_vertex_array_object.xml
>>
>> diff --git a/src/mapi/glapi/gen/APPLE_vertex_array_object.xml b/src/mapi/glapi/gen/APPLE_vertex_array_object.xml
>> new file mode 100644
>> index 0000000..7312f9b
>> --- /dev/null
>> +++ b/src/mapi/glapi/gen/APPLE_vertex_array_object.xml
>> @@ -0,0 +1,27 @@
>> +<?xml version="1.0"?>
>> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
>> +
>> +<OpenGLAPI>
>> +<category name="GL_APPLE_vertex_array_object" number="273">
>> +    <enum name="VERTEX_ARRAY_BINDING_APPLE"               value="0x85B5"/>
>> +
>> +    <function name="BindVertexArrayAPPLE" deprecated="3.1">
>> +        <param name="array" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="DeleteVertexArraysAPPLE" alias="DeleteVertexArrays">
>> +        <param name="n" type="GLsizei"/>
>> +	<param name="arrays" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="GenVertexArraysAPPLE" deprecated="3.1">
>> +        <param name="n" type="GLsizei"/>
>> +	<param name="arrays" type="GLuint *" count="n" output="true"/>
>> +    </function>
>> +
>> +    <function name="IsVertexArrayAPPLE" alias="IsVertexArray">
>> +        <param name="array" type="GLuint"/>
>> +	<return type="GLboolean"/>
>> +    </function>
>> +</category>
>> +</OpenGLAPI>
>> diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
>> index ecd1c71..33139bd 100644
>> --- a/src/mapi/glapi/gen/Makefile.am
>> +++ b/src/mapi/glapi/gen/Makefile.am
>> @@ -182,20 +182,21 @@ API_XML = \
>>   	ARB_texture_view.xml \
>>   	ARB_uniform_buffer_object.xml \
>>   	ARB_vertex_array_object.xml \
>>   	ARB_vertex_attrib_64bit.xml \
>>   	ARB_vertex_attrib_binding.xml \
>>   	ARB_viewport_array.xml \
>>   	AMD_draw_buffers_blend.xml \
>>   	AMD_performance_monitor.xml \
>>   	ARB_vertex_type_2_10_10_10_rev.xml \
>>   	APPLE_object_purgeable.xml \
>> +	APPLE_vertex_array_object.xml \
>>   	EXT_draw_buffers2.xml \
>>   	EXT_framebuffer_object.xml \
>>   	EXT_gpu_shader4.xml \
>>   	EXT_packed_depth_stencil.xml \
>>   	EXT_provoking_vertex.xml \
>>   	EXT_separate_shader_objects.xml \
>>   	EXT_texture_array.xml \
>>   	EXT_texture_integer.xml \
>>   	EXT_transform_feedback.xml \
>>   	EXT_window_rectangles.xml \
>> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
>> index 762fb5a..630d6b8 100644
>> --- a/src/mapi/glapi/gen/gl_API.xml
>> +++ b/src/mapi/glapi/gen/gl_API.xml
>> @@ -12524,21 +12524,21 @@
>>           <size name="Get" mode="get"/>
>>       </enum>
>>   
>>       <function name="ActiveStencilFaceEXT" deprecated="3.1">
>>           <param name="face" type="GLenum"/>
>>           <glx rop="4220"/>
>>       </function>
>>   </category>
>>   
>>   <xi:include href="APPLE_object_purgeable.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> -<!-- Extension number 273 obsolete APPLE_vertex_array_object. -->
>> +<xi:include href="APPLE_vertex_array_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>>   
>>   <category name="GL_APPLE_ycbcr_422" number="275">
>>       <enum name="YCBCR_422_APPLE"                          value="0x85B9"/>
>>       <enum name="UNSIGNED_SHORT_8_8_APPLE"                 value="0x85BA"/>
>>       <enum name="UNSIGNED_SHORT_8_8_REV_APPLE"             value="0x85BB"/>
>>   </category>
>>   
>>   <category name="GL_S3_s3tc" number="276">
>>       <enum name="RGB_S3TC"                                 value="0x83A0"/>
>>       <enum name="RGB4_S3TC"                                value="0x83A1"/>
>> diff --git a/src/mapi/glapi/tests/check_table.cpp b/src/mapi/glapi/tests/check_table.cpp
>> index a1041bce..09bf4f3 100644
>> --- a/src/mapi/glapi/tests/check_table.cpp
>> +++ b/src/mapi/glapi/tests/check_table.cpp
>> @@ -1397,21 +1397,23 @@ const struct name_offset known_dispatch[] = {
>>      { "glColorFragmentOp3ATI", _O(ColorFragmentOp3ATI) },
>>      { "glDeleteFragmentShaderATI", _O(DeleteFragmentShaderATI) },
>>      { "glEndFragmentShaderATI", _O(EndFragmentShaderATI) },
>>      { "glGenFragmentShadersATI", _O(GenFragmentShadersATI) },
>>      { "glPassTexCoordATI", _O(PassTexCoordATI) },
>>      { "glSampleMapATI", _O(SampleMapATI) },
>>      { "glSetFragmentShaderConstantATI", _O(SetFragmentShaderConstantATI) },
>>      { "glPointParameteri", _O(PointParameteri) },
>>      { "glPointParameteriv", _O(PointParameteriv) },
>>      { "glActiveStencilFaceEXT", _O(ActiveStencilFaceEXT) },
>> +   { "glBindVertexArrayAPPLE", _O(BindVertexArrayAPPLE) },
>>      { "glDeleteVertexArrays", _O(DeleteVertexArrays) },
>> +   { "glGenVertexArraysAPPLE", _O(GenVertexArraysAPPLE) },
>>      { "glIsVertexArray", _O(IsVertexArray) },
>>      { "glGetProgramNamedParameterdvNV", _O(GetProgramNamedParameterdvNV) },
>>      { "glGetProgramNamedParameterfvNV", _O(GetProgramNamedParameterfvNV) },
>>      { "glProgramNamedParameter4dNV", _O(ProgramNamedParameter4dNV) },
>>      { "glProgramNamedParameter4dvNV", _O(ProgramNamedParameter4dvNV) },
>>      { "glProgramNamedParameter4fNV", _O(ProgramNamedParameter4fNV) },
>>      { "glProgramNamedParameter4fvNV", _O(ProgramNamedParameter4fvNV) },
>>      { "glPrimitiveRestartIndex", _O(PrimitiveRestartIndex) },
>>      { "glPrimitiveRestartNV", _O(PrimitiveRestartNV) },
>>      { "glDepthBoundsEXT", _O(DepthBoundsEXT) },
>> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
>> index 82c00fb..b986229 100644
>> --- a/src/mesa/main/arrayobj.c
>> +++ b/src/mesa/main/arrayobj.c
>> @@ -466,20 +466,28 @@ _mesa_BindVertexArray( GLuint id )
>>          */
>>         ctx->Array._DrawArrays = NULL;
>>         ctx->Array.DrawMethod = DRAW_NONE;
>>      }
>>   
>>      ctx->NewState |= _NEW_ARRAY;
>>      _mesa_reference_vao(ctx, &ctx->Array.VAO, newObj);
>>   }
>>   
>>   
>> +void GLAPIENTRY
>> +_mesa_BindVertexArrayAPPLE(GLuint id)
>> +{
>> +   GET_CURRENT_CONTEXT(ctx);
>> +   _mesa_problem(ctx, "APPLE_vertex_array_object is not supported!");
>> +}
>> +
>> +
>>   /**
>>    * Delete a set of array objects.
>>    *
>>    * \param n      Number of array objects to delete.
>>    * \param ids    Array of \c n array object IDs.
>>    */
>>   void GLAPIENTRY
>>   _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
>>   {
>>      GET_CURRENT_CONTEXT(ctx);
>> @@ -572,20 +580,28 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
>>    * All arrays will be required to live in VBOs.
>>    */
>>   void GLAPIENTRY
>>   _mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
>>   {
>>      GET_CURRENT_CONTEXT(ctx);
>>      gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArrays");
>>   }
>>   
>>   
>> +void GLAPIENTRY
>> +_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
>> +{
>> +   GET_CURRENT_CONTEXT(ctx);
>> +   _mesa_problem(ctx, "APPLE_vertex_array_object is not supported!");
>> +}
>> +
>> +
>>   /**
>>    * ARB_direct_state_access
>>    * Generates ID's and creates the array objects.
>>    */
>>   void GLAPIENTRY
>>   _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays)
>>   {
>>      GET_CURRENT_CONTEXT(ctx);
>>      gen_vertex_arrays(ctx, n, arrays, true, "glCreateVertexArrays");
>>   }
>> diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
>> index 1794968..097027b 100644
>> --- a/src/mesa/main/arrayobj.h
>> +++ b/src/mesa/main/arrayobj.h
>> @@ -89,23 +89,27 @@ _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao);
>>   extern bool
>>   _mesa_all_buffers_are_unmapped(const struct gl_vertex_array_object *vao);
>>   
>>   /*
>>    * API functions
>>    */
>>   
>>   
>>   void GLAPIENTRY _mesa_BindVertexArray( GLuint id );
>>   
>> +void GLAPIENTRY _mesa_BindVertexArrayAPPLE(GLuint id);
>> +
>>   void GLAPIENTRY _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids);
>>   
>>   void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
>>   
>> +void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
>> +
>>   void GLAPIENTRY _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays);
>>   
>>   GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id );
>>   
>>   void GLAPIENTRY _mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer);
>>   
>>   void GLAPIENTRY _mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);
>>   
>>   #endif /* ARRAYOBJ_H */
>> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
>> index b33043e..12a9ee7 100644
>> --- a/src/mesa/main/tests/dispatch_sanity.cpp
>> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
>> @@ -962,20 +962,22 @@ const struct function common_desktop_functions_possible[] = {
>>      { "glBlendBarrierKHR", 20, -1 },
>>   
>>      /* GL_ARB_sparse_buffer */
>>      { "glBufferPageCommitmentARB", 43, -1 },
>>      { "glNamedBufferPageCommitmentARB", 43, -1 },
>>   
>>      { NULL, 0, -1 }
>>   };
>>   
>>   const struct function gl_compatibility_functions_possible[] = {
>> +   { "glBindVertexArrayAPPLE", 10, -1 },
>> +   { "glGenVertexArraysAPPLE", 10, -1 },
>>      { "glBindRenderbufferEXT", 10, -1 },
>>      { "glBindFramebufferEXT", 10, -1 },
>>      { "glNewList", 10, _gloffset_NewList },
>>      { "glEndList", 10, _gloffset_EndList },
>>      { "glCallList", 10, _gloffset_CallList },
>>      { "glCallLists", 10, _gloffset_CallLists },
>>      { "glDeleteLists", 10, _gloffset_DeleteLists },
>>      { "glGenLists", 10, _gloffset_GenLists },
>>      { "glListBase", 10, _gloffset_ListBase },
>>      { "glBegin", 10, _gloffset_Begin },
>>
> 


More information about the mesa-dev mailing list