Commit 702aabdb by Nicolas Capens Committed by Nicolas Capens

Call any available function for creating frame buffers.

BUG=18110152 Change-Id: I08f5b87a409cd0f788b2eb0648b7efa5ab05fada Reviewed-on: https://swiftshader-review.googlesource.com/1278Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 14ee7622
......@@ -132,7 +132,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
if(mWindow)
{
frameBuffer = es2::createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight);
frameBuffer = es::createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight);
if(!frameBuffer)
{
......@@ -142,8 +142,8 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
}
}
backBuffer = es2::createBackBuffer(backBufferWidth, backBufferHeight, mConfig);
backBuffer = es::createBackBuffer(backBufferWidth, backBufferHeight, mConfig);
if(!backBuffer)
{
ERR("Could not create back buffer");
......@@ -153,7 +153,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
if(mConfig->mDepthStencilFormat != sw::FORMAT_NULL)
{
mDepthStencil = es2::createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false);
mDepthStencil = es::createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false);
if(!mDepthStencil)
{
......
......@@ -91,9 +91,6 @@ CONSTRUCTOR static bool eglAttachProcess()
libGLES_CM = loadLibrary(libGLES_CM_lib);
es1::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLES_CM, "glCreateContext");
es1::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLES_CM, "glGetProcAddress");
es1::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLES_CM, "createBackBuffer");
es1::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLES_CM, "createDepthStencil");
es1::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLES_CM, "createFrameBuffer");
#if defined(_WIN32)
const char *libGLESv2_lib = "libGLESv2.dll";
......@@ -104,9 +101,17 @@ CONSTRUCTOR static bool eglAttachProcess()
libGLESv2 = loadLibrary(libGLESv2_lib);
es2::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext");
es2::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");
es2::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");
es2::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil");
es2::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");
es::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLES_CM, "createBackBuffer");
es::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLES_CM, "createDepthStencil");
es::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLES_CM, "createFrameBuffer");
if(!es::createBackBuffer)
{
es::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");
es::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil");
es::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");
}
return libGLES_CM != 0 || libGLESv2 != 0;
}
......@@ -274,15 +279,16 @@ namespace es1
{
egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0;
__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;
egl::Image *(*createBackBuffer)(int width, int height, const egl::Config *config) = 0;
egl::Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard) = 0;
sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height) = 0;
}
namespace es2
{
egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0;
__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;
}
namespace es
{
egl::Image *(*createBackBuffer)(int width, int height, const egl::Config *config) = 0;
egl::Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard) = 0;
sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height) = 0;
......
......@@ -87,9 +87,6 @@ namespace es1
{
extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext);
extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
extern egl::Image *(*createBackBuffer)(int width, int height, const egl::Config *config);
extern egl::Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
extern sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height);
}
// libGLESv2 dependencies
......@@ -97,6 +94,10 @@ namespace es2
{
extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext);
extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
}
namespace es
{
extern egl::Image *(*createBackBuffer)(int width, int height, const egl::Config *config);
extern egl::Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
extern sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height);
......
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