Skip to content

build(libobs-opengl): make the conversions explicit (#2625) - #2871

Merged
zackees merged 2 commits into
masterfrom
infra/2625-conversion-libobs-opengl
Oct 29, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2625-conversion-libobs-opengl

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Slice of #2625: the conversion groups on libobs-opengl, with every conversion in the target's own translation units stated at the call site.

RED 915ec4f64 adds the three -W*conversion enablers to the libobs-opengl target only. The target's two unity translation units (build/opengl.core+.h.c, build/opengl.nix+.h.c) replay with the global -Wno-conversion / -Wno-sign-conversion / -Wno-float-conversion pins dropped and report 89 diagnostics, all -Wsign-conversion, in 12 files:

file findings
gl-helpers.c.h 28
gl-texture3d.c.h 13
gl-egl-common.c.h 12
gl-subsystem.c.h 10
gl-vertexbuffer.c.h 7
gl-shader.c.h 5
gl-texture2d.c.h 5
gl-x11-egl.c.h 3
gl-texturecube.c.h 2
gl-zstencil.c.h 2
gl-indexbuffer.c.h 1
gl-stagesurf.c.h 1

GREEN f4dd3f5cc states each one at its boundary:

  • gl-helpers / gl-subsystem: the GL entry points take GLint/GLsizei/GLenum/GLuint, so texture dimensions, mip levels, copy offsets, mapped buffer sizes, the bound framebuffer id and the vertex attribute ids convert once at the call. The viewport's base_height - y - height stays signed through the assignment.
  • gl-texture2d/gl-texture3d/gl-texturecube/gl-zstencil: the internal format (GLenum in the texture struct, GLint in the GL call), the per-mip dimensions and the mip level are explicit.
  • gl-egl-common: EGLAttrib takes the upper 32 bits of a DRM modifier as its own signed 64-bit type; the format/modifier allocation sizes and the device count are explicit.
  • gl-x11-egl: the X visual id (xcb_visualid_t) and the pixmap target (EGLint) are explicit.
  • gl-shader: the info-log lengths and the attribute index arithmetic are explicit size_t.

Every cast keeps the value the code already computed; there is no pragma and no per-file -Wno-*.

Evidence

  • Replay after the fix: 0 findings in the same 2 translation units (ci/warning_findings.py --language c, compdb of the configured tree, three pins dropped).
  • From-scratch target build in obs-rust-linux-validate:e756cdba69646bd5 at this tip (target objects rebuilt): ninja libobs-opengl → RC=0, no warning:/error: lines, libobs-opengl.so linked.
  • ./lint clean (clang-format, gersemi, the repo Dylints).

The global pins stay until every target is ratcheted; this slice only removes them from this target's flag list. MSVC is unaffected, since the generator expression does not match it.

Refs #2625. No docs/features.md line: build tooling only.

RED: the target now compiles with -Wconversion, -Wsign-conversion and
-Wfloat-conversion instead of inheriting the global -Wno-* pins. The Tier 2
replay of the target's unity TUs reports the implicit conversions that were
hidden.
GREEN: the 89 -Wsign-conversion diagnostics the RED commit exposed are stated
at their boundaries in the target's 12 translation units.

- gl-helpers/gl-subsystem: the GL entry points take GLint/GLsizei/GLenum/
  GLuint, so texture dimensions, mip levels, offsets, buffer sizes and the
  bound framebuffer/attribute ids convert once at the call.
- gl-egl-common: EGLAttrib takes the upper 32 bits of a DRM modifier, and the
  allocation sizes and device counts are explicit.
- gl-x11-egl: the X visual id and the pixmap target are explicit.
- gl-shader: the info-log lengths and the attribute index arithmetic are
  explicit size_t.

No behaviour change: every cast keeps the value the code already computed.
The global -Wno-conversion / -Wno-sign-conversion / -Wno-float-conversion stay
until every target is ratcheted.
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit 1266081 Oct 29, 2026
34 checks passed
@zackees
zackees deleted the infra/2625-conversion-libobs-opengl branch October 29, 2026 06:29
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…t#2879) (obs-rust#2880)

The macOS branch of device_stage_texture() is inside #ifdef __APPLE__, so the
Linux replay behind obs-rust#2871 never compiled it and missed two -Wsign-conversion
diagnostics: the framebuffer restore passes a GLint binding to
gl_bind_framebuffer(GLuint), and glReadPixels takes GLsizei widths from
uint32_t stage-surface dimensions. State both at the call; the values are
unchanged (a read-framebuffer binding is a non-negative name).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant