Stepped through with the debugger and the downloadFromGpu seems to return the correct width and height of the mip level, however when you call map, the mWidth and mHeight from the mapImpl( uint32 slice ) function says the full texture resolution.
So more in depth:
OgreD3D11AsyncTextureTicket.cpp
line 128: DownloadFromGpu.
The "srcTextureBox" variable for the staging texture shows for example 128x128 as the mip resolution for a 1024x1024 base resolution texture, however the:
OgreD3D11AsyncTextureTicket.cpp
Line 264: TextureBox D3D11AsyncTextureTicket::mapImpl( uint32 slice )
Code: Select all
TextureBox retVal( mWidth, mHeight, getDepth(), getNumSlices(),
Any reason why it shows 1024x1024 and do i have to do the rez changes to the texture box returned, or is this an error.
Example Pseudo Code:
Code: Select all
// myTexture width / height = 1024
// myTexture depth = 1
// myTexture type = cubemap - slices = 6
// myTexture format = PFG_RGBA16_FLOAT
// mMip level = 3
asyncTicket = textureGpuManager->createAsyncTextureTicket(myTexture->getWidth(), myTexture->getHeight(), myTexture->getDepth(), TypeCube, PFG_RGBA16_FLOAT);
asyncTicket->download(myTexture, mMip, true); // Downloads 128x128 to staging texture
TextureBox box;
if (asyncTicket->canMapMoreThanOneSlice()) {
box = asyncTicket->map(0));
}else {
for (SkyUInt32 i = 0; i < asyncTicket->getNumSlices(); i++) {
... asyncTicket->map(i));
}
}
//box.width will be 1024 whereas i need it to be 128 to match the downloaded mip level res
//box.height will be 1024 whereas i need it to be 128 to match the downloaded mip level res
If you need more information, then please let me know
Edit: Of course this would also affect the bytesPerRow and bytesPerImage which is why im not sure if this is a bug or not and cant find an example in ogre source where the mipmaps are being downloaded and used with the texturebox, only the "void PccPerPixelGridPlacement::preCopyRenderTargetToCubemap( TextureGpu *renderTarget, uint32 cubemapArrayIdx )" seems to download mips and getEmptyBox is used in the _copyRenderTargetToCubemap() function....
Still thinking its a misunderstanding...
Edit 2: Duh!! just make the texture ticket with the height and width of what i want.
Code: Select all
asyncTicket = textureGpuManager->createAsyncTextureTicket(myTexture->getWidth() >> mMip, myTexture->getHeight() >> mMip, myTexture->getDepth(), TypeCube, PFG_RGBA16_FLOAT);