gallium: use PIPE_SHADER_* everywhere, remove TGSI_PROCESSOR_*
[mesa.git] / src / gallium / auxiliary / vl / vl_zscan.c
1 /**************************************************************************
2 *
3 * Copyright 2011 Christian König
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #include <assert.h>
29
30 #include "pipe/p_screen.h"
31 #include "pipe/p_context.h"
32
33 #include "util/u_draw.h"
34 #include "util/u_sampler.h"
35 #include "util/u_inlines.h"
36 #include "util/u_memory.h"
37
38 #include "tgsi/tgsi_ureg.h"
39
40 #include "vl_defines.h"
41 #include "vl_types.h"
42
43 #include "vl_zscan.h"
44 #include "vl_vertex_buffers.h"
45
46 enum VS_OUTPUT
47 {
48 VS_O_VPOS = 0,
49 VS_O_VTEX = 0
50 };
51
52 const int vl_zscan_normal_16[] =
53 {
54 /* Zig-Zag scan pattern */
55 0, 1, 4, 8, 5, 2, 3, 6,
56 9,12,13,10, 7,11,14,15
57 };
58
59 const int vl_zscan_linear[] =
60 {
61 /* Linear scan pattern */
62 0, 1, 2, 3, 4, 5, 6, 7,
63 8, 9,10,11,12,13,14,15,
64 16,17,18,19,20,21,22,23,
65 24,25,26,27,28,29,30,31,
66 32,33,34,35,36,37,38,39,
67 40,41,42,43,44,45,46,47,
68 48,49,50,51,52,53,54,55,
69 56,57,58,59,60,61,62,63
70 };
71
72 const int vl_zscan_normal[] =
73 {
74 /* Zig-Zag scan pattern */
75 0, 1, 8,16, 9, 2, 3,10,
76 17,24,32,25,18,11, 4, 5,
77 12,19,26,33,40,48,41,34,
78 27,20,13, 6, 7,14,21,28,
79 35,42,49,56,57,50,43,36,
80 29,22,15,23,30,37,44,51,
81 58,59,52,45,38,31,39,46,
82 53,60,61,54,47,55,62,63
83 };
84
85 const int vl_zscan_alternate[] =
86 {
87 /* Alternate scan pattern */
88 0, 8,16,24, 1, 9, 2,10,
89 17,25,32,40,48,56,57,49,
90 41,33,26,18, 3,11, 4,12,
91 19,27,34,42,50,58,35,43,
92 51,59,20,28, 5,13, 6,14,
93 21,29,36,44,52,60,37,45,
94 53,61,22,30, 7,15,23,31,
95 38,46,54,62,39,47,55,63
96 };
97
98 static void *
99 create_vert_shader(struct vl_zscan *zscan)
100 {
101 struct ureg_program *shader;
102
103 struct ureg_src scale;
104 struct ureg_src vrect, vpos, block_num;
105
106 struct ureg_dst tmp;
107 struct ureg_dst o_vpos;
108 struct ureg_dst *o_vtex;
109
110 signed i;
111
112 shader = ureg_create(PIPE_SHADER_VERTEX);
113 if (!shader)
114 return NULL;
115
116 o_vtex = MALLOC(zscan->num_channels * sizeof(struct ureg_dst));
117
118 scale = ureg_imm2f(shader,
119 (float)VL_BLOCK_WIDTH / zscan->buffer_width,
120 (float)VL_BLOCK_HEIGHT / zscan->buffer_height);
121
122 vrect = ureg_DECL_vs_input(shader, VS_I_RECT);
123 vpos = ureg_DECL_vs_input(shader, VS_I_VPOS);
124 block_num = ureg_DECL_vs_input(shader, VS_I_BLOCK_NUM);
125
126 tmp = ureg_DECL_temporary(shader);
127
128 o_vpos = ureg_DECL_output(shader, TGSI_SEMANTIC_POSITION, VS_O_VPOS);
129
130 for (i = 0; i < zscan->num_channels; ++i)
131 o_vtex[i] = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX + i);
132
133 /*
134 * o_vpos.xy = (vpos + vrect) * scale
135 * o_vpos.zw = 1.0f
136 *
137 * tmp.xy = InstanceID / blocks_per_line
138 * tmp.x = frac(tmp.x)
139 * tmp.y = floor(tmp.y)
140 *
141 * o_vtex.x = vrect.x / blocks_per_line + tmp.x
142 * o_vtex.y = vrect.y
143 * o_vtex.z = tmp.z * blocks_per_line / blocks_total
144 */
145 ureg_ADD(shader, ureg_writemask(tmp, TGSI_WRITEMASK_XY), vpos, vrect);
146 ureg_MUL(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_XY), ureg_src(tmp), scale);
147 ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_ZW), ureg_imm1f(shader, 1.0f));
148
149 ureg_MUL(shader, ureg_writemask(tmp, TGSI_WRITEMASK_XW), ureg_scalar(block_num, TGSI_SWIZZLE_X),
150 ureg_imm1f(shader, 1.0f / zscan->blocks_per_line));
151
152 ureg_FRC(shader, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X));
153 ureg_FLR(shader, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_src(tmp));
154
155 for (i = 0; i < zscan->num_channels; ++i) {
156 ureg_ADD(shader, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y),
157 ureg_imm1f(shader, 1.0f / (zscan->blocks_per_line * VL_BLOCK_WIDTH)
158 * (i - (signed)zscan->num_channels / 2)));
159
160 ureg_MAD(shader, ureg_writemask(o_vtex[i], TGSI_WRITEMASK_X), vrect,
161 ureg_imm1f(shader, 1.0f / zscan->blocks_per_line), ureg_src(tmp));
162 ureg_MOV(shader, ureg_writemask(o_vtex[i], TGSI_WRITEMASK_Y), vrect);
163 ureg_MOV(shader, ureg_writemask(o_vtex[i], TGSI_WRITEMASK_Z), vpos);
164 ureg_MUL(shader, ureg_writemask(o_vtex[i], TGSI_WRITEMASK_W), ureg_src(tmp),
165 ureg_imm1f(shader, (float)zscan->blocks_per_line / zscan->blocks_total));
166 }
167
168 ureg_release_temporary(shader, tmp);
169 ureg_END(shader);
170
171 FREE(o_vtex);
172
173 return ureg_create_shader_and_destroy(shader, zscan->pipe);
174 }
175
176 static void *
177 create_frag_shader(struct vl_zscan *zscan)
178 {
179 struct ureg_program *shader;
180 struct ureg_src *vtex;
181
182 struct ureg_src samp_src, samp_scan, samp_quant;
183
184 struct ureg_dst *tmp;
185 struct ureg_dst quant, fragment;
186
187 unsigned i;
188
189 shader = ureg_create(PIPE_SHADER_FRAGMENT);
190 if (!shader)
191 return NULL;
192
193 vtex = MALLOC(zscan->num_channels * sizeof(struct ureg_src));
194 tmp = MALLOC(zscan->num_channels * sizeof(struct ureg_dst));
195
196 for (i = 0; i < zscan->num_channels; ++i)
197 vtex[i] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX + i, TGSI_INTERPOLATE_LINEAR);
198
199 samp_src = ureg_DECL_sampler(shader, 0);
200 samp_scan = ureg_DECL_sampler(shader, 1);
201 samp_quant = ureg_DECL_sampler(shader, 2);
202
203 for (i = 0; i < zscan->num_channels; ++i)
204 tmp[i] = ureg_DECL_temporary(shader);
205 quant = ureg_DECL_temporary(shader);
206
207 fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
208
209 /*
210 * tmp.x = tex(vtex, 1)
211 * tmp.y = vtex.z
212 * fragment = tex(tmp, 0) * quant
213 */
214 for (i = 0; i < zscan->num_channels; ++i)
215 ureg_TEX(shader, ureg_writemask(tmp[i], TGSI_WRITEMASK_X), TGSI_TEXTURE_2D, vtex[i], samp_scan);
216
217 for (i = 0; i < zscan->num_channels; ++i)
218 ureg_MOV(shader, ureg_writemask(tmp[i], TGSI_WRITEMASK_Y), ureg_scalar(vtex[i], TGSI_SWIZZLE_W));
219
220 for (i = 0; i < zscan->num_channels; ++i) {
221 ureg_TEX(shader, ureg_writemask(tmp[0], TGSI_WRITEMASK_X << i), TGSI_TEXTURE_2D, ureg_src(tmp[i]), samp_src);
222 ureg_TEX(shader, ureg_writemask(quant, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_3D, vtex[i], samp_quant);
223 }
224
225 ureg_MUL(shader, quant, ureg_src(quant), ureg_imm1f(shader, 16.0f));
226 ureg_MUL(shader, fragment, ureg_src(tmp[0]), ureg_src(quant));
227
228 for (i = 0; i < zscan->num_channels; ++i)
229 ureg_release_temporary(shader, tmp[i]);
230 ureg_END(shader);
231
232 FREE(vtex);
233 FREE(tmp);
234
235 return ureg_create_shader_and_destroy(shader, zscan->pipe);
236 }
237
238 static bool
239 init_shaders(struct vl_zscan *zscan)
240 {
241 assert(zscan);
242
243 zscan->vs = create_vert_shader(zscan);
244 if (!zscan->vs)
245 goto error_vs;
246
247 zscan->fs = create_frag_shader(zscan);
248 if (!zscan->fs)
249 goto error_fs;
250
251 return true;
252
253 error_fs:
254 zscan->pipe->delete_vs_state(zscan->pipe, zscan->vs);
255
256 error_vs:
257 return false;
258 }
259
260 static void
261 cleanup_shaders(struct vl_zscan *zscan)
262 {
263 assert(zscan);
264
265 zscan->pipe->delete_vs_state(zscan->pipe, zscan->vs);
266 zscan->pipe->delete_fs_state(zscan->pipe, zscan->fs);
267 }
268
269 static bool
270 init_state(struct vl_zscan *zscan)
271 {
272 struct pipe_blend_state blend;
273 struct pipe_rasterizer_state rs_state;
274 struct pipe_sampler_state sampler;
275 unsigned i;
276
277 assert(zscan);
278
279 memset(&rs_state, 0, sizeof(rs_state));
280 rs_state.half_pixel_center = true;
281 rs_state.bottom_edge_rule = true;
282 rs_state.depth_clip = 1;
283 zscan->rs_state = zscan->pipe->create_rasterizer_state(zscan->pipe, &rs_state);
284 if (!zscan->rs_state)
285 goto error_rs_state;
286
287 memset(&blend, 0, sizeof blend);
288
289 blend.independent_blend_enable = 0;
290 blend.rt[0].blend_enable = 0;
291 blend.rt[0].rgb_func = PIPE_BLEND_ADD;
292 blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
293 blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
294 blend.rt[0].alpha_func = PIPE_BLEND_ADD;
295 blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
296 blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
297 blend.logicop_enable = 0;
298 blend.logicop_func = PIPE_LOGICOP_CLEAR;
299 /* Needed to allow color writes to FB, even if blending disabled */
300 blend.rt[0].colormask = PIPE_MASK_RGBA;
301 blend.dither = 0;
302 zscan->blend = zscan->pipe->create_blend_state(zscan->pipe, &blend);
303 if (!zscan->blend)
304 goto error_blend;
305
306 for (i = 0; i < 3; ++i) {
307 memset(&sampler, 0, sizeof(sampler));
308 sampler.wrap_s = PIPE_TEX_WRAP_REPEAT;
309 sampler.wrap_t = PIPE_TEX_WRAP_REPEAT;
310 sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
311 sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
312 sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
313 sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
314 sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
315 sampler.compare_func = PIPE_FUNC_ALWAYS;
316 sampler.normalized_coords = 1;
317 zscan->samplers[i] = zscan->pipe->create_sampler_state(zscan->pipe, &sampler);
318 if (!zscan->samplers[i])
319 goto error_samplers;
320 }
321
322 return true;
323
324 error_samplers:
325 for (i = 0; i < 2; ++i)
326 if (zscan->samplers[i])
327 zscan->pipe->delete_sampler_state(zscan->pipe, zscan->samplers[i]);
328
329 zscan->pipe->delete_rasterizer_state(zscan->pipe, zscan->rs_state);
330
331 error_blend:
332 zscan->pipe->delete_blend_state(zscan->pipe, zscan->blend);
333
334 error_rs_state:
335 return false;
336 }
337
338 static void
339 cleanup_state(struct vl_zscan *zscan)
340 {
341 unsigned i;
342
343 assert(zscan);
344
345 for (i = 0; i < 3; ++i)
346 zscan->pipe->delete_sampler_state(zscan->pipe, zscan->samplers[i]);
347
348 zscan->pipe->delete_rasterizer_state(zscan->pipe, zscan->rs_state);
349 zscan->pipe->delete_blend_state(zscan->pipe, zscan->blend);
350 }
351
352 struct pipe_sampler_view *
353 vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks_per_line)
354 {
355 const unsigned total_size = blocks_per_line * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT;
356
357 int patched_layout[64];
358
359 struct pipe_resource res_tmpl, *res;
360 struct pipe_sampler_view sv_tmpl, *sv;
361 struct pipe_transfer *buf_transfer;
362 unsigned x, y, i, pitch;
363 float *f;
364
365 struct pipe_box rect =
366 {
367 0, 0, 0,
368 VL_BLOCK_WIDTH * blocks_per_line,
369 VL_BLOCK_HEIGHT,
370 1
371 };
372
373 assert(pipe && layout && blocks_per_line);
374
375 for (i = 0; i < 64; ++i)
376 patched_layout[layout[i]] = i;
377
378 memset(&res_tmpl, 0, sizeof(res_tmpl));
379 res_tmpl.target = PIPE_TEXTURE_2D;
380 res_tmpl.format = PIPE_FORMAT_R32_FLOAT;
381 res_tmpl.width0 = VL_BLOCK_WIDTH * blocks_per_line;
382 res_tmpl.height0 = VL_BLOCK_HEIGHT;
383 res_tmpl.depth0 = 1;
384 res_tmpl.array_size = 1;
385 res_tmpl.usage = PIPE_USAGE_IMMUTABLE;
386 res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
387
388 res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
389 if (!res)
390 goto error_resource;
391
392 f = pipe->transfer_map(pipe, res,
393 0, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
394 &rect, &buf_transfer);
395 if (!f)
396 goto error_map;
397
398 pitch = buf_transfer->stride / sizeof(float);
399
400 for (i = 0; i < blocks_per_line; ++i)
401 for (y = 0; y < VL_BLOCK_HEIGHT; ++y)
402 for (x = 0; x < VL_BLOCK_WIDTH; ++x) {
403 float addr = patched_layout[x + y * VL_BLOCK_WIDTH] +
404 i * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT;
405
406 addr /= total_size;
407
408 f[i * VL_BLOCK_WIDTH + y * pitch + x] = addr;
409 }
410
411 pipe->transfer_unmap(pipe, buf_transfer);
412
413 memset(&sv_tmpl, 0, sizeof(sv_tmpl));
414 u_sampler_view_default_template(&sv_tmpl, res, res->format);
415 sv = pipe->create_sampler_view(pipe, res, &sv_tmpl);
416 pipe_resource_reference(&res, NULL);
417 if (!sv)
418 goto error_map;
419
420 return sv;
421
422 error_map:
423 pipe_resource_reference(&res, NULL);
424
425 error_resource:
426 return NULL;
427 }
428
429 bool
430 vl_zscan_init(struct vl_zscan *zscan, struct pipe_context *pipe,
431 unsigned buffer_width, unsigned buffer_height,
432 unsigned blocks_per_line, unsigned blocks_total,
433 unsigned num_channels)
434 {
435 assert(zscan && pipe);
436
437 zscan->pipe = pipe;
438 zscan->buffer_width = buffer_width;
439 zscan->buffer_height = buffer_height;
440 zscan->num_channels = num_channels;
441 zscan->blocks_per_line = blocks_per_line;
442 zscan->blocks_total = blocks_total;
443
444 if(!init_shaders(zscan))
445 return false;
446
447 if(!init_state(zscan)) {
448 cleanup_shaders(zscan);
449 return false;
450 }
451
452 return true;
453 }
454
455 void
456 vl_zscan_cleanup(struct vl_zscan *zscan)
457 {
458 assert(zscan);
459
460 cleanup_shaders(zscan);
461 cleanup_state(zscan);
462 }
463
464 bool
465 vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
466 struct pipe_sampler_view *src, struct pipe_surface *dst)
467 {
468 struct pipe_resource res_tmpl, *res;
469 struct pipe_sampler_view sv_tmpl;
470
471 assert(zscan && buffer);
472
473 memset(buffer, 0, sizeof(struct vl_zscan_buffer));
474
475 pipe_sampler_view_reference(&buffer->src, src);
476
477 buffer->viewport.scale[0] = dst->width;
478 buffer->viewport.scale[1] = dst->height;
479 buffer->viewport.scale[2] = 1;
480 buffer->viewport.translate[0] = 0;
481 buffer->viewport.translate[1] = 0;
482 buffer->viewport.translate[2] = 0;
483
484 buffer->fb_state.width = dst->width;
485 buffer->fb_state.height = dst->height;
486 buffer->fb_state.nr_cbufs = 1;
487 pipe_surface_reference(&buffer->fb_state.cbufs[0], dst);
488
489 memset(&res_tmpl, 0, sizeof(res_tmpl));
490 res_tmpl.target = PIPE_TEXTURE_3D;
491 res_tmpl.format = PIPE_FORMAT_R8_UNORM;
492 res_tmpl.width0 = VL_BLOCK_WIDTH * zscan->blocks_per_line;
493 res_tmpl.height0 = VL_BLOCK_HEIGHT;
494 res_tmpl.depth0 = 2;
495 res_tmpl.array_size = 1;
496 res_tmpl.usage = PIPE_USAGE_IMMUTABLE;
497 res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
498
499 res = zscan->pipe->screen->resource_create(zscan->pipe->screen, &res_tmpl);
500 if (!res)
501 return false;
502
503 memset(&sv_tmpl, 0, sizeof(sv_tmpl));
504 u_sampler_view_default_template(&sv_tmpl, res, res->format);
505 sv_tmpl.swizzle_r = sv_tmpl.swizzle_g = sv_tmpl.swizzle_b = sv_tmpl.swizzle_a = TGSI_SWIZZLE_X;
506 buffer->quant = zscan->pipe->create_sampler_view(zscan->pipe, res, &sv_tmpl);
507 pipe_resource_reference(&res, NULL);
508 if (!buffer->quant)
509 return false;
510
511 return true;
512 }
513
514 void
515 vl_zscan_cleanup_buffer(struct vl_zscan_buffer *buffer)
516 {
517 assert(buffer);
518
519 pipe_sampler_view_reference(&buffer->src, NULL);
520 pipe_sampler_view_reference(&buffer->layout, NULL);
521 pipe_sampler_view_reference(&buffer->quant, NULL);
522 pipe_surface_reference(&buffer->fb_state.cbufs[0], NULL);
523 }
524
525 void
526 vl_zscan_set_layout(struct vl_zscan_buffer *buffer, struct pipe_sampler_view *layout)
527 {
528 assert(buffer);
529 assert(layout);
530
531 pipe_sampler_view_reference(&buffer->layout, layout);
532 }
533
534 void
535 vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
536 const uint8_t matrix[64], bool intra)
537 {
538 struct pipe_context *pipe;
539 struct pipe_transfer *buf_transfer;
540 unsigned x, y, i, pitch;
541 uint8_t *data;
542
543 struct pipe_box rect =
544 {
545 0, 0, intra ? 1 : 0,
546 VL_BLOCK_WIDTH,
547 VL_BLOCK_HEIGHT,
548 1
549 };
550
551 assert(buffer);
552 assert(matrix);
553
554 pipe = zscan->pipe;
555
556 rect.width *= zscan->blocks_per_line;
557
558 data = pipe->transfer_map(pipe, buffer->quant->texture,
559 0, PIPE_TRANSFER_WRITE |
560 PIPE_TRANSFER_DISCARD_RANGE,
561 &rect, &buf_transfer);
562 if (!data)
563 return;
564
565 pitch = buf_transfer->stride;
566
567 for (i = 0; i < zscan->blocks_per_line; ++i)
568 for (y = 0; y < VL_BLOCK_HEIGHT; ++y)
569 for (x = 0; x < VL_BLOCK_WIDTH; ++x)
570 data[i * VL_BLOCK_WIDTH + y * pitch + x] = matrix[x + y * VL_BLOCK_WIDTH];
571
572 pipe->transfer_unmap(pipe, buf_transfer);
573 }
574
575 void
576 vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned num_instances)
577 {
578 assert(buffer);
579
580 zscan->pipe->bind_rasterizer_state(zscan->pipe, zscan->rs_state);
581 zscan->pipe->bind_blend_state(zscan->pipe, zscan->blend);
582 zscan->pipe->bind_sampler_states(zscan->pipe, PIPE_SHADER_FRAGMENT,
583 0, 3, zscan->samplers);
584 zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state);
585 zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport);
586 zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT,
587 0, 3, &buffer->src);
588 zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs);
589 zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs);
590 util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances);
591 }