Problem using OpenGL with SteamVR runtime

I’m running into an issue using OpenGL with the SteamVR 1.25.8 runtime (Windows 10, nVidia GeForce RTX 3080). The image displayed in the headset is the bottom left 16x16 portion of the 2016x2172 swapchain image stretched over the entire display. I used glGetTexImage to read out the contents of the swapchain image after rendering to it, and can verify that the frame is correctly rendered to the entire texture before calling xrReleaseSwapchainImage. I’m not getting any errors from the OpenXR functions I’m calling and I’m not seeing any relevant info from the XR_EXT_debug_utils extension.

Using the nSight frame debugger, I’m seeing that after calling xrEndFrame, the runtime appears to be copying the 2016x2172 GL texture to a 16x16 ID3D11Texture2D object, using the WGL_NV_DX_interop extension I’m assuming. This explains the behavior I’m observing, but I’m having trouble figuring out what is causing this. I’ve looked at the SteamVR developer console, but don’t see any error/debug messages that would indicate any problems.

My application works fine with the Oculus and Varjo runtimes. I’ve tested with a couple other sample OpenXR/OpenGL apps. One also exhibits the same problem, but the “hello_xr” sample that comes with the OpenXR SDK works fine. I’ve attempted to replicate the OpenXR/OpenGL initialization calls of the “hello_xr” sample with my app, but I still can’t seem to find the cause of this problem.

I’m assuming something with how my app is initializing OpenXR or OpenGL is causing the SteamVR runtime to fallback on creating a 16x16 ID3D11Texture2D object instead of the full frame size. Has anybody else encountered this problem or know the cause of it?

For the OpenXR folks here, you might want to show your XrSwapchainCreateInfo and xrCreateSwapchain() code.

For the OpenXR folks here, you might want to show your XrSwapchainCreateInfo and xrCreateSwapchain() code.

Here is the code related to XrSwapchainCreateInfo and xrCreateSwapchain(). I’ve tried every available color format with no success.

// Populated from xrEnumerateViewConfigurationViews
std::vector<XrViewConfigurationView> viewConfigs;
for(size_t i = 0; i < viewConfigs.size(); ++i) {

	XrSwapchainCreateInfo swapchainCreateInfo = {XR_TYPE_SWAPCHAIN_CREATE_INFO};
	swapchainCreateInfo.createFlags = 0;
	swapchainCreateInfo.usageFlags = XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT;
	swapchainCreateInfo.format = GL_SRGB8_ALPHA8;
	swapchainCreateInfo.width = viewConfigs[i].recommendedImageRectWidth;
	swapchainCreateInfo.height = viewConfigs[i].recommendedImageRectHeight;
	swapchainCreateInfo.sampleCount = 1; // Also tried viewConfigs[i].recommendedSwapchainSampleCount;
	swapchainCreateInfo.mipCount = 1;
	swapchainCreateInfo.faceCount = 1;
	swapchainCreateInfo.arraySize = 1;

	XrSwapchain colorSwapChain;
	result = xrCreateSwapchain(session, &swapchainCreateInfo, &colorSwapChain);
	if(XR_FAILED(result)) {
		// Log error
		return false;
	}
}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.