diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-03-27 14:22:34 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-27 13:22:34 -0400 |
| commit | c4773301a17a5a9f9c964a3e7ba6dfbf0730a94b (patch) | |
| tree | 282856f2cf271ef600249cc06901b3c37d6325c9 /lib | |
| parent | 769b045ba4990729e025d4ba16135a7a22d5944e (diff) | |
Update libgfxd and convert it into a subrepo (#103)
* remove libgfxd
Signed-off-by: angie <angheloalf95@gmail.com>
* git subrepo clone https://github.com/glankk/libgfxd.git lib/libgfxd/
subrepo:
subdir: "lib/libgfxd"
merged: "2f00ff7"
upstream:
origin: "https://github.com/glankk/libgfxd.git"
branch: "master"
commit: "2f00ff7"
git-subrepo:
version: "0.4.3"
origin: "???"
commit: "???"
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libgfxd/.gitrepo | 12 | ||||
| -rw-r--r-- | lib/libgfxd/gbi.h | 30 | ||||
| -rw-r--r-- | lib/libgfxd/uc_macrofn.c | 17 |
3 files changed, 43 insertions, 16 deletions
diff --git a/lib/libgfxd/.gitrepo b/lib/libgfxd/.gitrepo new file mode 100644 index 0000000..59040be --- /dev/null +++ b/lib/libgfxd/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/glankk/libgfxd.git + branch = master + commit = 2f00ff7dff14ae44c12ed421be54b9fec815541b + parent = a43a526c4296d7dc48852f6017fe069724465494 + method = merge + cmdver = 0.4.3 diff --git a/lib/libgfxd/gbi.h b/lib/libgfxd/gbi.h index e502ee9..72df358 100644 --- a/lib/libgfxd/gbi.h +++ b/lib/libgfxd/gbi.h @@ -1,5 +1,5 @@ /** - * gbi.h version 0.3.3 + * gbi.h version 0.3.4 * n64 graphics microcode interface library * compatible with fast3d, f3dex, f3dex2, s2dex, and s2dex2 * @@ -201,6 +201,10 @@ #define G_TX_LOADTILE 7 #define G_TX_RENDERTILE 0 +/* loadblock constants */ +#define G_TX_DXT_FRAC 11 +#define G_TX_LDBLK_MAX_TXL 2047 + /* geometry mode */ #define G_ZBUFFER (gI_(0b1) << 0) #define G_SHADE (gI_(0b1) << 2) @@ -1813,8 +1817,7 @@ gsDPLoadSync(), \ gsDPLoadBlock( \ G_TX_LOADTILE, 0, 0, \ - (((width) * (height) + 1) * G_SIZ_BITS(siz) - 1) / \ - G_SIZ_BITS(G_SIZ_LDSIZ(siz)) - 1, \ + G_LTB_LRS(width, height, siz), \ dxt), \ gsDPPipeSync(), \ gsDPSetTile( \ @@ -2112,7 +2115,7 @@ gF_(uls, 12, 12) | \ gF_(ult, 12, 0), \ gF_(tile, 3, 24) | \ - gF_(lrs, 12, 12) | \ + gF_(G_LDBLK_TXL(lrs), 12, 12) | \ gF_(dxt, 12, 0)) #define gsDPNoOp() \ @@ -3719,10 +3722,21 @@ typedef struct #define G_SIZ_LDBITS(siz) ((siz) < G_IM_SIZ_16b ? G_SIZ_BITS(siz) : 16) #define G_DXT(siz, width) \ ( \ - (width) * G_SIZ_BITS(siz) <= 64 ? \ - (1 << 11) : \ - ((1 << 11) + (width) * G_SIZ_BITS(siz) / 64 - 1) / \ - ((width) * G_SIZ_BITS(siz) / 64) \ + (width) * G_SIZ_BITS(siz) > 64 ? \ + ((1 << 11) + (width) * G_SIZ_BITS(siz) / 64 - 1) / \ + ((width) * G_SIZ_BITS(siz) / 64) : \ + (1 << 11) \ + ) +#define G_LTB_LRS(width, height, siz) \ + ( \ + (((width) * (height) + 1) * G_SIZ_BITS(siz) - 1) / \ + G_SIZ_BITS(G_SIZ_LDSIZ(siz)) - 1 \ + ) +#define G_LDBLK_TXL(txl) \ + ( \ + (txl) > G_TX_LDBLK_MAX_TXL ? \ + G_TX_LDBLK_MAX_TXL : \ + (txl) \ ) /* depth value macros */ diff --git a/lib/libgfxd/uc_macrofn.c b/lib/libgfxd/uc_macrofn.c index 707c0cb..7baeb70 100644 --- a/lib/libgfxd/uc_macrofn.c +++ b/lib/libgfxd/uc_macrofn.c @@ -274,15 +274,10 @@ UCFUNC int c_ltb(gfxd_macro_t *m, int n_macro, int id, int mdxt, int mtmem, } int width = (argvu(&m[6], 3) >> 2) + 1; int height = (argvu(&m[6], 4) >> 2) + 1; - unsigned lrs = ((width * height + 1) * G_SIZ_BITS(siz) - 1) / - G_SIZ_BITS(G_SIZ_LDSIZ(siz)) - 1; + unsigned lrs = G_LDBLK_TXL(G_LTB_LRS(width, height, siz)); unsigned dxt = 0; if (!mdxt) - { - dxt = (width * G_SIZ_BITS(siz) <= 64 ? (1 << 11) : - ((1 << 11) + width * G_SIZ_BITS(siz) / 64 - 1) / - (width * G_SIZ_BITS(siz) / 64)); - } + dxt = G_DXT(siz, width); int line; if (myuv) line = (width + 7) / 8; @@ -592,7 +587,13 @@ UCFUNC int d_DPLoadBlock(gfxd_macro_t *m, uint32_t hi, uint32_t lo) argu(m, 2, "ult", getfield(hi, 12, 0), gfxd_Coordi); argu(m, 3, "lrs", getfield(lo, 12, 12), gfxd_Coordi); argu(m, 4, "dxt", getfield(lo, 12, 0), gfxd_Dxt); - return 0; + if (argvu(m, 3) > G_TX_LDBLK_MAX_TXL) { + badarg(m, 3); + return -1; + } + else { + return 0; + } } UCFUNC int d_DPNoOp(gfxd_macro_t *m, uint32_t hi, uint32_t lo) |
