{"action":"closed","issue":{"url":"https://api.github.com/repos/SaschaWillems/Vulkan/issues/251","repository_url":"https://api.github.com/repos/SaschaWillems/Vulkan","labels_url":"https://api.github.com/repos/SaschaWillems/Vulkan/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/SaschaWillems/Vulkan/issues/251/comments","events_url":"https://api.github.com/repos/SaschaWillems/Vulkan/issues/251/events","html_url":"https://github.com/SaschaWillems/Vulkan/issues/251","id":192144167,"number":251,"title":"'computeparticles' has non-deterministic results","user":{"login":"kspagnoli-nv","id":17505421,"avatar_url":"https://avatars.githubusercontent.com/u/17505421?v=3","gravatar_id":"","url":"https://api.github.com/users/kspagnoli-nv","html_url":"https://github.com/kspagnoli-nv","followers_url":"https://api.github.com/users/kspagnoli-nv/followers","following_url":"https://api.github.com/users/kspagnoli-nv/following{/other_user}","gists_url":"https://api.github.com/users/kspagnoli-nv/gists{/gist_id}","starred_url":"https://api.github.com/users/kspagnoli-nv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kspagnoli-nv/subscriptions","organizations_url":"https://api.github.com/users/kspagnoli-nv/orgs","repos_url":"https://api.github.com/users/kspagnoli-nv/repos","events_url":"https://api.github.com/users/kspagnoli-nv/events{/privacy}","received_events_url":"https://api.github.com/users/kspagnoli-nv/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-28T23:16:19Z","updated_at":"2016-11-29T19:45:44Z","closed_at":"2016-11-29T19:45:44Z","body":"Hi Sascha, \r\n\r\nI found a subtle bug in the 'computeparticles' example. The compute shader is actually doing 16x the work it needs to which results in multiple work items writing to the same memory location. This results in non-deterministic results. \r\n\r\nIn the current implementation, you are dispatching with a global size of 16348x1x1 and a local size of 16x16x1. This results in an overall grid of 261568x16x1 where the x-size matches the number of particles (good!) but the work is done 16x for each particles (trouble!).\r\n\r\nThis can easily be fixed by changing the local_size_y in the compute shader from...\r\n\r\n```glsl\r\nlayout (local_size_x = 16, local_size_y = 16) in;\r\n```\r\n\r\nTo...\r\n\r\n```glsl\r\nlayout (local_size_x = 16, local_size_y = 1) in;\r\n```\r\n\r\nThough, I'd recommend changing to...\r\n\r\n```glsl\r\nlayout (local_size_x = 256, local_size_y = 1) in;\r\n```\r\n\r\nAnd updating the global dispatch size for better performance.\r\n\r\nFor what it's worth, I noticed this while debugging with NVIDIA Nsight and seeing inconsistent post-dispatch buffer data.\r\n\r\nThanks for the great samples!\r\n"}}
{"actor":{"display_login":"SaschaWillems"}}