[Mesa-dev] [PATCH 08/14] mesa: overhaul the glGetTexImage code

Brian Paul brianp at vmware.com
Thu Jul 16 07:30:29 PDT 2015


On 07/15/2015 07:15 PM, Ilia Mirkin wrote:
> The reason why you chose to call select_tex_image() several times
> through a get_tex_image flow eludes me. Why not just get it once at
> the beginning and pass it around? The old APIs also used a
> gl_texture_image and not a gl_texture_object. (Obviously the object is
> implicitly gettable from the image when necessary.)

It's kind of arbitrary, but I leaned toward passing a gl_texture_object 
and level instead.

Passing a gl_texture_image to getteximage_error_check(), for example, 
wouldn't allow us to get rid of the 'level' parameter since it still 
needs to be error-checked.  We could return a gl_texture_image from 
get_texture_image_dims() but it would be null in a number of situations. 
  Some situations would require raising GL_INVALID_VALUE, others 
GL_INVALID_OPERATION.

I was also hesitant to pass around a gl_texture_image pointer because in 
the case of non-array cube maps we actually care about six 
gl_texture_images.  When the code still passed an image I was often 
asking myself "is this the positive x image or one specified by target 
or one specified by zoffset?"  I found it easier to understand when I 
switched to a gl_texture_object.

select_tex_image() is a cheap call.  Are you concerned about the cost of 
calling it?

-Brian



More information about the mesa-dev mailing list