/**************************************************************************
*
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2008 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tgsi/tgsi_dump.h"
#include "tr_dump.h"
+#include "tr_dump_defines.h"
#include "tr_dump_state.h"
-void trace_dump_format(enum pipe_format format)
-{
- if (!trace_dumping_enabled_locked())
- return;
-
- trace_dump_enum(util_format_name(format) );
-}
-
-
void trace_dump_resource_template(const struct pipe_resource *templat)
{
if (!trace_dumping_enabled_locked())
trace_dump_member_end();
trace_dump_member(uint, templat, last_level);
+ trace_dump_member(uint, templat, nr_samples);
trace_dump_member(uint, templat, usage);
trace_dump_member(uint, templat, bind);
trace_dump_member(uint, templat, flags);
trace_dump_struct_begin("pipe_box");
- trace_dump_member(uint, box, x);
- trace_dump_member(uint, box, y);
- trace_dump_member(uint, box, z);
- trace_dump_member(uint, box, width);
- trace_dump_member(uint, box, height);
- trace_dump_member(uint, box, depth);
+ trace_dump_member(int, box, x);
+ trace_dump_member(int, box, y);
+ trace_dump_member(int, box, z);
+ trace_dump_member(int, box, width);
+ trace_dump_member(int, box, height);
+ trace_dump_member(int, box, depth);
trace_dump_struct_end();
}
trace_dump_member(bool, state, flatshade);
trace_dump_member(bool, state, light_twoside);
+ trace_dump_member(bool, state, clamp_vertex_color);
+ trace_dump_member(bool, state, clamp_fragment_color);
trace_dump_member(uint, state, front_ccw);
trace_dump_member(uint, state, cull_face);
trace_dump_member(uint, state, fill_front);
trace_dump_member(bool, state, poly_smooth);
trace_dump_member(bool, state, poly_stipple_enable);
trace_dump_member(bool, state, point_smooth);
- trace_dump_member(uint, state, sprite_coord_enable);
trace_dump_member(bool, state, sprite_coord_mode);
trace_dump_member(bool, state, point_quad_rasterization);
trace_dump_member(bool, state, point_size_per_vertex);
trace_dump_member(bool, state, multisample);
trace_dump_member(bool, state, line_smooth);
trace_dump_member(bool, state, line_stipple_enable);
- trace_dump_member(uint, state, line_stipple_factor);
- trace_dump_member(uint, state, line_stipple_pattern);
trace_dump_member(bool, state, line_last_pixel);
+
trace_dump_member(bool, state, flatshade_first);
- trace_dump_member(bool, state, gl_rasterization_rules);
+
+ trace_dump_member(bool, state, half_pixel_center);
+ trace_dump_member(bool, state, bottom_edge_rule);
+
+ trace_dump_member(bool, state, rasterizer_discard);
+
+ trace_dump_member(bool, state, depth_clip);
+
+ trace_dump_member(bool, state, clip_halfz);
+
+ trace_dump_member(uint, state, clip_plane_enable);
+
+ trace_dump_member(uint, state, line_stipple_factor);
+ trace_dump_member(uint, state, line_stipple_pattern);
+
+ trace_dump_member(uint, state, sprite_coord_enable);
trace_dump_member(float, state, line_width);
trace_dump_member(float, state, point_size);
trace_dump_array_end();
trace_dump_member_end();
- trace_dump_member(uint, state, nr);
-
trace_dump_struct_end();
}
void trace_dump_shader_state(const struct pipe_shader_state *state)
{
- static char str[8192];
unsigned i;
if (!trace_dumping_enabled_locked())
return;
}
- tgsi_dump_str(state->tokens, 0, str, sizeof(str));
trace_dump_struct_begin("pipe_shader_state");
trace_dump_member_begin("tokens");
- trace_dump_string(str);
+ if (state->tokens) {
+ static char str[64 * 1024];
+ tgsi_dump_str(state->tokens, 0, str, sizeof(str));
+ trace_dump_string(str);
+ } else {
+ trace_dump_null();
+ }
trace_dump_member_end();
trace_dump_member_begin("stream_output");
trace_dump_struct_begin("pipe_stream_output_info");
trace_dump_member(uint, &state->stream_output, num_outputs);
- trace_dump_member(uint, &state->stream_output, stride);
+ trace_dump_member_array(uint, &state->stream_output, stride);
+ trace_dump_member_begin("output");
trace_dump_array_begin();
for(i = 0; i < state->stream_output.num_outputs; ++i) {
trace_dump_elem_begin();
trace_dump_struct_begin(""); /* anonymous */
trace_dump_member(uint, &state->stream_output.output[i], register_index);
- trace_dump_member(uint, &state->stream_output.output[i], register_mask);
+ trace_dump_member(uint, &state->stream_output.output[i], start_component);
+ trace_dump_member(uint, &state->stream_output.output[i], num_components);
trace_dump_member(uint, &state->stream_output.output[i], output_buffer);
+ trace_dump_member(uint, &state->stream_output.output[i], dst_offset);
+ trace_dump_member(uint, &state->stream_output.output[i], stream);
trace_dump_struct_end();
trace_dump_elem_end();
}
trace_dump_array_end();
+ trace_dump_member_end(); // output
trace_dump_struct_end();
- trace_dump_member_end();
+ trace_dump_member_end(); // stream_output
trace_dump_struct_end();
}
trace_dump_member(uint, state, compare_func);
trace_dump_member(bool, state, normalized_coords);
trace_dump_member(uint, state, max_anisotropy);
+ trace_dump_member(bool, state, seamless_cube_map);
trace_dump_member(float, state, lod_bias);
trace_dump_member(float, state, min_lod);
trace_dump_member(float, state, max_lod);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
- trace_dump_member(uint, state, usage);
-
trace_dump_member_begin("u");
trace_dump_struct_begin(""); /* anonymous */
if (target == PIPE_BUFFER) {
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, buffer_offset);
trace_dump_member(resource_ptr, state, buffer);
+ trace_dump_member(ptr, state, user_buffer);
trace_dump_struct_end();
}
trace_dump_member(uint, state, index_size);
trace_dump_member(uint, state, offset);
trace_dump_member(resource_ptr, state, buffer);
+ trace_dump_member(ptr, state, user_buffer);
trace_dump_struct_end();
}
}
+void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
+{
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if(!state) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_constant_buffer");
+ trace_dump_member(ptr, state, buffer);
+ trace_dump_member(uint, state, buffer_offset);
+ trace_dump_member(uint, state, buffer_size);
+ trace_dump_struct_end();
+}
+
+
void trace_dump_draw_info(const struct pipe_draw_info *state)
{
if (!trace_dumping_enabled_locked())
trace_dump_member(ptr, state, count_from_stream_output);
+ trace_dump_member(ptr, state, indirect);
+ trace_dump_member(uint, state, indirect_offset);
+
trace_dump_struct_end();
}
+
+void trace_dump_blit_info(const struct pipe_blit_info *info)
+{
+ char mask[7];
+
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if (!info) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_blit_info");
+
+ trace_dump_member_begin("dst");
+ trace_dump_struct_begin("dst");
+ trace_dump_member(resource_ptr, &info->dst, resource);
+ trace_dump_member(uint, &info->dst, level);
+ trace_dump_member(format, &info->dst, format);
+ trace_dump_member_begin("box");
+ trace_dump_box(&info->dst.box);
+ trace_dump_member_end();
+ trace_dump_struct_end();
+ trace_dump_member_end();
+
+ trace_dump_member_begin("src");
+ trace_dump_struct_begin("src");
+ trace_dump_member(resource_ptr, &info->src, resource);
+ trace_dump_member(uint, &info->src, level);
+ trace_dump_member(format, &info->src, format);
+ trace_dump_member_begin("box");
+ trace_dump_box(&info->src.box);
+ trace_dump_member_end();
+ trace_dump_struct_end();
+ trace_dump_member_end();
+
+ mask[0] = (info->mask & PIPE_MASK_R) ? 'R' : '-';
+ mask[1] = (info->mask & PIPE_MASK_G) ? 'G' : '-';
+ mask[2] = (info->mask & PIPE_MASK_B) ? 'B' : '-';
+ mask[3] = (info->mask & PIPE_MASK_A) ? 'A' : '-';
+ mask[4] = (info->mask & PIPE_MASK_Z) ? 'Z' : '-';
+ mask[5] = (info->mask & PIPE_MASK_S) ? 'S' : '-';
+ mask[6] = 0;
+
+ trace_dump_member_begin("mask");
+ trace_dump_string(mask);
+ trace_dump_member_end();
+ trace_dump_member(uint, info, filter);
+
+ trace_dump_member(bool, info, scissor_enable);
+ trace_dump_member_begin("scissor");
+ trace_dump_scissor_state(&info->scissor);
+ trace_dump_member_end();
+
+ trace_dump_struct_end();
+}
+
+void
+trace_dump_query_result(unsigned query_type,
+ const union pipe_query_result *result)
+{
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if (!result) {
+ trace_dump_null();
+ return;
+ }
+
+ switch (query_type) {
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
+ case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+ case PIPE_QUERY_GPU_FINISHED:
+ trace_dump_bool(result->b);
+ break;
+
+ case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_TIMESTAMP:
+ case PIPE_QUERY_TIME_ELAPSED:
+ case PIPE_QUERY_PRIMITIVES_GENERATED:
+ case PIPE_QUERY_PRIMITIVES_EMITTED:
+ trace_dump_uint(result->u64);
+ break;
+
+ case PIPE_QUERY_SO_STATISTICS:
+ trace_dump_struct_begin("pipe_query_data_so_statistics");
+ trace_dump_member(uint, &result->so_statistics, num_primitives_written);
+ trace_dump_member(uint, &result->so_statistics, primitives_storage_needed);
+ trace_dump_struct_end();
+ break;
+
+ case PIPE_QUERY_TIMESTAMP_DISJOINT:
+ trace_dump_struct_begin("pipe_query_data_timestamp_disjoint");
+ trace_dump_member(uint, &result->timestamp_disjoint, frequency);
+ trace_dump_member(bool, &result->timestamp_disjoint, disjoint);
+ trace_dump_struct_end();
+ break;
+
+ case PIPE_QUERY_PIPELINE_STATISTICS:
+ trace_dump_struct_begin("pipe_query_data_pipeline_statistics");
+ trace_dump_member(uint, &result->pipeline_statistics, ia_vertices);
+ trace_dump_member(uint, &result->pipeline_statistics, ia_primitives);
+ trace_dump_member(uint, &result->pipeline_statistics, vs_invocations);
+ trace_dump_member(uint, &result->pipeline_statistics, gs_invocations);
+ trace_dump_member(uint, &result->pipeline_statistics, gs_primitives);
+ trace_dump_member(uint, &result->pipeline_statistics, c_invocations);
+ trace_dump_member(uint, &result->pipeline_statistics, c_primitives);
+ trace_dump_member(uint, &result->pipeline_statistics, ps_invocations);
+ trace_dump_member(uint, &result->pipeline_statistics, hs_invocations);
+ trace_dump_member(uint, &result->pipeline_statistics, ds_invocations);
+ trace_dump_member(uint, &result->pipeline_statistics, cs_invocations);
+ trace_dump_struct_end();
+ break;
+
+ default:
+ assert(query_type >= PIPE_QUERY_DRIVER_SPECIFIC);
+ trace_dump_uint(result->u64);
+ break;
+ }
+}