google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

Home Page:https://google.github.io/filament/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adreno segfault with Vulkan when using unoptimized materials

prideout opened this issue · comments

Default settings and model, but must use a debug build to repro (unoptimized shaders are probably required).

The callstack contains vkCreateGraphicsPipelines which leads to QGLCCompileToIRShader in the qcom driver.

Pixel 4 with Android 12.

2022-03-08 14:33:23.350 13508-13528/com.google.android.filament.gltf I/AdrenoGLES-0: QUALCOMM build                   : 85da404, I46ff5fc46f
    Build Date                       : 11/30/20
    OpenGL ES Shader Compiler Version: EV031.31.04.01
    Local Branch                     : promo490_3_Google
    Remote Branch                    : 
    Remote Branch                    : 
    Reconstruct Branch               : 
2022-03-08 14:33:23.350 13508-13528/com.google.android.filament.gltf I/AdrenoGLES-0: Build Config                     : S P 10.0.4 AArch64
2022-03-08 14:33:23.350 13508-13528/com.google.android.filament.gltf I/AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
2022-03-08 14:33:23.352 13508-13528/com.google.android.filament.gltf I/AdrenoGLES-0: PFP: 0x016ee190, ME: 0x00000000
2022-03-08 14:33:24.384 13508-13537/com.google.android.filament.gltf A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8 in tid 13537 (FEngine::loop), pid 13508 (d.filament.gltf)
2022-03-08 14:33:24.416 1113-1224/? E/QMI_FW: qmi_cci_get_ref: ref count increased 2
2022-03-08 14:33:24.416 1113-1224/? I/CHRE: @ 260338.395: [AR] inconsistent: 41.176471
2022-03-08 14:33:24.417 1113-1224/? E/QMI_FW: qmi_cci_get_ref: ref count increased 2
2022-03-08 14:33:24.417 1113-1224/? D/CHRE: @ 260338.396: [ActivityPlatform] type 6, confidence 41
2022-03-08 14:33:24.440 13555-13555/? I/crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
2022-03-08 14:33:24.440 893-893/? I/tombstoned: received crash request for pid 13537
2022-03-08 14:33:24.441 13555-13555/? I/crash_dump64: performing dump of process 13508 (target tid = 13537)
2022-03-08 14:33:24.449 13555-13555/? E/DEBUG: failed to read /proc/uptime: Permission denied
2022-03-08 14:33:24.751 1896-3918/? W/InputManager-JNI: Input channel object '3522ad2 Toast (client)' was disposed without first being removed with the input manager!
2022-03-08 14:33:24.754 1896-3918/? W/NotificationService: Toast already killed. pkg=com.google.android.filament.gltf token=android.os.BinderProxy@eb3eea9
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: Build fingerprint: 'google/flame/flame:12/SQ1A.220205.002/8010174:user/release-keys'
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: Revision: 'MP1.0'
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: ABI: 'arm64'
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: Timestamp: 2022-03-08 14:33:24.449168353-0800
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: Process uptime: 0s
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: Cmdline: com.google.android.filament.gltf
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: pid: 13508, tid: 13537, name: FEngine::loop  >>> com.google.android.filament.gltf <<<
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: uid: 10465
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: Cause: null pointer dereference
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x0  b40000747cb8e0d0  x1  b40000734ca92190  x2  0000000000000001  x3  0000000000000045
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x4  b40000740cbd2520  x5  0000000000000005  x6  0000000000000021  x7  0000000000000001
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x8  0000000000000000  x9  874bac45304dc38d  x10 0000000000000000  x11 0000000000000021
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x12 0000000000000021  x13 b40000745ca55840  x14 000000727f882000  x15 0000000000000002
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x16 00000000000004c5  x17 00000072dc336118  x18 0000000000000007  x19 b4000073aca3ddb0
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x20 0000000000000000  x21 000000727f87e108  x22 3fffffffffffffff  x23 0000000000000004
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x24 0000000000000025  x25 b40000732cb128c0  x26 0000000000000004  x27 1fffffffffffffff
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     x28 0000000000000002  x29 b40000747cb8e0d0
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:     lr  00000072dce6efdc  sp  000000727f87df00  pc  00000072dcccae84  pst 0000000080000000
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG: backtrace:
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #00 pc 0000000000a7fe84  /vendor/lib64/libllvm-glnext.so (!!!0000!e996c91808ee26a66525968cb74e1e!85da404!+60) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #01 pc 0000000000c23fd8  /vendor/lib64/libllvm-glnext.so (!!!0000!5e4fdc544e8fb931f7dc5b11ff9a1d!85da404!+736) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #02 pc 0000000000c2483c  /vendor/lib64/libllvm-glnext.so (!!!0000!d7545dc46adf0a11a32e0f672f7e96!85da404!+972) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #03 pc 0000000000c3c0ec  /vendor/lib64/libllvm-glnext.so (!!!0000!d49599a40965508ac577c49e7c01e5!85da404!+348) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #04 pc 0000000000c3c5fc  /vendor/lib64/libllvm-glnext.so (!!!0000!f250bbeae4787d84d80d43e35a8b6d!85da404!+668) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #05 pc 0000000000c48290  /vendor/lib64/libllvm-glnext.so (!!!0000!d4b3104e6a37ce8c57eba970e8b2e1!85da404!+400) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #06 pc 0000000000a298a0  /vendor/lib64/libllvm-glnext.so (!!!0000!c03b43b7629d6f1414578265c7e520!85da404!+936) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #07 pc 0000000000b0fdc8  /vendor/lib64/libllvm-glnext.so (QGLCCompileToIRShader(void*, QGLC_SRCSHADER*, QGLC_COMPILETOIR_RESULT*)+88) (BuildId: 2e7eb8a8e15d025a6fb76421c6f455b6)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #08 pc 00000000000ae460  /vendor/lib64/hw/vulkan.adreno.so (!!!0000!408a0df45472c0e06e44d798996f89!85da404!+8248) (BuildId: 4eca9f7b16181c0ea2b281d9ab0f3c36)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #09 pc 00000000000943f0  /vendor/lib64/hw/vulkan.adreno.so (!!!0000!9edc5309b84ca97e813fe8bc838b43!85da404!+120) (BuildId: 4eca9f7b16181c0ea2b281d9ab0f3c36)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #10 pc 000000000006f2a4  /vendor/lib64/hw/vulkan.adreno.so (qglinternal::vkCreateGraphicsPipelines(VkDevice_T*, VkPipelineCache_T*, unsigned int, VkGraphicsPipelineCreateInfo const*, VkAllocationCallbacks const*, VkPipeline_T**)+2796) (BuildId: 4eca9f7b16181c0ea2b281d9ab0f3c36)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #11 pc 000000000050826c  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libVkLayer_khronos_validation.so (BuildId: 4dbe0f1b30e911d3f115344528a36a780368669d)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #12 pc 0000000000537a70  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libVkLayer_khronos_validation.so (BuildId: 4dbe0f1b30e911d3f115344528a36a780368669d)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #13 pc 0000000000604398  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #14 pc 0000000000603b7c  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #15 pc 000000000058fa6c  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #16 pc 00000000005b4160  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #17 pc 00000000005b4074  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #18 pc 00000000005b3fa8  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #19 pc 000000000058ef64  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #20 pc 0000000000588fd0  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #21 pc 000000000051c358  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #22 pc 000000000051c138  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.773 13555-13555/? A/DEBUG:       #23 pc 000000000051c0c8  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #24 pc 000000000051c068  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #25 pc 000000000051c038  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #26 pc 000000000051ae18  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #27 pc 00000000004892f4  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #28 pc 0000000000484534  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #29 pc 000000000051cc88  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #30 pc 000000000051a5d8  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #31 pc 00000000004408c4  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #32 pc 000000000043dd0c  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #33 pc 0000000000448484  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #34 pc 0000000000448368  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #35 pc 0000000000447b88  /data/app/~~0NgFBzu818ypKjfBxnA4Kg==/com.google.android.filament.gltf-WZSq7JNmYMsiUoZ8P9KmVw==/lib/arm64/libfilament-jni.so (BuildId: fc65b46e50d03b3b5eb094062e009441f7b5f8b0)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #36 pc 00000000000b1910  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: ba489d4985c0cf173209da67405662f9)
2022-03-08 14:33:24.774 13555-13555/? A/DEBUG:       #37 pc 00000000000513f0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: ba489d4985c0cf173209da67405662f9)

To repro, make two changes before building filament:

  1. In gradle.properties, changecom.google.android.filament.dist-dir by replacing release with debug.
  2. Change first constructor in ModelViewer.kt by passing Engine.Backend.VULKAN into Engine constructor.

This can actually be repro'ed with a release build:

  • just use the -d option when invoking build.sh
  • if using Android Studio, you also need to set com.google.android.filament.matdbg=true in gradle.properties

For record. It seems adreno vulkan compiler has a problem with shaders of the following form:

#version 450

out gl_PerVertex {
    vec4 gl_Position;   
};

highp vec4 m1(const mat4 inm, vec3 p) {
    return inm * vec4(p, 1.0);
}


highp vec4 m2(const mat4 inm, vec3 p) {
    return inm * m1(mat4(1.0), p);
}

void main() {
    gl_Position = m2(mat4(1.0), vec3(0.5));
}

where two methods have const mat4 and one calls the other. This adjusted version does not crash:

#version 450

out gl_PerVertex {
    vec4 gl_Position;   
};

highp vec4 m1(const mat4 inm, vec3 p) {
    return inm * vec4(p, 1.0);
}

highp vec4 m2(mat4 inm, vec3 p) {
    return inm * m1(mat4(1.0), p);
}

void main() {
    gl_Position = m2(mat4(1.0), vec3(0.5));
}

We use const mostly as a best practice and in the hope it will help compilers. We could get rid of them, I don't think they have any actual impact.

Running spirv-diff on the crashing vs. non-crashing version, we get

 ; SPIR-V
 ; Version: 1.0
 ; Generator: Khronos Glslang Reference Front End; 11
-; Bound: 52
+; Bound: 62
 ; Schema: 0
                OpCapability Shader
           %1 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Vertex %4 "main" %43
                OpSource GLSL 450
                OpName %4 "main"
                OpName %14 "m1(mf44;vf3;"
                OpName %12 "inm"
                OpName %13 "p"
                OpName %18 "m2(mf44;vf3;"
                OpName %16 "inm"
                OpName %17 "p"
                OpName %35 "param"
                OpName %41 "gl_PerVertex"
                OpMemberName %41 0 "gl_Position"
                OpName %43 ""
+               OpName %60 "param"
                OpName %48 "param"
                OpMemberDecorate %41 0 BuiltIn Position
                OpDecorate %41 Block
           %2 = OpTypeVoid
           %3 = OpTypeFunction %2
           %6 = OpTypeFloat 32
           %7 = OpTypeVector %6 4
           %8 = OpTypeMatrix %7 4
           %9 = OpTypeVector %6 3
          %10 = OpTypePointer Function %9
          %11 = OpTypeFunction %7 %8 %10
+         %52 = OpTypePointer Function %8
+         %53 = OpTypeFunction %7 %52 %10
          %21 = OpConstant %6 1
          %29 = OpConstant %6 0
          %30 = OpConstantComposite %7 %21 %29 %29 %29
          %31 = OpConstantComposite %7 %29 %21 %29 %29
          %32 = OpConstantComposite %7 %29 %29 %21 %29
          %33 = OpConstantComposite %7 %29 %29 %29 %21
          %34 = OpConstantComposite %8 %30 %31 %32 %33
          %41 = OpTypeStruct %7
          %42 = OpTypePointer Output %41
          %43 = OpVariable %42 Output
          %44 = OpTypeInt 32 1
          %45 = OpConstant %44 0
          %46 = OpConstant %6 0.5
          %47 = OpConstantComposite %9 %46 %46 %46
          %50 = OpTypePointer Output %7
           %4 = OpFunction %2 None %3
           %5 = OpLabel
+         %60 = OpVariable %52 Function
          %48 = OpVariable %10 Function
+               OpStore %60 %34
                OpStore %48 %47
-         %49 = OpFunctionCall %7 %18 %34 %48
+         %61 = OpFunctionCall %7 %18 %60 %48
          %51 = OpAccessChain %50 %43 %45
-               OpStore %51 %49
+               OpStore %51 %61
                OpReturn
                OpFunctionEnd
          %14 = OpFunction %7 None %11
          %12 = OpFunctionParameter %8
          %13 = OpFunctionParameter %10
          %15 = OpLabel
          %20 = OpLoad %9 %13
          %22 = OpCompositeExtract %6 %20 0
          %23 = OpCompositeExtract %6 %20 1
          %24 = OpCompositeExtract %6 %20 2
          %25 = OpCompositeConstruct %7 %22 %23 %24 %21
          %26 = OpMatrixTimesVector %7 %12 %25
                OpReturnValue %26
                OpFunctionEnd
-         %18 = OpFunction %7 None %11
+         %18 = OpFunction %7 None %53
-         %16 = OpFunctionParameter %8
+         %16 = OpFunctionParameter %52
          %17 = OpFunctionParameter %10
          %19 = OpLabel
          %35 = OpVariable %10 Function
+         %56 = OpLoad %8 %16
          %36 = OpLoad %9 %17
                OpStore %35 %36
          %37 = OpFunctionCall %7 %14 %34 %35
-         %38 = OpMatrixTimesVector %7 %16 %37
+         %57 = OpMatrixTimesVector %7 %56 %37
-               OpReturnValue %38
+               OpReturnValue %57
                OpFunctionEnd