mesa: Use appropriate unsigned/signed, float/integer types.
This commit is contained in:
@@ -164,8 +164,8 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
|
|||||||
{
|
{
|
||||||
struct mem_block *p;
|
struct mem_block *p;
|
||||||
const int mask = (1 << align2)-1;
|
const int mask = (1 << align2)-1;
|
||||||
unsigned int startofs = 0;
|
int startofs = 0;
|
||||||
unsigned int endofs;
|
int endofs;
|
||||||
|
|
||||||
if (!heap || align2 < 0 || size <= 0)
|
if (!heap || align2 < 0 || size <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -467,7 +467,7 @@ _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
|
|||||||
for (i = 0; i < prog->NumInstructions; i++) {
|
for (i = 0; i < prog->NumInstructions; i++) {
|
||||||
struct prog_instruction *inst = prog->Instructions + i;
|
struct prog_instruction *inst = prog->Instructions + i;
|
||||||
if (inst->BranchTarget > 0) {
|
if (inst->BranchTarget > 0) {
|
||||||
if (inst->BranchTarget >= start) {
|
if ((GLuint)inst->BranchTarget >= start) {
|
||||||
inst->BranchTarget += count;
|
inst->BranchTarget += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1079,7 +1079,7 @@ update_textures_used(struct gl_program *prog)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
|
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) {
|
if (program->Parameters->Parameters[location].Type == PROGRAM_SAMPLER) {
|
||||||
/* This controls which texture unit which is used by a 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 {
|
else {
|
||||||
/* ordinary uniform variable */
|
/* ordinary uniform variable */
|
||||||
GLuint k, i;
|
GLsizei k, i;
|
||||||
|
|
||||||
if (count * elems > program->Parameters->Parameters[location].Size) {
|
if (count * elems > program->Parameters->Parameters[location].Size) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)");
|
||||||
|
@@ -1934,7 +1934,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
|
|||||||
byte *prod;
|
byte *prod;
|
||||||
GLuint size, start, version;
|
GLuint size, start, version;
|
||||||
slang_string preprocessed;
|
slang_string preprocessed;
|
||||||
int maxVersion;
|
GLuint maxVersion;
|
||||||
|
|
||||||
#if FEATURE_ARB_shading_language_120
|
#if FEATURE_ARB_shading_language_120
|
||||||
maxVersion = 120;
|
maxVersion = 120;
|
||||||
|
@@ -182,14 +182,14 @@ static void
|
|||||||
print_generic2(const slang_operation *op, const char *oper,
|
print_generic2(const slang_operation *op, const char *oper,
|
||||||
const char *s, int indent)
|
const char *s, int indent)
|
||||||
{
|
{
|
||||||
int i;
|
GLuint i;
|
||||||
if (oper) {
|
if (oper) {
|
||||||
spaces(indent);
|
spaces(indent);
|
||||||
printf("[%p locals %p] %s %s\n", (void*) op, (void*) op->locals, oper, s);
|
printf("[%p locals %p] %s %s\n", (void*) op, (void*) op->locals, oper, s);
|
||||||
}
|
}
|
||||||
for (i = 0; i < op->num_children; i++) {
|
for (i = 0; i < op->num_children; i++) {
|
||||||
spaces(indent);
|
spaces(indent);
|
||||||
printf("//child %d:\n", i);
|
printf("//child %u:\n", i);
|
||||||
slang_print_tree(&op->children[i], indent);
|
slang_print_tree(&op->children[i], indent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -804,7 +804,7 @@ int
|
|||||||
slang_checksum_tree(const slang_operation *op)
|
slang_checksum_tree(const slang_operation *op)
|
||||||
{
|
{
|
||||||
int s = op->num_children;
|
int s = op->num_children;
|
||||||
int i;
|
GLuint i;
|
||||||
|
|
||||||
for (i = 0; i < op->num_children; i++) {
|
for (i = 0; i < op->num_children; i++) {
|
||||||
s += slang_checksum_tree(&op->children[i]);
|
s += slang_checksum_tree(&op->children[i]);
|
||||||
|
@@ -517,7 +517,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
struct cso_context *cso = ctx->st->cso_context;
|
struct cso_context *cso = ctx->st->cso_context;
|
||||||
GLfloat x0, y0, x1, y1;
|
GLfloat x0, y0, x1, y1;
|
||||||
GLuint maxSize;
|
GLsizei maxSize;
|
||||||
|
|
||||||
/* limit checks */
|
/* limit checks */
|
||||||
/* XXX if DrawPixels image is larger than max texture size, break
|
/* 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 width = ctx->DrawBuffer->Width;
|
||||||
const float height = ctx->DrawBuffer->Height;
|
const float height = ctx->DrawBuffer->Height;
|
||||||
struct pipe_viewport_state vp;
|
struct pipe_viewport_state vp;
|
||||||
vp.scale[0] = 0.5 * width;
|
vp.scale[0] = 0.5f * width;
|
||||||
vp.scale[1] = -0.5 * height;
|
vp.scale[1] = -0.5f * height;
|
||||||
vp.scale[2] = 1.0;
|
vp.scale[2] = 1.0f;
|
||||||
vp.scale[3] = 1.0;
|
vp.scale[3] = 1.0f;
|
||||||
vp.translate[0] = 0.5 * width;
|
vp.translate[0] = 0.5f * width;
|
||||||
vp.translate[1] = 0.5 * height;
|
vp.translate[1] = 0.5f * height;
|
||||||
vp.translate[2] = 0.0;
|
vp.translate[2] = 0.0f;
|
||||||
vp.translate[3] = 0.0;
|
vp.translate[3] = 0.0f;
|
||||||
cso_set_viewport(cso, &vp);
|
cso_set_viewport(cso, &vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -177,7 +177,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
GLfloat temp[MAX_WIDTH][4];
|
GLfloat temp[MAX_WIDTH][4];
|
||||||
const GLbitfield transferOps = ctx->_ImageTransferState;
|
const GLbitfield transferOps = ctx->_ImageTransferState;
|
||||||
GLint i, yStep, dfStride;
|
GLsizei i, j;
|
||||||
|
GLint yStep, dfStride;
|
||||||
GLfloat *df;
|
GLfloat *df;
|
||||||
struct st_renderbuffer *strb;
|
struct st_renderbuffer *strb;
|
||||||
struct gl_pixelstore_attrib clippedPacking = *pack;
|
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) {
|
surf->format == PIPE_FORMAT_X8Z24_UNORM) {
|
||||||
if (format == GL_DEPTH_COMPONENT) {
|
if (format == GL_DEPTH_COMPONENT) {
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
GLuint ztemp[MAX_WIDTH], j;
|
GLuint ztemp[MAX_WIDTH];
|
||||||
GLfloat zfloat[MAX_WIDTH];
|
GLfloat zfloat[MAX_WIDTH];
|
||||||
const double scale = 1.0 / ((1 << 24) - 1);
|
const double scale = 1.0 / ((1 << 24) - 1);
|
||||||
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
|
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) {
|
else if (surf->format == PIPE_FORMAT_Z16_UNORM) {
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
GLushort ztemp[MAX_WIDTH], j;
|
GLushort ztemp[MAX_WIDTH];
|
||||||
GLfloat zfloat[MAX_WIDTH];
|
GLfloat zfloat[MAX_WIDTH];
|
||||||
const double scale = 1.0 / 0xffff;
|
const double scale = 1.0 / 0xffff;
|
||||||
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
|
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) {
|
else if (surf->format == PIPE_FORMAT_Z32_UNORM) {
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
GLuint ztemp[MAX_WIDTH], j;
|
GLuint ztemp[MAX_WIDTH];
|
||||||
GLfloat zfloat[MAX_WIDTH];
|
GLfloat zfloat[MAX_WIDTH];
|
||||||
const double scale = 1.0 / 0xffffffff;
|
const double scale = 1.0 / 0xffffffff;
|
||||||
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
|
pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
|
||||||
|
@@ -216,7 +216,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
|
|||||||
(ctx->Polygon.FrontMode != GL_FILL ||
|
(ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != GL_FILL)) {
|
ctx->Polygon.BackMode != GL_FILL)) {
|
||||||
/* need edge flags */
|
/* need edge flags */
|
||||||
GLuint i;
|
GLint i;
|
||||||
unsigned *vec;
|
unsigned *vec;
|
||||||
struct st_buffer_object *stobj = st_buffer_object(array->BufferObj);
|
struct st_buffer_object *stobj = st_buffer_object(array->BufferObj);
|
||||||
ubyte *map;
|
ubyte *map;
|
||||||
|
@@ -43,7 +43,7 @@ static int _min(int a, int b)
|
|||||||
return (a < b) ? a : 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;
|
return (a > b) ? a : b;
|
||||||
}
|
}
|
||||||
@@ -94,17 +94,17 @@ void st_init_limits(struct st_context *st)
|
|||||||
1, MAX_DRAW_BUFFERS);
|
1, MAX_DRAW_BUFFERS);
|
||||||
|
|
||||||
c->MaxLineWidth
|
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
|
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
|
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
|
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
|
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
|
c->MaxTextureLodBias
|
||||||
= screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
|
= screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
|
||||||
|
Reference in New Issue
Block a user