d3d1x: MipLevels -1 in resource view desc means all
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 13 Oct 2011 12:22:37 +0000 (14:22 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 21 Oct 2011 21:00:37 +0000 (23:00 +0200)
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h

index 74ad24cf4c333fe68aacbe7c497d4cad15b6d61a..899ccc7364b7c7cc1a453265f868517b1a62f0b6 100644 (file)
@@ -1027,7 +1027,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                case D3D11_SRV_DIMENSION_TEXTURECUBE:
                        // yes, this works for all of these types
                        templat.u.tex.first_level = desc->Texture1D.MostDetailedMip;
-                       templat.u.tex.last_level = templat.u.tex.first_level + desc->Texture1D.MipLevels - 1;
+                       if(desc->Texture1D.MipLevels == (unsigned)-1)
+                               templat.u.tex.last_level = templat.texture->last_level;
+                       else
+                               templat.u.tex.last_level = templat.u.tex.first_level + desc->Texture1D.MipLevels - 1;
+                       assert(templat.u.tex.last_level >= templat.u.tex.first_level);
                        break;
                case D3D11_SRV_DIMENSION_BUFFER:
                case D3D11_SRV_DIMENSION_TEXTURE2DMS: