Use an accessor for depth/frame addresses.

This commit is contained in:
Unknown W. Brackets 2013-10-06 15:51:31 -07:00
parent 6e3c741d83
commit d49ad5f114
4 changed files with 17 additions and 12 deletions

View File

@ -386,10 +386,10 @@ void FramebufferManagerDX9::SetRenderFrameBuffer() {
gstate_c.framebufChanged = false;
// Get parameters
u32 fb_address = (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8);
u32 fb_address = gstate.getFrameBufRawAddress();
int fb_stride = gstate.fbwidth & 0x3C0;
u32 z_address = (gstate.zbptr & 0xFFFFFF) | ((gstate.zbwidth & 0xFF0000) << 8);
u32 z_address = gstate.getDepthBufRawAddress();
int z_stride = gstate.zbwidth & 0x3C0;
// Yeah this is not completely right. but it'll do for now.

View File

@ -516,10 +516,10 @@ void FramebufferManager::SetRenderFrameBuffer() {
gstate_c.framebufChanged = false;
// Get parameters
u32 fb_address = (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8);
u32 fb_address = gstate.getFrameBufRawAddress();
int fb_stride = gstate.fbwidth & 0x3C0;
u32 z_address = (gstate.zbptr & 0xFFFFFF) | ((gstate.zbwidth & 0xFF0000) << 8);
u32 z_address = gstate.getDepthBufRawAddress();
int z_stride = gstate.zbwidth & 0x3C0;
// Yeah this is not completely right. but it'll do for now.
@ -1402,7 +1402,7 @@ void FramebufferManager::Resized() {
}
bool FramebufferManager::GetCurrentFramebuffer(GPUDebugBuffer &buffer) {
u32 fb_address = (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8);
u32 fb_address = gstate.getFrameBufRawAddress();
int fb_stride = gstate.fbwidth & 0x3C0;
VirtualFramebuffer *vfb = currentRenderVfb_;
@ -1429,10 +1429,10 @@ bool FramebufferManager::GetCurrentFramebuffer(GPUDebugBuffer &buffer) {
}
bool FramebufferManager::GetCurrentDepthbuffer(GPUDebugBuffer &buffer) {
u32 fb_address = (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8);
u32 fb_address = gstate.getFrameBufRawAddress();
int fb_stride = gstate.fbwidth & 0x3C0;
u32 z_address = (gstate.zbptr & 0xFFFFFF) | ((gstate.zbwidth & 0xFF0000) << 8);
u32 z_address = gstate.getDepthBufRawAddress();
int z_stride = gstate.zbwidth & 0x3C0;
VirtualFramebuffer *vfb = currentRenderVfb_;
@ -1462,7 +1462,7 @@ bool FramebufferManager::GetCurrentDepthbuffer(GPUDebugBuffer &buffer) {
}
bool FramebufferManager::GetCurrentStencilbuffer(GPUDebugBuffer &buffer) {
u32 fb_address = (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8);
u32 fb_address = gstate.getFrameBufRawAddress();
int fb_stride = gstate.fbwidth & 0x3C0;
VirtualFramebuffer *vfb = currentRenderVfb_;

View File

@ -212,8 +212,13 @@ struct GPUgstate
float tgenMatrix[12];
float boneMatrix[12 * 8]; // Eight bone matrices.
u32 getFrameBufRawAddress() const { return (fbptr & 0xFFFFFF) | ((fbwidth & 0xFF0000) << 8); }
// 0x44000000 is uncached VRAM.
u32 getFrameBufAddress() const { return 0x44000000 | getFrameBufRawAddress(); }
GEBufferFormat FrameBufFormat() const { return static_cast<GEBufferFormat>(framebufpixformat & 3); }
int FrameBufStride() const { return fbwidth&0x7C0; }
u32 getDepthBufRawAddress() const { return (zbptr & 0xFFFFFF) | ((zbwidth & 0xFF0000) << 8); }
u32 getDepthBufAddress() const { return 0x44000000 | getDepthBufRawAddress(); }
int DepthBufStride() const { return zbwidth&0x7C0; }
// Pixel Pipeline

View File

@ -431,11 +431,11 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
break;
case GE_CMD_FRAMEBUFPTR:
fb.data = Memory::GetPointer(0x44000000 | (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8));
fb.data = Memory::GetPointer(gstate.getFrameBufAddress());
break;
case GE_CMD_FRAMEBUFWIDTH:
fb.data = Memory::GetPointer(0x44000000 | (gstate.fbptr & 0xFFFFFF) | ((gstate.fbwidth & 0xFF0000) << 8));
fb.data = Memory::GetPointer(gstate.getFrameBufAddress());
break;
case GE_CMD_FRAMEBUFPIXFORMAT:
@ -532,11 +532,11 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
break;
case GE_CMD_ZBUFPTR:
depthbuf.data = Memory::GetPointer(0x44000000 | (gstate.zbptr & 0xFFFFFF) | ((gstate.zbwidth & 0xFF0000) << 8));
depthbuf.data = Memory::GetPointer(gstate.getDepthBufAddress());
break;
case GE_CMD_ZBUFWIDTH:
depthbuf.data = Memory::GetPointer(0x44000000 | (gstate.zbptr & 0xFFFFFF) | ((gstate.zbwidth & 0xFF0000) << 8));
depthbuf.data = Memory::GetPointer(gstate.getDepthBufAddress());
break;
case GE_CMD_AMBIENTCOLOR: