mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 16:53:40 +01:00
softgpu: Use region for debugger buffer previews.
It's fine if it resizes or etc., but this should generally be the interesting area of vram to show, without any confusing noise on the side/etc.
This commit is contained in:
1 parent
9f86959826
commit
eb0ea71f24
2 files changed
+35
-11
No files matched your search
@@ -1260,14 +1260,16 @@ void DrawLine(const VertexData &v0, const VertexData &v1)
|
||||
|
||||
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer)
|
||||
{
|
||||
buffer.Allocate(gstate.DepthBufStride(), 512, GPU_DBG_FORMAT_8BIT);
|
||||
int w = gstate.getRegionX2() - gstate.getRegionX1() + 1;
|
||||
int h = gstate.getRegionY2() - gstate.getRegionY1() + 1;
|
||||
buffer.Allocate(w, h, GPU_DBG_FORMAT_8BIT);
|
||||
|
||||
u8 *row = buffer.GetData();
|
||||
for (int y = 0; y < 512; ++y) {
|
||||
for (int x = 0; x < gstate.DepthBufStride(); ++x) {
|
||||
row[x] = GetPixelStencil(x, y);
|
||||
for (int y = gstate.getRegionY1(); y <= gstate.getRegionY2(); ++y) {
|
||||
for (int x = gstate.getRegionX1(); x <= gstate.getRegionX2(); ++x) {
|
||||
row[x - gstate.getRegionX1()] = GetPixelStencil(x, y);
|
||||
}
|
||||
row += gstate.DepthBufStride();
|
||||
row += w;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -865,17 +865,39 @@ bool SoftGPU::FramebufferDirty() {
|
||||
|
||||
bool SoftGPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer)
|
||||
{
|
||||
// We don't know the height, so just use 512, which should be the max (hopefully?)
|
||||
// TODO: Could check clipping and such, though...?
|
||||
buffer = GPUDebugBuffer(fb.data, gstate.FrameBufStride(), 512, gstate.FrameBufFormat());
|
||||
int w = gstate.getRegionX2() - gstate.getRegionX1() + 1;
|
||||
int h = gstate.getRegionY2() - gstate.getRegionY1() + 1;
|
||||
buffer.Allocate(w, h, gstate.FrameBufFormat());
|
||||
|
||||
u8 *src = fb.data;
|
||||
u8 *dst = buffer.GetData();
|
||||
for (int y = gstate.getRegionY1(); y <= gstate.getRegionY2(); ++y) {
|
||||
if (gstate.FrameBufFormat() == GE_FORMAT_8888) {
|
||||
memcpy(dst, src + gstate.getRegionX1(), (gstate.getRegionX2() + 1) * 4);
|
||||
dst += w * 4;
|
||||
src += gstate.FrameBufStride() * 4;
|
||||
} else {
|
||||
memcpy(dst, src + gstate.getRegionX1(), (gstate.getRegionX2() + 1) * 2);
|
||||
dst += w * 2;
|
||||
src += gstate.FrameBufStride() * 2;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SoftGPU::GetCurrentDepthbuffer(GPUDebugBuffer &buffer)
|
||||
{
|
||||
// We don't know the height, so just use 512, which should be the max (hopefully?)
|
||||
// TODO: Could check clipping and such, though...?
|
||||
buffer = GPUDebugBuffer(depthbuf.data, gstate.DepthBufStride(), 512, GPU_DBG_FORMAT_16BIT);
|
||||
int w = gstate.getRegionX2() - gstate.getRegionX1() + 1;
|
||||
int h = gstate.getRegionY2() - gstate.getRegionY1() + 1;
|
||||
buffer.Allocate(w, h, GPU_DBG_FORMAT_16BIT);
|
||||
|
||||
u8 *src = depthbuf.data;
|
||||
u8 *dst = buffer.GetData();
|
||||
for (int y = gstate.getRegionY1(); y <= gstate.getRegionY2(); ++y) {
|
||||
memcpy(dst, src + gstate.getRegionX1(), (gstate.getRegionX2() + 1) * 2);
|
||||
dst += w * 2;
|
||||
src += gstate.DepthBufStride() * 2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user