"Fossies" - the Fresh Open Source Software Archive

Member "mesa-20.1.8/src/gallium/drivers/svga/svga_format.h" (16 Sep 2020, 5069 Bytes) of package /linux/misc/mesa-20.1.8.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "svga_format.h" see the Fossies "Dox" file reference documentation.

    1 /**********************************************************
    2  * Copyright 2011 VMware, Inc.  All rights reserved.
    3  *
    4  * Permission is hereby granted, free of charge, to any person
    5  * obtaining a copy of this software and associated documentation
    6  * files (the "Software"), to deal in the Software without
    7  * restriction, including without limitation the rights to use, copy,
    8  * modify, merge, publish, distribute, sublicense, and/or sell copies
    9  * of the Software, and to permit persons to whom the Software is
   10  * furnished to do so, subject to the following conditions:
   11  *
   12  * The above copyright notice and this permission notice shall be
   13  * included in all copies or substantial portions of the Software.
   14  *
   15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
   19  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   20  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   22  * SOFTWARE.
   23  *
   24  **********************************************************/
   25 
   26 #ifndef SVGA_FORMAT_H_
   27 #define SVGA_FORMAT_H_
   28 
   29 
   30 #include "pipe/p_format.h"
   31 #include "svga_context.h"
   32 #include "svga_types.h"
   33 #include "svga_reg.h"
   34 #include "svga3d_reg.h"
   35 
   36 
   37 struct svga_screen;
   38 
   39 
   40 /**
   41  * Vertex format flags.  These are used to specify that some vertex formats
   42  * need extra processing/conversion in the vertex shader.  For example,
   43  * setting the W component to 1, or swapping R/B, or converting packed uint
   44  * types to signed int/snorm.
   45  */
   46 #define VF_ADJUST_RANGE     (1 << 0)
   47 #define VF_W_TO_1           (1 << 1)
   48 #define VF_U_TO_F_CAST      (1 << 2)  /* convert uint to float */
   49 #define VF_I_TO_F_CAST      (1 << 3)  /* convert sint to float */
   50 #define VF_BGRA             (1 << 4)  /* swap R/B */
   51 #define VF_PUINT_TO_SNORM   (1 << 5)  /* 10_10_10_2 to snorm */
   52 #define VF_PUINT_TO_USCALED (1 << 6)  /* 10_10_10_2 to uscaled */
   53 #define VF_PUINT_TO_SSCALED (1 << 7)  /* 10_10_10_2 to sscaled */
   54 
   55 /**
   56  * Texture format flags.
   57  */
   58 #define TF_GEN_MIPS         (1 << 8)  /* supports hw generate mipmap */
   59 #define TF_000X             (1 << 9)  /* swizzle <0, 0, 0, X> */
   60 #define TF_XXXX             (1 << 10) /* swizzle <X, X, X, X> */
   61 #define TF_XXX1             (1 << 11) /* swizzle <X, X, X, 1> */
   62 #define TF_XXXY             (1 << 12) /* swizzle <X, X, X, Y> */
   63 
   64 void
   65 svga_translate_vertex_format_vgpu10(enum pipe_format format,
   66                                     SVGA3dSurfaceFormat *svga_format,
   67                                     unsigned *vf_flags);
   68 
   69 void
   70 svga_translate_texture_buffer_view_format(enum pipe_format format,
   71                                           SVGA3dSurfaceFormat *svga_format,
   72                                           unsigned *tf_flags);
   73 
   74 enum SVGA3dSurfaceFormat
   75 svga_translate_format(const struct svga_screen *ss,
   76                       enum pipe_format format,
   77                       unsigned bind);
   78 
   79 void
   80 svga_get_format_cap(struct svga_screen *ss,
   81                     SVGA3dSurfaceFormat format,
   82                     SVGA3dSurfaceFormatCaps *caps);
   83 
   84 void
   85 svga_format_size(SVGA3dSurfaceFormat format,
   86                  unsigned *block_width,
   87                  unsigned *block_height,
   88                  unsigned *bytes_per_block);
   89 
   90 const char *
   91 svga_format_name(SVGA3dSurfaceFormat format);
   92 
   93 boolean
   94 svga_format_is_integer(SVGA3dSurfaceFormat format);
   95 
   96 boolean
   97 svga_format_support_gen_mips(enum pipe_format format);
   98 
   99 enum tgsi_return_type
  100 svga_get_texture_datatype(enum pipe_format format);
  101 
  102 
  103 // XXX: Move this to svga_context?
  104 boolean
  105 svga_has_any_integer_cbufs(const struct svga_context *svga);
  106 
  107 
  108 SVGA3dSurfaceFormat
  109 svga_typeless_format(SVGA3dSurfaceFormat format);
  110 
  111 
  112 SVGA3dSurfaceFormat
  113 svga_sampler_format(SVGA3dSurfaceFormat format);
  114 
  115 
  116 bool
  117 svga_format_is_uncompressed_snorm(SVGA3dSurfaceFormat format);
  118 
  119 
  120 bool
  121 svga_format_is_typeless(SVGA3dSurfaceFormat format);
  122 
  123 bool
  124 svga_format_is_shareable(const struct svga_screen *ss,
  125                          enum pipe_format pformat,
  126                          SVGA3dSurfaceFormat sformat,
  127                          unsigned bind,
  128                          bool verbose);
  129 
  130 SVGA3dSurfaceFormat
  131 svga_linear_to_srgb(SVGA3dSurfaceFormat format);
  132 
  133 
  134 bool
  135 svga_is_format_supported(struct pipe_screen *screen,
  136                          enum pipe_format format,
  137                          enum pipe_texture_target target,
  138                          unsigned sample_count,
  139                          unsigned storage_sample_count,
  140                          unsigned bindings);
  141 
  142 
  143 bool
  144 svga_is_dx_format_supported(struct pipe_screen *screen,
  145                             enum pipe_format format,
  146                             enum pipe_texture_target target,
  147                             unsigned sample_count,
  148                             unsigned storage_sample_count,
  149                             unsigned bindings);
  150 
  151 #endif /* SVGA_FORMAT_H_ */