mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-18 21:27:52 +00:00
Support 16 bit buffers in the GE debugger too.
This commit is contained in:
parent
4bc912c6db
commit
47b43e997f
@ -146,12 +146,8 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
SetPauseAction(PAUSE_GETFRAMEBUF);
|
||||
|
||||
if (bufferResult) {
|
||||
if (buffer.GetFormat() == GE_FORMAT_8888) {
|
||||
frameWindow->Draw(buffer.GetData(), buffer.GetStride(), buffer.GetHeight(), SimpleGLWindow::RESIZE_SHRINK_CENTER);
|
||||
} else {
|
||||
ERROR_LOG(COMMON, "Non-8888 buffers not yet supported.");
|
||||
frameWindow->Clear();
|
||||
}
|
||||
auto fmt = SimpleGLWindow::Format(buffer.GetFormat());
|
||||
frameWindow->Draw(buffer.GetData(), buffer.GetStride(), buffer.GetHeight(), fmt, SimpleGLWindow::RESIZE_SHRINK_CENTER);
|
||||
} else {
|
||||
ERROR_LOG(COMMON, "Unable to get buffer.");
|
||||
}
|
||||
|
@ -205,17 +205,32 @@ void SimpleGLWindow::DrawChecker() {
|
||||
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices);
|
||||
}
|
||||
|
||||
void SimpleGLWindow::Draw(u8 *data, int w, int h, ResizeType resize) {
|
||||
void SimpleGLWindow::Draw(u8 *data, int w, int h, Format fmt, ResizeType resize) {
|
||||
DrawChecker();
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glViewport(0, 0, w_, h_);
|
||||
glScissor(0, 0, w_, h_);
|
||||
|
||||
GLint components = GL_RGBA;
|
||||
GLenum glfmt;
|
||||
if (fmt == FORMAT_8888) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
glfmt = GL_UNSIGNED_BYTE;
|
||||
} else {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
if (fmt == FORMAT_4444) {
|
||||
glfmt = GL_UNSIGNED_SHORT_4_4_4_4;
|
||||
} else if (fmt == FORMAT_5551) {
|
||||
glfmt = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
} else if (fmt == FORMAT_565) {
|
||||
glfmt = GL_UNSIGNED_SHORT_5_6_5;
|
||||
components = GL_RGB;
|
||||
}
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex_);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, components, w, h, 0, components, glfmt, data);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
|
@ -24,6 +24,13 @@
|
||||
struct SimpleGLWindow {
|
||||
static const PTCHAR windowClass;
|
||||
|
||||
enum Format {
|
||||
FORMAT_565 = 0,
|
||||
FORMAT_5551 = 1,
|
||||
FORMAT_4444 = 2,
|
||||
FORMAT_8888 = 3,
|
||||
};
|
||||
|
||||
enum ResizeType {
|
||||
RESIZE_NONE,
|
||||
RESIZE_SHRINK_FIT,
|
||||
@ -34,7 +41,7 @@ struct SimpleGLWindow {
|
||||
~SimpleGLWindow();
|
||||
|
||||
void Clear();
|
||||
void Draw(u8 *data, int w, int h, ResizeType resize = RESIZE_NONE);
|
||||
void Draw(u8 *data, int w, int h, Format = FORMAT_8888, ResizeType resize = RESIZE_NONE);
|
||||
|
||||
void Swap() {
|
||||
SwapBuffers(hDC_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user