Attempt to support rendering depth/stencil.

But no interface yet.  I can't tell if it works, I just get black...
This commit is contained in:
Unknown W. Brackets 2013-09-28 02:38:05 -07:00
parent 14efcbcc9b
commit da1d700904
5 changed files with 30 additions and 9 deletions

View file

@ -1380,6 +1380,7 @@ bool FramebufferManager::GetCurrentDepthbuffer(GPUDebugBuffer &buffer) {
if (!vfb) {
// If there's no vfb and we're drawing there, must be memory?
// TODO: Is the value 16-bit? It seems to be.
buffer = GPUDebugBuffer(Memory::GetPointer(z_address), z_stride, 512, GPU_DBG_FORMAT_16BIT);
return true;
}

View file

@ -752,3 +752,18 @@ bool SoftGPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer)
buffer = GPUDebugBuffer(fb.data, gstate.FrameBufStride(), 512, gstate.FrameBufFormat());
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...?
// TODO: Is the value 16-bit? It seems to be.
buffer = GPUDebugBuffer(depthbuf.data, gstate.DepthBufStride(), 512, GPU_DBG_FORMAT_16BIT);
return true;
}
bool SoftGPU::GetCurrentStencilbuffer(GPUDebugBuffer &buffer)
{
// TODO: Just need the alpha value from the framebuffer...
return false;
}

View file

@ -74,15 +74,9 @@ public:
}
virtual bool GetCurrentFramebuffer(GPUDebugBuffer &buffer);
bool GetCurrentTexture(GPUDebugBuffer &buffer) {
// TODO
return false;
}
virtual bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) {
// TODO
return false;
}
virtual bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) {
virtual bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer);
virtual bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer);
virtual bool GetCurrentTexture(GPUDebugBuffer &buffer) {
// TODO
return false;
}

View file

@ -219,6 +219,9 @@ void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt) {
if (fmt == FORMAT_8888) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glfmt = GL_UNSIGNED_BYTE;
} else if (fmt == FORMAT_FLOAT) {
glfmt = GL_FLOAT;
components = GL_RED;
} else {
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
if (fmt == FORMAT_4444) {
@ -228,6 +231,11 @@ void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt) {
} else if (fmt == FORMAT_565) {
glfmt = GL_UNSIGNED_SHORT_5_6_5;
components = GL_RGB;
} else if (fmt == FORMAT_16BIT) {
glfmt = GL_UNSIGNED_SHORT;
components = GL_RED;
} else {
_dbg_assert_msg_(COMMON, false, "Invalid SimpleGLWindow format.");
}
}

View file

@ -29,6 +29,9 @@ struct SimpleGLWindow {
FORMAT_5551 = 1,
FORMAT_4444 = 2,
FORMAT_8888 = 3,
FORMAT_FLOAT = 0x10,
FORMAT_16BIT = 0x11,
};
enum Flags {