Closed nyorain closed 2 years ago
Thank you so much for the PR. I've tested it a bit and it works nicely. I am going to give it a more thorough test once I integrate this new version of SPIRV-VM into SHADERed.
I am open to unit tests too -- it would certainly improve the quality of the project!
Anyway, it's a really nice PR, thank you once again. I've added you to the README.md as a contributor.
This implements a new API for image sampling with the following goals:
spvm_state
.spvm_image
is now the "base" struct only containing basic image information and applications will extend that struct with their own information. The implementation mirroring the old approach is calledspvm_image_data
so we have an API incompatibility here. If that's a big issue we could change the names (using something likespvm_image_base
for the interface instead) but I'd rather not.More of a RFC on the API design for now, the implementation still has some TODOs, isn't well tested and I might have missed one or two changes from my modified spvm version that are already needed. I would be in favor of adding a small set of unit tests to spvm and be willing to write them.
This PR already contains some additional fixes that were needed/useful to implement the new sampling:
SPVM_
prefix to the macros. Surprisingly many projects think it's a good idea to define macros likeMIN
in their header files.sampled_image
consists of two members: first the image, then the sampler.spvm_member_memcpy
that was useful during debugging and helps code documentation.