Skip to content

Fix Intel "Failed to map buffer for frame" during playback#274

Merged
tedwaine merged 1 commit into
AcademySoftwareFoundation:developfrom
bdeluca:pr/fix-intel-pbo-cache
Jun 18, 2026
Merged

Fix Intel "Failed to map buffer for frame" during playback#274
tedwaine merged 1 commit into
AcademySoftwareFoundation:developfrom
bdeluca:pr/fix-intel-pbo-cache

Conversation

@bdeluca

@bdeluca bdeluca commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

The Mac (__OPENGL_4_1__) path of GLBlindRGBA8bitTex::map_buffer_for_upload stores the glMapBuffer result in mapped_address_, so the cache check at the top short-circuits subsequent calls. The non-Mac path returned glMapNamedBuffer directly without storing it, so the cache never fired and every prepare-for-upload re-ran glNamedBufferData + glMapNamedBuffer on the same PBO.

NVIDIA accepts the re-orphan-and-map; Intel returns NULL once the buffer has been used as a GL_PIXEL_UNPACK_BUFFER source, which spams "Failed to map buffer for frame" during normal playback. Store the map result, clear it after glUnmapNamedBuffer in __bind, and after buffer deletion in resize() so we don't return a stale pointer.

Tested on Windows with both Intel and NVIDIA GPUs, and on Linux with NVIDIA. If it's really necessary to test the Linux/Intel combination I can do it, but it won't be until next week.

The Mac (__OPENGL_4_1__) path assigned the glMapBuffer result to
mapped_address_, so the cache check at the top of map_buffer_for_upload
(if (!resize(buffer_size) && mapped_address_) return mapped_address_;)
short-circuited on subsequent calls. The non-Mac path returned the
glMapNamedBuffer result directly without storing it, so mapped_address_
stayed null and the check never fired. Every prepare-for-upload re-ran
glNamedBufferData + glMapNamedBuffer on the same PBO.

NVIDIA accepts this re-orphan-and-map pattern. Intel doesn't: the remap
returns NULL once the buffer has been used as a GL_PIXEL_UNPACK_BUFFER
source, which logs 'Failed to map buffer for frame' during normal
playback.

Fix: assign the map result to mapped_address_ so the cache check fires.
Clear it after glUnmapNamedBuffer in __bind, and after the buffer
deletion in resize(), so we don't return a stale pointer.

Signed-off-by: Ben de Luca <bdeluca@gmail.com>
@tedwaine tedwaine merged commit 113864f into AcademySoftwareFoundation:develop Jun 18, 2026
2 of 3 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