Skip to content

Commit

Permalink
Merge branch 'master' into TemporaryHackishBranch
Browse files Browse the repository at this point in the history
Conflicts:
	GPU/Common/FramebufferCommon.cpp
	UI/GameSettingsScreen.cpp
  • Loading branch information
LunaMoo committed Dec 26, 2017
2 parents 3b1b1bb + 43166c4 commit f268097
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 80 deletions.
3 changes: 3 additions & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,9 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
if (iAnisotropyLevel > 4) {
iAnisotropyLevel = 4;
}
if (iRenderingMode != FB_NON_BUFFERED_MODE && iRenderingMode != FB_BUFFERED_MODE) {
g_Config.iRenderingMode = FB_BUFFERED_MODE;
}

// Check for an old dpad setting
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
Expand Down
2 changes: 1 addition & 1 deletion Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ struct Config {
bool bHardwareTransform; // only used in the GLES backend
bool bSoftwareSkinning; // may speed up some games

int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (CPU) 3 = Read Framebuffer to memory (GPU)
int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
int iBufFilter; // 1 = linear, 2 = nearest
int iSmallDisplayZoomType; // Used to fit display into screen 0 = stretch, 1 = partial stretch, 2 = auto scaling, 3 = manual scaling.
Expand Down
7 changes: 5 additions & 2 deletions Core/MIPS/IR/IRInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,11 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst, const u32 *constPool, int c
}

case IROp::Break:
Crash();
break;
if (!g_Config.bIgnoreBadMemAccess) {
Core_EnableStepping(true);
host->SetDebugMode(true);
}
return mips->pc + 4;

case IROp::SetCtrlVFPU:
mips->vfpuCtrl[inst->dest] = constPool[inst->src1];
Expand Down
2 changes: 0 additions & 2 deletions Core/Reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ namespace Reporting
bool IsSupported()
{
// Disabled when using certain hacks, because they make for poor reports.
if (g_Config.iRenderingMode >= 2) // FBO_READFBOMEMORY_MIN
return false;
if (g_Config.bTimerHack)
return false;
if (CheatsInEffect())
Expand Down
10 changes: 4 additions & 6 deletions GPU/Common/FramebufferCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ bool FramebufferManagerCommon::UpdateSize() {
void FramebufferManagerCommon::BeginFrame() {
DecimateFBOs();
currentRenderVfb_ = nullptr;
updateVRAM_ = !(g_Config.iRenderingMode == FB_NON_BUFFERED_MODE || g_Config.iRenderingMode == FB_BUFFERED_MODE);
}

void FramebufferManagerCommon::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
Expand Down Expand Up @@ -195,8 +194,7 @@ u32 FramebufferManagerCommon::FramebufferByteSize(const VirtualFramebuffer *vfb)
}

bool FramebufferManagerCommon::ShouldDownloadFramebuffer(const VirtualFramebuffer *vfb) const {
return updateVRAM_ ||
(PSP_CoreParameter().compat.flags().Force04154000Download && vfb->fb_address == 0x00154000) ||
return (PSP_CoreParameter().compat.flags().Force04154000Download && vfb->fb_address == 0x00154000) ||
(PSP_CoreParameter().compat.flags().ForceRangeDownload && vfb->fb_address >= 0x001F3A80 && vfb->fb_address <= 0x001FE7C0) ||
(PSP_CoreParameter().compat.flags().Force04Download && vfb->fb_address >= 0x00000000 && vfb->fb_address <= 0x00400000); // Should be vfb->fb_address >= 0x00154000 && vfb->fb_address <= 0x00158000, but nah, let's make it less safe, but more universal
}
Expand Down Expand Up @@ -460,7 +458,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame
vfbs_.push_back(vfb);
currentRenderVfb_ = vfb;

if (useBufferedRendering_ && !updateVRAM_ && !g_Config.bDisableSlowFramebufEffects) {
if (useBufferedRendering_ && !g_Config.bDisableSlowFramebufEffects) {
gpu->PerformMemoryUpload(fb_address_mem, byteSize);
NotifyStencilUpload(fb_address_mem, byteSize, true);
// TODO: Is it worth trying to upload the depth buffer?
Expand Down Expand Up @@ -1213,7 +1211,7 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w,
}

bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, bool isMemset, u32 skipDrawReason) {
if (updateVRAM_ || size == 0) {
if (size == 0) {
return false;
}

Expand Down Expand Up @@ -1583,7 +1581,7 @@ void FramebufferManagerCommon::OptimizeDownloadRange(VirtualFramebuffer * vfb, i
}

bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dstStride, int dstX, int dstY, u32 srcBasePtr, int srcStride, int srcX, int srcY, int width, int height, int bpp, u32 skipDrawReason) {
if (!useBufferedRendering_ || updateVRAM_) {
if (!useBufferedRendering_) {
return false;
}

Expand Down
10 changes: 0 additions & 10 deletions GPU/Common/FramebufferCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ enum {
enum {
FB_NON_BUFFERED_MODE = 0,
FB_BUFFERED_MODE = 1,

// Hm, it's unfortunate that GPU has ended up as two separate values in GL and GLES.
#ifndef USING_GLES2
FB_READFBOMEMORY_CPU = 2,
FB_READFBOMEMORY_GPU = 3,
#else
FB_READFBOMEMORY_GPU = 2,
#endif
FBO_READFBOMEMORY_MIN = 2
};

namespace Draw {
Expand Down Expand Up @@ -385,7 +376,6 @@ class FramebufferManagerCommon {
u32 framebufRangeEnd_ = 0;

bool useBufferedRendering_ = false;
bool updateVRAM_ = false;
bool usePostShader_ = false;
bool postShaderAtOutputResolution_ = false;
bool postShaderIsUpscalingFilter_ = false;
Expand Down
4 changes: 0 additions & 4 deletions GPU/Common/TextureCacheCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,6 @@ bool TextureCacheCommon::AttachFramebuffer(TexCacheEntry *entry, u32 address, Vi

// If they match exactly, it's non-CLUT and from the top left.
if (exactMatch) {
// Apply to non-buffered and buffered mode only.
if (!(g_Config.iRenderingMode == FB_NON_BUFFERED_MODE || g_Config.iRenderingMode == FB_BUFFERED_MODE))
return false;

DEBUG_LOG(G3D, "Render to texture detected at %08x!", address);
if (framebuffer->fb_stride != entry->bufw) {
WARN_LOG_REPORT_ONCE(diffStrides1, G3D, "Render to texture with different strides %d != %d", entry->bufw, framebuffer->fb_stride);
Expand Down
5 changes: 0 additions & 5 deletions GPU/GLES/FramebufferManagerGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,6 @@ void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int
void FramebufferManagerGLES::EndFrame() {
CHECK_GL_ERROR_IF_DEBUG();

// We flush to memory last requested framebuffer, if any.
// Only do this in the read-framebuffer modes.
if (updateVRAM_)
PackFramebufferAsync_(nullptr);

// Let's explicitly invalidate any temp FBOs used during this frame.
if (gl_extensions.GLES3 && glInvalidateFramebuffer != nullptr) {
for (auto temp : tempFBOs_) {
Expand Down
10 changes: 2 additions & 8 deletions GPU/GLES/GPU_GLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,11 @@ void GPU_GLES::CheckGPUFeatures() {

bool useCPU = false;
if (!gl_extensions.IsGLES) {
// Urrgh, we don't even define FB_READFBOMEMORY_CPU on mobile
#ifndef USING_GLES2
useCPU = g_Config.iRenderingMode == FB_READFBOMEMORY_CPU;
#endif
// Some cards or drivers seem to always dither when downloading a framebuffer to 16-bit.
// This causes glitches in games that expect the exact values.
// It has not been experienced on NVIDIA cards, so those are left using the GPU (which is faster.)
if (g_Config.iRenderingMode == FB_BUFFERED_MODE) {
if (gl_extensions.gpuVendor != GPU_VENDOR_NVIDIA || gl_extensions.ver[0] < 3) {
useCPU = true;
}
if (gl_extensions.gpuVendor != GPU_VENDOR_NVIDIA || !gl_extensions.VersionGEThan(3, 0)) {
useCPU = true;
}
} else {
useCPU = true;
Expand Down
3 changes: 2 additions & 1 deletion GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,8 @@ void GPUCommon::Execute_BoneMtxNum(u32 op, u32 diff) {
const int end = 12 * 8 - (op & 0x7F);
int i = 0;

bool fastLoad = !debugRecording_;
// TODO: Validate what should happen when explicitly setting num to 96 or higher.
bool fastLoad = !debugRecording_ && end > 0;
if (currentList->pc < currentList->stall && currentList->pc + end * 4 >= currentList->stall) {
fastLoad = false;
}
Expand Down
1 change: 0 additions & 1 deletion Qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ void MainWindow::createMenus()
anisotropicGroup = new MenuActionGroup(this, anisotropicMenu, SLOT(anisotropicGroup_triggered(QAction *)),
QStringList() << "Off" << "2x" << "4x" << "8x" << "16x",
QList<int>() << 0 << 1 << 2 << 3 << 4);
// TODO: Check for newer buffer render options
videoMenu->add(new MenuAction(this, SLOT(bufferRenderAct()), QT_TR_NOOP("&Buffered Rendering"), Qt::Key_F5))
->addEventChecked(&g_Config.iRenderingMode);
videoMenu->add(new MenuAction(this, SLOT(linearAct()), QT_TR_NOOP("&Linear Filtering")))
Expand Down
10 changes: 2 additions & 8 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,15 @@ void GameSettingsScreen::CreateViews() {
renderingBackendChoice->HideChoice(3);
}

static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory (CPU)", "Read Framebuffers To Memory (GPU)" };
static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering"};
PopupMultiChoice *renderingModeChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gr->T("Mode"), renderingMode, 0, ARRAY_SIZE(renderingMode), gr->GetName(), screenManager()));
renderingModeChoice->OnChoice.Add([=](EventParams &e) {
switch (g_Config.iRenderingMode) {
case FB_NON_BUFFERED_MODE:
settingInfo_->Show(gr->T("RenderingMode NonBuffered Tip", "Faster, but nothing may draw in some games"), e.v);
settingInfo_->Show(gr->T("RenderingMode NonBuffered Tip", "Faster, but graphics may be missing in some games"), e.v);
break;
case FB_BUFFERED_MODE:
break;
#ifndef USING_GLES2
case FB_READFBOMEMORY_CPU:
#endif
case FB_READFBOMEMORY_GPU:
settingInfo_->Show(gr->T("RenderingMode ReadFromMemory Tip", "Causes crashes in many games, not recommended"), e.v);
break;
}
return UI::EVENT_CONTINUE;
});
Expand Down
27 changes: 1 addition & 26 deletions Windows/MainWindowMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ namespace MainWindow {
TranslateSubMenu(menu, "Rendering Mode", MENU_OPTIONS, SUBMENU_RENDERING_MODE);
TranslateMenuItem(menu, ID_OPTIONS_NONBUFFEREDRENDERING);
TranslateMenuItem(menu, ID_OPTIONS_BUFFEREDRENDERING);
TranslateMenuItem(menu, ID_OPTIONS_READFBOTOMEMORYCPU);
TranslateMenuItem(menu, ID_OPTIONS_READFBOTOMEMORYGPU);
TranslateSubMenu(menu, "Frame Skipping", MENU_OPTIONS, SUBMENU_FRAME_SKIPPING, L"\tF7");
TranslateMenuItem(menu, ID_OPTIONS_FRAMESKIP_AUTO);
TranslateMenuItem(menu, ID_OPTIONS_FRAMESKIP_0);
Expand Down Expand Up @@ -526,15 +524,9 @@ namespace MainWindow {
}

static void setRenderingMode(int mode) {
if (mode >= FB_NON_BUFFERED_MODE)
g_Config.iRenderingMode = mode;
else {
if (++g_Config.iRenderingMode > FB_READFBOMEMORY_GPU)
g_Config.iRenderingMode = FB_NON_BUFFERED_MODE;
}

I18NCategory *gr = GetI18NCategory("Graphics");

g_Config.iRenderingMode = mode;
switch (g_Config.iRenderingMode) {
case FB_NON_BUFFERED_MODE:
osm.Show(gr->T("Non-Buffered Rendering"));
Expand All @@ -544,14 +536,6 @@ namespace MainWindow {
case FB_BUFFERED_MODE:
osm.Show(gr->T("Buffered Rendering"));
break;

case FB_READFBOMEMORY_CPU:
osm.Show(gr->T("Read Framebuffers To Memory (CPU)"));
break;

case FB_READFBOMEMORY_GPU:
osm.Show(gr->T("Read Framebuffers To Memory (GPU)"));
break;
}

NativeMessageReceived("gpu_resized", "");
Expand Down Expand Up @@ -824,8 +808,6 @@ namespace MainWindow {

case ID_OPTIONS_NONBUFFEREDRENDERING: setRenderingMode(FB_NON_BUFFERED_MODE); break;
case ID_OPTIONS_BUFFEREDRENDERING: setRenderingMode(FB_BUFFERED_MODE); break;
case ID_OPTIONS_READFBOTOMEMORYCPU: setRenderingMode(FB_READFBOMEMORY_CPU); break;
case ID_OPTIONS_READFBOTOMEMORYGPU: setRenderingMode(FB_READFBOMEMORY_GPU); break;

case ID_DEBUG_SHOWDEBUGSTATISTICS:
g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
Expand Down Expand Up @@ -1248,14 +1230,7 @@ namespace MainWindow {
static const int renderingmode[] = {
ID_OPTIONS_NONBUFFEREDRENDERING,
ID_OPTIONS_BUFFEREDRENDERING,
ID_OPTIONS_READFBOTOMEMORYCPU,
ID_OPTIONS_READFBOTOMEMORYGPU,
};
if (g_Config.iRenderingMode < FB_NON_BUFFERED_MODE)
g_Config.iRenderingMode = FB_NON_BUFFERED_MODE;

else if (g_Config.iRenderingMode > FB_READFBOMEMORY_GPU)
g_Config.iRenderingMode = FB_READFBOMEMORY_GPU;

for (int i = 0; i < ARRAY_SIZE(renderingmode); i++) {
CheckMenuItem(menu, renderingmode[i], MF_BYCOMMAND | ((i == g_Config.iRenderingMode) ? MF_CHECKED : MF_UNCHECKED));
Expand Down
6 changes: 2 additions & 4 deletions Windows/ppsspp.rc
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,8 @@ BEGIN

POPUP "Rendering Mode"
BEGIN
MENUITEM "Non-Buffered Rendering", ID_OPTIONS_NONBUFFEREDRENDERING
MENUITEM "Buffered Rendering", ID_OPTIONS_BUFFEREDRENDERING
MENUITEM "Read Framebuffers To Memory (CPU)", ID_OPTIONS_READFBOTOMEMORYCPU
MENUITEM "Read Framebuffers To Memory (GPU)", ID_OPTIONS_READFBOTOMEMORYGPU
MENUITEM "Non-Buffered Rendering", ID_OPTIONS_NONBUFFEREDRENDERING
MENUITEM "Buffered Rendering", ID_OPTIONS_BUFFEREDRENDERING
END
POPUP "Frame Skipping"
BEGIN
Expand Down
2 changes: 0 additions & 2 deletions Windows/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@
#define ID_DISASM_THREAD_KILL 40073
#define ID_FILE_SAVESTATE_NEXT_SLOT 40074
#define ID_FILE_SAVESTATE_NEXT_SLOT_HC 40075
#define ID_OPTIONS_READFBOTOMEMORYGPU 40076
#define ID_OPTIONS_READFBOTOMEMORYCPU 40077
#define ID_OPTIONS_NONBUFFEREDRENDERING 40078
#define ID_OPTIONS_FRAMESKIP_0 40079
#define ID_OPTIONS_FRAMESKIP_1 40080
Expand Down

0 comments on commit f268097

Please sign in to comment.