Commit b602f0dc by Nicolas Capens

Enumerate multisampled EGL configs.

Bug 23535380 Change-Id: I4bc3d9821812253df46262f59d9a55a5802f00b0 Reviewed-on: https://swiftshader-review.googlesource.com/3936Reviewed-by: 's avatarGreg Hartman <ghartman@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 3ff330f7
...@@ -143,7 +143,7 @@ Config::Config(const DisplayMode &displayMode, EGLint minInterval, EGLint maxInt ...@@ -143,7 +143,7 @@ Config::Config(const DisplayMode &displayMode, EGLint minInterval, EGLint maxInt
| EGL_OPENGL_ES3_BIT | EGL_OPENGL_ES3_BIT
#endif #endif
; ;
mSampleBuffers = multiSample ? 1 : 0; mSampleBuffers = (multiSample > 0) ? 1 : 0;
mSamples = multiSample; mSamples = multiSample;
mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT; mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
mTransparentType = EGL_NONE; mTransparentType = EGL_NONE;
......
...@@ -134,6 +134,13 @@ bool Display::initialize() ...@@ -134,6 +134,13 @@ bool Display::initialize()
mMinSwapInterval = 0; mMinSwapInterval = 0;
mMaxSwapInterval = 4; mMaxSwapInterval = 4;
const int samples[] =
{
0,
2,
4
};
const sw::Format renderTargetFormats[] = const sw::Format renderTargetFormats[] =
{ {
sw::FORMAT_A1R5G5B5, sw::FORMAT_A1R5G5B5,
...@@ -161,6 +168,8 @@ bool Display::initialize() ...@@ -161,6 +168,8 @@ bool Display::initialize()
DisplayMode currentDisplayMode = getDisplayMode(); DisplayMode currentDisplayMode = getDisplayMode();
ConfigSet configSet; ConfigSet configSet;
for(int samplesIndex = 0; samplesIndex < sizeof(samples) / sizeof(int); samplesIndex++)
{
for(int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(sw::Format); formatIndex++) for(int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(sw::Format); formatIndex++)
{ {
sw::Format renderTargetFormat = renderTargetFormats[formatIndex]; sw::Format renderTargetFormat = renderTargetFormats[formatIndex];
...@@ -169,9 +178,8 @@ bool Display::initialize() ...@@ -169,9 +178,8 @@ bool Display::initialize()
{ {
sw::Format depthStencilFormat = depthStencilFormats[depthStencilIndex]; sw::Format depthStencilFormat = depthStencilFormats[depthStencilIndex];
// FIXME: enumerate multi-sampling configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, samples[samplesIndex]);
}
configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, 0);
} }
} }
......
...@@ -83,11 +83,11 @@ bool Surface::initialize() ...@@ -83,11 +83,11 @@ bool Surface::initialize()
{ {
if(libGLES_CM) if(libGLES_CM)
{ {
depthStencil = libGLES_CM->createDepthStencil(width, height, config->mDepthStencilFormat, 1, false); depthStencil = libGLES_CM->createDepthStencil(width, height, config->mDepthStencilFormat, config->mSamples, false);
} }
else if(libGLESv2) else if(libGLESv2)
{ {
depthStencil = libGLESv2->createDepthStencil(width, height, config->mDepthStencilFormat, 1, false); depthStencil = libGLESv2->createDepthStencil(width, height, config->mDepthStencilFormat, config->mSamples, false);
} }
if(!depthStencil) if(!depthStencil)
......
...@@ -786,7 +786,7 @@ egl::Image *createBackBuffer(int width, int height, const egl::Config *config) ...@@ -786,7 +786,7 @@ egl::Image *createBackBuffer(int width, int height, const egl::Config *config)
{ {
if(config) if(config)
{ {
return new egl::Image(width, height, config->mRenderTargetFormat, 1, false, true); return new egl::Image(width, height, config->mRenderTargetFormat, config->mSamples, false, true);
} }
return 0; return 0;
......
...@@ -1894,7 +1894,7 @@ egl::Image *createBackBuffer(int width, int height, const egl::Config *config) ...@@ -1894,7 +1894,7 @@ egl::Image *createBackBuffer(int width, int height, const egl::Config *config)
{ {
if(config) if(config)
{ {
return new egl::Image(width, height, config->mRenderTargetFormat, 1, false, true); return new egl::Image(width, height, config->mRenderTargetFormat, config->mSamples, false, true);
} }
return 0; return 0;
......
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