{"action":"created","issue":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/issues/529","repository_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross","labels_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/issues/529/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/issues/529/comments","events_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/issues/529/events","html_url":"https://github.com/KhronosGroup/SPIRV-Cross/issues/529","id":312791270,"number":529,"title":"Using depth texture for Metal","user":{"login":"cyh36","id":19408604,"avatar_url":"https://avatars3.githubusercontent.com/u/19408604?v=4","gravatar_id":"","url":"https://api.github.com/users/cyh36","html_url":"https://github.com/cyh36","followers_url":"https://api.github.com/users/cyh36/followers","following_url":"https://api.github.com/users/cyh36/following{/other_user}","gists_url":"https://api.github.com/users/cyh36/gists{/gist_id}","starred_url":"https://api.github.com/users/cyh36/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyh36/subscriptions","organizations_url":"https://api.github.com/users/cyh36/orgs","repos_url":"https://api.github.com/users/cyh36/repos","events_url":"https://api.github.com/users/cyh36/events{/privacy}","received_events_url":"https://api.github.com/users/cyh36/received_events","type":"User","site_admin":false},"labels":[{"id":352397990,"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-10T06:41:12Z","updated_at":"2018-04-10T07:49:29Z","closed_at":null,"author_association":"NONE","body":"Given the SPIRV generated from the following shader:\r\n```\r\nlayout (binding = 0) uniform texture2D uDepth; \r\nlayout (binding = 1) uniform samplerShadow uSampler;\r\n\r\nfloat Samp(vec2 uv)\r\n{\r\n    return texture(sampler2DShadow(uDepth, uSampler), vec3(uv, 0.001));\r\n}\r\n```\r\nThe Metal version would automatically supplement the function arguments, like:\r\n```\r\nfloat Samp(thread const float2& uv, thread texture2d<float> uDepth_, thread sampler uSampler_)\r\n{\r\n    return uDepth_.sample_compare(uSampler_, uv, 0.001);\r\n}\r\n```\r\nObviously the texture “uDepth” get a wrong type \"texture2d<float>\". If I define the function arguments explicitly like \"float Samp(texture2D t, samplerShadow s, vec2 uv)\", than the metal shader converted will be correct.\r\n\r\nThe second problem is, the iOS Metal requires that the sampler in sample_compare is a compile-time constant, so the metal shader above wouldn't be compiled successfully on iOS. It seems that the MSL Compiler should add a \"constexpr sampler\" declaration before sample_compare method invoking automatically for iOS?\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/issues/comments/380007485","html_url":"https://github.com/KhronosGroup/SPIRV-Cross/issues/529#issuecomment-380007485","issue_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Cross/issues/529","id":380007485,"user":{"login":"HansKristian-ARM","id":17786731,"avatar_url":"https://avatars2.githubusercontent.com/u/17786731?v=4","gravatar_id":"","url":"https://api.github.com/users/HansKristian-ARM","html_url":"https://github.com/HansKristian-ARM","followers_url":"https://api.github.com/users/HansKristian-ARM/followers","following_url":"https://api.github.com/users/HansKristian-ARM/following{/other_user}","gists_url":"https://api.github.com/users/HansKristian-ARM/gists{/gist_id}","starred_url":"https://api.github.com/users/HansKristian-ARM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansKristian-ARM/subscriptions","organizations_url":"https://api.github.com/users/HansKristian-ARM/orgs","repos_url":"https://api.github.com/users/HansKristian-ARM/repos","events_url":"https://api.github.com/users/HansKristian-ARM/events{/privacy}","received_events_url":"https://api.github.com/users/HansKristian-ARM/received_events","type":"User","site_admin":false},"created_at":"2018-04-10T07:49:29Z","updated_at":"2018-04-10T07:49:29Z","author_association":"CONTRIBUTOR","body":"Something is probably missing in the tracking of how images are used.\r\n\r\nHaving to use compile-time constant samplers for depth seems kinda silly, does Metal seriously require this? That means changing a sampler will force a full recompile of shaders, and forget about arrays of samplers ..."}}
{"actor":{"display_login":"HansKristian-ARM"}}