[Mesa-dev] [PATCH 1/8] util/blitter: silence assorted MSVC warnings
Brian Paul
brian.e.paul at gmail.com
Tue Oct 16 17:35:22 PDT 2012
From: Brian Paul <brianp at vmware.com>
Fix signed/unsigned comparison warnings and float/int assignment warnings.
---
src/gallium/auxiliary/util/u_blitter.c | 27 ++++++++++++++-------------
src/gallium/auxiliary/util/u_blitter.h | 16 ++++++++--------
2 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 1072a0e..4d6cdd7 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -606,10 +606,10 @@ static void get_texcoords(struct pipe_sampler_view *src,
out[2] = x2 / (float)u_minify(src_width0, level);
out[3] = y2 / (float)u_minify(src_height0, level);
} else {
- out[0] = x1;
- out[1] = y1;
- out[2] = x2;
- out[3] = y2;
+ out[0] = (float) x1;
+ out[1] = (float) y1;
+ out[2] = (float) x2;
+ out[3] = (float) y2;
}
}
@@ -664,19 +664,19 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
case PIPE_TEXTURE_1D_ARRAY:
for (i = 0; i < 4; i++)
- ctx->vertices[i][1][1] = layer; /*t*/
+ ctx->vertices[i][1][1] = (float) layer; /*t*/
break;
case PIPE_TEXTURE_2D_ARRAY:
for (i = 0; i < 4; i++) {
- ctx->vertices[i][1][2] = layer; /*r*/
- ctx->vertices[i][1][3] = sample; /*q*/
+ ctx->vertices[i][1][2] = (float) layer; /*r*/
+ ctx->vertices[i][1][3] = (float) sample; /*q*/
}
break;
case PIPE_TEXTURE_2D:
for (i = 0; i < 4; i++) {
- ctx->vertices[i][1][2] = sample; /*r*/
+ ctx->vertices[i][1][2] = (float) sample; /*r*/
}
break;
@@ -1010,7 +1010,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
blitter_set_common_draw_rect_state(ctx, FALSE);
blitter_set_dst_dimensions(ctx, width, height);
- blitter->draw_rectangle(blitter, 0, 0, width, height, depth,
+ blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
UTIL_BLITTER_ATTRIB_COLOR, color);
blitter_restore_vertex_states(ctx);
@@ -1569,7 +1569,8 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
blitter_set_common_draw_rect_state(ctx, FALSE);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
- blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, depth,
+ blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
+ (float) depth,
UTIL_BLITTER_ATTRIB_NONE, NULL);
blitter_restore_vertex_states(ctx);
@@ -1881,11 +1882,11 @@ static boolean is_box_inside_resource(const struct pipe_resource *res,
}
return box->x >= 0 &&
- box->x + box->width <= width &&
+ box->x + box->width <= (int) width &&
box->y >= 0 &&
- box->y + box->height <= height &&
+ box->y + box->height <= (int) height &&
box->z >= 0 &&
- box->z + box->depth <= depth;
+ box->z + box->depth <= (int) depth;
}
static unsigned get_sample_count(const struct pipe_resource *res)
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index 4f71467..de06393 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -98,16 +98,16 @@ struct blitter_context
boolean is_sample_mask_saved;
unsigned saved_sample_mask;
- int saved_num_sampler_states;
+ unsigned saved_num_sampler_states;
void *saved_sampler_states[PIPE_MAX_SAMPLERS];
- int saved_num_sampler_views;
+ unsigned saved_num_sampler_views;
struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS];
- int saved_num_vertex_buffers;
+ unsigned saved_num_vertex_buffers;
struct pipe_vertex_buffer saved_vertex_buffers[PIPE_MAX_ATTRIBS];
- int saved_num_so_targets;
+ unsigned saved_num_so_targets;
struct pipe_stream_output_target *saved_so_targets[PIPE_MAX_SO_BUFFERS];
struct pipe_query *saved_render_cond_query;
@@ -435,7 +435,7 @@ void util_blitter_save_scissor(struct blitter_context *blitter,
static INLINE
void util_blitter_save_fragment_sampler_states(
struct blitter_context *blitter,
- int num_sampler_states,
+ unsigned num_sampler_states,
void **sampler_states)
{
assert(num_sampler_states <= Elements(blitter->saved_sampler_states));
@@ -447,7 +447,7 @@ void util_blitter_save_fragment_sampler_states(
static INLINE void
util_blitter_save_fragment_sampler_views(struct blitter_context *blitter,
- int num_views,
+ unsigned num_views,
struct pipe_sampler_view **views)
{
unsigned i;
@@ -461,7 +461,7 @@ util_blitter_save_fragment_sampler_views(struct blitter_context *blitter,
static INLINE void
util_blitter_save_vertex_buffers(struct blitter_context *blitter,
- int num_vertex_buffers,
+ unsigned num_vertex_buffers,
struct pipe_vertex_buffer *vertex_buffers)
{
assert(num_vertex_buffers <= Elements(blitter->saved_vertex_buffers));
@@ -475,7 +475,7 @@ util_blitter_save_vertex_buffers(struct blitter_context *blitter,
static INLINE void
util_blitter_save_so_targets(struct blitter_context *blitter,
- int num_targets,
+ unsigned num_targets,
struct pipe_stream_output_target **targets)
{
unsigned i;
--
1.7.4.1
More information about the mesa-dev
mailing list