Skip to content

Target GLSL 3.30 instead of 4.50

Arto Bendiken requested to merge (removed):artob/fix-shader-compat into master

Attempting to run the program with Monado 0.1 in my stock Debian 11 virtual machine (running under VMware Fusion), I encountered the following problem:

$ ./openxr-example
Runtime supports 7 extensions
Runtime supports required extension XR_KHR_opengl_enable
Loader found 2 api layers: XR_APILAYER_LUNARG_api_dump, XR_APILAYER_LUNARG_core_validation
Runtime Name: Monado(XRT) by Collabora et al
Runtime Version: 0.1.42
Successfully got XrSystem 1 for HMD form factor
System properties for system 1: "Monado: Dummy HMD", vendor ID 42
	Max layers          : 1
	Max swapchain height: 16384
	Max swapchain width : 16384
	Orientation Tracking: 1
	Position Tracking   : 0
Runtime supports 1 view configurations
Runtime supports our VR view configuration, yay!
VR View Configuration:
	view configuratio type: 2
	FOV mutable           : no
View count: 2
View 0:
	Resolution       : Recommended 1344x1512, Max: 1920x2160
	Swapchain Samples: Recommended: 1, Max: 1)
View 1:
	Resolution       : Recommended 1344x1512, Max: 1920x2160
	Swapchain Samples: Recommended: 1, Max: 1)
Vertex Shader failed to compile: 0:1(10): error: GLSL 4.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

This PR proposes a fix to that by targeting GLSL 3.30 (with the GL_ARB_explicit_uniform_location extension) instead of 4.50.

I remain unable to run the program for the moment (troubleshooting that now), but at least the shader code appears to compile fine now:

$ ./openxr-example
...
Successfully compiled vertex shader!
Successfully compiled fragment shader!
Successfully linked shader program!
compositor_check_vulkan_caps - Failed to create VkDevice: VK_ERROR_INITIALIZATION_FAILED
XR_ERROR_INITIALIZATION_FAILED in xrCreateSession:  failed create a compositor
Failed to create session [XR_ERROR_INITIALIZATION_FAILED]
Segmentation fault

Merge request reports