Skip to content

Commit bed95c2

Browse files
committed
test(tvos): inspect actual scaler LUT input and edge coefficients
1 parent 0e92b56 commit bed95c2

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

‎.github/workflows/tvos.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
"render context handoff did not complete", "native target:",
174174
"native GL provider:", "native draw:", "native renderer result:",
175175
"native uniform:", "native sampler:", "native texture allocation:",
176-
"native pass pixels:"]):
176+
"native pass pixels:", "native LUT input:", "native LUT pixels:"]):
177177
print(line)
178178
raise SystemExit(1)
179179
finally:

‎src/player/MpvVideoItem.cpp‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,56 @@ namespace {
8282
std::fprintf(stderr, "native texture allocation: texture=%d size=%dx%d level=%d format=%d\n",
8383
texture, width, height, level, internal);
8484
}
85+
if (data && width == 2 && height == 256 && format == GL_RGBA && type == GL_FLOAT) {
86+
const auto *values = static_cast<const GLfloat *>(data);
87+
GLint rowLength = 0, skipRows = 0, skipPixels = 0, unpackBuffer = 0;
88+
::glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowLength);
89+
::glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skipRows);
90+
::glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skipPixels);
91+
::glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &unpackBuffer);
92+
std::fprintf(stderr,
93+
"native LUT input: rowLength=%d skipRows=%d skipPixels=%d unpackBuffer=%d row0=%g,%g,%g,%g,%g,%g,%g,%g row1=%g,%g,%g,%g,%g,%g,%g,%g\n",
94+
rowLength, skipRows, skipPixels, unpackBuffer,
95+
double(values[0]), double(values[1]), double(values[2]), double(values[3]),
96+
double(values[4]), double(values[5]), double(values[6]), double(values[7]),
97+
double(values[8]), double(values[9]), double(values[10]), double(values[11]),
98+
double(values[12]), double(values[13]), double(values[14]), double(values[15]));
99+
}
85100
::glTexImage2D(target, level, internal, width, height, border, format, type, data);
101+
if (data && width == 2 && height == 256 && format == GL_RGBA && type == GL_FLOAT) {
102+
GLint texture = 0, read = 0, draw = 0, pack = 0, length = 0, rows = 0, pixels = 0;
103+
::glGetIntegerv(GL_TEXTURE_BINDING_2D, &texture);
104+
::glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &read);
105+
::glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw);
106+
::glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &pack);
107+
::glGetIntegerv(GL_PACK_ROW_LENGTH, &length);
108+
::glGetIntegerv(GL_PACK_SKIP_ROWS, &rows);
109+
::glGetIntegerv(GL_PACK_SKIP_PIXELS, &pixels);
110+
GLuint probe = 0;
111+
::glGenFramebuffers(1, &probe);
112+
::glBindFramebuffer(GL_FRAMEBUFFER, probe);
113+
::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, texture, 0);
114+
const GLenum status = ::glCheckFramebufferStatus(GL_FRAMEBUFFER);
115+
unsigned short values[8] {};
116+
if (status == GL_FRAMEBUFFER_COMPLETE) {
117+
::glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
118+
::glPixelStorei(GL_PACK_ROW_LENGTH, 0);
119+
::glPixelStorei(GL_PACK_SKIP_ROWS, 0);
120+
::glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
121+
::glReadPixels(0, 0, 2, 1, GL_RGBA, GL_HALF_FLOAT, values);
122+
}
123+
std::fprintf(stderr, "native LUT pixels: texture=%d status=%u error=%u row0=%04x,%04x,%04x,%04x,%04x,%04x,%04x,%04x\n",
124+
texture, unsigned(status), unsigned(::glGetError()), unsigned(values[0]), unsigned(values[1]),
125+
unsigned(values[2]), unsigned(values[3]), unsigned(values[4]), unsigned(values[5]),
126+
unsigned(values[6]), unsigned(values[7]));
127+
::glBindBuffer(GL_PIXEL_PACK_BUFFER, pack);
128+
::glPixelStorei(GL_PACK_ROW_LENGTH, length);
129+
::glPixelStorei(GL_PACK_SKIP_ROWS, rows);
130+
::glPixelStorei(GL_PACK_SKIP_PIXELS, pixels);
131+
::glBindFramebuffer(GL_READ_FRAMEBUFFER, read);
132+
::glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw);
133+
::glDeleteFramebuffers(1, &probe);
134+
}
86135
}
87136
void diagnosticDrawArrays(GLenum mode, GLint first, GLsizei count)
88137
{

‎tools/apple/smoke-tvos.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ for bundle, arguments, expected in checks:
105105
"render context handoff did not complete", "native target:", "native GL provider:",
106106
"native presentation diagnostic:", "native draw:", "native renderer result:",
107107
"native uniform:", "native sampler:", "native texture allocation:",
108-
"native pass pixels:"]):
108+
"native pass pixels:", "native LUT input:", "native LUT pixels:"]):
109109
print(re.sub(r"https?://\S+", "[redacted-url]", line))
110110
if any(marker in line for marker in ["launch test:", "video result:", "orientation:", "viewport:", "decoder:",
111111
"render context was not ready", "failed to initialize mpv",

0 commit comments

Comments
 (0)