Does anyone know if it’s possible to alias a sub-region of one texture or framebuffer as another texture of the same pixel format?
From my point of view, this’d be really nice since you can then write shader code that doesn’t have to worry about keeping texture sampling within a particular region of a larger texture, and clamping/tiling/mirroring addressing modes would work transparently for the region aliased texture that are bound to the samplers. I’m talking about 1D and 2D textures here, where an aliasing texture would only have the first mip-level; supporting fully mipmapped sub-region aliasing textures sounds tricky. I can imagine it also being useful for aliasing a region of a volume/3D texture… Can’t quite see how it’d be useful to alias a rectangular region of a cube face, though.
As another example, this can also provide a handy mechansim for dynamically down-rez’ing any rendering and thereby dynamically balancing the GPU load to some extent, again, without having to muck about with clamping texture addressing regions. For example, if you time the GPU rendering time for a frame, if you run over a maximum permitted GPU render time (and where you decide a small loss of visual fidelity is acceptable… e.g. if the camera is panning or moving fast), you smoothly scale your main scene viewport size down a little. Just reducing the viewport size onto the framebuffer isn’t usually enough if you still have to do some post-processing on your scene or ultimately copy it to the main back-buffer, where you need it to fill the whole buffer. Your post-effects or copying then needs to sample from the main scene framebuffer within this shrunken region (0,0 to 0.9,0.9, say)… More correctly, it needs to stay half a texel’s width and height within this region. Instead of having to burden the shader code with ensuring it samples half a texel within this down-rez’d region, a smaller texture aliasing this texture region simplifies everything; the shader just samples from 0,0 to 1,1 as usual.
Apologies for the excessive examples.
Anyway, if this kind of thing is possible, could you point me to the relevant extensions or examples? If not, would others find this kind of thing a useful feature… or are there very good reasons for not allowing this kind of stuff?