Commit 3533125c by Nicolas Capens Committed by Nicolas Capens

Don't treat A8R8G8B8 on an X8R8G8B8 display as a slow EGL config.

Bug 18510357 Change-Id: I0cd62227d3ba00c7bf5f70a8c2a2748f8cdc5242 Reviewed-on: https://swiftshader-review.googlesource.com/1481Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 0270476a
......@@ -24,14 +24,9 @@ using namespace std;
namespace egl
{
Config::Config(DisplayMode displayMode, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
Config::Config(const DisplayMode &displayMode, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
: mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
{
set(displayMode, minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample);
}
void Config::set(DisplayMode displayMode, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
{
mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE;
......@@ -81,7 +76,7 @@ void Config::set(DisplayMode displayMode, EGLint minInterval, EGLint maxInterval
mLuminanceSize = 0;
mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER;
mConfigCaveat = (displayMode.format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
mConfigCaveat = isSlowConfig() ? EGL_SLOW_CONFIG : EGL_NONE;
mConfigID = 0;
mConformant = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT;
......@@ -156,6 +151,16 @@ EGLConfig Config::getHandle() const
return (EGLConfig)(size_t)mConfigID;
}
bool Config::isSlowConfig() const
{
if(mDisplayMode.format == sw::FORMAT_X8R8G8B8 && mRenderTargetFormat == sw::FORMAT_A8R8G8B8)
{
return false;
}
return mDisplayMode.format != mRenderTargetFormat;
}
SortConfig::SortConfig(const EGLint *attribList)
: mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false)
{
......
......@@ -37,10 +37,10 @@ struct DisplayMode
class Config
{
public:
Config(DisplayMode displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
Config(const DisplayMode &displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
void set(DisplayMode displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
EGLConfig getHandle() const;
bool isSlowConfig() const;
const DisplayMode mDisplayMode;
const sw::Format mRenderTargetFormat;
......
......@@ -24,14 +24,9 @@ using namespace std;
namespace egl
{
Config::Config(DisplayMode displayMode, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
Config::Config(const DisplayMode &displayMode, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
: mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
{
set(displayMode, minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample);
}
void Config::set(DisplayMode displayMode, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
{
mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE;
......@@ -81,7 +76,7 @@ void Config::set(DisplayMode displayMode, EGLint minInterval, EGLint maxInterval
mLuminanceSize = 0;
mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER;
mConfigCaveat = (displayMode.format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
mConfigCaveat = isSlowConfig() ? EGL_SLOW_CONFIG : EGL_NONE;
mConfigID = 0;
mConformant = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT;
......@@ -156,6 +151,16 @@ EGLConfig Config::getHandle() const
return (EGLConfig)(size_t)mConfigID;
}
bool Config::isSlowConfig() const
{
if(mDisplayMode.format == sw::FORMAT_X8R8G8B8 && mRenderTargetFormat == sw::FORMAT_A8R8G8B8)
{
return false;
}
return mDisplayMode.format != mRenderTargetFormat;
}
SortConfig::SortConfig(const EGLint *attribList)
: mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false)
{
......@@ -349,7 +354,7 @@ bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint
}
else
{
*numConfig = passed.size();
*numConfig = static_cast<EGLint>(passed.size());
}
return true;
......
......@@ -37,10 +37,10 @@ struct DisplayMode
class Config
{
public:
Config(DisplayMode displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
Config(const DisplayMode &displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
void set(DisplayMode displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
EGLConfig getHandle() const;
bool isSlowConfig() const;
const DisplayMode mDisplayMode;
const sw::Format mRenderTargetFormat;
......
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