Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility to run compute shaders, and add tests for it #45

Merged
merged 12 commits into from
Jan 27, 2020
Merged

Conversation

almarklein
Copy link
Collaborator

@almarklein almarklein commented Jan 21, 2020

  • Add compute_with_buffers() utility function.
  • Add tests for it. This'll be the first time we will be actually running wgpu on CI :)

After this makes it into a release, python-shader could use it to better validate the compiler.

At this this point this is blocked by #47: the added test can't run on CI. If there is no quick solution for it, I propose we disable the test on CI, so that we can at least run it locally.

wgpu/_compute.py Outdated Show resolved Hide resolved
wgpu/_compute.py Outdated Show resolved Hide resolved
wgpu/_compute.py Outdated Show resolved Hide resolved
@Korijn
Copy link
Collaborator

Korijn commented Jan 22, 2020

For now, let's just add an option to skip the tests and merge so we can continue with development, and use #47 to track the problem.

@almarklein
Copy link
Collaborator Author

Ready for final checkup. Changes since last review:

  • The new module was moved to utils subpackage.
  • We already had a utils module, so I renamed that to _coreutils.
  • No more numpy, but ctypes arrays. An extra nice thing about this is that output_arrays must now be specified with just a ctypes array type, which includes the length :)
  • A wrapper that works with numpy arrays is easily made, because numpy operates well with ctypes. (but that wrapper is not in our scope).
  • The tests are skipped if wgpu cannot get a device (this is checked once in a test run).

@Korijn
Copy link
Collaborator

Korijn commented Jan 25, 2020

I'm not too familiar with ctypes but it looks good!

dev-requirements.txt Outdated Show resolved Hide resolved
wgpu/utils/_compute.py Outdated Show resolved Hide resolved
examples/compute_noop.py Show resolved Hide resolved
@Korijn Korijn merged commit d7ddc37 into master Jan 27, 2020
@Korijn Korijn deleted the compute branch January 27, 2020 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants