Merge branch 'gallium-0.1' into gallium-tex-surfaces

This commit is contained in:
Keith Whitwell 2008-05-02 12:00:13 +01:00
commit c3a8a41faa
46 changed files with 413 additions and 409 deletions

View File

@ -24,6 +24,7 @@ headers in general, should stricly follow these guidelines to ensure
* Don't use variable number of macro arguments. Use static inline functions
instead.
* Don't use C99 features.
= Standard Library =
@ -42,3 +43,67 @@ portable way.
* Use the functions/macros in p_debug.h.
* Don't include assert.h, call abort, printf, etc.
= Code Style =
== Inherantice in C ==
The main thing we do is mimic inheritance by structure containment.
Here's a silly made-up example:
/* base class */
struct buffer
{
int size;
void (*validate)(struct buffer *buf);
};
/* sub-class of bufffer */
struct texture_buffer
{
struct buffer base; /* the base class, MUST COME FIRST! */
int format;
int width, height;
};
Then, we'll typically have cast-wrapper functions to convert base-class
pointers to sub-class pointers where needed:
static inline struct vertex_buffer *vertex_buffer(struct buffer *buf)
{
return (struct vertex_buffer *) buf;
}
To create/init a sub-classed object:
struct buffer *create_texture_buffer(int w, int h, int format)
{
struct texture_buffer *t = malloc(sizeof(*t));
t->format = format;
t->width = w;
t->height = h;
t->base.size = w * h;
t->base.validate = tex_validate;
return &t->base;
}
Example sub-class method:
void tex_validate(struct buffer *buf)
{
struct texture_buffer *tb = texture_buffer(buf);
assert(tb->format);
assert(tb->width);
assert(tb->height);
}
Note that we typically do not use typedefs to make "class names"; we use
'struct whatever' everywhere.
Gallium's pipe_context and the subclassed psb_context, etc are prime examples
of this. There's also many examples in Mesa and the Mesa state tracker.

View File

@ -256,7 +256,7 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
uint size = 4;
immed = tgsi_default_full_immediate();
immed.Immediate.Size = 1 + size; /* one for the token itself */
immed.u.ImmediateFloat32 = (struct tgsi_immediate_float32 *) value;
immed.u.Pointer = (void *) value;
ctx->emit_immediate(ctx, &immed);
}

View File

@ -200,7 +200,6 @@ static void varray_prepare(struct draw_pt_front_end *frontend,
unsigned opt)
{
struct varray_frontend *varray = (struct varray_frontend *)frontend;
const struct pipe_rasterizer_state *rasterizer = varray->draw->rasterizer;
if (opt & PT_PIPELINE)
{

View File

@ -225,7 +225,6 @@ static void vcache_prepare( struct draw_pt_front_end *frontend,
unsigned opt )
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
const struct pipe_rasterizer_state *rasterizer = vcache->draw->rasterizer;
if (opt & PT_PIPELINE)
{

View File

@ -51,17 +51,17 @@
#if SSE_SWIZZLES
typedef void (XSTDCALL *codegen_function) (
const struct tgsi_exec_vector *input,
struct tgsi_exec_vector *output,
float (*constant)[4],
struct tgsi_exec_vector *temporary,
float (*immediates)[4],
const float (*aos_input)[4],
uint num_inputs,
uint input_stride,
float (*aos_output)[4],
uint num_outputs,
uint output_stride );
const struct tgsi_exec_vector *input, /* 1 */
struct tgsi_exec_vector *output, /* 2 */
float (*constant)[4], /* 3 */
struct tgsi_exec_vector *temporary, /* 4 */
float (*immediates)[4], /* 5 */
const float (*aos_input)[4], /* 6 */
uint num_inputs, /* 7 */
uint input_stride, /* 8 */
float (*aos_output)[4], /* 9 */
uint num_outputs, /* 10 */
uint output_stride ); /* 11 */
#else
typedef void (XSTDCALL *codegen_function) (
const struct tgsi_exec_vector *input,

View File

@ -347,9 +347,9 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg )
return x86_make_reg( reg.file, reg.idx );
}
unsigned char *x86_get_label( struct x86_function *p )
int x86_get_label( struct x86_function *p )
{
return p->csr;
return p->csr - p->store;
}
@ -361,17 +361,22 @@ unsigned char *x86_get_label( struct x86_function *p )
void x86_jcc( struct x86_function *p,
enum x86_cc cc,
unsigned char *label )
int label )
{
intptr_t offset = pointer_to_intptr( label ) - (pointer_to_intptr( x86_get_label(p) ) + 2);
int offset = label - (x86_get_label(p) + 2);
DUMP_I(cc);
if (offset < 0) {
int amt = p->csr - p->store;
assert(amt > -offset);
}
if (offset <= 127 && offset >= -128) {
emit_1ub(p, 0x70 + cc);
emit_1b(p, (char) offset);
}
else {
offset = pointer_to_intptr( label ) - (pointer_to_intptr( x86_get_label(p) ) + 6);
offset = label - (x86_get_label(p) + 6);
emit_2ub(p, 0x0f, 0x80 + cc);
emit_1i(p, offset);
}
@ -379,8 +384,8 @@ void x86_jcc( struct x86_function *p,
/* Always use a 32bit offset for forward jumps:
*/
unsigned char *x86_jcc_forward( struct x86_function *p,
enum x86_cc cc )
int x86_jcc_forward( struct x86_function *p,
enum x86_cc cc )
{
DUMP_I(cc);
emit_2ub(p, 0x0f, 0x80 + cc);
@ -388,7 +393,7 @@ unsigned char *x86_jcc_forward( struct x86_function *p,
return x86_get_label(p);
}
unsigned char *x86_jmp_forward( struct x86_function *p)
int x86_jmp_forward( struct x86_function *p)
{
DUMP();
emit_1ub(p, 0xe9);
@ -396,7 +401,7 @@ unsigned char *x86_jmp_forward( struct x86_function *p)
return x86_get_label(p);
}
unsigned char *x86_call_forward( struct x86_function *p)
int x86_call_forward( struct x86_function *p)
{
DUMP();
@ -408,42 +413,24 @@ unsigned char *x86_call_forward( struct x86_function *p)
/* Fixup offset from forward jump:
*/
void x86_fixup_fwd_jump( struct x86_function *p,
unsigned char *fixup )
int fixup )
{
*(int *)(fixup - 4) = pointer_to_intptr( x86_get_label(p) ) - pointer_to_intptr( fixup );
*(int *)(p->store + fixup - 4) = x86_get_label(p) - fixup;
}
void x86_jmp( struct x86_function *p, unsigned char *label)
void x86_jmp( struct x86_function *p, int label)
{
DUMP_I( label );
emit_1ub(p, 0xe9);
emit_1i(p, pointer_to_intptr( label ) - pointer_to_intptr( x86_get_label(p) ) - 4);
emit_1i(p, label - x86_get_label(p) - 4);
}
#if 0
static unsigned char *cptr( void (*label)() )
{
return (unsigned char *) label;
}
/* This doesn't work once we start reallocating & copying the
* generated code on buffer fills, because the call is relative to the
* current pc.
*/
void x86_call( struct x86_function *p, void (*label)())
{
DUMP_I( label );
emit_1ub(p, 0xe8);
emit_1i(p, cptr(label) - x86_get_label(p) - 4);
}
#else
void x86_call( struct x86_function *p, struct x86_reg reg)
{
DUMP_R( reg );
emit_1ub(p, 0xff);
emit_modrm_noreg(p, 2, reg);
}
#endif
/* michal:
@ -462,8 +449,15 @@ void x86_push( struct x86_function *p,
struct x86_reg reg )
{
DUMP_R( reg );
assert(reg.mod == mod_REG);
emit_1ub(p, 0x50 + reg.idx);
if (reg.mod == mod_REG)
emit_1ub(p, 0x50 + reg.idx);
else
{
emit_1ub(p, 0xff);
emit_modrm_noreg(p, 6, reg);
}
p->stack_offset += 4;
}
@ -495,6 +489,7 @@ void x86_dec( struct x86_function *p,
void x86_ret( struct x86_function *p )
{
DUMP();
assert(p->stack_offset == 0);
emit_1ub(p, 0xc3);
}

View File

@ -124,23 +124,23 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg );
/* Labels, jumps and fixup:
*/
unsigned char *x86_get_label( struct x86_function *p );
int x86_get_label( struct x86_function *p );
void x86_jcc( struct x86_function *p,
enum x86_cc cc,
unsigned char *label );
int label );
unsigned char *x86_jcc_forward( struct x86_function *p,
int x86_jcc_forward( struct x86_function *p,
enum x86_cc cc );
unsigned char *x86_jmp_forward( struct x86_function *p);
int x86_jmp_forward( struct x86_function *p);
unsigned char *x86_call_forward( struct x86_function *p);
int x86_call_forward( struct x86_function *p);
void x86_fixup_fwd_jump( struct x86_function *p,
unsigned char *fixup );
int fixup );
void x86_jmp( struct x86_function *p, unsigned char *label );
void x86_jmp( struct x86_function *p, int label );
/* void x86_call( struct x86_function *p, void (*label)() ); */
void x86_call( struct x86_function *p, struct x86_reg reg);

View File

@ -209,6 +209,7 @@ remove_context_from_surface(struct sct_surface *si,
}
else {
prev = curr;
next = curr->next;
}
}
}

View File

@ -1530,41 +1530,44 @@ exec_instruction(
break;
case TGSI_OPCODE_EXP:
debug_printf("TGSI: EXP opcode not implemented\n");
/* from ARB_v_p:
tmp = ScalarLoad(op0);
result.x = 2^floor(tmp);
result.y = tmp - floor(tmp);
result.z = RoughApprox2ToX(tmp);
result.w = 1.0;
*/
#if 0
/* something like this: */
FETCH( &r[0], 0, CHAN_X );
micro_exp2( &r[0], &r[0] );
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
STORE( &r[0], 0, chan_index );
micro_flr( &r[1], &r[0] ); /* r1 = floor(r0) */
if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
micro_exp2( &r[2], &r[1] ); /* r2 = 2 ^ r1 */
STORE( &r[2], 0, CHAN_X ); /* store r2 */
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
micro_sub( &r[2], &r[0], &r[1] ); /* r2 = r0 - r1 */
STORE( &r[2], 0, CHAN_Y ); /* store r2 */
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
micro_exp2( &r[2], &r[0] ); /* r2 = 2 ^ r0 */
STORE( &r[2], 0, CHAN_Z ); /* store r2 */
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W );
}
#endif
break;
case TGSI_OPCODE_LOG:
debug_printf("TGSI: LOG opcode not implemented\n");
/* from ARB_v_p:
tmp = fabs(ScalarLoad(op0));
result.x = floor(log2(tmp));
result.y = tmp / 2^(floor(log2(tmp)));
result.z = RoughApproxLog2(tmp);
result.w = 1.0;
*/
#if 0
/* something like this: */
FETCH( &r[0], 0, CHAN_X );
micro_lg2( &r[0], &r[0] );
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
STORE( &r[0], 0, chan_index );
micro_abs( &r[2], &r[0] ); /* r2 = abs(r0) */
micro_lg2( &r[1], &r[2] ); /* r1 = lg2(r2) */
micro_flr( &r[0], &r[1] ); /* r0 = floor(r1) */
if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
STORE( &r[0], 0, CHAN_X );
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
micro_exp2( &r[0], &r[0] ); /* r0 = 2 ^ r0 */
micro_div( &r[0], &r[2], &r[0] ); /* r0 = r2 / r0 */
STORE( &r[0], 0, CHAN_Y );
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
STORE( &r[1], 0, CHAN_Z );
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W );
}
#endif
break;
case TGSI_OPCODE_MUL:

View File

@ -103,15 +103,9 @@ get_output_base( void )
static struct x86_reg
get_temp_base( void )
{
#ifdef WIN32
return x86_make_reg(
file_REG32,
reg_BX );
#else
return x86_make_reg(
file_REG32,
reg_SI );
#endif
}
static struct x86_reg
@ -133,14 +127,6 @@ get_immediate_base( void )
* Data access helpers.
*/
static struct x86_reg
get_argument(
unsigned index )
{
return x86_make_disp(
x86_make_reg( file_REG32, reg_SP ),
(index + 1) * 4 );
}
static struct x86_reg
get_immediate(
@ -455,19 +441,13 @@ emit_push_gp(
{
x86_push(
func,
get_const_base() );
x86_make_reg( file_REG32, reg_AX) );
x86_push(
func,
get_input_base() );
x86_make_reg( file_REG32, reg_CX) );
x86_push(
func,
get_output_base() );
/* It is important on non-win32 platforms that temp base is pushed last.
*/
x86_push(
func,
get_temp_base() );
x86_make_reg( file_REG32, reg_DX) );
}
static void
@ -478,16 +458,13 @@ x86_pop_gp(
*/
x86_pop(
func,
get_temp_base() );
x86_make_reg( file_REG32, reg_DX) );
x86_pop(
func,
get_output_base() );
x86_make_reg( file_REG32, reg_CX) );
x86_pop(
func,
get_input_base() );
x86_pop(
func,
get_const_base() );
x86_make_reg( file_REG32, reg_AX) );
}
static void
@ -504,19 +481,23 @@ emit_func_call_dst(
emit_push_gp(
func );
#ifdef WIN32
x86_push(
func,
get_temp( TEMP_R0, 0 ) );
#endif
{
struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX );
x86_lea(
func,
ecx,
get_temp( TEMP_R0, 0 ) );
x86_push( func, ecx );
x86_mov_reg_imm( func, ecx, (unsigned long) code );
x86_call( func, ecx );
#ifndef WIN32
x86_pop(func, ecx );
#endif
}
x86_pop_gp(
func );
@ -577,11 +558,7 @@ static void XSTDCALL
cos4f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = cosf( store[X + 0] );
store[X + 1] = cosf( store[X + 1] );
@ -604,11 +581,8 @@ static void XSTDCALL
ex24f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = powf( 2.0f, store[X + 0] );
store[X + 1] = powf( 2.0f, store[X + 1] );
store[X + 2] = powf( 2.0f, store[X + 2] );
@ -641,11 +615,8 @@ static void XSTDCALL
flr4f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = floorf( store[X + 0] );
store[X + 1] = floorf( store[X + 1] );
store[X + 2] = floorf( store[X + 2] );
@ -667,11 +638,8 @@ static void XSTDCALL
frc4f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] -= floorf( store[X + 0] );
store[X + 1] -= floorf( store[X + 1] );
store[X + 2] -= floorf( store[X + 2] );
@ -693,11 +661,8 @@ static void XSTDCALL
lg24f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = LOG2( store[X + 0] );
store[X + 1] = LOG2( store[X + 1] );
store[X + 2] = LOG2( store[X + 2] );
@ -755,11 +720,8 @@ static void XSTDCALL
pow4f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = powf( store[X + 0], store[X + 4] );
store[X + 1] = powf( store[X + 1], store[X + 5] );
store[X + 2] = powf( store[X + 2], store[X + 6] );
@ -800,11 +762,8 @@ static void XSTDCALL
rsqrt4f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = 1.0F / sqrtf( store[X + 0] );
store[X + 1] = 1.0F / sqrtf( store[X + 1] );
store[X + 2] = 1.0F / sqrtf( store[X + 2] );
@ -878,11 +837,8 @@ static void XSTDCALL
sin4f(
float *store )
{
#ifdef WIN32
const unsigned X = 0;
#else
const unsigned X = TEMP_R0 * 16;
#endif
store[X + 0] = sinf( store[X + 0] );
store[X + 1] = sinf( store[X + 1] );
store[X + 2] = sinf( store[X + 2] );
@ -1234,11 +1190,16 @@ emit_instruction(
switch( inst->Instruction.Opcode ) {
case TGSI_OPCODE_ARL:
#if 0
/* XXX this isn't working properly (see glean vertProg1 test) */
FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( func, *inst, 0, 0, chan_index );
emit_f2it( func, 0 );
STORE( func, *inst, 0, 0, chan_index );
}
#else
return 0;
#endif
break;
case TGSI_OPCODE_MOV:
@ -2029,40 +1990,40 @@ emit_declaration(
}
}
static void aos_to_soa( struct x86_function *func, uint aos, uint soa, uint num, uint stride )
static void aos_to_soa( struct x86_function *func,
uint arg_aos,
uint arg_soa,
uint arg_num,
uint arg_stride )
{
struct x86_reg soa_input;
struct x86_reg aos_input;
struct x86_reg num_inputs;
struct x86_reg temp;
unsigned char *inner_loop;
struct x86_reg soa_input = x86_make_reg( file_REG32, reg_AX );
struct x86_reg aos_input = x86_make_reg( file_REG32, reg_BX );
struct x86_reg num_inputs = x86_make_reg( file_REG32, reg_CX );
struct x86_reg stride = x86_make_reg( file_REG32, reg_DX );
int inner_loop;
soa_input = x86_make_reg( file_REG32, reg_AX );
aos_input = x86_make_reg( file_REG32, reg_BX );
num_inputs = x86_make_reg( file_REG32, reg_CX );
temp = x86_make_reg( file_REG32, reg_DX );
/* Save EBX */
x86_push( func, x86_make_reg( file_REG32, reg_BX ) );
x86_mov( func, soa_input, get_argument( soa + 1 ) );
x86_mov( func, aos_input, get_argument( aos + 1 ) );
x86_mov( func, num_inputs, get_argument( num + 1 ) );
x86_mov( func, aos_input, x86_fn_arg( func, arg_aos ) );
x86_mov( func, soa_input, x86_fn_arg( func, arg_soa ) );
x86_mov( func, num_inputs, x86_fn_arg( func, arg_num ) );
x86_mov( func, stride, x86_fn_arg( func, arg_stride ) );
/* do */
inner_loop = x86_get_label( func );
{
x86_mov( func, temp, get_argument( stride + 1 ) );
x86_push( func, aos_input );
sse_movlps( func, make_xmm( 0 ), x86_make_disp( aos_input, 0 ) );
sse_movlps( func, make_xmm( 3 ), x86_make_disp( aos_input, 8 ) );
x86_add( func, aos_input, temp );
x86_add( func, aos_input, stride );
sse_movhps( func, make_xmm( 0 ), x86_make_disp( aos_input, 0 ) );
sse_movhps( func, make_xmm( 3 ), x86_make_disp( aos_input, 8 ) );
x86_add( func, aos_input, temp );
x86_add( func, aos_input, stride );
sse_movlps( func, make_xmm( 1 ), x86_make_disp( aos_input, 0 ) );
sse_movlps( func, make_xmm( 4 ), x86_make_disp( aos_input, 8 ) );
x86_add( func, aos_input, temp );
x86_add( func, aos_input, stride );
sse_movhps( func, make_xmm( 1 ), x86_make_disp( aos_input, 0 ) );
sse_movhps( func, make_xmm( 4 ), x86_make_disp( aos_input, 8 ) );
x86_pop( func, aos_input );
@ -2088,7 +2049,7 @@ static void aos_to_soa( struct x86_function *func, uint aos, uint soa, uint num,
x86_jcc( func, cc_NE, inner_loop );
/* Restore EBX */
x86_pop( func, x86_make_reg( file_REG32, reg_BX ) );
x86_pop( func, aos_input );
}
static void soa_to_aos( struct x86_function *func, uint aos, uint soa, uint num, uint stride )
@ -2097,7 +2058,7 @@ static void soa_to_aos( struct x86_function *func, uint aos, uint soa, uint num,
struct x86_reg aos_output;
struct x86_reg num_outputs;
struct x86_reg temp;
unsigned char *inner_loop;
int inner_loop;
soa_output = x86_make_reg( file_REG32, reg_AX );
aos_output = x86_make_reg( file_REG32, reg_BX );
@ -2105,11 +2066,11 @@ static void soa_to_aos( struct x86_function *func, uint aos, uint soa, uint num,
temp = x86_make_reg( file_REG32, reg_DX );
/* Save EBX */
x86_push( func, x86_make_reg( file_REG32, reg_BX ) );
x86_push( func, aos_output );
x86_mov( func, soa_output, get_argument( soa + 1 ) );
x86_mov( func, aos_output, get_argument( aos + 1 ) );
x86_mov( func, num_outputs, get_argument( num + 1 ) );
x86_mov( func, soa_output, x86_fn_arg( func, soa ) );
x86_mov( func, aos_output, x86_fn_arg( func, aos ) );
x86_mov( func, num_outputs, x86_fn_arg( func, num ) );
/* do */
inner_loop = x86_get_label( func );
@ -2126,7 +2087,7 @@ static void soa_to_aos( struct x86_function *func, uint aos, uint soa, uint num,
sse_unpcklps( func, make_xmm( 3 ), make_xmm( 4 ) );
sse_unpckhps( func, make_xmm( 5 ), make_xmm( 4 ) );
x86_mov( func, temp, get_argument( stride + 1 ) );
x86_mov( func, temp, x86_fn_arg( func, stride ) );
x86_push( func, aos_output );
sse_movlps( func, x86_make_disp( aos_output, 0 ), make_xmm( 0 ) );
sse_movlps( func, x86_make_disp( aos_output, 8 ), make_xmm( 3 ) );
@ -2150,7 +2111,7 @@ static void soa_to_aos( struct x86_function *func, uint aos, uint soa, uint num,
x86_jcc( func, cc_NE, inner_loop );
/* Restore EBX */
x86_pop( func, x86_make_reg( file_REG32, reg_BX ) );
x86_pop( func, aos_output );
}
/**
@ -2185,6 +2146,17 @@ tgsi_emit_sse2(
tgsi_parse_init( &parse, tokens );
/* Can't just use EDI, EBX without save/restoring them:
*/
x86_push(
func,
get_immediate_base() );
x86_push(
func,
get_temp_base() );
/*
* Different function args for vertex/fragment shaders:
*/
@ -2193,51 +2165,55 @@ tgsi_emit_sse2(
x86_mov(
func,
get_input_base(),
get_argument( 0 ) );
x86_fn_arg( func, 1 ) );
/* skipping outputs argument here */
x86_mov(
func,
get_const_base(),
get_argument( 2 ) );
x86_fn_arg( func, 3 ) );
x86_mov(
func,
get_temp_base(),
get_argument( 3 ) );
x86_fn_arg( func, 4 ) );
x86_mov(
func,
get_coef_base(),
get_argument( 4 ) );
x86_fn_arg( func, 5 ) );
x86_mov(
func,
get_immediate_base(),
get_argument( 5 ) );
x86_fn_arg( func, 6 ) );
}
else {
assert(parse.FullHeader.Processor.Processor == TGSI_PROCESSOR_VERTEX);
if (do_swizzles)
aos_to_soa( func, 5, 0, 6, 7 );
aos_to_soa( func,
6, /* aos_input */
1, /* machine->input */
7, /* num_inputs */
8 ); /* input_stride */
x86_mov(
func,
get_input_base(),
get_argument( 0 ) );
x86_fn_arg( func, 1 ) );
x86_mov(
func,
get_output_base(),
get_argument( 1 ) );
x86_fn_arg( func, 2 ) );
x86_mov(
func,
get_const_base(),
get_argument( 2 ) );
x86_fn_arg( func, 3 ) );
x86_mov(
func,
get_temp_base(),
get_argument( 3 ) );
x86_fn_arg( func, 4 ) );
x86_mov(
func,
get_immediate_base(),
get_argument( 4 ) );
x86_fn_arg( func, 5 ) );
}
while( !tgsi_parse_end_of_tokens( &parse ) && ok ) {
@ -2260,7 +2236,7 @@ tgsi_emit_sse2(
x86_mov(
func,
get_output_base(),
get_argument( 1 ) );
x86_fn_arg( func, 2 ) );
}
}
@ -2307,9 +2283,19 @@ tgsi_emit_sse2(
if (parse.FullHeader.Processor.Processor == TGSI_PROCESSOR_VERTEX) {
if (do_swizzles)
soa_to_aos( func, 8, 1, 9, 10 );
soa_to_aos( func, 9, 2, 10, 11 );
}
/* Can't just use EBX, EDI without save/restoring them:
*/
x86_pop(
func,
get_temp_base() );
x86_pop(
func,
get_immediate_base() );
#ifdef WIN32
emit_retw( func, 16 );
#else

View File

@ -767,6 +767,31 @@ dump_instruction_short(
SID( dst->DstRegister.Index );
CHR( ']' );
switch (dst->DstRegisterExtModulate.Modulate) {
case TGSI_MODULATE_1X:
break;
case TGSI_MODULATE_2X:
TXT( "_2X" );
break;
case TGSI_MODULATE_4X:
TXT( "_4X" );
break;
case TGSI_MODULATE_8X:
TXT( "_8X" );
break;
case TGSI_MODULATE_HALF:
TXT( "_D2" );
break;
case TGSI_MODULATE_QUARTER:
TXT( "_D4" );
break;
case TGSI_MODULATE_EIGHTH:
TXT( "_D8" );
break;
default:
assert( 0 );
}
if( dst->DstRegister.WriteMask != TGSI_WRITEMASK_XYZW ) {
CHR( '.' );
if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_X ) {

View File

@ -43,7 +43,7 @@ tgsi_full_token_free(
union tgsi_full_token *full_token )
{
if( full_token->Token.Type == TGSI_TOKEN_TYPE_IMMEDIATE ) {
FREE( full_token->FullImmediate.u.Pointer );
FREE( (void *) full_token->FullImmediate.u.Pointer );
}
}
@ -156,7 +156,7 @@ tgsi_parse_token(
imm->u.Pointer = MALLOC(
sizeof( struct tgsi_immediate_float32 ) * (imm->Immediate.Size - 1) );
for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
next_token( ctx, &imm->u.ImmediateFloat32[i] );
next_token( ctx, (struct tgsi_immediate_float32 *) &imm->u.ImmediateFloat32[i] );
}
break;

View File

@ -52,8 +52,8 @@ struct tgsi_full_immediate
struct tgsi_immediate Immediate;
union
{
void *Pointer;
struct tgsi_immediate_float32 *ImmediateFloat32;
const void *Pointer;
const struct tgsi_immediate_float32 *ImmediateFloat32;
} u;
};

View File

@ -103,18 +103,14 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->file_max[file] = MAX2(info->file_max[file], (int)i);
if (file == TGSI_FILE_INPUT) {
info->input_semantic_name[info->num_inputs]
= (ubyte)fulldecl->Semantic.SemanticName;
info->input_semantic_index[info->num_inputs]
= (ubyte)fulldecl->Semantic.SemanticIndex;
info->input_semantic_name[i] = (ubyte)fulldecl->Semantic.SemanticName;
info->input_semantic_index[i] = (ubyte)fulldecl->Semantic.SemanticIndex;
info->num_inputs++;
}
if (file == TGSI_FILE_OUTPUT) {
info->output_semantic_name[info->num_outputs]
= (ubyte)fulldecl->Semantic.SemanticName;
info->output_semantic_index[info->num_outputs]
= (ubyte)fulldecl->Semantic.SemanticIndex;
info->output_semantic_name[i] = (ubyte)fulldecl->Semantic.SemanticName;
info->output_semantic_index[i] = (ubyte)fulldecl->Semantic.SemanticIndex;
info->num_outputs++;
}
@ -137,6 +133,9 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
}
}
assert( info->file_max[TGSI_FILE_INPUT] + 1 == info->num_inputs );
assert( info->file_max[TGSI_FILE_OUTPUT] + 1 == info->num_outputs );
info->uses_kill = (info->opcode_count[TGSI_OPCODE_KIL] ||
info->opcode_count[TGSI_OPCODE_KILP]);

View File

@ -404,7 +404,7 @@ static boolean build_vertex_emit( struct translate_sse *p,
struct x86_reg srcEAX = x86_make_reg(file_REG32, reg_CX);
struct x86_reg countEBP = x86_make_reg(file_REG32, reg_BP);
struct x86_reg translateESI = x86_make_reg(file_REG32, reg_SI);
uint8_t *fixup, *label;
int fixup, label;
unsigned j;
p->func = func;

View File

@ -422,4 +422,4 @@ void debug_print_format(const char *msg, unsigned fmt )
debug_printf("%s: %s\n", msg, fmtstr);
}
#endif
#endif

View File

@ -296,6 +296,8 @@ util_blit_pixels(struct blit_state *ctx,
src, srcLeft, srcTop, /* src */
srcW, srcH); /* size */
pipe->texture_update(pipe, tex, 0, 1 << 0);
/* save state (restored below) */
cso_save_blend(ctx->cso);
cso_save_depth_stencil_alpha(ctx->cso);

View File

@ -505,6 +505,9 @@ format_to_type_comps(enum pipe_format pformat,
return;
default:
assert(0);
*datatype = UBYTE;
*comps = 0;
break;
}
}

View File

@ -333,12 +333,11 @@ void
i915_disassemble_program(struct debug_stream *stream,
const unsigned * program, unsigned sz)
{
unsigned size = program[0] & 0x1ff;
unsigned i;
PRINTF(stream, "\t\tBEGIN\n");
assert(size + 2 == sz);
assert((program[0] & 0x1ff) + 2 == sz);
program++;
for (i = 1; i < sz; i += 3, program += 3) {

View File

@ -182,6 +182,7 @@ i915_is_format_supported( struct pipe_screen *screen,
break;
default:
assert(0);
return FALSE;
}
for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) {

View File

@ -122,7 +122,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
struct pipe_context *
softpipe_create( struct pipe_screen *screen,
struct pipe_winsys *pipe_winsys,
struct softpipe_winsys *softpipe_winsys )
void *unused )
{
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
uint i;
@ -212,8 +212,6 @@ softpipe_create( struct pipe_screen *screen,
softpipe->quad.colormask = sp_quad_colormask_stage(softpipe);
softpipe->quad.output = sp_quad_output_stage(softpipe);
softpipe->winsys = softpipe_winsys;
/*
* Create drawing context and plug our rendering stage into it.
*/

View File

@ -57,8 +57,6 @@ struct sp_vertex_shader;
struct softpipe_context {
struct pipe_context pipe; /**< base class */
struct softpipe_winsys *winsys; /**< window system interface */
/* The most recent drawing state as set by the driver:
*/

View File

@ -82,10 +82,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
void
softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
struct sp_fragment_shader *state = fs;
assert(fs != softpipe->fs);
assert(fs != softpipe_context(pipe)->fs);
state->delete( state );
}

View File

@ -59,7 +59,7 @@ struct pipe_context;
struct pipe_context *softpipe_create( struct pipe_screen *,
struct pipe_winsys *,
struct softpipe_winsys * );
void *unused );
struct pipe_screen *

View File

@ -37,6 +37,7 @@
#include "xmesaP.h"
#undef ASSERT
#undef Elements
#include "pipe/p_winsys.h"
#include "pipe/p_format.h"
@ -88,18 +89,6 @@ struct xmesa_surface
};
/**
* Derived from softpipe_winsys.
* We just need one extra field which indicates the pixel format to use for
* drawing surfaces so that we're compatible with the XVisual/window format.
*/
struct xmesa_softpipe_winsys
{
struct softpipe_winsys spws;
enum pipe_format pixelformat;
};
struct xmesa_pipe_winsys
{
struct pipe_winsys base;
@ -119,12 +108,7 @@ xmesa_surface(struct pipe_surface *ps)
return (struct xmesa_surface *) ps;
}
/** cast wrapper */
static INLINE struct xmesa_softpipe_winsys *
xmesa_softpipe_winsys(struct softpipe_winsys *spws)
{
return (struct xmesa_softpipe_winsys *) spws;
}
/**
* Turn the softpipe opaque buffer pointer into a dri_bufmgr opaque
@ -526,8 +510,7 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys,
/**
* Called via pipe->surface_alloc() to create new surfaces (textures,
* renderbuffers, etc.
* Called via winsys->surface_alloc() to create new surfaces.
*/
static struct pipe_surface *
xm_surface_alloc(struct pipe_winsys *ws)
@ -612,10 +595,19 @@ xmesa_get_pipe_winsys_aub(struct xmesa_visual *xm_vis)
{
static struct xmesa_pipe_winsys *ws = NULL;
if (!ws && getenv("XM_AUB")) {
if (!ws) {
ws = (struct xmesa_pipe_winsys *) xmesa_create_pipe_winsys_aub();
}
else if (!ws) {
return &ws->base;
}
struct pipe_winsys *
xmesa_get_pipe_winsys(struct xmesa_visual *xm_vis)
{
static struct xmesa_pipe_winsys *ws = NULL;
if (!ws) {
ws = CALLOC_STRUCT(xmesa_pipe_winsys);
ws->xm_visual = xm_vis;
@ -646,45 +638,19 @@ xmesa_get_pipe_winsys_aub(struct xmesa_visual *xm_vis)
}
/**
* Called via softpipe_winsys->is_format_supported().
* This function is only called to test formats for front/back color surfaces.
* The winsys being queried will have been created at glXCreateContext
* time, with a pixel format corresponding to the context's visual.
*/
static boolean
xmesa_is_format_supported(struct softpipe_winsys *sws,
enum pipe_format format)
{
struct xmesa_softpipe_winsys *xmws = xmesa_softpipe_winsys(sws);
return (format == xmws->pixelformat);
}
/**
* Return pointer to a softpipe_winsys object.
*/
static struct softpipe_winsys *
xmesa_get_softpipe_winsys(uint pixelformat)
{
struct xmesa_softpipe_winsys *xmws
= CALLOC_STRUCT(xmesa_softpipe_winsys);
if (!xmws)
return NULL;
xmws->spws.is_format_supported = xmesa_is_format_supported;
xmws->pixelformat = pixelformat;
return &xmws->spws;
}
struct pipe_context *
xmesa_create_pipe_context(XMesaContext xmesa, uint pixelformat)
{
struct pipe_winsys *pws = xmesa_get_pipe_winsys_aub(xmesa->xm_visual);
struct pipe_winsys *pws;
struct pipe_context *pipe;
if (getenv("XM_AUB")) {
pws = xmesa_get_pipe_winsys_aub(xmesa->xm_visual);
}
else {
pws = xmesa_get_pipe_winsys(xmesa->xm_visual);
}
#ifdef GALLIUM_CELL
if (!getenv("GALLIUM_NOCELL")) {
struct cell_winsys *cws = cell_get_winsys(pixelformat);
@ -695,10 +661,9 @@ xmesa_create_pipe_context(XMesaContext xmesa, uint pixelformat)
else
#endif
{
struct softpipe_winsys *spws = xmesa_get_softpipe_winsys(pixelformat);
struct pipe_screen *screen = softpipe_create_screen(pws);
pipe = softpipe_create(screen, pws, spws);
pipe = softpipe_create(screen, pws, NULL);
}
if (pipe)

10
src/mesa/main/context.c Normal file → Executable file
View File

@ -1504,15 +1504,19 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
* or not bound to a user-created FBO.
*/
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
/* fix up the fb fields - these will end up wrong otherwise
if the DRIdrawable changes, and everything relies on them.
This is a bit messy (same as needed in _mesa_BindFramebufferEXT) */
* if the DRIdrawable changes, and everything relies on them.
* This is a bit messy (same as needed in _mesa_BindFramebufferEXT)
*/
int i;
GLenum buffers[MAX_DRAW_BUFFERS];
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) {
buffers[i] = newCtx->Color.DrawBuffer[i];
}
_mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers, buffers, NULL);
}
if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {

View File

@ -223,15 +223,10 @@ update_blend( struct st_context *st )
const struct st_tracked_state st_update_blend = {
.name = "st_update_blend",
.dirty = {
.mesa = (_NEW_COLOR), /* XXX _NEW_BLEND someday? */
.st = 0,
"st_update_blend", /* name */
{ /* dirty */
(_NEW_COLOR), /* XXX _NEW_BLEND someday? */ /* mesa */
0, /* st */
},
.update = update_blend
update_blend, /* update */
};

View File

@ -62,15 +62,10 @@ static void update_clip( struct st_context *st )
const struct st_tracked_state st_update_clip = {
.name = "st_update_clip",
.dirty = {
.mesa = (_NEW_TRANSFORM),
.st = 0,
"st_update_clip", /* name */
{ /* dirty */
(_NEW_TRANSFORM), /* mesa */
0, /* st */
},
.update = update_clip
update_clip /* update */
};

View File

@ -113,12 +113,12 @@ static void update_vs_constants(struct st_context *st )
}
const struct st_tracked_state st_update_vs_constants = {
.name = "st_update_vs_constants",
.dirty = {
.mesa = 0, /* set dynamically above */
.st = ST_NEW_VERTEX_PROGRAM,
"st_update_vs_constants", /* name */
{ /* dirty */
0, /* set dynamically above */ /* mesa */
ST_NEW_VERTEX_PROGRAM, /* st */
},
.update = update_vs_constants
update_vs_constants /* update */
};
/* Fragment shader:
@ -132,11 +132,11 @@ static void update_fs_constants(struct st_context *st )
}
const struct st_tracked_state st_update_fs_constants = {
.name = "st_update_fs_constants",
.dirty = {
.mesa = 0, /* set dynamically above */
.st = ST_NEW_FRAGMENT_PROGRAM,
"st_update_fs_constants", /* name */
{ /* dirty */
0, /* set dynamically above */ /* mesa */
ST_NEW_FRAGMENT_PROGRAM, /* st */
},
.update = update_fs_constants
update_fs_constants /* update */
};

View File

@ -142,10 +142,10 @@ update_depth_stencil_alpha(struct st_context *st)
const struct st_tracked_state st_update_depth_stencil_alpha = {
.name = "st_update_depth_stencil",
.dirty = {
.mesa = (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR),
.st = 0,
"st_update_depth_stencil", /* name */
{ /* dirty */
(_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR), /* mesa */
0, /* st */
},
.update = update_depth_stencil_alpha
update_depth_stencil_alpha /* update */
};

View File

@ -55,12 +55,12 @@ static void update_tnl( struct st_context *st )
const struct st_tracked_state st_update_tnl = {
.name = "st_update_tnl",
.dirty = {
.mesa = TNL_FIXED_FUNCTION_STATE_FLAGS,
.st = 0
"st_update_tnl", /* name */
{ /* dirty */
TNL_FIXED_FUNCTION_STATE_FLAGS, /* mesa */
0 /* st */
},
.update = update_tnl
update_tnl /* update */
};

View File

@ -96,11 +96,11 @@ update_framebuffer_state( struct st_context *st )
const struct st_tracked_state st_update_framebuffer = {
.name = "st_update_framebuffer",
.dirty = {
.mesa = _NEW_BUFFERS,
.st = 0,
"st_update_framebuffer", /* name */
{ /* dirty */
_NEW_BUFFERS, /* mesa */
0, /* st */
},
.update = update_framebuffer_state
update_framebuffer_state /* update */
};

View File

@ -464,10 +464,10 @@ update_pixel_transfer(struct st_context *st)
const struct st_tracked_state st_update_pixel_transfer = {
.name = "st_update_pixel_transfer",
.dirty = {
.mesa = _NEW_PIXEL | _NEW_COLOR_MATRIX,
.st = 0,
"st_update_pixel_transfer", /* name */
{ /* dirty */
_NEW_PIXEL | _NEW_COLOR_MATRIX, /* mesa */
0, /* st */
},
.update = update_pixel_transfer
update_pixel_transfer /* update */
};

View File

@ -267,11 +267,11 @@ static void update_raster_state( struct st_context *st )
}
const struct st_tracked_state st_update_rasterizer = {
.name = "st_update_rasterizer",
.dirty = {
.mesa = (_NEW_LIGHT | _NEW_POLYGON | _NEW_LINE | _NEW_SCISSOR |
_NEW_POINT | _NEW_BUFFERS | _NEW_MULTISAMPLE),
.st = 0,
"st_update_rasterizer", /* name */
{ /* dirty */
(_NEW_LIGHT | _NEW_POLYGON | _NEW_LINE | _NEW_SCISSOR | /* mesa */
_NEW_POINT | _NEW_BUFFERS | _NEW_MULTISAMPLE),
0, /* st */
},
.update = update_raster_state
update_raster_state /* update */
};

View File

@ -37,6 +37,7 @@
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
#include "cso_cache/cso_context.h"
@ -147,17 +148,8 @@ update_samplers(struct st_context *st)
sampler->normalized_coords = 1;
sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias;
#if 1
sampler->min_lod = (texobj->MinLod) < 0.0 ? 0.0 : texobj->MinLod;
sampler->max_lod = texobj->MaxLod;
#else
/* min/max lod should really be as follows (untested).
* Also, calculate_first_last_level() needs to be overhauled
* since today's hardware had real support for LOD clamping.
*/
sampler->min_lod = MAX2(texobj->BaseLevel, texobj->MinLod);
sampler->max_lod = MIN2(texobj->MaxLevel, texobj->MaxLod);
#endif
sampler->border_color[0] = texobj->BorderColor[RCOMP];
sampler->border_color[1] = texobj->BorderColor[GCOMP];
@ -193,15 +185,10 @@ update_samplers(struct st_context *st)
const struct st_tracked_state st_update_sampler = {
.name = "st_update_sampler",
.dirty = {
.mesa = _NEW_TEXTURE,
.st = 0,
"st_update_sampler", /* name */
{ /* dirty */
_NEW_TEXTURE, /* mesa */
0, /* st */
},
.update = update_samplers
update_samplers /* update */
};

View File

@ -83,15 +83,10 @@ update_scissor( struct st_context *st )
const struct st_tracked_state st_update_scissor = {
.name = "st_update_scissor",
.dirty = {
.mesa = (_NEW_SCISSOR | _NEW_BUFFERS),
.st = 0,
"st_update_scissor", /* name */
{ /* dirty */
(_NEW_SCISSOR | _NEW_BUFFERS), /* mesa */
0, /* st */
},
.update = update_scissor
update_scissor /* update */
};

View File

@ -281,10 +281,10 @@ update_linkage( struct st_context *st )
const struct st_tracked_state st_update_shader = {
.name = "st_update_shader",
.dirty = {
.mesa = 0,
.st = ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM
"st_update_shader", /* name */
{ /* dirty */
0, /* mesa */
ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM /* st */
},
.update = update_linkage
update_linkage /* update */
};

View File

@ -54,10 +54,10 @@ update_stipple( struct st_context *st )
const struct st_tracked_state st_update_polygon_stipple = {
.name = "st_update_polygon_stipple",
.dirty = {
.mesa = (_NEW_POLYGONSTIPPLE),
.st = 0,
"st_update_polygon_stipple", /* name */
{ /* dirty */
(_NEW_POLYGONSTIPPLE), /* mesa */
0, /* st */
},
.update = update_stipple
update_stipple /* update */
};

View File

@ -111,15 +111,10 @@ update_textures(struct st_context *st)
const struct st_tracked_state st_update_texture = {
.name = "st_update_texture",
.dirty = {
.mesa = _NEW_TEXTURE,
.st = ST_NEW_FRAGMENT_PROGRAM,
"st_update_texture", /* name */
{ /* dirty */
_NEW_TEXTURE, /* mesa */
ST_NEW_FRAGMENT_PROGRAM, /* st */
},
.update = update_textures
update_textures /* update */
};

View File

@ -82,10 +82,10 @@ update_viewport( struct st_context *st )
const struct st_tracked_state st_update_viewport = {
.name = "st_update_viewport",
.dirty = {
.mesa = _NEW_BUFFERS | _NEW_VIEWPORT,
.st = 0,
"st_update_viewport", /* name */
{ /* dirty */
_NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */
0, /* st */
},
.update = update_viewport
update_viewport /* update */
};

View File

@ -34,8 +34,8 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "shader/prog_instruction.h"
#include "st_atom.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_cb_accum.h"
#include "st_cb_clear.h"
#include "st_cb_fbo.h"

View File

@ -1339,8 +1339,6 @@ static void
calculate_first_last_level(struct st_texture_object *stObj)
{
struct gl_texture_object *tObj = &stObj->base;
const struct gl_texture_image *const baseImage =
tObj->Image[0][tObj->BaseLevel];
/* These must be signed values. MinLod and MaxLod can be negative numbers,
* and having firstLevel and lastLevel as signed prevents the need for
@ -1363,7 +1361,7 @@ calculate_first_last_level(struct st_texture_object *stObj)
}
else {
firstLevel = 0;
lastLevel = MIN2(tObj->MaxLevel - tObj->BaseLevel, baseImage->MaxLog2);
lastLevel = MIN2(tObj->MaxLevel, tObj->Image[0][0]->WidthLog2);
}
break;
case GL_TEXTURE_RECTANGLE_NV:
@ -1486,10 +1484,7 @@ st_finalize_texture(GLcontext *ctx,
(stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
stObj->pt->format !=
st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) ||
stObj->pt->last_level != stObj->lastLevel ||
stObj->pt->width[0] != firstImage->base.Width2 ||
stObj->pt->height[0] != firstImage->base.Height2 ||
stObj->pt->depth[0] != firstImage->base.Depth2 ||
stObj->pt->last_level < stObj->lastLevel ||
stObj->pt->cpp != cpp ||
stObj->pt->compressed != firstImage->base.IsCompressed)) {
pipe_texture_release(&stObj->pt);

View File

@ -35,8 +35,8 @@
#include "vbo/vbo.h"
#include "st_atom.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_cb_bufferobjects.h"
#include "st_draw.h"
#include "st_program.h"
@ -549,9 +549,10 @@ st_feedback_draw_vbo(GLcontext *ctx,
unsigned indexSize;
struct gl_buffer_object *bufobj = ib->obj;
struct st_buffer_object *stobj = st_buffer_object(bufobj);
index_buffer_handle = stobj->buffer;
void *map;
index_buffer_handle = stobj->buffer;
switch (ib->type) {
case GL_UNSIGNED_INT:
indexSize = 4;

View File

@ -38,17 +38,17 @@
#include "st_extensions.h"
static int min(int a, int b)
static int _min(int a, int b)
{
return (a < b) ? a : b;
}
static int max(int a, int b)
static int _max(int a, int b)
{
return (a > b) ? a : b;
}
static int clamp(int a, int min, int max)
static int _clamp(int a, int min, int max)
{
if (a < min)
return min;
@ -69,42 +69,42 @@ void st_init_limits(struct st_context *st)
struct gl_constants *c = &st->ctx->Const;
c->MaxTextureLevels
= min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
MAX_TEXTURE_LEVELS);
c->Max3DTextureLevels
= min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),
MAX_3D_TEXTURE_LEVELS);
c->MaxCubeTextureLevels
= min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS),
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS),
MAX_CUBE_TEXTURE_LEVELS);
c->MaxTextureRectSize
= min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE);
= _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE);
c->MaxTextureUnits
= c->MaxTextureImageUnits
= c->MaxTextureCoordUnits
= min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS),
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS),
MAX_TEXTURE_IMAGE_UNITS);
c->MaxDrawBuffers
= clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
= _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
c->MaxLineWidth
= max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
c->MaxLineWidthAA
= max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
c->MaxPointSize
= max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
c->MaxPointSizeAA
= max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
c->MaxTextureMaxAnisotropy
= max(2.0, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
= _max(2.0, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
c->MaxTextureLodBias
= screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);

View File

@ -805,7 +805,7 @@ tgsi_translate_mesa_program(
{
GLboolean tempsUsed[MAX_PROGRAM_TEMPS + 1];
GLboolean inside_range = GL_FALSE;
GLuint start_range;
GLuint start_range = 0;
find_temporaries(program, tempsUsed);
tempsUsed[MAX_PROGRAM_TEMPS] = GL_FALSE;

View File

@ -101,14 +101,14 @@ struct st_vertex_program
};
static inline struct st_fragment_program *
static INLINE struct st_fragment_program *
st_fragment_program( struct gl_fragment_program *fp )
{
return (struct st_fragment_program *)fp;
}
static inline struct st_vertex_program *
static INLINE struct st_vertex_program *
st_vertex_program( struct gl_vertex_program *vp )
{
return (struct st_vertex_program *)vp;