mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-16 13:02:33 +00:00
More performance improvements
This commit is contained in:
parent
e16efd7dd6
commit
ba544d6e35
3 changed files with 21 additions and 43 deletions
|
|
@ -291,44 +291,20 @@ public:
|
||||||
inline bool Empty() const { return mCount == 0; }
|
inline bool Empty() const { return mCount == 0; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool operator==(const char *aString) const {
|
bool OPTIMIZE_O3 operator==(const char *aString) const {
|
||||||
if (strlen(aString) != mCount) return false;
|
return !strcmp(mBuffer, aString);
|
||||||
for (u8 i = 0; i != mCount; ++i) {
|
|
||||||
if (aString[i] != mBuffer[i]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const String &aOther) const {
|
bool OPTIMIZE_O3 operator==(const String &aOther) const {
|
||||||
if (aOther.mCount != mCount) return false;
|
return !strcmp(mBuffer, aOther.mBuffer);
|
||||||
for (u8 i = 0; i != mCount; ++i) {
|
|
||||||
if (aOther.mBuffer[i] != mBuffer[i]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const char *aString) const {
|
bool OPTIMIZE_O3 operator!=(const char *aString) const {
|
||||||
if (strlen(aString) != mCount) return true;
|
return strcmp(mBuffer, aString);
|
||||||
for (u8 i = 0; i != mCount; ++i) {
|
|
||||||
if (aString[i] != mBuffer[i]) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const String &aOther) const {
|
bool OPTIMIZE_O3 operator!=(const String &aOther) const {
|
||||||
if (aOther.mCount != mCount) return true;
|
return strcmp(mBuffer, aOther.mBuffer);
|
||||||
for (u8 i = 0; i != mCount; ++i) {
|
|
||||||
if (aOther.mBuffer[i] != mBuffer[i]) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -12,18 +12,20 @@ static Vtx djui_font_normal_vertices[] = {
|
||||||
{{{ 0, 0, 0}, 0, { 512, 256}, { 0xff, 0xff, 0xff, 0xff }}},
|
{{{ 0, 0, 0}, 0, { 512, 256}, { 0xff, 0xff, 0xff, 0xff }}},
|
||||||
};
|
};
|
||||||
|
|
||||||
const Gfx dl_font_normal_display_list[] = {
|
const Gfx dl_font_normal_display_list_begin[] = {
|
||||||
gsDPPipeSync(),
|
gsDPPipeSync(),
|
||||||
gsSPClearGeometryMode(G_LIGHTING),
|
gsSPClearGeometryMode(G_LIGHTING),
|
||||||
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
|
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
|
||||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||||
gsDPSetTextureFilter(G_TF_POINT),
|
gsDPSetTextureFilter(G_TF_POINT),
|
||||||
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
||||||
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD),
|
|
||||||
gsDPLoadSync(),
|
|
||||||
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)),
|
|
||||||
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD),
|
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD),
|
||||||
gsDPSetTileSize(0, 0, 0, (16 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC),
|
gsDPSetTileSize(0, 0, 0, (16 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC),
|
||||||
|
gsSPEndDisplayList(),
|
||||||
|
};
|
||||||
|
|
||||||
|
const Gfx dl_font_normal_display_list[] = {
|
||||||
|
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)),
|
||||||
gsSPVertex(djui_font_normal_vertices, 4, 0),
|
gsSPVertex(djui_font_normal_vertices, 4, 0),
|
||||||
gsSPExecuteDjui(G_TEXCLIP_DJUI),
|
gsSPExecuteDjui(G_TEXCLIP_DJUI),
|
||||||
gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0),
|
gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0),
|
||||||
|
|
@ -54,7 +56,7 @@ static const struct DjuiFont sDjuiFontNormal = {
|
||||||
.lineHeight = 0.8125f,
|
.lineHeight = 0.8125f,
|
||||||
.defaultFontScale = 32.0f,
|
.defaultFontScale = 32.0f,
|
||||||
.rotatedUV = true,
|
.rotatedUV = true,
|
||||||
.textBeginDisplayList = NULL,
|
.textBeginDisplayList = dl_font_normal_display_list_begin,
|
||||||
.render_char = djui_font_normal_render_char,
|
.render_char = djui_font_normal_render_char,
|
||||||
.char_width = djui_font_normal_char_width,
|
.char_width = djui_font_normal_char_width,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1866,7 +1866,7 @@ static uint32_t sDjuiOverrideW = 0;
|
||||||
static uint32_t sDjuiOverrideH = 0;
|
static uint32_t sDjuiOverrideH = 0;
|
||||||
static uint32_t sDjuiOverrideB = 0;
|
static uint32_t sDjuiOverrideB = 0;
|
||||||
|
|
||||||
static void djui_gfx_dp_execute_clipping(void) {
|
static void OPTIMIZE_O3 djui_gfx_dp_execute_clipping(void) {
|
||||||
if (!sDjuiClip) { return; }
|
if (!sDjuiClip) { return; }
|
||||||
sDjuiClip = false;
|
sDjuiClip = false;
|
||||||
|
|
||||||
|
|
@ -1941,7 +1941,7 @@ static void djui_gfx_dp_execute_clipping(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void djui_gfx_dp_execute_override(void) {
|
static void OPTIMIZE_O3 djui_gfx_dp_execute_override(void) {
|
||||||
if (!sDjuiOverride) { return; }
|
if (!sDjuiOverride) { return; }
|
||||||
sDjuiOverride = false;
|
sDjuiOverride = false;
|
||||||
|
|
||||||
|
|
@ -1974,14 +1974,14 @@ static void djui_gfx_dp_execute_override(void) {
|
||||||
rdp.textures_changed[1] = true;
|
rdp.textures_changed[1] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void djui_gfx_dp_execute_djui(uint32_t opcode) {
|
static void OPTIMIZE_O3 djui_gfx_dp_execute_djui(uint32_t opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case G_TEXOVERRIDE_DJUI: djui_gfx_dp_execute_override(); break;
|
case G_TEXOVERRIDE_DJUI: djui_gfx_dp_execute_override(); break;
|
||||||
case G_TEXCLIP_DJUI: djui_gfx_dp_execute_clipping(); break;
|
case G_TEXCLIP_DJUI: djui_gfx_dp_execute_clipping(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) {
|
static void OPTIMIZE_O3 djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) {
|
||||||
sDjuiClipRotatedUV = rotatedUV;
|
sDjuiClipRotatedUV = rotatedUV;
|
||||||
sDjuiClipX1 = x1;
|
sDjuiClipX1 = x1;
|
||||||
sDjuiClipY1 = y1;
|
sDjuiClipY1 = y1;
|
||||||
|
|
@ -1990,7 +1990,7 @@ static void djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, u
|
||||||
sDjuiClip = true;
|
sDjuiClip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void djui_gfx_dp_set_override(void* texture, uint32_t w, uint32_t h, uint32_t b) {
|
static void OPTIMIZE_O3 djui_gfx_dp_set_override(void* texture, uint32_t w, uint32_t h, uint32_t b) {
|
||||||
sDjuiOverrideTexture = texture;
|
sDjuiOverrideTexture = texture;
|
||||||
sDjuiOverrideW = w;
|
sDjuiOverrideW = w;
|
||||||
sDjuiOverrideH = h;
|
sDjuiOverrideH = h;
|
||||||
|
|
@ -1998,7 +1998,7 @@ static void djui_gfx_dp_set_override(void* texture, uint32_t w, uint32_t h, uint
|
||||||
sDjuiOverride = (texture != NULL);
|
sDjuiOverride = (texture != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_run_dl(Gfx* cmd) {
|
void OPTIMIZE_O3 djui_gfx_run_dl(Gfx* cmd) {
|
||||||
uint32_t opcode = cmd->words.w0 >> 24;
|
uint32_t opcode = cmd->words.w0 >> 24;
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case G_TEXCLIP_DJUI:
|
case G_TEXCLIP_DJUI:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue