Path: blob/21.2-virgl/src/gallium/drivers/svga/svga_format.h
4570 views
/**********************************************************1* Copyright 2011 VMware, Inc. All rights reserved.2*3* Permission is hereby granted, free of charge, to any person4* obtaining a copy of this software and associated documentation5* files (the "Software"), to deal in the Software without6* restriction, including without limitation the rights to use, copy,7* modify, merge, publish, distribute, sublicense, and/or sell copies8* of the Software, and to permit persons to whom the Software is9* furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be12* included in all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND17* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS18* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN19* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN20* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21* SOFTWARE.22*23**********************************************************/2425#ifndef SVGA_FORMAT_H_26#define SVGA_FORMAT_H_272829#include "pipe/p_format.h"30#include "svga_context.h"31#include "svga_types.h"32#include "svga_reg.h"33#include "svga3d_reg.h"343536struct svga_screen;373839/**40* Vertex format flags. These are used to specify that some vertex formats41* need extra processing/conversion in the vertex shader. For example,42* setting the W component to 1, or swapping R/B, or converting packed uint43* types to signed int/snorm.44*/45#define VF_ADJUST_RANGE (1 << 0)46#define VF_W_TO_1 (1 << 1)47#define VF_U_TO_F_CAST (1 << 2) /* convert uint to float */48#define VF_I_TO_F_CAST (1 << 3) /* convert sint to float */49#define VF_BGRA (1 << 4) /* swap R/B */50#define VF_PUINT_TO_SNORM (1 << 5) /* 10_10_10_2 to snorm */51#define VF_PUINT_TO_USCALED (1 << 6) /* 10_10_10_2 to uscaled */52#define VF_PUINT_TO_SSCALED (1 << 7) /* 10_10_10_2 to sscaled */5354/**55* Texture format flags.56*/57#define TF_GEN_MIPS (1 << 8) /* supports hw generate mipmap */58#define TF_000X (1 << 9) /* swizzle <0, 0, 0, X> */59#define TF_XXXX (1 << 10) /* swizzle <X, X, X, X> */60#define TF_XXX1 (1 << 11) /* swizzle <X, X, X, 1> */61#define TF_XXXY (1 << 12) /* swizzle <X, X, X, Y> */6263void64svga_translate_vertex_format_vgpu10(enum pipe_format format,65SVGA3dSurfaceFormat *svga_format,66unsigned *vf_flags);6768void69svga_translate_texture_buffer_view_format(enum pipe_format format,70SVGA3dSurfaceFormat *svga_format,71unsigned *tf_flags);7273enum SVGA3dSurfaceFormat74svga_translate_format(const struct svga_screen *ss,75enum pipe_format format,76unsigned bind);7778void79svga_get_format_cap(struct svga_screen *ss,80SVGA3dSurfaceFormat format,81SVGA3dSurfaceFormatCaps *caps);8283void84svga_format_size(SVGA3dSurfaceFormat format,85unsigned *block_width,86unsigned *block_height,87unsigned *bytes_per_block);8889const char *90svga_format_name(SVGA3dSurfaceFormat format);9192boolean93svga_format_is_integer(SVGA3dSurfaceFormat format);9495boolean96svga_format_support_gen_mips(enum pipe_format format);9798enum tgsi_return_type99svga_get_texture_datatype(enum pipe_format format);100101102// XXX: Move this to svga_context?103boolean104svga_has_any_integer_cbufs(const struct svga_context *svga);105106107SVGA3dSurfaceFormat108svga_typeless_format(SVGA3dSurfaceFormat format);109110111SVGA3dSurfaceFormat112svga_sampler_format(SVGA3dSurfaceFormat format);113114115bool116svga_format_is_uncompressed_snorm(SVGA3dSurfaceFormat format);117118119bool120svga_format_is_typeless(SVGA3dSurfaceFormat format);121122bool123svga_format_is_shareable(const struct svga_screen *ss,124enum pipe_format pformat,125SVGA3dSurfaceFormat sformat,126unsigned bind,127bool verbose);128129SVGA3dSurfaceFormat130svga_linear_to_srgb(SVGA3dSurfaceFormat format);131132133bool134svga_is_format_supported(struct pipe_screen *screen,135enum pipe_format format,136enum pipe_texture_target target,137unsigned sample_count,138unsigned storage_sample_count,139unsigned bindings);140141142bool143svga_is_dx_format_supported(struct pipe_screen *screen,144enum pipe_format format,145enum pipe_texture_target target,146unsigned sample_count,147unsigned storage_sample_count,148unsigned bindings);149150#endif /* SVGA_FORMAT_H_ */151152153