2 * Mesa 3-D graphics library
4 * Copyright (C) 2013 LunarG, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
31 #include "ilo_common.h"
32 #include "ilo_state.h"
38 struct ilo_state_vector
;
44 const struct ilo_dev_info
*dev
;
45 struct ilo_builder
*builder
;
47 struct intel_bo
*workaround_bo
;
49 uint32_t packed_sample_position_1x
;
50 uint32_t packed_sample_position_4x
;
51 uint32_t packed_sample_position_8x
[2];
56 * Any state that involves resources needs to be re-emitted when the
57 * batch bo changed. This is because we do not pin the resources and
58 * their offsets (or existence) may change between batch buffers.
60 bool batch_bo_changed
;
61 bool state_bo_changed
;
62 bool instruction_bo_changed
;
67 struct ilo_render_state
{
69 * When a WA is needed before some command, we always emit the WA right
70 * before the command. Knowing what have already been done since last
71 * 3DPRIMITIVE allows us to skip some WAs.
73 uint32_t current_pipe_control_dw1
;
76 * When a WA is needed after some command, we may have the WA follow the
77 * command immediately or defer it. If this is non-zero, a PIPE_CONTROL
78 * will be emitted before 3DPRIMITIVE.
80 uint32_t deferred_pipe_control_dw1
;
82 bool primitive_restart
;
87 uint32_t CLIP_VIEWPORT
;
88 uint32_t SF_CLIP_VIEWPORT
; /* GEN7+ */
91 uint32_t COLOR_CALC_STATE
;
93 uint32_t DEPTH_STENCIL_STATE
;
95 uint32_t SCISSOR_RECT
;
98 uint32_t BINDING_TABLE_STATE
;
99 int BINDING_TABLE_STATE_size
;
100 uint32_t SURFACE_STATE
[ILO_MAX_VS_SURFACES
];
101 uint32_t SAMPLER_STATE
;
102 uint32_t SAMPLER_BORDER_COLOR_STATE
[ILO_MAX_SAMPLERS
];
103 uint32_t PUSH_CONSTANT_BUFFER
;
104 int PUSH_CONSTANT_BUFFER_size
;
108 uint32_t BINDING_TABLE_STATE
;
109 int BINDING_TABLE_STATE_size
;
110 uint32_t SURFACE_STATE
[ILO_MAX_GS_SURFACES
];
115 uint32_t BINDING_TABLE_STATE
;
116 int BINDING_TABLE_STATE_size
;
117 uint32_t SURFACE_STATE
[ILO_MAX_WM_SURFACES
];
118 uint32_t SAMPLER_STATE
;
119 uint32_t SAMPLER_BORDER_COLOR_STATE
[ILO_MAX_SAMPLERS
];
120 uint32_t PUSH_CONSTANT_BUFFER
;
121 int PUSH_CONSTANT_BUFFER_size
;
127 ilo_render_create(struct ilo_builder
*builder
);
130 ilo_render_destroy(struct ilo_render
*render
);
133 * Estimate the size of an action.
136 ilo_render_get_sample_position(const struct ilo_render
*render
,
137 unsigned sample_count
,
138 unsigned sample_index
,
142 ilo_render_invalidate_hw(struct ilo_render
*render
);
145 ilo_render_invalidate_builder(struct ilo_render
*render
);
148 ilo_render_get_flush_len(const struct ilo_render
*render
);
151 ilo_render_emit_flush(struct ilo_render
*render
);
154 ilo_render_get_query_len(const struct ilo_render
*render
,
155 unsigned query_type
);
158 ilo_render_emit_query(struct ilo_render
*render
,
159 struct ilo_query
*q
, uint32_t offset
);
162 ilo_render_get_rectlist_len(const struct ilo_render
*render
,
163 const struct ilo_blitter
*blitter
);
166 ilo_render_emit_rectlist(struct ilo_render
*render
,
167 const struct ilo_blitter
*blitter
);
170 ilo_render_get_draw_len(const struct ilo_render
*render
,
171 const struct ilo_state_vector
*vec
);
174 ilo_render_emit_draw(struct ilo_render
*render
,
175 const struct ilo_state_vector
*vec
);
177 #endif /* ILO_RENDER_H */