1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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 TUNGSTEN GRAPHICS 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.
26 **************************************************************************/
30 * Copy/blit pixel rect between surfaces
36 #include "pipe/p_context.h"
37 #include "util/u_debug.h"
38 #include "pipe/p_defines.h"
39 #include "util/u_inlines.h"
40 #include "pipe/p_shader_tokens.h"
41 #include "pipe/p_state.h"
43 #include "util/u_blit.h"
44 #include "util/u_draw_quad.h"
45 #include "util/u_math.h"
46 #include "util/u_memory.h"
47 #include "util/u_sampler.h"
48 #include "util/u_simple_shaders.h"
50 #include "cso_cache/cso_context.h"
55 struct pipe_context
*pipe
;
56 struct cso_context
*cso
;
58 struct pipe_blend_state blend
;
59 struct pipe_depth_stencil_alpha_state depthstencil
;
60 struct pipe_rasterizer_state rasterizer
;
61 struct pipe_sampler_state sampler
;
62 struct pipe_viewport_state viewport
;
63 struct pipe_clip_state clip
;
64 struct pipe_vertex_element velem
[2];
67 void *fs
[TGSI_WRITEMASK_XYZW
+ 1];
69 struct pipe_resource
*vbuf
; /**< quad vertices */
72 float vertices
[4][2][4]; /**< vertex/texcoords for quad */
77 * Create state object for blit.
78 * Intended to be created once and re-used for many blit() calls.
81 util_create_blit(struct pipe_context
*pipe
, struct cso_context
*cso
)
83 struct blit_state
*ctx
;
86 ctx
= CALLOC_STRUCT(blit_state
);
93 /* disabled blending/masking */
94 memset(&ctx
->blend
, 0, sizeof(ctx
->blend
));
95 ctx
->blend
.rt
[0].colormask
= PIPE_MASK_RGBA
;
97 /* no-op depth/stencil/alpha */
98 memset(&ctx
->depthstencil
, 0, sizeof(ctx
->depthstencil
));
101 memset(&ctx
->rasterizer
, 0, sizeof(ctx
->rasterizer
));
102 ctx
->rasterizer
.cull_face
= PIPE_FACE_NONE
;
103 ctx
->rasterizer
.gl_rasterization_rules
= 1;
106 memset(&ctx
->sampler
, 0, sizeof(ctx
->sampler
));
107 ctx
->sampler
.wrap_s
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
108 ctx
->sampler
.wrap_t
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
109 ctx
->sampler
.wrap_r
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
110 ctx
->sampler
.min_mip_filter
= PIPE_TEX_MIPFILTER_NONE
;
111 ctx
->sampler
.min_img_filter
= 0; /* set later */
112 ctx
->sampler
.mag_img_filter
= 0; /* set later */
113 ctx
->sampler
.normalized_coords
= 1;
115 /* vertex elements state */
116 memset(&ctx
->velem
[0], 0, sizeof(ctx
->velem
[0]) * 2);
117 for (i
= 0; i
< 2; i
++) {
118 ctx
->velem
[i
].src_offset
= i
* 4 * sizeof(float);
119 ctx
->velem
[i
].instance_divisor
= 0;
120 ctx
->velem
[i
].vertex_buffer_index
= 0;
121 ctx
->velem
[i
].src_format
= PIPE_FORMAT_R32G32B32A32_FLOAT
;
124 /* vertex shader - still required to provide the linkage between
125 * fragment shader input semantics and vertex_element/buffers.
128 const uint semantic_names
[] = { TGSI_SEMANTIC_POSITION
,
129 TGSI_SEMANTIC_GENERIC
};
130 const uint semantic_indexes
[] = { 0, 0 };
131 ctx
->vs
= util_make_vertex_passthrough_shader(pipe
, 2, semantic_names
,
135 /* fragment shader */
136 ctx
->fs
[TGSI_WRITEMASK_XYZW
] =
137 util_make_fragment_tex_shader(pipe
, TGSI_TEXTURE_2D
,
138 TGSI_INTERPOLATE_LINEAR
);
141 /* init vertex data that doesn't change */
142 for (i
= 0; i
< 4; i
++) {
143 ctx
->vertices
[i
][0][3] = 1.0f
; /* w */
144 ctx
->vertices
[i
][1][2] = 0.0f
; /* r */
145 ctx
->vertices
[i
][1][3] = 1.0f
; /* q */
153 * Destroy a blit context
156 util_destroy_blit(struct blit_state
*ctx
)
158 struct pipe_context
*pipe
= ctx
->pipe
;
161 pipe
->delete_vs_state(pipe
, ctx
->vs
);
163 for (i
= 0; i
< Elements(ctx
->fs
); i
++)
165 pipe
->delete_fs_state(pipe
, ctx
->fs
[i
]);
167 pipe_resource_reference(&ctx
->vbuf
, NULL
);
174 * Get offset of next free slot in vertex buffer for quad vertices.
177 get_next_slot( struct blit_state
*ctx
)
179 const unsigned max_slots
= 4096 / sizeof ctx
->vertices
;
181 if (ctx
->vbuf_slot
>= max_slots
)
182 util_blit_flush( ctx
);
185 ctx
->vbuf
= pipe_buffer_create(ctx
->pipe
->screen
,
186 PIPE_BIND_VERTEX_BUFFER
,
187 max_slots
* sizeof ctx
->vertices
);
190 return ctx
->vbuf_slot
++ * sizeof ctx
->vertices
;
197 * Setup vertex data for the textured quad we'll draw.
201 setup_vertex_data_tex(struct blit_state
*ctx
,
202 float x0
, float y0
, float x1
, float y1
,
203 float s0
, float t0
, float s1
, float t1
,
208 ctx
->vertices
[0][0][0] = x0
;
209 ctx
->vertices
[0][0][1] = y0
;
210 ctx
->vertices
[0][0][2] = z
;
211 ctx
->vertices
[0][1][0] = s0
; /*s*/
212 ctx
->vertices
[0][1][1] = t0
; /*t*/
214 ctx
->vertices
[1][0][0] = x1
;
215 ctx
->vertices
[1][0][1] = y0
;
216 ctx
->vertices
[1][0][2] = z
;
217 ctx
->vertices
[1][1][0] = s1
; /*s*/
218 ctx
->vertices
[1][1][1] = t0
; /*t*/
220 ctx
->vertices
[2][0][0] = x1
;
221 ctx
->vertices
[2][0][1] = y1
;
222 ctx
->vertices
[2][0][2] = z
;
223 ctx
->vertices
[2][1][0] = s1
;
224 ctx
->vertices
[2][1][1] = t1
;
226 ctx
->vertices
[3][0][0] = x0
;
227 ctx
->vertices
[3][0][1] = y1
;
228 ctx
->vertices
[3][0][2] = z
;
229 ctx
->vertices
[3][1][0] = s0
;
230 ctx
->vertices
[3][1][1] = t1
;
232 offset
= get_next_slot( ctx
);
234 pipe_buffer_write_nooverlap(ctx
->pipe
, ctx
->vbuf
,
235 offset
, sizeof(ctx
->vertices
), ctx
->vertices
);
242 * \return TRUE if two regions overlap, FALSE otherwise
245 regions_overlap(int srcX0
, int srcY0
,
246 int srcX1
, int srcY1
,
247 int dstX0
, int dstY0
,
248 int dstX1
, int dstY1
)
250 if (MAX2(srcX0
, srcX1
) < MIN2(dstX0
, dstX1
))
251 return FALSE
; /* src completely left of dst */
253 if (MAX2(dstX0
, dstX1
) < MIN2(srcX0
, srcX1
))
254 return FALSE
; /* dst completely left of src */
256 if (MAX2(srcY0
, srcY1
) < MIN2(dstY0
, dstY1
))
257 return FALSE
; /* src completely above dst */
259 if (MAX2(dstY0
, dstY1
) < MIN2(srcY0
, srcY1
))
260 return FALSE
; /* dst completely above src */
262 return TRUE
; /* some overlap */
267 * Copy pixel block from src surface to dst surface.
268 * Overlapping regions are acceptable.
269 * Flipping and stretching are supported.
270 * \param filter one of PIPE_TEX_MIPFILTER_NEAREST/LINEAR
271 * \param writemask controls which channels in the dest surface are sourced
272 * from the src surface. Disabled channels are sourced
274 * XXX need some control over blitting Z and/or stencil.
277 util_blit_pixels_writemask(struct blit_state
*ctx
,
278 struct pipe_resource
*src_tex
,
279 struct pipe_subresource srcsub
,
280 int srcX0
, int srcY0
,
281 int srcX1
, int srcY1
,
283 struct pipe_surface
*dst
,
284 int dstX0
, int dstY0
,
285 int dstX1
, int dstY1
,
286 float z
, uint filter
,
289 struct pipe_context
*pipe
= ctx
->pipe
;
290 struct pipe_screen
*screen
= pipe
->screen
;
291 struct pipe_sampler_view
*sampler_view
= NULL
;
292 struct pipe_sampler_view sv_templ
;
293 struct pipe_framebuffer_state fb
;
294 const int srcW
= abs(srcX1
- srcX0
);
295 const int srcH
= abs(srcY1
- srcY0
);
298 float s0
, t0
, s1
, t1
;
300 assert(filter
== PIPE_TEX_MIPFILTER_NEAREST
||
301 filter
== PIPE_TEX_MIPFILTER_LINEAR
);
303 assert(srcsub
.level
<= src_tex
->last_level
);
305 /* do the regions overlap? */
306 overlap
= src_tex
== dst
->texture
&&
307 dst
->face
== srcsub
.face
&&
308 dst
->level
== srcsub
.level
&&
309 dst
->zslice
== srcZ0
&&
310 regions_overlap(srcX0
, srcY0
, srcX1
, srcY1
,
311 dstX0
, dstY0
, dstX1
, dstY1
);
314 * Check for simple case: no format conversion, no flipping, no stretching,
316 * Filter mode should not matter since there's no stretching.
318 if (dst
->format
== src_tex
->format
&&
323 (dstX1
- dstX0
) == (srcX1
- srcX0
) &&
324 (dstY1
- dstY0
) == (srcY1
- srcY0
) &&
326 struct pipe_subresource subdst
;
327 subdst
.face
= dst
->face
;
328 subdst
.level
= dst
->level
;
329 pipe
->resource_copy_region(pipe
,
330 dst
->texture
, subdst
,
331 dstX0
, dstY0
, dst
->zslice
,/* dest */
333 srcX0
, srcY0
, srcZ0
,/* src */
334 srcW
, srcH
); /* size */
339 /* Create a temporary texture when src and dest alias or when src
340 * is anything other than a 2d texture.
341 * XXX should just use appropriate shader to access 1d / 3d slice / cube face,
342 * much like the u_blitter code does (should be pretty trivial).
344 * This can still be improved upon.
346 if ((src_tex
== dst
->texture
&&
347 dst
->face
== srcsub
.face
&&
348 dst
->level
== srcsub
.level
&&
349 dst
->zslice
== srcZ0
) ||
350 src_tex
->target
!= PIPE_TEXTURE_2D
)
352 struct pipe_resource texTemp
;
353 struct pipe_resource
*tex
;
354 struct pipe_sampler_view sv_templ
;
355 struct pipe_subresource texsub
;
356 const int srcLeft
= MIN2(srcX0
, srcX1
);
357 const int srcTop
= MIN2(srcY0
, srcY1
);
359 if (srcLeft
!= srcX0
) {
360 /* left-right flip */
366 if (srcTop
!= srcY0
) {
373 /* create temp texture */
374 memset(&texTemp
, 0, sizeof(texTemp
));
375 texTemp
.target
= PIPE_TEXTURE_2D
;
376 texTemp
.format
= src_tex
->format
;
377 texTemp
.last_level
= 0;
378 texTemp
.width0
= srcW
;
379 texTemp
.height0
= srcH
;
381 texTemp
.bind
= PIPE_BIND_SAMPLER_VIEW
;
383 tex
= screen
->resource_create(screen
, &texTemp
);
389 /* load temp texture */
390 pipe
->resource_copy_region(pipe
,
391 tex
, texsub
, 0, 0, 0, /* dest */
392 src_tex
, srcsub
, srcLeft
, srcTop
, srcZ0
, /* src */
393 srcW
, srcH
); /* size */
400 u_sampler_view_default_template(&sv_templ
, tex
, tex
->format
);
401 sampler_view
= pipe
->create_sampler_view(pipe
, tex
, &sv_templ
);
404 pipe_resource_reference(&tex
, NULL
);
407 pipe_resource_reference(&tex
, NULL
);
410 u_sampler_view_default_template(&sv_templ
, src_tex
, src_tex
->format
);
411 sv_templ
.first_level
= sv_templ
.last_level
= srcsub
.level
;
412 sampler_view
= pipe
->create_sampler_view(pipe
, src_tex
, &sv_templ
);
418 s0
= srcX0
/ (float)(u_minify(sampler_view
->texture
->width0
, srcsub
.level
));
419 s1
= srcX1
/ (float)(u_minify(sampler_view
->texture
->width0
, srcsub
.level
));
420 t0
= srcY0
/ (float)(u_minify(sampler_view
->texture
->height0
, srcsub
.level
));
421 t1
= srcY1
/ (float)(u_minify(sampler_view
->texture
->height0
, srcsub
.level
));
425 assert(screen
->is_format_supported(screen
, sampler_view
->format
, PIPE_TEXTURE_2D
,
426 sampler_view
->texture
->nr_samples
,
427 PIPE_BIND_SAMPLER_VIEW
, 0));
428 assert(screen
->is_format_supported(screen
, dst
->format
, PIPE_TEXTURE_2D
,
429 dst
->texture
->nr_samples
,
430 PIPE_BIND_RENDER_TARGET
, 0));
432 /* save state (restored below) */
433 cso_save_blend(ctx
->cso
);
434 cso_save_depth_stencil_alpha(ctx
->cso
);
435 cso_save_rasterizer(ctx
->cso
);
436 cso_save_samplers(ctx
->cso
);
437 cso_save_fragment_sampler_views(ctx
->cso
);
438 cso_save_viewport(ctx
->cso
);
439 cso_save_framebuffer(ctx
->cso
);
440 cso_save_fragment_shader(ctx
->cso
);
441 cso_save_vertex_shader(ctx
->cso
);
442 cso_save_clip(ctx
->cso
);
443 cso_save_vertex_elements(ctx
->cso
);
445 /* set misc state we care about */
446 cso_set_blend(ctx
->cso
, &ctx
->blend
);
447 cso_set_depth_stencil_alpha(ctx
->cso
, &ctx
->depthstencil
);
448 cso_set_rasterizer(ctx
->cso
, &ctx
->rasterizer
);
449 cso_set_clip(ctx
->cso
, &ctx
->clip
);
450 cso_set_vertex_elements(ctx
->cso
, 2, ctx
->velem
);
453 ctx
->sampler
.min_img_filter
= filter
;
454 ctx
->sampler
.mag_img_filter
= filter
;
455 /* we've limited this already with the sampler view but you never know... */
456 ctx
->sampler
.min_lod
= srcsub
.level
;
457 ctx
->sampler
.max_lod
= srcsub
.level
;
458 cso_single_sampler(ctx
->cso
, 0, &ctx
->sampler
);
459 cso_single_sampler_done(ctx
->cso
);
462 ctx
->viewport
.scale
[0] = 0.5f
* dst
->width
;
463 ctx
->viewport
.scale
[1] = 0.5f
* dst
->height
;
464 ctx
->viewport
.scale
[2] = 0.5f
;
465 ctx
->viewport
.scale
[3] = 1.0f
;
466 ctx
->viewport
.translate
[0] = 0.5f
* dst
->width
;
467 ctx
->viewport
.translate
[1] = 0.5f
* dst
->height
;
468 ctx
->viewport
.translate
[2] = 0.5f
;
469 ctx
->viewport
.translate
[3] = 0.0f
;
470 cso_set_viewport(ctx
->cso
, &ctx
->viewport
);
473 cso_set_fragment_sampler_views(ctx
->cso
, 1, &sampler_view
);
475 if (ctx
->fs
[writemask
] == NULL
)
477 util_make_fragment_tex_shader_writemask(pipe
, TGSI_TEXTURE_2D
,
478 TGSI_INTERPOLATE_LINEAR
,
482 cso_set_fragment_shader_handle(ctx
->cso
, ctx
->fs
[writemask
]);
483 cso_set_vertex_shader_handle(ctx
->cso
, ctx
->vs
);
486 memset(&fb
, 0, sizeof(fb
));
487 fb
.width
= dst
->width
;
488 fb
.height
= dst
->height
;
491 cso_set_framebuffer(ctx
->cso
, &fb
);
494 offset
= setup_vertex_data_tex(ctx
,
495 (float) dstX0
/ dst
->width
* 2.0f
- 1.0f
,
496 (float) dstY0
/ dst
->height
* 2.0f
- 1.0f
,
497 (float) dstX1
/ dst
->width
* 2.0f
- 1.0f
,
498 (float) dstY1
/ dst
->height
* 2.0f
- 1.0f
,
503 util_draw_vertex_buffer(ctx
->pipe
, ctx
->vbuf
, offset
,
504 PIPE_PRIM_TRIANGLE_FAN
,
506 2); /* attribs/vert */
508 /* restore state we changed */
509 cso_restore_blend(ctx
->cso
);
510 cso_restore_depth_stencil_alpha(ctx
->cso
);
511 cso_restore_rasterizer(ctx
->cso
);
512 cso_restore_samplers(ctx
->cso
);
513 cso_restore_fragment_sampler_views(ctx
->cso
);
514 cso_restore_viewport(ctx
->cso
);
515 cso_restore_framebuffer(ctx
->cso
);
516 cso_restore_fragment_shader(ctx
->cso
);
517 cso_restore_vertex_shader(ctx
->cso
);
518 cso_restore_clip(ctx
->cso
);
519 cso_restore_vertex_elements(ctx
->cso
);
521 pipe_sampler_view_reference(&sampler_view
, NULL
);
526 util_blit_pixels(struct blit_state
*ctx
,
527 struct pipe_resource
*src_tex
,
528 struct pipe_subresource srcsub
,
529 int srcX0
, int srcY0
,
530 int srcX1
, int srcY1
,
532 struct pipe_surface
*dst
,
533 int dstX0
, int dstY0
,
534 int dstX1
, int dstY1
,
535 float z
, uint filter
)
537 util_blit_pixels_writemask( ctx
, src_tex
,
546 TGSI_WRITEMASK_XYZW
);
550 /* Release vertex buffer at end of frame to avoid synchronous
553 void util_blit_flush( struct blit_state
*ctx
)
555 pipe_resource_reference(&ctx
->vbuf
, NULL
);
562 * Copy pixel block from src texture to dst surface.
564 * XXX Should support selection of level.
565 * XXX need some control over blitting Z and/or stencil.
568 util_blit_pixels_tex(struct blit_state
*ctx
,
569 struct pipe_sampler_view
*src_sampler_view
,
570 int srcX0
, int srcY0
,
571 int srcX1
, int srcY1
,
572 struct pipe_surface
*dst
,
573 int dstX0
, int dstY0
,
574 int dstX1
, int dstY1
,
575 float z
, uint filter
)
577 struct pipe_framebuffer_state fb
;
578 float s0
, t0
, s1
, t1
;
580 struct pipe_resource
*tex
= src_sampler_view
->texture
;
582 assert(filter
== PIPE_TEX_MIPFILTER_NEAREST
||
583 filter
== PIPE_TEX_MIPFILTER_LINEAR
);
586 assert(tex
->width0
!= 0);
587 assert(tex
->height0
!= 0);
589 s0
= srcX0
/ (float)tex
->width0
;
590 s1
= srcX1
/ (float)tex
->width0
;
591 t0
= srcY0
/ (float)tex
->height0
;
592 t1
= srcY1
/ (float)tex
->height0
;
594 assert(ctx
->pipe
->screen
->is_format_supported(ctx
->pipe
->screen
, dst
->format
,
596 dst
->texture
->nr_samples
,
597 PIPE_BIND_RENDER_TARGET
,
600 /* save state (restored below) */
601 cso_save_blend(ctx
->cso
);
602 cso_save_depth_stencil_alpha(ctx
->cso
);
603 cso_save_rasterizer(ctx
->cso
);
604 cso_save_samplers(ctx
->cso
);
605 cso_save_fragment_sampler_views(ctx
->cso
);
606 cso_save_framebuffer(ctx
->cso
);
607 cso_save_fragment_shader(ctx
->cso
);
608 cso_save_vertex_shader(ctx
->cso
);
609 cso_save_clip(ctx
->cso
);
610 cso_save_vertex_elements(ctx
->cso
);
612 /* set misc state we care about */
613 cso_set_blend(ctx
->cso
, &ctx
->blend
);
614 cso_set_depth_stencil_alpha(ctx
->cso
, &ctx
->depthstencil
);
615 cso_set_rasterizer(ctx
->cso
, &ctx
->rasterizer
);
616 cso_set_clip(ctx
->cso
, &ctx
->clip
);
617 cso_set_vertex_elements(ctx
->cso
, 2, ctx
->velem
);
620 ctx
->sampler
.min_img_filter
= filter
;
621 ctx
->sampler
.mag_img_filter
= filter
;
622 cso_single_sampler(ctx
->cso
, 0, &ctx
->sampler
);
623 cso_single_sampler_done(ctx
->cso
);
626 ctx
->viewport
.scale
[0] = 0.5f
* dst
->width
;
627 ctx
->viewport
.scale
[1] = 0.5f
* dst
->height
;
628 ctx
->viewport
.scale
[2] = 0.5f
;
629 ctx
->viewport
.scale
[3] = 1.0f
;
630 ctx
->viewport
.translate
[0] = 0.5f
* dst
->width
;
631 ctx
->viewport
.translate
[1] = 0.5f
* dst
->height
;
632 ctx
->viewport
.translate
[2] = 0.5f
;
633 ctx
->viewport
.translate
[3] = 0.0f
;
634 cso_set_viewport(ctx
->cso
, &ctx
->viewport
);
637 cso_set_fragment_sampler_views(ctx
->cso
, 1, &src_sampler_view
);
640 cso_set_fragment_shader_handle(ctx
->cso
, ctx
->fs
[TGSI_WRITEMASK_XYZW
]);
641 cso_set_vertex_shader_handle(ctx
->cso
, ctx
->vs
);
644 memset(&fb
, 0, sizeof(fb
));
645 fb
.width
= dst
->width
;
646 fb
.height
= dst
->height
;
649 cso_set_framebuffer(ctx
->cso
, &fb
);
652 offset
= setup_vertex_data_tex(ctx
,
653 (float) dstX0
/ dst
->width
* 2.0f
- 1.0f
,
654 (float) dstY0
/ dst
->height
* 2.0f
- 1.0f
,
655 (float) dstX1
/ dst
->width
* 2.0f
- 1.0f
,
656 (float) dstY1
/ dst
->height
* 2.0f
- 1.0f
,
660 util_draw_vertex_buffer(ctx
->pipe
,
662 PIPE_PRIM_TRIANGLE_FAN
,
664 2); /* attribs/vert */
666 /* restore state we changed */
667 cso_restore_blend(ctx
->cso
);
668 cso_restore_depth_stencil_alpha(ctx
->cso
);
669 cso_restore_rasterizer(ctx
->cso
);
670 cso_restore_samplers(ctx
->cso
);
671 cso_restore_fragment_sampler_views(ctx
->cso
);
672 cso_restore_framebuffer(ctx
->cso
);
673 cso_restore_fragment_shader(ctx
->cso
);
674 cso_restore_vertex_shader(ctx
->cso
);
675 cso_restore_clip(ctx
->cso
);
676 cso_restore_vertex_elements(ctx
->cso
);