WinRT: allowed for querying of max texture size (via Direct3D 11.1)
authorDavid Ludwig <dludwig@pobox.com>
Sun, 24 Feb 2013 10:30:12 -0500
changeset 8446 290de0966136
parent 8445 b38ff6d1f2a6
child 8447 cd47b09e6e96
WinRT: allowed for querying of max texture size (via Direct3D 11.1)
src/render/direct3d11/SDL_render_d3d11.cpp
--- a/src/render/direct3d11/SDL_render_d3d11.cpp	Sun Feb 24 10:14:23 2013 -0500
+++ b/src/render/direct3d11/SDL_render_d3d11.cpp	Sun Feb 24 10:30:12 2013 -0500
@@ -89,7 +89,6 @@
 HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
 HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
 
-// WinRT, TODO: fill in the Direct3D 11.1 renderer's max texture width and height
 extern "C" SDL_RenderDriver D3D11_RenderDriver = {
     D3D11_CreateRenderer,
     {
@@ -100,8 +99,8 @@
             SDL_PIXELFORMAT_RGB888,
             SDL_PIXELFORMAT_ARGB8888
         },
-        0,                          // max_texture_width
-        0                           // max_texture_height
+        0,                          // max_texture_width: will be filled in later
+        0                           // max_texture_height: will be filled in later
     }
 };
 
@@ -342,6 +341,32 @@
     }
 
     //
+    // Make note of the maximum texture size
+    // Max texture sizes are documented on MSDN, at:
+    // http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
+    //
+    switch (data->d3dDevice->GetFeatureLevel()) {
+        case D3D_FEATURE_LEVEL_11_1:
+        case D3D_FEATURE_LEVEL_11_0:
+            renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
+            break;
+
+        case D3D_FEATURE_LEVEL_10_1:
+        case D3D_FEATURE_LEVEL_10_0:
+            renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
+            break;
+
+        case D3D_FEATURE_LEVEL_9_3:
+            renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
+            break;
+
+        case D3D_FEATURE_LEVEL_9_2:
+        case D3D_FEATURE_LEVEL_9_1:
+            renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
+            break;
+    }
+
+    //
     // Load in SDL's one and only vertex shader:
     //
     vector<char> fileData;