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

Consider adding PhantomData to Image and Pipe memory objects #2

Closed
kenba opened this issue Jan 15, 2021 · 2 comments
Closed

Consider adding PhantomData to Image and Pipe memory objects #2

kenba opened this issue Jan 15, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@kenba
Copy link
Owner

kenba commented Jan 15, 2021

Consider adding PhantomData to Image and Pipe memory objects to match the Buffer implementation of pull request #1.

@kenba kenba added the enhancement New feature or request label Jan 15, 2021
@kenba
Copy link
Owner Author

kenba commented Jan 16, 2021

PhantomData was added to Buffer because a Buffer refers to an array/Vector of data of a given type and the PhantomData is used to hold the type information to help the Rust compiler's type checking.

Image and Pipe are different in that they refer to the underlying data in different ways:

  • An Image refers to the underlying image in cl_image_format and cl_image_desc structures.
  • A Pipe only refers to the pipe_packet_size, i.e. the sizeof the type of data being sent down the Pipe.

There is nothing to be gained by storing type information in Image or Pipe, so they do not require a PhantomData variable.

There is also no reason for any Image or Pipe methods to be declared as template functions, so the templates should be removed.

@kenba
Copy link
Owner Author

kenba commented Jan 16, 2021

Unnecessary templates removed from methods in commit 7a2d015

@kenba kenba closed this as completed Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant