1fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri/************************************************************************** 2fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * 3fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * Copyright 2010 Luca Barbieri 4fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * 5fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * Permission is hereby granted, free of charge, to any person obtaining 6fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * a copy of this software and associated documentation files (the 7fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * "Software"), to deal in the Software without restriction, including 8fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * without limitation the rights to use, copy, modify, merge, publish, 9fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * distribute, sublicense, and/or sell copies of the Software, and to 10fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * permit persons to whom the Software is furnished to do so, subject to 11fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * the following conditions: 12fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * 13fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * The above copyright notice and this permission notice (including the 14fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * next paragraph) shall be included in all copies or substantial 15fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * portions of the Software. 16fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * 17fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 21fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri * 25fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri **************************************************************************/ 26fa32fde26cbb770c6ffa0a0ead529d511eab1eb1Luca Barbieri 27137ba91aadd7a3a24c1a7d76dd8bd5f7aa477fd2Kai Wasserbäch#include "pipe/p_state.h" 28137ba91aadd7a3a24c1a7d76dd8bd5f7aa477fd2Kai Wasserbäch#include "util/u_format.h" 29137ba91aadd7a3a24c1a7d76dd8bd5f7aa477fd2Kai Wasserbäch#include "util/u_debug_describe.h" 30137ba91aadd7a3a24c1a7d76dd8bd5f7aa477fd2Kai Wasserbäch#include "util/u_string.h" 31d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri 32d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbierivoid 33d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieridebug_describe_reference(char* buf, const struct pipe_reference*ptr) 34d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri{ 35d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri strcpy(buf, "pipe_object"); 36d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri} 37d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri 38d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbierivoid 39d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieridebug_describe_resource(char* buf, const struct pipe_resource *ptr) 40d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri{ 41bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri switch(ptr->target) 42bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri { 43bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri case PIPE_BUFFER: 44121aa3cfcb106be1ecaae102177bb882bfbce9d9José Fonseca util_sprintf(buf, "pipe_buffer<%u>", (unsigned)util_format_get_stride(ptr->format, ptr->width0)); 45bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 46bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri case PIPE_TEXTURE_1D: 47d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level); 48bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 49bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri case PIPE_TEXTURE_2D: 50d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri util_sprintf(buf, "pipe_texture2d<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); 51bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 52bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri case PIPE_TEXTURE_RECT: 53061c2a7cb3924f1983554aa1d53b78238196c412Luca Barbieri util_sprintf(buf, "pipe_texture_rect<%u,%u,%s>", ptr->width0, ptr->height0, util_format_short_name(ptr->format)); 54bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 55bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri case PIPE_TEXTURE_CUBE: 56d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri util_sprintf(buf, "pipe_texture_cube<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); 57bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 58bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri case PIPE_TEXTURE_3D: 59d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri util_sprintf(buf, "pipe_texture3d<%u,%u,%u,%s,%u>", ptr->width0, ptr->height0, ptr->depth0, util_format_short_name(ptr->format), ptr->last_level); 60bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 61bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri default: 62d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri util_sprintf(buf, "pipe_martian_resource<%u>", ptr->target); 63bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri break; 64bed9dff9d94e33d34340183d7cb633869dcb4f90Luca Barbieri } 65d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri} 66d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri 67d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbierivoid 68d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieridebug_describe_surface(char* buf, const struct pipe_surface *ptr) 69d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri{ 70d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri char res[128]; 71d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri debug_describe_resource(res, ptr->texture); 724c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->u.tex.level, ptr->u.tex.first_layer, ptr->u.tex.last_layer); 73d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri} 74d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri 75d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbierivoid 76d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieridebug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr) 77d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri{ 78d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri char res[128]; 79d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri debug_describe_resource(res, ptr->texture); 80d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format)); 81d46f91af68e4930b84dd066687c4d865cb54c9b3Luca Barbieri} 828a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák 838a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšákvoid 848a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšákdebug_describe_so_target(char* buf, 858a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák const struct pipe_stream_output_target *ptr) 868a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák{ 878a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák char res[128]; 888a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák debug_describe_resource(res, ptr->buffer); 898a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák util_sprintf(buf, "pipe_stream_output_target<%s,%u,%u>", res, 908a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák ptr->buffer_offset, ptr->buffer_size); 918a9a37cebeff19b56afed43ae037d00950fa7594Marek Olšák} 92