Browse Source

Make it compile under Win32.

tags/mesa_20090313
Michal 18 years ago
parent
commit
5961732c1b

+ 4
- 4
src/mesa/pipe/i915simple/i915_blit.c View File

@@ -47,7 +47,7 @@ i915_fill_blit(struct i915_context *i915,
unsigned BR13, CMD;
BATCH_LOCALS;

dst_pitch *= cpp;
dst_pitch *= (short) cpp;

switch (cpp) {
case 1:
@@ -102,14 +102,14 @@ i915_copy_blit( struct i915_context *i915,
BATCH_LOCALS;


DBG(i915,
I915_DBG(i915,
"%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
__FUNCTION__,
src_buffer, src_pitch, src_offset, src_x, src_y,
dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h);

src_pitch *= cpp;
dst_pitch *= cpp;
src_pitch *= (short) cpp;
dst_pitch *= (short) cpp;

switch (cpp) {
case 1:

+ 2
- 2
src/mesa/pipe/i915simple/i915_context.c View File

@@ -175,7 +175,7 @@ static void i915_destroy( struct pipe_context *pipe )

draw_destroy( i915->draw );

free( i915 );
FREE( i915 );
}


@@ -341,7 +341,7 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys,
*/
i915->draw = draw_create();
assert(i915->draw);
if (getenv("I915_VBUF")) {
if (GETENV("I915_VBUF")) {
draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915));
}
else {

+ 4
- 5
src/mesa/pipe/i915simple/i915_debug.c View File

@@ -498,7 +498,7 @@ static boolean debug_map_state( struct debug_stream *stream,
unsigned len )
{
unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
unsigned j = 0;

PRINTF("%s (%d dwords):\n", name, len);
PRINTF("\t0x%08x\n", ptr[j++]);
@@ -550,7 +550,7 @@ static boolean debug_sampler_state( struct debug_stream *stream,
unsigned len )
{
unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
unsigned j = 0;

PRINTF("%s (%d dwords):\n", name, len);
PRINTF("\t0x%08x\n", ptr[j++]);
@@ -827,7 +827,7 @@ i915_dump_batchbuffer( struct i915_context *i915 )
struct debug_stream stream;
unsigned *start = i915->batch_start;
unsigned *end = i915->winsys->batch_start( i915->winsys, 0, 0 );
unsigned bytes = (end - start) * 4;
unsigned long bytes = (unsigned long) (end - start) * 4;
boolean done = FALSE;

stream.offset = 0;
@@ -843,8 +843,7 @@ i915_dump_batchbuffer( struct i915_context *i915 )
stream.winsys->printf( stream.winsys, "\n\nBATCH: (%d)\n", bytes / 4);

while (!done &&
stream.offset < bytes &&
stream.offset >= 0)
stream.offset < bytes)
{
if (!i915_debug_packet( &stream ))
break;

+ 2
- 2
src/mesa/pipe/i915simple/i915_debug.h View File

@@ -69,12 +69,12 @@ void i915_print_ureg(const char *msg, unsigned ureg);

#ifdef DEBUG
#include "pipe/p_winsys.h"
#define DBG( i915, ... ) do { \
#define I915_DBG( i915, ... ) do { \
if ((i915)->debug & FILE_DEBUG_FLAG) \
(i915)->pipe.winsys->printf( (i915)->pipe.winsys, __VA_ARGS__ ); \
} while(0)
#else
#define DBG( i915, ... ) \
#define I915_DBG( i915, ... ) \
(void)i915
#endif


+ 1
- 1
src/mesa/pipe/i915simple/i915_debug_fp.c View File

@@ -327,7 +327,7 @@ i915_disassemble_program(struct debug_stream *stream,
const unsigned * program, unsigned sz)
{
unsigned size = program[0] & 0x1ff;
int i;
unsigned i;

PRINTF("\t\tBEGIN\n");


+ 3
- 3
src/mesa/pipe/i915simple/i915_fpc_emit.c View File

@@ -235,7 +235,7 @@ uint i915_emit_texld( struct i915_fp_compile *p,
uint
i915_emit_const1f(struct i915_fp_compile * p, float c0)
{
int reg, idx;
unsigned reg, idx;

if (c0 == 0.0)
return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO);
@@ -264,7 +264,7 @@ i915_emit_const1f(struct i915_fp_compile * p, float c0)
uint
i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1)
{
int reg, idx;
unsigned reg, idx;

if (c0 == 0.0)
return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W);
@@ -302,7 +302,7 @@ uint
i915_emit_const4f(struct i915_fp_compile * p,
float c0, float c1, float c2, float c3)
{
int reg;
unsigned reg;

for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
if (p->constant_flags[reg] == 0xf &&

+ 15
- 15
src/mesa/pipe/i915simple/i915_fpc_translate.c View File

@@ -69,16 +69,16 @@ static unsigned passthrough[] =

/* 1, -1/3!, 1/5!, -1/7! */
static const float sin_constants[4] = { 1.0,
-1.0 / (3 * 2 * 1),
1.0 / (5 * 4 * 3 * 2 * 1),
-1.0 / (7 * 6 * 5 * 4 * 3 * 2 * 1)
-1.0f / (3 * 2 * 1),
1.0f / (5 * 4 * 3 * 2 * 1),
-1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1)
};

/* 1, -1/2!, 1/4!, -1/6! */
static const float cos_constants[4] = { 1.0,
-1.0 / (2 * 1),
1.0 / (4 * 3 * 2 * 1),
-1.0 / (6 * 5 * 4 * 3 * 2 * 1)
-1.0f / (2 * 1),
1.0f / (4 * 3 * 2 * 1),
-1.0f / (6 * 5 * 4 * 3 * 2 * 1)
};


@@ -102,7 +102,7 @@ i915_use_passthrough_shader(struct i915_context *i915)
{
fprintf(stderr, "**** Using i915 pass-through fragment shader\n");

i915->current.program = (uint *) malloc(sizeof(passthrough));
i915->current.program = (uint *) MALLOC(sizeof(passthrough));
if (i915->current.program) {
memcpy(i915->current.program, passthrough, sizeof(passthrough));
i915->current.program_len = Elements(passthrough);
@@ -167,7 +167,7 @@ src_vector(struct i915_fp_compile *p,

switch (sem_name) {
case TGSI_SEMANTIC_POSITION:
printf("SKIP SEM POS\n");
fprintf(stderr, "SKIP SEM POS\n");
/*
assert(p->wpos_tex != -1);
src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
@@ -430,7 +430,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0);
src0, i915_emit_const1f(p, 1.0f / (M_PI * 2.0f)), 0);

i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);

@@ -439,7 +439,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
tmp, i915_emit_const1f(p, (M_PI * 2)), 0);
tmp, i915_emit_const1f(p, (M_PI * 2.0f)), 0);

/*
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
@@ -986,8 +986,8 @@ i915_init_compile(struct i915_context *i915,
static void
i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
{
uint program_size = p->csr - p->program;
uint decl_size = p->decl - p->declarations;
unsigned long program_size = (unsigned long) (p->csr - p->program);
unsigned long decl_size = (unsigned long) (p->decl - p->declarations);

if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT)
i915_program_error(p, "Exceeded max nr indirect texture lookups");
@@ -1003,7 +1003,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)

/* free old program, if present */
if (i915->current.program) {
free(i915->current.program);
FREE(i915->current.program);
i915->current.program_len = 0;
}

@@ -1028,7 +1028,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
/* Copy compilation results to fragment program struct:
*/
i915->current.program
= (uint *) malloc((program_size + decl_size) * sizeof(uint));
= (uint *) MALLOC((program_size + decl_size) * sizeof(uint));
if (i915->current.program) {
i915->current.program_len = program_size + decl_size;

@@ -1049,7 +1049,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)

/* Release the compilation struct:
*/
free(p);
FREE(p);
}



+ 2
- 2
src/mesa/pipe/i915simple/i915_prim_vbuf.c View File

@@ -101,7 +101,7 @@ static INLINE struct vbuf_stage *vbuf_stage( struct draw_stage *stage )
static INLINE boolean
overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
{
unsigned long used = (char *)ptr - (char *)map;
unsigned long used = (unsigned long) ((char *)ptr - (char *)map);
return (used + bytes) > bufsz;
}

@@ -438,7 +438,7 @@ struct draw_stage *i915_draw_vbuf_stage( struct i915_context *i915 )
assert(IBUF_SIZE < UNDEFINED_VERTEX_ID);

/* FIXME: free this memory on takedown */
vbuf->element_map = malloc( IBUF_SIZE );
vbuf->element_map = MALLOC( IBUF_SIZE );
vbuf->vertex_map = NULL;
vbuf->vertex_ptr = vbuf->vertex_map;

+ 7
- 7
src/mesa/pipe/i915simple/i915_regions.c View File

@@ -163,9 +163,9 @@ i915_region_copy(struct pipe_context *pipe,
else {
i915_copy_blit( i915_context(pipe),
dst->cpp,
src->pitch, src->buffer, src_offset,
dst->pitch, dst->buffer, dst_offset,
srcx, srcy, dstx, dsty, width, height );
(short) src->pitch, src->buffer, src_offset,
(short) dst->pitch, dst->buffer, dst_offset,
(short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
}
}

@@ -204,7 +204,7 @@ i915_region_fill(struct pipe_context *pipe,
ushort *row = (ushort *) get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++)
row[j] = value;
row[j] = (ushort) value;
row += dst->pitch;
}
}
@@ -226,10 +226,10 @@ i915_region_fill(struct pipe_context *pipe,
else {
i915_fill_blit( i915_context(pipe),
dst->cpp,
dst->pitch,
(short) dst->pitch,
dst->buffer, dst_offset,
dstx, dsty,
width, height,
(short) dstx, (short) dsty,
(short) width, (short) height,
value );
}
}

+ 14
- 14
src/mesa/pipe/i915simple/i915_state.c View File

@@ -97,7 +97,7 @@ static void *
i915_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *blend)
{
struct i915_blend_state *cso_data = calloc(1, sizeof(struct i915_blend_state));
struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state );

{
unsigned eqRGB = blend->rgb_func;
@@ -182,7 +182,7 @@ static void i915_bind_blend_state(struct pipe_context *pipe,

static void i915_delete_blend_state(struct pipe_context *pipe, void *blend)
{
free(blend);
FREE(blend);
}

static void i915_set_blend_color( struct pipe_context *pipe,
@@ -199,15 +199,15 @@ static void *
i915_create_sampler_state(struct pipe_context *pipe,
const struct pipe_sampler_state *sampler)
{
struct i915_sampler_state *cso = calloc(1, sizeof(struct i915_sampler_state));
cso->templ = sampler;

struct i915_sampler_state *cso = CALLOC_STRUCT( i915_sampler_state );
const unsigned ws = sampler->wrap_s;
const unsigned wt = sampler->wrap_t;
const unsigned wr = sampler->wrap_r;
unsigned minFilt, magFilt;
unsigned mipFilt;

cso->templ = sampler;

mipFilt = translate_mip_filter(sampler->min_mip_filter);
if (sampler->max_anisotropy > 1.0) {
minFilt = FILTER_ANISOTROPIC;
@@ -222,7 +222,7 @@ i915_create_sampler_state(struct pipe_context *pipe,
}

{
int b = sampler->lod_bias * 16.0;
int b = (int) (sampler->lod_bias * 16.0);
b = CLAMP(b, -256, 255);
cso->state[0] |= ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK);
}
@@ -274,7 +274,7 @@ static void i915_bind_sampler_state(struct pipe_context *pipe,
static void i915_delete_sampler_state(struct pipe_context *pipe,
void *sampler)
{
free(sampler);
FREE(sampler);
}


@@ -286,7 +286,7 @@ static void *
i915_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_state *depth_stencil)
{
struct i915_depth_stencil_state *cso = calloc(1, sizeof(struct i915_depth_stencil_state));
struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state );

{
int testmask = depth_stencil->stencil.value_mask[0] & 0xff;
@@ -379,7 +379,7 @@ static void i915_bind_depth_stencil_state(struct pipe_context *pipe,
static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
void *depth_stencil)
{
free(depth_stencil);
FREE(depth_stencil);
}


@@ -387,7 +387,7 @@ static void *
i915_create_alpha_test_state(struct pipe_context *pipe,
const struct pipe_alpha_test_state *alpha_test)
{
struct i915_alpha_test_state *cso = calloc(1, sizeof(struct i915_alpha_test_state));
struct i915_alpha_test_state *cso = CALLOC_STRUCT( i915_alpha_test_state );

if (alpha_test->enabled) {
int test = i915_translate_compare_func(alpha_test->func);
@@ -413,7 +413,7 @@ static void i915_bind_alpha_test_state(struct pipe_context *pipe,
static void i915_delete_alpha_test_state(struct pipe_context *pipe,
void *alpha)
{
free(alpha);
FREE(alpha);
}

static void i915_set_scissor_state( struct pipe_context *pipe,
@@ -619,7 +619,7 @@ static void *
i915_create_rasterizer_state(struct pipe_context *pipe,
const struct pipe_rasterizer_state *rasterizer)
{
struct i915_rasterizer_state *cso = calloc(1, sizeof(struct i915_rasterizer_state));
struct i915_rasterizer_state *cso = CALLOC_STRUCT( i915_rasterizer_state );

cso->templ = rasterizer;
cso->color_interp = rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
@@ -671,7 +671,7 @@ i915_create_rasterizer_state(struct pipe_context *pipe,
S4_FLATSHADE_SPECULAR);
}

cso->LIS7 = rasterizer->offset_units; /* probably incorrect */
cso->LIS7 = fui( rasterizer->offset_units );


return cso;
@@ -693,7 +693,7 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe,
static void i915_delete_rasterizer_state(struct pipe_context *pipe,
void *setup)
{
free(setup);
FREE(setup);
}

static void i915_set_vertex_buffer( struct pipe_context *pipe,

+ 17
- 17
src/mesa/pipe/i915simple/i915_state_dynamic.c View File

@@ -50,7 +50,7 @@ static inline void set_dynamic_indirect( struct i915_context *i915,
const unsigned *src,
unsigned dwords )
{
int i;
unsigned i;

for (i = 0; i < dwords; i++)
i915->current.dynamic[offset + i] = src[i];
@@ -80,8 +80,8 @@ static void upload_MODES4( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_MODES4 = {
.dirty = I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
.update = upload_MODES4
I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
upload_MODES4
};


@@ -99,8 +99,8 @@ static void upload_BFO( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_BFO = {
.dirty = I915_NEW_DEPTH_STENCIL,
.update = upload_BFO
I915_NEW_DEPTH_STENCIL,
upload_BFO
};


@@ -133,8 +133,8 @@ static void upload_BLENDCOLOR( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_BLENDCOLOR = {
.dirty = I915_NEW_BLEND,
.update = upload_BLENDCOLOR
I915_NEW_BLEND,
upload_BLENDCOLOR
};

/***********************************************************************
@@ -153,8 +153,8 @@ static void upload_IAB( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_IAB = {
.dirty = I915_NEW_BLEND,
.update = upload_IAB
I915_NEW_BLEND,
upload_IAB
};


@@ -172,8 +172,8 @@ static void upload_DEPTHSCALE( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_DEPTHSCALE = {
.dirty = I915_NEW_RASTERIZER,
.update = upload_DEPTHSCALE
I915_NEW_RASTERIZER,
upload_DEPTHSCALE
};


@@ -230,8 +230,8 @@ static void upload_STIPPLE( struct i915_context *i915 )


const struct i915_tracked_state i915_upload_STIPPLE = {
.dirty = I915_NEW_RASTERIZER | I915_NEW_STIPPLE,
.update = upload_STIPPLE
I915_NEW_RASTERIZER | I915_NEW_STIPPLE,
upload_STIPPLE
};


@@ -248,8 +248,8 @@ static void upload_SCISSOR_ENABLE( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = {
.dirty = I915_NEW_RASTERIZER,
.update = upload_SCISSOR_ENABLE
I915_NEW_RASTERIZER,
upload_SCISSOR_ENABLE
};


@@ -274,8 +274,8 @@ static void upload_SCISSOR_RECT( struct i915_context *i915 )


const struct i915_tracked_state i915_upload_SCISSOR_RECT = {
.dirty = I915_NEW_SCISSOR,
.update = upload_SCISSOR_RECT
I915_NEW_SCISSOR,
upload_SCISSOR_RECT
};



+ 12
- 12
src/mesa/pipe/i915simple/i915_state_immediate.c View File

@@ -78,8 +78,8 @@ static void upload_S0S1(struct i915_context *i915)
}

const struct i915_tracked_state i915_upload_S0S1 = {
.dirty = I915_NEW_VBO | I915_NEW_VERTEX_FORMAT,
.update = upload_S0S1
I915_NEW_VBO | I915_NEW_VERTEX_FORMAT,
upload_S0S1
};


@@ -115,8 +115,8 @@ static void upload_S2S4(struct i915_context *i915)


const struct i915_tracked_state i915_upload_S2S4 = {
.dirty = I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT,
.update = upload_S2S4
I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT,
upload_S2S4
};


@@ -147,8 +147,8 @@ static void upload_S5( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_S5 = {
.dirty = (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER),
.update = upload_S5
(I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER),
upload_S5
};


@@ -178,8 +178,8 @@ static void upload_S6( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_S6 = {
.dirty = I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
.update = upload_S6
I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
upload_S6
};


@@ -187,11 +187,11 @@ const struct i915_tracked_state i915_upload_S6 = {
*/
static void upload_S7( struct i915_context *i915 )
{
float LIS7;
unsigned LIS7;

/* I915_NEW_RASTERIZER
*/
LIS7 = i915->rasterizer->LIS7; /* probably incorrect */
LIS7 = i915->rasterizer->LIS7;

if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) {
i915->current.immediate[I915_IMMEDIATE_S7] = LIS7;
@@ -200,8 +200,8 @@ static void upload_S7( struct i915_context *i915 )
}

const struct i915_tracked_state i915_upload_S7 = {
.dirty = I915_NEW_RASTERIZER,
.update = upload_S7
I915_NEW_RASTERIZER,
upload_S7
};



+ 1
- 1
src/mesa/pipe/i915simple/i915_surface.c View File

@@ -81,7 +81,7 @@ i915_get_tile_rgba(struct pipe_context *pipe,
break;
case PIPE_FORMAT_S8_Z24:
{
const float scale = 1.0 / (float) 0xffffff;
const float scale = 1.0f / (float) 0xffffff;
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++) {

+ 5
- 5
src/mesa/pipe/i915simple/i915_tex_layout.c View File

@@ -72,14 +72,14 @@ i915_miptree_set_level_info(struct pipe_mipmap_tree *mt,
/* Not sure when this would happen, but anyway:
*/
if (mt->level[level].image_offset) {
free(mt->level[level].image_offset);
FREE(mt->level[level].image_offset);
mt->level[level].image_offset = NULL;
}

assert(nr_images);
assert(!mt->level[level].image_offset);

mt->level[level].image_offset = (unsigned *) malloc(nr_images * sizeof(unsigned));
mt->level[level].image_offset = (unsigned *) MALLOC(nr_images * sizeof(unsigned));
mt->level[level].image_offset[0] = 0;
}

@@ -186,7 +186,7 @@ static const int step_offsets[6][2] = {
boolean
i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
int level;
unsigned level;

switch (mt->target) {
case PIPE_TEXTURE_CUBE: {
@@ -309,7 +309,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
boolean
i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
int level;
unsigned level;

switch (mt->target) {
case PIPE_TEXTURE_CUBE:{
@@ -417,7 +417,7 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
unsigned nr_images = mt->target == PIPE_TEXTURE_3D ? depth : 6;
int x = 0;
int y = 0;
int q, j;
unsigned q, j;

i915_miptree_set_level_info(mt, level, nr_images,
0, mt->total_height,

Loading…
Cancel
Save