unsigned ib_offset;
util_draw_init_info(&new_info);
+ new_info.index_bounds_valid = info->index_bounds_valid;
new_info.min_index = info->min_index;
new_info.max_index = info->max_index;
new_info.index_bias = info->index_bias;
info.count = count;
info.start_instance = start_instance;
info.instance_count = instance_count;
+ info.index_bounds_valid = true;
info.min_index = start;
info.max_index = start + count - 1;
* These values determine the user buffer bounds to upload.
*/
new_info.index_bias = index_bias0;
+ new_info.index_bounds_valid = true;
new_info.min_index = ~0u;
new_info.max_index = 0;
new_info.start_instance = ~0u;
if (u_vbuf_need_minmax_index(mgr)) {
unsigned max_index;
- if (new_info.max_index != ~0u) {
+ if (new_info.index_bounds_valid) {
min_index = new_info.min_index;
max_index = new_info.max_index;
} else {
/* Mali Utgard GPU always need min/max index info for index draw,
* compute it if upper layer does not do for us */
- if (info->max_index != ~0u) {
+ if (info->index_bounds_valid) {
ctx->min_index = info->min_index;
ctx->max_index = info->max_index;
needs_indices = false;
bool needs_indices = true;
mali_ptr out = 0;
- if (info->max_index != ~0u) {
+ if (info->index_bounds_valid) {
*min_index = info->min_index;
*max_index = info->max_index;
needs_indices = false;
static void handle_draw_indexed(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
+ state->info.index_bounds_valid = false;
state->info.min_index = 0;
state->info.max_index = ~0;
state->info.index_size = state->index_size;
struct rendering_state *state, bool indexed)
{
if (indexed) {
+ state->info.index_bounds_valid = false;
state->info.index_size = state->index_size;
state->info.index.resource = state->index_buffer;
state->info.max_index = ~0;
info.index_size = context->index_size;
info.start = context->index_offset / context->index_size + StartIndex;
info.index_bias = BaseVertexIndex;
+ info.index_bounds_valid = true;
/* These don't include index bias: */
info.min_index = MinVertexIndex;
info.max_index = MinVertexIndex + NumVertices - 1;
info.index_size = index_size;
info.start = index_offset / info.index_size;
info.index_bias = 0;
+ info.index_bounds_valid = true;
info.min_index = MinVertexIndex;
info.max_index = MinVertexIndex + NumVertices - 1;
info.has_user_indices = ibuf == NULL;
ubyte vertices_per_patch; /**< the number of vertices per patch */
ubyte index_size; /**< if 0, the draw is not indexed. */
bool primitive_restart:1;
- bool has_user_indices:1; /**< if true, use index.user_buffer */
- char _pad:6; /**< padding for memcmp */
+ bool has_user_indices:1; /**< if true, use index.user_buffer */
+ bool index_bounds_valid:1; /**< whether min_index and max_index are valid;
+ they're always invalid if index_size == 0 */
+ char _pad:5; /**< padding for memcmp */
unsigned start_instance; /**< first instance id */
unsigned instance_count; /**< number of instances */
if (!index_bounds_valid && st->draw_needs_minmax_index) {
vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
nr_prims);
+ index_bounds_valid = true;
}
info.index_size = 1 << ib->index_size_shift;
+ info.index_bounds_valid = index_bounds_valid;
info.min_index = min_index;
info.max_index = max_index;
st_validate_state(st, ST_PIPELINE_RENDER);
- if (ib && !index_bounds_valid)
+ if (ib && !index_bounds_valid) {
vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, nr_prims);
+ index_bounds_valid = true;
+ }
/* must get these after state validation! */
struct st_common_variant_key key;
}
info.index_size = index_size;
+ info.index_bounds_valid = index_bounds_valid;
info.min_index = min_index;
info.max_index = max_index;
info.has_user_indices = true;