#define FETCH_MAX 256
#define DRAW_MAX (16*1024)
+
struct vcache_frontend {
struct draw_pt_front_end base;
struct draw_context *draw;
unsigned opt;
};
+
static INLINE void
vcache_flush( struct vcache_frontend *vcache )
{
vcache->draw_count = 0;
}
+
static INLINE void
vcache_check_flush( struct vcache_frontend *vcache )
{
- if ( vcache->draw_count + 6 >= DRAW_MAX ||
- vcache->fetch_count + 4 >= FETCH_MAX )
- {
+ if (vcache->draw_count + 6 >= DRAW_MAX ||
+ vcache->fetch_count + 4 >= FETCH_MAX) {
vcache_flush( vcache );
}
}
vcache_check_flush(vcache);
}
+
static INLINE void
vcache_line( struct vcache_frontend *vcache,
unsigned i0,
vcache_check_flush(vcache);
}
+
static INLINE void
vcache_quad( struct vcache_frontend *vcache,
unsigned i0,
}
}
+
static INLINE void
vcache_ef_quad( struct vcache_frontend *vcache,
unsigned i0,
}
}
+
/* At least for now, we're back to using a template include file for
* this. The two paths aren't too different though - it may be
* possible to reunify them.
ushort *dest )
{
unsigned i;
-
for (i = 0; i < count; i++)
dest[i] = (ushort)(src[i] + delta);
}
+
static INLINE void
rebase_ushort_elts( const ushort *src,
unsigned count,
int delta,
- ushort *dest )
+ ushort *dest )
{
unsigned i;
-
for (i = 0; i < count; i++)
dest[i] = (ushort)(src[i] + delta);
}
+
static INLINE void
rebase_ubyte_elts( const ubyte *src,
unsigned count,
ushort *dest )
{
unsigned i;
-
for (i = 0; i < count; i++)
dest[i] = (ushort)(src[i] + delta);
}
-
static INLINE void
translate_uint_elts( const unsigned *src,
unsigned count,
ushort *dest )
{
unsigned i;
-
for (i = 0; i < count; i++)
dest[i] = (ushort)(src[i]);
}
+
static INLINE void
translate_ushort_elts( const ushort *src,
unsigned count,
ushort *dest )
{
unsigned i;
-
for (i = 0; i < count; i++)
dest[i] = (ushort)(src[i]);
}
+
static INLINE void
translate_ubyte_elts( const ubyte *src,
unsigned count,
ushort *dest )
{
unsigned i;
-
for (i = 0; i < count; i++)
dest[i] = (ushort)(src[i]);
}
}
#endif
+
static INLINE void
vcache_check_run( struct draw_pt_front_end *frontend,
pt_elt_func get_elt,
&vcache->fetch_max );
}
-
assert((elt_bias >= 0 && min_index + elt_bias >= min_index) ||
(elt_bias < 0 && min_index + elt_bias < min_index));
if (min_index == 0 &&
- index_size == 2)
- {
+ index_size == 2) {
transformed_elts = (const ushort *)elts;
}
- else
- {
+ else {
storage = MALLOC( draw_count * sizeof(ushort) );
if (!storage)
goto fail;
switch(index_size) {
case 1:
rebase_ubyte_elts( (const ubyte *)elts,
- draw_count,
- 0 - (int)min_index,
- storage );
+ draw_count,
+ 0 - (int)min_index,
+ storage );
break;
case 2:
rebase_ushort_elts( (const ushort *)elts,
- draw_count,
- 0 - (int)min_index,
- storage );
+ draw_count,
+ 0 - (int)min_index,
+ storage );
break;
case 4:
rebase_uint_elts( (const uint *)elts,
- draw_count,
- 0 - (int)min_index,
- storage );
+ draw_count,
+ 0 - (int)min_index,
+ storage );
break;
default:
debug_printf("failed to execute atomic draw elts for %d/%d, splitting up\n",
fetch_count, draw_count);
- fail:
+fail:
vcache_run( frontend, get_elt, elts, elt_bias, draw_count );
}
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
- if (opt & PT_PIPELINE)
- {
+ if (opt & PT_PIPELINE) {
vcache->base.run = vcache_run_extras;
}
- else
- {
+ else {
vcache->base.run = vcache_check_run;
}
/* Have to run prepare here, but try and guess a good prim for
* doing so:
*/
- vcache->middle_prim = (opt & PT_PIPELINE) ? vcache->output_prim : vcache->input_prim;
+ vcache->middle_prim = (opt & PT_PIPELINE)
+ ? vcache->output_prim : vcache->input_prim;
+
middle->prepare( middle,
vcache->middle_prim,
opt, &vcache->fetch_max );
}
-
-
static void
vcache_finish( struct draw_pt_front_end *frontend )
{
vcache->middle = NULL;
}
+
static void
vcache_destroy( struct draw_pt_front_end *frontend )
{