util: Avoid dumping masked state. Other minor improvements.
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 14 Feb 2010 23:54:22 +0000 (23:54 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Sun, 14 Feb 2010 23:54:22 +0000 (23:54 +0000)
src/gallium/auxiliary/util/u_dump.h
src/gallium/auxiliary/util/u_dump_state.c

index cad0b355585a4bf0f49b9258bb7fd4013186bb4a..379f18ef38b8607bb3c497dc22051d82e258c5c6 100644 (file)
@@ -51,6 +51,11 @@ extern "C" {
 struct os_stream;
 
 
+/* Duplicated here for convenience */
+extern struct os_stream *
+os_log_stream;
+
+
 /*
  * p_defines.h
  *
index 5ba913699829eca4bef7ed2fc8dca4ff0a64dd1a..eaf4ec90f254a08c59a12b641076368532bdd88b 100644 (file)
@@ -450,8 +450,10 @@ util_dump_depth_stencil_alpha_state(struct os_stream *stream, const struct pipe_
    util_dump_member_begin(stream, "depth");
    util_dump_struct_begin(stream, "pipe_depth_state");
    util_dump_member(stream, bool, &state->depth, enabled);
-   util_dump_member(stream, bool, &state->depth, writemask);
-   util_dump_member(stream, uint, &state->depth, func);
+   if (state->depth.enabled) {
+      util_dump_member(stream, bool, &state->depth, writemask);
+      util_dump_member(stream, enum_func, &state->depth, func);
+   }
    util_dump_struct_end(stream);
    util_dump_member_end(stream);
 
@@ -461,12 +463,14 @@ util_dump_depth_stencil_alpha_state(struct os_stream *stream, const struct pipe_
       util_dump_elem_begin(stream);
       util_dump_struct_begin(stream, "pipe_stencil_state");
       util_dump_member(stream, bool, &state->stencil[i], enabled);
-      util_dump_member(stream, enum_func, &state->stencil[i], func);
-      util_dump_member(stream, uint, &state->stencil[i], fail_op);
-      util_dump_member(stream, uint, &state->stencil[i], zpass_op);
-      util_dump_member(stream, uint, &state->stencil[i], zfail_op);
-      util_dump_member(stream, uint, &state->stencil[i], valuemask);
-      util_dump_member(stream, uint, &state->stencil[i], writemask);
+      if (state->stencil[i].enabled) {
+         util_dump_member(stream, enum_func, &state->stencil[i], func);
+         util_dump_member(stream, uint, &state->stencil[i], fail_op);
+         util_dump_member(stream, uint, &state->stencil[i], zpass_op);
+         util_dump_member(stream, uint, &state->stencil[i], zfail_op);
+         util_dump_member(stream, uint, &state->stencil[i], valuemask);
+         util_dump_member(stream, uint, &state->stencil[i], writemask);
+      }
       util_dump_struct_end(stream);
       util_dump_elem_end(stream);
    }
@@ -476,8 +480,10 @@ util_dump_depth_stencil_alpha_state(struct os_stream *stream, const struct pipe_
    util_dump_member_begin(stream, "alpha");
    util_dump_struct_begin(stream, "pipe_alpha_state");
    util_dump_member(stream, bool, &state->alpha, enabled);
-   util_dump_member(stream, enum_func, &state->alpha, func);
-   util_dump_member(stream, float, &state->alpha, ref_value);
+   if (state->alpha.enabled) {
+      util_dump_member(stream, enum_func, &state->alpha, func);
+      util_dump_member(stream, float, &state->alpha, ref_value);
+   }
    util_dump_struct_end(stream);
    util_dump_member_end(stream);
 
@@ -490,14 +496,15 @@ util_dump_rt_blend_state(struct os_stream *stream, const struct pipe_rt_blend_st
    util_dump_struct_begin(stream, "pipe_rt_blend_state");
 
    util_dump_member(stream, uint, state, blend_enable);
-
-   util_dump_member(stream, enum_blend_func, state, rgb_func);
-   util_dump_member(stream, enum_blend_factor, state, rgb_src_factor);
-   util_dump_member(stream, enum_blend_factor, state, rgb_dst_factor);
-
-   util_dump_member(stream, enum_blend_func, state, alpha_func);
-   util_dump_member(stream, enum_blend_factor, state, alpha_src_factor);
-   util_dump_member(stream, enum_blend_factor, state, alpha_dst_factor);
+   if (state->blend_enable) {
+      util_dump_member(stream, enum_blend_func, state, rgb_func);
+      util_dump_member(stream, enum_blend_factor, state, rgb_src_factor);
+      util_dump_member(stream, enum_blend_factor, state, rgb_dst_factor);
+
+      util_dump_member(stream, enum_blend_func, state, alpha_func);
+      util_dump_member(stream, enum_blend_factor, state, alpha_src_factor);
+      util_dump_member(stream, enum_blend_factor, state, alpha_dst_factor);
+   }
 
    util_dump_member(stream, uint, state, colormask);
 
@@ -519,15 +526,18 @@ util_dump_blend_state(struct os_stream *stream, const struct pipe_blend_state *s
    util_dump_member(stream, bool, state, dither);
 
    util_dump_member(stream, bool, state, logicop_enable);
-   util_dump_member(stream, enum_func, state, logicop_func);
-
-   util_dump_member(stream, bool, state, independent_blend_enable);
-
-   util_dump_member_begin(stream, "rt");
-   if (state->independent_blend_enable)
-      valid_entries = PIPE_MAX_COLOR_BUFS;
-   util_dump_struct_array(stream, rt_blend_state, state->rt, valid_entries);
-   util_dump_member_end(stream);
+   if (state->logicop_enable) {
+      util_dump_member(stream, enum_func, state, logicop_func);
+   }
+   else {
+      util_dump_member(stream, bool, state, independent_blend_enable);
+
+      util_dump_member_begin(stream, "rt");
+      if (state->independent_blend_enable)
+         valid_entries = PIPE_MAX_COLOR_BUFS;
+      util_dump_struct_array(stream, rt_blend_state, state->rt, valid_entries);
+      util_dump_member_end(stream);
+   }
 
    util_dump_struct_end(stream);
 }
@@ -595,7 +605,7 @@ util_dump_sampler_state(struct os_stream *stream, const struct pipe_sampler_stat
    util_dump_member(stream, uint, state, min_mip_filter);
    util_dump_member(stream, uint, state, mag_img_filter);
    util_dump_member(stream, uint, state, compare_mode);
-   util_dump_member(stream, uint, state, compare_func);
+   util_dump_member(stream, enum_func, state, compare_func);
    util_dump_member(stream, bool, state, normalized_coords);
    util_dump_member(stream, uint, state, max_anisotropy);
    util_dump_member(stream, float, state, lod_bias);