Commit 00ed7a1f by Jamie Madill Committed by Commit Bot

Enable always-available extensions in gl::Context.

We can consolidate exposing these extensions in initCaps. Otherwise we have to maintain the lists in every Renderer back-end. Also do the same treatment for select egl::Display extensions. BUG=angleproject:1319 Change-Id: I529dd120c6d2cdbb789bd9dd20491e796e97f3f6 Reviewed-on: https://chromium-review.googlesource.com/345914Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 19f88f92
...@@ -149,7 +149,7 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -149,7 +149,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
{ {
ASSERT(!mRobustAccess); // Unimplemented ASSERT(!mRobustAccess); // Unimplemented
initCaps(mClientVersion); initCaps();
mState.initialize(mCaps, mExtensions, mClientVersion, GetDebug(attribs)); mState.initialize(mCaps, mExtensions, mClientVersion, GetDebug(attribs));
...@@ -2077,7 +2077,7 @@ bool Context::hasActiveTransformFeedback(GLuint program) const ...@@ -2077,7 +2077,7 @@ bool Context::hasActiveTransformFeedback(GLuint program) const
return false; return false;
} }
void Context::initCaps(GLuint clientVersion) void Context::initCaps()
{ {
mCaps = mImplementation->getNativeCaps(); mCaps = mImplementation->getNativeCaps();
...@@ -2085,19 +2085,26 @@ void Context::initCaps(GLuint clientVersion) ...@@ -2085,19 +2085,26 @@ void Context::initCaps(GLuint clientVersion)
mLimitations = mImplementation->getNativeLimitations(); mLimitations = mImplementation->getNativeLimitations();
if (clientVersion < 3) if (mClientVersion < 3)
{ {
// Disable ES3+ extensions // Disable ES3+ extensions
mExtensions.colorBufferFloat = false; mExtensions.colorBufferFloat = false;
mExtensions.eglImageExternalEssl3 = false; mExtensions.eglImageExternalEssl3 = false;
} }
if (clientVersion > 2) if (mClientVersion > 2)
{ {
// FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts // FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
//mExtensions.sRGB = false; //mExtensions.sRGB = false;
} }
// Some extensions are always available because they are implemented in the GL layer.
mExtensions.bindUniformLocation = true;
mExtensions.vertexArrayObject = true;
// Enable the no error extension if the context was created with the flag.
mExtensions.noError = mSkipValidation;
// Explicitly enable GL_KHR_debug // Explicitly enable GL_KHR_debug
mExtensions.debug = true; mExtensions.debug = true;
mExtensions.maxDebugMessageLength = 1024; mExtensions.maxDebugMessageLength = 1024;
...@@ -2126,11 +2133,11 @@ void Context::initCaps(GLuint clientVersion) ...@@ -2126,11 +2133,11 @@ void Context::initCaps(GLuint clientVersion)
// Caps are AND'd with the renderer caps because some core formats are still unsupported in // Caps are AND'd with the renderer caps because some core formats are still unsupported in
// ES3. // ES3.
formatCaps.texturable = formatCaps.texturable =
formatCaps.texturable && formatInfo.textureSupport(clientVersion, mExtensions); formatCaps.texturable && formatInfo.textureSupport(mClientVersion, mExtensions);
formatCaps.renderable = formatCaps.renderable =
formatCaps.renderable && formatInfo.renderSupport(clientVersion, mExtensions); formatCaps.renderable && formatInfo.renderSupport(mClientVersion, mExtensions);
formatCaps.filterable = formatCaps.filterable =
formatCaps.filterable && formatInfo.filterSupport(clientVersion, mExtensions); formatCaps.filterable && formatInfo.filterSupport(mClientVersion, mExtensions);
// OpenGL ES does not support multisampling with integer formats // OpenGL ES does not support multisampling with integer formats
if (!formatInfo.renderSupport || formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT) if (!formatInfo.renderSupport || formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT)
......
...@@ -435,7 +435,7 @@ class Context final : public ValidationContext ...@@ -435,7 +435,7 @@ class Context final : public ValidationContext
void initRendererString(); void initRendererString();
void initExtensionStrings(); void initExtensionStrings();
void initCaps(GLuint clientVersion); void initCaps();
std::unique_ptr<rx::ContextImpl> mImplementation; std::unique_ptr<rx::ContextImpl> mImplementation;
......
...@@ -892,6 +892,10 @@ void Display::initDisplayExtensions() ...@@ -892,6 +892,10 @@ void Display::initDisplayExtensions()
{ {
mDisplayExtensions = mImplementation->getExtensions(); mDisplayExtensions = mImplementation->getExtensions();
// Some extensions are always available because they are implemented in the EGL layer.
mDisplayExtensions.createContext = true;
mDisplayExtensions.createContextNoError = true;
// Force EGL_KHR_get_all_proc_addresses on. // Force EGL_KHR_get_all_proc_addresses on.
mDisplayExtensions.getAllProcAddresses = true; mDisplayExtensions.getAllProcAddresses = true;
......
...@@ -1055,12 +1055,8 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions ...@@ -1055,12 +1055,8 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions
// D3D11 does not support present with dirty rectangles until DXGI 1.2. // D3D11 does not support present with dirty rectangles until DXGI 1.2.
outExtensions->postSubBuffer = mRenderer11DeviceCaps.supportsDXGI1_2; outExtensions->postSubBuffer = mRenderer11DeviceCaps.supportsDXGI1_2;
outExtensions->createContext = true;
outExtensions->deviceQuery = true; outExtensions->deviceQuery = true;
outExtensions->createContextNoError = true;
outExtensions->image = true; outExtensions->image = true;
outExtensions->imageBase = true; outExtensions->imageBase = true;
outExtensions->glTexture2DImage = true; outExtensions->glTexture2DImage = true;
......
...@@ -1240,10 +1240,7 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons ...@@ -1240,10 +1240,7 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons
extensions->eglStreamConsumerExternal = true; extensions->eglStreamConsumerExternal = true;
extensions->unpackSubimage = true; extensions->unpackSubimage = true;
extensions->packSubimage = true; extensions->packSubimage = true;
extensions->vertexArrayObject = true;
extensions->noError = true;
extensions->lossyETCDecode = true; extensions->lossyETCDecode = true;
extensions->bindUniformLocation = true;
extensions->syncQuery = GetEventQuerySupport(featureLevel); extensions->syncQuery = GetEventQuerySupport(featureLevel);
// D3D11 Feature Level 10_0+ uses SV_IsFrontFace in HLSL to emulate gl_FrontFacing. // D3D11 Feature Level 10_0+ uses SV_IsFrontFace in HLSL to emulate gl_FrontFacing.
......
...@@ -530,9 +530,7 @@ void Renderer9::generateDisplayExtensions(egl::DisplayExtensions *outExtensions) ...@@ -530,9 +530,7 @@ void Renderer9::generateDisplayExtensions(egl::DisplayExtensions *outExtensions)
outExtensions->querySurfacePointer = true; outExtensions->querySurfacePointer = true;
outExtensions->windowFixedSize = true; outExtensions->windowFixedSize = true;
outExtensions->postSubBuffer = true; outExtensions->postSubBuffer = true;
outExtensions->createContext = true;
outExtensions->deviceQuery = true; outExtensions->deviceQuery = true;
outExtensions->createContextNoError = true;
outExtensions->image = true; outExtensions->image = true;
outExtensions->imageBase = true; outExtensions->imageBase = true;
......
...@@ -593,9 +593,6 @@ void GenerateCaps(IDirect3D9 *d3d9, ...@@ -593,9 +593,6 @@ void GenerateCaps(IDirect3D9 *d3d9,
extensions->eglImageExternal = true; extensions->eglImageExternal = true;
extensions->unpackSubimage = true; extensions->unpackSubimage = true;
extensions->packSubimage = true; extensions->packSubimage = true;
extensions->vertexArrayObject = true;
extensions->noError = true;
extensions->bindUniformLocation = true;
extensions->syncQuery = extensions->fence; extensions->syncQuery = extensions->fence;
// D3D9 has no concept of separate masks and refs for front and back faces in the depth stencil // D3D9 has no concept of separate masks and refs for front and back faces in the depth stencil
......
...@@ -251,8 +251,6 @@ const FunctionsGL *DisplayCGL::getFunctionsGL() const ...@@ -251,8 +251,6 @@ const FunctionsGL *DisplayCGL::getFunctionsGL() const
void DisplayCGL::generateExtensions(egl::DisplayExtensions *outExtensions) const void DisplayCGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
{ {
outExtensions->createContext = true;
outExtensions->createContextNoError = true;
} }
void DisplayCGL::generateCaps(egl::Caps *outCaps) const void DisplayCGL::generateCaps(egl::Caps *outCaps) const
......
...@@ -1000,8 +1000,6 @@ const FunctionsGL *DisplayOzone::getFunctionsGL() const ...@@ -1000,8 +1000,6 @@ const FunctionsGL *DisplayOzone::getFunctionsGL() const
void DisplayOzone::generateExtensions(egl::DisplayExtensions *outExtensions) const void DisplayOzone::generateExtensions(egl::DisplayExtensions *outExtensions) const
{ {
outExtensions->createContext = true;
outExtensions->createContextNoError = true;
} }
void DisplayOzone::generateCaps(egl::Caps *outCaps) const void DisplayOzone::generateCaps(egl::Caps *outCaps) const
......
...@@ -887,8 +887,6 @@ const FunctionsGL *DisplayGLX::getFunctionsGL() const ...@@ -887,8 +887,6 @@ const FunctionsGL *DisplayGLX::getFunctionsGL() const
void DisplayGLX::generateExtensions(egl::DisplayExtensions *outExtensions) const void DisplayGLX::generateExtensions(egl::DisplayExtensions *outExtensions) const
{ {
outExtensions->createContext = true;
outExtensions->createContextNoError = true;
} }
void DisplayGLX::generateCaps(egl::Caps *outCaps) const void DisplayGLX::generateCaps(egl::Caps *outCaps) const
......
...@@ -665,13 +665,6 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM ...@@ -665,13 +665,6 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM
extensions->framebufferMixedSamples = functions->hasGLExtension("GL_NV_framebuffer_mixed_samples") || extensions->framebufferMixedSamples = functions->hasGLExtension("GL_NV_framebuffer_mixed_samples") ||
functions->hasGLESExtension("GL_NV_framebuffer_mixed_samples"); functions->hasGLESExtension("GL_NV_framebuffer_mixed_samples");
// ANGLE emulates vertex array objects in its GL layer
extensions->vertexArrayObject = true;
extensions->noError = true;
extensions->bindUniformLocation = true;
} }
void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds) void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds)
......
...@@ -621,12 +621,8 @@ egl::Error DisplayWGL::initializeD3DDevice() ...@@ -621,12 +621,8 @@ egl::Error DisplayWGL::initializeD3DDevice()
void DisplayWGL::generateExtensions(egl::DisplayExtensions *outExtensions) const void DisplayWGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
{ {
outExtensions->createContext = true;
outExtensions->createContextNoError = true;
// Only enable the surface orientation and post sub buffer for DXGI swap chain surfaces, they // Only enable the surface orientation and post sub buffer for DXGI swap chain surfaces, they
// prefer to swap with // prefer to swap with inverted Y.
// inverted Y.
outExtensions->postSubBuffer = mUseDXGISwapChains; outExtensions->postSubBuffer = mUseDXGISwapChains;
outExtensions->surfaceOrientation = mUseDXGISwapChains; outExtensions->surfaceOrientation = mUseDXGISwapChains;
} }
......
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