<commit_before>// sdl_main.cpp

#ifdef _WIN32
#  define WINDOWS_LEAN_AND_MEAN
#  define NOMINMAX
#  include <windows.h>
#endif

#include <sstream>

#include <GL/glew.h>
#include <SDL.h>
#include <SDL_syswm.h>
#undef main

#include <glm/gtc/type_ptr.hpp>

#ifdef USE_ANTTWEAKBAR
#  include <AntTweakBar.h>
#endif

#include <stdio.h>
#include <string.h>
#include <sstream>

#include "RiftAppSkeleton.h"
#include "RenderingMode.h"
#include "Timer.h"
#include "FPSTimer.h"
#include "Logger.h"

RiftAppSkeleton g_app;
RenderingMode g_renderMode;
Timer g_timer;
double g_lastFrameTime = 0.0;
FPSTimer g_fps;

int m_keyStates[4096];

// mouse motion internal state
int oldx, oldy, newx, newy;
int which_button = -1;
int modifier_mode = 0;

//ShaderWithVariables g_auxPresent;
SDL_Window* g_pHMDWindow = NULL;
SDL_Window* g_pAuxWindow = NULL;
SDL_GLContext g_HMDglContext = NULL;
Uint32 g_HMDWindowID = 0;
Uint32 g_AuxWindowID = 0;
int g_auxWindow_w = 600;
int g_auxWindow_h = 600;

SDL_Joystick* g_pJoy = NULL;

float g_fpsSmoothingFactor = 0.02f;
float g_fpsDeltaThreshold = 5.0f;
bool g_dynamicallyScaleFBO = false;
int g_targetFPS = 100;

#ifdef USE_ANTTWEAKBAR
TwBar* g_pTweakbar = NULL;
#endif

SDL_Window* initializeAuxiliaryWindow();
void destroyAuxiliaryWindow(SDL_Window* pAuxWindow);

// Set VSync is framework-dependent and has to come before the include
static void SetVsync(int state)
{
    LOG_INFO("SetVsync(%d)", state);
    ///@todo Handle aux window
    int ret = SDL_GL_SetSwapInterval(state);
    if (ret != 0)
    {
        LOG_INFO("Error occurred in SDL_GL_SetSwapInterval: %s", SDL_GetError());
    }
}

#include "main_include.cpp"

void timestep()<commit_msg>Call SDL_GL_SetSwapInterval on both aux and main contexts in SetVsync.<commit_after>// sdl_main.cpp

#ifdef _WIN32
#  define WINDOWS_LEAN_AND_MEAN
#  define NOMINMAX
#  include <windows.h>
#endif

#include <sstream>

#include <GL/glew.h>
#include <SDL.h>
#include <SDL_syswm.h>
#undef main

#include <glm/gtc/type_ptr.hpp>

#ifdef USE_ANTTWEAKBAR
#  include <AntTweakBar.h>
#endif

#include <stdio.h>
#include <string.h>
#include <sstream>

#include "RiftAppSkeleton.h"
#include "RenderingMode.h"
#include "Timer.h"
#include "FPSTimer.h"
#include "Logger.h"

RiftAppSkeleton g_app;
RenderingMode g_renderMode;
Timer g_timer;
double g_lastFrameTime = 0.0;
FPSTimer g_fps;

int m_keyStates[4096];

// mouse motion internal state
int oldx, oldy, newx, newy;
int which_button = -1;
int modifier_mode = 0;

//ShaderWithVariables g_auxPresent;
SDL_Window* g_pHMDWindow = NULL;
SDL_Window* g_pAuxWindow = NULL;
SDL_GLContext g_HMDglContext = NULL;
Uint32 g_HMDWindowID = 0;
Uint32 g_AuxWindowID = 0;
int g_auxWindow_w = 600;
int g_auxWindow_h = 600;

SDL_Joystick* g_pJoy = NULL;

float g_fpsSmoothingFactor = 0.02f;
float g_fpsDeltaThreshold = 5.0f;
bool g_dynamicallyScaleFBO = false;
int g_targetFPS = 100;

#ifdef USE_ANTTWEAKBAR
TwBar* g_pTweakbar = NULL;
#endif

SDL_Window* initializeAuxiliaryWindow();
void destroyAuxiliaryWindow(SDL_Window* pAuxWindow);

// Set VSync is framework-dependent and has to come before the include
static void SetVsync(int state)
{
    LOG_INFO("SetVsync(%d)", state);

    int ret = 0;
    if (g_pAuxWindow != NULL)
    {
        SDL_GL_MakeCurrent(g_pAuxWindow, g_HMDglContext);
        ret = SDL_GL_SetSwapInterval(state);
        if (ret != 0)
        {
            LOG_INFO("Error occurred in SDL_GL_SetSwapInterval: %s", SDL_GetError());
        }
    }
    SDL_GL_MakeCurrent(g_pHMDWindow, g_HMDglContext);
    ret = SDL_GL_SetSwapInterval(state);
    if (ret != 0)
    {
        LOG_INFO("Error occurred in SDL_GL_SetSwapInterval: %s", SDL_GetError());
    }
}

#include "main_include.cpp"

void timestep()
{'fraction_non_alphanumeric': 0.10884170921795217, 'fraction_numerical': 0.01719967750604676, 'mean_word_length': 4.752704791344668, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3465089', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1458, 'n_words': 340}