Fix rendering mode switching issue in old & new UI

This commit is contained in:
raven02 2013-07-22 07:33:18 +08:00
parent c7298ccc86
commit 76bd4e3120
9 changed files with 21 additions and 20 deletions

View file

@ -64,7 +64,7 @@ public:
// GFX
bool bDisplayFramebuffer;
bool bHardwareTransform;
int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (GPU) 3 = Read Framebuffer to memory (CPU)
int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (CPU) 3 = Read Framebuffer to memory (GPU)
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
bool bUseVBO;
#ifdef BLACKBERRY

View file

@ -172,7 +172,7 @@ FramebufferManager::FramebufferManager() :
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
useBufferedRendering_ = g_Config.iRenderingMode != 0 ? 1 : 0;
useBufferedRendering_ = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE ? 1 : 0;
// Check vendor string to try and guess GPU
const char *cvendor = (char *)glGetString(GL_VENDOR);
@ -1124,7 +1124,7 @@ void FramebufferManager::BeginFrame() {
// TODO: restore state?
}
currentRenderVfb_ = 0;
useBufferedRendering_ = g_Config.iRenderingMode != 0 ? 1 : 0;
useBufferedRendering_ = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE ? 1 : 0;
}
void FramebufferManager::SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {
@ -1165,7 +1165,7 @@ void FramebufferManager::DecimateFBOs() {
fbo_unbind();
currentRenderVfb_ = 0;
bool thirdFrame = (gpuStats.numFrames % 3 == 0);
bool useFramebufferToMem = g_Config.iRenderingMode > 1 ? 1 : 0;
bool useFramebufferToMem = g_Config.iRenderingMode != FB_BUFFERED_MODE ? 1 : 0;
for (size_t i = 0; i < vfbs_.size(); ++i) {
VirtualFramebuffer *vfb = vfbs_[i];

View file

@ -51,16 +51,17 @@ enum {
GPU_VENDOR_ARM = 4,
GPU_VENDOR_POWERVR = 5,
GPU_VENDOR_ADRENO = 6,
GPU_VENDOR_UNKNOWN = 0
GPU_VENDOR_UNKNOWN = 0,
};
enum {
FB_NON_BUFFERED_MODE = 0,
FB_BUFFERED_MODE = 1,
FB_READFBOMEMORY_GPU = 2,
FB_READFBOMEMORY_CPU = 3,
FB_READFBOMEMORY_CPU = 2,
FB_READFBOMEMORY_GPU = 3,
};
struct VirtualFramebuffer {
int last_frame_used;

View file

@ -27,6 +27,7 @@
#include "UI/MiscScreens.h"
#include "Core/Config.h"
#include "android/jni/TestRunner.h"
#include "GPU/GPUInterface.h"
namespace UI {
@ -198,7 +199,6 @@ void GameSettingsScreen::CreateViews() {
"Read Framebuffers To Memory(GPU)"
};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, 4, gs, screenManager()));
graphicsSettings->Add(new ItemHeader(gs->T("Features")));
graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform")));
graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache")));

View file

@ -34,7 +34,7 @@
#include "UI/GameSettingsScreen.h"
#include "UI/ui_atlas.h"
#include "Core/Config.h"
#include "GPU/GPUInterface.h"
#ifdef _WIN32
namespace MainWindow {
@ -468,6 +468,7 @@ UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
UI::EventReturn GamePauseScreen::OnContinue(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_CANCEL);
if (gpu) gpu->Resized();
return UI::EVENT_DONE;
}

View file

@ -467,6 +467,7 @@ void PauseScreen::render() {
VLinear vlinear(dp_xres - 10, 100, 20);
if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 40, 0, i->T("Continue"), ALIGN_RIGHT)) {
screenManager()->finishDialog(this, DR_CANCEL);
if (gpu) gpu->Resized();
}
if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 40, 0, i->T("Settings"), ALIGN_RIGHT)) {
@ -935,10 +936,7 @@ void GraphicsScreenP1::render() {
#endif
UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap);
if (UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti-Aliasing"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing)) {
if (gpu)
gpu->Resized();
}
if (UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti-Aliasing"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing))
#ifdef _WIN32
//bool Vsync = g_Config.iVSyncInterval != 0;
@ -957,13 +955,13 @@ void GraphicsScreenP1::render() {
g_Config.iRenderingMode = rendering ? 1 : 0;
bool useFBO = g_Config.iRenderingMode == 2;
if (UICheckBox(GEN_ID, x, y += stride, gs->T("Read Framebuffers to Memory (GPU)"), ALIGN_TOPLEFT, &useFBO))
if (UICheckBox(GEN_ID, x, y += stride, gs->T("Read Framebuffers to Memory (CPU)"), ALIGN_TOPLEFT, &useFBO))
g_Config.iRenderingMode = useFBO ? 2 : 0;
bool useCPU = g_Config.iRenderingMode == 3;
if (UICheckBox(GEN_ID, x, y += stride, gs->T("Read Framebuffers to Memory (CPU)"), ALIGN_TOPLEFT, &useCPU))
if (UICheckBox(GEN_ID, x, y += stride, gs->T("Read Framebuffers to Memory (GPU)"), ALIGN_TOPLEFT, &useCPU))
g_Config.iRenderingMode = useCPU ? 3 : 0;
UIEnd();
}

View file

@ -220,6 +220,7 @@ namespace MainWindow
void setRenderingMode(int num) {
g_Config.iRenderingMode = num;
if (gpu) gpu->Resized();
}
void setFpsLimit(int fps) {
@ -734,11 +735,11 @@ namespace MainWindow
setRenderingMode(1);
break;
case ID_OPTIONS_READFBOTOMEMORYGPU:
case ID_OPTIONS_READFBOTOMEMORYCPU:
setRenderingMode(2);
break;
case ID_OPTIONS_READFBOTOMEMORYCPU:
case ID_OPTIONS_READFBOTOMEMORYGPU:
setRenderingMode(3);
break;
@ -1105,8 +1106,8 @@ namespace MainWindow
static const int renderingmode[] = {
ID_OPTIONS_NONBUFFEREDRENDERING,
ID_OPTIONS_BUFFEREDRENDERING,
ID_OPTIONS_READFBOTOMEMORYGPU,
ID_OPTIONS_READFBOTOMEMORYCPU,
ID_OPTIONS_READFBOTOMEMORYGPU,
};
for (int i = 0; i < 4; i++) {
CheckMenuItem(menu, renderingmode[i], MF_BYCOMMAND | ( i == g_Config.iRenderingMode )? MF_CHECKED : MF_UNCHECKED);

Binary file not shown.

2
native

@ -1 +1 @@
Subproject commit ee0f3848272b6eb5446b468a1c55868e3b3c455c
Subproject commit dd99cfbbe808a62528cfb2f51864ad596812c1f6