Skip to content

gfx: one name per uniform statement, so the Tizen emulator compiles the ambient shader - #1481

Merged
GLinnik21 merged 6 commits into
mainfrom
gfx/one-declaration-per-statement
Nov 20, 2026
Merged

GLinnik21 merged 6 commits into
mainfrom
gfx/one-declaration-per-statement

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Samsung's TV 10.0 emulator (YaGL GLES 2.0 over the host's Mesa) rejected the ambient vertex shader. plx_gfx could not start there: a required shader's rejection stops the app from starting. The one statement that declared four uniforms at once is now four statements, and a host test keeps every shader at one name per uniform / varying / attribute statement.

Evidence (emulator, probe build samsung/hello-tpk at e8da14ce6)

  • Unsplit VS_AMBIENT_DITHERED fails with 0:37(9): error: syntax error, unexpected NEW_IDENTIFIER, at varying highp vec2 v_dither_nc;. The same source with the four corners split compiles. A cut-down variant shows the same before and after.
  • A #version 100 preamble also makes it compile, but the link then fails ("all shaders must use same shading language version"), so that route was dropped.
  • With the split, all 14 required programs compile and link. init_gl, init_text, init_image and init_blur return, and plx_gfx draws a rect and text, with glGetError 0 at init, frame and swap, for 3420 frames.
  • Why YaGL rejects the multi-declarator is not established.
  • The optional straighten program still fails there with the same kind of error, and it has no multi-declarator. It degrades rather than exiting, and matters only over the video plane. It is left for the Tizen URI work.

webOS: the same GPU code (measured on the dev set)

The question was whether the split could cost frames on LG. It cannot, because the driver compiles both spellings to the same program. A scratch-only build of e2088058d (before) and of 9ed56b066 (after), both ARM_PROFILE=release, read each program back with glGetProgramBinaryOES (Mali format 0x8f61). Each side ran one --guest --mock boot, no keys sent.

program (built from vs_ambient.vert) binary length SHA-256, before = after
APROG 10804 cb84345b…abeae19
APROG_PLAIN 3376 50f2bc08…099c237
SCRIM_PROG 9152 a8a8f462…af366f2a5
ART_WASH 12472 ea59375d…9a2d5
PROG (control, unchanged) 18740 22586859…bd9e2b
SPROG (control, unchanged) 7396 716b5515…c82a
  • The uniform and attribute tables (names, types, sizes, locations) are identical too.
  • The only difference between the two builds is each vertex source, 509 bytes longer (the four declarations and the comment). That is parsed once at boot.
  • The instrumentation was never committed here. This is one set and its Mali driver.
  • The uniforms are looked up by name, and each corner is uploaded with its own glUniform4f.

Tests

  • the_one_name_per_declaration_scan_counts_exactly_the_storage_statements_with_two_names: the scan counts uniform vec4 a, b; and its array and multi-line forms. It does not count commas in comments, parameter lists, array sizes, locals, or identifiers that merely contain a storage keyword.
  • every_shader_keeps_one_name_per_declaration_in_a_uniform_varying_or_attribute_statement: walks shaders/, so a new shader is covered by being added. It was red before the split.
  • make test-crate C=plx_gfx: test result: ok. 282 passed; 0 failed; 14 ignored.

🤖 Generated with Claude Code

GLinnik21 and others added 6 commits November 20, 2026 07:36
…ribute

A host test, red against vs_ambient.vert's four-name uniform statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the Samsung TV 10.0 emulator (YaGL, which hands shaders to Mesa llvmpipe)
the three programs built on vs_ambient.vert fail to link with "all shaders
must use same shading language version", while the eleven other required
pairs link. `uniform vec4 u_atl, u_atr, u_abr, u_abl;` is the only
multi-declarator statement in shaders/, so it is split into four one-name
declarations. The uniforms are looked up by name, so a conforming driver
reads the same program. The scan test the previous commit added now passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The emulator rejects VS_AMBIENT_DITHERED at its dither varying; the
four-name uniform statement was the only multi-declarator, which makes it
the suspected cause, not a confirmed one. The test's doc, its failure
message and the shader's comment now say that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the TV 10.0 x86_64 emulator, with the Tizen hello-world probe (samsung/hello-tpk
at e8da14c), the unsplit vs_ambient.vert failed, the split source compiled, a
cut-down variant did the same, and with the split all 14 required programs
compiled and linked and plx_gfx drew. The host test's doc comment and the shader's
comment said the split was only the suspected cause; they now state what was
measured and what is still not established (why YaGL rejects the statement, and
the optional straighten program that still fails there).

The doc comment also no longer says that gfx_compile exits the process: a
required shader's rejection stops the app from starting, whichever way that is
done. The test's assertion message says the same as the comment.

Co-Authored-By: Claude <noreply@anthropic.com>
The comment said every declaration names one variable, and that the host test
keeps the sources one-per-statement. The test enforces only uniform, varying and
attribute statements, and its self-test allows a local `vec2 a, b;`. The comment
now says the same as the test's doc comment.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit eb74ef8 into main Nov 20, 2026
14 checks passed
@GLinnik21
GLinnik21 deleted the gfx/one-declaration-per-statement branch November 20, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant