Implements queriability for internal format sample counts.
TRAC #23273
Authored-by: Shannon Woods
Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index c6f9bef..ddcb5a1 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -2455,6 +2455,46 @@
return (itr != mMultiSampleSupport.end()) ? mMaxSupportedSamples : 0;
}
+GLsizei Renderer9::getNumSampleCounts(GLint internalFormat) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
+
+ unsigned int numCounts = 0;
+ if (iter != mMultiSampleSupport.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ for (int i = 0; i < D3DMULTISAMPLE_16_SAMPLES; i++)
+ {
+ if (i != D3DMULTISAMPLE_NONMASKABLE && info.supportedSamples[i])
+ {
+ numCounts++;
+ }
+ }
+ }
+
+ return numCounts;
+}
+
+void Renderer9::getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
+
+ if (iter != mMultiSampleSupport.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ int bufPos = 0;
+ for (int i = D3DMULTISAMPLE_16_SAMPLES; i >= 0 && bufPos < bufSize; i--)
+ {
+ if (i != D3DMULTISAMPLE_NONMASKABLE && info.supportedSamples[i])
+ {
+ params[bufPos++] = i;
+ }
+ }
+ }
+}
+
int Renderer9::getNearestSupportedSamples(D3DFORMAT format, int requested) const
{
if (requested == 0)