Temporarily adds format conversion functions to EGL.

TRAC #21819 Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1346 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 21290e67
...@@ -29,6 +29,44 @@ namespace ...@@ -29,6 +29,44 @@ namespace
DisplayMap displays; DisplayMap displays;
} }
// D3D9_REMOVE - Temporary duplication of this conversion function until remainder of d3d types are stripped
GLenum ConvertBackBufferFormat(D3DFORMAT format)
{
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;
default:
UNREACHABLE();
}
return GL_RGBA4;
}
// D3D9_REMOVE - Temporary duplication of this conversion function until remainder of d3d types are stripped
GLenum ConvertDepthStencilFormat(D3DFORMAT format)
{
if (format == D3DFMT_INTZ)
{
return GL_DEPTH24_STENCIL8_OES;
}
switch (format)
{
case D3DFMT_D16:
case D3DFMT_D24X8:
return GL_DEPTH_COMPONENT16;
case D3DFMT_D24S8:
return GL_DEPTH24_STENCIL8_OES;
default:
UNREACHABLE();
}
return GL_DEPTH24_STENCIL8_OES;
}
egl::Display *Display::getDisplay(EGLNativeDisplayType displayId) egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
{ {
if (displays.find(displayId) != displays.end()) if (displays.find(displayId) != displays.end())
......
...@@ -23,6 +23,24 @@ ...@@ -23,6 +23,24 @@
namespace egl namespace egl
{ {
// D3D9_REMOVE - Temporary duplication of this conversion function until remainder of d3d types are stripped
D3DFORMAT ConvertRenderbufferFormat(GLenum format)
{
switch (format)
{
case GL_NONE: return D3DFMT_NULL;
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGBA8_OES: return D3DFMT_A8R8G8B8;
case GL_RGB565: return D3DFMT_R5G6B5;
case GL_RGB8_OES: return D3DFMT_X8R8G8B8;
case GL_DEPTH_COMPONENT16:
case GL_STENCIL_INDEX8:
case GL_DEPTH24_STENCIL8_OES: return D3DFMT_D24S8;
default: UNREACHABLE(); return D3DFMT_A8R8G8B8;
}
}
Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported) Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported) : mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{ {
...@@ -211,6 +229,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight) ...@@ -211,6 +229,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET, result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
mConfig->mRenderTargetFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle); mConfig->mRenderTargetFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
if (FAILED(result)) if (FAILED(result))
{ {
ERR("Could not create offscreen texture: %08lX", result); ERR("Could not create offscreen texture: %08lX", result);
......
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