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/formatutils9.cpp b/src/libGLESv2/renderer/formatutils9.cpp
index a0321d3..a2bba1a 100644
--- a/src/libGLESv2/renderer/formatutils9.cpp
+++ b/src/libGLESv2/renderer/formatutils9.cpp
@@ -209,9 +209,15 @@
return map;
}
-static bool getD3D9FormatInfo(D3DFORMAT format, D3DFormatInfo *outFormatInfo)
+static const D3D9FormatInfoMap &GetD3D9FormatInfoMap()
{
static const D3D9FormatInfoMap infoMap = buildD3D9FormatInfoMap();
+ return infoMap;
+}
+
+static bool getD3D9FormatInfo(D3DFORMAT format, D3DFormatInfo *outFormatInfo)
+{
+ const D3D9FormatInfoMap &infoMap = GetD3D9FormatInfoMap();
D3D9FormatInfoMap::const_iterator iter = infoMap.find(format);
if (iter != infoMap.end())
{
@@ -226,6 +232,18 @@
return false;
}
}
+static d3d9::D3DFormatSet BuildAllD3DFormatSet()
+{
+ d3d9::D3DFormatSet set;
+
+ const D3D9FormatInfoMap &infoMap = GetD3D9FormatInfoMap();
+ for (D3D9FormatInfoMap::const_iterator i = infoMap.begin(); i != infoMap.end(); ++i)
+ {
+ set.insert(i->first);
+ }
+
+ return set;
+}
namespace d3d9
{
@@ -348,6 +366,12 @@
}
}
+const D3DFormatSet &GetAllUsedD3DFormats()
+{
+ static const D3DFormatSet formatSet = BuildAllD3DFormatSet();
+ return formatSet;
+}
+
}
namespace gl_d3d9