[Mesa-dev] [PATCH 08/13] mesa: rewrite/consolidate code in _mesa_test_texobj_completeness()
Brian Paul
brianp at vmware.com
Tue Mar 20 06:41:18 PDT 2012
On 03/20/2012 12:56 AM, Eric Anholt wrote:
> On Sun, 18 Mar 2012 10:49:24 -0600, Brian Paul<brianp at vmware.com> wrote:
>> Merge the mipmap level checking code that was separate cases for 1D,
>> 2D, 3D and CUBE before.
>
>> - if (img->_BaseFormat == GL_DEPTH_COMPONENT) {
>> - incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
>> - return;
>> - }
>
> [...]
>
>> - /* Don't support GL_DEPTH_COMPONENT for cube maps */
>> - if (ctx->VersionMajor< 3&& !ctx->Extensions.EXT_gpu_shader4) {
>> - if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
>> - incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
>> - return;
>> - }
>> - }
>
> It was a surprise tosee these two blocks be dropped. However, it looks
> totally safe: texture image creation already errors out in these cases,
> so we shouldn't have any reason to check for it at completeness time.
Right.
>> - /* check that all six images have same size */
>> - if (t->Image[face][i]->Width2 != width ||
>> - t->Image[face][i]->Height2 != height) {
>> +
>> + /* Extra checks for cube textures */
>> + if (face> 0) {
>> + /* check that cube faces are the same size */
>> + if (img->Width2 != t->Image[0][i]->Width2 ||
>> + img->Height2 != t->Image[0][i]->Height2) {
>> incomplete(t, "CubeMap Image[n][i] bad size");
>> return;
>> }
>
> I thought this testing might be wrong, since we're not checking that
> cube faces have width == height. That's also tested at image creation
> time, though, so it's true at this point (and so, technically, we
> wouldn't even need to test for Height2s matching up)
Yes, I think I'll remove the height comparison and add an assertion
and comment to explain that.
-Brian
More information about the mesa-dev
mailing list