mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-19 07:51:57 +09:00
[Fix, Test] (MG_Backend/DirectVulkan): convert every default-framebuffer rectangle between GL and display Y origins - viewport, scissor, ReadPixels offset, rect-capable readback remap, blit source
This commit is contained in:
@@ -601,9 +601,13 @@ namespace MGITest {
|
||||
}
|
||||
|
||||
Image ReadPixels(int width, int height) {
|
||||
return ReadPixelsRect(0, 0, width, height);
|
||||
}
|
||||
|
||||
Image ReadPixelsRect(int x, int y, int width, int height) {
|
||||
Image image(width, height);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image.Data());
|
||||
glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image.Data());
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,11 +184,18 @@ namespace MGITest {
|
||||
|
||||
void ClearTo(float r, float g, float b, float a);
|
||||
|
||||
// Reads back the whole currently bound READ framebuffer. width/height must
|
||||
// be the target's full size - DirectVulkan's default-framebuffer readback
|
||||
// only re-orients a full-extent read.
|
||||
// Reads back the whole currently bound READ framebuffer.
|
||||
Image ReadPixels(int width, int height);
|
||||
|
||||
// A PARTIAL glReadPixels. Row 0 of the returned image is GL row `y` of the
|
||||
// framebuffer, i.e. the bottom row of the requested rect - the same
|
||||
// convention ReadPixels uses, just with an origin. This is the shape the
|
||||
// conformance suite reads in (a random sub-rect of the default
|
||||
// framebuffer), and the shape DirectVulkan's default-FBO readback used to
|
||||
// hand back in Vulkan row order because its re-orientation only ran on an
|
||||
// exact full-extent read.
|
||||
Image ReadPixelsRect(int x, int y, int width, int height);
|
||||
|
||||
// Drains any GL error queue and returns the first error, or 0.
|
||||
unsigned int FirstGLError();
|
||||
const char* GLErrorName(unsigned int error);
|
||||
|
||||
Reference in New Issue
Block a user