1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 #ifndef _GX2UTCOPY_H_
14 #define _GX2UTCOPY_H_
15 
16 // Note: Currently this header depends on gx2.h being included first to define
17 // types like s32 and structures like GX2Surface.
18 #include <cafe/gx2.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /// @addtogroup GX2UTCopyAndConvertGroup
25 /// @{
26 
27 /// \brief Rectangular region
28 typedef struct _GX2UTRect {
29     s32 left;
30     s32 top;
31     s32 right;
32     s32 bottom;
33 } GX2UTRect;
34 
35 /// \brief Setup all of the constant render state needed for \ref GX2UTCopySurface.
36 ///
37 /// \param enable Enable or disable the state
38 ///
39 /// This enables and disables the state used by \ref GX2UTCopySurface and
40 /// \ref GX2UTCopySurfaceRectOp.  After finishing all copy operations, it is
41 /// necessary to call this function to disable the copy state and sets any
42 /// changed state to the GX2 default state. A smaller yet equivalent
43 /// routine can be written using knowledge of the application's desired state.
44 /// To customize the state that is restored, refer to the library source
45 /// (src/lib/gx2ut/gx2utCopy.cpp).
46 ///
47 /// \donotcall \gx2_typical \enddonotcall
48 ///
49 /// \clobberstate
50 ///
51 /// \writesgpu
52 /// \alwayswritesgpu
53 ///
54 void GX2UTSetCopyState(GX2Boolean enable);
55 
56 /// \brief Copy the specified source surface rectangle to the dest surface rectangle.
57 ///
58 /// \param srcSurface  Pointer to source surface structure
59 /// \param srcMip      Mip level of surface to read (0 typically)
60 /// \param srcSlice    Slice to read for array & 3D (0 typically)
61 /// \param srcRect     Pointer to the source region to copy.
62 /// \param dstSurface  Pointer to destination surface structure
63 /// \param dstMip      Mip level of dest surface to write (0 typically)
64 /// \param dstSlice    Slice to write for array & 3D (0 typically)
65 /// \param dstRect     Pointer to the destination region to copy.
66 /// \param dstAuxPtr   Destination MSAA auxPtr for AA buffer or NULL for non-AA buffers.
67 /// \param dstAuxSize  Destination MSAA auxSize for AA buffers or NULL for non-AA buffers.
68 ///
69 /// This function assumes \ref GX2UTSetCopyState
70 /// (or comparable state setup function) has been called to setup required
71 /// render state.
72 ///
73 /// Copies a region from one surface to a region of another surface.
74 /// Setting the rectangular regions to a top-left of (0,0) and a bottom-right
75 /// of (width, height) will blt the entire surface without any flipping (the
76 /// right and bottom are exclusive).
77 ///
78 /// The srcRect/dstRect dimensions should be relative to the mipmap level
79 /// dimensions, not the base level dimensions.
80 ///
81 /// This copies one surface to another in the same way s \ref GX2CopySurface
82 /// and \ref GX2CopySurfaceEx. It modifies the currently bound VS/PS
83 /// shaders, GX_RENDER_TARGET0, and Scissor/Viewport settings. In addition it
84 /// overwrites VS uniform locations 0-7 and PS sampler location 0, and it
85 /// changes the \ref GX2SetShaderMode to
86 ///  \ref GX2_SHADER_MODE_UNIFORM_REGISTER.
87 ///
88 /// \note Compressed textures must be copied on a 4x4 pixel alignment.
89 ///       Coordinates are in terms of pixels, not blocks.
90 ///       For compressed textures the source and destination formats must
91 ///       match.
92 ///
93 /// \note It is not necessary to call \ref GX2Invalidate on the
94 ///        source/destination buffers. This is done internally.
95 ///
96 /// \note If the source is an AA buffer, you must call
97 ///       \ref GX2ExpandAAColorBuffer or \ref GX2UTExpandAAColorBuffer first.
98 ///
99 /// \note This copy, as it is, will be impacted by the toss stage
100 ///       (\ref GX2TossStageSect) setup at GX2Init time. To avoid this, call
101 ///       this function from a separate state context with profiling disabled.
102 ///       See \ref GX2SetupContextStateEx for more information.
103 ///
104 /// \warning Stretching is not supported for depth/stencil/compressed formats.
105 ///
106 /// \clobberstate
107 ///
108 /// \donotcall \gx2_typical \enddonotcall
109 ///
110 /// \writesgpu
111 /// \alwayswritesgpu
112 ///
113 void GX2UTCopySurfaceRectOp(const GX2Surface *srcSurface,
114                             u32 srcMip, u32 srcSlice, GX2UTRect *srcRect,
115                             GX2Surface *dstSurface,
116                             u32 dstMip, u32 dstSlice, GX2UTRect *dstRect,
117                             void* dstAuxPtr, u32 dstAuxSize);
118 
119 /// \brief Copy the specified source surface to the dest surface.
120 ///
121 /// \param srcSurface  Pointer to source surface structure
122 /// \param srcMip      Mip level of surface to read (0 typically)
123 /// \param srcSlice    Slice to read for array & 3D (0 typically)
124 /// \param dstSurface  Pointer to destination surface structure
125 /// \param dstMip      Mip level of dest surface to write (0 typically)
126 /// \param dstSlice    Slice to write for array & 3D (0 typically)
127 /// \param dstAuxPtr   Destination MSAA auxPtr for AA buffer or NULL for non-AA buffers.
128 /// \param dstAuxSize  Destination MSAA auxSize for AA buffers or NULL for non-AA buffers.
129 ///
130 /// This function assumes \ref GX2UTSetCopyState
131 /// (or comparable state setup function) has been called to setup required
132 /// render state.
133 ///
134 /// Copies a region from one surface to a region of another surface.
135 /// Setting the rectangular regions to a top-left of (0,0) and a bottom-right
136 /// of (width, height) will blt the entire surface without any flipping (the
137 /// right and bottom are exclusive).
138 ///
139 /// This copies one surface to another in the same way s \ref GX2CopySurface
140 /// and \ref GX2CopySurfaceEx. It modifies the currently bound VS/PS
141 /// shaders, GX_RENDER_TARGET0, and Scissor/Viewport settings. In addition it
142 /// overwrites VS uniform locations 0-7 and PS sampler location 0, and it
143 /// changes the \ref GX2SetShaderMode to
144 ///  \ref GX2_SHADER_MODE_UNIFORM_REGISTER.
145 ///
146 /// \note Compressed textures must be copied on a 4x4 pixel alignment.
147 ///       Coordinates are in terms of pixels, not blocks.
148 ///       For compressed textures the source and destination formats must
149 ///       match.
150 ///
151 /// \note It is not necessary to call \ref GX2Invalidate on the
152 ///        source/destination buffers. This is done internally.
153 ///
154 /// \note If the source is an AA buffer, you must call
155 ///       \ref GX2ExpandAAColorBuffer or \ref GX2UTExpandAAColorBuffer first.
156 ///
157 /// \note This copy, as it is, will be impacted by the toss stage
158 ///       (\ref GX2TossStageSect) setup at GX2Init time. To avoid this, call
159 ///       this function from a separate state context with profiling disabled.
160 ///       See \ref GX2SetupContextStateEx for more information.
161 ///
162 /// \warning Stretching is not supported for depth/stencil/compressed formats.
163 ///
164 /// \clobberstate
165 ///
166 /// \donotcall \gx2_typical \enddonotcall
167 ///
168 /// \writesgpu
169 /// \alwayswritesgpu
170 ///
GX2UTCopySurfaceOp(const GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice,void * dstAuxPtr,u32 dstAuxSize)171 GX2_INLINE void GX2UTCopySurfaceOp(const GX2Surface *srcSurface,
172                                    u32 srcMip, u32 srcSlice,
173                                    GX2Surface *dstSurface,
174                                    u32 dstMip, u32 dstSlice,
175                                    void* dstAuxPtr, u32 dstAuxSize)
176 {
177     GX2UTRect srcRect = {0};
178     GX2UTRect dstRect = {0};
179 
180     GX2UTDebugTagIndent(__func__);
181 
182     // This may be stretch copy so rectangles need to match
183     // source and destination surfaces.
184     srcRect.right = GX2Max(1, srcSurface->width >> srcMip);
185     srcRect.bottom = GX2Max(1, srcSurface->height >> srcMip);
186     dstRect.right = GX2Max(1, dstSurface->width >> dstMip);
187     dstRect.bottom = GX2Max(1, dstSurface->height >> dstMip);
188 
189     GX2UTCopySurfaceRectOp(srcSurface, srcMip, srcSlice, &srcRect,
190                            dstSurface, dstMip, dstSlice, &dstRect,
191                            dstAuxPtr, dstAuxSize);
192     GX2UTDebugTagUndent();
193 }
194 
195 /// \brief Copy the specified source surface to the dest surface.
196 ///
197 /// \param srcSurface  Pointer to source surface structure
198 /// \param srcMip      Mip level of surface to read (0 typically)
199 /// \param srcSlice    Slice to read for array & 3D (0 typically)
200 /// \param srcRect     Pointer to the source region to copy.
201 /// \param dstSurface  Pointer to destination surface structure
202 /// \param dstMip      Mip level of dest surface to write (0 typically)
203 /// \param dstSlice    Slice to write for array & 3D (0 typically)
204 /// \param dstRect     Pointer to the destination region to copy.
205 /// \param dstAuxPtr   Destination MSAA auxPtr for AA buffer or NULL for non-AA buffers.
206 /// \param dstAuxSize  Destination MSAA auxSize for AA buffers or NULL for non-AA buffers.
207 ///
208 /// This function assumes \ref GX2UTSetCopyState
209 /// (or comparable state setup function) has been called to setup required
210 /// render state.
211 ///
212 /// Copies a region from one surface to a region of another surface.
213 /// Setting the rectangular regions to a top-left of (0,0) and a bottom-right
214 /// of (width, height) will blt the entire surface without any flipping (the
215 /// right and bottom are exclusive).
216 ///
217 /// The srcRect/dstRect dimensions should be relative to the mipmap level
218 /// dimensions, not the base level dimensions.
219 ///
220 /// \note Compressed textures must be copied on a 4x4 pixel alignment.
221 ///       Coordinates are in terms of pixels, not blocks.
222 ///       For compressed textures the source and destination formats must
223 ///       match.
224 ///
225 /// \note It is not necessary to call \ref GX2Invalidate on the
226 ///        source/destination buffers. This is done internally.
227 ///
228 /// \note If the source is an AA buffer, you must call
229 ///       \ref GX2ExpandAAColorBuffer or \ref GX2UTExpandAAColorBuffer first.
230 ///
231 /// \note This copy, as it is, will be impacted by the toss stage
232 ///       (\ref GX2TossStageSect) setup at GX2Init time. To avoid this, call
233 ///       this function from a separate state context with profiling disabled.
234 ///       See \ref GX2SetupContextStateEx for more information.
235 ///
236 /// \warning The behavior of this routine has changed from SDK 2.12.00!
237 ///          It now disables state shadowing and requires
238 ///          \ref GX2SetContextState afterward. To avoid this, please use
239 ///          \ref GX2UTCopySurfaceRectOp instead.
240 ///
241 /// \warning Stretching is not supported for depth/stencil/compressed formats.
242 ///
243 /// \warning Better performing alternatives exist. Please see
244 ///          \ref GX2UTAdvancedGX2ReplacementAPISect.
245 ///
246 /// \clobberstate
247 /// \disablesstateshadow
248 ///
249 /// \donotcall \gx2_typical \enddonotcall
250 ///
251 /// \writesgpu
252 /// \alwayswritesgpu
253 ///
GX2UTCopySurfaceRect(const GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2UTRect * srcRect,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice,GX2UTRect * dstRect,void * dstAuxPtr,u32 dstAuxSize)254 GX2_INLINE void GX2UTCopySurfaceRect(const GX2Surface *srcSurface,
255                                      u32 srcMip, u32 srcSlice,
256                                      GX2UTRect *srcRect,
257                                      GX2Surface *dstSurface,
258                                      u32 dstMip, u32 dstSlice,
259                                      GX2UTRect *dstRect,
260                                      void* dstAuxPtr, u32 dstAuxSize)
261 {
262     GX2UTDebugTagIndent(__func__);
263 
264     // Disable state shadowing.  If your app is using state shadowing,
265     // you will need to restore the context after calling this function.
266     GX2SetContextState(NULL);
267 
268     // Setup all of the constant render state needed for the copy.
269     GX2UTSetCopyState(GX2_ENABLE);
270 
271     // Setup parameter specific render state and copy.
272     GX2UTCopySurfaceRectOp(srcSurface, srcMip, srcSlice, srcRect,
273                          dstSurface, dstMip, dstSlice, dstRect,
274                          dstAuxPtr, dstAuxSize);
275 
276     // Disable special hardware state and set state back to GX2 default
277     GX2UTSetCopyState(GX2_DISABLE);
278 
279 
280     GX2UTDebugTagUndent();
281 }
282 
283 /// \brief Copy the specified source surface to the dest surface.
284 ///
285 /// \deprecated This API has been deprecated and may not be available in future
286 ///             releases. Please use \ref GX2UTCopySurfaceRect instead.
287 ///
288 /// \param srcSurface  Pointer to source surface structure
289 /// \param srcMip      Mip level of surface to read (0 typically)
290 /// \param srcSlice    Slice to read for array & 3D (0 typically)
291 /// \param srcRect     Pointer to the source region to copy.
292 /// \param dstSurface  Pointer to destination surface structure
293 /// \param dstMip      Mip level of dest surface to write (0 typically)
294 /// \param dstSlice    Slice to write for array & 3D (0 typically)
295 /// \param dstRect     Pointer to the destination region to copy.
296 /// \param dstAuxPtr   Destination MSAA auxPtr for AA buffer or NULL for non-AA buffers.
297 /// \param dstAuxSize  Destination MSAA auxSize for AA buffers or NULL for non-AA buffers.
298 ///
299 /// This routine copys one surface to another in the same way as
300 /// \ref GX2CopySurfaceEx.
301 ///
302 /// The source and destination rectangles are relative to the current miplevel.
303 ///
304 /// \note Compressed textures must be copied on a 4x4 pixel alignment.
305 ///       Coordinates are in terms of pixels, not blocks.
306 ///       For compressed textures the source and destination formats must
307 ///       match.
308 ///
309 /// \note It is not necessary to call \ref GX2Invalidate on the
310 ///        source/destination buffers. This is done internally.
311 ///
312 /// \warning Better performing alternatives exist. Please see
313 ///          \ref GX2UTAdvancedGX2ReplacementAPISect.
314 ///
315 /// \clobberstate
316 /// \disablesstateshadow
317 ///
318 /// \donotcall \gx2_typical \enddonotcall
319 ///
320 /// \writesgpu
321 /// \alwayswritesgpu
322 ///
GX2UTSetAndCopySurfaceRect(const GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2UTRect * srcRect,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice,GX2UTRect * dstRect,void * dstAuxPtr,u32 dstAuxSize)323 GX2_INLINE void GX2UTSetAndCopySurfaceRect(const GX2Surface *srcSurface,
324                                            u32 srcMip, u32 srcSlice,
325                                            GX2UTRect *srcRect,
326                                            GX2Surface *dstSurface,
327                                            u32 dstMip, u32 dstSlice,
328                                            GX2UTRect *dstRect,
329                                            void* dstAuxPtr, u32 dstAuxSize)
330 {
331     GX2UTDebugTagIndent(__func__);
332 
333     // Setup parameter specific render state and copy.
334     GX2UTCopySurfaceRect(srcSurface, srcMip, srcSlice, srcRect,
335                          dstSurface, dstMip, dstSlice, dstRect,
336                          dstAuxPtr, dstAuxSize);
337 
338     GX2UTDebugTagUndent();
339 }
340 
341 /// \brief Copy the specified source surface to the dest surface.
342 ///
343 /// \param srcSurface  Pointer to source surface structure
344 /// \param srcMip      Mip level of surface to read (0 typically)
345 /// \param srcSlice    Slice to read for array & 3D (0 typically)
346 /// \param dstSurface  Pointer to destination surface structure
347 /// \param dstMip      Mip level of dest surface to write (0 typically)
348 /// \param dstSlice    Slice to write for array & 3D (0 typically)
349 /// \param numRects    Number of rectangles to copy
350 /// \param pSrcRects   Array of source rectangles to copy
351 /// \param pDstPoints  Array of destination points to copy the rectangles to.
352 ///
353 /// This function mimics the behavior of GX2 and is intended to be an optimized
354 /// replacement for \ref GX2CopySurfaceEx.
355 ///
356 /// The rectangles in pSrcRects should be relative to the mip-level dimensions.
357 ///
358 /// \note Compressed textures must be copied on a 4x4 pixel alignment.
359 ///       Coordinates are in terms of pixels, not blocks.
360 ///       For compressed textures the source and destination formats must
361 ///       match.
362 ///
363 /// \note It is not necessary to call \ref GX2Invalidate on the
364 ///        source/destination buffers. This is done internally.
365 ///
366 /// \warning Better performing alternatives exist. Please see
367 ///          \ref GX2UTAdvancedGX2ReplacementAPISect.
368 ///
369 /// \clobberstate
370 /// \disablesstateshadow
371 ///
372 /// \donotcall \gx2_typical \enddonotcall
373 ///
374 /// \writesgpu
375 /// \alwayswritesgpu
376 ///
GX2UTCopySurfaceEx(const GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice,u32 numRects,GX2RectInt * pSrcRects,GX2PointInt * pDstPoints)377 GX2_INLINE void GX2UTCopySurfaceEx(const GX2Surface *srcSurface,
378                                    u32 srcMip, u32 srcSlice,
379                                    GX2Surface *dstSurface,
380                                    u32 dstMip, u32 dstSlice,
381                                    u32 numRects,
382                                    GX2RectInt* pSrcRects,
383                                    GX2PointInt* pDstPoints)
384 {
385     GX2UTRect srcRect;
386     GX2UTRect dstRect;
387 
388     GX2UTDebugTagIndent(__func__);
389 
390     // Disable state shadowing.  If your app is using state shadowing,
391     // you will need to restore the context after calling this function.
392     GX2SetContextState(NULL);
393 
394     // Setup all of the constant render state needed for the copy.
395     GX2UTSetCopyState(GX2_ENABLE);
396 
397     for (int i = 0; i < numRects; i++)
398     {
399         // Setup the source rectangle
400         srcRect.left = pSrcRects[i].left;
401         srcRect.right = pSrcRects[i].right;
402         srcRect.top = pSrcRects[i].top;
403         srcRect.bottom = pSrcRects[i].bottom;
404 
405         // Setup the destination rectangle
406         dstRect.left = pDstPoints[i].x;
407         dstRect.right = pDstPoints[i].x + pSrcRects[i].right - pSrcRects[i].left;
408         dstRect.top = pDstPoints[i].y + pSrcRects[i].top;
409         dstRect.bottom = pDstPoints[i].y + pSrcRects[i].bottom - pSrcRects[i].top;
410         //Setup parameter specific render state and copy.
411         GX2UTCopySurfaceRectOp(srcSurface, srcMip, srcSlice, &srcRect,
412                              dstSurface, dstMip, dstSlice, &dstRect,
413                              NULL, 0);
414     }
415 
416     // Disable special hardware state and set state back to GX2 default
417     GX2UTSetCopyState(GX2_DISABLE);
418 
419     GX2UTDebugTagUndent();
420 }
421 
422 /// \brief Copy the specified source surface to the dest surface.
423 ///
424 /// \param srcSurface  Pointer to source surface structure
425 /// \param srcMip      Mip level of surface to read (0 typically)
426 /// \param srcSlice    Slice to read for array & 3D (0 typically)
427 /// \param dstSurface  Pointer to destination surface structure
428 /// \param dstMip      Mip level of dest surface to write (0 typically)
429 /// \param dstSlice    Slice to write for array & 3D (0 typically)
430 ///
431 /// This function mimics the behavior of GX2 and is intended to be an optimized
432 /// replacement for \ref GX2CopySurface.
433 ///
434 /// This function assumes \ref GX2UTSetCopyState()
435 /// (or comparable state setup function) has been called to setup required
436 /// render state.
437 ///
438 /// To specify the source and destination regions or to copy AA color
439 /// buffers, use  \ref GX2UTCopySurfaceRectOp instead.
440 ///
441 /// \note It is not necessary to call \ref GX2Invalidate on the
442 ///        source/destination buffers. This is done internally.
443 ///
444 /// \note This copy, as it is, will be impacted by the toss stage
445 ///       (\ref GX2TossStageSect) setup at GX2Init time. To avoid this, call
446 ///       this function from a separate state context with profiling disabled.
447 ///       See \ref GX2SetupContextStateEx for more information.
448 ///
449 ///
450 /// \warning The behavior of this routine has changed from SDK 2.12.00!
451 ///          It now disables state shadowing and requires
452 ///          \ref GX2SetContextState afterward. To avoid this, please use
453 ///          \ref GX2UTCopySurfaceRectOp instead.
454 ///
455 /// \warning Stretching is not supported for depth/stencil/compressed formats.
456 ///
457 /// \warning Better performing alternatives exist. Please see
458 ///          \ref GX2UTAdvancedGX2ReplacementAPISect.
459 ///
460 /// \clobberstate
461 /// \disablesstateshadow
462 ///
463 /// \donotcall \gx2_typical \enddonotcall
464 ///
465 /// \writesgpu
466 /// \alwayswritesgpu
467 ///
GX2UTCopySurface(const GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice)468 GX2_INLINE void GX2UTCopySurface(const GX2Surface *srcSurface,
469                                  u32 srcMip, u32 srcSlice,
470                                  GX2Surface *dstSurface,
471                                  u32 dstMip, u32 dstSlice)
472 {
473     GX2UTRect srcRect;
474     GX2UTRect dstRect;
475 
476     //We need to adjust rectangles based on the mip level
477     srcRect.left = 0;
478     srcRect.top  = 0;
479     srcRect.right  = GX2Max(1, srcSurface->width  >> srcMip);
480     srcRect.bottom = GX2Max(1, srcSurface->height >> srcMip);
481 
482     dstRect.left = 0;
483     dstRect.top  = 0;
484     dstRect.right  = GX2Max(1, dstSurface->width  >> dstMip);
485     dstRect.bottom = GX2Max(1, dstSurface->height >> dstMip);
486 
487     GX2UTDebugTagIndent(__func__);
488 
489     // Disable state shadowing.  If your app is using state shadowing,
490     // you will need to restore the context after calling this function.
491     GX2SetContextState(NULL);
492 
493     // Setup all of the constant render state needed for the copy.
494     GX2UTSetCopyState(GX2_ENABLE);
495 
496     GX2UTCopySurfaceRectOp(srcSurface, srcMip, srcSlice, &srcRect,
497                          dstSurface, dstMip, dstSlice, &dstRect,
498                          NULL, 0);
499 
500     // Disable special hardware state and set state back to GX2 default
501     GX2UTSetCopyState(GX2_DISABLE);
502 
503     GX2UTDebugTagUndent();
504 }
505 
506 /// \brief Copy the specified source surface to the dest surface.
507 ///
508 /// \deprecated This API has been deprecated and may not be available in future
509 ///             releases. Please use \ref GX2UTCopySurface instead.
510 ///
511 /// \param srcSurface  Pointer to source surface structure
512 /// \param srcMip      Mip level of surface to read (0 typically)
513 /// \param srcSlice    Slice to read for array & 3D (0 typically)
514 /// \param dstSurface  Pointer to destination surface structure
515 /// \param dstMip      Mip level of dest surface to write (0 typically)
516 /// \param dstSlice    Slice to write for array & 3D (0 typically)
517 ///
518 /// This function mimics the behavior of GX2 and is intended to be an optimized
519 /// replacement for \ref GX2CopySurface.
520 ///
521 /// \note It is not necessary to call \ref GX2Invalidate on the
522 ///        source/destination buffers. This is done internally.
523 ///
524 /// \warning Better performing alternatives exist. Please see
525 ///          \ref GX2UTAdvancedGX2ReplacementAPISect.
526 ///
527 /// \clobberstate
528 /// \disablesstateshadow
529 ///
530 /// \donotcall \gx2_typical \enddonotcall
531 ///
532 /// \writesgpu
533 /// \alwayswritesgpu
534 ///
GX2UTSetAndCopySurface(const GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice)535 GX2_INLINE void GX2UTSetAndCopySurface(
536     const GX2Surface *srcSurface, u32 srcMip, u32 srcSlice,
537     GX2Surface *dstSurface, u32 dstMip, u32 dstSlice)
538 {
539     GX2UTDebugTagIndent(__func__);
540 
541     //Setup parameter specific render state and copy.
542     GX2UTCopySurface(srcSurface, srcMip, srcSlice,
543                      dstSurface, dstMip, dstSlice);
544 
545     GX2UTDebugTagUndent();
546 }
547 
548 /// @}
549 
550 #ifdef __cplusplus
551 }
552 #endif // __cplusplus
553 
554 #endif // _GX2UTCOPY_H_
555