{"action":"opened","issue":{"url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1258","repository_url":"https://api.github.com/repos/KhronosGroup/glslang","labels_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1258/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1258/comments","events_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1258/events","html_url":"https://github.com/KhronosGroup/glslang/issues/1258","id":300063201,"number":1258,"title":"glslangValidator generates invalid SPIR-V with nested structs","user":{"login":"afd","id":4739677,"avatar_url":"https://avatars0.githubusercontent.com/u/4739677?v=4","gravatar_id":"","url":"https://api.github.com/users/afd","html_url":"https://github.com/afd","followers_url":"https://api.github.com/users/afd/followers","following_url":"https://api.github.com/users/afd/following{/other_user}","gists_url":"https://api.github.com/users/afd/gists{/gist_id}","starred_url":"https://api.github.com/users/afd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afd/subscriptions","organizations_url":"https://api.github.com/users/afd/orgs","repos_url":"https://api.github.com/users/afd/repos","events_url":"https://api.github.com/users/afd/events{/privacy}","received_events_url":"https://api.github.com/users/afd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-25T21:29:43Z","updated_at":"2018-02-25T21:29:43Z","closed_at":null,"author_association":"NONE","body":"glslangValidator generates what appears to be invalid SPIR-V for the following GLSL fragment shader:\r\n\r\n#version 450\r\n\r\nprecision highp float;\r\n\r\nstruct U {\r\n mat2 m;\r\n};\r\nstruct T {\r\n mat2 m;\r\n};\r\nstruct S {\r\n T t;\r\n U u;\r\n};\r\nvoid main()\r\n{\r\n  S(T(mat2(1.0)), U(mat2(1.0)));\r\n}\r\n\r\nThe SPIR-V that gets generated is as follows:\r\n\r\n               OpCapability Shader\r\n          %1 = OpExtInstImport \"GLSL.std.450\"\r\n               OpMemoryModel Logical GLSL450\r\n               OpEntryPoint Fragment %4 \"main\"\r\n               OpExecutionMode %4 OriginUpperLeft\r\n               OpSource GLSL 450\r\n               OpName %4 \"main\"\r\n               OpName %9 \"T\"\r\n               OpMemberName %9 0 \"m\"\r\n               OpName %10 \"U\"\r\n               OpMemberName %10 0 \"m\"\r\n               OpName %11 \"S\"\r\n               OpMemberName %11 0 \"t\"\r\n               OpMemberName %11 1 \"u\"\r\n          %2 = OpTypeVoid\r\n          %3 = OpTypeFunction %2\r\n          %6 = OpTypeFloat 32\r\n          %7 = OpTypeVector %6 2\r\n          %8 = OpTypeMatrix %7 2\r\n          %9 = OpTypeStruct %8\r\n         %10 = OpTypeStruct %8\r\n         %11 = OpTypeStruct %9 %10\r\n         %12 = OpConstant %6 1\r\n         %13 = OpConstant %6 0\r\n         %14 = OpConstantComposite %7 %12 %13\r\n         %15 = OpConstantComposite %7 %13 %12\r\n         %16 = OpConstantComposite %8 %14 %15\r\n         %17 = OpConstantComposite %9 %16\r\n         %18 = OpConstantComposite %11 %17 %17\r\n          %4 = OpFunction %2 None %3\r\n          %5 = OpLabel\r\n               OpReturn\r\n               OpFunctionEnd\r\n\r\nThe problem is:\r\n\r\n         %18 = OpConstantComposite %11 %17 %17\r\n\r\nThis has result type %11, which is:\r\n\r\n         %11 = OpTypeStruct %9 %10\r\n\r\nNow %17 has type %9, so is fine for the first of the two %17 arguments; but the second type %17 is used, type %10 is expected.\r\n\r\nspirv-val rejects the resulting SPIR-V:\r\n\r\nerror: 113: OpConstantComposite Constituent <id> '17' type does not match the Result Type <id> '11's member type.\r\n"}}
{"actor":{"display_login":"afd"}}