{"action":"created","issue":{"url":"https://api.github.com/repos/gpuweb/gpuweb/issues/122","repository_url":"https://api.github.com/repos/gpuweb/gpuweb","labels_url":"https://api.github.com/repos/gpuweb/gpuweb/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/gpuweb/gpuweb/issues/122/comments","events_url":"https://api.github.com/repos/gpuweb/gpuweb/issues/122/events","html_url":"https://github.com/gpuweb/gpuweb/pull/122","id":382044005,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxODQzODk4","number":122,"title":"Add depthTestEnabled and stencilTestEnabled to DepthStencilDescriptor","user":{"login":"Richard-Yunchao","id":11435653,"node_id":"MDQ6VXNlcjExNDM1NjUz","avatar_url":"https://avatars1.githubusercontent.com/u/11435653?v=4","gravatar_id":"","url":"https://api.github.com/users/Richard-Yunchao","html_url":"https://github.com/Richard-Yunchao","followers_url":"https://api.github.com/users/Richard-Yunchao/followers","following_url":"https://api.github.com/users/Richard-Yunchao/following{/other_user}","gists_url":"https://api.github.com/users/Richard-Yunchao/gists{/gist_id}","starred_url":"https://api.github.com/users/Richard-Yunchao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Richard-Yunchao/subscriptions","organizations_url":"https://api.github.com/users/Richard-Yunchao/orgs","repos_url":"https://api.github.com/users/Richard-Yunchao/repos","events_url":"https://api.github.com/users/Richard-Yunchao/events{/privacy}","received_events_url":"https://api.github.com/users/Richard-Yunchao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-11-19T03:30:39Z","updated_at":"2018-11-21T06:10:19Z","closed_at":"2018-11-20T01:59:28Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gpuweb/gpuweb/pulls/122","html_url":"https://github.com/gpuweb/gpuweb/pull/122","diff_url":"https://github.com/gpuweb/gpuweb/pull/122.diff","patch_url":"https://github.com/gpuweb/gpuweb/pull/122.patch"},"body":"Please refer to the investigation at https://github.com/gpuweb/gpuweb/issues/118 and the discussion at https://github.com/gpuweb/gpuweb/pull/114. \r\n\r\nHere comes the comparison about depthTestEnable/stencilTestEnable in Metal, D3D12 and Vulkan:\r\nD3D12 and Vulkan can support depthTestEnabled and stencilTestEnabled directly in its depth/stencil state or descriptor. Both of them can only enable/disable depth or stencil test for both front and back faces. They can't enable depth or stencil test for one face and disable it for the other face.\r\n\r\nMetal doesn't have a variable to explict disable/enable depth test or stencil test. But it can make depth test always pass via setting depthCompareFunction to its default value MTLCompareFunction.always. And it can disable stencil test via setting MTLStencilDescriptor to nil for front or back face separately. \r\n\r\nBased on the fact above (please correct me if I made mistakes), I prefer to add depthTestEnabled and stencilTestEnabled in WebGPUDepthStencilStateDescriptor:\r\nIf we add these two parameters, it can be supported directly in D3D12 and Vulkan. And it is doable in Metal too. And it's straightforward for web devs. \r\n\r\nIf we don't have these two parameters. Then we need to say in WebGPU spec:\r\n1) setting **WebGPUCompareFunction depthCompare** in WebGPUDepthStencilDescriptor to **always** to disable depth test. \r\n2) setting both **WebGPUStencilStateFaceDescriptor front** and **WebGPUStencilStateFaceDescriptor back** to null object (or **WebGPUCompareFunction compare** to **always** for both front and back faces) in order to disable stencil test for both faces. If you only set one face to null and don't set the other face, an error will be generated.    \r\n\r\nNo matter we add these two parameters or not, we basically do the same for underlying 3 graphics APIs under the hood in order to disable depth/stencil test or toggle between enabling/disabling. But it seems to me that adding these two parameters is much more straightforward for web devs. \r\n\r\nSo I created this pr for discussion. PTAL. \r\nIf you think we don't need them, I'm OK to close this pr.  And I totally agree with Kai that we should  either have both or have neither. "},"comment":{"url":"https://api.github.com/repos/gpuweb/gpuweb/issues/comments/440545745","html_url":"https://github.com/gpuweb/gpuweb/pull/122#issuecomment-440545745","issue_url":"https://api.github.com/repos/gpuweb/gpuweb/issues/122","id":440545745,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDU0NTc0NQ==","user":{"login":"Richard-Yunchao","id":11435653,"node_id":"MDQ6VXNlcjExNDM1NjUz","avatar_url":"https://avatars1.githubusercontent.com/u/11435653?v=4","gravatar_id":"","url":"https://api.github.com/users/Richard-Yunchao","html_url":"https://github.com/Richard-Yunchao","followers_url":"https://api.github.com/users/Richard-Yunchao/followers","following_url":"https://api.github.com/users/Richard-Yunchao/following{/other_user}","gists_url":"https://api.github.com/users/Richard-Yunchao/gists{/gist_id}","starred_url":"https://api.github.com/users/Richard-Yunchao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Richard-Yunchao/subscriptions","organizations_url":"https://api.github.com/users/Richard-Yunchao/orgs","repos_url":"https://api.github.com/users/Richard-Yunchao/repos","events_url":"https://api.github.com/users/Richard-Yunchao/events{/privacy}","received_events_url":"https://api.github.com/users/Richard-Yunchao/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T06:10:19Z","updated_at":"2018-11-21T06:10:19Z","author_association":"CONTRIBUTOR","body":"@kvark , no worries. We can revisit this issue in future if needed. "}}
{"actor":{"display_login":"Richard-Yunchao"}}