newView.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. return {
  2. tag = 'texture-view',
  3. summary = 'Create a texture view referencing a parent Texture.',
  4. description = [[
  5. Creates a new Texture view. A texture view does not store any pixels on its own, but instead
  6. uses the pixel data of a "parent" Texture object. The width, height, format, sample count, and
  7. usage flags all match the parent. The view may have a different `TextureType` from the parent,
  8. and it may reference a subset of the parent texture's layers and mipmap levels.
  9. Texture views can be used as render targets in a render pass and they can be bound to Shaders.
  10. They can not currently be used for transfer operations. They are used for:
  11. - Reinterpretation of texture contents. For example, a cubemap can be treated as
  12. an array texture.
  13. - Rendering to a particular image or mipmap level of a texture.
  14. - Binding a particular image or mipmap level to a shader.
  15. ]],
  16. arguments = {
  17. type = {
  18. type = 'TextureType',
  19. description = 'The texture type of the view.'
  20. },
  21. layer = {
  22. type = 'number',
  23. default = '1',
  24. description = 'The index of the first layer in the view.'
  25. },
  26. layerCount = {
  27. type = 'number',
  28. default = 'nil',
  29. description = 'The number of layers in the view, or `nil` to use all remaining layers.'
  30. },
  31. mipmap = {
  32. type = 'number',
  33. default = '1',
  34. description = 'The index of the first mipmap in the view.'
  35. },
  36. mipmapCount = {
  37. type = 'number',
  38. default = 'nil',
  39. description = 'The number of mipmaps in the view, or `nil` to use all remaining mipmaps.'
  40. }
  41. },
  42. returns = {
  43. view = {
  44. type = 'Texture',
  45. description = 'The new texture view.'
  46. }
  47. },
  48. variants = {
  49. {
  50. description = 'Create a 2D texture view referencing a single layer and mipmap.',
  51. arguments = { 'layer', 'mipmap' },
  52. returns = { 'view' }
  53. },
  54. {
  55. description = 'Create a texture view with an explicit type, layer range, and mipmap range.',
  56. arguments = { 'type', 'layer', 'layerCount', 'mipmap', 'mipmapCount' },
  57. returns = { 'view' }
  58. }
  59. },
  60. related = {
  61. 'Texture:isView',
  62. 'Texture:getParent',
  63. 'lovr.graphics.newTexture'
  64. }
  65. }