1 /**************************************************************************
3 * Copyright 2007 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 **************************************************************************/
29 * \brief Clipping stage
31 * \author Keith Whitwell <keith@tungstengraphics.com>
35 #include "util/u_memory.h"
36 #include "util/u_math.h"
38 #include "pipe/p_shader_tokens.h"
41 #include "draw_pipe.h"
46 /** Set to 1 to enable printing of coords before/after clipping */
51 #define IS_NEGATIVE(X) ((X) < 0.0)
54 #ifndef DIFFERENT_SIGNS
55 #define DIFFERENT_SIGNS(x, y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
58 #define MAX_CLIPPED_VERTICES ((2 * (6 + PIPE_MAX_CLIP_PLANES))+1)
63 struct draw_stage stage
; /**< base class */
65 /* List of the attributes to be flatshaded. */
66 uint num_flat_attribs
;
67 uint flat_attribs
[PIPE_MAX_SHADER_OUTPUTS
];
69 /* Mask of attributes in noperspective mode */
70 boolean noperspective_attribs
[PIPE_MAX_SHADER_OUTPUTS
];
77 static INLINE
struct clip_stage
*clip_stage( struct draw_stage
*stage
)
79 return (struct clip_stage
*)stage
;
83 #define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT)))
86 /* All attributes are float[4], so this is easy:
88 static void interp_attr( float dst
[4],
93 dst
[0] = LINTERP( t
, out
[0], in
[0] );
94 dst
[1] = LINTERP( t
, out
[1], in
[1] );
95 dst
[2] = LINTERP( t
, out
[2], in
[2] );
96 dst
[3] = LINTERP( t
, out
[3], in
[3] );
101 * Copy flat shaded attributes src vertex to dst vertex.
103 static void copy_flat( struct draw_stage
*stage
,
104 struct vertex_header
*dst
,
105 const struct vertex_header
*src
)
107 const struct clip_stage
*clipper
= clip_stage(stage
);
109 for (i
= 0; i
< clipper
->num_flat_attribs
; i
++) {
110 const uint attr
= clipper
->flat_attribs
[i
];
111 COPY_4FV(dst
->data
[attr
], src
->data
[attr
]);
117 /* Interpolate between two vertices to produce a third.
119 static void interp( const struct clip_stage
*clip
,
120 struct vertex_header
*dst
,
122 const struct vertex_header
*out
,
123 const struct vertex_header
*in
)
125 const unsigned nr_attrs
= draw_current_shader_outputs(clip
->stage
.draw
);
126 const unsigned pos_attr
= draw_current_shader_position_output(clip
->stage
.draw
);
127 const unsigned clip_attr
= draw_current_shader_clipvertex_output(clip
->stage
.draw
);
134 dst
->edgeflag
= 0; /* will get overwritten later */
135 dst
->have_clipdist
= in
->have_clipdist
;
136 dst
->vertex_id
= UNDEFINED_VERTEX_ID
;
138 /* Interpolate the clip-space coords.
140 interp_attr(dst
->clip
, t
, in
->clip
, out
->clip
);
141 /* interpolate the clip-space position */
142 interp_attr(dst
->pre_clip_pos
, t
, in
->pre_clip_pos
, out
->pre_clip_pos
);
144 /* Do the projective divide and viewport transformation to get
145 * new window coordinates:
148 const float *pos
= dst
->pre_clip_pos
;
149 const float *scale
= clip
->stage
.draw
->viewport
.scale
;
150 const float *trans
= clip
->stage
.draw
->viewport
.translate
;
151 const float oow
= 1.0f
/ pos
[3];
153 dst
->data
[pos_attr
][0] = pos
[0] * oow
* scale
[0] + trans
[0];
154 dst
->data
[pos_attr
][1] = pos
[1] * oow
* scale
[1] + trans
[1];
155 dst
->data
[pos_attr
][2] = pos
[2] * oow
* scale
[2] + trans
[2];
156 dst
->data
[pos_attr
][3] = oow
;
160 * Compute the t in screen-space instead of 3d space to use
161 * for noperspective interpolation.
163 * The points can be aligned with the X axis, so in that case try
164 * the Y. When both points are at the same screen position, we can
165 * pick whatever value (the interpolated point won't be in front
166 * anyway), so just use the 3d t.
171 /* find either in.x != out.x or in.y != out.y */
172 for (k
= 0; k
< 2; k
++) {
173 if (in
->clip
[k
] != out
->clip
[k
]) {
174 /* do divide by W, then compute linear interpolation factor */
175 float in_coord
= in
->clip
[k
] / in
->clip
[3];
176 float out_coord
= out
->clip
[k
] / out
->clip
[3];
177 float dst_coord
= dst
->clip
[k
] / dst
->clip
[3];
178 t_nopersp
= (dst_coord
- out_coord
) / (in_coord
- out_coord
);
186 for (j
= 0; j
< nr_attrs
; j
++) {
187 if (j
!= pos_attr
&& j
!= clip_attr
) {
188 if (clip
->noperspective_attribs
[j
])
189 interp_attr(dst
->data
[j
], t_nopersp
, in
->data
[j
], out
->data
[j
]);
191 interp_attr(dst
->data
[j
], t
, in
->data
[j
], out
->data
[j
]);
198 * Emit a post-clip polygon to the next pipeline stage. The polygon
199 * will be convex and the provoking vertex will always be vertex[0].
201 static void emit_poly( struct draw_stage
*stage
,
202 struct vertex_header
**inlist
,
203 const boolean
*edgeflags
,
205 const struct prim_header
*origPrim
)
207 struct prim_header header
;
209 ushort edge_first
, edge_middle
, edge_last
;
211 if (stage
->draw
->rasterizer
->flatshade_first
) {
212 edge_first
= DRAW_PIPE_EDGE_FLAG_0
;
213 edge_middle
= DRAW_PIPE_EDGE_FLAG_1
;
214 edge_last
= DRAW_PIPE_EDGE_FLAG_2
;
217 edge_first
= DRAW_PIPE_EDGE_FLAG_2
;
218 edge_middle
= DRAW_PIPE_EDGE_FLAG_0
;
219 edge_last
= DRAW_PIPE_EDGE_FLAG_1
;
225 /* later stages may need the determinant, but only the sign matters */
226 header
.det
= origPrim
->det
;
227 header
.flags
= DRAW_PIPE_RESET_STIPPLE
| edge_first
| edge_middle
;
230 for (i
= 2; i
< n
; i
++, header
.flags
= edge_middle
) {
231 /* order the triangle verts to respect the provoking vertex mode */
232 if (stage
->draw
->rasterizer
->flatshade_first
) {
233 header
.v
[0] = inlist
[0]; /* the provoking vertex */
234 header
.v
[1] = inlist
[i
-1];
235 header
.v
[2] = inlist
[i
];
238 header
.v
[0] = inlist
[i
-1];
239 header
.v
[1] = inlist
[i
];
240 header
.v
[2] = inlist
[0]; /* the provoking vertex */
243 if (!edgeflags
[i
-1]) {
244 header
.flags
&= ~edge_middle
;
247 if (i
== n
- 1 && edgeflags
[i
])
248 header
.flags
|= edge_last
;
251 const struct draw_vertex_shader
*vs
= stage
->draw
->vs
.vertex_shader
;
253 debug_printf("Clipped tri: (flat-shade-first = %d)\n",
254 stage
->draw
->rasterizer
->flatshade_first
);
255 for (j
= 0; j
< 3; j
++) {
256 debug_printf(" Vert %d: clip: %f %f %f %f\n", j
,
257 header
.v
[j
]->clip
[0],
258 header
.v
[j
]->clip
[1],
259 header
.v
[j
]->clip
[2],
260 header
.v
[j
]->clip
[3]);
261 for (k
= 0; k
< vs
->info
.num_outputs
; k
++) {
262 debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j
, k
,
263 header
.v
[j
]->data
[k
][0],
264 header
.v
[j
]->data
[k
][1],
265 header
.v
[j
]->data
[k
][2],
266 header
.v
[j
]->data
[k
][3]);
271 stage
->next
->tri( stage
->next
, &header
);
277 dot4(const float *a
, const float *b
)
279 return (a
[0] * b
[0] +
286 * this function extracts the clip distance for the current plane,
287 * it first checks if the shader provided a clip distance, otherwise
288 * it works out the value using the clipvertex
290 static INLINE
float getclipdist(const struct clip_stage
*clipper
,
291 struct vertex_header
*vert
,
296 if (vert
->have_clipdist
&& plane_idx
>= 6) {
297 /* pick the correct clipdistance element from the output vectors */
298 int _idx
= plane_idx
- 6;
300 int vidx
= cdi
? _idx
- 4 : _idx
;
301 dp
= vert
->data
[draw_current_shader_clipdistance_output(clipper
->stage
.draw
, cdi
)][vidx
];
303 plane
= clipper
->plane
[plane_idx
];
304 dp
= dot4(vert
->clip
, plane
);
309 /* Clip a triangle against the viewport and user clip planes.
312 do_clip_tri( struct draw_stage
*stage
,
313 struct prim_header
*header
,
316 struct clip_stage
*clipper
= clip_stage( stage
);
317 struct vertex_header
*a
[MAX_CLIPPED_VERTICES
];
318 struct vertex_header
*b
[MAX_CLIPPED_VERTICES
];
319 struct vertex_header
**inlist
= a
;
320 struct vertex_header
**outlist
= b
;
324 boolean aEdges
[MAX_CLIPPED_VERTICES
];
325 boolean bEdges
[MAX_CLIPPED_VERTICES
];
326 boolean
*inEdges
= aEdges
;
327 boolean
*outEdges
= bEdges
;
329 inlist
[0] = header
->v
[0];
330 inlist
[1] = header
->v
[1];
331 inlist
[2] = header
->v
[2];
334 const float *v0
= header
->v
[0]->clip
;
335 const float *v1
= header
->v
[1]->clip
;
336 const float *v2
= header
->v
[2]->clip
;
337 debug_printf("Clip triangle:\n");
338 debug_printf(" %f, %f, %f, %f\n", v0
[0], v0
[1], v0
[2], v0
[3]);
339 debug_printf(" %f, %f, %f, %f\n", v1
[0], v1
[1], v1
[2], v1
[3]);
340 debug_printf(" %f, %f, %f, %f\n", v2
[0], v2
[1], v2
[2], v2
[3]);
344 * Note: at this point we can't just use the per-vertex edge flags.
345 * We have to observe the edge flag bits set in header->flags which
346 * were set during primitive decomposition. Put those flags into
347 * an edge flags array which parallels the vertex array.
348 * Later, in the 'unfilled' pipeline stage we'll draw the edge if both
349 * the header.flags bit is set AND the per-vertex edgeflag field is set.
351 inEdges
[0] = !!(header
->flags
& DRAW_PIPE_EDGE_FLAG_0
);
352 inEdges
[1] = !!(header
->flags
& DRAW_PIPE_EDGE_FLAG_1
);
353 inEdges
[2] = !!(header
->flags
& DRAW_PIPE_EDGE_FLAG_2
);
355 while (clipmask
&& n
>= 3) {
356 const unsigned plane_idx
= ffs(clipmask
)-1;
357 const boolean is_user_clip_plane
= plane_idx
>= 6;
358 struct vertex_header
*vert_prev
= inlist
[0];
359 boolean
*edge_prev
= &inEdges
[0];
361 unsigned outcount
= 0;
363 dp_prev
= getclipdist(clipper
, vert_prev
, plane_idx
);
364 clipmask
&= ~(1<<plane_idx
);
366 assert(n
< MAX_CLIPPED_VERTICES
);
367 if (n
>= MAX_CLIPPED_VERTICES
)
369 inlist
[n
] = inlist
[0]; /* prevent rotation of vertices */
370 inEdges
[n
] = inEdges
[0];
372 for (i
= 1; i
<= n
; i
++) {
373 struct vertex_header
*vert
= inlist
[i
];
374 boolean
*edge
= &inEdges
[i
];
376 float dp
= getclipdist(clipper
, vert
, plane_idx
);
378 if (!IS_NEGATIVE(dp_prev
)) {
379 assert(outcount
< MAX_CLIPPED_VERTICES
);
380 if (outcount
>= MAX_CLIPPED_VERTICES
)
382 outEdges
[outcount
] = *edge_prev
;
383 outlist
[outcount
++] = vert_prev
;
386 if (DIFFERENT_SIGNS(dp
, dp_prev
)) {
387 struct vertex_header
*new_vert
;
390 assert(tmpnr
< MAX_CLIPPED_VERTICES
+ 1);
391 if (tmpnr
>= MAX_CLIPPED_VERTICES
+ 1)
393 new_vert
= clipper
->stage
.tmp
[tmpnr
++];
395 assert(outcount
< MAX_CLIPPED_VERTICES
);
396 if (outcount
>= MAX_CLIPPED_VERTICES
)
399 new_edge
= &outEdges
[outcount
];
400 outlist
[outcount
++] = new_vert
;
402 if (IS_NEGATIVE(dp
)) {
403 /* Going out of bounds. Avoid division by zero as we
404 * know dp != dp_prev from DIFFERENT_SIGNS, above.
406 float t
= dp
/ (dp
- dp_prev
);
407 interp( clipper
, new_vert
, t
, vert
, vert_prev
);
409 /* Whether or not to set edge flag for the new vert depends
410 * on whether it's a user-defined clipping plane. We're
411 * copying NVIDIA's behaviour here.
413 if (is_user_clip_plane
) {
414 /* we want to see an edge along the clip plane */
416 new_vert
->edgeflag
= TRUE
;
419 /* we don't want to see an edge along the frustum clip plane */
420 *new_edge
= *edge_prev
;
421 new_vert
->edgeflag
= FALSE
;
427 float t
= dp_prev
/ (dp_prev
- dp
);
428 interp( clipper
, new_vert
, t
, vert_prev
, vert
);
430 /* Copy starting vert's edgeflag:
432 new_vert
->edgeflag
= vert_prev
->edgeflag
;
433 *new_edge
= *edge_prev
;
442 /* swap in/out lists */
444 struct vertex_header
**tmp
= inlist
;
450 boolean
*tmp
= inEdges
;
457 /* If flat-shading, copy provoking vertex color to polygon vertex[0]
460 if (clipper
->num_flat_attribs
) {
461 if (stage
->draw
->rasterizer
->flatshade_first
) {
462 if (inlist
[0] != header
->v
[0]) {
463 assert(tmpnr
< MAX_CLIPPED_VERTICES
+ 1);
464 if (tmpnr
>= MAX_CLIPPED_VERTICES
+ 1)
466 inlist
[0] = dup_vert(stage
, inlist
[0], tmpnr
++);
467 copy_flat(stage
, inlist
[0], header
->v
[0]);
471 if (inlist
[0] != header
->v
[2]) {
472 assert(tmpnr
< MAX_CLIPPED_VERTICES
+ 1);
473 if (tmpnr
>= MAX_CLIPPED_VERTICES
+ 1)
475 inlist
[0] = dup_vert(stage
, inlist
[0], tmpnr
++);
476 copy_flat(stage
, inlist
[0], header
->v
[2]);
481 /* Emit the polygon as triangles to the setup stage:
483 emit_poly( stage
, inlist
, inEdges
, n
, header
);
488 /* Clip a line against the viewport and user clip planes.
491 do_clip_line( struct draw_stage
*stage
,
492 struct prim_header
*header
,
495 const struct clip_stage
*clipper
= clip_stage( stage
);
496 struct vertex_header
*v0
= header
->v
[0];
497 struct vertex_header
*v1
= header
->v
[1];
500 struct prim_header newprim
;
503 const unsigned plane_idx
= ffs(clipmask
)-1;
504 const float dp0
= getclipdist(clipper
, v0
, plane_idx
);
505 const float dp1
= getclipdist(clipper
, v1
, plane_idx
);
508 float t
= dp1
/ (dp1
- dp0
);
513 float t
= dp0
/ (dp0
- dp1
);
518 return; /* discard */
520 clipmask
&= ~(1 << plane_idx
); /* turn off this plane's bit */
524 interp( clipper
, stage
->tmp
[0], t0
, v0
, v1
);
525 copy_flat(stage
, stage
->tmp
[0], v0
);
526 newprim
.v
[0] = stage
->tmp
[0];
533 interp( clipper
, stage
->tmp
[1], t1
, v1
, v0
);
534 newprim
.v
[1] = stage
->tmp
[1];
540 stage
->next
->line( stage
->next
, &newprim
);
545 clip_point( struct draw_stage
*stage
,
546 struct prim_header
*header
)
548 if (header
->v
[0]->clipmask
== 0)
549 stage
->next
->point( stage
->next
, header
);
554 clip_line( struct draw_stage
*stage
,
555 struct prim_header
*header
)
557 unsigned clipmask
= (header
->v
[0]->clipmask
|
558 header
->v
[1]->clipmask
);
561 /* no clipping needed */
562 stage
->next
->line( stage
->next
, header
);
564 else if ((header
->v
[0]->clipmask
&
565 header
->v
[1]->clipmask
) == 0) {
566 do_clip_line(stage
, header
, clipmask
);
568 /* else, totally clipped */
573 clip_tri( struct draw_stage
*stage
,
574 struct prim_header
*header
)
576 unsigned clipmask
= (header
->v
[0]->clipmask
|
577 header
->v
[1]->clipmask
|
578 header
->v
[2]->clipmask
);
581 /* no clipping needed */
582 stage
->next
->tri( stage
->next
, header
);
584 else if ((header
->v
[0]->clipmask
&
585 header
->v
[1]->clipmask
&
586 header
->v
[2]->clipmask
) == 0) {
587 do_clip_tri(stage
, header
, clipmask
);
592 /* Update state. Could further delay this until we hit the first
593 * primitive that really requires clipping.
596 clip_init_state( struct draw_stage
*stage
)
598 struct clip_stage
*clipper
= clip_stage( stage
);
599 const struct draw_vertex_shader
*vs
= stage
->draw
->vs
.vertex_shader
;
600 const struct draw_geometry_shader
*gs
= stage
->draw
->gs
.geometry_shader
;
601 const struct draw_fragment_shader
*fs
= stage
->draw
->fs
.fragment_shader
;
603 struct tgsi_shader_info
*vs_info
= gs
? &gs
->info
: &vs
->info
;
605 /* We need to know for each attribute what kind of interpolation is
606 * done on it (flat, smooth or noperspective). But the information
607 * is not directly accessible for outputs, only for inputs. So we
608 * have to match semantic name and index between the VS (or GS/ES)
609 * outputs and the FS inputs to get to the interpolation mode.
611 * The only hitch is with gl_FrontColor/gl_BackColor which map to
612 * gl_Color, and their Secondary versions. First there are (up to)
613 * two outputs for one input, so we tuck the information in a
614 * specific array. Second if they don't have qualifiers, the
615 * default value has to be picked from the global shade mode.
617 * Of course, if we don't have a fragment shader in the first
618 * place, defaults should be used.
621 /* First pick up the interpolation mode for
622 * gl_Color/gl_SecondaryColor, with the correct default.
624 int indexed_interp
[2];
625 indexed_interp
[0] = indexed_interp
[1] = stage
->draw
->rasterizer
->flatshade
?
626 TGSI_INTERPOLATE_CONSTANT
: TGSI_INTERPOLATE_PERSPECTIVE
;
629 for (i
= 0; i
< fs
->info
.num_inputs
; i
++) {
630 if (fs
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_COLOR
) {
631 if (fs
->info
.input_interpolate
[i
] != TGSI_INTERPOLATE_COLOR
)
632 indexed_interp
[fs
->info
.input_semantic_index
[i
]] = fs
->info
.input_interpolate
[i
];
637 /* Then resolve the interpolation mode for every output attribute.
639 * Given how the rest of the code, the most efficient way is to
640 * have a vector of flat-mode attributes, and a mask for
641 * noperspective attributes.
644 clipper
->num_flat_attribs
= 0;
645 memset(clipper
->noperspective_attribs
, 0, sizeof(clipper
->noperspective_attribs
));
646 for (i
= 0; i
< vs_info
->num_outputs
; i
++) {
647 /* Find the interpolation mode for a specific attribute
651 /* If it's gl_{Front,Back}{,Secondary}Color, pick up the mode
652 * from the array we've filled before. */
653 if (vs_info
->output_semantic_name
[i
] == TGSI_SEMANTIC_COLOR
||
654 vs_info
->output_semantic_name
[i
] == TGSI_SEMANTIC_BCOLOR
) {
655 interp
= indexed_interp
[vs_info
->output_semantic_index
[i
]];
657 /* Otherwise, search in the FS inputs, with a decent default
658 * if we don't find it.
661 interp
= TGSI_INTERPOLATE_PERSPECTIVE
;
663 for (j
= 0; j
< fs
->info
.num_inputs
; j
++) {
664 if (vs_info
->output_semantic_name
[i
] == fs
->info
.input_semantic_name
[j
] &&
665 vs_info
->output_semantic_index
[i
] == fs
->info
.input_semantic_index
[j
]) {
666 interp
= fs
->info
.input_interpolate
[j
];
673 /* If it's flat, add it to the flat vector. Otherwise update
674 * the noperspective mask.
676 if (interp
== TGSI_INTERPOLATE_CONSTANT
) {
677 clipper
->flat_attribs
[clipper
->num_flat_attribs
] = i
;
678 clipper
->num_flat_attribs
++;
680 clipper
->noperspective_attribs
[i
] = interp
== TGSI_INTERPOLATE_LINEAR
;
683 stage
->tri
= clip_tri
;
684 stage
->line
= clip_line
;
689 static void clip_first_tri( struct draw_stage
*stage
,
690 struct prim_header
*header
)
692 clip_init_state( stage
);
693 stage
->tri( stage
, header
);
696 static void clip_first_line( struct draw_stage
*stage
,
697 struct prim_header
*header
)
699 clip_init_state( stage
);
700 stage
->line( stage
, header
);
704 static void clip_flush( struct draw_stage
*stage
,
707 stage
->tri
= clip_first_tri
;
708 stage
->line
= clip_first_line
;
709 stage
->next
->flush( stage
->next
, flags
);
713 static void clip_reset_stipple_counter( struct draw_stage
*stage
)
715 stage
->next
->reset_stipple_counter( stage
->next
);
719 static void clip_destroy( struct draw_stage
*stage
)
721 draw_free_temp_verts( stage
);
727 * Allocate a new clipper stage.
728 * \return pointer to new stage object
730 struct draw_stage
*draw_clip_stage( struct draw_context
*draw
)
732 struct clip_stage
*clipper
= CALLOC_STRUCT(clip_stage
);
736 clipper
->stage
.draw
= draw
;
737 clipper
->stage
.name
= "clipper";
738 clipper
->stage
.point
= clip_point
;
739 clipper
->stage
.line
= clip_first_line
;
740 clipper
->stage
.tri
= clip_first_tri
;
741 clipper
->stage
.flush
= clip_flush
;
742 clipper
->stage
.reset_stipple_counter
= clip_reset_stipple_counter
;
743 clipper
->stage
.destroy
= clip_destroy
;
745 clipper
->plane
= draw
->plane
;
747 if (!draw_alloc_temp_verts( &clipper
->stage
, MAX_CLIPPED_VERTICES
+1 ))
750 return &clipper
->stage
;
754 clipper
->stage
.destroy( &clipper
->stage
);