Skip to content

Commit 87e3250

Browse files
committed
Add a note that OpenVR overlays assume unpremultiplied alpha by default
1 parent ce11757 commit 87e3250

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/video/openvr/SDL_openvrvideo.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,14 @@ static bool OPENVR_InitializeOverlay(SDL_VideoDevice *_this,SDL_Window *window)
654654
videodata->oOverlay->SetOverlayFlag(videodata->overlayID, 1<<23, true); //vr::VROverlayFlags_EnableControlBar
655655
videodata->oOverlay->SetOverlayFlag(videodata->overlayID, 1<<24, true); //vr::VROverlayFlags_EnableControlBarKeyboard
656656
videodata->oOverlay->SetOverlayFlag(videodata->overlayID, 1<<25, true); //vr::VROverlayFlags_EnableControlBarClose
657+
#if 0
658+
/* OpenVR overlays assume unpremultiplied alpha by default, set this flag to tag the source buffer as premultiplied.
659+
* Note that (as of 2025) OpenVR overlay composition is higher quality when premultiplied buffers are provided,
660+
* as texture samplers that blend energy (such as bilinear) do not yield sensical results when operating on natively
661+
* unpremultiplied textures. It is thus preferable to hand openvr natively premultiplied buffers when accurate
662+
* sampling / composition is required. */
663+
videodata->oOverlay->SetOverlayFlag(videodata->overlayID, VROverlayFlags_IsPremultiplied, true );
664+
#endif
657665
videodata->oOverlay->SetOverlayName(videodata->overlayID, window->title);
658666

659667
videodata->bDidCreateOverlay = true;

0 commit comments

Comments
 (0)