1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2007 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/* Authors:
29bf215546Sopenharmony_ci *  Brian Paul
30bf215546Sopenharmony_ci */
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci#include "util/u_memory.h"
33bf215546Sopenharmony_ci#include "util/u_inlines.h"
34bf215546Sopenharmony_ci#include "util/format/u_format.h"
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci#include "draw/draw_context.h"
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci#include "sp_context.h"
39bf215546Sopenharmony_ci#include "sp_state.h"
40bf215546Sopenharmony_ci#include "sp_texture.h"
41bf215546Sopenharmony_ci#include "sp_tex_sample.h"
42bf215546Sopenharmony_ci#include "sp_tex_tile_cache.h"
43bf215546Sopenharmony_ci#include "sp_screen.h"
44bf215546Sopenharmony_ci#include "frontend/sw_winsys.h"
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci
47bf215546Sopenharmony_ci/**
48bf215546Sopenharmony_ci * Bind a range [start, start+num-1] of samplers for a shader stage.
49bf215546Sopenharmony_ci */
50bf215546Sopenharmony_cistatic void
51bf215546Sopenharmony_cisoftpipe_bind_sampler_states(struct pipe_context *pipe,
52bf215546Sopenharmony_ci                             enum pipe_shader_type shader,
53bf215546Sopenharmony_ci                             unsigned start,
54bf215546Sopenharmony_ci                             unsigned num,
55bf215546Sopenharmony_ci                             void **samplers)
56bf215546Sopenharmony_ci{
57bf215546Sopenharmony_ci   struct softpipe_context *softpipe = softpipe_context(pipe);
58bf215546Sopenharmony_ci   unsigned i;
59bf215546Sopenharmony_ci
60bf215546Sopenharmony_ci   assert(shader < PIPE_SHADER_TYPES);
61bf215546Sopenharmony_ci   assert(start + num <= ARRAY_SIZE(softpipe->samplers[shader]));
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_ci   draw_flush(softpipe->draw);
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci   /* set the new samplers */
66bf215546Sopenharmony_ci   for (i = 0; i < num; i++) {
67bf215546Sopenharmony_ci      softpipe->samplers[shader][start + i] = samplers[i];
68bf215546Sopenharmony_ci   }
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci   /* find highest non-null samplers[] entry */
71bf215546Sopenharmony_ci   {
72bf215546Sopenharmony_ci      unsigned j = MAX2(softpipe->num_samplers[shader], start + num);
73bf215546Sopenharmony_ci      while (j > 0 && softpipe->samplers[shader][j - 1] == NULL)
74bf215546Sopenharmony_ci         j--;
75bf215546Sopenharmony_ci      softpipe->num_samplers[shader] = j;
76bf215546Sopenharmony_ci   }
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_ci   if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
79bf215546Sopenharmony_ci      draw_set_samplers(softpipe->draw,
80bf215546Sopenharmony_ci                        shader,
81bf215546Sopenharmony_ci                        softpipe->samplers[shader],
82bf215546Sopenharmony_ci                        softpipe->num_samplers[shader]);
83bf215546Sopenharmony_ci   }
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_ci   softpipe->dirty |= SP_NEW_SAMPLER;
86bf215546Sopenharmony_ci}
87bf215546Sopenharmony_ci
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_cistatic void
90bf215546Sopenharmony_cisoftpipe_sampler_view_destroy(struct pipe_context *pipe,
91bf215546Sopenharmony_ci                              struct pipe_sampler_view *view)
92bf215546Sopenharmony_ci{
93bf215546Sopenharmony_ci   pipe_resource_reference(&view->texture, NULL);
94bf215546Sopenharmony_ci   FREE(view);
95bf215546Sopenharmony_ci}
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ci
98bf215546Sopenharmony_civoid
99bf215546Sopenharmony_cisoftpipe_set_sampler_views(struct pipe_context *pipe,
100bf215546Sopenharmony_ci                           enum pipe_shader_type shader,
101bf215546Sopenharmony_ci                           unsigned start,
102bf215546Sopenharmony_ci                           unsigned num,
103bf215546Sopenharmony_ci                           unsigned unbind_num_trailing_slots,
104bf215546Sopenharmony_ci                           bool take_ownership,
105bf215546Sopenharmony_ci                           struct pipe_sampler_view **views)
106bf215546Sopenharmony_ci{
107bf215546Sopenharmony_ci   struct softpipe_context *softpipe = softpipe_context(pipe);
108bf215546Sopenharmony_ci   uint i;
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_ci   assert(shader < PIPE_SHADER_TYPES);
111bf215546Sopenharmony_ci   assert(start + num <= ARRAY_SIZE(softpipe->sampler_views[shader]));
112bf215546Sopenharmony_ci
113bf215546Sopenharmony_ci   draw_flush(softpipe->draw);
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_ci   /* set the new sampler views */
116bf215546Sopenharmony_ci   for (i = 0; i < num; i++) {
117bf215546Sopenharmony_ci      struct sp_sampler_view *sp_sviewsrc;
118bf215546Sopenharmony_ci      struct sp_sampler_view *sp_sviewdst =
119bf215546Sopenharmony_ci         &softpipe->tgsi.sampler[shader]->sp_sview[start + i];
120bf215546Sopenharmony_ci      struct pipe_sampler_view **pview = &softpipe->sampler_views[shader][start + i];
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ci      if (take_ownership) {
123bf215546Sopenharmony_ci         pipe_sampler_view_reference(pview, NULL);
124bf215546Sopenharmony_ci         *pview = views[i];
125bf215546Sopenharmony_ci      } else {
126bf215546Sopenharmony_ci         pipe_sampler_view_reference(pview, views[i]);
127bf215546Sopenharmony_ci      }
128bf215546Sopenharmony_ci      sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[shader][start + i],
129bf215546Sopenharmony_ci                                         views[i]);
130bf215546Sopenharmony_ci      /*
131bf215546Sopenharmony_ci       * We don't really have variants, however some bits are different per shader,
132bf215546Sopenharmony_ci       * so just copy?
133bf215546Sopenharmony_ci       */
134bf215546Sopenharmony_ci      sp_sviewsrc = (struct sp_sampler_view *)*pview;
135bf215546Sopenharmony_ci      if (sp_sviewsrc) {
136bf215546Sopenharmony_ci         memcpy(sp_sviewdst, sp_sviewsrc, sizeof(*sp_sviewsrc));
137bf215546Sopenharmony_ci         sp_sviewdst->compute_lambda = softpipe_get_lambda_func(&sp_sviewdst->base, shader);
138bf215546Sopenharmony_ci         sp_sviewdst->compute_lambda_from_grad = softpipe_get_lambda_from_grad_func(&sp_sviewdst->base, shader);
139bf215546Sopenharmony_ci         sp_sviewdst->cache = softpipe->tex_cache[shader][start + i];
140bf215546Sopenharmony_ci      }
141bf215546Sopenharmony_ci      else {
142bf215546Sopenharmony_ci         memset(sp_sviewdst, 0,  sizeof(*sp_sviewsrc));
143bf215546Sopenharmony_ci      }
144bf215546Sopenharmony_ci   }
145bf215546Sopenharmony_ci   for (; i < num + unbind_num_trailing_slots; i++) {
146bf215546Sopenharmony_ci      struct pipe_sampler_view **pview = &softpipe->sampler_views[shader][start + i];
147bf215546Sopenharmony_ci      pipe_sampler_view_reference(pview, NULL);
148bf215546Sopenharmony_ci      sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[shader][start + i],
149bf215546Sopenharmony_ci                                         NULL);
150bf215546Sopenharmony_ci   }
151bf215546Sopenharmony_ci
152bf215546Sopenharmony_ci
153bf215546Sopenharmony_ci   /* find highest non-null sampler_views[] entry */
154bf215546Sopenharmony_ci   {
155bf215546Sopenharmony_ci      unsigned j = MAX2(softpipe->num_sampler_views[shader], start + num);
156bf215546Sopenharmony_ci      while (j > 0 && softpipe->sampler_views[shader][j - 1] == NULL)
157bf215546Sopenharmony_ci         j--;
158bf215546Sopenharmony_ci      softpipe->num_sampler_views[shader] = j;
159bf215546Sopenharmony_ci   }
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_ci   if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
162bf215546Sopenharmony_ci      draw_set_sampler_views(softpipe->draw,
163bf215546Sopenharmony_ci                             shader,
164bf215546Sopenharmony_ci                             softpipe->sampler_views[shader],
165bf215546Sopenharmony_ci                             softpipe->num_sampler_views[shader]);
166bf215546Sopenharmony_ci   }
167bf215546Sopenharmony_ci
168bf215546Sopenharmony_ci   softpipe->dirty |= SP_NEW_TEXTURE;
169bf215546Sopenharmony_ci}
170bf215546Sopenharmony_ci
171bf215546Sopenharmony_ci
172bf215546Sopenharmony_cistatic void
173bf215546Sopenharmony_cisoftpipe_delete_sampler_state(struct pipe_context *pipe,
174bf215546Sopenharmony_ci                              void *sampler)
175bf215546Sopenharmony_ci{
176bf215546Sopenharmony_ci   FREE( sampler );
177bf215546Sopenharmony_ci}
178bf215546Sopenharmony_ci
179bf215546Sopenharmony_ci
180bf215546Sopenharmony_cistatic void
181bf215546Sopenharmony_ciprepare_shader_sampling(
182bf215546Sopenharmony_ci   struct softpipe_context *sp,
183bf215546Sopenharmony_ci   unsigned num,
184bf215546Sopenharmony_ci   struct pipe_sampler_view **views,
185bf215546Sopenharmony_ci   enum pipe_shader_type shader_type,
186bf215546Sopenharmony_ci   struct pipe_resource *mapped_tex[PIPE_MAX_SHADER_SAMPLER_VIEWS])
187bf215546Sopenharmony_ci{
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_ci   unsigned i;
190bf215546Sopenharmony_ci   uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
191bf215546Sopenharmony_ci   uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
192bf215546Sopenharmony_ci   uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
193bf215546Sopenharmony_ci   const void *addr;
194bf215546Sopenharmony_ci
195bf215546Sopenharmony_ci   assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
196bf215546Sopenharmony_ci   if (!num)
197bf215546Sopenharmony_ci      return;
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_ci   for (i = 0; i < num; i++) {
200bf215546Sopenharmony_ci      struct pipe_sampler_view *view = views[i];
201bf215546Sopenharmony_ci
202bf215546Sopenharmony_ci      if (view) {
203bf215546Sopenharmony_ci         struct pipe_resource *tex = view->texture;
204bf215546Sopenharmony_ci         struct softpipe_resource *sp_tex = softpipe_resource(tex);
205bf215546Sopenharmony_ci         unsigned width0 = tex->width0;
206bf215546Sopenharmony_ci         unsigned num_layers = tex->depth0;
207bf215546Sopenharmony_ci         unsigned first_level = 0;
208bf215546Sopenharmony_ci         unsigned last_level = 0;
209bf215546Sopenharmony_ci
210bf215546Sopenharmony_ci         /* We're referencing the texture's internal data, so save a
211bf215546Sopenharmony_ci          * reference to it.
212bf215546Sopenharmony_ci          */
213bf215546Sopenharmony_ci         pipe_resource_reference(&mapped_tex[i], tex);
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_ci         if (!sp_tex->dt) {
216bf215546Sopenharmony_ci            /* regular texture - setup array of mipmap level offsets */
217bf215546Sopenharmony_ci            ASSERTED struct pipe_resource *res = view->texture;
218bf215546Sopenharmony_ci            int j;
219bf215546Sopenharmony_ci
220bf215546Sopenharmony_ci            if (view->target != PIPE_BUFFER) {
221bf215546Sopenharmony_ci               first_level = view->u.tex.first_level;
222bf215546Sopenharmony_ci               last_level = view->u.tex.last_level;
223bf215546Sopenharmony_ci               assert(first_level <= last_level);
224bf215546Sopenharmony_ci               assert(last_level <= res->last_level);
225bf215546Sopenharmony_ci               addr = sp_tex->data;
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ci               for (j = first_level; j <= last_level; j++) {
228bf215546Sopenharmony_ci                  mip_offsets[j] = sp_tex->level_offset[j];
229bf215546Sopenharmony_ci                  row_stride[j] = sp_tex->stride[j];
230bf215546Sopenharmony_ci                  img_stride[j] = sp_tex->img_stride[j];
231bf215546Sopenharmony_ci               }
232bf215546Sopenharmony_ci               if (tex->target == PIPE_TEXTURE_1D_ARRAY ||
233bf215546Sopenharmony_ci                   tex->target == PIPE_TEXTURE_2D_ARRAY ||
234bf215546Sopenharmony_ci                   tex->target == PIPE_TEXTURE_CUBE ||
235bf215546Sopenharmony_ci                   tex->target == PIPE_TEXTURE_CUBE_ARRAY) {
236bf215546Sopenharmony_ci                  num_layers = view->u.tex.last_layer - view->u.tex.first_layer + 1;
237bf215546Sopenharmony_ci                  for (j = first_level; j <= last_level; j++) {
238bf215546Sopenharmony_ci                     mip_offsets[j] += view->u.tex.first_layer *
239bf215546Sopenharmony_ci                                       sp_tex->img_stride[j];
240bf215546Sopenharmony_ci                  }
241bf215546Sopenharmony_ci                  if (view->target == PIPE_TEXTURE_CUBE ||
242bf215546Sopenharmony_ci                      view->target == PIPE_TEXTURE_CUBE_ARRAY) {
243bf215546Sopenharmony_ci                     assert(num_layers % 6 == 0);
244bf215546Sopenharmony_ci                  }
245bf215546Sopenharmony_ci                  assert(view->u.tex.first_layer <= view->u.tex.last_layer);
246bf215546Sopenharmony_ci                  assert(view->u.tex.last_layer < res->array_size);
247bf215546Sopenharmony_ci               }
248bf215546Sopenharmony_ci            }
249bf215546Sopenharmony_ci            else {
250bf215546Sopenharmony_ci               unsigned view_blocksize = util_format_get_blocksize(view->format);
251bf215546Sopenharmony_ci               addr = sp_tex->data;
252bf215546Sopenharmony_ci               /* probably don't really need to fill that out */
253bf215546Sopenharmony_ci               mip_offsets[0] = 0;
254bf215546Sopenharmony_ci               row_stride[0] = 0;
255bf215546Sopenharmony_ci               img_stride[0] = 0;
256bf215546Sopenharmony_ci
257bf215546Sopenharmony_ci               /* everything specified in number of elements here. */
258bf215546Sopenharmony_ci               width0 = view->u.buf.size / view_blocksize;
259bf215546Sopenharmony_ci               addr = (uint8_t *)addr + view->u.buf.offset;
260bf215546Sopenharmony_ci               assert(view->u.buf.offset + view->u.buf.size <= res->width0);
261bf215546Sopenharmony_ci            }
262bf215546Sopenharmony_ci         }
263bf215546Sopenharmony_ci         else {
264bf215546Sopenharmony_ci            /* display target texture/surface */
265bf215546Sopenharmony_ci            struct softpipe_screen *screen = softpipe_screen(tex->screen);
266bf215546Sopenharmony_ci            struct sw_winsys *winsys = screen->winsys;
267bf215546Sopenharmony_ci            addr = winsys->displaytarget_map(winsys, sp_tex->dt,
268bf215546Sopenharmony_ci                                             PIPE_MAP_READ);
269bf215546Sopenharmony_ci            row_stride[0] = sp_tex->stride[0];
270bf215546Sopenharmony_ci            img_stride[0] = sp_tex->img_stride[0];
271bf215546Sopenharmony_ci            mip_offsets[0] = 0;
272bf215546Sopenharmony_ci            assert(addr);
273bf215546Sopenharmony_ci         }
274bf215546Sopenharmony_ci         draw_set_mapped_texture(sp->draw,
275bf215546Sopenharmony_ci                                 shader_type,
276bf215546Sopenharmony_ci                                 i,
277bf215546Sopenharmony_ci                                 width0, tex->height0, num_layers,
278bf215546Sopenharmony_ci                                 first_level, last_level, 0, 0,
279bf215546Sopenharmony_ci                                 addr,
280bf215546Sopenharmony_ci                                 row_stride, img_stride, mip_offsets);
281bf215546Sopenharmony_ci      }
282bf215546Sopenharmony_ci   }
283bf215546Sopenharmony_ci}
284bf215546Sopenharmony_ci
285bf215546Sopenharmony_cistatic void
286bf215546Sopenharmony_cisp_sampler_view_display_target_unmap(struct softpipe_context *sp,
287bf215546Sopenharmony_ci                                     struct pipe_sampler_view *view)
288bf215546Sopenharmony_ci{
289bf215546Sopenharmony_ci   if (view) {
290bf215546Sopenharmony_ci      struct pipe_resource *tex = view->texture;
291bf215546Sopenharmony_ci      struct softpipe_resource *sp_tex = softpipe_resource(tex);
292bf215546Sopenharmony_ci      if (sp_tex->dt) {
293bf215546Sopenharmony_ci         struct softpipe_screen *screen = softpipe_screen(tex->screen);
294bf215546Sopenharmony_ci         struct sw_winsys *winsys = screen->winsys;
295bf215546Sopenharmony_ci         winsys->displaytarget_unmap(winsys, sp_tex->dt);
296bf215546Sopenharmony_ci      }
297bf215546Sopenharmony_ci   }
298bf215546Sopenharmony_ci}
299bf215546Sopenharmony_ci
300bf215546Sopenharmony_ci/**
301bf215546Sopenharmony_ci * Called during state validation when SP_NEW_TEXTURE is set.
302bf215546Sopenharmony_ci */
303bf215546Sopenharmony_civoid
304bf215546Sopenharmony_cisoftpipe_prepare_vertex_sampling(struct softpipe_context *sp,
305bf215546Sopenharmony_ci                                 unsigned num,
306bf215546Sopenharmony_ci                                 struct pipe_sampler_view **views)
307bf215546Sopenharmony_ci{
308bf215546Sopenharmony_ci   prepare_shader_sampling(sp, num, views, PIPE_SHADER_VERTEX,
309bf215546Sopenharmony_ci                           sp->mapped_vs_tex);
310bf215546Sopenharmony_ci}
311bf215546Sopenharmony_ci
312bf215546Sopenharmony_civoid
313bf215546Sopenharmony_cisoftpipe_cleanup_vertex_sampling(struct softpipe_context *ctx)
314bf215546Sopenharmony_ci{
315bf215546Sopenharmony_ci   unsigned i;
316bf215546Sopenharmony_ci   for (i = 0; i < ARRAY_SIZE(ctx->mapped_vs_tex); i++) {
317bf215546Sopenharmony_ci      sp_sampler_view_display_target_unmap(
318bf215546Sopenharmony_ci         ctx, ctx->sampler_views[PIPE_SHADER_VERTEX][i]);
319bf215546Sopenharmony_ci      pipe_resource_reference(&ctx->mapped_vs_tex[i], NULL);
320bf215546Sopenharmony_ci   }
321bf215546Sopenharmony_ci}
322bf215546Sopenharmony_ci
323bf215546Sopenharmony_ci
324bf215546Sopenharmony_ci/**
325bf215546Sopenharmony_ci * Called during state validation when SP_NEW_TEXTURE is set.
326bf215546Sopenharmony_ci */
327bf215546Sopenharmony_civoid
328bf215546Sopenharmony_cisoftpipe_prepare_geometry_sampling(struct softpipe_context *sp,
329bf215546Sopenharmony_ci                                   unsigned num,
330bf215546Sopenharmony_ci                                   struct pipe_sampler_view **views)
331bf215546Sopenharmony_ci{
332bf215546Sopenharmony_ci   prepare_shader_sampling(sp, num, views, PIPE_SHADER_GEOMETRY,
333bf215546Sopenharmony_ci                           sp->mapped_gs_tex);
334bf215546Sopenharmony_ci}
335bf215546Sopenharmony_ci
336bf215546Sopenharmony_civoid
337bf215546Sopenharmony_cisoftpipe_cleanup_geometry_sampling(struct softpipe_context *ctx)
338bf215546Sopenharmony_ci{
339bf215546Sopenharmony_ci   unsigned i;
340bf215546Sopenharmony_ci   for (i = 0; i < ARRAY_SIZE(ctx->mapped_gs_tex); i++) {
341bf215546Sopenharmony_ci      sp_sampler_view_display_target_unmap(
342bf215546Sopenharmony_ci         ctx, ctx->sampler_views[PIPE_SHADER_GEOMETRY][i]);
343bf215546Sopenharmony_ci      pipe_resource_reference(&ctx->mapped_gs_tex[i], NULL);
344bf215546Sopenharmony_ci   }
345bf215546Sopenharmony_ci}
346bf215546Sopenharmony_ci
347bf215546Sopenharmony_ci
348bf215546Sopenharmony_civoid
349bf215546Sopenharmony_cisoftpipe_init_sampler_funcs(struct pipe_context *pipe)
350bf215546Sopenharmony_ci{
351bf215546Sopenharmony_ci   pipe->create_sampler_state = softpipe_create_sampler_state;
352bf215546Sopenharmony_ci   pipe->bind_sampler_states = softpipe_bind_sampler_states;
353bf215546Sopenharmony_ci   pipe->delete_sampler_state = softpipe_delete_sampler_state;
354bf215546Sopenharmony_ci
355bf215546Sopenharmony_ci   pipe->create_sampler_view = softpipe_create_sampler_view;
356bf215546Sopenharmony_ci   pipe->set_sampler_views = softpipe_set_sampler_views;
357bf215546Sopenharmony_ci   pipe->sampler_view_destroy = softpipe_sampler_view_destroy;
358bf215546Sopenharmony_ci}
359bf215546Sopenharmony_ci
360