Only support ES3 contexts on Shader Model 4+ hardware.

TRAC #22854 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2126 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 1ab57be9
// //
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -378,18 +378,25 @@ EGLContext Display::createContext(EGLConfig configHandle, EGLint clientVersion, ...@@ -378,18 +378,25 @@ EGLContext Display::createContext(EGLConfig configHandle, EGLint clientVersion,
{ {
if (!mRenderer) if (!mRenderer)
{ {
return NULL; return EGL_NO_CONTEXT;
} }
else if (mRenderer->testDeviceLost(false)) // Lost device else if (mRenderer->testDeviceLost(false)) // Lost device
{ {
if (!restoreLostDevice()) if (!restoreLostDevice())
return NULL; {
return error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
}
}
if (clientVersion > 2 && mRenderer->getMajorShaderModel() < 4)
{
return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
} }
gl::Context *context = glCreateContext(clientVersion, shareContext, mRenderer, notifyResets, robustAccess); gl::Context *context = glCreateContext(clientVersion, shareContext, mRenderer, notifyResets, robustAccess);
mContextSet.insert(context); mContextSet.insert(context);
return context; return success(context);
} }
bool Display::restoreLostDevice() bool Display::restoreLostDevice()
......
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -779,7 +779,7 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte ...@@ -779,7 +779,7 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
try try
{ {
// Get the requested client version (default is 1) and check it is two. // Get the requested client version (default is 1) and check it is 2 or 3.
EGLint client_version = 1; EGLint client_version = 1;
bool reset_notification = false; bool reset_notification = false;
bool robust_access = false; bool robust_access = false;
...@@ -839,12 +839,7 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte ...@@ -839,12 +839,7 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
return EGL_NO_CONTEXT; return EGL_NO_CONTEXT;
} }
EGLContext context = display->createContext(config, client_version, static_cast<gl::Context*>(share_context), reset_notification, robust_access); return display->createContext(config, client_version, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
if (context)
return egl::success(context);
else
return egl::error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
} }
catch(std::bad_alloc&) catch(std::bad_alloc&)
{ {
......
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