Compare commits

...
Author SHA1 Message Date
spoopyghosty0 8cf2dc1e4d FrameBridge: emulate inverse alpha blending with passthrough (#329)
Star Wars: Beyond Victory's mixed reality showed the room on the game's
objects and black where the room should be. Unreal keeps 1 - coverage in
the scene alpha, and OVRPlugin chains XrCompositionLayerAlphaBlendFB
(colour ONE_MINUS_SRC_ALPHA / SRC_ALPHA) to the eye layer; the Frame's
runtime ignores the struct and blends with the plain texture alpha.

New adapter setting alpha_blend_emul (default on, Vulkan): while
passthrough is emulated and the projection layer asks for inverse
blending, the alpha of the eye image rectangles is inverted in place
(alpha-only blend pass, once per acquired image, queued ahead of the
runtime's submission). layer_debug now also logs the blend factors.
Headless on the Frame: factors (3,2/3,2) seen, inversion runs, 72 fps,
no rejected frames. Not yet checked in the headset.
2026-10-15 20:55:04 -04:00
17 changed files with 427 additions and 17 deletions

No files matched your search

+2 -2
View File
@@ -13,11 +13,11 @@ e8c0965c188665a4e565e4a3af983ef1866d1cf9225665cc90d8df286bc96ef3 ./arm64-v8a/li
5432674a59d02f411cd853a5dc57e3fa547d1ac518f25bf433fc54c43677177a ./arm64-v8a/libfpglmv.so
8a8f6b1da8952cb3933a5b53558424a5fc56043b2527a16bb6dd62a00d2de01a ./arm64-v8a/libframe_xrshim.so
19ba5ed3c4b780f5ae46251f6958f552acfc5f13c8bb39f995579593fa8990c6 ./arm64-v8a/libglshim.so
0f058921e9c1f5b9ef5847cc9e6b80a23e75028c76c1d3bb02d1610b535f81c9 ./arm64-v8a/libopenxr_loader_generic.so
02e09b817edc4ef3e8d2c32df8c27f647267a932166745130e904a185e1c3422 ./arm64-v8a/libopenxr_loader_generic.so
1feaeafad467c4cafdf2b018a4d84b0bee200c3f711697b4ce97e66a3ba256ca ./arm64-v8a/libovrplatformcompat.so
a4ed80ae45ca90758239f152ea5a2e8c127d491e1e697ea5680db6fd7f72db07 ./arm64-v8a/libvrapi.so
a4ed80ae45ca90758239f152ea5a2e8c127d491e1e697ea5680db6fd7f72db07 ./arm64-v8a/libvrapi_foveation.so
9e8a7ce599b62a7c607b0d3637e4ec1b1ea1974c3373a7af3f5920ad2adc5e00 ./armeabi-v7a/libopenxr_loader_generic.so
e2a7ff9fa4a1f0977e62a4cac7534736c4f48fa8a5770b84bd0ae371dfc4b797 ./armeabi-v7a/libopenxr_loader_generic.so
1871eae093432d277da4bc751bf5f3269dfcf11f9168260b0c3caadb0dedb19d ./dex/oculusos-stubs.dex
b634ab5640e258563c536e658cad87080553df6f34f62269a21d554844e58bfe ./hevc/COPYING.FFmpeg
141de01f0d40b97d4f9a720db5ab8ea442f6aa35db5272048899292884994a1c ./hevc/libstagefrighthw.so
Binary file not shown.
Binary file not shown.
+2
View File
@@ -80,6 +80,8 @@
- Swapchain formats: GLES `GL_SRGB8_ALPHA8` (35907) / `GL_SRGB8` (35905) only, samples = 1. Vulkan: 43 (R8G8B8A8_SRGB)
and 50, not 37/44 (UNORM).
- Environment blend: ALPHA_BLEND available (grayscale passthrough cameras).
- XR_FB_composition_layer_alpha_blend and XR_KHR_composition_layer_color_scale_bias are not the runtime's (OVRPort's
dispatcher lists alpha_blend): their structs are ignored, so FrameBridge emulates inverse alpha (`alpha_blend_emul`).
- Reference spaces: STAGE bounds are reported as 1×1 m.
- Display 72 Hz by default in tests. Head pose is only tracked while the headset is worn; otherwise flags 0x3 and
the session stays below FOCUSED.
+17 -2
View File
@@ -2,7 +2,7 @@
# Patches
Every patch and game setting FramePort knows: 169 entries in 5 groups. A game's recipe is its chosen patches and settings; tested games get theirs from the catalog ([GAMES.md](GAMES.md)), and other games get the patches FramePort suggests from its analysis. You change them on the game page under Customize.
Every patch and game setting FramePort knows: 170 entries in 5 groups. A game's recipe is its chosen patches and settings; tested games get theirs from the catalog ([GAMES.md](GAMES.md)), and other games get the patches FramePort suggests from its analysis. You change them on the game page under Customize.
Each entry says what the patch does, whether it changes the APK or only the install, when FramePort suggests it, its options, the catalog games whose recipe names it and the launch-test signatures that suggest it. Patches that are on by default are on for every game, so the catalog rarely names them.
@@ -12,7 +12,7 @@ Link to an entry with its id, dots replaced by dashes: `PATCHES.md#frame-unity_t
- [Patches from OVRPort](#group-overport) (25)
- [Steam Frame patches](#group-frame) (55)
- [Game settings](#group-adapter) (68)
- [Game settings](#group-adapter) (69)
- [Files and settings on the Frame](#group-device) (8)
- [PC VR (Proton and Revive)](#group-pcvr) (13)
@@ -103,6 +103,7 @@ Link to an entry with its id, dots replaced by dashes: `PATCHES.md#frame-unity_t
| [Pointer start](#adapter-aim_forward) | `adapter.aim_forward` | Game settings | |
| [Pointer angle](#adapter-aim_pitch) | `adapter.aim_pitch` | Game settings | |
| [Pointer turn](#adapter-aim_yaw) | `adapter.aim_yaw` | Game settings | |
| [Fix inside-out mixed reality](#adapter-alpha_blend_emul) | `adapter.alpha_blend_emul` | Game settings | |
| [Use controllers](#adapter-controller_fix) | `adapter.controller_fix` | Game settings | 1 |
| [Show Steam Frame controllers](#adapter-controller_models) | `adapter.controller_models` | Game settings | 4 |
| [Stand in for cube layers](#adapter-cube_standin) | `adapter.cube_standin` | Game settings | |
@@ -1270,6 +1271,20 @@ Turns the pointer left or right.
> Turns the controllers' pointing ray left (+) or right (−).
### <a id="adapter-alpha_blend_emul"></a>Fix inside-out mixed reality
For games that show your room on their objects and darkness where your room should be.
- `adapter.alpha_blend_emul`
- **Changes:** Game setting: stored in the build and on the Frame (settings.conf); can be changed without a rebuild.
- **Suggested:** not automatically; set on the game page (Customize), by a recipe or after a launch test.
- **Options:**
- Value: int, default `1`.
- Game settings → Mixed reality → "Fix inside-out mixed reality" (advanced); shown while `adapter.passthrough_emul` is on.
- **Source:** [patches/settings.py](../src/frameport/patches/settings.py)
> With emulated passthrough, honours the eye layer's XR_FB_composition_layer_alpha_blend, which the Frame's runtime ignores: Unreal games keep inverted alpha and ask for inverse blending, so the room showed where the game drew and black where it should show the room (for example Star Wars: Beyond Victory). The alpha is inverted in the game's image before it is composited (Vulkan).
### <a id="adapter-controller_fix"></a>Use controllers
Turn off only for games you play with your hands instead of controllers.
+1
View File
@@ -172,6 +172,7 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
| Upside-down image in a GL bridge game | GL images start at the bottom row | fixed in the bridge (swap angleUp/Down for GL chains) |
| UI panels upside down (AC Nexus) | XrCompositionLayerImageLayoutFB VERTICAL_FLIP unsupported | adapter `flip_emul=1` (default); rotating quads makes them vanish |
| Passthrough black (BAM) | XR_FB_passthrough missing | adapter `passthrough_emul=1` (default) + `patch_force_passthrough` for MR-only games |
| Mixed reality inside out: the room shows on the game's objects, black where the room should be (Unreal, for example Star Wars: Beyond Victory, GitHub #329) | Unreal keeps 1 - coverage in the scene alpha and OVRPlugin chains XrCompositionLayerAlphaBlendFB (colour factors ONE_MINUS_SRC_ALPHA / SRC_ALPHA, `layer_debug` shows `n=1000041001(3,2/3,2)`) to the eye layer; the Frame's runtime ignores it | adapter `alpha_blend_emul=1` (default, Vulkan): inverts the alpha of the eye images in place while passthrough is emulated; logs `alpha_blend: inverting the alpha of swapchain=…` |
| Quest Touch controllers (or none) shown in a game that uses Meta's runtime controller models | XR_FB_render_model missing on the Frame | adapter `controller_models=1`: the agent converts the Frame's SteamVR controller models to glb at install, the adapter serves them. Games with their own controller meshes aren't affected (none of the 34 catalog games use runtime models) |
| `overportOXR: Unknown proc addr: xr…` for a function the adapter emulates | overport's dispatcher only forwards functions in its own table | route the plugin's lookups through `native/xrshim` (done for XR_FB_render_model when `controller_models=1`) |
| MR game stuck waiting for room data (Demeter) | no Meta scene API | adapter `scene_emul=1` (+ `frame.meta_permissions`) |
+5
View File
@@ -0,0 +1,5 @@
#version 450
// alpha_blend_vk.c: with blending (one minus destination alpha, zero) and only alpha written, the image's alpha
// becomes 1 - alpha.
layout(location=0) out vec4 outputColor;
void main(){outputColor=vec4(0,0,0,1);}
+3
View File
@@ -0,0 +1,3 @@
#version 450
// A triangle that covers the whole viewport (alpha_blend_vk.c).
void main(){vec2 p=vec2((gl_VertexIndex<<1)&2,gl_VertexIndex&2);gl_Position=vec4(p*2-1,0,1);}
+42
View File
@@ -0,0 +1,42 @@
// Generated from alpha_blend.vert and alpha_blend.frag.
static const uint32_t alpha_blend_vert_spv[] = {
0x07230203,0x00010000,0x000d000a,0x0000002c,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000c,0x0000001d,0x00040047,
0x0000000c,0x0000000b,0x0000002a,0x00050048,0x0000001b,0x00000000,0x0000000b,0x00000000,
0x00050048,0x0000001b,0x00000001,0x0000000b,0x00000001,0x00050048,0x0000001b,0x00000002,
0x0000000b,0x00000003,0x00050048,0x0000001b,0x00000003,0x0000000b,0x00000004,0x00030047,
0x0000001b,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040015,0x0000000a,
0x00000020,0x00000001,0x00040020,0x0000000b,0x00000001,0x0000000a,0x0004003b,0x0000000b,
0x0000000c,0x00000001,0x0004002b,0x0000000a,0x0000000e,0x00000001,0x0004002b,0x0000000a,
0x00000010,0x00000002,0x00040017,0x00000017,0x00000006,0x00000004,0x00040015,0x00000018,
0x00000020,0x00000000,0x0004002b,0x00000018,0x00000019,0x00000001,0x0004001c,0x0000001a,
0x00000006,0x00000019,0x0006001e,0x0000001b,0x00000017,0x00000006,0x0000001a,0x0000001a,
0x00040020,0x0000001c,0x00000003,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000003,
0x0004002b,0x0000000a,0x0000001e,0x00000000,0x0004002b,0x00000006,0x00000020,0x40000000,
0x0004002b,0x00000006,0x00000022,0x3f800000,0x0004002b,0x00000006,0x00000025,0x00000000,
0x00040020,0x00000029,0x00000003,0x00000017,0x0005002c,0x00000007,0x0000002b,0x00000022,
0x00000022,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003d,0x0000000a,0x0000000d,0x0000000c,0x000500c4,0x0000000a,0x0000000f,0x0000000d,
0x0000000e,0x000500c7,0x0000000a,0x00000011,0x0000000f,0x00000010,0x0004006f,0x00000006,
0x00000012,0x00000011,0x000500c7,0x0000000a,0x00000014,0x0000000d,0x00000010,0x0004006f,
0x00000006,0x00000015,0x00000014,0x00050050,0x00000007,0x00000016,0x00000012,0x00000015,
0x0005008e,0x00000007,0x00000021,0x00000016,0x00000020,0x00050083,0x00000007,0x00000024,
0x00000021,0x0000002b,0x00050051,0x00000006,0x00000026,0x00000024,0x00000000,0x00050051,
0x00000006,0x00000027,0x00000024,0x00000001,0x00070050,0x00000017,0x00000028,0x00000026,
0x00000027,0x00000025,0x00000022,0x00050041,0x00000029,0x0000002a,0x0000001d,0x0000001e,
0x0003003e,0x0000002a,0x00000028,0x000100fd,0x00010038,
};
static const uint32_t alpha_blend_frag_spv[] = {
0x07230203,0x00010000,0x000d000a,0x0000000d,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x00030010,0x00000004,
0x00000007,0x00040047,0x00000009,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,
0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,
0x00000004,0x00040020,0x00000008,0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,
0x00000003,0x0004002b,0x00000006,0x0000000a,0x00000000,0x0004002b,0x00000006,0x0000000b,
0x3f800000,0x0007002c,0x00000007,0x0000000c,0x0000000a,0x0000000a,0x0000000a,0x0000000b,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0003003e,
0x00000009,0x0000000c,0x000100fd,0x00010038,
};
+301
View File
@@ -0,0 +1,301 @@
// SPDX-License-Identifier: GPL-3.0-only
// Included by frame_adapter.c after flip_vk.c. XR_FB_composition_layer_alpha_blend for emulated passthrough
// (setting alpha_blend_emul, Vulkan sessions).
//
// Passthrough is emulated by compositing the game's projection layer over the Frame's cameras with its texture alpha
// (ALPHA_BLEND environment). Unreal's mobile renderer keeps 1 - coverage in the scene alpha (0 where it drew, 1 where
// it drew nothing), and Meta's OVRPlugin compensates with an XrCompositionLayerAlphaBlendFB on the eye layer
// (source colour factor ONE_MINUS_SRC_ALPHA, destination SRC_ALPHA). The Frame's runtime ignores that struct, so the
// cameras showed through the scene and the empty background stayed black (GitHub #329, Star Wars: Beyond Victory).
// Blending src * (1 - a) + dst * a is the same as the runtime's standard blend with alpha 1 - a, so the alpha of the
// layer's image rectangles is inverted in place, once per acquired image, by a tiny render pass (blend: one minus
// destination alpha, zero; only alpha written) before the frame goes to the runtime. Our work is queued on the app's
// queue ahead of the runtime's xrEndFrame submission; command buffers come from a ring and are only waited for when
// reused, several frames later.
#include "alpha_blend_spv.h"
#define AB_RING 4
#define AB_TARGETS 32
static struct {
VkDevice device; // the session's device these objects belong to
int state; // 0 = not set up, 1 = ready, -1 = failed
VkFormat format; // the pipeline's colour format
PFN_vkCreateShaderModule CreateShaderModule;
PFN_vkDestroyShaderModule DestroyShaderModule;
PFN_vkCreatePipelineLayout CreatePipelineLayout;
PFN_vkCreateRenderPass CreateRenderPass;
PFN_vkDestroyRenderPass DestroyRenderPass;
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
PFN_vkDestroyPipeline DestroyPipeline;
PFN_vkCreateImageView CreateImageView;
PFN_vkDestroyImageView DestroyImageView;
PFN_vkCreateFramebuffer CreateFramebuffer;
PFN_vkDestroyFramebuffer DestroyFramebuffer;
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
PFN_vkCmdEndRenderPass CmdEndRenderPass;
PFN_vkCmdBindPipeline CmdBindPipeline;
PFN_vkCmdSetViewport CmdSetViewport;
PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdDraw CmdDraw;
VkShaderModule vs, fs;
VkPipelineLayout layout;
VkRenderPass pass;
VkPipeline pipeline;
VkCommandBuffer cmd[AB_RING];
VkFence fence[AB_RING];
int pending[AB_RING], next;
struct { XrSwapchain swapchain; VkImage image; uint32_t layer, w, h; VkImageView view; VkFramebuffer fb; } targets[AB_TARGETS];
} ab;
static int ab_functions(void) {
#define AB_DEV(name) ab.name = (PFN_vk##name)vk.GetDeviceProcAddr(vk.device, "vk" #name); if (!ab.name) return 0;
AB_DEV(CreateShaderModule) AB_DEV(DestroyShaderModule) AB_DEV(CreatePipelineLayout) AB_DEV(CreateRenderPass)
AB_DEV(DestroyRenderPass) AB_DEV(CreateGraphicsPipelines) AB_DEV(DestroyPipeline) AB_DEV(CreateImageView)
AB_DEV(DestroyImageView) AB_DEV(CreateFramebuffer) AB_DEV(DestroyFramebuffer) AB_DEV(CmdBeginRenderPass)
AB_DEV(CmdEndRenderPass) AB_DEV(CmdBindPipeline) AB_DEV(CmdSetViewport) AB_DEV(CmdSetScissor) AB_DEV(CmdDraw)
#undef AB_DEV
return 1;
}
// Command buffers, fences and shaders: once per session device.
static int ab_ready(void) {
if (ab.device != vk.device) { // a new session (the old device's objects went with it)
memset(&ab, 0, sizeof(ab));
ab.device = vk.device;
}
if (ab.state) return ab.state > 0;
ab.state = -1;
if (!vk_ready() || !ab_functions()) return 0;
VkCommandBufferAllocateInfo alloc = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, NULL, vk.pool,
VK_COMMAND_BUFFER_LEVEL_PRIMARY, AB_RING};
if (vk.AllocateCommandBuffers(vk.device, &alloc, ab.cmd) != VK_SUCCESS) return 0;
for (int i = 0; i < AB_RING; ++i) {
VkFenceCreateInfo fence = {VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, NULL, 0};
if (vk.CreateFence(vk.device, &fence, NULL, &ab.fence[i]) != VK_SUCCESS) return 0;
}
VkShaderModuleCreateInfo vs = {VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, NULL, 0, sizeof(alpha_blend_vert_spv),
alpha_blend_vert_spv};
VkShaderModuleCreateInfo fs = {VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, NULL, 0, sizeof(alpha_blend_frag_spv),
alpha_blend_frag_spv};
if (ab.CreateShaderModule(vk.device, &vs, NULL, &ab.vs) != VK_SUCCESS ||
ab.CreateShaderModule(vk.device, &fs, NULL, &ab.fs) != VK_SUCCESS) return 0;
VkPipelineLayoutCreateInfo layout = {VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, NULL, 0, 0, NULL, 0, NULL};
if (ab.CreatePipelineLayout(vk.device, &layout, NULL, &ab.layout) != VK_SUCCESS) return 0;
ab.state = 1;
return 1;
}
// Render pass + pipeline for one colour format (the eye swapchains': rebuilt only if it changes).
static int ab_pipeline(VkFormat format) {
if (ab.pipeline && ab.format == format) return 1;
if (ab.pipeline) { ab.DestroyPipeline(vk.device, ab.pipeline, NULL); ab.pipeline = VK_NULL_HANDLE; }
if (ab.pass) { ab.DestroyRenderPass(vk.device, ab.pass, NULL); ab.pass = VK_NULL_HANDLE; }
VkAttachmentDescription color = {0, format, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_LOAD,
VK_ATTACHMENT_STORE_OP_STORE, VK_ATTACHMENT_LOAD_OP_DONT_CARE,
VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL};
VkAttachmentReference ref = {0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL};
VkSubpassDescription subpass = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, NULL, 1, &ref, NULL, NULL, 0, NULL};
VkSubpassDependency deps[2] = {
// the app's rendering into the image (any stage) before our read-modify-write
{VK_SUBPASS_EXTERNAL, 0, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_ACCESS_MEMORY_WRITE_BIT, VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, 0},
// and ours before whatever the runtime does with it next
{0, VK_SUBPASS_EXTERNAL, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, 0},
};
VkRenderPassCreateInfo rp = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, NULL, 0, 1, &color, 1, &subpass, 2, deps};
if (ab.CreateRenderPass(vk.device, &rp, NULL, &ab.pass) != VK_SUCCESS) { ab.pass = VK_NULL_HANDLE; return 0; }
VkPipelineShaderStageCreateInfo stages[2] = {
{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, NULL, 0, VK_SHADER_STAGE_VERTEX_BIT, ab.vs, "main", NULL},
{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, NULL, 0, VK_SHADER_STAGE_FRAGMENT_BIT, ab.fs, "main", NULL},
};
VkPipelineVertexInputStateCreateInfo input = {VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
VkPipelineInputAssemblyStateCreateInfo assembly = {VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, NULL,
0, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, VK_FALSE};
VkPipelineViewportStateCreateInfo viewport = {VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, NULL, 0, 1, NULL,
1, NULL};
VkPipelineRasterizationStateCreateInfo raster = {VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO};
raster.polygonMode = VK_POLYGON_MODE_FILL;
raster.cullMode = VK_CULL_MODE_NONE;
raster.lineWidth = 1.0f;
VkPipelineMultisampleStateCreateInfo multisample = {VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO};
multisample.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
VkPipelineColorBlendAttachmentState blend = {VK_TRUE, VK_BLEND_FACTOR_ZERO, VK_BLEND_FACTOR_ONE, VK_BLEND_OP_ADD,
VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA, VK_BLEND_FACTOR_ZERO,
VK_BLEND_OP_ADD, VK_COLOR_COMPONENT_A_BIT};
VkPipelineColorBlendStateCreateInfo blending = {VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO};
blending.attachmentCount = 1;
blending.pAttachments = &blend;
VkDynamicState dynamic_states[2] = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR};
VkPipelineDynamicStateCreateInfo dynamic = {VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, NULL, 0, 2,
dynamic_states};
VkGraphicsPipelineCreateInfo pipeline = {VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO};
pipeline.stageCount = 2;
pipeline.pStages = stages;
pipeline.pVertexInputState = &input;
pipeline.pInputAssemblyState = &assembly;
pipeline.pViewportState = &viewport;
pipeline.pRasterizationState = &raster;
pipeline.pMultisampleState = &multisample;
pipeline.pColorBlendState = &blending;
pipeline.pDynamicState = &dynamic;
pipeline.layout = ab.layout;
pipeline.renderPass = ab.pass;
if (ab.CreateGraphicsPipelines(vk.device, VK_NULL_HANDLE, 1, &pipeline, NULL, &ab.pipeline) != VK_SUCCESS) {
ab.pipeline = VK_NULL_HANDLE;
return 0;
}
ab.format = format;
// framebuffers were made for the old render pass (compatible only with the same format): drop them
for (int i = 0; i < AB_TARGETS; ++i)
if (ab.targets[i].fb) {
ab.DestroyFramebuffer(vk.device, ab.targets[i].fb, NULL);
ab.DestroyImageView(vk.device, ab.targets[i].view, NULL);
memset(&ab.targets[i], 0, sizeof(ab.targets[i]));
}
LOG("alpha_blend: Vulkan alpha inversion ready (format %d)", (int)format);
return 1;
}
static void ab_wait_all(void) {
for (int i = 0; i < AB_RING; ++i)
if (ab.pending[i]) {
vk.WaitForFences(vk.device, 1, &ab.fence[i], VK_TRUE, 1000000000ull);
vk.ResetFences(vk.device, 1, &ab.fence[i]);
ab.pending[i] = 0;
}
}
// The view + framebuffer of one array layer of a swapchain image.
static VkFramebuffer ab_target(XrSwapchain swapchain, VkImage image, uint32_t layer, VkFormat format, uint32_t w, uint32_t h) {
int free_slot = -1;
for (int i = 0; i < AB_TARGETS; ++i) {
if (ab.targets[i].fb && ab.targets[i].image == image && ab.targets[i].layer == layer &&
ab.targets[i].swapchain == swapchain) return ab.targets[i].fb;
if (!ab.targets[i].fb && free_slot < 0) free_slot = i;
}
if (free_slot < 0) return VK_NULL_HANDLE;
VkImageViewCreateInfo vi = {VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, NULL, 0, image, VK_IMAGE_VIEW_TYPE_2D, format,
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY},
{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, layer, 1}};
VkImageView view;
if (ab.CreateImageView(vk.device, &vi, NULL, &view) != VK_SUCCESS) return VK_NULL_HANDLE;
VkFramebufferCreateInfo fi = {VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, NULL, 0, ab.pass, 1, &view, w, h, 1};
VkFramebuffer fb;
if (ab.CreateFramebuffer(vk.device, &fi, NULL, &fb) != VK_SUCCESS) {
ab.DestroyImageView(vk.device, view, NULL);
return VK_NULL_HANDLE;
}
ab.targets[free_slot].swapchain = swapchain;
ab.targets[free_slot].image = image;
ab.targets[free_slot].layer = layer;
ab.targets[free_slot].w = w;
ab.targets[free_slot].h = h;
ab.targets[free_slot].view = view;
ab.targets[free_slot].fb = fb;
return fb;
}
// xrDestroySwapchain (before the runtime's): our views and framebuffers of its images go first.
static void ab_on_destroy(XrSwapchain swapchain) {
if (ab.state <= 0 || ab.device != vk.device) return;
int any = 0;
for (int i = 0; i < AB_TARGETS; ++i) any |= ab.targets[i].fb && ab.targets[i].swapchain == swapchain;
if (!any) return;
ab_wait_all();
for (int i = 0; i < AB_TARGETS; ++i)
if (ab.targets[i].fb && ab.targets[i].swapchain == swapchain) {
ab.DestroyFramebuffer(vk.device, ab.targets[i].fb, NULL);
ab.DestroyImageView(vk.device, ab.targets[i].view, NULL);
memset(&ab.targets[i], 0, sizeof(ab.targets[i]));
}
}
// Inverts the alpha of one projection view's rectangle in the image the app last acquired from its swapchain
// (Vulkan; once per acquire). Returns 1 when done or already done for this image, 0 when it couldn't be done.
static int ab_invert_view(const XrSwapchainSubImage *sub) {
if (!vk.device) return 0; // not a Vulkan session
int ok = 0;
pthread_mutex_lock(&flip_lock);
tracked_swapchain *t = find_tracked(sub->swapchain, 0);
uint32_t index = t ? t->last_acquired : 0, layer = sub->imageArrayIndex;
XrRect2Di rect = sub->imageRect;
if (!t || !t->image_count || index >= t->image_count || layer >= 32 || rect.extent.width <= 0 ||
rect.extent.height <= 0 || t->info.sampleCount > 1 ||
!(t->info.usageFlags & XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT))
goto done;
if (t->alpha_inverted[index] & (1u << layer)) { ok = 1; goto done; } // a static frame submitted again
if (!ab_ready() || !ab_pipeline((VkFormat)t->info.format)) goto done;
VkFramebuffer fb = ab_target(sub->swapchain, t->images[index], layer, (VkFormat)t->info.format, t->info.width,
t->info.height);
if (!fb) goto done;
int slot = ab.next;
if (ab.pending[slot]) { // submitted AB_RING calls ago: normally long finished
if (vk.WaitForFences(vk.device, 1, &ab.fence[slot], VK_TRUE, 100000000ull) != VK_SUCCESS) goto done;
vk.ResetFences(vk.device, 1, &ab.fence[slot]);
ab.pending[slot] = 0;
}
VkCommandBuffer cmd = ab.cmd[slot];
VkCommandBufferBeginInfo begin = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, NULL};
vk.ResetCommandBuffer(cmd, 0);
vk.BeginCommandBuffer(cmd, &begin);
VkRect2D area = {{rect.offset.x, rect.offset.y}, {(uint32_t)rect.extent.width, (uint32_t)rect.extent.height}};
VkRenderPassBeginInfo rb = {VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, NULL, ab.pass, fb, area, 0, NULL};
ab.CmdBeginRenderPass(cmd, &rb, VK_SUBPASS_CONTENTS_INLINE);
ab.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ab.pipeline);
VkViewport vp = {(float)rect.offset.x, (float)rect.offset.y, (float)rect.extent.width, (float)rect.extent.height,
0.0f, 1.0f};
ab.CmdSetViewport(cmd, 0, 1, &vp);
ab.CmdSetScissor(cmd, 0, 1, &area);
ab.CmdDraw(cmd, 3, 1, 0, 0);
ab.CmdEndRenderPass(cmd);
vk.EndCommandBuffer(cmd);
VkSubmitInfo submit = {VK_STRUCTURE_TYPE_SUBMIT_INFO, NULL, 0, NULL, NULL, 1, &cmd, 0, NULL};
if (vk.QueueSubmit(vk.queue, 1, &submit, ab.fence[slot]) != VK_SUCCESS) goto done;
ab.pending[slot] = 1;
ab.next = (slot + 1) % AB_RING;
t->alpha_inverted[index] |= 1u << layer;
ok = 1;
static int logged;
if (!logged++)
LOG("alpha_blend: inverting the alpha of swapchain=%p (rect %dx%d at %d,%d, layer %u) for passthrough",
(void *)(uintptr_t)sub->swapchain, rect.extent.width, rect.extent.height, rect.offset.x, rect.offset.y, layer);
done:
pthread_mutex_unlock(&flip_lock);
return ok;
}
// xrEndFrame, emulated passthrough: what the projection layer's XrCompositionLayerAlphaBlendFB asks for, done with
// the runtime's standard blend. 0 = nothing to do (no such struct, or factors that can't be expressed), 1 = straight
// alpha (inverted when asked), 2 = premultiplied colour (alpha inverted when asked).
static int alpha_blend_apply(const XrCompositionLayerProjection *p) {
const XrCompositionLayerAlphaBlendFB *f = NULL;
for (const XrBaseInStructure *n = (const XrBaseInStructure *)p->next; n; n = n->next)
if (n->type == XR_TYPE_COMPOSITION_LAYER_ALPHA_BLEND_FB) f = (const XrCompositionLayerAlphaBlendFB *)n;
if (!f) return 0;
int src = f->srcFactorColor, dst = f->dstFactorColor;
int straight = src == XR_BLEND_FACTOR_SRC_ALPHA_FB, premultiplied = src == XR_BLEND_FACTOR_ONE_FB,
inverse = src == XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB;
static int logged;
if (!logged++)
LOG("alpha_blend: projection layer asks for colour %d/%d alpha %d/%d (src/dst factors)", src, dst,
f->srcFactorAlpha, f->dstFactorAlpha);
if ((straight || premultiplied) && dst == XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB) return straight ? 1 : 2;
if (!(inverse || premultiplied) || dst != XR_BLEND_FACTOR_SRC_ALPHA_FB) {
static int warned;
if (!warned++) LOG("alpha_blend: these factors can't be emulated, the layer is blended normally");
return 0;
}
int done = 1; // src * (1 - a) + dst * a: the standard blend with the alpha inverted
for (uint32_t v = 0; v < p->viewCount && v < 2; ++v) done &= ab_invert_view(&p->views[v].subImage);
if (!done) {
static int warned;
if (!warned++) LOG("alpha_blend: inverse alpha asked for, but the image couldn't be changed (not Vulkan?)");
return 0;
}
return inverse ? 1 : 2;
}
+2
View File
@@ -74,6 +74,7 @@ typedef struct {
// submitted again without a new acquire: flipping them again would undo it)
struct { XrRect2Di rect; uint32_t layer; } flipped[MAX_IMAGES][4];
uint32_t flipped_count[MAX_IMAGES];
uint32_t alpha_inverted[MAX_IMAGES]; // alpha_blend_vk.c: array layers whose alpha was inverted since the acquire
int dumped; // flip_dump saved this swapchain's quad
int logged; // its first in-place flip was logged
} tracked_swapchain;
@@ -136,6 +137,7 @@ static void flip_on_acquire(XrSwapchain handle, uint32_t index) {
if (t) {
t->last_acquired = index;
if (index < MAX_IMAGES) t->flipped_count[index] = 0; // new content: upside down again
if (index < MAX_IMAGES) t->alpha_inverted[index] = 0;
if(t->acquired_count<MAX_IMAGES)t->acquired[t->acquired_count++]=index;
}
pthread_mutex_unlock(&flip_lock);
+16 -1
View File
@@ -127,6 +127,7 @@ static int layer_fix = 1;
static int mutable_fix = 0;
static int swap_eyes = 0;
static int passthrough_emul = 1;
static int alpha_blend_emul = 1; // alpha_blend_vk.c: honour XR_FB_composition_layer_alpha_blend with passthrough
static int respace_kick = 0;
static int strip_depth = 0;
static int flip_quads = 0;
@@ -192,6 +193,7 @@ static void read_settings(const char *path) {
if (sscanf(line, "mutable_fix=%f", &value) == 1) mutable_fix = value != 0;
if (sscanf(line, "swap_eyes=%f", &value) == 1) swap_eyes = value != 0;
if (sscanf(line, "passthrough_emul=%f", &value) == 1) passthrough_emul = value != 0;
if (sscanf(line, "alpha_blend_emul=%f", &value) == 1) alpha_blend_emul = value != 0;
if (sscanf(line, "respace_kick=%f", &value) == 1) respace_kick = value != 0;
if (sscanf(line, "strip_depth=%f", &value) == 1) strip_depth = value != 0;
if (sscanf(line, "flip_quads=%f", &value) == 1) flip_quads = value != 0;
@@ -562,6 +564,7 @@ static void flip_on_create_swapchain(XrSwapchain handle, const XrSwapchainCreate
static int flip_wants_transfer(const XrSwapchainCreateInfo *info);
static void clear_gl_errors(const char *where);
static void flip_on_destroy(XrSwapchain handle);
static void ab_on_destroy(XrSwapchain handle);
static void emul_on_create_swapchain(XrSwapchain handle, const XrSwapchainCreateInfo *info);
static void emul_on_destroy_swapchain(XrSwapchain handle);
static int emul_virtual_create(XrSession session, const XrSwapchainCreateInfo *info, XrSwapchain *out);
@@ -703,6 +706,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrDestroySwapchain(XrSwapchain swapchain) {
surf_scene_destroy(swapchain);
forget_swapchain(swapchain);
surf_on_destroy(swapchain);
ab_on_destroy(swapchain);
flip_on_destroy(swapchain);
emul_on_destroy_swapchain(swapchain);
snap_on_destroy(swapchain);
@@ -884,6 +888,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetSystemProperties(XrInstance instance, XrSyst
}
#include "flip_vk.c"
#include "alpha_blend_vk.c"
#include "pose_time.c"
// XR_KHR_convert_timespec_time for runtimes that lack it (Frame): XrTime is derived from the monotonic clock
@@ -1630,8 +1635,14 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
q->radius, q->subImage.imageRect.offset.x, q->subImage.imageRect.offset.y,
q->subImage.imageRect.extent.width, q->subImage.imageRect.extent.height);
}
for (const XrBaseInStructure *n = (const XrBaseInStructure *)l->next; n && used < sizeof(now) - 32; n = n->next)
for (const XrBaseInStructure *n = (const XrBaseInStructure *)l->next; n && used < sizeof(now) - 48; n = n->next) {
used += (size_t)snprintf(now + used, sizeof(now) - used, " n=%d", n->type);
if (n->type == XR_TYPE_COMPOSITION_LAYER_ALPHA_BLEND_FB) { // src/dst factors: colour, then alpha
const XrCompositionLayerAlphaBlendFB *ab = (const XrCompositionLayerAlphaBlendFB *)n;
used += (size_t)snprintf(now + used, sizeof(now) - used, "(%d,%d/%d,%d)", ab->srcFactorColor,
ab->dstFactorColor, ab->srcFactorAlpha, ab->dstFactorAlpha);
}
}
used += (size_t)snprintf(now + used, sizeof(now) - used, "]");
}
if (strcmp(now, last)) {
@@ -1759,6 +1770,10 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
projections[count] = *(const XrCompositionLayerProjection *)layer;
projections[count].layerFlags |= XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT |
XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT;
// the game's XR_FB_composition_layer_alpha_blend factors (ignored by the Frame's runtime), e.g. Unreal's
// inverted scene alpha: the camera showed where the game drew and black where it didn't (GitHub #329)
if (alpha_blend_emul && alpha_blend_apply(&projections[count]) == 2)
projections[count].layerFlags &= ~(XrCompositionLayerFlags)XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT;
layer = (const XrCompositionLayerBaseHeader *)&projections[count];
}
if (strip_depth && layer->type == XR_TYPE_COMPOSITION_LAYER_PROJECTION &&
+14 -12
View File
@@ -136,18 +136,20 @@ def build_adapter(tc: Path):
src = HERE / "adapter"
shader_tools = tc.parents[3] / "shader-tools" / tc.name
suffix = ".exe" if os.name == "nt" else ""
sections = ["// Generated from surface_composite.vert and surface_composite.frag.\n"]
for stage in ("vert", "frag"):
binary = CACHE / f"surface_composite_{stage}.spv"
run([shader_tools / ("glslc" + suffix), "--target-env=vulkan1.0", "-O",
src / f"surface_composite.{stage}", "-o", binary])
run([shader_tools / ("spirv-val" + suffix), "--target-env", "vulkan1.0", binary])
data = binary.read_bytes()
words = struct.unpack(f"<{len(data)//4}I", data)
sections.append(f"static const uint32_t surface_composite_{stage}_spv[] = {{\n" +
"\n".join(" " + ",".join(f"0x{v:08x}" for v in words[i:i+8]) + ","
for i in range(0, len(words), 8)) + "\n};\n")
(src / "surface_composite_spv.h").write_text("".join(sections), encoding="utf-8")
for header, shaders in (("surface_composite", ("vert", "frag")), ("alpha_blend", ("vert", "frag"))):
names = " and ".join(f"{header}.{stage}" for stage in shaders)
sections = [f"// Generated from {names}.\n"]
for stage in shaders:
binary = CACHE / f"{header}_{stage}.spv"
run([shader_tools / ("glslc" + suffix), "--target-env=vulkan1.0", "-O",
src / f"{header}.{stage}", "-o", binary])
run([shader_tools / ("spirv-val" + suffix), "--target-env", "vulkan1.0", binary])
data = binary.read_bytes()
words = struct.unpack(f"<{len(data)//4}I", data)
sections.append(f"static const uint32_t {header}_{stage}_spv[] = {{\n" +
"\n".join(" " + ",".join(f"0x{v:08x}" for v in words[i:i+8]) + ","
for i in range(0, len(words), 8)) + "\n};\n")
(src / f"{header}_spv.h").write_text("".join(sections), encoding="utf-8")
run([sys.executable, src / "gen_forwarders.py"])
inc = openxr_include("adapter")
common = ["-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror", "-Wno-gnu-conditional-omitted-operand",
+5
View File
@@ -14,6 +14,11 @@
"title": "Pointer turn",
"group": "Game settings"
},
"adapter.alpha_blend_emul": {
"anchor": "adapter-alpha_blend_emul",
"title": "Fix inside-out mixed reality",
"group": "Game settings"
},
"adapter.controller_fix": {
"anchor": "adapter-controller_fix",
"title": "Use controllers",
+3
View File
@@ -490,6 +490,7 @@
"Fix depth flicker (Unreal Vulkan)": "",
"Fix freezes when controllers vibrate": "",
"Fix hands lagging behind controllers": "",
"Fix inside-out mixed reality": "",
"Fix launcher icon entry": "",
"Fix Lua startup crashes on Frame": "",
"Fix minimal Android SDK": "",
@@ -514,6 +515,7 @@
"For games that judder or shimmer while you hold your head still (for example I Am Cat).": "",
"For games that pause or recenter when the headset briefly loses focus.": "",
"For games that show the headset's own controllers. Takes effect after a reinstall.": "",
"For games that show your room on their objects and darkness where your room should be.": "",
"For games where one eye flickers or jitters. Costs some speed.": "",
"For games whose fades to black don't show, so you see the level loading (for example Batman: Arkham Shadow).": "",
"For games whose hands trail the controllers when you move them (for example BattleSisters).": "",
@@ -1817,6 +1819,7 @@
"Windows' firewall blocks the Frame from reaching FramePort. Start the setup again and allow the change when Windows asks.": "",
"Windows' firewall blocks the Frame on public networks. Set this network to Private in Windows' network settings.": "",
"Windows' firewall for WSL blocks the Frame. Show the setup command again and allow the change when Windows asks.": "",
"With emulated passthrough, honours the eye layer's XR_FB_composition_layer_alpha_blend, which the Frame's runtime ignores: Unreal games keep inverted alpha and ask for inverse blending, so the room showed where the game drew and black where it should show the room (for example Star Wars: Beyond Victory). The alpha is inverted in the game's image before it is composited (Vulkan).": "",
"Without a Meta account, OVRPort's platform library makes up a new user id at every start (ovr_GetLoggedInUserID). Games that file saves under the user id (for example Walkabout Mini Golf) then start with an empty profile each time and seem to lose all progress. Gives the game a fixed id instead, different for each game and each FramePort user.": "",
"Working": "",
"Working…": "",
+11
View File
@@ -59,6 +59,11 @@ SETTINGS = [
"Drop layers whose swapchain failed or whose extension isn't enabled."),
("passthrough_emul", "int", 1, "Emulate passthrough",
"XR_FB_passthrough via ALPHA_BLEND (Frame grayscale cameras)."),
("alpha_blend_emul", "int", 1, "Emulate layer alpha blending",
"With emulated passthrough, honours the eye layer's XR_FB_composition_layer_alpha_blend, which the Frame's "
"runtime ignores: Unreal games keep inverted alpha and ask for inverse blending, so the room showed where the "
"game drew and black where it should show the room (for example Star Wars: Beyond Victory). The alpha is "
"inverted in the game's image before it is composited (Vulkan)."),
("flip_emul", "int", 1, "Emulate flipped quads",
"Blit quads flagged XrCompositionLayerImageLayoutFB VERTICAL_FLIP upside down (Vulkan). Fixes UI panels and "
"text that show upside down (for example Assassin's Creed Nexus)."),
@@ -341,6 +346,10 @@ UI: dict[str, dict] = {
"passthrough_emul": dict(group="room", level="common", label="See your room",
help="Shows the Frame's cameras where the game expects passthrough.",
control=("switch",)),
"alpha_blend_emul": dict(group="room", level="advanced", label="Fix inside-out mixed reality",
depends="passthrough_emul",
help="For games that show your room on their objects and darkness where your room "
"should be.", control=("switch",)),
"scene_emul": dict(group="room", level="common", label="Pretend room layout",
help="Mixed-reality games that build their level from your room get a simple room with walls.",
control=("switch",)),
@@ -531,6 +540,8 @@ class AdapterSetting(Patch):
"scene_depth": lambda a: ap.uses_scene(a) or a.extra.get("mr_only"),
"passthrough_emul": lambda a: (a.extra.get("mr_only")
or "com.oculus.feature.PASSTHROUGH" in (a.extra.get("features") or {})),
"alpha_blend_emul": lambda a: (a.extra.get("mr_only")
or "com.oculus.feature.PASSTHROUGH" in (a.extra.get("features") or {})),
"flip_emul": ap.is_vulkan,
"flip_quads": ap.is_vulkan,
"mutable_fix": ap.is_vulkan,
+3
View File
@@ -539,6 +539,9 @@ def test_game_settings_dialog_shows_relevant_settings_and_saves_only_changes():
vulkan = _analysis()
gles = _analysis(graphics="GLES (declared in manifest)")
assert ad.relevant(vulkan, "flip_emul", 1) and not ad.relevant(gles, "flip_emul", 1) # Vulkan-only
# inverse alpha blending only matters where passthrough can be shown
mr = _analysis(extra={"size": 1, "features": {"com.oculus.feature.PASSTHROUGH": True}})
assert ad.relevant(mr, "alpha_blend_emul", 1) and not ad.relevant(vulkan, "alpha_blend_emul", 1)
assert ad.relevant(gles, "equirect_emul", 0) and not ad.relevant(vulkan, "equirect_emul", 0)
assert ad.relevant(vulkan, "equirect_emul", 1) # changed from its default: always shown
r = Recipe("com.x", patches={"adapter.scale": {"value": 1.5}, "frame.launcher": {}})