Skip to content

iris-hostgl: a texture's internal format is answered as the program gave it - #245

Merged
techomancer merged 1 commit into
techomancer:mainfrom
atomchild411:hostgl-tex-internal-format
Oct 17, 2026
Merged

techomancer merged 1 commit into
techomancer:mainfrom
atomchild411:hostgl-tex-internal-format

Conversation

@atomchild411

Copy link
Copy Markdown
Collaborator

iris-hostgl: a texture's internal format is answered as the program gave it

glGetTexLevelParameteriv(..., GL_TEXTURE_INTERNAL_FORMAT, ...) answered with the sized format the host chose. On a Mac that is GL_RGBA8 for a texture given GL_RGBA. IRIX's libGL, like Mesa, answers with the format the program asked for.

What it broke

Cosmo Player (VRML in Netscape: LivingO2 in the O2 demos, and any VRML world) probes which texture sizes work with GL_PROXY_TEXTURE_2D. It compares the internal format the proxy answers with the one it asked for, and took the Mac's answer as "refused". It then shrank every texture to 1x1, so every textured surface drew in one texel's colour:

  • the monitor's screen picture was dark;
  • the desk was flat orange;
  • the logos were solid rectangles.

A GL call trace shows the difference:

  • SGI's libGL answers GL_RGBA and Cosmo uploads 15 textures at up to 512x512.
  • Host GL on the Mac answered GL_RGBA8, and every upload was 1x1.

The change

  • The executor keeps the internal format each glTexImage1D/2D/3D and glCopyTexImage1D/2D gave, by texture, target and level. A proxy's is kept under texture 0.
  • glGetTexLevelParameter{i,f}v(GL_TEXTURE_INTERNAL_FORMAT) answers with it while the host has an image there.
  • A refused proxy (0) is left as the host answered.

The calls are generated (tools/glshim.py), and calls.rs is regenerated from it.

Tests

  • Unit test: texture_internal_format_is_answered_as_the_program_gave_it checks a GL_RGBA proxy and a texture given GL 1.0's 3. It fails on macOS without the change. On Linux it passes either way, since Mesa already answers what was asked.
  • cargo test --manifest-path iris-hostgl/Cargo.toml: 33 passed on macOS and on Linux (Debian 12 arm64, Mesa). macOS on upstream c0597bd, Linux on 6b3263f (the one commit between them is a publishing script). CI does not build host GL.
  • On IRIX 6.5.22m, Max IMPACT: LivingO2 under host GL draws its textures as SGI's libGL does, on macOS and on Linux. Its texture uploads are the same 15 sizes as under SGI's libGL.

🤖 Generated with Claude Code

…ave it

glGetTexLevelParameteriv(GL_TEXTURE_INTERNAL_FORMAT) answered with the
sized format the Mac chose -- GL_RGBA8 for GL_RGBA -- where IRIX's libGL
(and Mesa) answer with what the program asked for. Cosmo Player probes
texture sizes with GL_PROXY_TEXTURE_2D and compares that answer with the
format it asked for; on the Mac's it took every size to be refused and
shrank every texture to 1x1, so LivingO2 (the O2 demos, VRML in
Netscape) drew each texture as one texel: the monitor's screen dark, the
desk flat orange, the logos solid rectangles.

The executor keeps the internal format each glTexImage1D/2D/3D and
glCopyTexImage1D/2D gave, by texture, target and level (a proxy's under
texture 0), and answers with it while the host has an image there; a
refused proxy (0) is left alone. Generated by tools/glshim.py.

Test: texture_internal_format_is_answered_as_the_program_gave_it (fails
without).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@atomchild411
atomchild411 force-pushed the hostgl-tex-internal-format branch from 33ff6ca to bbe813e Compare October 17, 2026 22:47
@techomancer
techomancer merged commit 0f4e914 into techomancer:main Oct 17, 2026
7 checks passed
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.

2 participants