{"action":"created","issue":{"url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1557","repository_url":"https://api.github.com/repos/KhronosGroup/glslang","labels_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1557/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1557/comments","events_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1557/events","html_url":"https://github.com/KhronosGroup/glslang/pull/1557","id":375336046,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2ODAzMTU5","number":1557,"title":"Add names for composite spec constants in SPIR-V","user":{"login":"nicebyte","id":12521759,"node_id":"MDQ6VXNlcjEyNTIxNzU5","avatar_url":"https://avatars2.githubusercontent.com/u/12521759?v=4","gravatar_id":"","url":"https://api.github.com/users/nicebyte","html_url":"https://github.com/nicebyte","followers_url":"https://api.github.com/users/nicebyte/followers","following_url":"https://api.github.com/users/nicebyte/following{/other_user}","gists_url":"https://api.github.com/users/nicebyte/gists{/gist_id}","starred_url":"https://api.github.com/users/nicebyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicebyte/subscriptions","organizations_url":"https://api.github.com/users/nicebyte/orgs","repos_url":"https://api.github.com/users/nicebyte/repos","events_url":"https://api.github.com/users/nicebyte/events{/privacy}","received_events_url":"https://api.github.com/users/nicebyte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-30T06:12:35Z","updated_at":"2018-11-01T05:39:25Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/KhronosGroup/glslang/pulls/1557","html_url":"https://github.com/KhronosGroup/glslang/pull/1557","diff_url":"https://github.com/KhronosGroup/glslang/pull/1557.diff","patch_url":"https://github.com/KhronosGroup/glslang/pull/1557.patch"},"body":"Consider the following code:\r\n\r\n    layout(constant_id=0) const int Y = 1;\r\n    layout(constant_id=1) const int Z = 2;\r\n    layout(constant_id=3) const int X = Y + Z;\r\n\r\nPreviously, it would produce SPIR-V decorations like this:\r\n\r\n    Decorate 21(Y) SpecId 1\r\n    Decorate 22 SpecId 3\r\n    Decorate 33(Z) SpecId 0\r\n\r\nThis seems inaccurate, since the spec constant `X` that is dependent on\r\nthe two others did not get a name in the SPIR-V decorations. This behavior\r\nmay potentially negatively affect shader introspection capabilities.\r\n\r\nThis change alters the behavior to always add a name, which results in the code\r\nabove producing the following decorations:\r\n\r\n    Decorate 21(Y) SpecId 1\r\n    Decorate 22(X) SpecId 3\r\n    Decorate 33(Z) SpecId 0"},"comment":{"url":"https://api.github.com/repos/KhronosGroup/glslang/issues/comments/434936535","html_url":"https://github.com/KhronosGroup/glslang/pull/1557#issuecomment-434936535","issue_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/1557","id":434936535,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDkzNjUzNQ==","user":{"login":"nicebyte","id":12521759,"node_id":"MDQ6VXNlcjEyNTIxNzU5","avatar_url":"https://avatars2.githubusercontent.com/u/12521759?v=4","gravatar_id":"","url":"https://api.github.com/users/nicebyte","html_url":"https://github.com/nicebyte","followers_url":"https://api.github.com/users/nicebyte/followers","following_url":"https://api.github.com/users/nicebyte/following{/other_user}","gists_url":"https://api.github.com/users/nicebyte/gists{/gist_id}","starred_url":"https://api.github.com/users/nicebyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicebyte/subscriptions","organizations_url":"https://api.github.com/users/nicebyte/orgs","repos_url":"https://api.github.com/users/nicebyte/repos","events_url":"https://api.github.com/users/nicebyte/events{/privacy}","received_events_url":"https://api.github.com/users/nicebyte/received_events","type":"User","site_admin":false},"created_at":"2018-11-01T05:39:25Z","updated_at":"2018-11-01T05:39:25Z","author_association":"CONTRIBUTOR","body":"All tests pass now, however it appears that SPIR-V validation tools think that a constant that is derived from other spec constants cannot be decorated with a `constant_id`.  See the following portion of the output:\r\n\r\n```\r\nerror: SPIRV-Tools Validation Errors\r\nerror: OpDecorate SpecId decoration target <id> '1' is not a scalar specialization constant.\r\n  OpDecorate %su64inc SpecId 105\r\n```\r\n\r\nAbove, `su64inc` is decorated with a `constant_id`, and is a constant whose default value depends on another specialization constant. \r\n\r\nThis ties back to the discussion here: https://github.com/KhronosGroup/SPIRV-Cross/pull/733#discussion_r229229653\r\n\r\nDepending on the final decision on how the spec should be interpreted, either the validation tools need to be modified to accept this as valid SPIR-V, or glslang should start rejecting code that was shown in the commit message."}}
{"actor":{"display_login":"nicebyte"}}