Browse Source

mesa: More signed/unsigned float/integer fixes.

tags/mesa_20090313
José Fonseca 17 years ago
parent
commit
5c1a78b7a8

+ 10
- 10
src/mesa/main/mm.c View File

@@ -53,11 +53,11 @@ mmDumpMemInfo(const struct mem_block *heap)
}

struct mem_block *
mmInit(unsigned int ofs, int size)
mmInit(unsigned ofs, unsigned size)
{
struct mem_block *heap, *block;
if (size <= 0)
if (!size)
return NULL;

heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
@@ -91,8 +91,8 @@ mmInit(unsigned int ofs, int size)

static struct mem_block *
SliceBlock(struct mem_block *p,
unsigned int startofs, int size,
int reserved, int alignment)
unsigned startofs, unsigned size,
unsigned reserved, unsigned alignment)
{
struct mem_block *newblock;

@@ -160,14 +160,14 @@ SliceBlock(struct mem_block *p,


struct mem_block *
mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned startSearch)
{
struct mem_block *p;
const int mask = (1 << align2)-1;
int startofs = 0;
int endofs;
const unsigned mask = (1 << align2)-1;
unsigned startofs = 0;
unsigned endofs;

if (!heap || align2 < 0 || size <= 0)
if (!heap || !align2 || !size)
return NULL;

for (p = heap->next_free; p != heap; p = p->next_free) {
@@ -193,7 +193,7 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)


struct mem_block *
mmFindBlock(struct mem_block *heap, int start)
mmFindBlock(struct mem_block *heap, unsigned start)
{
struct mem_block *p;


+ 8
- 8
src/mesa/main/mm.h View File

@@ -39,10 +39,10 @@ struct mem_block {
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
struct mem_block *heap;
unsigned int ofs;
int size;
unsigned int free:1;
unsigned int reserved:1;
unsigned ofs;
unsigned size;
unsigned free:1;
unsigned reserved:1;
};


@@ -51,7 +51,7 @@ struct mem_block {
* input: total size in bytes
* return: a heap pointer if OK, NULL if error
*/
extern struct mem_block *mmInit(unsigned int ofs, int size);
extern struct mem_block *mmInit(unsigned ofs, unsigned size);

/**
* Allocate 'size' bytes with 2^align2 bytes alignment,
@@ -63,8 +63,8 @@ extern struct mem_block *mmInit(unsigned int ofs, int size);
* startSearch = linear offset from start of heap to begin search
* return: pointer to the allocated block, 0 if error
*/
extern struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2,
int startSearch);
extern struct mem_block *mmAllocMem(struct mem_block *heap, unsigned size,
unsigned align2, unsigned startSearch);

/**
* Free block starts at offset
@@ -78,7 +78,7 @@ extern int mmFreeMem(struct mem_block *b);
* input: pointer to a heap, start offset
* return: pointer to a block
*/
extern struct mem_block *mmFindBlock(struct mem_block *heap, int start);
extern struct mem_block *mmFindBlock(struct mem_block *heap, unsigned start);

/**
* destroy MM

+ 8
- 8
src/mesa/state_tracker/st_cb_bitmap.c View File

@@ -494,14 +494,14 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
const GLfloat width = (GLfloat)fb->Width;
const GLfloat height = (GLfloat)fb->Height;
struct pipe_viewport_state vp;
vp.scale[0] = 0.5 * width;
vp.scale[1] = (GLfloat)(height * (invert ? -0.5 : 0.5));
vp.scale[2] = 1.0;
vp.scale[3] = 1.0;
vp.translate[0] = (GLfloat)(0.5 * width);
vp.translate[1] = (GLfloat)(0.5 * height);
vp.translate[2] = 0.0;
vp.translate[3] = 0.0;
vp.scale[0] = 0.5f * width;
vp.scale[1] = height * (invert ? -0.5f : 0.5f);
vp.scale[2] = 1.0f;
vp.scale[3] = 1.0f;
vp.translate[0] = 0.5f * width;
vp.translate[1] = 0.5f * height;
vp.translate[2] = 0.0f;
vp.translate[3] = 0.0f;
cso_set_viewport(cso, &vp);
}


+ 12
- 12
src/mesa/state_tracker/st_cb_drawpixels.c View File

@@ -425,12 +425,12 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
const GLfloat fb_width = fb->Width;
const GLfloat fb_height = fb->Height;
const GLfloat clip_x0 = x0 / fb_width * 2.0 - 1.0;
const GLfloat clip_y0 = y0 / fb_height * 2.0 - 1.0;
const GLfloat clip_x1 = x1 / fb_width * 2.0 - 1.0;
const GLfloat clip_y1 = y1 / fb_height * 2.0 - 1.0;
const GLfloat sLeft = 0.0F, sRight = 1.0F;
const GLfloat tTop = invertTex, tBot = 1.0 - tTop;
const GLfloat clip_x0 = x0 / fb_width * 2.0f - 1.0f;
const GLfloat clip_y0 = y0 / fb_height * 2.0f - 1.0f;
const GLfloat clip_x1 = x1 / fb_width * 2.0f - 1.0f;
const GLfloat clip_y1 = y1 / fb_height * 2.0f - 1.0f;
const GLfloat sLeft = 0.0f, sRight = 1.0f;
const GLfloat tTop = invertTex, tBot = 1.0f - tTop;
GLuint tex, i;

/* upper-left */
@@ -463,21 +463,21 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
if (color) {
for (i = 0; i < 4; i++) {
verts[i][0][2] = z; /*Z*/
verts[i][0][3] = 1.0; /*W*/
verts[i][0][3] = 1.0f; /*W*/
verts[i][1][0] = color[0];
verts[i][1][1] = color[1];
verts[i][1][2] = color[2];
verts[i][1][3] = color[3];
verts[i][2][2] = 0.0; /*R*/
verts[i][2][3] = 1.0; /*Q*/
verts[i][2][2] = 0.0f; /*R*/
verts[i][2][3] = 1.0f; /*Q*/
}
}
else {
for (i = 0; i < 4; i++) {
verts[i][0][2] = z; /*Z*/
verts[i][0][3] = 1.0; /*W*/
verts[i][1][2] = 0.0; /*R*/
verts[i][1][3] = 1.0; /*Q*/
verts[i][0][3] = 1.0f; /*W*/
verts[i][1][2] = 0.0f; /*R*/
verts[i][1][3] = 1.0f; /*Q*/
}
}
}

Loading…
Cancel
Save