util/blitter: silence assorted MSVC warnings
authorBrian Paul <brianp@vmware.com>
Wed, 17 Oct 2012 00:32:57 +0000 (18:32 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 17 Oct 2012 16:13:30 +0000 (10:13 -0600)
Fix signed/unsigned comparison warnings and float/int assignment warnings.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_blitter.h

index 1072a0e9a74e84270492964a578664989ba5beef..4d6cdd7a244a557288c9967fd37a5dbaebacd986 100644 (file)
@@ -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)
index 4f7146701b1f6d0107832585fbdbfdebd9d52472..de063937793cf081a9543d73ae10c3563b6433b3 100644 (file)
@@ -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;