MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / check_pixel

Function check_pixel

test/browser/webgl2_texsubimage3d.c:14–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#define CHANNELS 4
13
14static void check_pixel(const GLubyte *buf, int x, int y,
15 GLubyte r, GLubyte g, GLubyte b, GLubyte a,
16 const char *label) {
17 int i = (y * WIDTH + x) * CHANNELS;
18 if (buf[i] == r && buf[i+1] == g && buf[i+2] == b && buf[i+3] == a) {
19 printf("PASS: %s — got rgba(%d,%d,%d,%d)\n", label, r, g, b, a);
20 } else {
21 printf("FAIL: %s — expected rgba(%d,%d,%d,%d), got rgba(%d,%d,%d,%d)\n",
22 label, r, g, b, a, buf[i], buf[i+1], buf[i+2], buf[i+3]);
23 assert(0);
24 }
25}
26
27static void read_slice(GLuint fb, GLuint tex, int z, GLubyte *out) {
28 glBindFramebuffer(GL_FRAMEBUFFER, fb);

Callers 1

mainFunction · 0.85

Calls 2

printfFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected