revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mesa / src / gallium / drivers / softpipe / sp_tex_sample.h
blobf0b867edc6e9e4860ee280deb32da5650818b09f
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 * Copyright 2010 VMware, Inc. All rights reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
17 * of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
29 #ifndef SP_TEX_SAMPLE_H
30 #define SP_TEX_SAMPLE_H
33 #include "tgsi/tgsi_exec.h"
35 struct sp_sampler_variant;
37 typedef void (*wrap_nearest_func)(const float s[4],
38 unsigned size,
39 int icoord[4]);
41 typedef void (*wrap_linear_func)(const float s[4],
42 unsigned size,
43 int icoord0[4],
44 int icoord1[4],
45 float w[4]);
47 typedef float (*compute_lambda_func)(const struct sp_sampler_variant *sampler,
48 const float s[QUAD_SIZE],
49 const float t[QUAD_SIZE],
50 const float p[QUAD_SIZE]);
52 typedef void (*filter_func)(struct tgsi_sampler *tgsi_sampler,
53 const float s[QUAD_SIZE],
54 const float t[QUAD_SIZE],
55 const float p[QUAD_SIZE],
56 const float c0[QUAD_SIZE],
57 enum tgsi_sampler_control control,
58 float rgba[NUM_CHANNELS][QUAD_SIZE]);
61 union sp_sampler_key {
62 struct {
63 unsigned target:3;
64 unsigned is_pot:1;
65 unsigned processor:2;
66 unsigned unit:4;
67 unsigned swizzle_r:3;
68 unsigned swizzle_g:3;
69 unsigned swizzle_b:3;
70 unsigned swizzle_a:3;
71 unsigned pad:10;
72 } bits;
73 unsigned value;
76 /**
77 * Subclass of tgsi_sampler
79 struct sp_sampler_variant
81 struct tgsi_sampler base; /**< base class */
83 union sp_sampler_key key;
85 /* The owner of this struct:
87 const struct pipe_sampler_state *sampler;
90 /* Currently bound texture:
92 const struct pipe_sampler_view *view;
93 struct softpipe_tex_tile_cache *cache;
95 unsigned processor;
97 /* For sp_get_samples_2d_linear_POT:
99 unsigned xpot;
100 unsigned ypot;
101 unsigned level;
103 unsigned faces[4];
105 wrap_nearest_func nearest_texcoord_s;
106 wrap_nearest_func nearest_texcoord_t;
107 wrap_nearest_func nearest_texcoord_p;
109 wrap_linear_func linear_texcoord_s;
110 wrap_linear_func linear_texcoord_t;
111 wrap_linear_func linear_texcoord_p;
113 filter_func min_img_filter;
114 filter_func mag_img_filter;
116 compute_lambda_func compute_lambda;
118 filter_func mip_filter;
119 filter_func compare;
120 filter_func sample_target;
122 /* Linked list:
124 struct sp_sampler_variant *next;
127 struct sp_sampler;
129 /* Create a sampler variant for a given set of non-orthogonal state. Currently the
131 struct sp_sampler_variant *
132 sp_create_sampler_variant( const struct pipe_sampler_state *sampler,
133 const union sp_sampler_key key );
135 void sp_sampler_variant_bind_view( struct sp_sampler_variant *variant,
136 struct softpipe_tex_tile_cache *tex_cache,
137 const struct pipe_sampler_view *view );
139 void sp_sampler_variant_destroy( struct sp_sampler_variant * );
143 static INLINE struct sp_sampler_variant *
144 sp_sampler_variant(const struct tgsi_sampler *sampler)
146 return (struct sp_sampler_variant *) sampler;
149 extern void
150 sp_get_samples(struct tgsi_sampler *tgsi_sampler,
151 const float s[QUAD_SIZE],
152 const float t[QUAD_SIZE],
153 const float p[QUAD_SIZE],
154 float lodbias,
155 float rgba[NUM_CHANNELS][QUAD_SIZE]);
158 #endif /* SP_TEX_SAMPLE_H */