[Mesa-dev] [PATCH 1/2] i965: Fix mipmap offsets for HiZ and separate stencil buffers.
sroland at vmware.com
Wed Apr 25 14:14:18 PDT 2012
Am 25.04.2012 21:30, schrieb Paul Berry:
> On 25 April 2012 11:13, Roland Scheidegger <sroland at vmware.com
> <mailto:sroland at vmware.com>> wrote:
> Am 24.04.2012 21 <tel:24.04.2012%2021>:23, schrieb Paul Berry:
> > When rendering to a miplevel other than 0 within a color, depth,
> > stencil, or HiZ buffer, we need to tell the GPU to render to an offset
> > within the buffer, so that the data is written into the correct
> > miplevel. We do this using a coarse offset (in pages), and a fine
> > adjustment (the so-called "tile_x" and "tile_y" values, which are
> > measured in pixels).
> Just wondering, can't you get the gpu to do these offset calculations
> for you?
> In theory yes, but my understanding is that there are enough limitations
> that we've elected not to. The limitations I'm aware of are:
> 1. Gen6 HiZ buffers (and possibly also separate stencil buffers?) don't
> respect the miplevel setting, so if we do this we'll have to do extra
> work to get HiZ and separate stencil to work properly.
> 2. The LOD we're rendering to must match for depth, stencil, and all
> color buffers. AFAICT, GL doesn't require this (though it's possible we
> might be able to work around it by reporting GL_FRAMEBUFFER_UNSUPPORTED,
> I'm not sure).
> The decision was made a long time before I joined the project, so I
> don't know the full history. I would like to do some experiments to try
> getting the gpu to do the offset calculations, but I'm not sure when
> I'll have time to do that :)
> After all dx10 allows you to have multiple mip levels bound as
> a render target at once, where the actual mip level being rendered to is
> determined by a system value (GL 3.3 (?) can do the same with the
> gl_Layer output of geometry shader). How do you handle that if you have
> to adjust the offset manually?
> I'm not familiar with dx10, but the GL 3.3 feature you're talking about
> is for rendering to multiple layers of 3D textures and texture arrays,
> and multiple faces of cubemaps. It doesn't have anything to do with
> miplevels. We implement gl_Layer yet (since we don't support geometry
> shaders) but I just did a quick scan of the docs and it looks like we'll
> be able to support it without a problem, since the offsets to get into a
> different layer and the offsets to get into a different miplevel are
Ah yes you're right. Both in GL and DX you can only select the layer
from arrays etc. but the mip slice is fixed - well I guess changing the
size of the render target in this way would be really fun :-). So
there's no need the gpu is able to do that on its own (with dx10 IIRC
the size of all render target views must match so you don't have the
problem 2) above which makes things easier).
More information about the mesa-dev