mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 00:33:34 +01:00
Consolidate Rendering Mode
This commit is contained in:
1 parent
8d30ebf3b0
commit
87fc81e56d
14 files changed
+79
-83
No files matched your search
@@ -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.bBufferedRendering;
|
||||
bool useBufferedRendering_ = g_Config.iRenderingMode != 0 ? 1 : 0;
|
||||
|
||||
// Check vendor string to try and guess GPU
|
||||
const char *cvendor = (char *)glGetString(GL_VENDOR);
|
||||
@@ -889,7 +889,7 @@ void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, int format) {
|
||||
void FramebufferManager::PackFramebufferGL_(VirtualFramebuffer *vfb) {
|
||||
GLubyte *packed = 0;
|
||||
bool unbind = false;
|
||||
|
||||
bool useCPU_ = g_Config.iRenderingMode == FB_READFBOMEMORY_CPU ? 1 : 0;
|
||||
// We'll prepare two PBOs to switch between readying and reading
|
||||
if(!pixelBufObj_) {
|
||||
GLuint pbos[2];
|
||||
@@ -962,7 +962,7 @@ void FramebufferManager::PackFramebufferGL_(VirtualFramebuffer *vfb) {
|
||||
|
||||
if(pixelBufObj_[currentPBO_].maxSize < bufSize) {
|
||||
// We reserve a buffer big enough to fit all those pixels
|
||||
if(g_Config.bFramebuffersCPUConvert && pixelType != GL_UNSIGNED_BYTE) {
|
||||
if(useCPU_ && pixelType != GL_UNSIGNED_BYTE) {
|
||||
// Wnd result may be 16-bit but we are reading 32-bit, so we need double the space on the buffer
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, bufSize*2, NULL, GL_DYNAMIC_READ);
|
||||
} else {
|
||||
@@ -978,7 +978,7 @@ void FramebufferManager::PackFramebufferGL_(VirtualFramebuffer *vfb) {
|
||||
pixelBufObj_[currentPBO_].format = vfb->format;
|
||||
pixelBufObj_[currentPBO_].reading = true;
|
||||
|
||||
if(g_Config.bFramebuffersCPUConvert) {
|
||||
if(useCPU_) {
|
||||
// If converting pixel formats on the CPU we'll always request RGBA8888
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
glReadPixels(0, 0, vfb->fb_stride, vfb->height, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||
@@ -1006,7 +1006,7 @@ void FramebufferManager::PackFramebufferGL_(VirtualFramebuffer *vfb) {
|
||||
DEBUG_LOG(HLE, "Reading pbo to mem, bufSize = %u, packed = %08x, fb_address = %08x, pbo = %u",
|
||||
pixelBufObj_[nextPBO].size, packed, pixelBufObj_[nextPBO].fb_address, nextPBO);
|
||||
|
||||
if(g_Config.bFramebuffersCPUConvert) {
|
||||
if(useCPU_) {
|
||||
ConvertFromRGBA8888(Memory::GetPointer(pixelBufObj_[nextPBO].fb_address), packed,
|
||||
pixelBufObj_[nextPBO].stride, pixelBufObj_[nextPBO].height,
|
||||
pixelBufObj_[nextPBO].format);
|
||||
@@ -1120,7 +1120,7 @@ void FramebufferManager::BeginFrame() {
|
||||
// TODO: restore state?
|
||||
}
|
||||
currentRenderVfb_ = 0;
|
||||
useBufferedRendering_ = g_Config.bBufferedRendering;
|
||||
useBufferedRendering_ = g_Config.iRenderingMode != 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
void FramebufferManager::SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {
|
||||
@@ -1161,11 +1161,13 @@ void FramebufferManager::DecimateFBOs() {
|
||||
fbo_unbind();
|
||||
currentRenderVfb_ = 0;
|
||||
bool thirdFrame = (gpuStats.numFrames % 3 == 0);
|
||||
bool useFramebufferToMem_ = g_Config.iRenderingMode > 1 ? 1 : 0;
|
||||
|
||||
for (size_t i = 0; i < vfbs_.size(); ++i) {
|
||||
VirtualFramebuffer *vfb = vfbs_[i];
|
||||
int age = frameLastFramebufUsed - vfb->last_frame_used;
|
||||
|
||||
if(g_Config.bFramebuffersToMem) {
|
||||
if(useFramebufferToMem_) {
|
||||
// Every third frame we'll commit framebuffers to memory
|
||||
if(thirdFrame && age <= FBO_OLD_AGE) {
|
||||
ReadFramebufferToMemory(vfb);
|
||||
@@ -1212,7 +1214,6 @@ void FramebufferManager::DestroyAllFBOs() {
|
||||
|
||||
void FramebufferManager::UpdateFromMemory(u32 addr, int size) {
|
||||
addr &= ~0x40000000;
|
||||
|
||||
// TODO: Could go through all FBOs, but probably not important?
|
||||
// TODO: Could also check for inner changes, but video is most important.
|
||||
if (addr == DisplayFramebufAddr() || addr == PrevDisplayFramebufAddr()) {
|
||||
@@ -1230,7 +1231,7 @@ void FramebufferManager::UpdateFromMemory(u32 addr, int size) {
|
||||
vfb->dirtyAfterDisplay = true;
|
||||
// TODO: This without the fbo_unbind() above would be better than destroying the FBO.
|
||||
// However, it doesn't seem to work for Star Ocean, at least
|
||||
if (g_Config.bBufferedRendering) {
|
||||
if (useBufferedRendering_) {
|
||||
fbo_bind_as_render_target(vfb->fbo);
|
||||
needUnbind = true;
|
||||
DrawPixels(Memory::GetPointer(addr), vfb->format, vfb->fb_stride);
|
||||
|
||||
Reference in new issue
Block a user