texelFetch Convert

I am trying to convert this shader to sparksl, but there is a problem that I have not encountered before

I converted it like this Based on the same Texture.sample

but I know that this method is not correct and I encounter this message

texelfetch works based on pixels, I think it needs the beginning and end of the page for the correct physics in this shader, that’s why it uses this method

But how to convert texelFetch?

I think there are some specific differences about how texel fetch works, compared to normal sampling. There’s no direct method that matches it in Spark, but generally I think you should be fine to use mediump or highp precision in conjunction with fragment stage sampling (which also works on pixels).

This specific error you are getting can be fixed just by removing the second argument. I’m guessing it was used to specify the level of detail for mipmapping (0 being the highest, most detailed). BufferA.sample(uv);