1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright (C) 2012 Rob Clark <robclark@freedesktop.org>
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21bf215546Sopenharmony_ci * SOFTWARE.
22bf215546Sopenharmony_ci *
23bf215546Sopenharmony_ci * Authors:
24bf215546Sopenharmony_ci *    Rob Clark <robclark@freedesktop.org>
25bf215546Sopenharmony_ci */
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci#ifndef FREEDRENO_TEXTURE_H_
28bf215546Sopenharmony_ci#define FREEDRENO_TEXTURE_H_
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#include "pipe/p_context.h"
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_civoid fd_sampler_states_bind(struct pipe_context *pctx,
33bf215546Sopenharmony_ci                            enum pipe_shader_type shader, unsigned start,
34bf215546Sopenharmony_ci                            unsigned nr, void **hwcso);
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_civoid fd_set_sampler_views(struct pipe_context *pctx,
37bf215546Sopenharmony_ci                          enum pipe_shader_type shader, unsigned start,
38bf215546Sopenharmony_ci                          unsigned nr, unsigned unbind_num_trailing_slots,
39bf215546Sopenharmony_ci                          bool take_ownership,
40bf215546Sopenharmony_ci                          struct pipe_sampler_view **views);
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_civoid fd_texture_init(struct pipe_context *pctx);
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_cistruct fd_texture_stateobj;
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci/* Both a3xx/a4xx share the same layout for the border-color buffer,
47bf215546Sopenharmony_ci * which contains the pre-swizzled (based on texture format) border
48bf215546Sopenharmony_ci * color value, with the following layout (per sampler):
49bf215546Sopenharmony_ci *
50bf215546Sopenharmony_ci *  offset | description
51bf215546Sopenharmony_ci *  -------+-------------
52bf215546Sopenharmony_ci *  0x00:  | fp16[0]   \
53bf215546Sopenharmony_ci *         | fp16[1]   |___ swizzled fp16 channel values for "small float"
54bf215546Sopenharmony_ci *         | fp16[2]   |    formats (<= 16 bits per component, !integer)
55bf215546Sopenharmony_ci *         | fp16[3]   /
56bf215546Sopenharmony_ci *  0x08:  | padding
57bf215546Sopenharmony_ci *  0x10:  | int16[0]  \
58bf215546Sopenharmony_ci *         | int16[1]  |___ swizzled int16 channels for "small integer"
59bf215546Sopenharmony_ci *         | int16[2]  |    formats (<= 16 bits per component, integer)
60bf215546Sopenharmony_ci *         | int16[3]  /
61bf215546Sopenharmony_ci *  0x18:  | padding
62bf215546Sopenharmony_ci *  0x20:  | fp32[0]   \
63bf215546Sopenharmony_ci *         | fp32[1]   |___ swizzled fp32 channel values for "large float"
64bf215546Sopenharmony_ci *         | fp32[2]   |    formats (> 16 bits per component, !integer)
65bf215546Sopenharmony_ci *         | fp32[3]   /
66bf215546Sopenharmony_ci *  0x30:  | int32[0]  \
67bf215546Sopenharmony_ci *         | int32[1]  |___ swizzled int32 channel values for "large int"
68bf215546Sopenharmony_ci *         | int32[2]  |    formats (> 16 bits per component, integer)
69bf215546Sopenharmony_ci *         | int32[3]  /
70bf215546Sopenharmony_ci */
71bf215546Sopenharmony_ci#define BORDERCOLOR_SIZE 0x40
72bf215546Sopenharmony_civoid fd_setup_border_colors(struct fd_texture_stateobj *tex, void *ptr,
73bf215546Sopenharmony_ci                            unsigned offset);
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ci#endif /* FREEDRENO_TEXTURE_H_ */
76