Browse Source

Add note about mipmaps in Texture:setPixels;

bjorn 1 year ago
parent
commit
73b687213d
2 changed files with 8 additions and 1 deletions
  1. 2 1
      api/init.lua
  2. 6 0
      api/lovr/graphics/Texture/setPixels.lua

+ 2 - 1
api/init.lua

@@ -23399,9 +23399,10 @@ return {
               description = "Sets pixels in the texture.  The source data can be an `Image` with the pixels to upload, or another `Texture` object to copy from.",
               key = "Texture:setPixels",
               module = "lovr.graphics",
-              notes = "The destination and source textures must have been created with the `transfer` usage.\n\nMultisampled textures can not be copied.\n\nIt is not currently possible to copy to or from a texture view.\n\nCopying between textures requires them to have the same format.\n\nWhen using different region sizes in a texture-to-texture copy:\n\n- It is not possible to mix 3D with non-3D textures.\n- Not every texture format is supported, use `lovr.graphics.isFormatSupported` to check.",
+              notes = "Note that if calling `Texture:setPixels(Image)` will only update the first mipmap of the texture, leaving the other mipmaps as-is.  You may want to regenerate the texture's mipmaps afterwards by calling `Texture:generateMipmaps`, or disable mipmaps entirely by setting `mipmaps` to false in `lovr.graphics.newTexture`.\n\nThe destination and source textures must have been created with the `transfer` usage.\n\nMultisampled textures can not be copied.\n\nIt is not currently possible to copy to or from a texture view.\n\nCopying between textures requires them to have the same format.\n\nWhen using different region sizes in a texture-to-texture copy:\n\n- It is not possible to mix 3D with non-3D textures.\n- Not every texture format is supported, use `lovr.graphics.isFormatSupported` to check.",
               related = {
                 "Texture:newReadback",
+                "Texture:generateMipmaps",
                 "Image:paste"
               },
               variants = {

+ 6 - 0
api/lovr/graphics/Texture/setPixels.lua

@@ -116,6 +116,11 @@ return {
     }
   },
   notes = [[
+    Note that if calling `Texture:setPixels(Image)` will only update the first mipmap of the
+    texture, leaving the other mipmaps as-is.  You may want to regenerate the texture's mipmaps
+    afterwards by calling `Texture:generateMipmaps`, or disable mipmaps entirely by setting
+    `mipmaps` to false in `lovr.graphics.newTexture`.
+
     The destination and source textures must have been created with the `transfer` usage.
 
     Multisampled textures can not be copied.
@@ -131,6 +136,7 @@ return {
   ]],
   related = {
     'Texture:newReadback',
+    'Texture:generateMipmaps',
     'Image:paste'
   }
 }