Fix for correct MaxTextureSize in CCConfiguration

In the Windows 8 framework, CCConfiguration current doesn’t get the correct MaxTextureSize. It is always 16,000 regardless of device. I created a method to set the correct MaxTextureSize based on device graphic support level. Even though Windows 8 is DirectX 11, slower devices can support lower feature levels, i.e. smaller textures.

Here’s how I handed this. Not sure if it’s the best approach.

Create a method in CCConfiguration to set the feature level and MaxTextureSize.

void CCConfiguration::setFeatureLevel(D3D_FEATURE_LEVEL x)
{
switch (x)
{
case D3D_FEATURE_LEVEL_9_1:
m_nMaxTextureSize = 2048;
break;
case D3D_FEATURE_LEVEL_9_2:
m_nMaxTextureSize = 2048;
break;
case D3D_FEATURE_LEVEL_9_3:
m_nMaxTextureSize = 4096;
break;
case D3D_FEATURE_LEVEL_10_0:
m_nMaxTextureSize = 8192;
break;
case D3D_FEATURE_LEVEL_10_1:
m_nMaxTextureSize = 16384;
break;
case D3D_FEATURE_LEVEL_11_0:
m_nMaxTextureSize = 16384;
break;
case D3D_FEATURE_LEVEL_11_1:
m_nMaxTextureSize = 16384;
break;
default:
m_nMaxTextureSize = 2048;
break;
}
}

How do we get the device feature level? In DirectXRender::CreateDeviceResources(), D3D11CreateDevice returns featureLevel. Use that to call and set feature level in CCConfiguration.

Hope this helps! I found this because my app was crashing due to creating textures too large.