[Mesa-dev] [PATCH 03/16] mesa: Add _mesa_bind_texture method

Tapani Pälli tapani.palli at intel.com
Wed Dec 20 18:27:55 UTC 2017



On 20.12.2017 20:04, Tapani Pälli wrote:
> 
> 
> On 20.12.2017 01:36, Ian Romanick wrote:
>> On 12/19/2017 03:45 AM, Tapani Pälli wrote:
>>>
>>>
>>> On 12/19/2017 01:39 PM, Tapani Pälli wrote:
>>>>
>>>>
>>>> On 12/19/2017 02:14 AM, Ian Romanick wrote:
>>>>> From: Ian Romanick <ian.d.romanick at intel.com>
>>>>>
>>>>> Light-weight glBindTexture for internal use.
>>>>>
>>>>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>>>>> ---
>>>>>    src/mesa/main/texobj.c | 17 ++++++++++++++++-
>>>>>    src/mesa/main/texobj.h |  4 +++-
>>>>>    2 files changed, 19 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
>>>>> index db40598..cd9f43c 100644
>>>>> --- a/src/mesa/main/texobj.c
>>>>> +++ b/src/mesa/main/texobj.c
>>>>> @@ -1692,6 +1692,22 @@ bind_texture_object(struct gl_context *ctx,
>>>>> unsigned unit,
>>>>>       }
>>>>>    }
>>>>
>>>> This could have some documentation block that says when it is used and
>>>> what are the differences with bind_texture?
>>>
>>> (some small comment like "Light-weight glBindTexture for internal use."
>>> could do)
>>
>> I've added this locally:
>>
>> /**
>>   * Light-weight bind texture for internal users
>>   *
>>   * This is really just \c finish_texture_init plus \c 
>> bind_texture_object.
>>   * This is intended to be used by internal Mesa functions that use
>>   * \c _mesa_CreateTexture and need to bind textures (e.g., meta).
>>   */
> 
> That looks good!
> 
> I've been going through here with rest of the set (I'm not very familiar 
> with meta so this takes time :/) and I'm wondering how do you test the 
> blitframebuffer changes? I tried to disable blorp and use only meta for 
> frambuffer blits but then lots of things fail with 'Invalid blit' with 
> the assertion here:
> 
> --- 8< ---
>     if (devinfo->gen >= 8 && (mask & GL_STENCIL_BUFFER_BIT)) {
>        assert(!"Invalid blit");
>     }
> --- 8< ---
> 
> I can see that blitframebuffer works fine for color buffers though when 
> debugging with game engine that does some color blits

OK now I realized meta does not do stencil, so it would be color and 
depth blit tests only. I'll do some further testing with that.


> 
> 
>>> Patches 1,2,3
>>> Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
>>>
>>>>> +void
>>>>> +_mesa_bind_texture(struct gl_context *ctx, GLenum target,
>>>>> +                   struct gl_texture_object *tex_obj)
>>>>> +{
>>>>> +   const GLint targetIndex = _mesa_tex_target_to_index(ctx, target);
>>>>> +
>>>>> +   assert(targetIndex >= 0 && targetIndex < NUM_TEXTURE_TARGETS);
>>>>> +
>>>>> +   if (tex_obj->Target == 0)
>>>>> +      finish_texture_init(ctx, target, tex_obj, targetIndex);
>>>>> +
>>>>> +   assert(tex_obj->Target == target);
>>>>> +   assert(tex_obj->TargetIndex == targetIndex);
>>>>> +
>>>>> +   bind_texture_object(ctx, ctx->Texture.CurrentUnit, tex_obj);
>>>>> +}
>>>>>    /**
>>>>>     * Implement glBindTexture().  Do error checking, look-up or create
>>>>> a new
>>>>> @@ -1764,7 +1780,6 @@ bind_texture(struct gl_context *ctx, GLenum
>>>>> target, GLuint texName,
>>>>>       bind_texture_object(ctx, ctx->Texture.CurrentUnit, newTexObj);
>>>>>    }
>>>>> -
>>>>>    void GLAPIENTRY
>>>>>    _mesa_BindTexture_no_error(GLenum target, GLuint texName)
>>>>>    {
>>>>> diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
>>>>> index 8dea853..f2d78ac 100644
>>>>> --- a/src/mesa/main/texobj.h
>>>>> +++ b/src/mesa/main/texobj.h
>>>>> @@ -175,7 +175,9 @@ extern void
>>>>>    _mesa_delete_nameless_texture(struct gl_context *ctx,
>>>>>                                  struct gl_texture_object *texObj);
>>>>> -
>>>>> +extern void
>>>>> +_mesa_bind_texture(struct gl_context *ctx, GLenum target,
>>>>> +                   struct gl_texture_object *tex_obj);
>>>>>    /*@}*/
>>>>>    /**
>>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list