src/render/direct3d11/SDL_render_d3d11.cpp
changeset 8446 290de0966136
parent 8445 b38ff6d1f2a6
child 8448 a85b3f8374b3
equal deleted inserted replaced
8445:b38ff6d1f2a6 8446:290de0966136
    87 HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
    87 HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
    88 HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
    88 HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
    89 HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
    89 HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
    90 HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
    90 HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
    91 
    91 
    92 // WinRT, TODO: fill in the Direct3D 11.1 renderer's max texture width and height
       
    93 extern "C" SDL_RenderDriver D3D11_RenderDriver = {
    92 extern "C" SDL_RenderDriver D3D11_RenderDriver = {
    94     D3D11_CreateRenderer,
    93     D3D11_CreateRenderer,
    95     {
    94     {
    96         "direct3d 11.1",
    95         "direct3d 11.1",
    97         (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),    // flags.  see SDL_RendererFlags
    96         (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),    // flags.  see SDL_RendererFlags
    98         2,                          // num_texture_formats
    97         2,                          // num_texture_formats
    99         {                           // texture_formats
    98         {                           // texture_formats
   100             SDL_PIXELFORMAT_RGB888,
    99             SDL_PIXELFORMAT_RGB888,
   101             SDL_PIXELFORMAT_ARGB8888
   100             SDL_PIXELFORMAT_ARGB8888
   102         },
   101         },
   103         0,                          // max_texture_width
   102         0,                          // max_texture_width: will be filled in later
   104         0                           // max_texture_height
   103         0                           // max_texture_height: will be filled in later
   105     }
   104     }
   106 };
   105 };
   107 
   106 
   108 
   107 
   109 //typedef struct
   108 //typedef struct
   340     if (FAILED(result)) {
   339     if (FAILED(result)) {
   341         return result;
   340         return result;
   342     }
   341     }
   343 
   342 
   344     //
   343     //
       
   344     // Make note of the maximum texture size
       
   345     // Max texture sizes are documented on MSDN, at:
       
   346     // http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
       
   347     //
       
   348     switch (data->d3dDevice->GetFeatureLevel()) {
       
   349         case D3D_FEATURE_LEVEL_11_1:
       
   350         case D3D_FEATURE_LEVEL_11_0:
       
   351             renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
       
   352             break;
       
   353 
       
   354         case D3D_FEATURE_LEVEL_10_1:
       
   355         case D3D_FEATURE_LEVEL_10_0:
       
   356             renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
       
   357             break;
       
   358 
       
   359         case D3D_FEATURE_LEVEL_9_3:
       
   360             renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
       
   361             break;
       
   362 
       
   363         case D3D_FEATURE_LEVEL_9_2:
       
   364         case D3D_FEATURE_LEVEL_9_1:
       
   365             renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
       
   366             break;
       
   367     }
       
   368 
       
   369     //
   345     // Load in SDL's one and only vertex shader:
   370     // Load in SDL's one and only vertex shader:
   346     //
   371     //
   347     vector<char> fileData;
   372     vector<char> fileData;
   348     if (!D3D11_ReadShaderContents(L"SDL_D3D11_VertexShader_Default.cso", fileData)) {
   373     if (!D3D11_ReadShaderContents(L"SDL_D3D11_VertexShader_Default.cso", fileData)) {
   349         SDL_SetError("Unable to open SDL's vertex shader file.");
   374         SDL_SetError("Unable to open SDL's vertex shader file.");