Added Functions for gathering all referenced D3D and DXGI formats. Renderers now use these functions to generate the multisample support maps.
TRAC #23212
Signed-off-by: Jamie Madill
Signed-off-by: Shannon Woods
Author: Geoff Lang
diff --git a/src/libGLESv2/renderer/formatutils11.cpp b/src/libGLESv2/renderer/formatutils11.cpp
index 3251813..a224e46 100644
--- a/src/libGLESv2/renderer/formatutils11.cpp
+++ b/src/libGLESv2/renderer/formatutils11.cpp
@@ -512,9 +512,15 @@
return map;
}
-static bool getDXGIFormatInfo(DXGI_FORMAT format, DXGIFormatInfo *outFormatInfo)
+static const DXGIFormatInfoMap &GetDXGIFormatInfoMap()
{
static const DXGIFormatInfoMap infoMap = buildDXGIFormatInfoMap();
+ return infoMap;
+}
+
+static bool getDXGIFormatInfo(DXGI_FORMAT format, DXGIFormatInfo *outFormatInfo)
+{
+ const DXGIFormatInfoMap &infoMap = GetDXGIFormatInfoMap();
DXGIFormatInfoMap::const_iterator iter = infoMap.find(format);
if (iter != infoMap.end())
{
@@ -530,6 +536,19 @@
}
}
+static d3d11::DXGIFormatSet BuildAllDXGIFormatSet()
+{
+ d3d11::DXGIFormatSet set;
+
+ const DXGIFormatInfoMap &infoMap = GetDXGIFormatInfoMap();
+ for (DXGIFormatInfoMap::const_iterator i = infoMap.begin(); i != infoMap.end(); ++i)
+ {
+ set.insert(i->first);
+ }
+
+ return set;
+}
+
namespace d3d11
{
@@ -653,6 +672,12 @@
}
}
+const DXGIFormatSet &GetAllUsedDXGIFormats()
+{
+ static DXGIFormatSet formatSet = BuildAllDXGIFormatSet();
+ return formatSet;
+}
+
}
namespace gl_d3d11