3a2fece45c60b38dd145efd56aac0aa23a167576
[mesa.git] / src / gallium / drivers / i965 / brw_context.h
1 /*
2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a 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, sublicense, 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
16 portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **********************************************************************/
27 /*
28 * Authors:
29 * Keith Whitwell <keith@tungstengraphics.com>
30 */
31
32
33 #ifndef BRWCONTEXT_INC
34 #define BRWCONTEXT_INC
35
36 #include "brw_structs.h"
37 #include "brw_winsys.h"
38 #include "pipe/p_state.h"
39 #include "pipe/p_context.h"
40 #include "tgsi/tgsi_scan.h"
41
42
43 /* Glossary:
44 *
45 * URB - uniform resource buffer. A mid-sized buffer which is
46 * partitioned between the fixed function units and used for passing
47 * values (vertices, primitives, constants) between them.
48 *
49 * CURBE - constant URB entry. An urb region (entry) used to hold
50 * constant values which the fixed function units can be instructed to
51 * preload into the GRF when spawning a thread.
52 *
53 * VUE - vertex URB entry. An urb entry holding a vertex and usually
54 * a vertex header. The header contains control information and
55 * things like primitive type, Begin/end flags and clip codes.
56 *
57 * PUE - primitive URB entry. An urb entry produced by the setup (SF)
58 * unit holding rasterization and interpolation parameters.
59 *
60 * GRF - general register file. One of several register files
61 * addressable by programmed threads. The inputs (r0, payload, curbe,
62 * urb) of the thread are preloaded to this area before the thread is
63 * spawned. The registers are individually 8 dwords wide and suitable
64 * for general usage. Registers holding thread input values are not
65 * special and may be overwritten.
66 *
67 * MRF - message register file. Threads communicate (and terminate)
68 * by sending messages. Message parameters are placed in contiguous
69 * MRF registers. All program output is via these messages. URB
70 * entries are populated by sending a message to the shared URB
71 * function containing the new data, together with a control word,
72 * often an unmodified copy of R0.
73 *
74 * R0 - GRF register 0. Typically holds control information used when
75 * sending messages to other threads.
76 *
77 * EU or GEN4 EU: The name of the programmable subsystem of the
78 * i965 hardware. Threads are executed by the EU, the registers
79 * described above are part of the EU architecture.
80 *
81 * Fixed function units:
82 *
83 * CS - Command streamer. Notional first unit, little software
84 * interaction. Holds the URB entries used for constant data, ie the
85 * CURBEs.
86 *
87 * VF/VS - Vertex Fetch / Vertex Shader. The fixed function part of
88 * this unit is responsible for pulling vertices out of vertex buffers
89 * in vram and injecting them into the processing pipe as VUEs. If
90 * enabled, it first passes them to a VS thread which is a good place
91 * for the driver to implement any active vertex shader.
92 *
93 * GS - Geometry Shader. This corresponds to a new DX10 concept. If
94 * enabled, incoming strips etc are passed to GS threads in individual
95 * line/triangle/point units. The GS thread may perform arbitary
96 * computation and emit whatever primtives with whatever vertices it
97 * chooses. This makes GS an excellent place to implement GL's
98 * unfilled polygon modes, though of course it is capable of much
99 * more. Additionally, GS is used to translate away primitives not
100 * handled by latter units, including Quads and Lineloops.
101 *
102 * CS - Clipper. Mesa's clipping algorithms are imported to run on
103 * this unit. The fixed function part performs cliptesting against
104 * the 6 fixed clipplanes and makes descisions on whether or not the
105 * incoming primitive needs to be passed to a thread for clipping.
106 * User clip planes are handled via cooperation with the VS thread.
107 *
108 * SF - Strips Fans or Setup: Triangles are prepared for
109 * rasterization. Interpolation coefficients are calculated.
110 * Flatshading and two-side lighting usually performed here.
111 *
112 * WM - Windower. Interpolation of vertex attributes performed here.
113 * Fragment shader implemented here. SIMD aspects of EU taken full
114 * advantage of, as pixels are processed in blocks of 16.
115 *
116 * CC - Color Calculator. No EU threads associated with this unit.
117 * Handles blending and (presumably) depth and stencil testing.
118 */
119
120 #define BRW_MAX_CURBE (32*16)
121
122 struct brw_context;
123
124 struct brw_depth_stencil_alpha_state {
125 struct pipe_depth_stencil_alpha_state templ; /* for draw module */
126
127 /* Precalculated hardware state:
128 */
129 struct brw_cc0 cc0;
130 struct brw_cc1 cc1;
131 struct brw_cc2 cc2;
132 struct brw_cc3 cc3;
133 };
134
135
136 struct brw_blend_state {
137 struct pipe_depth_stencil_alpha_state templ; /* for draw module */
138
139 /* Precalculated hardware state:
140 */
141 struct brw_cc3 cc3;
142 struct brw_cc5 cc5;
143 struct brw_cc6 cc6;
144 struct brw_cc7 cc7;
145 };
146
147
148 struct brw_rasterizer_state;
149
150
151 struct brw_vertex_shader {
152 const struct tgsi_token *tokens;
153 struct tgsi_shader_info info;
154
155 struct brw_winsys_buffer *const_buffer; /** Program constant buffer/surface */
156 GLboolean use_const_buffer;
157 };
158
159
160 struct brw_fragment_shader {
161 const struct tgsi_token *tokens;
162 struct tgsi_shader_info info;
163
164 GLboolean isGLSL;
165
166 struct brw_winsys_buffer *const_buffer; /** Program constant buffer/surface */
167 GLboolean use_const_buffer;
168 };
169
170
171
172 #define PIPE_NEW_DEPTH_STENCIL_ALPHA 0x1
173 #define PIPE_NEW_RAST 0x2
174 #define PIPE_NEW_BLEND 0x2
175 #define PIPE_NEW_VIEWPORT 0x2
176 #define PIPE_NEW_FRAMEBUFFER 0x2
177 #define PIPE_NEW_VERTEX_BUFFER 0x2
178 #define PIPE_NEW_VERTEX_ELEMENT 0x2
179 #define PIPE_NEW_FRAGMENT_SHADER 0x2
180 #define PIPE_NEW_VERTEX_SHADER 0x2
181 #define PIPE_NEW_FRAGMENT_CONSTS 0x2
182 #define PIPE_NEW_VERTEX_CONSTS 0x2
183 #define PIPE_NEW_CLIP 0x2
184
185
186 #define BRW_NEW_URB_FENCE 0x1
187 #define BRW_NEW_FRAGMENT_PROGRAM 0x2
188 #define BRW_NEW_VERTEX_PROGRAM 0x4
189 #define BRW_NEW_INPUT_DIMENSIONS 0x8
190 #define BRW_NEW_CURBE_OFFSETS 0x10
191 #define BRW_NEW_REDUCED_PRIMITIVE 0x20
192 #define BRW_NEW_PRIMITIVE 0x40
193 #define BRW_NEW_CONTEXT 0x80
194 #define BRW_NEW_WM_INPUT_DIMENSIONS 0x100
195 #define BRW_NEW_PSP 0x800
196 #define BRW_NEW_WM_SURFACES 0x1000
197 #define BRW_NEW_FENCE 0x2000
198 #define BRW_NEW_INDICES 0x4000
199 #define BRW_NEW_VERTICES 0x8000
200 /**
201 * Used for any batch entry with a relocated pointer that will be used
202 * by any 3D rendering.
203 */
204 #define BRW_NEW_BATCH 0x10000
205 /** brw->depth_region updated */
206 #define BRW_NEW_DEPTH_BUFFER 0x20000
207 #define BRW_NEW_NR_WM_SURFACES 0x40000
208 #define BRW_NEW_NR_VS_SURFACES 0x80000
209 #define BRW_NEW_INDEX_BUFFER 0x100000
210
211 struct brw_state_flags {
212 /** State update flags signalled by mesa internals */
213 GLuint mesa;
214 /**
215 * State update flags signalled as the result of brw_tracked_state updates
216 */
217 GLuint brw;
218 /** State update flags signalled by brw_state_cache.c searches */
219 GLuint cache;
220 };
221
222
223
224 /* Data about a particular attempt to compile a program. Note that
225 * there can be many of these, each in a different GL state
226 * corresponding to a different brw_wm_prog_key struct, with different
227 * compiled programs:
228 */
229 struct brw_wm_prog_data {
230 GLuint curb_read_length;
231 GLuint urb_read_length;
232
233 GLuint first_curbe_grf;
234 GLuint total_grf;
235 GLuint total_scratch;
236
237 GLuint nr_params; /**< number of float params/constants */
238 GLboolean error;
239
240 /* Pointer to tracked values (only valid once
241 * _mesa_load_state_parameters has been called at runtime).
242 */
243 const GLfloat *param[BRW_MAX_CURBE];
244 };
245
246 struct brw_sf_prog_data {
247 GLuint urb_read_length;
248 GLuint total_grf;
249
250 /* Each vertex may have upto 12 attributes, 4 components each,
251 * except WPOS which requires only 2. (11*4 + 2) == 44 ==> 11
252 * rows.
253 *
254 * Actually we use 4 for each, so call it 12 rows.
255 */
256 GLuint urb_entry_size;
257 };
258
259 struct brw_clip_prog_data {
260 GLuint curb_read_length; /* user planes? */
261 GLuint clip_mode;
262 GLuint urb_read_length;
263 GLuint total_grf;
264 };
265
266 struct brw_gs_prog_data {
267 GLuint urb_read_length;
268 GLuint total_grf;
269 };
270
271 struct brw_vs_prog_data {
272 GLuint curb_read_length;
273 GLuint urb_read_length;
274 GLuint total_grf;
275 GLuint outputs_written;
276 GLuint nr_params; /**< number of float params/constants */
277
278 GLuint inputs_read;
279
280 /* Used for calculating urb partitions:
281 */
282 GLuint urb_entry_size;
283 };
284
285
286 /* Size == 0 if output either not written, or always [0,0,0,1]
287 */
288 struct brw_vs_ouput_sizes {
289 GLubyte output_size[PIPE_MAX_SHADER_OUTPUTS];
290 };
291
292
293 /** Number of texture sampler units */
294 #define BRW_MAX_TEX_UNIT 16
295
296 /**
297 * Size of our surface binding table for the WM.
298 * This contains pointers to the drawing surfaces and current texture
299 * objects and shader constant buffers (+2).
300 */
301 #define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1)
302
303 /**
304 * Helpers to convert drawing buffers, textures and constant buffers
305 * to surface binding table indexes, for WM.
306 */
307 #define SURF_INDEX_DRAW(d) (d)
308 #define SURF_INDEX_FRAG_CONST_BUFFER (MAX_DRAW_BUFFERS)
309 #define SURF_INDEX_TEXTURE(t) (MAX_DRAW_BUFFERS + 1 + (t))
310
311 /**
312 * Size of surface binding table for the VS.
313 * Only one constant buffer for now.
314 */
315 #define BRW_VS_MAX_SURF 1
316
317 /**
318 * Only a VS constant buffer
319 */
320 #define SURF_INDEX_VERT_CONST_BUFFER 0
321
322
323 enum brw_cache_id {
324 BRW_CC_VP,
325 BRW_CC_UNIT,
326 BRW_WM_PROG,
327 BRW_SAMPLER_DEFAULT_COLOR,
328 BRW_SAMPLER,
329 BRW_WM_UNIT,
330 BRW_SF_PROG,
331 BRW_SF_VP,
332 BRW_SF_UNIT,
333 BRW_VS_UNIT,
334 BRW_VS_PROG,
335 BRW_GS_UNIT,
336 BRW_GS_PROG,
337 BRW_CLIP_VP,
338 BRW_CLIP_UNIT,
339 BRW_CLIP_PROG,
340 BRW_SS_SURFACE,
341 BRW_SS_SURF_BIND,
342
343 BRW_MAX_CACHE
344 };
345
346 struct brw_cache_item {
347 /**
348 * Effectively part of the key, cache_id identifies what kind of state
349 * buffer is involved, and also which brw->state.dirty.cache flag should
350 * be set when this cache item is chosen.
351 */
352 enum brw_cache_id cache_id;
353 /** 32-bit hash of the key data */
354 GLuint hash;
355 GLuint key_size; /* for variable-sized keys */
356 const void *key;
357 struct brw_winsys_buffer **reloc_bufs;
358 GLuint nr_reloc_bufs;
359
360 struct brw_winsys_buffer *bo;
361 GLuint data_size;
362
363 struct brw_cache_item *next;
364 };
365
366
367
368 struct brw_cache {
369 struct brw_context *brw;
370
371 struct brw_cache_item **items;
372 GLuint size, n_items;
373
374 GLuint key_size[BRW_MAX_CACHE]; /* for fixed-size keys */
375 GLuint aux_size[BRW_MAX_CACHE];
376 char *name[BRW_MAX_CACHE];
377
378 /* Record of the last BOs chosen for each cache_id. Used to set
379 * brw->state.dirty.cache when a new cache item is chosen.
380 */
381 struct brw_winsys_buffer *last_bo[BRW_MAX_CACHE];
382 };
383
384
385 /* Considered adding a member to this struct to document which flags
386 * an update might raise so that ordering of the state atoms can be
387 * checked or derived at runtime. Dropped the idea in favor of having
388 * a debug mode where the state is monitored for flags which are
389 * raised that have already been tested against.
390 */
391 struct brw_tracked_state {
392 struct brw_state_flags dirty;
393 void (*prepare)( struct brw_context *brw );
394 void (*emit)( struct brw_context *brw );
395 };
396
397 /* Flags for brw->state.cache.
398 */
399 #define CACHE_NEW_CC_VP (1<<BRW_CC_VP)
400 #define CACHE_NEW_CC_UNIT (1<<BRW_CC_UNIT)
401 #define CACHE_NEW_WM_PROG (1<<BRW_WM_PROG)
402 #define CACHE_NEW_SAMPLER_DEFAULT_COLOR (1<<BRW_SAMPLER_DEFAULT_COLOR)
403 #define CACHE_NEW_SAMPLER (1<<BRW_SAMPLER)
404 #define CACHE_NEW_WM_UNIT (1<<BRW_WM_UNIT)
405 #define CACHE_NEW_SF_PROG (1<<BRW_SF_PROG)
406 #define CACHE_NEW_SF_VP (1<<BRW_SF_VP)
407 #define CACHE_NEW_SF_UNIT (1<<BRW_SF_UNIT)
408 #define CACHE_NEW_VS_UNIT (1<<BRW_VS_UNIT)
409 #define CACHE_NEW_VS_PROG (1<<BRW_VS_PROG)
410 #define CACHE_NEW_GS_UNIT (1<<BRW_GS_UNIT)
411 #define CACHE_NEW_GS_PROG (1<<BRW_GS_PROG)
412 #define CACHE_NEW_CLIP_VP (1<<BRW_CLIP_VP)
413 #define CACHE_NEW_CLIP_UNIT (1<<BRW_CLIP_UNIT)
414 #define CACHE_NEW_CLIP_PROG (1<<BRW_CLIP_PROG)
415 #define CACHE_NEW_SURFACE (1<<BRW_SS_SURFACE)
416 #define CACHE_NEW_SURF_BIND (1<<BRW_SS_SURF_BIND)
417
418 struct brw_cached_batch_item {
419 struct header *header;
420 GLuint sz;
421 struct brw_cached_batch_item *next;
422 };
423
424
425
426 /* Protect against a future where VERT_ATTRIB_MAX > 32. Wouldn't life
427 * be easier if C allowed arrays of packed elements?
428 */
429 #define VS_INPUT_BITMASK_DWORDS ((PIPE_MAX_SHADER_INPUTS+31)/32)
430
431
432
433
434 struct brw_vertex_info {
435 GLuint sizes[VS_INPUT_BITMASK_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */
436 };
437
438
439 struct brw_query_object {
440 /** Doubly linked list of active query objects in the context. */
441 struct brw_query_object *prev, *next;
442
443 /** Last query BO associated with this query. */
444 struct brw_winsys_buffer *bo;
445 /** First index in bo with query data for this object. */
446 int first_index;
447 /** Last index in bo with query data for this object. */
448 int last_index;
449
450 /* Total count of pixels from previous BOs */
451 unsigned int count;
452 };
453
454
455 /**
456 * brw_context is derived from pipe_context
457 */
458 struct brw_context
459 {
460 struct pipe_context pipe;
461
462 struct brw_screen *brw_screen;
463 struct brw_winsys_screen *sws;
464
465 GLuint primitive;
466 GLuint reduced_primitive;
467
468 GLboolean emit_state_always;
469 GLboolean no_batch_wrap;
470
471 /* Active vertex program:
472 */
473 struct {
474 const struct brw_vertex_shader *vs;
475 const struct brw_fragment_shader *fs;
476 const struct brw_blend_state *blend;
477 const struct brw_rasterizer_state *rast;
478 const struct brw_depth_stencil_alpha_state *dsa;
479 struct pipe_framebuffer_state fb;
480 struct pipe_viewport_state vp;
481 struct pipe_clip_state ucp;
482 } curr;
483
484 struct {
485 struct brw_state_flags dirty;
486
487 /**
488 * List of buffers accumulated in brw_validate_state to receive
489 * dri_bo_check_aperture treatment before exec, so we can know if we
490 * should flush the batch and try again before emitting primitives.
491 *
492 * This can be a fixed number as we only have a limited number of
493 * objects referenced from the batchbuffer in a primitive emit,
494 * consisting of the vertex buffers, pipelined state pointers,
495 * the CURBE, the depth buffer, and a query BO.
496 */
497 struct brw_winsys_buffer *validated_bos[PIPE_MAX_SHADER_INPUTS + 16];
498 int validated_bo_count;
499 } state;
500
501 struct brw_cache cache; /** non-surface items */
502 struct brw_cache surface_cache; /* surface items */
503 struct brw_cached_batch_item *cached_batch_items;
504
505 struct {
506 struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
507 struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
508 unsigned num_vertex_element;
509 unsigned num_vertex_buffer;
510
511 struct u_upload_mgr *upload_vertex;
512 struct u_upload_mgr *upload_index;
513
514
515 /* Summary of size and varying of active arrays, so we can check
516 * for changes to this state:
517 */
518 struct brw_vertex_info info;
519 unsigned int min_index, max_index;
520 } vb;
521
522 struct {
523 /**
524 * Index buffer for this draw_prims call.
525 *
526 * Updates are signaled by BRW_NEW_INDICES.
527 */
528 const struct _mesa_index_buffer *ib;
529
530 /* Updates to these fields are signaled by BRW_NEW_INDEX_BUFFER. */
531 struct brw_winsys_buffer *bo;
532 unsigned int offset;
533 unsigned int size;
534 /* Offset to index buffer index to use in CMD_3D_PRIM so that we can
535 * avoid re-uploading the IB packet over and over if we're actually
536 * referencing the same index buffer.
537 */
538 unsigned int start_vertex_offset;
539 } ib;
540
541
542 /* BRW_NEW_URB_ALLOCATIONS:
543 */
544 struct {
545 GLuint vsize; /* vertex size plus header in urb registers */
546 GLuint csize; /* constant buffer size in urb registers */
547 GLuint sfsize; /* setup data size in urb registers */
548
549 GLboolean constrained;
550
551 GLuint nr_vs_entries;
552 GLuint nr_gs_entries;
553 GLuint nr_clip_entries;
554 GLuint nr_sf_entries;
555 GLuint nr_cs_entries;
556
557 GLuint vs_start;
558 GLuint gs_start;
559 GLuint clip_start;
560 GLuint sf_start;
561 GLuint cs_start;
562 } urb;
563
564
565 /* BRW_NEW_CURBE_OFFSETS:
566 */
567 struct {
568 GLuint wm_start; /**< pos of first wm const in CURBE buffer */
569 GLuint wm_size; /**< number of float[4] consts, multiple of 16 */
570 GLuint clip_start;
571 GLuint clip_size;
572 GLuint vs_start;
573 GLuint vs_size;
574 GLuint total_size;
575
576 struct brw_winsys_buffer *curbe_bo;
577 /** Offset within curbe_bo of space for current curbe entry */
578 GLuint curbe_offset;
579 /** Offset within curbe_bo of space for next curbe entry */
580 GLuint curbe_next_offset;
581
582 GLfloat *last_buf;
583 GLuint last_bufsz;
584 /**
585 * Whether we should create a new bo instead of reusing the old one
586 * (if we just dispatch the batch pointing at the old one.
587 */
588 GLboolean need_new_bo;
589 } curbe;
590
591 struct {
592 struct brw_vs_prog_data *prog_data;
593
594 struct brw_winsys_buffer *prog_bo;
595 struct brw_winsys_buffer *state_bo;
596
597 /** Binding table of pointers to surf_bo entries */
598 struct brw_winsys_buffer *bind_bo;
599 struct brw_winsys_buffer *surf_bo[BRW_VS_MAX_SURF];
600 GLuint nr_surfaces;
601 } vs;
602
603 struct {
604 struct brw_gs_prog_data *prog_data;
605
606 GLboolean prog_active;
607 struct brw_winsys_buffer *prog_bo;
608 struct brw_winsys_buffer *state_bo;
609 } gs;
610
611 struct {
612 struct brw_clip_prog_data *prog_data;
613
614 struct brw_winsys_buffer *prog_bo;
615 struct brw_winsys_buffer *state_bo;
616 struct brw_winsys_buffer *vp_bo;
617 } clip;
618
619
620 struct {
621 struct brw_sf_prog_data *prog_data;
622
623 struct brw_winsys_buffer *prog_bo;
624 struct brw_winsys_buffer *state_bo;
625 struct brw_winsys_buffer *vp_bo;
626 } sf;
627
628 struct {
629 struct brw_wm_prog_data *prog_data;
630 struct brw_wm_compile *compile_data;
631
632 /** Input sizes, calculated from active vertex program.
633 * One bit per fragment program input attribute.
634 */
635 //GLbitfield input_size_masks[4];
636
637 /** Array of surface default colors (texture border color) */
638 struct brw_winsys_buffer *sdc_bo[BRW_MAX_TEX_UNIT];
639
640 GLuint render_surf;
641 GLuint nr_surfaces;
642
643 GLuint max_threads;
644 struct brw_winsys_buffer *scratch_bo;
645
646 GLuint sampler_count;
647 struct brw_winsys_buffer *sampler_bo;
648
649 /** Binding table of pointers to surf_bo entries */
650 struct brw_winsys_buffer *bind_bo;
651 struct brw_winsys_buffer *surf_bo[PIPE_MAX_COLOR_BUFS];
652
653 struct brw_winsys_buffer *prog_bo;
654 struct brw_winsys_buffer *state_bo;
655 } wm;
656
657
658 struct {
659 struct brw_winsys_buffer *prog_bo;
660 struct brw_winsys_buffer *state_bo;
661 struct brw_winsys_buffer *vp_bo;
662 } cc;
663
664 struct {
665 struct brw_query_object active_head;
666 struct brw_winsys_buffer *bo;
667 int index;
668 GLboolean active;
669 } query;
670 /* Used to give every program string a unique id
671 */
672 GLuint program_id;
673 };
674
675
676 #define BRW_PACKCOLOR8888(r,g,b,a) ((r<<24) | (g<<16) | (b<<8) | a)
677
678
679
680 /*======================================================================
681 * brw_vtbl.c
682 */
683 void brwInitVtbl( struct brw_context *brw );
684
685
686 /*======================================================================
687 * brw_queryobj.c
688 */
689 void brw_init_query(struct brw_context *brw);
690 void brw_prepare_query_begin(struct brw_context *brw);
691 void brw_emit_query_begin(struct brw_context *brw);
692 void brw_emit_query_end(struct brw_context *brw);
693
694 /*======================================================================
695 * brw_state_dump.c
696 */
697 void brw_debug_batch(struct brw_context *intel);
698
699 /*======================================================================
700 * brw_tex.c
701 */
702 void brw_validate_textures( struct brw_context *brw );
703
704
705 /*======================================================================
706 * brw_pipe_shader.c
707 */
708 void brw_init_shader_funcs( struct brw_context *brw );
709
710
711 /* brw_urb.c
712 */
713 void brw_upload_urb_fence(struct brw_context *brw);
714
715 /* brw_curbe.c
716 */
717 void brw_upload_cs_urb_state(struct brw_context *brw);
718
719 /* brw_disasm.c */
720 int brw_disasm (FILE *file, struct brw_instruction *inst);
721
722 /*======================================================================
723 * Inline conversion functions. These are better-typed than the
724 * macros used previously:
725 */
726 static INLINE struct brw_context *
727 brw_context( struct pipe_context *ctx )
728 {
729 return (struct brw_context *)ctx;
730 }
731
732
733
734
735 #define DO_SETUP_BITS ((1<<(FRAG_ATTRIB_MAX)) - 1)
736
737 #endif
738