1 /**************************************************************************
3 * Copyright 2007-2009 VMware, Inc.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
30 * The setup code is concerned with point/line/triangle setup and
31 * putting commands/data into the bins.
35 #ifndef LP_SETUP_CONTEXT_H
36 #define LP_SETUP_CONTEXT_H
40 #include "lp_tile_soa.h" /* for TILE_SIZE */
43 #include "draw/draw_vbuf.h"
45 #define LP_SETUP_NEW_FS 0x01
46 #define LP_SETUP_NEW_CONSTANTS 0x02
47 #define LP_SETUP_NEW_BLEND_COLOR 0x04
50 struct lp_scene_queue
;
54 * Point/line/triangle setup context.
55 * Note: "stored" below indicates data which is stored in the bins,
56 * not arbitrary malloc'd memory.
59 * Subclass of vbuf_render, plugged directly into the draw module as
60 * the rendering backend.
64 struct vbuf_render base
;
66 struct vertex_info
*vertex_info
;
70 uint vertex_buffer_size
;
73 /* Final pipeline stage for draw module. Draw module should
74 * create/install this itself now.
76 struct draw_stage
*vbuf
;
77 struct lp_rasterizer
*rast
;
78 struct lp_scene
*scene
; /**< current scene */
79 struct lp_scene_queue
*empty_scenes
; /**< queue of empty scenes */
81 boolean flatshade_first
;
82 boolean ccw_is_frontface
;
85 struct pipe_framebuffer_state fb
;
89 union lp_rast_cmd_arg color
; /**< lp_rast_clear_color() cmd */
90 union lp_rast_cmd_arg zstencil
; /**< lp_rast_clear_zstencil() cmd */
100 struct lp_shader_input input
[PIPE_MAX_ATTRIBS
];
103 const struct lp_rast_state
*stored
; /**< what's in the scene */
104 struct lp_rast_state current
; /**< currently set state */
107 /** fragment shader constants */
109 struct pipe_buffer
*current
;
110 unsigned stored_size
;
111 const void *stored_data
;
115 struct pipe_blend_color current
;
119 unsigned dirty
; /**< bitmask of LP_SETUP_x bits */
121 void (*point
)( struct setup_context
*,
122 const float (*v0
)[4]);
124 void (*line
)( struct setup_context
*,
125 const float (*v0
)[4],
126 const float (*v1
)[4]);
128 void (*triangle
)( struct setup_context
*,
129 const float (*v0
)[4],
130 const float (*v1
)[4],
131 const float (*v2
)[4]);
134 void lp_setup_choose_triangle( struct setup_context
*setup
);
135 void lp_setup_choose_line( struct setup_context
*setup
);
136 void lp_setup_choose_point( struct setup_context
*setup
);
138 struct lp_scene
*lp_setup_get_current_scene(struct setup_context
*setup
);
140 void lp_setup_init_vbuf(struct setup_context
*setup
);
142 void lp_setup_update_state( struct setup_context
*setup
);