Skip to content

Commit

Permalink
glViewport calls need to be in pixel coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Nov 20, 2012
1 parent 4c2929c commit 2a56d36
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
7 changes: 7 additions & 0 deletions Core/CoreParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ struct CoreParameter
bool printfEmuLog; // writes "emulator:" logging to stdout
bool headLess; // Try to avoid messageboxes etc

// Internal PSP resolution
int renderWidth;
int renderHeight;

// Virtual (dpi-adjusted) output resolution
int outputWidth;
int outputHeight;

// Actual pixel output resolution (for use by glViewport and the like)
int pixelWidth;
int pixelHeight;
};
4 changes: 2 additions & 2 deletions GPU/GLES/DisplayListInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void GLES_GPU::InitClear()
// glClearColor(1,0,1,1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
}
glViewport(0, 0, renderWidth_, renderHeight_);
glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
}

void GLES_GPU::BeginFrame()
Expand Down Expand Up @@ -115,7 +115,7 @@ void GLES_GPU::CopyDisplayToOutput()
VirtualFramebuffer *vfb = GetDisplayFBO();
fbo_unbind();

glViewport(0, 0, PSP_CoreParameter().outputWidth, PSP_CoreParameter().outputHeight);
glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);

currentRenderVfb_ = 0;

Expand Down
18 changes: 10 additions & 8 deletions Windows/EmuThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,20 @@ DWORD TheThread(LPVOID x)

INFO_LOG(BOOT, "Starting up hardware.");

CoreParameter coreParameter;
coreParameter.fileToStart = fileToStart;
coreParameter.enableSound = true;
coreParameter.gpuCore = GPU_GLES;
coreParameter.cpuCore = g_Config.bJIT ? CPU_JIT : CPU_INTERPRETER;
coreParameter.enableDebugging = true;
coreParameter.printfEmuLog = false;
coreParameter.headLess = false;
CoreParameter coreParameter;
coreParameter.fileToStart = fileToStart;
coreParameter.enableSound = true;
coreParameter.gpuCore = GPU_GLES;
coreParameter.cpuCore = g_Config.bJIT ? CPU_JIT : CPU_INTERPRETER;
coreParameter.enableDebugging = true;
coreParameter.printfEmuLog = false;
coreParameter.headLess = false;
coreParameter.renderWidth = 480 * g_Config.iWindowZoom;
coreParameter.renderHeight = 272 * g_Config.iWindowZoom;
coreParameter.outputWidth = 480 * g_Config.iWindowZoom;
coreParameter.outputHeight = 272 * g_Config.iWindowZoom;
coreParameter.pixelWidth = 480 * g_Config.iWindowZoom;
coreParameter.pixelHeight = 272 * g_Config.iWindowZoom;

std::string error_string;
if (!PSP_Init(coreParameter, &error_string))
Expand Down
4 changes: 3 additions & 1 deletion android/jni/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true)
coreParam.renderHeight = 272;
coreParam.outputWidth = dp_xres;
coreParam.outputHeight = dp_yres;
coreParam.pixelWidth = pixel_xres;
coreParam.pixelHeight = pixel_yres;

std::string error_string;
if (PSP_Init(coreParam, &error_string)) {
Expand Down Expand Up @@ -176,7 +178,7 @@ void EmuScreen::render()

uiTexture->Bind(0);

glViewport(0, 0, dp_xres, dp_yres);
glViewport(0, 0, pixel_xres, pixel_yres);

ui_draw2d.Begin(DBMODE_NORMAL);

Expand Down

0 comments on commit 2a56d36

Please sign in to comment.