Last active
January 11, 2019 13:41
-
-
Save fuqunaga/3bd590dbb7b3c560d5acef69e3b3cc6a to your computer and use it in GitHub Desktop.
DispatchThreadNum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ComputerShaderExtension | |
{ | |
public static void DispatchThreadNum(this ComputeShader cs, int kernel, int threadNumX, int threadNumY, int threadNumZ) | |
{ | |
uint x, y, z; | |
cs.GetKernelThreadGroupSizes(kernel, out x, out y, out z); | |
cs.Dispatch(kernel, Mathf.CeilToInt((float)threadNumX / x), Mathf.CeilToInt((float)threadNumY / y), Mathf.CeilToInt((float)threadNumZ / z)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment