[Mesa-dev] [PATCH 1/3] mesa: remove unneeded error check in create_textures()

Anuj Phogat anuj.phogat at gmail.com
Thu Oct 8 12:15:22 PDT 2015


On Thu, Oct 8, 2015 at 11:01 AM, Brian Paul <brianp at vmware.com> wrote:
> You tested with all 3 patches and everything's OK now?
>
> I guess I'd still like an R-b on the 3rd patch ("mesa,meta: move
> gl_texture_object::TargetIndex initializations") from someone before
> pushing.
done.
>
> -Brian
>
>
> On 10/08/2015 11:57 AM, Mark Janes wrote:
>>
>> Tested-by: Mark Janes <mark.a.janes at intel.com>
>>
>> Brian Paul <brianp at vmware.com> writes:
>>
>>> Callers of create_texture() will either pass target=0 or a validated
>>> GL texture target enum so no need to do another error check inside
>>> the loop.
>>> ---
>>>   src/mesa/main/texobj.c | 11 ++---------
>>>   1 file changed, 2 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
>>> index 173e43c..aa4b38c 100644
>>> --- a/src/mesa/main/texobj.c
>>> +++ b/src/mesa/main/texobj.c
>>> @@ -1211,6 +1211,7 @@ _mesa_create_nameless_texture(struct gl_context
>>> *ctx, GLenum target)
>>>    * glCreateTextures should throw errors if target = 0. This is not
>>> exposed to
>>>    * the rest of Mesa to encourage Mesa internals to use nameless
>>> textures,
>>>    * which do not require expensive hash lookups.
>>> + * \param target  either 0 or a a valid / error-checked texture target
>>> enum
>>>    */
>>>   static void
>>>   create_textures(struct gl_context *ctx, GLenum target,
>>> @@ -1219,6 +1220,7 @@ create_textures(struct gl_context *ctx, GLenum
>>> target,
>>>      GLuint first;
>>>      GLint i;
>>>      const char *func = dsa ? "Create" : "Gen";
>>> +   const GLint targetIndex = _mesa_tex_target_to_index(ctx, target);
>>>
>>>      if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
>>>         _mesa_debug(ctx, "gl%sTextures %d\n", func, n);
>>> @@ -1241,7 +1243,6 @@ create_textures(struct gl_context *ctx, GLenum
>>> target,
>>>      /* Allocate new, empty texture objects */
>>>      for (i = 0; i < n; i++) {
>>>         struct gl_texture_object *texObj;
>>> -      GLint targetIndex;
>>>         GLuint name = first + i;
>>>         texObj = ctx->Driver.NewTextureObject(ctx, name, target);
>>>         if (!texObj) {
>>> @@ -1252,14 +1253,6 @@ create_textures(struct gl_context *ctx, GLenum
>>> target,
>>>
>>>         /* Initialize the target index if target is non-zero. */
>>>         if (target != 0) {
>>> -         targetIndex = _mesa_tex_target_to_index(ctx, texObj->Target);
>>> -         if (targetIndex < 0) { /* Bad Target */
>>> -            mtx_unlock(&ctx->Shared->Mutex);
>>> -            _mesa_error(ctx, GL_INVALID_ENUM, "gl%sTextures(target =
>>> %s)",
>>> -                        func, _mesa_enum_to_string(texObj->Target));
>>> -            return;
>>> -         }
>>> -         assert(targetIndex < NUM_TEXTURE_TARGETS);
>>>            texObj->TargetIndex = targetIndex;
>>>         }
>>>
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=wH7wzPfX3yNt9F68zI5o07hlcSlDR3G_FNCKDirtQ2Y&s=cqrFZKT8ppra0ur69BB8607q0TMHVG6Z44hRctrib9k&e=
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list