[Mesa-dev] [PATCH 3/4] mesa: Remove deleteFlag pattern.

Timothy Arceri tarceri at itsqueeze.com
Fri Apr 21 09:43:31 UTC 2017



On 21/04/17 17:54, Samuel Pitoiset wrote:
> The commit message looks a bit vague because this deleteFlag pattern is 
> used in many places. Here, you are *only* removing it for unlocked 
> objects, I think the title should be slightly improved.

Yeah. This was originally from a series that replaced all the locks with 
atomic inc/dec, however there are threading issues that need to be 
resolved before that is ready. These were the last of the pattern in 
that case. I'll update the commit message.

> 
> On 04/21/2017 07:20 AM, Timothy Arceri wrote:
>> From: Matt Turner <mattst88 at gmail.com>
>>
>> ---
>>   src/mesa/main/arrayobj.c    | 4 +---
>>   src/mesa/main/pipelineobj.c | 4 +---
>>   2 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
>> index 9f4477e..24555d9 100644
>> --- a/src/mesa/main/arrayobj.c
>> +++ b/src/mesa/main/arrayobj.c
>> @@ -181,28 +181,26 @@ _mesa_delete_vao(struct gl_context *ctx, struct 
>> gl_vertex_array_object *obj)
>>    */
>>   void
>>   _mesa_reference_vao_(struct gl_context *ctx,
>>                        struct gl_vertex_array_object **ptr,
>>                        struct gl_vertex_array_object *vao)
>>   {
>>      assert(*ptr != vao);
>>      if (*ptr) {
>>         /* Unreference the old array object */
>> -      GLboolean deleteFlag = GL_FALSE;
>>         struct gl_vertex_array_object *oldObj = *ptr;
>>         assert(oldObj->RefCount > 0);
>>         oldObj->RefCount--;
>> -      deleteFlag = (oldObj->RefCount == 0);
>> -      if (deleteFlag)
>> +      if (oldObj->RefCount == 0)
>>            _mesa_delete_vao(ctx, oldObj);
>>         *ptr = NULL;
>>      }
>>      assert(!*ptr);
>>      if (vao) {
>>         /* reference new array object */
>>         assert(vao->RefCount > 0);
>> diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
>> index a0fa55a..9a852be 100644
>> --- a/src/mesa/main/pipelineobj.c
>> +++ b/src/mesa/main/pipelineobj.c
>> @@ -177,28 +177,26 @@ remove_pipeline_object(struct gl_context *ctx, 
>> struct gl_pipeline_object *obj)
>>    */
>>   void
>>   _mesa_reference_pipeline_object_(struct gl_context *ctx,
>>                                    struct gl_pipeline_object **ptr,
>>                                    struct gl_pipeline_object *obj)
>>   {
>>      assert(*ptr != obj);
>>      if (*ptr) {
>>         /* Unreference the old pipeline object */
>> -      GLboolean deleteFlag = GL_FALSE;
>>         struct gl_pipeline_object *oldObj = *ptr;
>>         assert(oldObj->RefCount > 0);
>>         oldObj->RefCount--;
>> -      deleteFlag = (oldObj->RefCount == 0);
>> -      if (deleteFlag) {
>> +      if (oldObj->RefCount == 0) {
>>            _mesa_delete_pipeline_object(ctx, oldObj);
>>         }
>>         *ptr = NULL;
>>      }
>>      assert(!*ptr);
>>      if (obj) {
>>         /* reference new pipeline object */
>>         assert(obj->RefCount > 0);
>>


More information about the mesa-dev mailing list