Home | History | Annotate | Download | only in util
      1 /**************************************************************************
      2  *
      3  * Copyright 2010 Vmware, Inc.
      4  * All Rights Reserved.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the
      8  * "Software"), to deal in the Software without restriction, including
      9  * without limitation the rights to use, copy, modify, merge, publish,
     10  * distribute, sub license, and/or sell copies of the Software, and to
     11  * permit persons to whom the Software is furnished to do so, subject to
     12  * the following conditions:
     13  *
     14  * The above copyright notice and this permission notice (including the
     15  * next paragraph) shall be included in all copies or substantial portions
     16  * of the Software.
     17  *
     18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
     21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
     22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     25  *
     26  **************************************************************************/
     27 
     28 #ifndef U_CAPS_H
     29 #define U_CAPS_H
     30 
     31 #include "pipe/p_compiler.h"
     32 
     33 struct pipe_screen;
     34 
     35 enum u_caps_check_enum {
     36    UTIL_CAPS_CHECK_TERMINATE = 0,
     37    UTIL_CAPS_CHECK_CAP,
     38    UTIL_CAPS_CHECK_INT,
     39    UTIL_CAPS_CHECK_FLOAT,
     40    UTIL_CAPS_CHECK_FORMAT,
     41    UTIL_CAPS_CHECK_SHADER,
     42    UTIL_CAPS_CHECK_UNIMPLEMENTED,
     43 };
     44 
     45 #define UTIL_CHECK_CAP(cap) \
     46    UTIL_CAPS_CHECK_CAP, PIPE_CAP_##cap
     47 
     48 #define UTIL_CHECK_INT(cap, higher) \
     49    UTIL_CAPS_CHECK_INT, PIPE_CAP_##cap, (unsigned)(higher)
     50 
     51 /* Floats currently lose precision */
     52 #define UTIL_CHECK_FLOAT(cap, higher) \
     53    UTIL_CAPS_CHECK_FLOAT, PIPE_CAPF_##cap, (unsigned)(int)(higher)
     54 
     55 #define UTIL_CHECK_FORMAT(format) \
     56    UTIL_CAPS_CHECK_FORMAT, PIPE_FORMAT_##format
     57 
     58 #define UTIL_CHECK_SHADER(shader, cap, higher) \
     59    UTIL_CAPS_CHECK_SHADER, (PIPE_SHADER_##shader << 24) | PIPE_SHADER_CAP_##cap, (unsigned)(higher)
     60 
     61 #define UTIL_CHECK_UNIMPLEMENTED \
     62    UTIL_CAPS_CHECK_UNIMPLEMENTED
     63 
     64 #define UTIL_CHECK_TERMINATE \
     65    UTIL_CAPS_CHECK_TERMINATE
     66 
     67 boolean util_check_caps(struct pipe_screen *screen, const unsigned *list);
     68 boolean util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out);
     69 void util_caps_demo_print(struct pipe_screen *screen);
     70 
     71 #endif
     72