OSMesa: Context creation compliance fixes

This commit is contained in:
Camilla Berglund 2016-11-08 23:43:45 +01:00
parent 62012e3c68
commit 0e8d129efb
2 changed files with 26 additions and 5 deletions

View File

@ -200,6 +200,13 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
fbconfig->accumBlueBits + fbconfig->accumBlueBits +
fbconfig->accumAlphaBits; fbconfig->accumAlphaBits;
if (ctxconfig->client == GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"OSMesa: OpenGL ES is not available on OSMesa");
return GLFW_FALSE;
}
if (ctxconfig->share) if (ctxconfig->share)
share = ctxconfig->share->context.osmesa.handle; share = ctxconfig->share->context.osmesa.handle;
@ -227,6 +234,13 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
setAttrib(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor); setAttrib(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor);
} }
if (ctxconfig->forward)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"OSMesa: Foward-compatible contexts not supported");
return GLFW_FALSE;
}
setAttrib(0, 0); setAttrib(0, 0);
window->context.osmesa.handle = window->context.osmesa.handle =

View File

@ -47,17 +47,24 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig, const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig)
{ {
if (!_glfwInitOSMesa()) if (!createNativeWindow(window, wndconfig))
return GLFW_FALSE; return GLFW_FALSE;
if (ctxconfig->client != GLFW_NO_API) if (ctxconfig->client != GLFW_NO_API)
{ {
if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API)
{
if (!_glfwInitOSMesa())
return GLFW_FALSE;
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
return GLFW_FALSE; return GLFW_FALSE;
} }
else
if (!createNativeWindow(window, wndconfig)) {
_glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: EGL not available");
return GLFW_FALSE; return GLFW_FALSE;
}
}
return GLFW_TRUE; return GLFW_TRUE;
} }