p_defines.h 38.7 KB
Newer Older
1 2
/**************************************************************************
 * 
Jose Fonseca's avatar
Jose Fonseca committed
3
 * Copyright 2007 VMware, Inc.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * All Rights Reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
Jose Fonseca's avatar
Jose Fonseca committed
21
 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 23 24 25 26 27
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 **************************************************************************/

Keith Whitwell's avatar
Keith Whitwell committed
28 29
#ifndef PIPE_DEFINES_H
#define PIPE_DEFINES_H
30

31
#include "p_compiler.h"
32

33 34 35 36
#ifdef __cplusplus
extern "C" {
#endif

37 38 39 40 41 42 43
/**
 * Gallium error codes.
 *
 * - A zero value always means success.
 * - A negative value always means failure.
 * - The meaning of a positive value is function dependent.
 */
44 45
enum pipe_error
{
46 47 48 49 50 51 52 53
   PIPE_OK = 0,
   PIPE_ERROR = -1,    /**< Generic error */
   PIPE_ERROR_BAD_INPUT = -2,
   PIPE_ERROR_OUT_OF_MEMORY = -3,
   PIPE_ERROR_RETRY = -4
   /* TODO */
};

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
enum pipe_blendfactor {
   PIPE_BLENDFACTOR_ONE = 1,
   PIPE_BLENDFACTOR_SRC_COLOR,
   PIPE_BLENDFACTOR_SRC_ALPHA,
   PIPE_BLENDFACTOR_DST_ALPHA,
   PIPE_BLENDFACTOR_DST_COLOR,
   PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE,
   PIPE_BLENDFACTOR_CONST_COLOR,
   PIPE_BLENDFACTOR_CONST_ALPHA,
   PIPE_BLENDFACTOR_SRC1_COLOR,
   PIPE_BLENDFACTOR_SRC1_ALPHA,

   PIPE_BLENDFACTOR_ZERO = 0x11,
   PIPE_BLENDFACTOR_INV_SRC_COLOR,
   PIPE_BLENDFACTOR_INV_SRC_ALPHA,
   PIPE_BLENDFACTOR_INV_DST_ALPHA,
   PIPE_BLENDFACTOR_INV_DST_COLOR,

   PIPE_BLENDFACTOR_INV_CONST_COLOR = 0x17,
   PIPE_BLENDFACTOR_INV_CONST_ALPHA,
   PIPE_BLENDFACTOR_INV_SRC1_COLOR,
   PIPE_BLENDFACTOR_INV_SRC1_ALPHA,
};

enum pipe_blend_func {
   PIPE_BLEND_ADD,
   PIPE_BLEND_SUBTRACT,
   PIPE_BLEND_REVERSE_SUBTRACT,
   PIPE_BLEND_MIN,
   PIPE_BLEND_MAX,
};
85

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
enum pipe_logicop {
   PIPE_LOGICOP_CLEAR,
   PIPE_LOGICOP_NOR,
   PIPE_LOGICOP_AND_INVERTED,
   PIPE_LOGICOP_COPY_INVERTED,
   PIPE_LOGICOP_AND_REVERSE,
   PIPE_LOGICOP_INVERT,
   PIPE_LOGICOP_XOR,
   PIPE_LOGICOP_NAND,
   PIPE_LOGICOP_AND,
   PIPE_LOGICOP_EQUIV,
   PIPE_LOGICOP_NOOP,
   PIPE_LOGICOP_OR_INVERTED,
   PIPE_LOGICOP_COPY,
   PIPE_LOGICOP_OR_REVERSE,
   PIPE_LOGICOP_OR,
   PIPE_LOGICOP_SET,
};
104

105 106 107 108
#define PIPE_MASK_R  0x1
#define PIPE_MASK_G  0x2
#define PIPE_MASK_B  0x4
#define PIPE_MASK_A  0x8
Brian's avatar
Brian committed
109
#define PIPE_MASK_RGBA 0xf
110 111 112
#define PIPE_MASK_Z  0x10
#define PIPE_MASK_S  0x20
#define PIPE_MASK_ZS 0x30
113
#define PIPE_MASK_RGBAZS (PIPE_MASK_RGBA|PIPE_MASK_ZS)
Brian's avatar
Brian committed
114

115

116 117 118 119
/**
 * Inequality functions.  Used for depth test, stencil compare, alpha
 * test, shadow compare, etc.
 */
120 121 122 123 124 125 126 127 128 129
enum pipe_compare_func {
   PIPE_FUNC_NEVER,
   PIPE_FUNC_LESS,
   PIPE_FUNC_EQUAL,
   PIPE_FUNC_LEQUAL,
   PIPE_FUNC_GREATER,
   PIPE_FUNC_NOTEQUAL,
   PIPE_FUNC_GEQUAL,
   PIPE_FUNC_ALWAYS,
};
Brian's avatar
Brian committed
130

Brian's avatar
Brian committed
131
/** Polygon fill mode */
132 133 134 135
enum {
   PIPE_POLYGON_MODE_FILL,
   PIPE_POLYGON_MODE_LINE,
   PIPE_POLYGON_MODE_POINT,
136
   PIPE_POLYGON_MODE_FILL_RECTANGLE,
137
};
Brian's avatar
Brian committed
138

139 140 141 142 143
/** Polygon face specification, eg for culling */
#define PIPE_FACE_NONE           0
#define PIPE_FACE_FRONT          1
#define PIPE_FACE_BACK           2
#define PIPE_FACE_FRONT_AND_BACK (PIPE_FACE_FRONT | PIPE_FACE_BACK)
Brian's avatar
Brian committed
144

145
/** Stencil ops */
146 147 148 149 150 151 152 153 154 155
enum pipe_stencil_op {
   PIPE_STENCIL_OP_KEEP,
   PIPE_STENCIL_OP_ZERO,
   PIPE_STENCIL_OP_REPLACE,
   PIPE_STENCIL_OP_INCR,
   PIPE_STENCIL_OP_DECR,
   PIPE_STENCIL_OP_INCR_WRAP,
   PIPE_STENCIL_OP_DECR_WRAP,
   PIPE_STENCIL_OP_INVERT,
};
Brian's avatar
Brian committed
156

157
/** Texture types.
158 159 160 161
 * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D
 */
enum pipe_texture_target
{
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
   PIPE_BUFFER,
   PIPE_TEXTURE_1D,
   PIPE_TEXTURE_2D,
   PIPE_TEXTURE_3D,
   PIPE_TEXTURE_CUBE,
   PIPE_TEXTURE_RECT,
   PIPE_TEXTURE_1D_ARRAY,
   PIPE_TEXTURE_2D_ARRAY,
   PIPE_TEXTURE_CUBE_ARRAY,
   PIPE_MAX_TEXTURE_TYPES,
};

enum pipe_tex_face {
   PIPE_TEX_FACE_POS_X,
   PIPE_TEX_FACE_NEG_X,
   PIPE_TEX_FACE_POS_Y,
   PIPE_TEX_FACE_NEG_Y,
   PIPE_TEX_FACE_POS_Z,
   PIPE_TEX_FACE_NEG_Z,
   PIPE_TEX_FACE_MAX,
};

enum pipe_tex_wrap {
   PIPE_TEX_WRAP_REPEAT,
   PIPE_TEX_WRAP_CLAMP,
   PIPE_TEX_WRAP_CLAMP_TO_EDGE,
   PIPE_TEX_WRAP_CLAMP_TO_BORDER,
   PIPE_TEX_WRAP_MIRROR_REPEAT,
   PIPE_TEX_WRAP_MIRROR_CLAMP,
   PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE,
   PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER,
};
Brian's avatar
Brian committed
194

195
/** Between mipmaps, ie mipfilter */
196 197 198 199 200
enum pipe_tex_mipfilter {
   PIPE_TEX_MIPFILTER_NEAREST,
   PIPE_TEX_MIPFILTER_LINEAR,
   PIPE_TEX_MIPFILTER_NONE,
};
201

202
/** Within a mipmap, ie min/mag filter */
203 204 205 206
enum pipe_tex_filter {
   PIPE_TEX_FILTER_NEAREST,
   PIPE_TEX_FILTER_LINEAR,
};
Brian's avatar
Brian committed
207

208 209 210 211
enum pipe_tex_compare {
   PIPE_TEX_COMPARE_NONE,
   PIPE_TEX_COMPARE_R_TO_TEXTURE,
};
Brian's avatar
Brian committed
212

213 214 215
/**
 * Clear buffer bits
 */
216 217 218 219 220 221 222 223 224 225 226
#define PIPE_CLEAR_DEPTH        (1 << 0)
#define PIPE_CLEAR_STENCIL      (1 << 1)
#define PIPE_CLEAR_COLOR0       (1 << 2)
#define PIPE_CLEAR_COLOR1       (1 << 3)
#define PIPE_CLEAR_COLOR2       (1 << 4)
#define PIPE_CLEAR_COLOR3       (1 << 5)
#define PIPE_CLEAR_COLOR4       (1 << 6)
#define PIPE_CLEAR_COLOR5       (1 << 7)
#define PIPE_CLEAR_COLOR6       (1 << 8)
#define PIPE_CLEAR_COLOR7       (1 << 9)
/** Combined flags */
227
/** All color buffers currently bound */
228 229 230 231
#define PIPE_CLEAR_COLOR        (PIPE_CLEAR_COLOR0 | PIPE_CLEAR_COLOR1 | \
                                 PIPE_CLEAR_COLOR2 | PIPE_CLEAR_COLOR3 | \
                                 PIPE_CLEAR_COLOR4 | PIPE_CLEAR_COLOR5 | \
                                 PIPE_CLEAR_COLOR6 | PIPE_CLEAR_COLOR7)
232
#define PIPE_CLEAR_DEPTHSTENCIL (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)
233

234 235 236
/**
 * Transfer object usage flags
 */
237 238
enum pipe_transfer_usage
{
239 240 241 242
   /**
    * Resource contents read back (or accessed directly) at transfer
    * create time.
    */
243
   PIPE_TRANSFER_READ = (1 << 0),
244 245
   
   /**
246
    * Resource contents will be written back at transfer_unmap
247 248
    * time (or modified as a result of being accessed directly).
    */
249
   PIPE_TRANSFER_WRITE = (1 << 1),
250 251 252 253

   /**
    * Read/modify/write
    */
254
   PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE,
255

256 257
   /** 
    * The transfer should map the texture storage directly. The driver may
258
    * return NULL if that isn't possible, and the gallium frontend needs to cope
259 260
    * with that and use an alternative path without this flag.
    *
261
    * E.g. the gallium frontend could have a simpler path which maps textures and
262 263
    * does read/modify/write cycles on them directly, and a more complicated
    * path which uses minimal read and write transfers.
264 265
    *
    * This flag supresses implicit "DISCARD" for buffer_subdata.
266
    */
267
   PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2),
268

269 270 271
   /**
    * Discards the memory within the mapped region.
    *
272
    * It should not be used with PIPE_TRANSFER_READ.
273 274 275 276
    *
    * See also:
    * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
    */
277
   PIPE_TRANSFER_DISCARD_RANGE = (1 << 8),
278

279 280 281 282 283
   /**
    * Fail if the resource cannot be mapped immediately.
    *
    * See also:
    * - Direct3D's D3DLOCK_DONOTWAIT flag.
284
    * - Mesa's MESA_MAP_NOWAIT_BIT flag.
285 286 287
    * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag.
    */
   PIPE_TRANSFER_DONTBLOCK = (1 << 9),
288

289 290 291
   /**
    * Do not attempt to synchronize pending operations on the resource when mapping.
    *
292
    * It should not be used with PIPE_TRANSFER_READ.
293 294 295 296 297 298 299 300 301 302 303 304
    *
    * See also:
    * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag.
    * - Direct3D's D3DLOCK_NOOVERWRITE flag.
    * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag.
    */
   PIPE_TRANSFER_UNSYNCHRONIZED = (1 << 10),

   /**
    * Written ranges will be notified later with
    * pipe_context::transfer_flush_region.
    *
305
    * It should not be used with PIPE_TRANSFER_READ.
306 307 308 309 310
    *
    * See also:
    * - pipe_context::transfer_flush_region
    * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
    */
311 312 313 314 315
   PIPE_TRANSFER_FLUSH_EXPLICIT = (1 << 11),

   /**
    * Discards all memory backing the resource.
    *
316
    * It should not be used with PIPE_TRANSFER_READ.
317 318 319 320 321 322 323 324 325
    *
    * This is equivalent to:
    * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_BUFFER_BIT
    * - BufferData(NULL) on a GL buffer
    * - Direct3D's D3DLOCK_DISCARD flag.
    * - WDDM's D3DDDICB_LOCKFLAGS.Discard flag.
    * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
    * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
    */
326
   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1 << 12),
327

328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
   /**
    * Allows the resource to be used for rendering while mapped.
    *
    * PIPE_RESOURCE_FLAG_MAP_PERSISTENT must be set when creating
    * the resource.
    *
    * If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
    * must be called to ensure the device can see what the CPU has written.
    */
   PIPE_TRANSFER_PERSISTENT = (1 << 13),

   /**
    * If PERSISTENT is set, this ensures any writes done by the device are
    * immediately visible to the CPU and vice versa.
    *
    * PIPE_RESOURCE_FLAG_MAP_COHERENT must be set when creating
    * the resource.
    */
346 347
   PIPE_TRANSFER_COHERENT = (1 << 14),

348 349 350 351 352 353 354
   /**
    * Map a resource in a thread-safe manner, because the calling thread can
    * be any thread. It can only be used if both WRITE and UNSYNCHRONIZED are
    * set.
    */
   PIPE_TRANSFER_THREAD_SAFE = 1 << 15,

355 356 357 358 359
   /**
    * This and higher bits are reserved for private use by drivers. Drivers
    * should use this as (PIPE_TRANSFER_DRV_PRV << i).
    */
   PIPE_TRANSFER_DRV_PRV = (1 << 24)
360
};
361

362 363 364
/**
 * Flags for the flush function.
 */
365 366
enum pipe_flush_flags
{
367 368
   PIPE_FLUSH_END_OF_FRAME = (1 << 0),
   PIPE_FLUSH_DEFERRED = (1 << 1),
369
   PIPE_FLUSH_FENCE_FD = (1 << 2),
370 371
   PIPE_FLUSH_ASYNC = (1 << 3),
   PIPE_FLUSH_HINT_FINISH = (1 << 4),
372 373
   PIPE_FLUSH_TOP_OF_PIPE = (1 << 5),
   PIPE_FLUSH_BOTTOM_OF_PIPE = (1 << 6),
374
};
375

376 377 378
/**
 * Flags for pipe_context::dump_debug_state.
 */
379
#define PIPE_DUMP_DEVICE_STATUS_REGISTERS    (1 << 0)
380

381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
/**
 * Create a compute-only context. Use in pipe_screen::context_create.
 * This disables draw, blit, and clear*, render_condition, and other graphics
 * functions. Interop with other graphics contexts is still allowed.
 * This allows scheduling jobs on a compute-only hardware command queue that
 * can run in parallel with graphics without stalling it.
 */
#define PIPE_CONTEXT_COMPUTE_ONLY      (1 << 0)

/**
 * Gather debug information and expect that pipe_context::dump_debug_state
 * will be called. Use in pipe_screen::context_create.
 */
#define PIPE_CONTEXT_DEBUG             (1 << 1)

396 397 398 399 400 401
/**
 * Whether out-of-bounds shader loads must return zero and out-of-bounds
 * shader stores must be dropped.
 */
#define PIPE_CONTEXT_ROBUST_BUFFER_ACCESS (1 << 2)

402 403 404 405 406 407 408
/**
 * Prefer threaded pipe_context. It also implies that video codec functions
 * will not be used. (they will be either no-ops or NULL when threading is
 * enabled)
 */
#define PIPE_CONTEXT_PREFER_THREADED   (1 << 3)

409 410 411 412 413 414 415 416 417
/**
 * Create a high priority context.
 */
#define PIPE_CONTEXT_HIGH_PRIORITY     (1 << 4)

/**
 * Create a low priority context.
 */
#define PIPE_CONTEXT_LOW_PRIORITY      (1 << 5)
418

419 420 421
/** Stop execution if the device is reset. */
#define PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET (1 << 6)

422 423 424 425
/**
 * Flags for pipe_context::memory_barrier.
 */
#define PIPE_BARRIER_MAPPED_BUFFER     (1 << 0)
426
#define PIPE_BARRIER_SHADER_BUFFER     (1 << 1)
427
#define PIPE_BARRIER_QUERY_BUFFER      (1 << 2)
428 429 430 431 432 433 434
#define PIPE_BARRIER_VERTEX_BUFFER     (1 << 3)
#define PIPE_BARRIER_INDEX_BUFFER      (1 << 4)
#define PIPE_BARRIER_CONSTANT_BUFFER   (1 << 5)
#define PIPE_BARRIER_INDIRECT_BUFFER   (1 << 6)
#define PIPE_BARRIER_TEXTURE           (1 << 7)
#define PIPE_BARRIER_IMAGE             (1 << 8)
#define PIPE_BARRIER_FRAMEBUFFER       (1 << 9)
435
#define PIPE_BARRIER_STREAMOUT_BUFFER  (1 << 10)
436
#define PIPE_BARRIER_GLOBAL_BUFFER     (1 << 11)
437 438 439 440 441 442
#define PIPE_BARRIER_UPDATE_BUFFER     (1 << 12)
#define PIPE_BARRIER_UPDATE_TEXTURE    (1 << 13)
#define PIPE_BARRIER_ALL               ((1 << 14) - 1)

#define PIPE_BARRIER_UPDATE \
   (PIPE_BARRIER_UPDATE_BUFFER | PIPE_BARRIER_UPDATE_TEXTURE)
443

444 445 446 447 448 449
/**
 * Flags for pipe_context::texture_barrier.
 */
#define PIPE_TEXTURE_BARRIER_SAMPLER      (1 << 0)
#define PIPE_TEXTURE_BARRIER_FRAMEBUFFER  (1 << 1)

450
/**
451
 * Resource binding flags -- gallium frontends must specify in advance all
452
 * the ways a resource might be used.
453
 */
454 455
#define PIPE_BIND_DEPTH_STENCIL        (1 << 0) /* create_surface */
#define PIPE_BIND_RENDER_TARGET        (1 << 1) /* create_surface */
456 457 458 459 460
#define PIPE_BIND_BLENDABLE            (1 << 2) /* create_surface */
#define PIPE_BIND_SAMPLER_VIEW         (1 << 3) /* create_sampler_view */
#define PIPE_BIND_VERTEX_BUFFER        (1 << 4) /* set_vertex_buffers */
#define PIPE_BIND_INDEX_BUFFER         (1 << 5) /* draw_elements */
#define PIPE_BIND_CONSTANT_BUFFER      (1 << 6) /* set_constant_buffer */
461
#define PIPE_BIND_DISPLAY_TARGET       (1 << 7) /* flush_front_buffer */
462
/* gap */
463 464
#define PIPE_BIND_STREAM_OUTPUT        (1 << 10) /* set_stream_output_buffers */
#define PIPE_BIND_CURSOR               (1 << 11) /* mouse cursor */
465
#define PIPE_BIND_CUSTOM               (1 << 12) /* gallium frontend/winsys usages */
466
#define PIPE_BIND_GLOBAL               (1 << 13) /* set_global_binding */
467 468 469 470
#define PIPE_BIND_SHADER_BUFFER        (1 << 14) /* set_shader_buffers */
#define PIPE_BIND_SHADER_IMAGE         (1 << 15) /* set_shader_images */
#define PIPE_BIND_COMPUTE_RESOURCE     (1 << 16) /* set_compute_resources */
#define PIPE_BIND_COMMAND_ARGS_BUFFER  (1 << 17) /* pipe_draw_info.indirect */
471
#define PIPE_BIND_QUERY_BUFFER         (1 << 18) /* get_query_result_resource */
472

473 474
/**
 * The first two flags above were previously part of the amorphous
475
 * TEXTURE_USAGE, most of which are now descriptions of the ways a
476 477
 * particular texture can be bound to the gallium pipeline.  The two flags
 * below do not fit within that and probably need to be migrated to some
478
 * other place.
479
 *
480 481 482
 * Scanout is used to ask for a texture suitable for actual scanout (hence
 * the name), which implies extra layout constraints on some hardware.
 * It may also have some special meaning regarding mouse cursor images.
483
 *
484 485
 * The shared flag is quite underspecified, but certainly isn't a
 * binding flag - it seems more like a message to the winsys to create
486
 * a shareable allocation.
487 488 489
 * 
 * The third flag has been added to be able to force textures to be created
 * in linear mode (no tiling).
490
 */
491 492 493
#define PIPE_BIND_SCANOUT     (1 << 19) /*  */
#define PIPE_BIND_SHARED      (1 << 20) /* get_texture_handle ??? */
#define PIPE_BIND_LINEAR      (1 << 21)
494 495


496 497
/**
 * Flags for the driver about resource behaviour:
498
 */
499 500
#define PIPE_RESOURCE_FLAG_MAP_PERSISTENT (1 << 0)
#define PIPE_RESOURCE_FLAG_MAP_COHERENT   (1 << 1)
501
#define PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY (1 << 2)
502
#define PIPE_RESOURCE_FLAG_SPARSE                (1 << 3)
503
#define PIPE_RESOURCE_FLAG_SINGLE_THREAD_USE     (1 << 4)
504
#define PIPE_RESOURCE_FLAG_ENCRYPTED             (1 << 5)
505
#define PIPE_RESOURCE_FLAG_DRV_PRIV    (1 << 8) /* driver/winsys private */
506
#define PIPE_RESOURCE_FLAG_FRONTEND_PRIV         (1 << 24) /* gallium frontend private */
507

508 509
/**
 * Hint about the expected lifecycle of a resource.
510
 * Sorted according to GPU vs CPU access.
511
 */
512 513 514 515 516 517 518
enum pipe_resource_usage {
   PIPE_USAGE_DEFAULT,        /* fast GPU access */
   PIPE_USAGE_IMMUTABLE,      /* fast GPU access, immutable */
   PIPE_USAGE_DYNAMIC,        /* uploaded data is used multiple times */
   PIPE_USAGE_STREAM,         /* uploaded data is used once */
   PIPE_USAGE_STAGING,        /* fast CPU access */
};
519

Brian's avatar
Brian committed
520 521 522
/**
 * Shaders
 */
523 524 525 526 527 528 529 530 531
enum pipe_shader_type {
   PIPE_SHADER_VERTEX,
   PIPE_SHADER_FRAGMENT,
   PIPE_SHADER_GEOMETRY,
   PIPE_SHADER_TESS_CTRL,
   PIPE_SHADER_TESS_EVAL,
   PIPE_SHADER_COMPUTE,
   PIPE_SHADER_TYPES,
};
Brian's avatar
Brian committed
532

533 534 535
/**
 * Primitive types:
 */
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
enum pipe_prim_type {
   PIPE_PRIM_POINTS,
   PIPE_PRIM_LINES,
   PIPE_PRIM_LINE_LOOP,
   PIPE_PRIM_LINE_STRIP,
   PIPE_PRIM_TRIANGLES,
   PIPE_PRIM_TRIANGLE_STRIP,
   PIPE_PRIM_TRIANGLE_FAN,
   PIPE_PRIM_QUADS,
   PIPE_PRIM_QUAD_STRIP,
   PIPE_PRIM_POLYGON,
   PIPE_PRIM_LINES_ADJACENCY,
   PIPE_PRIM_LINE_STRIP_ADJACENCY,
   PIPE_PRIM_TRIANGLES_ADJACENCY,
   PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY,
   PIPE_PRIM_PATCHES,
   PIPE_PRIM_MAX,
};
554

555 556 557
/**
 * Tessellator spacing types
 */
558 559 560 561 562
enum pipe_tess_spacing {
   PIPE_TESS_SPACING_FRACTIONAL_ODD,
   PIPE_TESS_SPACING_FRACTIONAL_EVEN,
   PIPE_TESS_SPACING_EQUAL,
};
563

Brian's avatar
Brian committed
564 565 566
/**
 * Query object types
 */
567 568 569
enum pipe_query_type {
   PIPE_QUERY_OCCLUSION_COUNTER,
   PIPE_QUERY_OCCLUSION_PREDICATE,
570
   PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
571 572 573 574 575 576 577
   PIPE_QUERY_TIMESTAMP,
   PIPE_QUERY_TIMESTAMP_DISJOINT,
   PIPE_QUERY_TIME_ELAPSED,
   PIPE_QUERY_PRIMITIVES_GENERATED,
   PIPE_QUERY_PRIMITIVES_EMITTED,
   PIPE_QUERY_SO_STATISTICS,
   PIPE_QUERY_SO_OVERFLOW_PREDICATE,
578
   PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE,
579 580
   PIPE_QUERY_GPU_FINISHED,
   PIPE_QUERY_PIPELINE_STATISTICS,
581
   PIPE_QUERY_PIPELINE_STATISTICS_SINGLE,
582 583 584 585
   PIPE_QUERY_TYPES,
   /* start of driver queries, see pipe_screen::get_driver_query_info */
   PIPE_QUERY_DRIVER_SPECIFIC = 256,
};
586

587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
/**
 * Index for PIPE_QUERY_PIPELINE_STATISTICS subqueries.
 */
enum pipe_statistics_query_index {
   PIPE_STAT_QUERY_IA_VERTICES,
   PIPE_STAT_QUERY_IA_PRIMITIVES,
   PIPE_STAT_QUERY_VS_INVOCATIONS,
   PIPE_STAT_QUERY_GS_INVOCATIONS,
   PIPE_STAT_QUERY_GS_PRIMITIVES,
   PIPE_STAT_QUERY_C_INVOCATIONS,
   PIPE_STAT_QUERY_C_PRIMITIVES,
   PIPE_STAT_QUERY_PS_INVOCATIONS,
   PIPE_STAT_QUERY_HS_INVOCATIONS,
   PIPE_STAT_QUERY_DS_INVOCATIONS,
   PIPE_STAT_QUERY_CS_INVOCATIONS,
};

604 605 606
/**
 * Conditional rendering modes
 */
607 608 609 610 611 612
enum pipe_render_cond_flag {
   PIPE_RENDER_COND_WAIT,
   PIPE_RENDER_COND_NO_WAIT,
   PIPE_RENDER_COND_BY_REGION_WAIT,
   PIPE_RENDER_COND_BY_REGION_NO_WAIT,
};
613

Brian's avatar
Brian committed
614 615 616
/**
 * Point sprite coord modes
 */
617 618 619 620
enum pipe_sprite_coord_mode {
   PIPE_SPRITE_COORD_UPPER_LEFT,
   PIPE_SPRITE_COORD_LOWER_LEFT,
};
621

622
/**
623
 * Texture & format swizzles
624
 */
625
enum pipe_swizzle {
626 627 628 629 630 631 632 633
   PIPE_SWIZZLE_X,
   PIPE_SWIZZLE_Y,
   PIPE_SWIZZLE_Z,
   PIPE_SWIZZLE_W,
   PIPE_SWIZZLE_0,
   PIPE_SWIZZLE_1,
   PIPE_SWIZZLE_NONE,
   PIPE_SWIZZLE_MAX, /**< Number of enums counter (must be last) */
634
};
635

636 637 638 639 640 641 642 643 644 645 646 647 648 649
/**
 * Viewport swizzles
 */
enum pipe_viewport_swizzle {
   PIPE_VIEWPORT_SWIZZLE_POSITIVE_X,
   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_X,
   PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y,
   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_Y,
   PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z,
   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_Z,
   PIPE_VIEWPORT_SWIZZLE_POSITIVE_W,
   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_W,
};

650 651
#define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull

652 653 654 655 656 657

/**
 * Device reset status.
 */
enum pipe_reset_status
{
658 659 660 661
   PIPE_NO_RESET,
   PIPE_GUILTY_CONTEXT_RESET,
   PIPE_INNOCENT_CONTEXT_RESET,
   PIPE_UNKNOWN_CONTEXT_RESET,
662 663 664
};


665 666 667 668 669 670
/**
 * Conservative rasterization modes.
 */
enum pipe_conservative_raster_mode
{
   PIPE_CONSERVATIVE_RASTER_OFF,
671 672 673 674 675 676

   /**
    * The post-snap mode means the conservative rasterization occurs after
    * the conversion from floating-point to fixed-point coordinates
    * on the subpixel grid.
    */
677
   PIPE_CONSERVATIVE_RASTER_POST_SNAP,
678 679 680 681 682

   /**
    * The pre-snap mode means the conservative rasterization occurs before
    * the conversion from floating-point to fixed-point coordinates.
    */
683 684 685 686
   PIPE_CONSERVATIVE_RASTER_PRE_SNAP,
};


687 688 689 690
/**
 * resource_get_handle flags.
 */
/* Requires pipe_context::flush_resource before external use. */
691
#define PIPE_HANDLE_USAGE_EXPLICIT_FLUSH     (1 << 0)
692
/* Expected external use of the resource: */
693 694
#define PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE  (1 << 1)
#define PIPE_HANDLE_USAGE_SHADER_WRITE       (1 << 2)
695

696 697 698 699 700 701 702 703
/**
 * pipe_image_view access flags.
 */
#define PIPE_IMAGE_ACCESS_READ       (1 << 0)
#define PIPE_IMAGE_ACCESS_WRITE      (1 << 1)
#define PIPE_IMAGE_ACCESS_READ_WRITE (PIPE_IMAGE_ACCESS_READ | \
                                      PIPE_IMAGE_ACCESS_WRITE)

704
/**
705
 * Implementation capabilities/limits which are queried through
706
 * pipe_screen::get_param()
707
 */
708 709
enum pipe_cap
{
Marek Olšák's avatar
Marek Olšák committed
710
   PIPE_CAP_GRAPHICS,
711 712 713 714 715 716 717
   PIPE_CAP_NPOT_TEXTURES,
   PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS,
   PIPE_CAP_ANISOTROPIC_FILTER,
   PIPE_CAP_POINT_SPRITE,
   PIPE_CAP_MAX_RENDER_TARGETS,
   PIPE_CAP_OCCLUSION_QUERY,
   PIPE_CAP_QUERY_TIME_ELAPSED,
718
   PIPE_CAP_TEXTURE_SHADOW_MAP,
719
   PIPE_CAP_TEXTURE_SWIZZLE,
720
   PIPE_CAP_MAX_TEXTURE_2D_SIZE,
721 722 723 724 725 726
   PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
   PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS,
   PIPE_CAP_TEXTURE_MIRROR_CLAMP,
   PIPE_CAP_BLEND_EQUATION_SEPARATE,
   PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS,
   PIPE_CAP_PRIMITIVE_RESTART,
727 728 729 730
   /** subset of PRIMITIVE_RESTART where the restart index is always the fixed
    * maximum value for the index type
    */
   PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX,
731
   /** blend enables and write masks per rendertarget */
732
   PIPE_CAP_INDEP_BLEND_ENABLE,
733
   /** different blend funcs per rendertarget */
734 735 736 737 738 739 740
   PIPE_CAP_INDEP_BLEND_FUNC,
   PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS,
   PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT,
   PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
   PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
   PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
   PIPE_CAP_DEPTH_CLIP_DISABLE,
741
   PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE,
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759
   PIPE_CAP_SHADER_STENCIL_EXPORT,
   PIPE_CAP_TGSI_INSTANCEID,
   PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR,
   PIPE_CAP_FRAGMENT_COLOR_CLAMPED,
   PIPE_CAP_MIXED_COLORBUFFER_FORMATS,
   PIPE_CAP_SEAMLESS_CUBE_MAP,
   PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE,
   PIPE_CAP_MIN_TEXEL_OFFSET,
   PIPE_CAP_MAX_TEXEL_OFFSET,
   PIPE_CAP_CONDITIONAL_RENDER,
   PIPE_CAP_TEXTURE_BARRIER,
   PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS,
   PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS,
   PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME,
   PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS,
   PIPE_CAP_VERTEX_COLOR_UNCLAMPED,
   PIPE_CAP_VERTEX_COLOR_CLAMPED,
   PIPE_CAP_GLSL_FEATURE_LEVEL,
760
   PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY,
761
   PIPE_CAP_ESSL_FEATURE_LEVEL,
762 763 764 765 766 767 768 769 770 771 772 773 774 775
   PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION,
   PIPE_CAP_USER_VERTEX_BUFFERS,
   PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY,
   PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY,
   PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY,
   PIPE_CAP_COMPUTE,
   PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT,
   PIPE_CAP_START_INSTANCE,
   PIPE_CAP_QUERY_TIMESTAMP,
   PIPE_CAP_TEXTURE_MULTISAMPLE,
   PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT,
   PIPE_CAP_CUBE_MAP_ARRAY,
   PIPE_CAP_TEXTURE_BUFFER_OBJECTS,
   PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT,
776
   PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY,
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814
   PIPE_CAP_TGSI_TEXCOORD,
   PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER,
   PIPE_CAP_QUERY_PIPELINE_STATISTICS,
   PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK,
   PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE,
   PIPE_CAP_MAX_VIEWPORTS,
   PIPE_CAP_ENDIANNESS,
   PIPE_CAP_MIXED_FRAMEBUFFER_SIZES,
   PIPE_CAP_TGSI_VS_LAYER_VIEWPORT,
   PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES,
   PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS,
   PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS,
   PIPE_CAP_TEXTURE_GATHER_SM5,
   PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT,
   PIPE_CAP_FAKE_SW_MSAA,
   PIPE_CAP_TEXTURE_QUERY_LOD,
   PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET,
   PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET,
   PIPE_CAP_SAMPLE_SHADING,
   PIPE_CAP_TEXTURE_GATHER_OFFSETS,
   PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION,
   PIPE_CAP_MAX_VERTEX_STREAMS,
   PIPE_CAP_DRAW_INDIRECT,
   PIPE_CAP_TGSI_FS_FINE_DERIVATIVE,
   PIPE_CAP_VENDOR_ID,
   PIPE_CAP_DEVICE_ID,
   PIPE_CAP_ACCELERATED,
   PIPE_CAP_VIDEO_MEMORY,
   PIPE_CAP_UMA,
   PIPE_CAP_CONDITIONAL_RENDER_INVERTED,
   PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE,
   PIPE_CAP_SAMPLER_VIEW_TARGET,
   PIPE_CAP_CLIP_HALFZ,
   PIPE_CAP_VERTEXID_NOBASE,
   PIPE_CAP_POLYGON_OFFSET_CLAMP,
   PIPE_CAP_MULTISAMPLE_Z_RESOLVE,
   PIPE_CAP_RESOURCE_FROM_USER_MEMORY,
   PIPE_CAP_DEVICE_RESET_STATUS_QUERY,
815
   PIPE_CAP_MAX_SHADER_PATCH_VARYINGS,
816 817
   PIPE_CAP_TEXTURE_FLOAT_LINEAR,
   PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR,
818
   PIPE_CAP_DEPTH_BOUNDS_TEST,
819
   PIPE_CAP_TGSI_TXQS,
820
   PIPE_CAP_FORCE_PERSAMPLE_INTERP,
821
   PIPE_CAP_SHAREABLE_SHADERS,
822
   PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS,
823
   PIPE_CAP_CLEAR_TEXTURE,
824
   PIPE_CAP_CLEAR_SCISSORED,
825
   PIPE_CAP_DRAW_PARAMETERS,
826
   PIPE_CAP_TGSI_PACK_HALF_FLOAT,
827 828
   PIPE_CAP_MULTI_DRAW_INDIRECT,
   PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS,
829
   PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL,
830
   PIPE_CAP_TGSI_FS_POINT_IS_SYSVAL,
831
   PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL,
832
   PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT,
833
   PIPE_CAP_INVALIDATE_BUFFER,
834
   PIPE_CAP_GENERATE_MIPMAP,
Rob Clark's avatar
Rob Clark committed
835
   PIPE_CAP_STRING_MARKER,
836
   PIPE_CAP_SURFACE_REINTERPRET_BLOCKS,
837
   PIPE_CAP_QUERY_BUFFER_OBJECT,
838
   PIPE_CAP_QUERY_MEMORY_INFO,
839 840 841 842
   PIPE_CAP_PCI_GROUP,
   PIPE_CAP_PCI_BUS,
   PIPE_CAP_PCI_DEVICE,
   PIPE_CAP_PCI_FUNCTION,
843
   PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT,
844
   PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR,
845
   PIPE_CAP_CULL_DISTANCE,
846
   PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES,
847
   PIPE_CAP_TGSI_VOTE,
848
   PIPE_CAP_MAX_WINDOW_RECTANGLES,
849
   PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED,
850
   PIPE_CAP_VIEWPORT_SUBPIXEL_BITS,
851
   PIPE_CAP_RASTERIZER_SUBPIXEL_BITS,
852
   PIPE_CAP_MIXED_COLOR_DEPTH_BITS,
853
   PIPE_CAP_TGSI_ARRAY_COMPONENTS,
854
   PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
855
   PIPE_CAP_TGSI_CAN_READ_OUTPUTS,
856
   PIPE_CAP_NATIVE_FENCE_FD,
857
   PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY,
858
   PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS,
859
   PIPE_CAP_FBFETCH,
860
   PIPE_CAP_TGSI_MUL_ZERO_WINS,
861
   PIPE_CAP_DOUBLES,
862
   PIPE_CAP_INT64,
863
   PIPE_CAP_INT64_DIVMOD,
864
   PIPE_CAP_TGSI_TEX_TXF_LZ,
865
   PIPE_CAP_TGSI_CLOCK,
866
   PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE,
867
   PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE,
868
   PIPE_CAP_TGSI_BALLOT,
869
   PIPE_CAP_TGSI_TES_LAYER_VIEWPORT,
870
   PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX,
871
   PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION,
872
   PIPE_CAP_POST_DEPTH_COVERAGE,
873
   PIPE_CAP_BINDLESS_TEXTURE,
874
   PIPE_CAP_NIR_SAMPLERS_AS_DEREF,
875
   PIPE_CAP_QUERY_SO_OVERFLOW,
876
   PIPE_CAP_MEMOBJ,
877
   PIPE_CAP_LOAD_CONSTBUF,
878
   PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS,
879
   PIPE_CAP_TILE_RASTER_ORDER,
880
   PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES,
881
   PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS,
882
   PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET,
883
   PIPE_CAP_CONTEXT_PRIORITY_MASK,
884
   PIPE_CAP_FENCE_SIGNAL,
885
   PIPE_CAP_CONSTBUF0_FLAGS,
886
   PIPE_CAP_PACKED_UNIFORMS,
887 888 889 890 891 892
   PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES,
   PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES,
   PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES,
   PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES,
   PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS,
   PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE,
893
   PIPE_CAP_CONSERVATIVE_RASTER_INNER_COVERAGE,
894
   PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS,
895
   PIPE_CAP_MAX_GS_INVOCATIONS,
896
   PIPE_CAP_MAX_SHADER_BUFFER_SIZE,
897
   PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE,
898
   PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS,
899 900
   PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTERS,
   PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER_BUFFERS,
901
   PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET,
902
   PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET,
903
   PIPE_CAP_SURFACE_SAMPLE_COUNT,
904
   PIPE_CAP_TGSI_ATOMFADD,
905
   PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE,
906
   PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND,
907
   PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
908
   PIPE_CAP_NIR_COMPACT_ARRAYS,
909
   PIPE_CAP_MAX_VARYINGS,
910
   PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK,
911
   PIPE_CAP_COMPUTE_SHADER_DERIVATIVES,
912
   PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS,
913
   PIPE_CAP_IMAGE_LOAD_FORMATTED,
914
   PIPE_CAP_THROTTLE,
915
   PIPE_CAP_DMABUF,
916
   PIPE_CAP_PREFER_COMPUTE_FOR_MULTIMEDIA,
917
   PIPE_CAP_FRAGMENT_SHADER_INTERLOCK,
918
   PIPE_CAP_FBFETCH_COHERENT,
919
   PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED,
920
   PIPE_CAP_ATOMIC_FLOAT_MINMAX,
Gert Wollny's avatar
Gert Wollny committed
921
   PIPE_CAP_TGSI_DIV,
922
   PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD,
923
   PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES,
924
   PIPE_CAP_VERTEX_SHADER_SATURATE,
925
   PIPE_CAP_TEXTURE_SHADOW_LOD,
926
   PIPE_CAP_SHADER_SAMPLES_IDENTICAL,
927
   PIPE_CAP_TGSI_ATOMINC_WRAP,
928
   PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF,
929 930
   PIPE_CAP_GL_SPIRV,
   PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS,
931
   PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION,
932
   PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE,
933
   PIPE_CAP_FLATSHADE,
934
   PIPE_CAP_ALPHA_TEST,
935
   PIPE_CAP_POINT_SIZE_FIXED,
936
   PIPE_CAP_TWO_SIDED_COLOR,
937
   PIPE_CAP_CLIP_PLANES,
938
   PIPE_CAP_MAX_VERTEX_BUFFERS,
939
   PIPE_CAP_OPENCL_INTEGER_FUNCTIONS,
940
   PIPE_CAP_INTEGER_MULTIPLY_32X16,
941 942
   /* Turn draw, dispatch, blit into NOOP */
   PIPE_CAP_FRONTEND_NOOP,
943
   PIPE_CAP_NIR_IMAGES_AS_DEREF,
944
   PIPE_CAP_PACKED_STREAM_OUTPUT,
945
   PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED,
946
   PIPE_CAP_PSIZ_CLAMPED,
947
   PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES,
948
   PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE,
949
   PIPE_CAP_VIEWPORT_SWIZZLE,
950
   PIPE_CAP_SYSTEM_SVM,
951
   PIPE_CAP_VIEWPORT_MASK,
952
   PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL,
953
   PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
954
   PIPE_CAP_GLSL_ZERO_INIT,
955
};
956

957 958 959 960 961
/**
 * Possible bits for PIPE_CAP_CONTEXT_PRIORITY_MASK param, which should
 * return a bitmask of the supported priorities.  If the driver does not
 * support prioritized contexts, it can return 0.
 *
Eric Engestrom's avatar
Eric Engestrom committed
962
 * Note that these match __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_*
963 964 965 966 967
 */
#define PIPE_CONTEXT_PRIORITY_LOW     (1 << 0)
#define PIPE_CONTEXT_PRIORITY_MEDIUM  (1 << 1)
#define PIPE_CONTEXT_PRIORITY_HIGH    (1 << 2)

968 969 970
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600 (1 << 1)

971 972
enum pipe_endian
{
973 974
   PIPE_ENDIAN_LITTLE = 0,
   PIPE_ENDIAN_BIG = 1,
975
#if UTIL_ARCH_LITTLE_ENDIAN
976
   PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
977
#elif UTIL_ARCH_BIG_ENDIAN
978 979 980
   PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
#endif
};
981

982 983 984 985 986 987
/**
 * Implementation limits which are queried through
 * pipe_screen::get_paramf()
 */
enum pipe_capf
{
988 989 990 991 992 993
   PIPE_CAPF_MAX_LINE_WIDTH,
   PIPE_CAPF_MAX_LINE_WIDTH_AA,
   PIPE_CAPF_MAX_POINT_WIDTH,
   PIPE_CAPF_MAX_POINT_WIDTH_AA,
   PIPE_CAPF_MAX_TEXTURE_ANISOTROPY,
   PIPE_CAPF_MAX_TEXTURE_LOD_BIAS,
994 995 996
   PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE,
   PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE,
   PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY,
997 998
};

999
/** Shader caps not specific to any single stage */
1000 1001
enum pipe_shader_cap
{
1002 1003 1004 1005 1006 1007
   PIPE_SHADER_CAP_MAX_INSTRUCTIONS, /* if 0, it means the stage is unsupported */
   PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS,
   PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS,
   PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS,
   PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH,
   PIPE_SHADER_CAP_MAX_INPUTS,
1008
   PIPE_SHADER_CAP_MAX_OUTPUTS,
1009
   PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE,
1010 1011
   PIPE_SHADER_CAP_MAX_CONST_BUFFERS,
   PIPE_SHADER_CAP_MAX_TEMPS,
1012
   /* boolean caps */
1013 1014 1015 1016 1017 1018 1019
   PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED,
   PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR,
   PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR,
   PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR,
   PIPE_SHADER_CAP_INDIRECT_CONST_ADDR,
   PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */
   PIPE_SHADER_CAP_INTEGERS,
1020
   PIPE_SHADER_CAP_INT64_ATOMICS,
Jan Vesely's avatar
Jan Vesely committed
1021
   PIPE_SHADER_CAP_FP16,
1022 1023
   PIPE_SHADER_CAP_FP16_DERIVATIVES,
   PIPE_SHADER_CAP_INT16,
1024 1025 1026
   PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS,
   PIPE_SHADER_CAP_PREFERRED_IR,
   PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED,
1027
   PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS,
1028
   PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED, /* all rounding modes */
1029
   PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED,
1030
   PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED,
1031 1032
   PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE,
   PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT,
1033
   PIPE_SHADER_CAP_MAX_SHADER_BUFFERS,
1034
   PIPE_SHADER_CAP_SUPPORTED_IRS,
1035
   PIPE_SHADER_CAP_MAX_SHADER_IMAGES,
1036
   PIPE_SHADER_CAP_LOWER_IF_THRESHOLD,
1037
   PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS,