TextureFormat.lua 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. return {
  2. description = [[
  3. Different data layouts for pixels in `Image` and `Texture` objects.
  4. Formats starting with `d` are depth formats, used for depth/stencil render targets.
  5. Formats starting with `bc` and `astc` are compressed formats. Compressed formats have better
  6. performance since they stay compressed on the CPU and GPU, reducing the amount of memory
  7. bandwidth required to look up all the pixels needed for shading.
  8. Formats without the `f` suffix are unsigned normalized formats, which store values in the range
  9. `[0,1]`. The `f` suffix indicates a floating point format which can store values outside this
  10. range, and is used for HDR rendering or storing data in a texture.
  11. ]],
  12. values = {
  13. {
  14. name = 'r8',
  15. description = 'One 8-bit channel. 1 byte per pixel.'
  16. },
  17. {
  18. name = 'rg8',
  19. description = 'Two 8-bit channels. 2 bytes per pixel.'
  20. },
  21. {
  22. name = 'rgba8',
  23. description = 'Four 8-bit channels. 4 bytes per pixel.'
  24. },
  25. {
  26. name = 'r16',
  27. description = 'One 16-bit channel. 2 bytes per pixel.'
  28. },
  29. {
  30. name = 'rg16',
  31. description = 'Two 16-bit channels. 4 bytes per pixel.'
  32. },
  33. {
  34. name = 'rgba16',
  35. description = 'Four 16-bit channels. 8 bytes per pixel.'
  36. },
  37. {
  38. name = 'r16f',
  39. description = 'One 16-bit floating point channel. 2 bytes per pixel.'
  40. },
  41. {
  42. name = 'rg16f',
  43. description = 'Two 16-bit floating point channels. 4 bytes per pixel.'
  44. },
  45. {
  46. name = 'rgba16f',
  47. description = 'Four 16-bit floating point channels. 8 bytes per pixel.'
  48. },
  49. {
  50. name = 'r32f',
  51. description = 'One 32-bit floating point channel. 4 bytes per pixel.'
  52. },
  53. {
  54. name = 'rg32f',
  55. description = 'Two 32-bit floating point channels. 8 bytes per pixel.'
  56. },
  57. {
  58. name = 'rgba32f',
  59. description = 'Four 32-bit floating point channels. 16 bytes per pixel.'
  60. },
  61. {
  62. name = 'rgb565',
  63. description = 'Packs three channels into 16 bits. 2 bytes per pixel.'
  64. },
  65. {
  66. name = 'rgb5a1',
  67. description = 'Packs four channels into 16 bits, with "cutout" alpha. 2 bytes per pixel.'
  68. },
  69. {
  70. name = 'rgb10a2',
  71. description = 'Packs four channels into 32 bits. 4 bytes per pixel.'
  72. },
  73. {
  74. name = 'rg11b10f',
  75. description = 'Packs three unsigned floating point channels into 32 bits. 4 bytes per pixel.'
  76. },
  77. {
  78. name = 'd16',
  79. description = 'One 16-bit depth channel. 2 bytes per pixel.'
  80. },
  81. {
  82. name = 'd24s8',
  83. description = 'One 24-bit depth channel and one 8-bit stencil channel. 4 bytes per pixel.'
  84. },
  85. {
  86. name = 'd32f',
  87. description = 'One 32-bit floating point depth channel. 4 bytes per pixel.'
  88. },
  89. {
  90. name = 'd32fs8',
  91. description = [[
  92. One 32-bit floating point depth channel and one 8-bit stencil channel. 5 bytes per pixel.
  93. ]]
  94. },
  95. {
  96. name = 'bc1',
  97. description = [[
  98. 3 channels. 8 bytes per 4x4 block, or 0.5 bytes per pixel. Good for opaque images.
  99. ]]
  100. },
  101. {
  102. name = 'bc2',
  103. description = [[
  104. Four channels. 16 bytes per 4x4 block or 1 byte per pixel. Not good for anything, because
  105. it only has 16 distinct levels of alpha.
  106. ]]
  107. },
  108. {
  109. name = 'bc3',
  110. description = [[
  111. Four channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for color images with
  112. transparency.
  113. ]]
  114. },
  115. {
  116. name = 'bc4u',
  117. description = [[
  118. One unsigned normalized channel. 8 bytes per 4x4 block or 0.5 bytes per pixel. Good for
  119. grayscale images, like heightmaps.
  120. ]]
  121. },
  122. {
  123. name = 'bc4s',
  124. description = [[
  125. One signed normalized channel. 8 bytes per 4x4 block or 0.5 bytes per pixel. Similar to
  126. bc4u but has a range of -1 to 1.
  127. ]]
  128. },
  129. {
  130. name = 'bc5u',
  131. description = [[
  132. Two unsigned normalized channels. 16 bytes per 4x4 block, or 1 byte per pixel. Good for
  133. normal maps.
  134. ]]
  135. },
  136. {
  137. name = 'bc5s',
  138. description = [[
  139. Two signed normalized channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for
  140. normal maps.
  141. ]]
  142. },
  143. {
  144. name = 'bc6uf',
  145. description = [[
  146. Three unsigned floating point channels. 16 bytes per 4x4 block or 1 byte per pixel. Good
  147. for HDR images.
  148. ]]
  149. },
  150. {
  151. name = 'bc6sf',
  152. description = [[
  153. Three floating point channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for HDR
  154. images.
  155. ]]
  156. },
  157. {
  158. name = 'bc7',
  159. description = [[
  160. Four channels. 16 bytes per 4x4 block or 1 byte per pixel. High quality. Good for most
  161. color images, including transparency.
  162. ]]
  163. },
  164. {
  165. name = 'astc4x4',
  166. description = 'Four channels, 16 bytes per 4x4 block or 1 byte per pixel.'
  167. },
  168. {
  169. name = 'astc5x4',
  170. description = 'Four channels, 16 bytes per 5x4 block or 0.80 bytes per pixel.'
  171. },
  172. {
  173. name = 'astc5x5',
  174. description = 'Four channels, 16 bytes per 5x5 block or 0.64 bytes per pixel.'
  175. },
  176. {
  177. name = 'astc6x5',
  178. description = 'Four channels, 16 bytes per 6x5 block or 0.53 bytes per pixel.'
  179. },
  180. {
  181. name = 'astc6x6',
  182. description = 'Four channels, 16 bytes per 6x6 block or 0.44 bytes per pixel.'
  183. },
  184. {
  185. name = 'astc8x5',
  186. description = 'Four channels, 16 bytes per 8x5 block or 0.40 bytes per pixel.'
  187. },
  188. {
  189. name = 'astc8x6',
  190. description = 'Four channels, 16 bytes per 8x6 block or 0.33 bytes per pixel.'
  191. },
  192. {
  193. name = 'astc8x8',
  194. description = 'Four channels, 16 bytes per 8x8 block or 0.25 bytes per pixel.'
  195. },
  196. {
  197. name = 'astc10x5',
  198. description = 'Four channels, 16 bytes per 10x5 block or 0.32 bytes per pixel.'
  199. },
  200. {
  201. name = 'astc10x6',
  202. description = 'Four channels, 16 bytes per 10x6 block or 0.27 bytes per pixel.'
  203. },
  204. {
  205. name = 'astc10x8',
  206. description = 'Four channels, 16 bytes per 10x8 block or 0.20 bytes per pixel.'
  207. },
  208. {
  209. name = 'astc10x10',
  210. description = 'Four channels, 16 bytes per 10x10 block or 0.16 bytes per pixel.'
  211. },
  212. {
  213. name = 'astc12x10',
  214. description = 'Four channels, 16 bytes per 12x10 block or 0.13 bytes per pixel.'
  215. },
  216. {
  217. name = 'astc12x12',
  218. description = 'Four channels, 16 bytes per 12x12 block or 0.11 bytes per pixel.'
  219. }
  220. }
  221. }