Commit dd4674f2 by Shannon Woods

Adds a function to retrieve the renderable DXGI format for a GL internal format.

TRAC #23273 Authored-by: Shannon Woods Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens
parent ddb785c2
...@@ -2451,7 +2451,7 @@ int Renderer11::getMaxSupportedSamples() const ...@@ -2451,7 +2451,7 @@ int Renderer11::getMaxSupportedSamples() const
GLsizei Renderer11::getMaxSupportedFormatSamples(GLint internalFormat) const GLsizei Renderer11::getMaxSupportedFormatSamples(GLint internalFormat) const
{ {
DXGI_FORMAT format = gl_d3d11::GetTexFormat(internalFormat, getCurrentClientVersion()); DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format); MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
return (iter != mMultisampleSupportMap.end()) ? iter->second.maxSupportedSamples : 0; return (iter != mMultisampleSupportMap.end()) ? iter->second.maxSupportedSamples : 0;
} }
......
...@@ -1011,6 +1011,19 @@ DXGI_FORMAT GetDSVFormat(GLint internalFormat, GLuint clientVersion) ...@@ -1011,6 +1011,19 @@ DXGI_FORMAT GetDSVFormat(GLint internalFormat, GLuint clientVersion)
} }
} }
// Given a GL internal format, this function returns the DSV format if it is depth- or stencil-renderable,
// the RTV format if it is color-renderable, and the (nonrenderable) texture format otherwise.
DXGI_FORMAT GetRenderableFormat(GLint internalFormat, GLuint clientVersion)
{
DXGI_FORMAT targetFormat = GetDSVFormat(internalFormat, clientVersion);
if (targetFormat == DXGI_FORMAT_UNKNOWN)
targetFormat = GetRTVFormat(internalFormat, clientVersion);
if (targetFormat == DXGI_FORMAT_UNKNOWN)
targetFormat = GetTexFormat(internalFormat, clientVersion);
return targetFormat;
}
} }
namespace d3d11_gl namespace d3d11_gl
......
...@@ -48,6 +48,7 @@ DXGI_FORMAT GetTexFormat(GLint internalFormat, GLuint clientVersion); ...@@ -48,6 +48,7 @@ DXGI_FORMAT GetTexFormat(GLint internalFormat, GLuint clientVersion);
DXGI_FORMAT GetSRVFormat(GLint internalFormat, GLuint clientVersion); DXGI_FORMAT GetSRVFormat(GLint internalFormat, GLuint clientVersion);
DXGI_FORMAT GetRTVFormat(GLint internalFormat, GLuint clientVersion); DXGI_FORMAT GetRTVFormat(GLint internalFormat, GLuint clientVersion);
DXGI_FORMAT GetDSVFormat(GLint internalFormat, GLuint clientVersion); DXGI_FORMAT GetDSVFormat(GLint internalFormat, GLuint clientVersion);
DXGI_FORMAT GetRenderableFormat(GLint internalFormat, GLuint clientVersion);
} }
......
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