Path: blob/21.2-virgl/src/gallium/drivers/freedreno/a5xx/fd5_texture.h
4574 views
/*1* Copyright (C) 2016 Rob Clark <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*22* Authors:23* Rob Clark <[email protected]>24*/2526#ifndef FD5_TEXTURE_H_27#define FD5_TEXTURE_H_2829#include "pipe/p_context.h"3031#include "freedreno_resource.h"32#include "freedreno_texture.h"3334#include "fd5_context.h"35#include "fd5_format.h"3637struct fd5_sampler_stateobj {38struct pipe_sampler_state base;39uint32_t texsamp0, texsamp1, texsamp2, texsamp3;40bool needs_border;41};4243static inline struct fd5_sampler_stateobj *44fd5_sampler_stateobj(struct pipe_sampler_state *samp)45{46return (struct fd5_sampler_stateobj *)samp;47}4849struct fd5_pipe_sampler_view {50struct pipe_sampler_view base;51uint32_t texconst0, texconst1, texconst2, texconst3, texconst5;52uint32_t texconst6, texconst7, texconst8, texconst9, texconst10, texconst11;53uint32_t offset;54bool astc_srgb;55};5657static inline struct fd5_pipe_sampler_view *58fd5_pipe_sampler_view(struct pipe_sampler_view *pview)59{60return (struct fd5_pipe_sampler_view *)pview;61}6263void fd5_texture_init(struct pipe_context *pctx);6465static inline enum a5xx_tex_type66fd5_tex_type(unsigned target)67{68switch (target) {69default:70assert(0);71case PIPE_BUFFER:72case PIPE_TEXTURE_1D:73case PIPE_TEXTURE_1D_ARRAY:74return A5XX_TEX_1D;75case PIPE_TEXTURE_RECT:76case PIPE_TEXTURE_2D:77case PIPE_TEXTURE_2D_ARRAY:78return A5XX_TEX_2D;79case PIPE_TEXTURE_3D:80return A5XX_TEX_3D;81case PIPE_TEXTURE_CUBE:82case PIPE_TEXTURE_CUBE_ARRAY:83return A5XX_TEX_CUBE;84}85}8687#endif /* FD5_TEXTURE_H_ */888990