uploadToTexture

fun CopyPass.uploadToTexture(source: TransferBuffer, destination: GpuTexture, width: Int, height: Int, sourceOffset: Int = 0, x: Int = 0, y: Int = 0)(source)

Copies tightly packed texels for a width by height rectangle from source at sourceOffset into destination, with the rectangle's top-left corner at texel x, y of destination. With x and y at 0 and the texture's own size it fills the whole texture. The rectangle must lie inside destination; SDL does not check it. Pass the Int parameters after the first pair by name.

Throws

if width or height is not positive, or sourceOffset, x or y is negative.


fun GpuDevice.uploadToTexture(texture: GpuTexture, image: Image, x: Int, y: Int)(source)

Copies the pixels of image into texture as given, alpha included and nothing blended, with the image's top-left corner at texel x, y, and leaves the rest of texture as it was. The image must lie inside texture, an RGBA8 texture; SDL does not check it.

The upload is submitted on its own command buffer before this function returns. SDL runs it after the work submitted earlier, so a frame already submitted still sees the old texels and the next one sees the new. Later changes to image do not reach the texture.

Throws

if x or y is negative.

if the staging memory cannot be created or the upload cannot be submitted.