Move all context related members to _GLFWcontext

This commit is contained in:
Camilla Berglund
2015-11-09 16:48:55 +01:00
parent b22a0ec7d8
commit d4079ad3a2
11 changed files with 146 additions and 124 deletions
+20 -13
View File
@@ -52,7 +52,7 @@ static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
window = _glfwPlatformGetCurrentContext();
version = (const char*) window->GetString(GL_VERSION);
version = (const char*) window->context.GetString(GL_VERSION);
if (!version)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@@ -356,8 +356,10 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
window->GetIntegerv = (PFNGLGETINTEGERVPROC) glfwGetProcAddress("glGetIntegerv");
window->GetString = (PFNGLGETSTRINGPROC) glfwGetProcAddress("glGetString");
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
glfwGetProcAddress("glGetIntegerv");
window->context.GetString = (PFNGLGETSTRINGPROC)
glfwGetProcAddress("glGetString");
if (!parseVersionString(&window->context.api,
&window->context.major,
@@ -373,8 +375,9 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
// We cache it here instead of in glfwExtensionSupported mostly to alert
// users as early as possible that their build may be broken
window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi");
if (!window->GetStringi)
window->context.GetStringi = (PFNGLGETSTRINGIPROC)
glfwGetProcAddress("glGetStringi");
if (!window->context.GetStringi)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Entry point retrieval is broken");
@@ -388,7 +391,7 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
if (window->context.major >= 3)
{
GLint flags;
window->GetIntegerv(GL_CONTEXT_FLAGS, &flags);
window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
window->context.forward = GLFW_TRUE;
@@ -413,7 +416,7 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
(window->context.major == 3 && window->context.minor >= 2))
{
GLint mask;
window->GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
window->context.GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
@@ -436,7 +439,8 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
// only present from 3.0 while the extension applies from 1.1
GLint strategy;
window->GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
&strategy);
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
@@ -453,7 +457,8 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
// one, so we can reuse them here
GLint strategy;
window->GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
&strategy);
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
@@ -465,7 +470,7 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
if (glfwExtensionSupported("GL_KHR_context_flush_control"))
{
GLint behavior;
window->GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
window->context.GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
if (behavior == GL_NONE)
window->context.release = GLFW_RELEASE_BEHAVIOR_NONE;
@@ -612,11 +617,12 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
// Check if extension is in the modern OpenGL extensions string list
window->GetIntegerv(GL_NUM_EXTENSIONS, &count);
window->context.GetIntegerv(GL_NUM_EXTENSIONS, &count);
for (i = 0; i < count; i++)
{
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
const char* en = (const char*)
window->context.GetStringi(GL_EXTENSIONS, i);
if (!en)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@@ -632,7 +638,8 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
{
// Check if extension is in the old style OpenGL extensions string
const char* extensions = (const char*) window->GetString(GL_EXTENSIONS);
const char* extensions = (const char*)
window->context.GetString(GL_EXTENSIONS);
if (!extensions)
{
_glfwInputError(GLFW_PLATFORM_ERROR,