Commit c223dc6b by Geoff Lang

Change Config to a struct and rename it's members.

BUG=angle:658 Change-Id: I18dab915730fc28815db8080b3614da821f9c8b1 Reviewed-on: https://chromium-review.googlesource.com/239901Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 6812a55c
......@@ -27,122 +27,122 @@ Config::Config()
}
Config::Config(rx::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLint texWidth, EGLint texHeight)
: mRenderTargetFormat(desc.renderTargetFormat), mDepthStencilFormat(desc.depthStencilFormat), mMultiSample(desc.multiSample)
: renderTargetFormat(desc.renderTargetFormat), depthStencilFormat(desc.depthStencilFormat), multiSample(desc.multiSample)
{
mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE;
bindToTextureRGB = EGL_FALSE;
bindToTextureRGBA = EGL_FALSE;
switch (desc.renderTargetFormat)
{
case GL_RGB5_A1:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 5;
mBlueSize = 5;
mAlphaSize = 1;
bufferSize = 16;
redSize = 5;
greenSize = 5;
blueSize = 5;
alphaSize = 1;
break;
case GL_BGR5_A1_ANGLEX:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 5;
mBlueSize = 5;
mAlphaSize = 1;
bufferSize = 16;
redSize = 5;
greenSize = 5;
blueSize = 5;
alphaSize = 1;
break;
case GL_RGBA8_OES:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
mBlueSize = 8;
mAlphaSize = 8;
mBindToTextureRGBA = true;
bufferSize = 32;
redSize = 8;
greenSize = 8;
blueSize = 8;
alphaSize = 8;
bindToTextureRGBA = true;
break;
case GL_RGB565:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 6;
mBlueSize = 5;
mAlphaSize = 0;
bufferSize = 16;
redSize = 5;
greenSize = 6;
blueSize = 5;
alphaSize = 0;
break;
case GL_RGB8_OES:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
mBlueSize = 8;
mAlphaSize = 0;
mBindToTextureRGB = true;
bufferSize = 32;
redSize = 8;
greenSize = 8;
blueSize = 8;
alphaSize = 0;
bindToTextureRGB = true;
break;
case GL_BGRA8_EXT:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
mBlueSize = 8;
mAlphaSize = 8;
mBindToTextureRGBA = true;
bufferSize = 32;
redSize = 8;
greenSize = 8;
blueSize = 8;
alphaSize = 8;
bindToTextureRGBA = true;
break;
default:
UNREACHABLE(); // Other formats should not be valid
}
mLuminanceSize = 0;
mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER;
mConfigCaveat = (desc.fastConfig) ? EGL_NONE : EGL_SLOW_CONFIG;
mConfigID = 0;
mConformant = 0;
luminanceSize = 0;
alphaMaskSize = 0;
colorBufferType = EGL_RGB_BUFFER;
configCaveat = (desc.fastConfig) ? EGL_NONE : EGL_SLOW_CONFIG;
configID = 0;
conformant = 0;
switch (desc.depthStencilFormat)
{
case GL_NONE:
mDepthSize = 0;
mStencilSize = 0;
depthSize = 0;
stencilSize = 0;
break;
case GL_DEPTH_COMPONENT32_OES:
mDepthSize = 32;
mStencilSize = 0;
depthSize = 32;
stencilSize = 0;
break;
case GL_DEPTH24_STENCIL8_OES:
mDepthSize = 24;
mStencilSize = 8;
depthSize = 24;
stencilSize = 8;
break;
case GL_DEPTH_COMPONENT24_OES:
mDepthSize = 24;
mStencilSize = 0;
depthSize = 24;
stencilSize = 0;
break;
case GL_DEPTH_COMPONENT16:
mDepthSize = 16;
mStencilSize = 0;
depthSize = 16;
stencilSize = 0;
break;
default:
UNREACHABLE();
}
mLevel = 0;
mMatchNativePixmap = EGL_NONE;
mMaxPBufferWidth = texWidth;
mMaxPBufferHeight = texHeight;
mMaxPBufferPixels = texWidth*texHeight;
mMaxSwapInterval = maxInterval;
mMinSwapInterval = minInterval;
mNativeRenderable = EGL_FALSE;
mNativeVisualID = 0;
mNativeVisualType = 0;
mRenderableType = EGL_OPENGL_ES2_BIT;
mSampleBuffers = desc.multiSample ? 1 : 0;
mSamples = desc.multiSample;
mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
mTransparentType = EGL_NONE;
mTransparentRedValue = 0;
mTransparentGreenValue = 0;
mTransparentBlueValue = 0;
level = 0;
matchNativePixmap = EGL_NONE;
maxPBufferWidth = texWidth;
maxPBufferHeight = texHeight;
maxPBufferPixels = texWidth*texHeight;
maxSwapInterval = maxInterval;
minSwapInterval = minInterval;
nativeRenderable = EGL_FALSE;
nativeVisualID = 0;
nativeVisualType = 0;
renderableType = EGL_OPENGL_ES2_BIT;
sampleBuffers = desc.multiSample ? 1 : 0;
samples = desc.multiSample;
surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
transparentType = EGL_NONE;
transparentRedValue = 0;
transparentGreenValue = 0;
transparentBlueValue = 0;
if (desc.es2Conformant)
{
mConformant = EGL_OPENGL_ES2_BIT;
conformant = EGL_OPENGL_ES2_BIT;
}
if (desc.es3Capable)
{
mRenderableType |= EGL_OPENGL_ES3_BIT_KHR;
mConformant |= EGL_OPENGL_ES3_BIT_KHR;
renderableType |= EGL_OPENGL_ES3_BIT_KHR;
conformant |= EGL_OPENGL_ES3_BIT_KHR;
}
}
......@@ -152,7 +152,7 @@ EGLint ConfigSet::add(const Config &config)
EGLint id = mConfigs.size() + 1;
Config copyConfig(config);
copyConfig.mConfigID = id;
copyConfig.configID = id;
mConfigs.insert(std::make_pair(id, copyConfig));
return id;
......@@ -210,10 +210,10 @@ class ConfigSorter
}
META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
SORT(mConfigCaveat);
SORT(configCaveat);
META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
SORT(mColorBufferType);
SORT(colorBufferType);
// By larger total number of color bits, only considering those that are requested to be > 0.
EGLint xComponentsSize = wantedComponentsSize(x);
......@@ -223,14 +223,14 @@ class ConfigSorter
return xComponentsSize > yComponentsSize;
}
SORT(mBufferSize);
SORT(mSampleBuffers);
SORT(mSamples);
SORT(mDepthSize);
SORT(mStencilSize);
SORT(mAlphaMaskSize);
SORT(mNativeVisualType);
SORT(mConfigID);
SORT(bufferSize);
SORT(sampleBuffers);
SORT(samples);
SORT(depthSize);
SORT(stencilSize);
SORT(alphaMaskSize);
SORT(nativeVisualType);
SORT(configID);
#undef SORT
......@@ -265,11 +265,11 @@ class ConfigSorter
{
EGLint total = 0;
if (mWantRed) total += config.mRedSize;
if (mWantGreen) total += config.mGreenSize;
if (mWantBlue) total += config.mBlueSize;
if (mWantAlpha) total += config.mAlphaSize;
if (mWantLuminance) total += config.mLuminanceSize;
if (mWantRed) total += config.redSize;
if (mWantGreen) total += config.greenSize;
if (mWantBlue) total += config.blueSize;
if (mWantAlpha) total += config.alphaSize;
if (mWantLuminance) total += config.luminanceSize;
return total;
}
......@@ -298,38 +298,38 @@ std::vector<const Config*> ConfigSet::filter(const AttributeMap &attributeMap) c
switch (attributeKey)
{
case EGL_BUFFER_SIZE: match = config.mBufferSize >= attributeValue; break;
case EGL_ALPHA_SIZE: match = config.mAlphaSize >= attributeValue; break;
case EGL_BLUE_SIZE: match = config.mBlueSize >= attributeValue; break;
case EGL_GREEN_SIZE: match = config.mGreenSize >= attributeValue; break;
case EGL_RED_SIZE: match = config.mRedSize >= attributeValue; break;
case EGL_DEPTH_SIZE: match = config.mDepthSize >= attributeValue; break;
case EGL_STENCIL_SIZE: match = config.mStencilSize >= attributeValue; break;
case EGL_CONFIG_CAVEAT: match = config.mConfigCaveat == (EGLenum)attributeValue; break;
case EGL_CONFIG_ID: match = config.mConfigID == attributeValue; break;
case EGL_LEVEL: match = config.mLevel >= attributeValue; break;
case EGL_NATIVE_RENDERABLE: match = config.mNativeRenderable == (EGLBoolean)attributeValue; break;
case EGL_NATIVE_VISUAL_TYPE: match = config.mNativeVisualType == attributeValue; break;
case EGL_SAMPLES: match = config.mSamples >= attributeValue; break;
case EGL_SAMPLE_BUFFERS: match = config.mSampleBuffers >= attributeValue; break;
case EGL_SURFACE_TYPE: match = (config.mSurfaceType & attributeValue) == attributeValue; break;
case EGL_TRANSPARENT_TYPE: match = config.mTransparentType == (EGLenum)attributeValue; break;
case EGL_TRANSPARENT_BLUE_VALUE: match = config.mTransparentBlueValue == attributeValue; break;
case EGL_TRANSPARENT_GREEN_VALUE: match = config.mTransparentGreenValue == attributeValue; break;
case EGL_TRANSPARENT_RED_VALUE: match = config.mTransparentRedValue == attributeValue; break;
case EGL_BIND_TO_TEXTURE_RGB: match = config.mBindToTextureRGB == (EGLBoolean)attributeValue; break;
case EGL_BIND_TO_TEXTURE_RGBA: match = config.mBindToTextureRGBA == (EGLBoolean)attributeValue; break;
case EGL_MIN_SWAP_INTERVAL: match = config.mMinSwapInterval == attributeValue; break;
case EGL_MAX_SWAP_INTERVAL: match = config.mMaxSwapInterval == attributeValue; break;
case EGL_LUMINANCE_SIZE: match = config.mLuminanceSize >= attributeValue; break;
case EGL_ALPHA_MASK_SIZE: match = config.mAlphaMaskSize >= attributeValue; break;
case EGL_COLOR_BUFFER_TYPE: match = config.mColorBufferType == (EGLenum)attributeValue; break;
case EGL_RENDERABLE_TYPE: match = (config.mRenderableType & attributeValue) == attributeValue; break;
case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
case EGL_CONFORMANT: match = (config.mConformant & attributeValue) == attributeValue; break;
case EGL_MAX_PBUFFER_WIDTH: match = config.mMaxPBufferWidth >= attributeValue; break;
case EGL_MAX_PBUFFER_HEIGHT: match = config.mMaxPBufferHeight >= attributeValue; break;
case EGL_MAX_PBUFFER_PIXELS: match = config.mMaxPBufferPixels >= attributeValue; break;
case EGL_BUFFER_SIZE: match = config.bufferSize >= attributeValue; break;
case EGL_ALPHA_SIZE: match = config.alphaSize >= attributeValue; break;
case EGL_BLUE_SIZE: match = config.blueSize >= attributeValue; break;
case EGL_GREEN_SIZE: match = config.greenSize >= attributeValue; break;
case EGL_RED_SIZE: match = config.redSize >= attributeValue; break;
case EGL_DEPTH_SIZE: match = config.depthSize >= attributeValue; break;
case EGL_STENCIL_SIZE: match = config.stencilSize >= attributeValue; break;
case EGL_CONFIG_CAVEAT: match = config.configCaveat == (EGLenum)attributeValue; break;
case EGL_CONFIG_ID: match = config.configID == attributeValue; break;
case EGL_LEVEL: match = config.level >= attributeValue; break;
case EGL_NATIVE_RENDERABLE: match = config.nativeRenderable == (EGLBoolean)attributeValue; break;
case EGL_NATIVE_VISUAL_TYPE: match = config.nativeVisualType == attributeValue; break;
case EGL_SAMPLES: match = config.samples >= attributeValue; break;
case EGL_SAMPLE_BUFFERS: match = config.sampleBuffers >= attributeValue; break;
case EGL_SURFACE_TYPE: match = (config.surfaceType & attributeValue) == attributeValue; break;
case EGL_TRANSPARENT_TYPE: match = config.transparentType == (EGLenum)attributeValue; break;
case EGL_TRANSPARENT_BLUE_VALUE: match = config.transparentBlueValue == attributeValue; break;
case EGL_TRANSPARENT_GREEN_VALUE: match = config.transparentGreenValue == attributeValue; break;
case EGL_TRANSPARENT_RED_VALUE: match = config.transparentRedValue == attributeValue; break;
case EGL_BIND_TO_TEXTURE_RGB: match = config.bindToTextureRGB == (EGLBoolean)attributeValue; break;
case EGL_BIND_TO_TEXTURE_RGBA: match = config.bindToTextureRGBA == (EGLBoolean)attributeValue; break;
case EGL_MIN_SWAP_INTERVAL: match = config.minSwapInterval == attributeValue; break;
case EGL_MAX_SWAP_INTERVAL: match = config.maxSwapInterval == attributeValue; break;
case EGL_LUMINANCE_SIZE: match = config.luminanceSize >= attributeValue; break;
case EGL_ALPHA_MASK_SIZE: match = config.alphaMaskSize >= attributeValue; break;
case EGL_COLOR_BUFFER_TYPE: match = config.colorBufferType == (EGLenum)attributeValue; break;
case EGL_RENDERABLE_TYPE: match = (config.renderableType & attributeValue) == attributeValue; break;
case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
case EGL_CONFORMANT: match = (config.conformant & attributeValue) == attributeValue; break;
case EGL_MAX_PBUFFER_WIDTH: match = config.maxPBufferWidth >= attributeValue; break;
case EGL_MAX_PBUFFER_HEIGHT: match = config.maxPBufferHeight >= attributeValue; break;
case EGL_MAX_PBUFFER_PIXELS: match = config.maxPBufferPixels >= attributeValue; break;
default: UNREACHABLE();
}
......
......@@ -22,51 +22,49 @@
namespace egl
{
class Display;
class Config
struct Config
{
public:
Config();
Config(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight);
GLenum mRenderTargetFormat;
GLenum mDepthStencilFormat;
GLint mMultiSample;
EGLint mBufferSize; // Depth of the color buffer
EGLint mRedSize; // Bits of Red in the color buffer
EGLint mGreenSize; // Bits of Green in the color buffer
EGLint mBlueSize; // Bits of Blue in the color buffer
EGLint mLuminanceSize; // Bits of Luminance in the color buffer
EGLint mAlphaSize; // Bits of Alpha in the color buffer
EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer
EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures.
EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures.
EGLenum mColorBufferType; // Color buffer type
EGLenum mConfigCaveat; // Any caveats for the configuration
EGLint mConfigID; // Unique EGLConfig identifier
EGLint mConformant; // Whether contexts created with this config are conformant
EGLint mDepthSize; // Bits of Z in the depth buffer
EGLint mLevel; // Frame buffer level
EGLBoolean mMatchNativePixmap; // Match the native pixmap format
EGLint mMaxPBufferWidth; // Maximum width of pbuffer
EGLint mMaxPBufferHeight; // Maximum height of pbuffer
EGLint mMaxPBufferPixels; // Maximum size of pbuffer
EGLint mMaxSwapInterval; // Maximum swap interval
EGLint mMinSwapInterval; // Minimum swap interval
EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
EGLint mNativeVisualID; // Handle of corresponding native visual
EGLint mNativeVisualType; // Native visual type of the associated visual
EGLint mRenderableType; // Which client rendering APIs are supported.
EGLint mSampleBuffers; // Number of multisample buffers
EGLint mSamples; // Number of samples per pixel
EGLint mStencilSize; // Bits of Stencil in the stencil buffer
EGLint mSurfaceType; // Which types of EGL surfaces are supported.
EGLenum mTransparentType; // Type of transparency supported
EGLint mTransparentRedValue; // Transparent red value
EGLint mTransparentGreenValue; // Transparent green value
EGLint mTransparentBlueValue; // Transparent blue value
GLenum renderTargetFormat; // TODO(geofflang): remove this
GLenum depthStencilFormat; // TODO(geofflang): remove this
GLint multiSample; // TODO(geofflang): remove this
EGLint bufferSize; // Depth of the color buffer
EGLint redSize; // Bits of Red in the color buffer
EGLint greenSize; // Bits of Green in the color buffer
EGLint blueSize; // Bits of Blue in the color buffer
EGLint luminanceSize; // Bits of Luminance in the color buffer
EGLint alphaSize; // Bits of Alpha in the color buffer
EGLint alphaMaskSize; // Bits of Alpha Mask in the mask buffer
EGLBoolean bindToTextureRGB; // True if bindable to RGB textures.
EGLBoolean bindToTextureRGBA; // True if bindable to RGBA textures.
EGLenum colorBufferType; // Color buffer type
EGLenum configCaveat; // Any caveats for the configuration
EGLint configID; // Unique EGLConfig identifier
EGLint conformant; // Whether contexts created with this config are conformant
EGLint depthSize; // Bits of Z in the depth buffer
EGLint level; // Frame buffer level
EGLBoolean matchNativePixmap; // Match the native pixmap format
EGLint maxPBufferWidth; // Maximum width of pbuffer
EGLint maxPBufferHeight; // Maximum height of pbuffer
EGLint maxPBufferPixels; // Maximum size of pbuffer
EGLint maxSwapInterval; // Maximum swap interval
EGLint minSwapInterval; // Minimum swap interval
EGLBoolean nativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
EGLint nativeVisualID; // Handle of corresponding native visual
EGLint nativeVisualType; // Native visual type of the associated visual
EGLint renderableType; // Which client rendering APIs are supported.
EGLint sampleBuffers; // Number of multisample buffers
EGLint samples; // Number of samples per pixel
EGLint stencilSize; // Bits of Stencil in the stencil buffer
EGLint surfaceType; // Which types of EGL surfaces are supported.
EGLenum transparentType; // Type of transparency supported
EGLint transparentRedValue; // Transparent red value
EGLint transparentGreenValue; // Transparent green value
EGLint transparentBlueValue; // Transparent blue value
};
class ConfigSet
......
......@@ -183,38 +183,38 @@ bool Display::getConfigAttrib(const Config *configuration, EGLint attribute, EGL
{
switch (attribute)
{
case EGL_BUFFER_SIZE: *value = configuration->mBufferSize; break;
case EGL_ALPHA_SIZE: *value = configuration->mAlphaSize; break;
case EGL_BLUE_SIZE: *value = configuration->mBlueSize; break;
case EGL_GREEN_SIZE: *value = configuration->mGreenSize; break;
case EGL_RED_SIZE: *value = configuration->mRedSize; break;
case EGL_DEPTH_SIZE: *value = configuration->mDepthSize; break;
case EGL_STENCIL_SIZE: *value = configuration->mStencilSize; break;
case EGL_CONFIG_CAVEAT: *value = configuration->mConfigCaveat; break;
case EGL_CONFIG_ID: *value = configuration->mConfigID; break;
case EGL_LEVEL: *value = configuration->mLevel; break;
case EGL_NATIVE_RENDERABLE: *value = configuration->mNativeRenderable; break;
case EGL_NATIVE_VISUAL_TYPE: *value = configuration->mNativeVisualType; break;
case EGL_SAMPLES: *value = configuration->mSamples; break;
case EGL_SAMPLE_BUFFERS: *value = configuration->mSampleBuffers; break;
case EGL_SURFACE_TYPE: *value = configuration->mSurfaceType; break;
case EGL_TRANSPARENT_TYPE: *value = configuration->mTransparentType; break;
case EGL_TRANSPARENT_BLUE_VALUE: *value = configuration->mTransparentBlueValue; break;
case EGL_TRANSPARENT_GREEN_VALUE: *value = configuration->mTransparentGreenValue; break;
case EGL_TRANSPARENT_RED_VALUE: *value = configuration->mTransparentRedValue; break;
case EGL_BIND_TO_TEXTURE_RGB: *value = configuration->mBindToTextureRGB; break;
case EGL_BIND_TO_TEXTURE_RGBA: *value = configuration->mBindToTextureRGBA; break;
case EGL_MIN_SWAP_INTERVAL: *value = configuration->mMinSwapInterval; break;
case EGL_MAX_SWAP_INTERVAL: *value = configuration->mMaxSwapInterval; break;
case EGL_LUMINANCE_SIZE: *value = configuration->mLuminanceSize; break;
case EGL_ALPHA_MASK_SIZE: *value = configuration->mAlphaMaskSize; break;
case EGL_COLOR_BUFFER_TYPE: *value = configuration->mColorBufferType; break;
case EGL_RENDERABLE_TYPE: *value = configuration->mRenderableType; break;
case EGL_MATCH_NATIVE_PIXMAP: *value = false; UNIMPLEMENTED(); break;
case EGL_CONFORMANT: *value = configuration->mConformant; break;
case EGL_MAX_PBUFFER_WIDTH: *value = configuration->mMaxPBufferWidth; break;
case EGL_MAX_PBUFFER_HEIGHT: *value = configuration->mMaxPBufferHeight; break;
case EGL_MAX_PBUFFER_PIXELS: *value = configuration->mMaxPBufferPixels; break;
case EGL_BUFFER_SIZE: *value = configuration->bufferSize; break;
case EGL_ALPHA_SIZE: *value = configuration->alphaSize; break;
case EGL_BLUE_SIZE: *value = configuration->blueSize; break;
case EGL_GREEN_SIZE: *value = configuration->greenSize; break;
case EGL_RED_SIZE: *value = configuration->redSize; break;
case EGL_DEPTH_SIZE: *value = configuration->depthSize; break;
case EGL_STENCIL_SIZE: *value = configuration->stencilSize; break;
case EGL_CONFIG_CAVEAT: *value = configuration->configCaveat; break;
case EGL_CONFIG_ID: *value = configuration->configID; break;
case EGL_LEVEL: *value = configuration->level; break;
case EGL_NATIVE_RENDERABLE: *value = configuration->nativeRenderable; break;
case EGL_NATIVE_VISUAL_TYPE: *value = configuration->nativeVisualType; break;
case EGL_SAMPLES: *value = configuration->samples; break;
case EGL_SAMPLE_BUFFERS: *value = configuration->sampleBuffers; break;
case EGL_SURFACE_TYPE: *value = configuration->surfaceType; break;
case EGL_TRANSPARENT_TYPE: *value = configuration->transparentType; break;
case EGL_TRANSPARENT_BLUE_VALUE: *value = configuration->transparentBlueValue; break;
case EGL_TRANSPARENT_GREEN_VALUE: *value = configuration->transparentGreenValue; break;
case EGL_TRANSPARENT_RED_VALUE: *value = configuration->transparentRedValue; break;
case EGL_BIND_TO_TEXTURE_RGB: *value = configuration->bindToTextureRGB; break;
case EGL_BIND_TO_TEXTURE_RGBA: *value = configuration->bindToTextureRGBA; break;
case EGL_MIN_SWAP_INTERVAL: *value = configuration->minSwapInterval; break;
case EGL_MAX_SWAP_INTERVAL: *value = configuration->maxSwapInterval; break;
case EGL_LUMINANCE_SIZE: *value = configuration->luminanceSize; break;
case EGL_ALPHA_MASK_SIZE: *value = configuration->alphaMaskSize; break;
case EGL_COLOR_BUFFER_TYPE: *value = configuration->colorBufferType; break;
case EGL_RENDERABLE_TYPE: *value = configuration->renderableType; break;
case EGL_MATCH_NATIVE_PIXMAP: *value = false; UNIMPLEMENTED(); break;
case EGL_CONFORMANT: *value = configuration->conformant; break;
case EGL_MAX_PBUFFER_WIDTH: *value = configuration->maxPBufferWidth; break;
case EGL_MAX_PBUFFER_HEIGHT: *value = configuration->maxPBufferHeight; break;
case EGL_MAX_PBUFFER_PIXELS: *value = configuration->maxPBufferPixels; break;
default:
return false;
}
......@@ -397,13 +397,13 @@ Error Display::createOffscreenSurface(const Config *configuration, EGLClientBuff
return Error(EGL_BAD_MATCH);
}
if (!(configuration->mSurfaceType & EGL_PBUFFER_BIT))
if (!(configuration->surfaceType & EGL_PBUFFER_BIT))
{
return Error(EGL_BAD_MATCH);
}
if ((textureFormat == EGL_TEXTURE_RGB && configuration->mBindToTextureRGB != EGL_TRUE) ||
(textureFormat == EGL_TEXTURE_RGBA && configuration->mBindToTextureRGBA != EGL_TRUE))
if ((textureFormat == EGL_TEXTURE_RGB && configuration->bindToTextureRGB != EGL_TRUE) ||
(textureFormat == EGL_TEXTURE_RGBA && configuration->bindToTextureRGBA != EGL_TRUE))
{
return Error(EGL_BAD_ATTRIBUTE);
}
......@@ -448,7 +448,7 @@ Error Display::createContext(const Config *configuration, EGLContext shareContex
}
}
if (attribs.get(EGL_CONTEXT_CLIENT_VERSION, 1) == 3 && !(configuration->mConformant & EGL_OPENGL_ES3_BIT_KHR))
if (attribs.get(EGL_CONTEXT_CLIENT_VERSION, 1) == 3 && !(configuration->conformant & EGL_OPENGL_ES3_BIT_KHR))
{
return Error(EGL_BAD_CONFIG);
}
......
......@@ -80,7 +80,7 @@ void Surface::setSwapInterval(EGLint interval)
EGLint Surface::getConfigID() const
{
return mImplementation->getConfig()->mConfigID;
return mImplementation->getConfig()->configID;
}
const Config *Surface::getConfig() const
......
......@@ -29,7 +29,7 @@ class SurfaceImpl;
namespace egl
{
class Display;
class Config;
struct Config;
class Surface final
{
......
......@@ -416,7 +416,7 @@ void Texture::bindTexImage(egl::Surface *surface)
// Set the image info to the size and format of the surface
ASSERT(mTarget == GL_TEXTURE_2D);
Extents size(surface->getWidth(), surface->getHeight(), 1);
ImageDesc desc(size, surface->getConfig()->mRenderTargetFormat);
ImageDesc desc(size, surface->getConfig()->renderTargetFormat);
setImageDesc(ImageIndex::MakeGeneric(mTarget, 0), desc);
}
......
......@@ -20,7 +20,7 @@ namespace egl
{
class AttributeMap;
class Display;
class Config;
struct Config;
class ConfigSet;
class Surface;
}
......
......@@ -35,7 +35,7 @@ SurfaceImpl::~SurfaceImpl()
EGLenum SurfaceImpl::getFormat() const
{
return mConfig->mRenderTargetFormat;
return mConfig->renderTargetFormat;
}
}
......@@ -15,7 +15,7 @@
namespace egl
{
class Display;
class Config;
struct Config;
}
namespace rx
......
......@@ -114,8 +114,8 @@ egl::Error SurfaceD3D::resetSwapChain()
}
mSwapChain = mRenderer->createSwapChain(mNativeWindow, static_cast<HANDLE>(mShareHandle),
mConfig->mRenderTargetFormat,
mConfig->mDepthStencilFormat);
mConfig->renderTargetFormat,
mConfig->depthStencilFormat);
if (!mSwapChain)
{
return egl::Error(EGL_BAD_ALLOC);
......
......@@ -15,39 +15,39 @@ static egl::Config GenerateGenericConfig()
{
egl::Config config;
config.mBufferSize = 24;
config.mRedSize = 8;
config.mGreenSize = 8;
config.mBlueSize = 8;
config.mLuminanceSize = 0;
config.mAlphaSize = 8;
config.mAlphaMaskSize = 0;
config.mBindToTextureRGB = EGL_TRUE;
config.mBindToTextureRGBA = EGL_TRUE;
config.mColorBufferType = EGL_RGB_BUFFER;
config.mConfigCaveat = EGL_NONE;
config.mConfigID = 0;
config.mConformant = EGL_OPENGL_ES2_BIT;
config.mDepthSize = 24;
config.mLevel = 0;
config.mMatchNativePixmap = EGL_NONE;
config.mMaxPBufferWidth = 1024;
config.mMaxPBufferHeight = 1024;
config.mMaxPBufferPixels = config.mMaxPBufferWidth * config.mMaxPBufferWidth;
config.mMaxSwapInterval = 0;
config.mMinSwapInterval = 4;
config.mNativeRenderable = EGL_OPENGL_ES2_BIT;
config.mNativeVisualID = 0;
config.mNativeVisualType = 0;
config.mRenderableType = EGL_FALSE;
config.mSampleBuffers = 0;
config.mSamples = 0;
config.mStencilSize = 8;
config.mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
config.mTransparentType = EGL_NONE;
config.mTransparentRedValue = 0;
config.mTransparentGreenValue = 0;
config.mTransparentBlueValue = 0;
config.bufferSize = 24;
config.redSize = 8;
config.greenSize = 8;
config.blueSize = 8;
config.luminanceSize = 0;
config.alphaSize = 8;
config.alphaMaskSize = 0;
config.bindToTextureRGB = EGL_TRUE;
config.bindToTextureRGBA = EGL_TRUE;
config.colorBufferType = EGL_RGB_BUFFER;
config.configCaveat = EGL_NONE;
config.configID = 0;
config.conformant = EGL_OPENGL_ES2_BIT;
config.depthSize = 24;
config.level = 0;
config.matchNativePixmap = EGL_NONE;
config.maxPBufferWidth = 1024;
config.maxPBufferHeight = 1024;
config.maxPBufferPixels = config.maxPBufferWidth * config.maxPBufferWidth;
config.maxSwapInterval = 0;
config.minSwapInterval = 4;
config.nativeRenderable = EGL_OPENGL_ES2_BIT;
config.nativeVisualID = 0;
config.nativeVisualType = 0;
config.renderableType = EGL_FALSE;
config.sampleBuffers = 0;
config.samples = 0;
config.stencilSize = 8;
config.surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
config.transparentType = EGL_NONE;
config.transparentRedValue = 0;
config.transparentGreenValue = 0;
config.transparentBlueValue = 0;
return config;
}
......@@ -59,7 +59,7 @@ static std::vector<egl::Config> GenerateUniqueConfigs(size_t count)
for (size_t i = 0; i < count; i++)
{
egl::Config config = GenerateGenericConfig();
config.mSamples = i;
config.samples = i;
configs.push_back(config);
}
......@@ -98,7 +98,7 @@ TEST(ConfigSetTest, IDs)
// Check that the config that was inserted has the ID that was returned
// by ConfigSet::add
EXPECT_EQ(id, set.get(id).mConfigID);
EXPECT_EQ(id, set.get(id).configID);
ids.insert(id);
}
......@@ -121,14 +121,14 @@ TEST(ConfigSetTest, Filtering_BitSizes)
EGLint(egl::Config::*ConfigMember);
};
VariableConfigBitSize testMembers[] =
VariableConfigBitSize testMembers[] =
{
{ EGL_RED_SIZE, &egl::Config::mRedSize },
{ EGL_GREEN_SIZE, &egl::Config::mGreenSize },
{ EGL_BLUE_SIZE, &egl::Config::mBlueSize },
{ EGL_ALPHA_SIZE, &egl::Config::mAlphaSize },
{ EGL_DEPTH_SIZE, &egl::Config::mDepthSize },
{ EGL_STENCIL_SIZE, &egl::Config::mStencilSize },
{ EGL_RED_SIZE, &egl::Config::redSize },
{ EGL_GREEN_SIZE, &egl::Config::greenSize },
{ EGL_BLUE_SIZE, &egl::Config::blueSize },
{ EGL_ALPHA_SIZE, &egl::Config::alphaSize },
{ EGL_DEPTH_SIZE, &egl::Config::depthSize },
{ EGL_STENCIL_SIZE, &egl::Config::stencilSize },
};
// Generate configsPerType configs with varying bit sizes of each type
......@@ -186,10 +186,10 @@ TEST(ConfigSetTest, Sorting_BitSizes)
egl::Config config = GenerateGenericConfig();
// Give random-ish bit sizes to the config
config.mRedSize = (i * 2) % 3;
config.mGreenSize = (i + 5) % 7;
config.mBlueSize = (i + 7) % 11;
config.mAlphaSize = (i + 13) % 17;
config.redSize = (i * 2) % 3;
config.greenSize = (i + 5) % 7;
config.blueSize = (i + 7) % 11;
config.alphaSize = (i + 13) % 17;
set.add(config);
}
......@@ -204,16 +204,16 @@ TEST(ConfigSetTest, Sorting_BitSizes)
for (size_t i = 1; i < filteredConfigs.size(); i++)
{
const egl::Config &prevConfig = *filteredConfigs[i - 1];
size_t prevBitCount = prevConfig.mRedSize +
prevConfig.mGreenSize +
prevConfig.mBlueSize +
prevConfig.mAlphaSize;
size_t prevBitCount = prevConfig.redSize +
prevConfig.greenSize +
prevConfig.blueSize +
prevConfig.alphaSize;
const egl::Config &curConfig = *filteredConfigs[i];
size_t curBitCount = curConfig.mRedSize +
curConfig.mGreenSize +
curConfig.mBlueSize +
curConfig.mAlphaSize;
size_t curBitCount = curConfig.redSize +
curConfig.greenSize +
curConfig.blueSize +
curConfig.alphaSize;
EXPECT_GE(prevBitCount, curBitCount);
}
......
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