SUTextureCreateFromImageData


#1

Hey, all. So, I wound up getting an SU_ERROR_GENERIC throw on a call to SUTextureCreateFromImageData.

I’m sending an image with a width of 1024, height of 880, and a bit stride of 24. From what I can see, this error isn’t listed in the docs for this function.

Any idea what the cause of this might be?


#2

Any chance you have a sample code snippet?

Does it happen with only one specific image, or any image you use?


#3

SU_ERROR_GENERIC will only be returned if either of width, height or bits_per_pixel parameters are zero. We missed that in the documentation. But you are not passing zero to either one. Looking at the code, this can’t possibly be happening :-/


#4

@bugra, @tt_su , you’re correct: the issue with SU_ERROR_GENERIC actually no longer applies - my bad.

However, I have what I understand to be a valid buffer of image data being passed to the CreateFromImageData function, and I keep getting invalid read access errors. I’m wondering if I’m missing something, here…

Anyway, for what it’s worth, here’s the code. The exception is thrown on line 46.

Of course, if you have any questions please do ask. I appreciate the help.


#5

Update: I figured out the problem. Silly me, I wasn’t taking into account the byte stride for the buffer sizes.

Thanks again :smile: