Skip to content

Commit 3dc663e

Browse files
committed
Allow using frame-to-field for texture copies
1 parent 7893252 commit 3dc663e

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

include/ogc/gx.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,8 @@
987987
* @{
988988
*/
989989
#define GX_COPY_PROGRESSIVE 0
990-
#define GX_COPY_NONE 1
990+
#define GX_COPY_MIPMAP 1 /*!< Only for texture copies. */
991+
#define GX_COPY_NONE 1 /*!< Only for display copies. */
991992
#define GX_COPY_INTLC_EVEN 2
992993
#define GX_COPY_INTLC_ODD 3
993994
#define GX_COPY_INTERLACED 3 /*!< XOR with VIDEO_GetNextField(). */
@@ -3755,9 +3756,7 @@ void GX_SetCopyFilter(u8 aa,const u8 sample_pattern[12][2],u8 vf,const u8 vfilte
37553756
*
37563757
* \details Specifically, it determines whether all lines, no lines, only even lines, or only odd lines are read.
37573758
*
3758-
* \note The opposite function, which determines whether all lines, only even lines or only odd lines are <i>written</i> to the EFB, is GX_SetFieldMask().<br><br>
3759-
*
3760-
* \note Only applies to display copies, GX_CopyTex() always uses the <tt>GX_COPY_PROGRESSIVE</tt> mode.
3759+
* \note The opposite function, which determines whether all lines, no lines, only even lines, or only odd lines are <i>written</i> to the EFB, is GX_SetFieldMask().<br><br>
37613760
*
37623761
* \param[in] mode \ref copymode to determine which field to copy (or both)
37633762
*
@@ -3813,13 +3812,13 @@ void GX_CopyDisp(void *dest,u8 clear);
38133812
void GX_SetTexCopySrc(u16 left,u16 top,u16 wd,u16 ht);
38143813

38153814
/*!
3816-
* \fn void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mipmap)
3815+
* \fn void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mode)
38173816
* \brief This function sets the width and height of the destination texture buffer in texels.
38183817
*
38193818
* \details This function sets the width (\a wd) and height (\a ht) of the destination texture buffer in texels. The application may render an image into
38203819
* the EFB and then copy it into a texture buffer in main memory. \a wd specifies the number of texels between adjacent lines in the texture buffer and can
38213820
* be different than the width of the source image. This function also sets the texture format (\a fmt) to be created during the copy operation. An
3822-
* optional box filter can be enabled using \a mipmap. This flag will scale the source image by 1/2.
3821+
* optional box filter can be enabled by setting \a mode to <tt>GX_COPY_MIPMAP</tt>. This flag will scale the source image by 1/2.
38233822
*
38243823
* Normally, the width of the EFB and destination \a wd are the same. When rendering smaller images that get copied and composited into a larger texture
38253824
* buffer, however, the EFB width and texture buffer \a wd are not necessarily the same.
@@ -3832,11 +3831,11 @@ void GX_SetTexCopySrc(u16 left,u16 top,u16 wd,u16 ht);
38323831
* \param[in] wd distance between successive lines in the texture buffer, in texels; must be a multiple of the texture tile width, which depends on \a fmt.
38333832
* \param[in] ht height of the texture buffer
38343833
* \param[in] fmt \ref texfmt
3835-
* \param[in] mipmap flag that indicates framebuffer should be cleared if <tt>GX_TRUE</tt>.
3834+
* \param[in] mode \ref copymode to determine which field to copy (or both)
38363835
*
38373836
* \return none
38383837
*/
3839-
void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mipmap);
3838+
void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mode);
38403839

38413840
/*!
38423841
* \fn void GX_CopyTex(void *dest,u8 clear)

libogc/gx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ void GX_SetTexCopySrc(u16 left,u16 top,u16 wd,u16 ht)
20662066
__gx->texCopyWH = (__gx->texCopyWH&~0xff000000)|(_SHIFTL(0x4a,24,8));
20672067
}
20682068

2069-
void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mipmap)
2069+
void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mode)
20702070
{
20712071
u8 lfmt = fmt&0xf;
20722072
u32 xtiles,ytiles,zplanes;
@@ -2079,7 +2079,8 @@ void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mipmap)
20792079
else __gx->texCopyCntrl = (__gx->texCopyCntrl&~0x18000)|0x10000;
20802080

20812081
__gx->texCopyCntrl = (__gx->texCopyCntrl&~0x8)|(lfmt&0x8);
2082-
__gx->texCopyCntrl = (__gx->texCopyCntrl&~0x200)|(_SHIFTL(mipmap,9,1));
2082+
__gx->texCopyCntrl = (__gx->texCopyCntrl&~0x3000)|(_SHIFTL(mode,12,2));
2083+
__gx->texCopyCntrl = (__gx->texCopyCntrl&~0x200)|(_SHIFTL((mode==GX_COPY_MIPMAP),9,1));
20832084
__gx->texCopyCntrl = (__gx->texCopyCntrl&~0x70)|(_SHIFTL(lfmt,4,3));
20842085

20852086
__gx->texCopyDst = (__gx->texCopyDst&~0xff000000)|(_SHIFTL(0x4d,24,8));

0 commit comments

Comments
 (0)