Adds function to convert depth *and* backbuffer formats.

TRAC #22092 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1428 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent b9bb2793
...@@ -429,6 +429,34 @@ GLenum ConvertDepthStencilFormat(D3DFORMAT format) ...@@ -429,6 +429,34 @@ GLenum ConvertDepthStencilFormat(D3DFORMAT format)
return GL_DEPTH24_STENCIL8_OES; return GL_DEPTH24_STENCIL8_OES;
} }
GLenum ConvertRenderTargetFormat(D3DFORMAT format)
{
if (format == D3DFMT_INTZ)
{
return GL_DEPTH24_STENCIL8_OES;
}
switch (format)
{
case D3DFMT_A4R4G4B4: return GL_RGBA4;
case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
case D3DFMT_R5G6B5: return GL_RGB565;
case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
case D3DFMT_D16:
case D3DFMT_D24X8:
return GL_DEPTH_COMPONENT16;
case D3DFMT_D24S8:
return GL_DEPTH24_STENCIL8_OES;
case D3DFMT_UNKNOWN:
return GL_NONE;
default:
UNREACHABLE();
}
return GL_RGBA4;
}
GLenum GetEquivalentFormat(D3DFORMAT format) GLenum GetEquivalentFormat(D3DFORMAT format)
{ {
if (format == D3DFMT_INTZ) if (format == D3DFMT_INTZ)
......
...@@ -52,6 +52,7 @@ GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type); ...@@ -52,6 +52,7 @@ GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format); bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
GLenum ConvertBackBufferFormat(D3DFORMAT format); GLenum ConvertBackBufferFormat(D3DFORMAT format);
GLenum ConvertDepthStencilFormat(D3DFORMAT format); GLenum ConvertDepthStencilFormat(D3DFORMAT format);
GLenum ConvertRenderTargetFormat(D3DFORMAT format);
GLenum GetEquivalentFormat(D3DFORMAT format); GLenum GetEquivalentFormat(D3DFORMAT format);
} }
......
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