On Tue, Apr 19, 2016 at 11:24 AM, Henri Verbeet hverbeet@gmail.com wrote:
On 19 April 2016 at 00:01, Józef Kucia jkucia@codeweavers.com wrote:
Signed-off-by: Józef Kucia jkucia@codeweavers.com
It's inefficient to download a complete miplevel to copy just a single layer from it.
Does this happen much in practice? Do you have performance numbers? The patch doesn't really make sense in its current form. surface_download_data() is meant for downloading the data from the texture. If that's not what you want, don't call it. (Also, does this actually work? It looks like it's just reading from the current drawable.)
The issue is if we do not have ARB_get_texture_sub_image we use glGet[Compressed]TexImage() to download the data from texture. This type of download is implemented in the patch 6. I want to avoid glGet[Compressed]TexImage() for array textures because these functions don't allow to download the data for a single wined3d surface. They allow to download data for the whole miplevel slice. In the patch 6 a block of memory is allocated, the whole miplevel slice is downloaded and the data for a single layer is copied to the current wined3d surface.
The idea in this patch is to simulate glGetTextureSubImage() using reads from the framebuffer. An array array texture is attached to framebuffer using glFramebufferTextureLayer() and the data for a single wined3d surface is downloaded using glReadPixels(). This works in my d3d11 tests which I plan to submit in the following patchset.