Well if instead of
+ resource = wined3d_texture_get_resource(surface->wined3d_texture);
I call wined3d_texture_get_sub_resource() then once control goes back to wined3d we can know texture_level and texture_layer for that particular surface (casting the surface from the subresource e.g. in wined3d_rendertarget_view_init()).
The sub_resource_idx "hack" would still be in place (maybe we can mitigate it with some inline comment) but the potential issue you pointed out could be easily solved then?
Ciao, Riccardo
2015-10-20 19:26 GMT+02:00 Henri Verbeet hverbeet@gmail.com:
On 20 October 2015 at 18:05, Riccardo Bortolato rikyz619@gmail.com wrote:
But d3d9_surface->sub_resource_idx is layer * container->level_count + level so view->sub_resource_idx would still be ok,
That's what I said. :)
But at some point we'll need to create actual OpenGL texture views, and then we'll need to correct level and layer indices instead of just the sub-resource index. (See also https://www.opengl.org/registry/specs/ARB/texture_view.txt for reference.)