Hi all,
I'm trying to generate MIP-maps of a 2D-array texture, but only a limited amount of array layers and MIP-levels.
For instance, to generate only the first 3 MIP-maps of a single array layer of a large 2D-array.
After experimenting with glBlitFramebuffer to generate the MIP-maps manually but still with some sort of hardware acceleration,
I ended up with glTextureView which already works with the limited amount of array layers (I can also verify the result in RenderDoc).
However, glGenerateMipmap (or glGenerateTextureMipmap) always generates the entire MIP-chain for the specified array layer.
Thus, the <numlevels> parameter of glTextureView seems to be ignored in the MIP-map generation process.
I also tried to use glTexParameteri(..., GL_TEXTURE_MAX_LEVEL, 3), but this has the same result.
Can anyone explain me how to solve this?
Here is an example code, how I do it:
void GenerateSubMips(
GLuint texID, GLenum texTarget, GLenum internalFormat,
GLuint baseMipLevel, GLuint numMipLevels,
GLuint baseArrayLayer, GLuint numArrayLayers)
{
GLuint texViewID = 0;
glGenTextures(1, &texViewID);
glTextureView(
texViewID, texTarget, texID, internalFormat,
baseMipLevel, numMipLevels,
baseArrayLayer, numArrayLayers
);
glGenerateTextureMipmap(texViewID);
glDeleteTextures(1, &texViewID);
}
GenerateSubMips(
myTex, GL_TEXTURE_2D_ARRAY, GL_RGBA8,
0, 3, // only the first 3 MIP-maps
4, 1 // only one array layer with index 4
);
Thanks and kind regards,
Lukas