From a2d91ee26da80db99aacc5f7599d9b8a215b904b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 15 Dec 2013 09:48:44 -0800 Subject: [PATCH] softgpu: Don't mask out so much of fb stride. Seems like anything from 4 is supported in 8888, most likely it just needs to align to 16 bytes. Values above 1024 work, but e.g. 2044 seems buggy. Fixes the map on Hexyz Force (rendered at 80 stride.) --- GPU/GLES/Framebuffer.cpp | 14 +++++++------- GPU/GPUState.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 40826593f0..c3b75062db 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -570,7 +570,7 @@ static void EstimateDrawingSize(int &drawing_width, int &drawing_height) { int region_height = gstate.getRegionY2() + 1; int scissor_width = gstate.getScissorX2() + 1; int scissor_height = gstate.getScissorY2() + 1; - int fb_stride = gstate.fbwidth & 0x3C0; + int fb_stride = gstate.FrameBufStride(); DEBUG_LOG(SCEGE,"viewport : %ix%i, region : %ix%i , scissor: %ix%i, stride: %i, %i", viewport_width,viewport_height, region_width, region_height, scissor_width, scissor_height, fb_stride, gstate.isModeThrough()); @@ -662,10 +662,10 @@ void FramebufferManager::SetRenderFrameBuffer() { // Get parameters u32 fb_address = gstate.getFrameBufRawAddress(); - int fb_stride = gstate.fbwidth & 0x3C0; + int fb_stride = gstate.FrameBufStride(); u32 z_address = gstate.getDepthBufRawAddress(); - int z_stride = gstate.zbwidth & 0x3C0; + int z_stride = gstate.DepthBufStride(); // Yeah this is not completely right. but it'll do for now. //int drawing_width = ((gstate.region2) & 0x3FF) + 1; @@ -1557,7 +1557,7 @@ void FramebufferManager::Resized() { bool FramebufferManager::GetCurrentFramebuffer(GPUDebugBuffer &buffer) { u32 fb_address = gstate.getFrameBufRawAddress(); - int fb_stride = gstate.fbwidth & 0x3C0; + int fb_stride = gstate.FrameBufStride(); VirtualFramebuffer *vfb = currentRenderVfb_; if (!vfb) { @@ -1584,10 +1584,10 @@ bool FramebufferManager::GetCurrentFramebuffer(GPUDebugBuffer &buffer) { bool FramebufferManager::GetCurrentDepthbuffer(GPUDebugBuffer &buffer) { u32 fb_address = gstate.getFrameBufRawAddress(); - int fb_stride = gstate.fbwidth & 0x3C0; + int fb_stride = gstate.FrameBufStride(); u32 z_address = gstate.getDepthBufRawAddress(); - int z_stride = gstate.zbwidth & 0x3C0; + int z_stride = gstate.DepthBufStride(); VirtualFramebuffer *vfb = currentRenderVfb_; if (!vfb) { @@ -1617,7 +1617,7 @@ bool FramebufferManager::GetCurrentDepthbuffer(GPUDebugBuffer &buffer) { bool FramebufferManager::GetCurrentStencilbuffer(GPUDebugBuffer &buffer) { u32 fb_address = gstate.getFrameBufRawAddress(); - int fb_stride = gstate.fbwidth & 0x3C0; + int fb_stride = gstate.FrameBufStride(); VirtualFramebuffer *vfb = currentRenderVfb_; if (!vfb) { diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 3473e864f7..751c96f1ac 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -218,10 +218,10 @@ struct GPUgstate // 0x44000000 is uncached VRAM. u32 getFrameBufAddress() const { return 0x44000000 | getFrameBufRawAddress(); } GEBufferFormat FrameBufFormat() const { return static_cast(framebufpixformat & 3); } - int FrameBufStride() const { return fbwidth&0x7C0; } + int FrameBufStride() const { return fbwidth&0x7FC; } u32 getDepthBufRawAddress() const { return (zbptr & 0xFFFFFF) | ((zbwidth & 0xFF0000) << 8); } u32 getDepthBufAddress() const { return 0x44000000 | getDepthBufRawAddress(); } - int DepthBufStride() const { return zbwidth&0x7C0; } + int DepthBufStride() const { return zbwidth&0x7FC; } // Pixel Pipeline bool isModeClear() const { return clearmode & 1; }