Clone of mesa.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

p_defines.h 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  1. /**************************************************************************
  2. *
  3. * Copyright 2007 VMware, Inc.
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21. * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  22. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. #ifndef PIPE_DEFINES_H
  28. #define PIPE_DEFINES_H
  29. #include "p_compiler.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /**
  34. * Gallium error codes.
  35. *
  36. * - A zero value always means success.
  37. * - A negative value always means failure.
  38. * - The meaning of a positive value is function dependent.
  39. */
  40. enum pipe_error
  41. {
  42. PIPE_OK = 0,
  43. PIPE_ERROR = -1, /**< Generic error */
  44. PIPE_ERROR_BAD_INPUT = -2,
  45. PIPE_ERROR_OUT_OF_MEMORY = -3,
  46. PIPE_ERROR_RETRY = -4
  47. /* TODO */
  48. };
  49. enum pipe_blendfactor {
  50. PIPE_BLENDFACTOR_ONE = 1,
  51. PIPE_BLENDFACTOR_SRC_COLOR,
  52. PIPE_BLENDFACTOR_SRC_ALPHA,
  53. PIPE_BLENDFACTOR_DST_ALPHA,
  54. PIPE_BLENDFACTOR_DST_COLOR,
  55. PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE,
  56. PIPE_BLENDFACTOR_CONST_COLOR,
  57. PIPE_BLENDFACTOR_CONST_ALPHA,
  58. PIPE_BLENDFACTOR_SRC1_COLOR,
  59. PIPE_BLENDFACTOR_SRC1_ALPHA,
  60. PIPE_BLENDFACTOR_ZERO = 0x11,
  61. PIPE_BLENDFACTOR_INV_SRC_COLOR,
  62. PIPE_BLENDFACTOR_INV_SRC_ALPHA,
  63. PIPE_BLENDFACTOR_INV_DST_ALPHA,
  64. PIPE_BLENDFACTOR_INV_DST_COLOR,
  65. PIPE_BLENDFACTOR_INV_CONST_COLOR = 0x17,
  66. PIPE_BLENDFACTOR_INV_CONST_ALPHA,
  67. PIPE_BLENDFACTOR_INV_SRC1_COLOR,
  68. PIPE_BLENDFACTOR_INV_SRC1_ALPHA,
  69. };
  70. enum pipe_blend_func {
  71. PIPE_BLEND_ADD,
  72. PIPE_BLEND_SUBTRACT,
  73. PIPE_BLEND_REVERSE_SUBTRACT,
  74. PIPE_BLEND_MIN,
  75. PIPE_BLEND_MAX,
  76. };
  77. enum pipe_logicop {
  78. PIPE_LOGICOP_CLEAR,
  79. PIPE_LOGICOP_NOR,
  80. PIPE_LOGICOP_AND_INVERTED,
  81. PIPE_LOGICOP_COPY_INVERTED,
  82. PIPE_LOGICOP_AND_REVERSE,
  83. PIPE_LOGICOP_INVERT,
  84. PIPE_LOGICOP_XOR,
  85. PIPE_LOGICOP_NAND,
  86. PIPE_LOGICOP_AND,
  87. PIPE_LOGICOP_EQUIV,
  88. PIPE_LOGICOP_NOOP,
  89. PIPE_LOGICOP_OR_INVERTED,
  90. PIPE_LOGICOP_COPY,
  91. PIPE_LOGICOP_OR_REVERSE,
  92. PIPE_LOGICOP_OR,
  93. PIPE_LOGICOP_SET,
  94. };
  95. #define PIPE_MASK_R 0x1
  96. #define PIPE_MASK_G 0x2
  97. #define PIPE_MASK_B 0x4
  98. #define PIPE_MASK_A 0x8
  99. #define PIPE_MASK_RGBA 0xf
  100. #define PIPE_MASK_Z 0x10
  101. #define PIPE_MASK_S 0x20
  102. #define PIPE_MASK_ZS 0x30
  103. #define PIPE_MASK_RGBAZS (PIPE_MASK_RGBA|PIPE_MASK_ZS)
  104. /**
  105. * Inequality functions. Used for depth test, stencil compare, alpha
  106. * test, shadow compare, etc.
  107. */
  108. enum pipe_compare_func {
  109. PIPE_FUNC_NEVER,
  110. PIPE_FUNC_LESS,
  111. PIPE_FUNC_EQUAL,
  112. PIPE_FUNC_LEQUAL,
  113. PIPE_FUNC_GREATER,
  114. PIPE_FUNC_NOTEQUAL,
  115. PIPE_FUNC_GEQUAL,
  116. PIPE_FUNC_ALWAYS,
  117. };
  118. /** Polygon fill mode */
  119. enum {
  120. PIPE_POLYGON_MODE_FILL,
  121. PIPE_POLYGON_MODE_LINE,
  122. PIPE_POLYGON_MODE_POINT,
  123. PIPE_POLYGON_MODE_FILL_RECTANGLE,
  124. };
  125. /** Polygon face specification, eg for culling */
  126. #define PIPE_FACE_NONE 0
  127. #define PIPE_FACE_FRONT 1
  128. #define PIPE_FACE_BACK 2
  129. #define PIPE_FACE_FRONT_AND_BACK (PIPE_FACE_FRONT | PIPE_FACE_BACK)
  130. /** Stencil ops */
  131. enum pipe_stencil_op {
  132. PIPE_STENCIL_OP_KEEP,
  133. PIPE_STENCIL_OP_ZERO,
  134. PIPE_STENCIL_OP_REPLACE,
  135. PIPE_STENCIL_OP_INCR,
  136. PIPE_STENCIL_OP_DECR,
  137. PIPE_STENCIL_OP_INCR_WRAP,
  138. PIPE_STENCIL_OP_DECR_WRAP,
  139. PIPE_STENCIL_OP_INVERT,
  140. };
  141. /** Texture types.
  142. * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D
  143. */
  144. enum pipe_texture_target
  145. {
  146. PIPE_BUFFER,
  147. PIPE_TEXTURE_1D,
  148. PIPE_TEXTURE_2D,
  149. PIPE_TEXTURE_3D,
  150. PIPE_TEXTURE_CUBE,
  151. PIPE_TEXTURE_RECT,
  152. PIPE_TEXTURE_1D_ARRAY,
  153. PIPE_TEXTURE_2D_ARRAY,
  154. PIPE_TEXTURE_CUBE_ARRAY,
  155. PIPE_MAX_TEXTURE_TYPES,
  156. };
  157. enum pipe_tex_face {
  158. PIPE_TEX_FACE_POS_X,
  159. PIPE_TEX_FACE_NEG_X,
  160. PIPE_TEX_FACE_POS_Y,
  161. PIPE_TEX_FACE_NEG_Y,
  162. PIPE_TEX_FACE_POS_Z,
  163. PIPE_TEX_FACE_NEG_Z,
  164. PIPE_TEX_FACE_MAX,
  165. };
  166. enum pipe_tex_wrap {
  167. PIPE_TEX_WRAP_REPEAT,
  168. PIPE_TEX_WRAP_CLAMP,
  169. PIPE_TEX_WRAP_CLAMP_TO_EDGE,
  170. PIPE_TEX_WRAP_CLAMP_TO_BORDER,
  171. PIPE_TEX_WRAP_MIRROR_REPEAT,
  172. PIPE_TEX_WRAP_MIRROR_CLAMP,
  173. PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE,
  174. PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER,
  175. };
  176. /** Between mipmaps, ie mipfilter */
  177. enum pipe_tex_mipfilter {
  178. PIPE_TEX_MIPFILTER_NEAREST,
  179. PIPE_TEX_MIPFILTER_LINEAR,
  180. PIPE_TEX_MIPFILTER_NONE,
  181. };
  182. /** Within a mipmap, ie min/mag filter */
  183. enum pipe_tex_filter {
  184. PIPE_TEX_FILTER_NEAREST,
  185. PIPE_TEX_FILTER_LINEAR,
  186. };
  187. enum pipe_tex_compare {
  188. PIPE_TEX_COMPARE_NONE,
  189. PIPE_TEX_COMPARE_R_TO_TEXTURE,
  190. };
  191. /**
  192. * Clear buffer bits
  193. */
  194. #define PIPE_CLEAR_DEPTH (1 << 0)
  195. #define PIPE_CLEAR_STENCIL (1 << 1)
  196. #define PIPE_CLEAR_COLOR0 (1 << 2)
  197. #define PIPE_CLEAR_COLOR1 (1 << 3)
  198. #define PIPE_CLEAR_COLOR2 (1 << 4)
  199. #define PIPE_CLEAR_COLOR3 (1 << 5)
  200. #define PIPE_CLEAR_COLOR4 (1 << 6)
  201. #define PIPE_CLEAR_COLOR5 (1 << 7)
  202. #define PIPE_CLEAR_COLOR6 (1 << 8)
  203. #define PIPE_CLEAR_COLOR7 (1 << 9)
  204. /** Combined flags */
  205. /** All color buffers currently bound */
  206. #define PIPE_CLEAR_COLOR (PIPE_CLEAR_COLOR0 | PIPE_CLEAR_COLOR1 | \
  207. PIPE_CLEAR_COLOR2 | PIPE_CLEAR_COLOR3 | \
  208. PIPE_CLEAR_COLOR4 | PIPE_CLEAR_COLOR5 | \
  209. PIPE_CLEAR_COLOR6 | PIPE_CLEAR_COLOR7)
  210. #define PIPE_CLEAR_DEPTHSTENCIL (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)
  211. /**
  212. * Transfer object usage flags
  213. */
  214. enum pipe_transfer_usage
  215. {
  216. /**
  217. * Resource contents read back (or accessed directly) at transfer
  218. * create time.
  219. */
  220. PIPE_TRANSFER_READ = (1 << 0),
  221. /**
  222. * Resource contents will be written back at transfer_unmap
  223. * time (or modified as a result of being accessed directly).
  224. */
  225. PIPE_TRANSFER_WRITE = (1 << 1),
  226. /**
  227. * Read/modify/write
  228. */
  229. PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE,
  230. /**
  231. * The transfer should map the texture storage directly. The driver may
  232. * return NULL if that isn't possible, and the state tracker needs to cope
  233. * with that and use an alternative path without this flag.
  234. *
  235. * E.g. the state tracker could have a simpler path which maps textures and
  236. * does read/modify/write cycles on them directly, and a more complicated
  237. * path which uses minimal read and write transfers.
  238. */
  239. PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2),
  240. /**
  241. * Discards the memory within the mapped region.
  242. *
  243. * It should not be used with PIPE_TRANSFER_READ.
  244. *
  245. * See also:
  246. * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
  247. */
  248. PIPE_TRANSFER_DISCARD_RANGE = (1 << 8),
  249. /**
  250. * Fail if the resource cannot be mapped immediately.
  251. *
  252. * See also:
  253. * - Direct3D's D3DLOCK_DONOTWAIT flag.
  254. * - Mesa's MESA_MAP_NOWAIT_BIT flag.
  255. * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag.
  256. */
  257. PIPE_TRANSFER_DONTBLOCK = (1 << 9),
  258. /**
  259. * Do not attempt to synchronize pending operations on the resource when mapping.
  260. *
  261. * It should not be used with PIPE_TRANSFER_READ.
  262. *
  263. * See also:
  264. * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag.
  265. * - Direct3D's D3DLOCK_NOOVERWRITE flag.
  266. * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag.
  267. */
  268. PIPE_TRANSFER_UNSYNCHRONIZED = (1 << 10),
  269. /**
  270. * Written ranges will be notified later with
  271. * pipe_context::transfer_flush_region.
  272. *
  273. * It should not be used with PIPE_TRANSFER_READ.
  274. *
  275. * See also:
  276. * - pipe_context::transfer_flush_region
  277. * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
  278. */
  279. PIPE_TRANSFER_FLUSH_EXPLICIT = (1 << 11),
  280. /**
  281. * Discards all memory backing the resource.
  282. *
  283. * It should not be used with PIPE_TRANSFER_READ.
  284. *
  285. * This is equivalent to:
  286. * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_BUFFER_BIT
  287. * - BufferData(NULL) on a GL buffer
  288. * - Direct3D's D3DLOCK_DISCARD flag.
  289. * - WDDM's D3DDDICB_LOCKFLAGS.Discard flag.
  290. * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
  291. * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
  292. */
  293. PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1 << 12),
  294. /**
  295. * Allows the resource to be used for rendering while mapped.
  296. *
  297. * PIPE_RESOURCE_FLAG_MAP_PERSISTENT must be set when creating
  298. * the resource.
  299. *
  300. * If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
  301. * must be called to ensure the device can see what the CPU has written.
  302. */
  303. PIPE_TRANSFER_PERSISTENT = (1 << 13),
  304. /**
  305. * If PERSISTENT is set, this ensures any writes done by the device are
  306. * immediately visible to the CPU and vice versa.
  307. *
  308. * PIPE_RESOURCE_FLAG_MAP_COHERENT must be set when creating
  309. * the resource.
  310. */
  311. PIPE_TRANSFER_COHERENT = (1 << 14)
  312. };
  313. /**
  314. * Flags for the flush function.
  315. */
  316. enum pipe_flush_flags
  317. {
  318. PIPE_FLUSH_END_OF_FRAME = (1 << 0),
  319. PIPE_FLUSH_DEFERRED = (1 << 1),
  320. PIPE_FLUSH_FENCE_FD = (1 << 2),
  321. };
  322. /**
  323. * Flags for pipe_context::dump_debug_state.
  324. */
  325. #define PIPE_DUMP_DEVICE_STATUS_REGISTERS (1 << 0)
  326. #define PIPE_DUMP_CURRENT_STATES (1 << 1)
  327. #define PIPE_DUMP_CURRENT_SHADERS (1 << 2)
  328. #define PIPE_DUMP_LAST_COMMAND_BUFFER (1 << 3)
  329. /**
  330. * Create a compute-only context. Use in pipe_screen::context_create.
  331. * This disables draw, blit, and clear*, render_condition, and other graphics
  332. * functions. Interop with other graphics contexts is still allowed.
  333. * This allows scheduling jobs on a compute-only hardware command queue that
  334. * can run in parallel with graphics without stalling it.
  335. */
  336. #define PIPE_CONTEXT_COMPUTE_ONLY (1 << 0)
  337. /**
  338. * Gather debug information and expect that pipe_context::dump_debug_state
  339. * will be called. Use in pipe_screen::context_create.
  340. */
  341. #define PIPE_CONTEXT_DEBUG (1 << 1)
  342. /**
  343. * Whether out-of-bounds shader loads must return zero and out-of-bounds
  344. * shader stores must be dropped.
  345. */
  346. #define PIPE_CONTEXT_ROBUST_BUFFER_ACCESS (1 << 2)
  347. /**
  348. * Prefer threaded pipe_context. It also implies that video codec functions
  349. * will not be used. (they will be either no-ops or NULL when threading is
  350. * enabled)
  351. */
  352. #define PIPE_CONTEXT_PREFER_THREADED (1 << 3)
  353. /**
  354. * Implicit and explicit derivatives after KILL behave as if KILL didn't
  355. * happen.
  356. */
  357. #define PIPE_SCREEN_ENABLE_CORRECT_TGSI_DERIVATIVES_AFTER_KILL (1 << 0)
  358. /**
  359. * Flags for pipe_context::memory_barrier.
  360. */
  361. #define PIPE_BARRIER_MAPPED_BUFFER (1 << 0)
  362. #define PIPE_BARRIER_SHADER_BUFFER (1 << 1)
  363. #define PIPE_BARRIER_QUERY_BUFFER (1 << 2)
  364. #define PIPE_BARRIER_VERTEX_BUFFER (1 << 3)
  365. #define PIPE_BARRIER_INDEX_BUFFER (1 << 4)
  366. #define PIPE_BARRIER_CONSTANT_BUFFER (1 << 5)
  367. #define PIPE_BARRIER_INDIRECT_BUFFER (1 << 6)
  368. #define PIPE_BARRIER_TEXTURE (1 << 7)
  369. #define PIPE_BARRIER_IMAGE (1 << 8)
  370. #define PIPE_BARRIER_FRAMEBUFFER (1 << 9)
  371. #define PIPE_BARRIER_STREAMOUT_BUFFER (1 << 10)
  372. #define PIPE_BARRIER_GLOBAL_BUFFER (1 << 11)
  373. #define PIPE_BARRIER_ALL ((1 << 12) - 1)
  374. /**
  375. * Flags for pipe_context::texture_barrier.
  376. */
  377. #define PIPE_TEXTURE_BARRIER_SAMPLER (1 << 0)
  378. #define PIPE_TEXTURE_BARRIER_FRAMEBUFFER (1 << 1)
  379. /**
  380. * Resource binding flags -- state tracker must specify in advance all
  381. * the ways a resource might be used.
  382. */
  383. #define PIPE_BIND_DEPTH_STENCIL (1 << 0) /* create_surface */
  384. #define PIPE_BIND_RENDER_TARGET (1 << 1) /* create_surface */
  385. #define PIPE_BIND_BLENDABLE (1 << 2) /* create_surface */
  386. #define PIPE_BIND_SAMPLER_VIEW (1 << 3) /* create_sampler_view */
  387. #define PIPE_BIND_VERTEX_BUFFER (1 << 4) /* set_vertex_buffers */
  388. #define PIPE_BIND_INDEX_BUFFER (1 << 5) /* draw_elements */
  389. #define PIPE_BIND_CONSTANT_BUFFER (1 << 6) /* set_constant_buffer */
  390. #define PIPE_BIND_DISPLAY_TARGET (1 << 7) /* flush_front_buffer */
  391. /* gap */
  392. #define PIPE_BIND_STREAM_OUTPUT (1 << 10) /* set_stream_output_buffers */
  393. #define PIPE_BIND_CURSOR (1 << 11) /* mouse cursor */
  394. #define PIPE_BIND_CUSTOM (1 << 12) /* state-tracker/winsys usages */
  395. #define PIPE_BIND_GLOBAL (1 << 13) /* set_global_binding */
  396. #define PIPE_BIND_SHADER_BUFFER (1 << 14) /* set_shader_buffers */
  397. #define PIPE_BIND_SHADER_IMAGE (1 << 15) /* set_shader_images */
  398. #define PIPE_BIND_COMPUTE_RESOURCE (1 << 16) /* set_compute_resources */
  399. #define PIPE_BIND_COMMAND_ARGS_BUFFER (1 << 17) /* pipe_draw_info.indirect */
  400. #define PIPE_BIND_QUERY_BUFFER (1 << 18) /* get_query_result_resource */
  401. /**
  402. * The first two flags above were previously part of the amorphous
  403. * TEXTURE_USAGE, most of which are now descriptions of the ways a
  404. * particular texture can be bound to the gallium pipeline. The two flags
  405. * below do not fit within that and probably need to be migrated to some
  406. * other place.
  407. *
  408. * It seems like scanout is used by the Xorg state tracker to ask for
  409. * a texture suitable for actual scanout (hence the name), which
  410. * implies extra layout constraints on some hardware. It may also
  411. * have some special meaning regarding mouse cursor images.
  412. *
  413. * The shared flag is quite underspecified, but certainly isn't a
  414. * binding flag - it seems more like a message to the winsys to create
  415. * a shareable allocation.
  416. *
  417. * The third flag has been added to be able to force textures to be created
  418. * in linear mode (no tiling).
  419. */
  420. #define PIPE_BIND_SCANOUT (1 << 19) /* */
  421. #define PIPE_BIND_SHARED (1 << 20) /* get_texture_handle ??? */
  422. #define PIPE_BIND_LINEAR (1 << 21)
  423. /**
  424. * Flags for the driver about resource behaviour:
  425. */
  426. #define PIPE_RESOURCE_FLAG_MAP_PERSISTENT (1 << 0)
  427. #define PIPE_RESOURCE_FLAG_MAP_COHERENT (1 << 1)
  428. #define PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY (1 << 2)
  429. #define PIPE_RESOURCE_FLAG_SPARSE (1 << 3)
  430. #define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 16) /* driver/winsys private */
  431. #define PIPE_RESOURCE_FLAG_ST_PRIV (1 << 24) /* state-tracker/winsys private */
  432. /**
  433. * Hint about the expected lifecycle of a resource.
  434. * Sorted according to GPU vs CPU access.
  435. */
  436. enum pipe_resource_usage {
  437. PIPE_USAGE_DEFAULT, /* fast GPU access */
  438. PIPE_USAGE_IMMUTABLE, /* fast GPU access, immutable */
  439. PIPE_USAGE_DYNAMIC, /* uploaded data is used multiple times */
  440. PIPE_USAGE_STREAM, /* uploaded data is used once */
  441. PIPE_USAGE_STAGING, /* fast CPU access */
  442. };
  443. /**
  444. * Shaders
  445. */
  446. enum pipe_shader_type {
  447. PIPE_SHADER_VERTEX,
  448. PIPE_SHADER_FRAGMENT,
  449. PIPE_SHADER_GEOMETRY,
  450. PIPE_SHADER_TESS_CTRL,
  451. PIPE_SHADER_TESS_EVAL,
  452. PIPE_SHADER_COMPUTE,
  453. PIPE_SHADER_TYPES,
  454. };
  455. /**
  456. * Primitive types:
  457. */
  458. enum pipe_prim_type {
  459. PIPE_PRIM_POINTS,
  460. PIPE_PRIM_LINES,
  461. PIPE_PRIM_LINE_LOOP,
  462. PIPE_PRIM_LINE_STRIP,
  463. PIPE_PRIM_TRIANGLES,
  464. PIPE_PRIM_TRIANGLE_STRIP,
  465. PIPE_PRIM_TRIANGLE_FAN,
  466. PIPE_PRIM_QUADS,
  467. PIPE_PRIM_QUAD_STRIP,
  468. PIPE_PRIM_POLYGON,
  469. PIPE_PRIM_LINES_ADJACENCY,
  470. PIPE_PRIM_LINE_STRIP_ADJACENCY,
  471. PIPE_PRIM_TRIANGLES_ADJACENCY,
  472. PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY,
  473. PIPE_PRIM_PATCHES,
  474. PIPE_PRIM_MAX,
  475. };
  476. /**
  477. * Tessellator spacing types
  478. */
  479. enum pipe_tess_spacing {
  480. PIPE_TESS_SPACING_FRACTIONAL_ODD,
  481. PIPE_TESS_SPACING_FRACTIONAL_EVEN,
  482. PIPE_TESS_SPACING_EQUAL,
  483. };
  484. /**
  485. * Query object types
  486. */
  487. enum pipe_query_type {
  488. PIPE_QUERY_OCCLUSION_COUNTER,
  489. PIPE_QUERY_OCCLUSION_PREDICATE,
  490. PIPE_QUERY_TIMESTAMP,
  491. PIPE_QUERY_TIMESTAMP_DISJOINT,
  492. PIPE_QUERY_TIME_ELAPSED,
  493. PIPE_QUERY_PRIMITIVES_GENERATED,
  494. PIPE_QUERY_PRIMITIVES_EMITTED,
  495. PIPE_QUERY_SO_STATISTICS,
  496. PIPE_QUERY_SO_OVERFLOW_PREDICATE,
  497. PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE,
  498. PIPE_QUERY_GPU_FINISHED,
  499. PIPE_QUERY_PIPELINE_STATISTICS,
  500. PIPE_QUERY_TYPES,
  501. /* start of driver queries, see pipe_screen::get_driver_query_info */
  502. PIPE_QUERY_DRIVER_SPECIFIC = 256,
  503. };
  504. /**
  505. * Conditional rendering modes
  506. */
  507. enum pipe_render_cond_flag {
  508. PIPE_RENDER_COND_WAIT,
  509. PIPE_RENDER_COND_NO_WAIT,
  510. PIPE_RENDER_COND_BY_REGION_WAIT,
  511. PIPE_RENDER_COND_BY_REGION_NO_WAIT,
  512. };
  513. /**
  514. * Point sprite coord modes
  515. */
  516. enum pipe_sprite_coord_mode {
  517. PIPE_SPRITE_COORD_UPPER_LEFT,
  518. PIPE_SPRITE_COORD_LOWER_LEFT,
  519. };
  520. /**
  521. * Texture & format swizzles
  522. */
  523. enum pipe_swizzle {
  524. PIPE_SWIZZLE_X,
  525. PIPE_SWIZZLE_Y,
  526. PIPE_SWIZZLE_Z,
  527. PIPE_SWIZZLE_W,
  528. PIPE_SWIZZLE_0,
  529. PIPE_SWIZZLE_1,
  530. PIPE_SWIZZLE_NONE,
  531. PIPE_SWIZZLE_MAX, /**< Number of enums counter (must be last) */
  532. };
  533. #define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull
  534. /**
  535. * Device reset status.
  536. */
  537. enum pipe_reset_status
  538. {
  539. PIPE_NO_RESET,
  540. PIPE_GUILTY_CONTEXT_RESET,
  541. PIPE_INNOCENT_CONTEXT_RESET,
  542. PIPE_UNKNOWN_CONTEXT_RESET,
  543. };
  544. /**
  545. * resource_get_handle flags.
  546. */
  547. /* Requires pipe_context::flush_resource before external use. */
  548. #define PIPE_HANDLE_USAGE_EXPLICIT_FLUSH (1 << 0)
  549. /* Expected external use of the resource: */
  550. #define PIPE_HANDLE_USAGE_READ (1 << 1)
  551. #define PIPE_HANDLE_USAGE_WRITE (1 << 2)
  552. #define PIPE_HANDLE_USAGE_READ_WRITE (PIPE_HANDLE_USAGE_READ | \
  553. PIPE_HANDLE_USAGE_WRITE)
  554. /**
  555. * pipe_image_view access flags.
  556. */
  557. #define PIPE_IMAGE_ACCESS_READ (1 << 0)
  558. #define PIPE_IMAGE_ACCESS_WRITE (1 << 1)
  559. #define PIPE_IMAGE_ACCESS_READ_WRITE (PIPE_IMAGE_ACCESS_READ | \
  560. PIPE_IMAGE_ACCESS_WRITE)
  561. /**
  562. * Implementation capabilities/limits which are queried through
  563. * pipe_screen::get_param()
  564. */
  565. enum pipe_cap
  566. {
  567. PIPE_CAP_NPOT_TEXTURES,
  568. PIPE_CAP_TWO_SIDED_STENCIL,
  569. PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS,
  570. PIPE_CAP_ANISOTROPIC_FILTER,
  571. PIPE_CAP_POINT_SPRITE,
  572. PIPE_CAP_MAX_RENDER_TARGETS,
  573. PIPE_CAP_OCCLUSION_QUERY,
  574. PIPE_CAP_QUERY_TIME_ELAPSED,
  575. PIPE_CAP_TEXTURE_SHADOW_MAP,
  576. PIPE_CAP_TEXTURE_SWIZZLE,
  577. PIPE_CAP_MAX_TEXTURE_2D_LEVELS,
  578. PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
  579. PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS,
  580. PIPE_CAP_TEXTURE_MIRROR_CLAMP,
  581. PIPE_CAP_BLEND_EQUATION_SEPARATE,
  582. PIPE_CAP_SM3,
  583. PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS,
  584. PIPE_CAP_PRIMITIVE_RESTART,
  585. /** blend enables and write masks per rendertarget */
  586. PIPE_CAP_INDEP_BLEND_ENABLE,
  587. /** different blend funcs per rendertarget */
  588. PIPE_CAP_INDEP_BLEND_FUNC,
  589. PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS,
  590. PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT,
  591. PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
  592. PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
  593. PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
  594. PIPE_CAP_DEPTH_CLIP_DISABLE,
  595. PIPE_CAP_SHADER_STENCIL_EXPORT,
  596. PIPE_CAP_TGSI_INSTANCEID,
  597. PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR,
  598. PIPE_CAP_FRAGMENT_COLOR_CLAMPED,
  599. PIPE_CAP_MIXED_COLORBUFFER_FORMATS,
  600. PIPE_CAP_SEAMLESS_CUBE_MAP,
  601. PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE,
  602. PIPE_CAP_MIN_TEXEL_OFFSET,
  603. PIPE_CAP_MAX_TEXEL_OFFSET,
  604. PIPE_CAP_CONDITIONAL_RENDER,
  605. PIPE_CAP_TEXTURE_BARRIER,
  606. PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS,
  607. PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS,
  608. PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME,
  609. PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS,
  610. PIPE_CAP_VERTEX_COLOR_UNCLAMPED,
  611. PIPE_CAP_VERTEX_COLOR_CLAMPED,
  612. PIPE_CAP_GLSL_FEATURE_LEVEL,
  613. PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION,
  614. PIPE_CAP_USER_VERTEX_BUFFERS,
  615. PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY,
  616. PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY,
  617. PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY,
  618. PIPE_CAP_COMPUTE,
  619. PIPE_CAP_USER_CONSTANT_BUFFERS,
  620. PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT,
  621. PIPE_CAP_START_INSTANCE,
  622. PIPE_CAP_QUERY_TIMESTAMP,
  623. PIPE_CAP_TEXTURE_MULTISAMPLE,
  624. PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT,
  625. PIPE_CAP_CUBE_MAP_ARRAY,
  626. PIPE_CAP_TEXTURE_BUFFER_OBJECTS,
  627. PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT,
  628. PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY,
  629. PIPE_CAP_TGSI_TEXCOORD,
  630. PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER,
  631. PIPE_CAP_QUERY_PIPELINE_STATISTICS,
  632. PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK,
  633. PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE,
  634. PIPE_CAP_MAX_VIEWPORTS,
  635. PIPE_CAP_ENDIANNESS,
  636. PIPE_CAP_MIXED_FRAMEBUFFER_SIZES,
  637. PIPE_CAP_TGSI_VS_LAYER_VIEWPORT,
  638. PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES,
  639. PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS,
  640. PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS,
  641. PIPE_CAP_TEXTURE_GATHER_SM5,
  642. PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT,
  643. PIPE_CAP_FAKE_SW_MSAA,
  644. PIPE_CAP_TEXTURE_QUERY_LOD,
  645. PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET,
  646. PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET,
  647. PIPE_CAP_SAMPLE_SHADING,
  648. PIPE_CAP_TEXTURE_GATHER_OFFSETS,
  649. PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION,
  650. PIPE_CAP_MAX_VERTEX_STREAMS,
  651. PIPE_CAP_DRAW_INDIRECT,
  652. PIPE_CAP_TGSI_FS_FINE_DERIVATIVE,
  653. PIPE_CAP_VENDOR_ID,
  654. PIPE_CAP_DEVICE_ID,
  655. PIPE_CAP_ACCELERATED,
  656. PIPE_CAP_VIDEO_MEMORY,
  657. PIPE_CAP_UMA,
  658. PIPE_CAP_CONDITIONAL_RENDER_INVERTED,
  659. PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE,
  660. PIPE_CAP_SAMPLER_VIEW_TARGET,
  661. PIPE_CAP_CLIP_HALFZ,
  662. PIPE_CAP_VERTEXID_NOBASE,
  663. PIPE_CAP_POLYGON_OFFSET_CLAMP,
  664. PIPE_CAP_MULTISAMPLE_Z_RESOLVE,
  665. PIPE_CAP_RESOURCE_FROM_USER_MEMORY,
  666. PIPE_CAP_DEVICE_RESET_STATUS_QUERY,
  667. PIPE_CAP_MAX_SHADER_PATCH_VARYINGS,
  668. PIPE_CAP_TEXTURE_FLOAT_LINEAR,
  669. PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR,
  670. PIPE_CAP_DEPTH_BOUNDS_TEST,
  671. PIPE_CAP_TGSI_TXQS,
  672. PIPE_CAP_FORCE_PERSAMPLE_INTERP,
  673. PIPE_CAP_SHAREABLE_SHADERS,
  674. PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS,
  675. PIPE_CAP_CLEAR_TEXTURE,
  676. PIPE_CAP_DRAW_PARAMETERS,
  677. PIPE_CAP_TGSI_PACK_HALF_FLOAT,
  678. PIPE_CAP_MULTI_DRAW_INDIRECT,
  679. PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS,
  680. PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL,
  681. PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL,
  682. PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT,
  683. PIPE_CAP_INVALIDATE_BUFFER,
  684. PIPE_CAP_GENERATE_MIPMAP,
  685. PIPE_CAP_STRING_MARKER,
  686. PIPE_CAP_SURFACE_REINTERPRET_BLOCKS,
  687. PIPE_CAP_QUERY_BUFFER_OBJECT,
  688. PIPE_CAP_QUERY_MEMORY_INFO,
  689. PIPE_CAP_PCI_GROUP,
  690. PIPE_CAP_PCI_BUS,
  691. PIPE_CAP_PCI_DEVICE,
  692. PIPE_CAP_PCI_FUNCTION,
  693. PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT,
  694. PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR,
  695. PIPE_CAP_CULL_DISTANCE,
  696. PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES,
  697. PIPE_CAP_TGSI_VOTE,
  698. PIPE_CAP_MAX_WINDOW_RECTANGLES,
  699. PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED,
  700. PIPE_CAP_VIEWPORT_SUBPIXEL_BITS,
  701. PIPE_CAP_MIXED_COLOR_DEPTH_BITS,
  702. PIPE_CAP_TGSI_ARRAY_COMPONENTS,
  703. PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
  704. PIPE_CAP_TGSI_CAN_READ_OUTPUTS,
  705. PIPE_CAP_NATIVE_FENCE_FD,
  706. PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY,
  707. PIPE_CAP_TGSI_FS_FBFETCH,
  708. PIPE_CAP_TGSI_MUL_ZERO_WINS,
  709. PIPE_CAP_DOUBLES,
  710. PIPE_CAP_INT64,
  711. PIPE_CAP_INT64_DIVMOD,
  712. PIPE_CAP_TGSI_TEX_TXF_LZ,
  713. PIPE_CAP_TGSI_CLOCK,
  714. PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE,
  715. PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE,
  716. PIPE_CAP_TGSI_BALLOT,
  717. PIPE_CAP_TGSI_TES_LAYER_VIEWPORT,
  718. PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX,
  719. PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION,
  720. PIPE_CAP_POST_DEPTH_COVERAGE,
  721. PIPE_CAP_BINDLESS_TEXTURE,
  722. PIPE_CAP_NIR_SAMPLERS_AS_DEREF,
  723. PIPE_CAP_QUERY_SO_OVERFLOW,
  724. };
  725. #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
  726. #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600 (1 << 1)
  727. enum pipe_endian
  728. {
  729. PIPE_ENDIAN_LITTLE = 0,
  730. PIPE_ENDIAN_BIG = 1,
  731. #if defined(PIPE_ARCH_LITTLE_ENDIAN)
  732. PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
  733. #elif defined(PIPE_ARCH_BIG_ENDIAN)
  734. PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
  735. #endif
  736. };
  737. /**
  738. * Implementation limits which are queried through
  739. * pipe_screen::get_paramf()
  740. */
  741. enum pipe_capf
  742. {
  743. PIPE_CAPF_MAX_LINE_WIDTH,
  744. PIPE_CAPF_MAX_LINE_WIDTH_AA,
  745. PIPE_CAPF_MAX_POINT_WIDTH,
  746. PIPE_CAPF_MAX_POINT_WIDTH_AA,
  747. PIPE_CAPF_MAX_TEXTURE_ANISOTROPY,
  748. PIPE_CAPF_MAX_TEXTURE_LOD_BIAS,
  749. PIPE_CAPF_GUARD_BAND_LEFT,
  750. PIPE_CAPF_GUARD_BAND_TOP,
  751. PIPE_CAPF_GUARD_BAND_RIGHT,
  752. PIPE_CAPF_GUARD_BAND_BOTTOM
  753. };
  754. /** Shader caps not specific to any single stage */
  755. enum pipe_shader_cap
  756. {
  757. PIPE_SHADER_CAP_MAX_INSTRUCTIONS, /* if 0, it means the stage is unsupported */
  758. PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS,
  759. PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS,
  760. PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS,
  761. PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH,
  762. PIPE_SHADER_CAP_MAX_INPUTS,
  763. PIPE_SHADER_CAP_MAX_OUTPUTS,
  764. PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE,
  765. PIPE_SHADER_CAP_MAX_CONST_BUFFERS,
  766. PIPE_SHADER_CAP_MAX_TEMPS,
  767. /* boolean caps */
  768. PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED,
  769. PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR,
  770. PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR,
  771. PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR,
  772. PIPE_SHADER_CAP_INDIRECT_CONST_ADDR,
  773. PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */
  774. PIPE_SHADER_CAP_INTEGERS,
  775. PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS,
  776. PIPE_SHADER_CAP_PREFERRED_IR,
  777. PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED,
  778. PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS,
  779. PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED, /* all rounding modes */
  780. PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED,
  781. PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED,
  782. PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE,
  783. PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT,
  784. PIPE_SHADER_CAP_MAX_SHADER_BUFFERS,
  785. PIPE_SHADER_CAP_SUPPORTED_IRS,
  786. PIPE_SHADER_CAP_MAX_SHADER_IMAGES,
  787. PIPE_SHADER_CAP_LOWER_IF_THRESHOLD,
  788. PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS,
  789. };
  790. /**
  791. * Shader intermediate representation.
  792. *
  793. * Note that if the driver requests something other than TGSI, it must
  794. * always be prepared to receive TGSI in addition to its preferred IR.
  795. * If the driver requests TGSI as its preferred IR, it will *always*
  796. * get TGSI.
  797. *
  798. * Note that PIPE_SHADER_IR_TGSI should be zero for backwards compat with
  799. * state trackers that only understand TGSI.
  800. */
  801. enum pipe_shader_ir
  802. {
  803. PIPE_SHADER_IR_TGSI = 0,
  804. PIPE_SHADER_IR_LLVM,
  805. PIPE_SHADER_IR_NATIVE,
  806. PIPE_SHADER_IR_NIR,
  807. };
  808. /**
  809. * Compute-specific implementation capability. They can be queried
  810. * using pipe_screen::get_compute_param.
  811. */
  812. enum pipe_compute_cap
  813. {
  814. PIPE_COMPUTE_CAP_ADDRESS_BITS,
  815. PIPE_COMPUTE_CAP_IR_TARGET,
  816. PIPE_COMPUTE_CAP_GRID_DIMENSION,
  817. PIPE_COMPUTE_CAP_MAX_GRID_SIZE,
  818. PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE,
  819. PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK,
  820. PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE,
  821. PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE,
  822. PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE,
  823. PIPE_COMPUTE_CAP_MAX_INPUT_SIZE,
  824. PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE,
  825. PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY,
  826. PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS,
  827. PIPE_COMPUTE_CAP_IMAGES_SUPPORTED,
  828. PIPE_COMPUTE_CAP_SUBGROUP_SIZE,
  829. PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK,
  830. };
  831. /**
  832. * Composite query types
  833. */
  834. /**
  835. * Query result for PIPE_QUERY_SO_STATISTICS.
  836. */
  837. struct pipe_query_data_so_statistics
  838. {
  839. uint64_t num_primitives_written;
  840. uint64_t primitives_storage_needed;
  841. };
  842. /**
  843. * Query result for PIPE_QUERY_TIMESTAMP_DISJOINT.
  844. */
  845. struct pipe_query_data_timestamp_disjoint
  846. {
  847. uint64_t frequency;
  848. boolean disjoint;
  849. };
  850. /**
  851. * Query result for PIPE_QUERY_PIPELINE_STATISTICS.
  852. */
  853. struct pipe_query_data_pipeline_statistics
  854. {
  855. uint64_t ia_vertices; /**< Num vertices read by the vertex fetcher. */
  856. uint64_t ia_primitives; /**< Num primitives read by the vertex fetcher. */
  857. uint64_t vs_invocations; /**< Num vertex shader invocations. */
  858. uint64_t gs_invocations; /**< Num geometry shader invocations. */
  859. uint64_t gs_primitives; /**< Num primitives output by a geometry shader. */
  860. uint64_t c_invocations; /**< Num primitives sent to the rasterizer. */
  861. uint64_t c_primitives; /**< Num primitives that were rendered. */
  862. uint64_t ps_invocations; /**< Num pixel shader invocations. */
  863. uint64_t hs_invocations; /**< Num hull shader invocations. */
  864. uint64_t ds_invocations; /**< Num domain shader invocations. */
  865. uint64_t cs_invocations; /**< Num compute shader invocations. */
  866. };
  867. /**
  868. * For batch queries.
  869. */
  870. union pipe_numeric_type_union
  871. {
  872. uint64_t u64;
  873. uint32_t u32;
  874. float f;
  875. };
  876. /**
  877. * Query result (returned by pipe_context::get_query_result).
  878. */
  879. union pipe_query_result
  880. {
  881. /* PIPE_QUERY_OCCLUSION_PREDICATE */
  882. /* PIPE_QUERY_SO_OVERFLOW_PREDICATE */
  883. /* PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE */
  884. /* PIPE_QUERY_GPU_FINISHED */
  885. boolean b;
  886. /* PIPE_QUERY_OCCLUSION_COUNTER */
  887. /* PIPE_QUERY_TIMESTAMP */
  888. /* PIPE_QUERY_TIME_ELAPSED */
  889. /* PIPE_QUERY_PRIMITIVES_GENERATED */
  890. /* PIPE_QUERY_PRIMITIVES_EMITTED */
  891. /* PIPE_DRIVER_QUERY_TYPE_UINT64 */
  892. /* PIPE_DRIVER_QUERY_TYPE_BYTES */
  893. /* PIPE_DRIVER_QUERY_TYPE_MICROSECONDS */
  894. /* PIPE_DRIVER_QUERY_TYPE_HZ */
  895. uint64_t u64;
  896. /* PIPE_DRIVER_QUERY_TYPE_UINT */
  897. uint32_t u32;
  898. /* PIPE_DRIVER_QUERY_TYPE_FLOAT */
  899. /* PIPE_DRIVER_QUERY_TYPE_PERCENTAGE */
  900. float f;
  901. /* PIPE_QUERY_SO_STATISTICS */
  902. struct pipe_query_data_so_statistics so_statistics;
  903. /* PIPE_QUERY_TIMESTAMP_DISJOINT */
  904. struct pipe_query_data_timestamp_disjoint timestamp_disjoint;
  905. /* PIPE_QUERY_PIPELINE_STATISTICS */
  906. struct pipe_query_data_pipeline_statistics pipeline_statistics;
  907. /* batch queries (variable length) */
  908. union pipe_numeric_type_union batch[1];
  909. };
  910. enum pipe_query_value_type
  911. {
  912. PIPE_QUERY_TYPE_I32,
  913. PIPE_QUERY_TYPE_U32,
  914. PIPE_QUERY_TYPE_I64,
  915. PIPE_QUERY_TYPE_U64,
  916. };
  917. union pipe_color_union
  918. {
  919. float f[4];
  920. int i[4];
  921. unsigned int ui[4];
  922. };
  923. enum pipe_driver_query_type
  924. {
  925. PIPE_DRIVER_QUERY_TYPE_UINT64,
  926. PIPE_DRIVER_QUERY_TYPE_UINT,
  927. PIPE_DRIVER_QUERY_TYPE_FLOAT,
  928. PIPE_DRIVER_QUERY_TYPE_PERCENTAGE,
  929. PIPE_DRIVER_QUERY_TYPE_BYTES,
  930. PIPE_DRIVER_QUERY_TYPE_MICROSECONDS,
  931. PIPE_DRIVER_QUERY_TYPE_HZ,
  932. PIPE_DRIVER_QUERY_TYPE_DBM,
  933. PIPE_DRIVER_QUERY_TYPE_TEMPERATURE,
  934. PIPE_DRIVER_QUERY_TYPE_VOLTS,
  935. PIPE_DRIVER_QUERY_TYPE_AMPS,
  936. PIPE_DRIVER_QUERY_TYPE_WATTS,
  937. };
  938. /* Whether an average value per frame or a cumulative value should be
  939. * displayed.
  940. */
  941. enum pipe_driver_query_result_type
  942. {
  943. PIPE_DRIVER_QUERY_RESULT_TYPE_AVERAGE,
  944. PIPE_DRIVER_QUERY_RESULT_TYPE_CUMULATIVE,
  945. };
  946. /**
  947. * Some hardware requires some hardware-specific queries to be submitted
  948. * as batched queries. The corresponding query objects are created using
  949. * create_batch_query, and at most one such query may be active at
  950. * any time.
  951. */
  952. #define PIPE_DRIVER_QUERY_FLAG_BATCH (1 << 0)
  953. /* Do not list this query in the HUD. */
  954. #define PIPE_DRIVER_QUERY_FLAG_DONT_LIST (1 << 1)
  955. struct pipe_driver_query_info
  956. {
  957. const char *name;
  958. unsigned query_type; /* PIPE_QUERY_DRIVER_SPECIFIC + i */
  959. union pipe_numeric_type_union max_value; /* max value that can be returned */
  960. enum pipe_driver_query_type type;
  961. enum pipe_driver_query_result_type result_type;
  962. unsigned group_id;
  963. unsigned flags;
  964. };
  965. struct pipe_driver_query_group_info
  966. {
  967. const char *name;
  968. unsigned max_active_queries;
  969. unsigned num_queries;
  970. };
  971. enum pipe_debug_type
  972. {
  973. PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1,
  974. PIPE_DEBUG_TYPE_ERROR,
  975. PIPE_DEBUG_TYPE_SHADER_INFO,
  976. PIPE_DEBUG_TYPE_PERF_INFO,
  977. PIPE_DEBUG_TYPE_INFO,
  978. PIPE_DEBUG_TYPE_FALLBACK,
  979. PIPE_DEBUG_TYPE_CONFORMANCE,
  980. };
  981. #ifdef __cplusplus
  982. }
  983. #endif
  984. #endif