llvmpipe: implement the new can_create_resource() function
[mesa.git] / src / gallium / drivers / llvmpipe / lp_rast_debug.c
index 64ac616f629fbb416fd9e4679f6f226e16e5bc6a..86f5f6415e8c826da6eef7accb139263977a1f87 100644 (file)
@@ -2,13 +2,6 @@
 #include "lp_rast_priv.h"
 #include "lp_state_fs.h"
 
-static INLINE int u_bit_scan(unsigned *mask)
-{
-   int i = ffs(*mask) - 1;
-   *mask &= ~(1 << i);
-   return i;
-}
-
 struct tile {
    int coverage;
    int overdraw;
@@ -62,6 +55,9 @@ get_variant( const struct lp_rast_state *state,
              const struct cmd_block *block,
              int k )
 {
+   if (!state)
+      return NULL;
+
    if (block->cmd[k] == LP_RAST_OP_SHADE_TILE ||
        block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE ||
        block->cmd[k] == LP_RAST_OP_TRIANGLE_1 ||
@@ -140,9 +136,14 @@ debug_shade_tile(int x, int y,
                  char val)
 {
    const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
-   boolean blend = tile->state->variant->key.blend.rt[0].blend_enable;
+   boolean blend;
    unsigned i,j;
 
+   if (!tile->state)
+      return 0;
+
+   blend = tile->state->variant->key.blend.rt[0].blend_enable;
+
    if (inputs->disable)
       return 0;
 
@@ -397,8 +398,8 @@ lp_debug_draw_bins_by_cmd_length( struct lp_scene *scene )
    for (y = 0; y < scene->tiles_y; y++) {
       for (x = 0; x < scene->tiles_x; x++) {
          const char *bits = " ...,-~:;=o+xaw*#XAWWWWWWWWWWWWWWWW";
-         int sz = lp_scene_bin_size(scene, x, y);
-         int sz2 = util_unsigned_logbase2(sz);
+         unsigned sz = lp_scene_bin_size(scene, x, y);
+         unsigned sz2 = util_logbase2(sz);
          debug_printf("%c", bits[MIN2(sz2,32)]);
       }
       debug_printf("\n");