Implement texture dimension limits and 32-bit index queries.
TRAC #22056
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1400 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index ee26e25..b0ff71a 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -21,7 +21,7 @@
mD3d11Module = NULL;
mDxgiModule = NULL;
- mD3d11 = NULL;
+ mDevice = NULL;
mDeviceContext = NULL;
}
@@ -35,10 +35,10 @@
mDeviceContext = NULL;
}
- if (mD3d11)
+ if (mDevice)
{
- mD3d11->Release();
- mD3d11 = NULL;
+ mDevice->Release();
+ mDevice = NULL;
}
if (mD3d11Module)
@@ -72,21 +72,26 @@
ERR("Could not retrieve D3D11CreateDevice address - aborting!\n");
return EGL_NOT_INITIALIZED;
}
-
- D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_10_0;
-
+
+ D3D_FEATURE_LEVEL featureLevel[] =
+ {
+ D3D_FEATURE_LEVEL_11_0,
+ D3D_FEATURE_LEVEL_10_1,
+ D3D_FEATURE_LEVEL_10_0,
+ };
+
HRESULT result = D3D11CreateDevice(NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
- NULL,
- &featureLevel,
- 1,
+ 0, // D3D11_CREATE_DEVICE_DEBUG
+ featureLevel,
+ sizeof(featureLevel)/sizeof(featureLevel[0]),
D3D11_SDK_VERSION,
- &mD3d11,
- NULL,
+ &mDevice,
+ &mFeatureLevel,
&mDeviceContext);
-
- if (!mD3d11 || FAILED(result))
+
+ if (!mDevice || FAILED(result))
{
ERR("Could not create D3D11 device - aborting!\n");
return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer
@@ -379,23 +384,35 @@
int Renderer11::getMaxTextureWidth() const
{
- // TODO
- UNIMPLEMENTED();
- return 1024;
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
+ default: UNREACHABLE(); return 0;
+ }
}
int Renderer11::getMaxTextureHeight() const
{
- // TODO
- UNIMPLEMENTED();
- return 1024;
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
+ default: UNREACHABLE(); return 0;
+ }
}
bool Renderer11::get32BitIndexSupport() const
{
- // TODO
- UNIMPLEMENTED();
- return true;
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32; // true
+ default: UNREACHABLE(); return false;
+ }
}
int Renderer11::getMinSwapInterval() const