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
parent c1e26341
...@@ -21,7 +21,7 @@ Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc( ...@@ -21,7 +21,7 @@ Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(
mD3d11Module = NULL; mD3d11Module = NULL;
mDxgiModule = NULL; mDxgiModule = NULL;
mD3d11 = NULL; mDevice = NULL;
mDeviceContext = NULL; mDeviceContext = NULL;
} }
...@@ -35,10 +35,10 @@ Renderer11::~Renderer11() ...@@ -35,10 +35,10 @@ Renderer11::~Renderer11()
mDeviceContext = NULL; mDeviceContext = NULL;
} }
if (mD3d11) if (mDevice)
{ {
mD3d11->Release(); mDevice->Release();
mD3d11 = NULL; mDevice = NULL;
} }
if (mD3d11Module) if (mD3d11Module)
...@@ -72,21 +72,26 @@ EGLint Renderer11::initialize() ...@@ -72,21 +72,26 @@ EGLint Renderer11::initialize()
ERR("Could not retrieve D3D11CreateDevice address - aborting!\n"); ERR("Could not retrieve D3D11CreateDevice address - aborting!\n");
return EGL_NOT_INITIALIZED; 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, HRESULT result = D3D11CreateDevice(NULL,
D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_HARDWARE,
NULL, NULL,
NULL, 0, // D3D11_CREATE_DEVICE_DEBUG
&featureLevel, featureLevel,
1, sizeof(featureLevel)/sizeof(featureLevel[0]),
D3D11_SDK_VERSION, D3D11_SDK_VERSION,
&mD3d11, &mDevice,
NULL, &mFeatureLevel,
&mDeviceContext); &mDeviceContext);
if (!mD3d11 || FAILED(result)) if (!mDevice || FAILED(result))
{ {
ERR("Could not create D3D11 device - aborting!\n"); ERR("Could not create D3D11 device - aborting!\n");
return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer
...@@ -379,23 +384,35 @@ float Renderer11::getMaxPointSize() const ...@@ -379,23 +384,35 @@ float Renderer11::getMaxPointSize() const
int Renderer11::getMaxTextureWidth() const int Renderer11::getMaxTextureWidth() const
{ {
// TODO switch (mFeatureLevel)
UNIMPLEMENTED(); {
return 1024; 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 int Renderer11::getMaxTextureHeight() const
{ {
// TODO switch (mFeatureLevel)
UNIMPLEMENTED(); {
return 1024; 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 bool Renderer11::get32BitIndexSupport() const
{ {
// TODO switch (mFeatureLevel)
UNIMPLEMENTED(); {
return true; 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 int Renderer11::getMinSwapInterval() const
......
...@@ -84,7 +84,7 @@ class Renderer11 : public Renderer ...@@ -84,7 +84,7 @@ class Renderer11 : public Renderer
virtual GLsizei getMaxSupportedSamples() const; virtual GLsizei getMaxSupportedSamples() const;
// D3D11-renderer specific methods // D3D11-renderer specific methods
ID3D11Device *getDevice() { return mD3d11; } ID3D11Device *getDevice() { return mDevice; }
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; }; ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
private: private:
...@@ -99,7 +99,8 @@ class Renderer11 : public Renderer ...@@ -99,7 +99,8 @@ class Renderer11 : public Renderer
void initializeDevice(); void initializeDevice();
void releaseDeviceResources(); void releaseDeviceResources();
ID3D11Device *mD3d11; ID3D11Device *mDevice;
D3D_FEATURE_LEVEL mFeatureLevel;
ID3D11DeviceContext *mDeviceContext; ID3D11DeviceContext *mDeviceContext;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment