Skip to content

Commit

Permalink
Layers/xrRenderGL/glHW.h|cpp: removed OpenGL helper context debris
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 12, 2025
1 parent 149e355 commit 99e06cb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
30 changes: 0 additions & 30 deletions src/Layers/xrRenderGL/glHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,6 @@ void CHW::CreateDevice(SDL_Window* hWnd)
return;
}

{
const Uint32 flags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL;

m_helper_window = SDL_CreateWindow("OpenXRay OpenGL helper window", 0, 0, 1, 1, flags);
R_ASSERT3(m_helper_window, "Cannot create helper window for OpenGL", SDL_GetError());

SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

// Create helper context
m_helper_context = SDL_GL_CreateContext(m_helper_window);
R_ASSERT3(m_helper_context, "Cannot create OpenGL context", SDL_GetError());

// just in case
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 0);
}

if (MakeContextCurrent(IRender::PrimaryContext) != 0)
{
Log("! Could not make context current after creating helper context:", SDL_GetError());
return;
}

UpdateVSync();

#ifdef DEBUG
Expand Down Expand Up @@ -159,9 +137,6 @@ void CHW::DestroyDevice()

SDL_GL_DeleteContext(m_context);
m_context = nullptr;

SDL_GL_DeleteContext(m_helper_context);
m_helper_context = nullptr;
}

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -203,8 +178,6 @@ IRender::RenderContext CHW::GetCurrentContext() const
const auto context = SDL_GL_GetCurrentContext();
if (context == m_context)
return IRender::PrimaryContext;
if (context == m_helper_context)
return IRender::HelperContext;
return IRender::NoContext;
}

Expand All @@ -218,9 +191,6 @@ int CHW::MakeContextCurrent(IRender::RenderContext context) const
case IRender::PrimaryContext:
return SDL_GL_MakeCurrent(m_window, m_context);

case IRender::HelperContext:
return SDL_GL_MakeCurrent(m_helper_window, m_helper_context);

default:
NODEFAULT;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Layers/xrRenderGL/glHW.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ class CHW
GLuint pFB{};

SDL_Window* m_window{};
SDL_Window* m_helper_window{};

SDL_GLContext m_context{};
SDL_GLContext m_helper_context{};

pcstr AdapterName;
pcstr OpenGLVersionString;
Expand Down

0 comments on commit 99e06cb

Please sign in to comment.