Replies: 1 comment
-
Ok, so, turns out if I create the texture with the VK_FORMAT_R8G8B8A8_UNORM format rather than VK_FORMAT_R8G8B8A8_UINT, and use a 'sampler' rather than 'usampler', it works - I can use unnormalized coordinates and get the expected texture value. Not sure why it doesn't work with VK_FORMAT_R8G8B8A8_UINT, but I can work with VK_FORMAT_R8G8B8A8_UNORM. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a basic 256x256 test gradient test texture where (0, 0) is 0, (1, 0) is 1, etc. with each texel incrementing by one until (255, 255) is 65535. I'm not doing anything special when I make it:
And I have a straightforward shader:
The shader is just sampling the middle of the texture for this example. If you sample any of the first row, things are fine. (0, 0), (1, 0), (2, 0), etc. are all good. But as soon as you try to sample any row other than y = 0 on iOS, the resulting sampled value is (255, 255, 255, 255) (i.e., the edge value), rather than (128, 128, 128, 128). I've tried both my iPhone 14 Pro and my old iPad 5th gen. Note however that this does work on MacOS.
Am I doing something wrong or missing something completely obvious? I've been poking at it for 3 days now. I checked out the MoltenVk code that translate a Vulkan texture sampler request to a Metal one; honestly it all looks fine. Maybe this is an iOS specific thing?
Anyway any thoughts are much appreciated. Maybe I'll just be forced to use normalized coordinates; won't be the end of the world.
Beta Was this translation helpful? Give feedback.
All reactions