Implemented Renderer11::getMaxSupportedSamples.

TRAC #22417 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1861 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 30f52c6c
...@@ -92,6 +92,8 @@ Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc( ...@@ -92,6 +92,8 @@ Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(
mDeviceLost = false; mDeviceLost = false;
mMaxSupportedSamples = 0;
mDevice = NULL; mDevice = NULL;
mDeviceContext = NULL; mDeviceContext = NULL;
mDxgiAdapter = NULL; mDxgiAdapter = NULL;
...@@ -201,6 +203,39 @@ EGLint Renderer11::initialize() ...@@ -201,6 +203,39 @@ EGLint Renderer11::initialize()
return EGL_NOT_INITIALIZED; return EGL_NOT_INITIALIZED;
} }
unsigned int maxSupportedSamples = 0;
unsigned int rtFormatCount = sizeof(RenderTargetFormats) / sizeof(DXGI_FORMAT);
unsigned int dsFormatCount = sizeof(DepthStencilFormats) / sizeof(DXGI_FORMAT);
for (unsigned int i = 0; i < rtFormatCount + dsFormatCount; ++i)
{
DXGI_FORMAT format = (i < rtFormatCount) ? RenderTargetFormats[i] : DepthStencilFormats[i - rtFormatCount];
if (format != DXGI_FORMAT_UNKNOWN)
{
UINT formatSupport;
result = mDevice->CheckFormatSupport(format, &formatSupport);
if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET))
{
MultisampleSupportInfo supportInfo;
for (unsigned int j = 1; j <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; j++)
{
result = mDevice->CheckMultisampleQualityLevels(format, j, &supportInfo.qualityLevels[j - 1]);
if (SUCCEEDED(result) && supportInfo.qualityLevels[j - 1] > 0)
{
maxSupportedSamples = std::max(j, maxSupportedSamples);
}
else
{
supportInfo.qualityLevels[j - 1] = 0;
}
}
mMultisampleSupportMap.insert(std::make_pair(format, supportInfo));
}
}
}
mMaxSupportedSamples = maxSupportedSamples;
initializeDevice(); initializeDevice();
// BGRA texture support is optional in feature levels 10 and 10_1 // BGRA texture support is optional in feature levels 10 and 10_1
...@@ -2169,9 +2204,7 @@ int Renderer11::getMaxSwapInterval() const ...@@ -2169,9 +2204,7 @@ int Renderer11::getMaxSwapInterval() const
int Renderer11::getMaxSupportedSamples() const int Renderer11::getMaxSupportedSamples() const
{ {
// TODO return mMaxSupportedSamples;
// UNIMPLEMENTED();
return 1;
} }
bool Renderer11::copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source) bool Renderer11::copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source)
......
...@@ -200,6 +200,17 @@ class Renderer11 : public Renderer ...@@ -200,6 +200,17 @@ class Renderer11 : public Renderer
RenderStateCache mStateCache; RenderStateCache mStateCache;
// Multisample format support
struct MultisampleSupportInfo
{
unsigned int qualityLevels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
};
typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
MultisampleSupportMap mMultisampleSupportMap;
unsigned int mMaxSupportedSamples;
// current render target states // current render target states
unsigned int mAppliedRenderTargetSerial; unsigned int mAppliedRenderTargetSerial;
unsigned int mAppliedDepthbufferSerial; unsigned int mAppliedDepthbufferSerial;
......
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