You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Further to the conversations in #65, #67 and GH-77, we should consider reserving ShaderBuiltins for members that will throw a ShaderBuiltinException as they cannot reasonably be implemented on the CPU - therefore code that uses them cannot be run on the CPU.
Methods that can have CPU equivalents should be in a seperate class (Builtins) to indicate that they can run on the GPU & CPU. This makes it easy to see if a file is using GPU only functionality (as it will reference ShaderBuiltins. By only including Builtins you can be sure the members used will be available when running the same code directly on the CPU.
Note, before GH-77 all members of ShaderBuiltins throw a ShaderBuiltinException anyway when executed on the CPU, even when they could be implemented to run on the CPU, so this wasn't as big an issue. However, going forward, the ability to share code between GPU & CPU is a USP of the library, and so consideration should be given to creating CPU implementations of members whenever feasible, so the distinction becomes more important.
The text was updated successfully, but these errors were encountered:
Note, this will also make it easier to test, as an automatic test can easily be added to ensure all ShaderBuiltins members throw a ShaderBuiltinException on invocation. Further, an automated test can be added to test consistency between Builtins members on CPU & GPU.
Further to the conversations in #65, #67 and GH-77, we should consider reserving
ShaderBuiltins
for members that will throw aShaderBuiltinException
as they cannot reasonably be implemented on the CPU - therefore code that uses them cannot be run on the CPU.Methods that can have CPU equivalents should be in a seperate class (
Builtins
) to indicate that they can run on the GPU & CPU. This makes it easy to see if a file is using GPU only functionality (as it will referenceShaderBuiltins
. By only includingBuiltins
you can be sure the members used will be available when running the same code directly on the CPU.Note, before GH-77 all members of
ShaderBuiltins
throw aShaderBuiltinException
anyway when executed on the CPU, even when they could be implemented to run on the CPU, so this wasn't as big an issue. However, going forward, the ability to share code between GPU & CPU is a USP of the library, and so consideration should be given to creating CPU implementations of members whenever feasible, so the distinction becomes more important.The text was updated successfully, but these errors were encountered: