101e04c3fSmrg/* Copyright (c) 2008 VMware, Inc. 201e04c3fSmrg * Copyright © 2018 Intel Corporation 301e04c3fSmrg * 401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a copy 501e04c3fSmrg * of this software and associated documentation files (the "Software"), to deal 601e04c3fSmrg * in the Software without restriction, including without limitation the rights 701e04c3fSmrg * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 801e04c3fSmrg * copies of the Software, and to permit persons to whom the Software is 901e04c3fSmrg * furnished to do so, subject to the following conditions: 1001e04c3fSmrg * 1101e04c3fSmrg * The above copyright notice and this permission notice shall be included in 1201e04c3fSmrg * all copies or substantial portions of the Software. 1301e04c3fSmrg * 1401e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1501e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1601e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1701e04c3fSmrg * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1801e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1901e04c3fSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 2001e04c3fSmrg * SOFTWARE. 2101e04c3fSmrg */ 2201e04c3fSmrg 2301e04c3fSmrg#include "u_prim.h" 247ec681f3Smrg#include "pipe/p_state.h" 2501e04c3fSmrg 2601e04c3fSmrg 2701e04c3fSmrg/** Return string name of given primitive type */ 2801e04c3fSmrgconst char * 2901e04c3fSmrgu_prim_name(enum pipe_prim_type prim) 3001e04c3fSmrg{ 317ec681f3Smrg#if defined(__GNUC__) 327ec681f3Smrg /* Check that the enum is packed: */ 337ec681f3Smrg STATIC_ASSERT(sizeof(enum pipe_prim_type) == 1); 347ec681f3Smrg#endif 357ec681f3Smrg 367ec681f3Smrg /* Draw merging in u_threaded_context requires that sizeof(mode) == 1. */ 377ec681f3Smrg struct pipe_draw_info info; 387ec681f3Smrg STATIC_ASSERT(sizeof(info.mode) == 1); 397ec681f3Smrg 407ec681f3Smrg struct pipe_draw_vertex_state_info dvs_info; 417ec681f3Smrg STATIC_ASSERT(sizeof(dvs_info.mode) == 1); 427ec681f3Smrg 4301e04c3fSmrg static const struct debug_named_value names[] = { 4401e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_POINTS), 4501e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_LINES), 4601e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_LOOP), 4701e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP), 4801e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES), 4901e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP), 5001e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_FAN), 5101e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_QUADS), 5201e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_QUAD_STRIP), 5301e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_POLYGON), 5401e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_LINES_ADJACENCY), 5501e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP_ADJACENCY), 5601e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES_ADJACENCY), 5701e04c3fSmrg DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY), 5801e04c3fSmrg DEBUG_NAMED_VALUE_END 5901e04c3fSmrg }; 6001e04c3fSmrg return debug_dump_enum(names, prim); 6101e04c3fSmrg} 62