mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Remove silly use of gstate.SetVSyncInterval
This commit is contained in:
parent
d822cbf60b
commit
08735b806f
8 changed files with 45 additions and 29 deletions
|
@ -45,6 +45,10 @@
|
|||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceGe.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Windows/OpenGLBase.h"
|
||||
#endif
|
||||
|
||||
enum {
|
||||
FLAG_FLUSHBEFORE = 1,
|
||||
FLAG_FLUSHBEFOREONCHANGE = 2,
|
||||
|
@ -463,7 +467,10 @@ GLES_GPU::~GLES_GPU() {
|
|||
fragmentTestCache_.Clear();
|
||||
delete shaderManager_;
|
||||
shaderManager_ = nullptr;
|
||||
glstate.SetVSyncInterval(0);
|
||||
|
||||
#ifdef _WIN32
|
||||
GL_SwapInterval(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Take the raw GL extension and versioning data and turn into feature flags.
|
||||
|
@ -649,7 +656,7 @@ inline void GLES_GPU::UpdateVsyncInterval(bool force) {
|
|||
// // See http://developer.download.nvidia.com/opengl/specs/WGL_EXT_swap_control_tear.txt
|
||||
// glstate.SetVSyncInterval(-desiredVSyncInterval);
|
||||
//} else {
|
||||
glstate.SetVSyncInterval(desiredVSyncInterval);
|
||||
GL_SwapInterval(desiredVSyncInterval);
|
||||
//}
|
||||
lastVsync_ = desiredVSyncInterval;
|
||||
}
|
||||
|
|
|
@ -593,7 +593,6 @@ void TransformDrawEngine::DoFlush() {
|
|||
if (vshader->UseHWTransform()) {
|
||||
GLuint vbo = 0, ebo = 0;
|
||||
int vertexCount = 0;
|
||||
int maxIndex = 0; // Compiler warns about this because it's only used in the #ifdeffed out RangeElements path.
|
||||
bool useElements = true;
|
||||
|
||||
// Cannot cache vertex data with morph enabled.
|
||||
|
@ -709,7 +708,6 @@ void TransformDrawEngine::DoFlush() {
|
|||
vbo = vai->vbo;
|
||||
ebo = vai->ebo;
|
||||
vertexCount = vai->numVerts;
|
||||
maxIndex = vai->maxIndex;
|
||||
prim = static_cast<GEPrimitiveType>(vai->prim);
|
||||
break;
|
||||
}
|
||||
|
@ -728,7 +726,6 @@ void TransformDrawEngine::DoFlush() {
|
|||
glstate.arrayBuffer.bind(vbo);
|
||||
glstate.elementArrayBuffer.bind(ebo);
|
||||
vertexCount = vai->numVerts;
|
||||
maxIndex = vai->maxIndex;
|
||||
prim = static_cast<GEPrimitiveType>(vai->prim);
|
||||
|
||||
gstate_c.vertexFullAlpha = vai->flags & VAI_FLAG_VERTEXFULLALPHA;
|
||||
|
@ -754,7 +751,6 @@ rotateVBO:
|
|||
gpuStats.numUncachedVertsDrawn += indexGen.VertexCount();
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
vertexCount = indexGen.VertexCount();
|
||||
maxIndex = indexGen.MaxIndex();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vertexCount = indexGen.PureCount();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
// TODO: What a mess this is :(
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/CommonWindows.h"
|
||||
#include "native/gfx/gl_common.h"
|
||||
#include "native/gfx_es2/gpu_features.h"
|
||||
|
@ -244,8 +264,8 @@ bool GL_Init(HWND window, std::string *error_message) {
|
|||
|
||||
hRC = m_hrc;
|
||||
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(0);
|
||||
GL_SwapInterval(0);
|
||||
|
||||
if (enableGLDebug && glewIsSupported("GL_ARB_debug_output")) {
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)&DebugCallbackARB, 0); // print debug output to stderr
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
|
@ -253,6 +273,11 @@ bool GL_Init(HWND window, std::string *error_message) {
|
|||
return true; // Success
|
||||
}
|
||||
|
||||
void GL_SwapInterval(int interval) {
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(0);
|
||||
}
|
||||
|
||||
void GL_Shutdown() {
|
||||
if (hRC) {
|
||||
// Are we able to release the DC and RC contexts?
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
|
||||
bool GL_Init(HWND window, std::string *error_message);
|
||||
void GL_Shutdown();
|
||||
void GL_SwapInterval(int interval);
|
||||
void GL_SwapBuffers();
|
||||
|
|
|
@ -70,6 +70,7 @@ struct InputState;
|
|||
// Temporary hacks around annoying linking errors.
|
||||
void D3D9_SwapBuffers() { }
|
||||
void GL_SwapBuffers() { }
|
||||
void GL_SwapInterval(int) { }
|
||||
void NativeUpdate(InputState &input_state) { }
|
||||
void NativeRender() { }
|
||||
void NativeResized() { }
|
||||
|
|
|
@ -15,17 +15,18 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "WindowsHeadlessHost.h"
|
||||
#include "Compare.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "Common/CommonWindows.h"
|
||||
#include <io.h>
|
||||
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/System.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "Windows/OpenGLBase.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "gfx/gl_common.h"
|
||||
|
@ -36,9 +37,6 @@ const bool WINDOW_VISIBLE = false;
|
|||
const int WINDOW_WIDTH = 480;
|
||||
const int WINDOW_HEIGHT = 272;
|
||||
|
||||
typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int value);
|
||||
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = NULL;
|
||||
|
||||
HWND CreateHiddenWindow() {
|
||||
static WNDCLASSEX wndClass = {
|
||||
sizeof(WNDCLASSEX),
|
||||
|
@ -60,18 +58,6 @@ HWND CreateHiddenWindow() {
|
|||
return CreateWindowEx(0, _T("PPSSPPHeadless"), _T("PPSSPPHeadless"), style, CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void SetVSync(int value)
|
||||
{
|
||||
const char *extensions = (const char *) glGetString(GL_EXTENSIONS);
|
||||
|
||||
if (!strstr(extensions, "WGL_EXT_swap_control"))
|
||||
return;
|
||||
|
||||
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC) wglGetProcAddress("wglSwapIntervalEXT");
|
||||
if (wglSwapIntervalEXT != NULL)
|
||||
wglSwapIntervalEXT(value);
|
||||
}
|
||||
|
||||
void WindowsHeadlessHost::LoadNativeAssets()
|
||||
{
|
||||
VFSRegister("", new DirectoryAssetReader("assets/"));
|
||||
|
@ -182,7 +168,7 @@ bool WindowsHeadlessHost::InitGraphics(std::string *error_message)
|
|||
ENFORCE(hRC = wglCreateContext(hDC), "Unable to create GL context.");
|
||||
ENFORCE(wglMakeCurrent(hDC, hRC), "Unable to activate GL context.");
|
||||
|
||||
SetVSync(0);
|
||||
GL_SwapInterval(0);
|
||||
|
||||
glewInit();
|
||||
|
||||
|
@ -193,8 +179,7 @@ bool WindowsHeadlessHost::InitGraphics(std::string *error_message)
|
|||
|
||||
void WindowsHeadlessHost::ShutdownGraphics()
|
||||
{
|
||||
if (hRC)
|
||||
{
|
||||
if (hRC) {
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(hRC);
|
||||
hRC = NULL;
|
||||
|
|
2
native
2
native
|
@ -1 +1 @@
|
|||
Subproject commit f78c4f6f84a5beea8c82040a1c169512bc857242
|
||||
Subproject commit 65e3d31e249ca811809121529f1971e408c154d3
|
|
@ -48,6 +48,7 @@
|
|||
std::string System_GetProperty(SystemProperty prop) { return ""; }
|
||||
int System_GetPropertyInt(SystemProperty prop) { return -1; }
|
||||
void NativeMessageReceived(const char *message, const char *value) {}
|
||||
void GL_SwapInterval(int) {}
|
||||
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue