[Mesa-dev] [PATCH] mesa: Define helper function to get the number of texture layers.

Brian Paul brianp at vmware.com
Tue Dec 10 09:15:50 PST 2013


On 12/10/2013 09:42 AM, Francisco Jerez wrote:
> Brian Paul <brianp at vmware.com> writes:
>
>> On 12/07/2013 06:17 PM, Francisco Jerez wrote:
>>> [...]
>>> +   default:
>>> +      unreachable();
>>
>> I think I'd like to see an assertion or _mesa_problem() call to catch
>> unhandled cases if new texture targets are added in the future.
>>
>>
> How about having the unreachable() macro print out an error and abort if
> it's ever reached?  See the attached patch.

OK, but wouldn't a simple assert suffice?


>
>>> +   }
>>> +}
>>> +
>>> +
>>> +/**
>>> + * Return the number of layers present in the given level of an array,
>>> + * cubemap or 3D texture.  If the texture is not layered return zero.
>>> + */
>>> +GLuint
>>> +_mesa_get_texture_layers(struct gl_texture_object *texObj, GLint level)
>>
>> The pointer could be const-qualifed and level could be GLuint.
>>
>
> I made level a signed integer deriberately, because texture levels seem
> to be declared as GLint everywhere else.

OK.

-Brian




More information about the mesa-dev mailing list