Ian Romanick wrote:
> 
> On Thu, Mar 07, 2002 at 10:23:33AM -0700, Brian Paul wrote:
> > > > > On Mon, 4 Mar 2002, Jos� Fonseca wrote:
> > > > >
> > > > > > ....
> > > > > >
> > > > > > But why does the number of levels has to do with the maximum texture
> > > > > size?
> >
> > You should look at tObj->Image[tObj->BaseLevel], not image[0] since it
> > might not exist.
> >
> > You seem to have been confused by "texture levels" before.  Looks like
> > you've figured it out now.  It's basically the maximum number of mipmap
> > levels AND it's related to max texture size.
> 
> Hmmm...this sounds like a good thing to add to the devel FAQ. :)  I'm sure
> he's not the only one to ever be confused by this.  Perhaps something like
> the following would work.  There should perhaps be some commentary on how
> this is all managed in 'struct gl_texture_object', but I'm not familiar with
> all of the nuances there.

I guess I'm assuming that anyone working on a DRI driver has read the
OpenGL specification and knows the terminology used in it.


> Q: What does the maximum texture size allowed by a graphics chip have to do
> with the number of mipmap levels stored by the driver?

A graphics chip should be able to store a complete set of mipmaps.  Maybe
the Mach64 is broken in that respect.


> A: When mipmapping is used, OpenGL requires that all mipmap levels be
> available for a texture of size NxN from N/2xN/2 down to 1x1.

>From NxN to 1x1, to be pedantic.


>  So, if a
> particular chip supports textures up to size 512x512, then the driver could
> potentially have to store mipmaps of sizes 256x256, 128x128, 64x64, ...,
> 4x4, 2x2, 1x1.

The 512x512 image is part of the mipmap as well.


> This is a total of 10 texture levels, 9 mipmaps and the base texture.

I don't know why you're treating the base-level texture specially.

Ordinarily, if you hardware supports a max texture size of NxN it
supports a mipmap of log2(N)+1 images or levels:

  level 0: N x N
  level 1: N/2 x N/2
  level 2: N/4 x N/4
   ...
  level k: 1 x 1

where k = log2(N).

Now then, OpenGL 1.2 introduced the notion of GL_TEXTURE_BASE_LEVEL and
GL_TEXTURE_MAX_LEVEL.  By setting these values you can tell OpenGL to
only use a subset of the mipmap images during texturing.  Specifically,
levels in [GL_TEXTURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL] (closed interval
notation) will only be referenced.

This is useful for progressive mipmap loading in apps which require
smooth framerates.

Furthermore, the GL_TEXTURE_MIN_LOD and GL_TEXTURE_MAX_LOD values are
used to clamp the lambda value which is used to select the mipmap level.
See the OpenGL spec for details.  I'll warn you that it's one of the most
complicated sections of the OpenGL spec.

It can be tricky to implement all this in the drivers.  I should know
since I'm the one that did so in all the DRI drivers.

-Brian

_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to