mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
gallium: remove dead code from draw_vf*
This commit is contained in:
parent
09059259be
commit
5abc8d9e23
6 changed files with 9 additions and 574 deletions
2
src/mesa/pipe/draw/Makefile
Normal file
2
src/mesa/pipe/draw/Makefile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
default:
|
||||
cd .. ; make
|
||||
|
|
@ -625,7 +625,7 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
|
|||
|
||||
vbuf->prim = ~0;
|
||||
|
||||
vbuf->vf = draw_vf_create(FALSE);
|
||||
vbuf->vf = draw_vf_create();
|
||||
if(!vbuf->vf)
|
||||
vbuf_destroy(&vbuf->stage);
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,6 @@ unsigned draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
|
|||
vf->attr[j].attrib = map[i].attrib;
|
||||
vf->attr[j].format = format;
|
||||
vf->attr[j].insert = draw_vf_format_info[format].insert;
|
||||
vf->attr[j].extract = draw_vf_format_info[format].extract;
|
||||
vf->attr[j].vertattrsize = draw_vf_format_info[format].attrsize;
|
||||
vf->attr[j].vertoffset = offset;
|
||||
|
||||
|
|
@ -201,41 +200,6 @@ unsigned draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
|
|||
|
||||
|
||||
|
||||
void draw_vf_set_vp_matrix( struct draw_vertex_fetch *vf,
|
||||
const float *viewport )
|
||||
{
|
||||
assert(vf->allow_viewport_emits);
|
||||
|
||||
/* scale */
|
||||
vf->vp[0] = viewport[MAT_SX];
|
||||
vf->vp[1] = viewport[MAT_SY];
|
||||
vf->vp[2] = viewport[MAT_SZ];
|
||||
vf->vp[3] = 1.0;
|
||||
|
||||
/* translate */
|
||||
vf->vp[4] = viewport[MAT_TX];
|
||||
vf->vp[5] = viewport[MAT_TY];
|
||||
vf->vp[6] = viewport[MAT_TZ];
|
||||
vf->vp[7] = 0.0;
|
||||
}
|
||||
|
||||
void draw_vf_set_vp_scale_translate( struct draw_vertex_fetch *vf,
|
||||
const float *scale,
|
||||
const float *translate )
|
||||
{
|
||||
assert(vf->allow_viewport_emits);
|
||||
|
||||
vf->vp[0] = scale[0];
|
||||
vf->vp[1] = scale[1];
|
||||
vf->vp[2] = scale[2];
|
||||
vf->vp[3] = scale[3];
|
||||
|
||||
vf->vp[4] = translate[0];
|
||||
vf->vp[5] = translate[1];
|
||||
vf->vp[6] = translate[2];
|
||||
vf->vp[7] = translate[3];
|
||||
}
|
||||
|
||||
|
||||
/* Set attribute pointers, adjusted for start position:
|
||||
*/
|
||||
|
|
@ -288,39 +252,10 @@ void draw_vf_emit_vertices( struct draw_vertex_fetch *vf,
|
|||
}
|
||||
|
||||
|
||||
/* Extract a named attribute from a hardware vertex. Will have to
|
||||
* reverse any viewport transformation, swizzling or other conversions
|
||||
* which may have been applied.
|
||||
*
|
||||
* This is mainly required for on-the-fly vertex translations to
|
||||
* swrast format.
|
||||
*/
|
||||
void draw_vf_get_attr( struct draw_vertex_fetch *vf,
|
||||
const void *vertex,
|
||||
GLenum attr,
|
||||
const float *dflt,
|
||||
float *dest )
|
||||
{
|
||||
const struct draw_vf_attr *a = vf->attr;
|
||||
const unsigned attr_count = vf->attr_count;
|
||||
unsigned j;
|
||||
|
||||
for (j = 0; j < attr_count; j++) {
|
||||
if (a[j].attrib == attr) {
|
||||
a[j].extract( &a[j], dest, (uint8_t *)vertex + a[j].vertoffset );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Else return the value from ctx->Current.
|
||||
*/
|
||||
_mesa_memcpy( dest, dflt, 4*sizeof(float));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct draw_vertex_fetch *draw_vf_create( boolean allow_viewport_emits )
|
||||
struct draw_vertex_fetch *draw_vf_create( void )
|
||||
{
|
||||
struct draw_vertex_fetch *vf = CALLOC_STRUCT(draw_vertex_fetch);
|
||||
unsigned i;
|
||||
|
|
@ -328,29 +263,6 @@ struct draw_vertex_fetch *draw_vf_create( boolean allow_viewport_emits )
|
|||
for (i = 0; i < DRAW_VF_ATTRIB_MAX; i++)
|
||||
vf->attr[i].vf = vf;
|
||||
|
||||
vf->allow_viewport_emits = allow_viewport_emits;
|
||||
|
||||
switch(CHAN_TYPE) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
vf->chan_scale[0] = 255.0;
|
||||
vf->chan_scale[1] = 255.0;
|
||||
vf->chan_scale[2] = 255.0;
|
||||
vf->chan_scale[3] = 255.0;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
vf->chan_scale[0] = 65535.0;
|
||||
vf->chan_scale[1] = 65535.0;
|
||||
vf->chan_scale[2] = 65535.0;
|
||||
vf->chan_scale[3] = 65535.0;
|
||||
break;
|
||||
default:
|
||||
vf->chan_scale[0] = 1.0;
|
||||
vf->chan_scale[1] = 1.0;
|
||||
vf->chan_scale[2] = 1.0;
|
||||
vf->chan_scale[3] = 1.0;
|
||||
break;
|
||||
}
|
||||
|
||||
vf->identity[0] = 0.0;
|
||||
vf->identity[1] = 0.0;
|
||||
vf->identity[2] = 0.0;
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ enum draw_vf_attr_format {
|
|||
DRAW_EMIT_2F,
|
||||
DRAW_EMIT_3F,
|
||||
DRAW_EMIT_4F,
|
||||
DRAW_EMIT_2F_VIEWPORT, /**< do viewport transform and emit */
|
||||
DRAW_EMIT_3F_VIEWPORT, /**< do viewport transform and emit */
|
||||
DRAW_EMIT_4F_VIEWPORT, /**< do viewport transform and emit */
|
||||
DRAW_EMIT_3F_XYW, /**< for projective texture */
|
||||
DRAW_EMIT_1UB_1F, /**< for fog coordinate */
|
||||
DRAW_EMIT_3UB_3F_RGB, /**< for specular color */
|
||||
|
|
@ -84,7 +81,6 @@ enum draw_vf_attr_format {
|
|||
DRAW_EMIT_4UB_4F_BGRA, /**< for color */
|
||||
DRAW_EMIT_4UB_4F_ARGB, /**< for color */
|
||||
DRAW_EMIT_4UB_4F_ABGR, /**< for color */
|
||||
DRAW_EMIT_4CHAN_4F_RGBA, /**< for swrast color */
|
||||
DRAW_EMIT_PAD, /**< leave a hole of 'offset' bytes */
|
||||
DRAW_EMIT_MAX
|
||||
};
|
||||
|
|
@ -98,14 +94,6 @@ struct draw_vf_attr_map {
|
|||
struct draw_vertex_fetch;
|
||||
|
||||
|
||||
void
|
||||
draw_vf_set_vp_matrix( struct draw_vertex_fetch *vf,
|
||||
const float *viewport );
|
||||
|
||||
void
|
||||
draw_vf_set_vp_scale_translate( struct draw_vertex_fetch *vf,
|
||||
const float *scale,
|
||||
const float *translate );
|
||||
|
||||
unsigned
|
||||
draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
|
||||
|
|
@ -135,7 +123,7 @@ draw_vf_get_attr( struct draw_vertex_fetch *vf,
|
|||
float *dest );
|
||||
|
||||
struct draw_vertex_fetch *
|
||||
draw_vf_create( boolean allow_viewport_emits );
|
||||
draw_vf_create( void );
|
||||
|
||||
void
|
||||
draw_vf_destroy( struct draw_vertex_fetch *vf );
|
||||
|
|
@ -196,9 +184,6 @@ struct draw_vertex_fetch
|
|||
|
||||
/* Parameters and constants for codegen:
|
||||
*/
|
||||
boolean allow_viewport_emits;
|
||||
float vp[8];
|
||||
float chan_scale[4];
|
||||
float identity[4];
|
||||
|
||||
struct draw_vf_fastpath *fastpath;
|
||||
|
|
@ -244,7 +229,6 @@ draw_vf_generate_sse_emit( struct draw_vertex_fetch *vf );
|
|||
|
||||
struct draw_vf_format_info {
|
||||
const char *name;
|
||||
draw_vf_extract_func extract;
|
||||
draw_vf_insert_func insert[4];
|
||||
const unsigned attrsize;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,125 +36,6 @@
|
|||
#include "draw_vf.h"
|
||||
|
||||
|
||||
/*
|
||||
* These functions take the NDC coordinates pointed to by 'in', apply the
|
||||
* NDC->Viewport mapping and store the results at 'v'.
|
||||
*/
|
||||
|
||||
static INLINE void insert_4f_viewport_4( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = scale[1] * in[1] + trans[1];
|
||||
out[2] = scale[2] * in[2] + trans[2];
|
||||
out[3] = in[3];
|
||||
}
|
||||
|
||||
static INLINE void insert_4f_viewport_3( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = scale[1] * in[1] + trans[1];
|
||||
out[2] = scale[2] * in[2] + trans[2];
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static INLINE void insert_4f_viewport_2( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = scale[1] * in[1] + trans[1];
|
||||
out[2] = trans[2];
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static INLINE void insert_4f_viewport_1( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = trans[1];
|
||||
out[2] = trans[2];
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static INLINE void insert_3f_viewport_3( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = scale[1] * in[1] + trans[1];
|
||||
out[2] = scale[2] * in[2] + trans[2];
|
||||
}
|
||||
|
||||
static INLINE void insert_3f_viewport_2( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = scale[1] * in[1] + trans[1];
|
||||
out[2] = scale[2] * in[2] + trans[2];
|
||||
}
|
||||
|
||||
static INLINE void insert_3f_viewport_1( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = trans[1];
|
||||
out[2] = trans[2];
|
||||
}
|
||||
|
||||
static INLINE void insert_2f_viewport_2( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = scale[1] * in[1] + trans[1];
|
||||
}
|
||||
|
||||
static INLINE void insert_2f_viewport_1( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
float *out = (float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = scale[0] * in[0] + trans[0];
|
||||
out[1] = trans[1];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* These functions do the same as above, except for the viewport mapping.
|
||||
*/
|
||||
|
||||
static INLINE void insert_4f_4( const struct draw_vf_attr *a, uint8_t *v, const float *in )
|
||||
{
|
||||
|
|
@ -278,50 +159,6 @@ static INLINE void insert_null( const struct draw_vf_attr *a, uint8_t *v, const
|
|||
(void) a; (void) v; (void) in;
|
||||
}
|
||||
|
||||
static INLINE void insert_4chan_4f_rgba_4( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
GLchan *c = (GLchan *)v;
|
||||
(void) a;
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[2], in[2]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[3], in[3]);
|
||||
}
|
||||
|
||||
static INLINE void insert_4chan_4f_rgba_3( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
GLchan *c = (GLchan *)v;
|
||||
(void) a;
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[2], in[2]);
|
||||
c[3] = CHAN_MAX;
|
||||
}
|
||||
|
||||
static INLINE void insert_4chan_4f_rgba_2( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
GLchan *c = (GLchan *)v;
|
||||
(void) a;
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]);
|
||||
c[2] = 0;
|
||||
c[3] = CHAN_MAX;
|
||||
}
|
||||
|
||||
static INLINE void insert_4chan_4f_rgba_1( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
GLchan *c = (GLchan *)v;
|
||||
(void) a;
|
||||
UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]);
|
||||
c[1] = 0;
|
||||
c[2] = 0;
|
||||
c[3] = CHAN_MAX;
|
||||
}
|
||||
|
||||
static INLINE void insert_4ub_4f_rgba_4( const struct draw_vf_attr *a, uint8_t *v,
|
||||
const float *in )
|
||||
{
|
||||
|
|
@ -545,291 +382,64 @@ static INLINE void insert_1ub_1f_1( const struct draw_vf_attr *a, uint8_t *v,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Functions to perform the reverse operations to the above, for
|
||||
* swrast translation and clip-interpolation.
|
||||
*
|
||||
* Currently always extracts a full 4 floats.
|
||||
*/
|
||||
|
||||
static void extract_4f_viewport( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
/* Although included for completeness, the position coordinate is
|
||||
* usually handled differently during clipping.
|
||||
*/
|
||||
out[0] = (in[0] - trans[0]) / scale[0];
|
||||
out[1] = (in[1] - trans[1]) / scale[1];
|
||||
out[2] = (in[2] - trans[2]) / scale[2];
|
||||
out[3] = in[3];
|
||||
}
|
||||
|
||||
static void extract_3f_viewport( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = (in[0] - trans[0]) / scale[0];
|
||||
out[1] = (in[1] - trans[1]) / scale[1];
|
||||
out[2] = (in[2] - trans[2]) / scale[2];
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
|
||||
static void extract_2f_viewport( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
const float *scale = a->vf->vp;
|
||||
const float *trans = a->vf->vp + 4;
|
||||
|
||||
out[0] = (in[0] - trans[0]) / scale[0];
|
||||
out[1] = (in[1] - trans[1]) / scale[1];
|
||||
out[2] = 0;
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
|
||||
static void extract_4f( const struct draw_vf_attr *a, float *out, const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
(void) a;
|
||||
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = in[2];
|
||||
out[3] = in[3];
|
||||
}
|
||||
|
||||
static void extract_3f_xyw( const struct draw_vf_attr *a, float *out, const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
(void) a;
|
||||
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = 0;
|
||||
out[3] = in[2];
|
||||
}
|
||||
|
||||
|
||||
static void extract_3f( const struct draw_vf_attr *a, float *out, const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
(void) a;
|
||||
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = in[2];
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
|
||||
static void extract_2f( const struct draw_vf_attr *a, float *out, const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
(void) a;
|
||||
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = 0;
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static void extract_1f( const struct draw_vf_attr *a, float *out, const uint8_t *v )
|
||||
{
|
||||
const float *in = (const float *)v;
|
||||
(void) a;
|
||||
|
||||
out[0] = in[0];
|
||||
out[1] = 0;
|
||||
out[2] = 0;
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static void extract_4chan_4f_rgba( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
GLchan *c = (GLchan *)v;
|
||||
(void) a;
|
||||
|
||||
out[0] = CHAN_TO_FLOAT(c[0]);
|
||||
out[1] = CHAN_TO_FLOAT(c[1]);
|
||||
out[2] = CHAN_TO_FLOAT(c[2]);
|
||||
out[3] = CHAN_TO_FLOAT(c[3]);
|
||||
}
|
||||
|
||||
static void extract_4ub_4f_rgba( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[0] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[1] = UBYTE_TO_FLOAT(v[1]);
|
||||
out[2] = UBYTE_TO_FLOAT(v[2]);
|
||||
out[3] = UBYTE_TO_FLOAT(v[3]);
|
||||
}
|
||||
|
||||
static void extract_4ub_4f_bgra( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[2] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[1] = UBYTE_TO_FLOAT(v[1]);
|
||||
out[0] = UBYTE_TO_FLOAT(v[2]);
|
||||
out[3] = UBYTE_TO_FLOAT(v[3]);
|
||||
}
|
||||
|
||||
static void extract_4ub_4f_argb( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[3] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[0] = UBYTE_TO_FLOAT(v[1]);
|
||||
out[1] = UBYTE_TO_FLOAT(v[2]);
|
||||
out[2] = UBYTE_TO_FLOAT(v[3]);
|
||||
}
|
||||
|
||||
static void extract_4ub_4f_abgr( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[3] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[2] = UBYTE_TO_FLOAT(v[1]);
|
||||
out[1] = UBYTE_TO_FLOAT(v[2]);
|
||||
out[0] = UBYTE_TO_FLOAT(v[3]);
|
||||
}
|
||||
|
||||
static void extract_3ub_3f_rgb( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[0] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[1] = UBYTE_TO_FLOAT(v[1]);
|
||||
out[2] = UBYTE_TO_FLOAT(v[2]);
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static void extract_3ub_3f_bgr( const struct draw_vf_attr *a, float *out,
|
||||
const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[2] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[1] = UBYTE_TO_FLOAT(v[1]);
|
||||
out[0] = UBYTE_TO_FLOAT(v[2]);
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
static void extract_1ub_1f( const struct draw_vf_attr *a, float *out, const uint8_t *v )
|
||||
{
|
||||
(void) a;
|
||||
out[0] = UBYTE_TO_FLOAT(v[0]);
|
||||
out[1] = 0;
|
||||
out[2] = 0;
|
||||
out[3] = 1;
|
||||
}
|
||||
|
||||
|
||||
const struct draw_vf_format_info draw_vf_format_info[DRAW_EMIT_MAX] =
|
||||
{
|
||||
{ "1f",
|
||||
extract_1f,
|
||||
{ insert_1f_1, insert_1f_1, insert_1f_1, insert_1f_1 },
|
||||
sizeof(float) },
|
||||
|
||||
{ "2f",
|
||||
extract_2f,
|
||||
{ insert_2f_1, insert_2f_2, insert_2f_2, insert_2f_2 },
|
||||
2 * sizeof(float) },
|
||||
|
||||
{ "3f",
|
||||
extract_3f,
|
||||
{ insert_3f_1, insert_3f_2, insert_3f_3, insert_3f_3 },
|
||||
3 * sizeof(float) },
|
||||
|
||||
{ "4f",
|
||||
extract_4f,
|
||||
{ insert_4f_1, insert_4f_2, insert_4f_3, insert_4f_4 },
|
||||
4 * sizeof(float) },
|
||||
|
||||
{ "2f_viewport",
|
||||
extract_2f_viewport,
|
||||
{ insert_2f_viewport_1, insert_2f_viewport_2, insert_2f_viewport_2,
|
||||
insert_2f_viewport_2 },
|
||||
2 * sizeof(float) },
|
||||
|
||||
{ "3f_viewport",
|
||||
extract_3f_viewport,
|
||||
{ insert_3f_viewport_1, insert_3f_viewport_2, insert_3f_viewport_3,
|
||||
insert_3f_viewport_3 },
|
||||
3 * sizeof(float) },
|
||||
|
||||
{ "4f_viewport",
|
||||
extract_4f_viewport,
|
||||
{ insert_4f_viewport_1, insert_4f_viewport_2, insert_4f_viewport_3,
|
||||
insert_4f_viewport_4 },
|
||||
4 * sizeof(float) },
|
||||
|
||||
{ "3f_xyw",
|
||||
extract_3f_xyw,
|
||||
{ insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_err,
|
||||
insert_3f_xyw_4 },
|
||||
3 * sizeof(float) },
|
||||
|
||||
{ "1ub_1f",
|
||||
extract_1ub_1f,
|
||||
{ insert_1ub_1f_1, insert_1ub_1f_1, insert_1ub_1f_1, insert_1ub_1f_1 },
|
||||
sizeof(uint8_t) },
|
||||
|
||||
{ "3ub_3f_rgb",
|
||||
extract_3ub_3f_rgb,
|
||||
{ insert_3ub_3f_rgb_1, insert_3ub_3f_rgb_2, insert_3ub_3f_rgb_3,
|
||||
insert_3ub_3f_rgb_3 },
|
||||
3 * sizeof(uint8_t) },
|
||||
|
||||
{ "3ub_3f_bgr",
|
||||
extract_3ub_3f_bgr,
|
||||
{ insert_3ub_3f_bgr_1, insert_3ub_3f_bgr_2, insert_3ub_3f_bgr_3,
|
||||
insert_3ub_3f_bgr_3 },
|
||||
3 * sizeof(uint8_t) },
|
||||
|
||||
{ "4ub_4f_rgba",
|
||||
extract_4ub_4f_rgba,
|
||||
{ insert_4ub_4f_rgba_1, insert_4ub_4f_rgba_2, insert_4ub_4f_rgba_3,
|
||||
insert_4ub_4f_rgba_4 },
|
||||
4 * sizeof(uint8_t) },
|
||||
|
||||
{ "4ub_4f_bgra",
|
||||
extract_4ub_4f_bgra,
|
||||
{ insert_4ub_4f_bgra_1, insert_4ub_4f_bgra_2, insert_4ub_4f_bgra_3,
|
||||
insert_4ub_4f_bgra_4 },
|
||||
4 * sizeof(uint8_t) },
|
||||
|
||||
{ "4ub_4f_argb",
|
||||
extract_4ub_4f_argb,
|
||||
{ insert_4ub_4f_argb_1, insert_4ub_4f_argb_2, insert_4ub_4f_argb_3,
|
||||
insert_4ub_4f_argb_4 },
|
||||
4 * sizeof(uint8_t) },
|
||||
|
||||
{ "4ub_4f_abgr",
|
||||
extract_4ub_4f_abgr,
|
||||
{ insert_4ub_4f_abgr_1, insert_4ub_4f_abgr_2, insert_4ub_4f_abgr_3,
|
||||
insert_4ub_4f_abgr_4 },
|
||||
4 * sizeof(uint8_t) },
|
||||
|
||||
{ "4chan_4f_rgba",
|
||||
extract_4chan_4f_rgba,
|
||||
{ insert_4chan_4f_rgba_1, insert_4chan_4f_rgba_2, insert_4chan_4f_rgba_3,
|
||||
insert_4chan_4f_rgba_4 },
|
||||
4 * sizeof(GLchan) },
|
||||
|
||||
{ "pad",
|
||||
NULL,
|
||||
{ NULL, NULL, NULL, NULL },
|
||||
0 }
|
||||
|
||||
|
|
@ -889,16 +499,10 @@ static void NAME( struct draw_vertex_fetch *vf, \
|
|||
insert_null, NAME)
|
||||
|
||||
|
||||
EMIT2(insert_3f_viewport_3, insert_4ub_4f_rgba_4, emit_viewport3_rgba4)
|
||||
EMIT2(insert_3f_viewport_3, insert_4ub_4f_bgra_4, emit_viewport3_bgra4)
|
||||
EMIT2(insert_3f_3, insert_4ub_4f_rgba_4, emit_xyz3_rgba4)
|
||||
|
||||
EMIT3(insert_4f_viewport_4, insert_4ub_4f_rgba_4, insert_2f_2, emit_viewport4_rgba4_st2)
|
||||
EMIT3(insert_4f_viewport_4, insert_4ub_4f_bgra_4, insert_2f_2, emit_viewport4_bgra4_st2)
|
||||
EMIT3(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, emit_xyzw4_rgba4_st2)
|
||||
|
||||
EMIT4(insert_4f_viewport_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_viewport4_rgba4_st2_st2)
|
||||
EMIT4(insert_4f_viewport_4, insert_4ub_4f_bgra_4, insert_2f_2, insert_2f_2, emit_viewport4_bgra4_st2_st2)
|
||||
EMIT4(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_xyzw4_rgba4_st2_st2)
|
||||
|
||||
|
||||
|
|
@ -914,42 +518,26 @@ void draw_vf_generate_hardwired_emit( struct draw_vertex_fetch *vf )
|
|||
*/
|
||||
switch (vf->attr_count) {
|
||||
case 2:
|
||||
if (vf->attr[0].do_insert == insert_3f_viewport_3) {
|
||||
if (vf->attr[1].do_insert == insert_4ub_4f_bgra_4)
|
||||
func = emit_viewport3_bgra4;
|
||||
else if (vf->attr[1].do_insert == insert_4ub_4f_rgba_4)
|
||||
func = emit_viewport3_rgba4;
|
||||
}
|
||||
else if (vf->attr[0].do_insert == insert_3f_3 &&
|
||||
vf->attr[1].do_insert == insert_4ub_4f_rgba_4) {
|
||||
if (vf->attr[0].do_insert == insert_3f_3 &&
|
||||
vf->attr[1].do_insert == insert_4ub_4f_rgba_4) {
|
||||
func = emit_xyz3_rgba4;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (vf->attr[2].do_insert == insert_2f_2) {
|
||||
if (vf->attr[1].do_insert == insert_4ub_4f_rgba_4) {
|
||||
if (vf->attr[0].do_insert == insert_4f_viewport_4)
|
||||
func = emit_viewport4_rgba4_st2;
|
||||
else if (vf->attr[0].do_insert == insert_4f_4)
|
||||
if (vf->attr[0].do_insert == insert_4f_4)
|
||||
func = emit_xyzw4_rgba4_st2;
|
||||
}
|
||||
else if (vf->attr[1].do_insert == insert_4ub_4f_bgra_4 &&
|
||||
vf->attr[0].do_insert == insert_4f_viewport_4)
|
||||
func = emit_viewport4_bgra4_st2;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (vf->attr[2].do_insert == insert_2f_2 &&
|
||||
vf->attr[3].do_insert == insert_2f_2) {
|
||||
if (vf->attr[1].do_insert == insert_4ub_4f_rgba_4) {
|
||||
if (vf->attr[0].do_insert == insert_4f_viewport_4)
|
||||
func = emit_viewport4_rgba4_st2_st2;
|
||||
else if (vf->attr[0].do_insert == insert_4f_4)
|
||||
if (vf->attr[0].do_insert == insert_4f_4)
|
||||
func = emit_xyzw4_rgba4_st2_st2;
|
||||
}
|
||||
else if (vf->attr[1].do_insert == insert_4ub_4f_bgra_4 &&
|
||||
vf->attr[0].do_insert == insert_4f_viewport_4)
|
||||
func = emit_viewport4_bgra4_st2_st2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,13 +369,6 @@ static boolean build_vertex_emit( struct x86_program *p )
|
|||
x86_mov(&p->func, vfESI, x86_fn_arg(&p->func, 1));
|
||||
|
||||
|
||||
/* Possibly load vp0, vp1 for viewport calcs:
|
||||
*/
|
||||
if (vf->allow_viewport_emits) {
|
||||
sse_movups(&p->func, vp0, x86_make_disp(vfESI, get_offset(vf, &vf->vp[0])));
|
||||
sse_movups(&p->func, vp1, x86_make_disp(vfESI, get_offset(vf, &vf->vp[4])));
|
||||
}
|
||||
|
||||
/* always load, needed or not:
|
||||
*/
|
||||
sse_movups(&p->func, p->chan0, x86_make_disp(vfESI, get_offset(vf, &vf->chan_scale[0])));
|
||||
|
|
@ -439,30 +432,6 @@ static boolean build_vertex_emit( struct x86_program *p )
|
|||
emit_store(p, dest, 4, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case DRAW_EMIT_2F_VIEWPORT:
|
||||
get_src_ptr(p, srcECX, vfESI, a);
|
||||
emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize);
|
||||
sse_mulps(&p->func, temp, vp0);
|
||||
sse_addps(&p->func, temp, vp1);
|
||||
emit_store(p, dest, 2, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case DRAW_EMIT_3F_VIEWPORT:
|
||||
get_src_ptr(p, srcECX, vfESI, a);
|
||||
emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize);
|
||||
sse_mulps(&p->func, temp, vp0);
|
||||
sse_addps(&p->func, temp, vp1);
|
||||
emit_store(p, dest, 3, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case DRAW_EMIT_4F_VIEWPORT:
|
||||
get_src_ptr(p, srcECX, vfESI, a);
|
||||
emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize);
|
||||
sse_mulps(&p->func, temp, vp0);
|
||||
sse_addps(&p->func, temp, vp1);
|
||||
emit_store(p, dest, 4, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case DRAW_EMIT_3F_XYW:
|
||||
get_src_ptr(p, srcECX, vfESI, a);
|
||||
emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize);
|
||||
|
|
@ -561,26 +530,6 @@ static boolean build_vertex_emit( struct x86_program *p )
|
|||
emit_pack_store_4ub(p, dest, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case DRAW_EMIT_4CHAN_4F_RGBA:
|
||||
switch (CHAN_TYPE) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
get_src_ptr(p, srcECX, vfESI, a);
|
||||
emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize);
|
||||
emit_pack_store_4ub(p, dest, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
get_src_ptr(p, srcECX, vfESI, a);
|
||||
emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize);
|
||||
emit_store(p, dest, 4, temp);
|
||||
update_src_ptr(p, srcECX, vfESI, a);
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
default:
|
||||
_mesa_printf("unknown CHAN_TYPE %s\n", _mesa_lookup_enum_by_nr(CHAN_TYPE));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_mesa_printf("unknown a[%d].format %d\n", j, a->format);
|
||||
return FALSE; /* catch any new opcodes */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue