unsigned BR13, CMD;
BATCH_LOCALS;
- dst_pitch *= cpp;
+ dst_pitch *= (short) cpp;
switch (cpp) {
case 1:
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:
draw_destroy( i915->draw );
- free( i915 );
+ FREE( i915 );
}
*/
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 {
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++]);
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++]);
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;
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;
#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
const unsigned * program, unsigned sz)
{
unsigned size = program[0] & 0x1ff;
- int i;
+ unsigned i;
PRINTF("\t\tBEGIN\n");
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);
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);
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 &&
/* 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)
};
{
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);
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);
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);
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
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");
/* free old program, if present */
if (i915->current.program) {
- free(i915->current.program);
+ FREE(i915->current.program);
i915->current.program_len = 0;
}
/* 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;
/* Release the compilation struct:
*/
- free(p);
+ FREE(p);
}
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;
}
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;
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 );
}
}
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;
}
}
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 );
}
}
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;
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,
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;
}
{
- 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);
}
static void i915_delete_sampler_state(struct pipe_context *pipe,
void *sampler)
{
- free(sampler);
+ FREE(sampler);
}
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;
static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
void *depth_stencil)
{
- free(depth_stencil);
+ FREE(depth_stencil);
}
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);
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,
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;
S4_FLATSHADE_SPECULAR);
}
- cso->LIS7 = rasterizer->offset_units; /* probably incorrect */
+ cso->LIS7 = fui( rasterizer->offset_units );
return cso;
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,
const unsigned *src,
unsigned dwords )
{
- int i;
+ unsigned i;
for (i = 0; i < dwords; i++)
i915->current.dynamic[offset + i] = src[i];
}
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
};
}
const struct i915_tracked_state i915_upload_BFO = {
- .dirty = I915_NEW_DEPTH_STENCIL,
- .update = upload_BFO
+ I915_NEW_DEPTH_STENCIL,
+ upload_BFO
};
}
const struct i915_tracked_state i915_upload_BLENDCOLOR = {
- .dirty = I915_NEW_BLEND,
- .update = upload_BLENDCOLOR
+ I915_NEW_BLEND,
+ upload_BLENDCOLOR
};
/***********************************************************************
}
const struct i915_tracked_state i915_upload_IAB = {
- .dirty = I915_NEW_BLEND,
- .update = upload_IAB
+ I915_NEW_BLEND,
+ upload_IAB
};
}
const struct i915_tracked_state i915_upload_DEPTHSCALE = {
- .dirty = I915_NEW_RASTERIZER,
- .update = upload_DEPTHSCALE
+ I915_NEW_RASTERIZER,
+ upload_DEPTHSCALE
};
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
};
}
const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = {
- .dirty = I915_NEW_RASTERIZER,
- .update = upload_SCISSOR_ENABLE
+ I915_NEW_RASTERIZER,
+ upload_SCISSOR_ENABLE
};
const struct i915_tracked_state i915_upload_SCISSOR_RECT = {
- .dirty = I915_NEW_SCISSOR,
- .update = upload_SCISSOR_RECT
+ I915_NEW_SCISSOR,
+ upload_SCISSOR_RECT
};
}
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
};
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
};
}
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
};
}
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
};
*/
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;
}
const struct i915_tracked_state i915_upload_S7 = {
- .dirty = I915_NEW_RASTERIZER,
- .update = upload_S7
+ I915_NEW_RASTERIZER,
+ upload_S7
};
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++) {
/* 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;
}
boolean
i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
- int level;
+ unsigned level;
switch (mt->target) {
case PIPE_TEXTURE_CUBE: {
boolean
i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
- int level;
+ unsigned level;
switch (mt->target) {
case PIPE_TEXTURE_CUBE:{
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,