mesa: Use appropriate unsigned/signed, float/integer types.

This commit is contained in:
José Fonseca 2008-06-24 11:34:46 +09:00
parent 80b359f574
commit 18ec140ef2
9 changed files with 30 additions and 29 deletions

View File

@ -164,8 +164,8 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
{
struct mem_block *p;
const int mask = (1 << align2)-1;
unsigned int startofs = 0;
unsigned int endofs;
int startofs = 0;
int endofs;
if (!heap || align2 < 0 || size <= 0)
return NULL;

View File

@ -467,7 +467,7 @@ _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
for (i = 0; i < prog->NumInstructions; i++) {
struct prog_instruction *inst = prog->Instructions + i;
if (inst->BranchTarget > 0) {
if (inst->BranchTarget >= start) {
if ((GLuint)inst->BranchTarget >= start) {
inst->BranchTarget += count;
}
}

View File

@ -1079,7 +1079,7 @@ update_textures_used(struct gl_program *prog)
*/
static void
set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
GLenum type, GLint count, GLint elems, const void *values)
GLenum type, GLsizei count, GLint elems, const void *values)
{
if (program->Parameters->Parameters[location].Type == PROGRAM_SAMPLER) {
/* This controls which texture unit which is used by a sampler */
@ -1111,7 +1111,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
}
else {
/* ordinary uniform variable */
GLuint k, i;
GLsizei k, i;
if (count * elems > program->Parameters->Parameters[location].Size) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)");

View File

@ -1934,7 +1934,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
byte *prod;
GLuint size, start, version;
slang_string preprocessed;
int maxVersion;
GLuint maxVersion;
#if FEATURE_ARB_shading_language_120
maxVersion = 120;

View File

@ -182,14 +182,14 @@ static void
print_generic2(const slang_operation *op, const char *oper,
const char *s, int indent)
{
int i;
GLuint i;
if (oper) {
spaces(indent);
printf("[%p locals %p] %s %s\n", (void*) op, (void*) op->locals, oper, s);
}
for (i = 0; i < op->num_children; i++) {
spaces(indent);
printf("//child %d:\n", i);
printf("//child %u:\n", i);
slang_print_tree(&op->children[i], indent);
}
}
@ -804,7 +804,7 @@ int
slang_checksum_tree(const slang_operation *op)
{
int s = op->num_children;
int i;
GLuint i;
for (i = 0; i < op->num_children; i++) {
s += slang_checksum_tree(&op->children[i]);

View File

@ -517,7 +517,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
struct pipe_context *pipe = ctx->st->pipe;
struct cso_context *cso = ctx->st->cso_context;
GLfloat x0, y0, x1, y1;
GLuint maxSize;
GLsizei maxSize;
/* limit checks */
/* XXX if DrawPixels image is larger than max texture size, break
@ -574,14 +574,14 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
const float width = ctx->DrawBuffer->Width;
const float height = ctx->DrawBuffer->Height;
struct pipe_viewport_state vp;
vp.scale[0] = 0.5 * width;
vp.scale[1] = -0.5 * height;
vp.scale[2] = 1.0;
vp.scale[3] = 1.0;
vp.translate[0] = 0.5 * width;
vp.translate[1] = 0.5 * height;
vp.translate[2] = 0.0;
vp.translate[3] = 0.0;
vp.scale[0] = 0.5f * width;
vp.scale[1] = -0.5f * height;
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);
}

View File

@ -177,7 +177,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
struct pipe_screen *screen = pipe->screen;
GLfloat temp[MAX_WIDTH][4];
const GLbitfield transferOps = ctx->_ImageTransferState;
GLint i, yStep, dfStride;
GLsizei i, j;
GLint yStep, dfStride;
GLfloat *df;
struct st_renderbuffer *strb;
struct gl_pixelstore_attrib clippedPacking = *pack;
@ -258,7 +259,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
surf->format == PIPE_FORMAT_X8Z24_UNORM) {
if (format == GL_DEPTH_COMPONENT) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH], j;
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / ((1 << 24) - 1);
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
@ -283,7 +284,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
else if (surf->format == PIPE_FORMAT_Z16_UNORM) {
for (i = 0; i < height; i++) {
GLushort ztemp[MAX_WIDTH], j;
GLushort ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffff;
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
@ -298,7 +299,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
else if (surf->format == PIPE_FORMAT_Z32_UNORM) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH], j;
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffffffff;
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);

View File

@ -216,7 +216,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
(ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)) {
/* need edge flags */
GLuint i;
GLint i;
unsigned *vec;
struct st_buffer_object *stobj = st_buffer_object(array->BufferObj);
ubyte *map;

View File

@ -43,7 +43,7 @@ static int _min(int a, int b)
return (a < b) ? a : b;
}
static int _max(int a, int b)
static float _maxf(float a, float b)
{
return (a > b) ? a : b;
}
@ -94,17 +94,17 @@ void st_init_limits(struct st_context *st)
1, MAX_DRAW_BUFFERS);
c->MaxLineWidth
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
= _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH));
c->MaxLineWidthAA
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
= _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA));
c->MaxPointSize
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
= _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
c->MaxPointSizeAA
= _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
= _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
c->MaxTextureMaxAnisotropy
= _max(2.0, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
= _maxf(2.0f, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
c->MaxTextureLodBias
= screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);