Merge pull request #317 from TwilitRealm/26-04-11-render-opts

UI render opts
This commit is contained in:
TakaRikka
2026-04-11 13:06:22 -07:00
committed by GitHub
11 changed files with 56 additions and 6 deletions
+3
View File
@@ -5,6 +5,7 @@
#include <dolphin/gx/GXAurora.h>
#include <dolphin/gx/GXExtra.h>
#include "tracy/Tracy.hpp"
#define GX_DEBUG_GROUP(name, ...) \
do { \
@@ -51,4 +52,6 @@ struct GXScopedDebugGroup {
}
};
#define GX_AND_TRACY_SCOPED(name) GXScopedDebugGroup scope(name); ZoneScopedN(name);
#endif // DUSK_GX_HELPER_H
+2
View File
@@ -511,6 +511,7 @@ void J2DPicture::drawSelf(f32 param_0, f32 param_1) {
}
void J2DPicture::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
GX_AND_TRACY_SCOPED("J2DPicture::drawSelf")
if (mTexture[0] != NULL && mTextureNum != 0) {
drawFullSet(mGlobalBounds.i.x + param_0, mGlobalBounds.i.y + param_1,
getWidth(), getHeight(), param_2);
@@ -527,6 +528,7 @@ void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
void J2DPicture::draw(f32 x, f32 y, f32 width, f32 height, bool mirrorX, bool mirrorY,
bool rotate90) {
GX_AND_TRACY_SCOPED("J2DPicture::draw")
if (isVisible() && mTextureNum != 0 && mTexture[0] != NULL) {
f32 x2 = x + width;
f32 y2 = y + height;
@@ -78,8 +78,21 @@ bool J2DPictureEx::prepareTexture(u8 param_0) {
return true;
}
#if TARGET_PC
bool checkAlphaCull(const J2DPictureEx* pic) {
return pic->mColorAlpha == 0;
}
#endif
void J2DPictureEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) {
GX_AND_TRACY_SCOPED("J2DPictureEx::drawSelf")
if (mMaterial != NULL) {
#if TARGET_PC
if (checkAlphaCull(this)) {
return;
}
#endif
mMaterial->setGX();
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
+2
View File
@@ -278,6 +278,8 @@ J2DPane* J2DScreen::searchUserInfo(u64 tag) {
}
void J2DScreen::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
GX_AND_TRACY_SCOPED("J2DScreen::drawSelf")
JUtility::TColor color(mColor);
u8 alpha = (color.a * mAlpha) / 255;
+2
View File
@@ -391,6 +391,8 @@ void J2DTextBox::drawSelf(f32 param_0, f32 param_1) {
}
void J2DTextBox::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) {
GX_AND_TRACY_SCOPED("J2DTextBox::drawSelf")
Mtx m;
J2DPrint print(mFont, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor,
@@ -93,6 +93,7 @@ J2DTextBoxEx::~J2DTextBoxEx() {
}
void J2DTextBoxEx::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) {
GX_AND_TRACY_SCOPED("J2DTextBoxEx::drawSelf")
Mtx m;
JUTFont* font = NULL;
+2
View File
@@ -410,6 +410,8 @@ void J2DWindow::drawSelf(f32 param_0, f32 param_1) {
}
void J2DWindow::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
GX_AND_TRACY_SCOPED("J2DWindow::drawSelf")
JGeometry::TBox2<f32> stack_50(mBounds);
stack_50.addPos(JGeometry::TVec2<f32>(param_0, param_1));
if (stack_50.getWidth() >= field_0x140 && stack_50.getHeight() >= field_0x142) {
@@ -122,6 +122,7 @@ J2DWindowEx::~J2DWindowEx() {
}
void J2DWindowEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) {
GX_AND_TRACY_SCOPED("J2DWindowEx::drawSelf")
JGeometry::TBox2<f32> aTStack_50(mBounds);
Mtx auStack_40;
aTStack_50.addPos(JGeometry::TVec2<f32>(param_0, param_1));
+2 -2
View File
@@ -435,10 +435,10 @@ void JUTResFont::loadImage(int code, GXTexMapID id){
mHeight = cellRow * cellH;
#if TARGET_PC
const auto found = mGlyphTextures->textures.find(code);
const auto found = mGlyphTextures->textures.find(pageIdx);
GXTexObj* texObj;
if (found == mGlyphTextures->textures.end()) {
texObj = &mGlyphTextures->textures[code];
texObj = &mGlyphTextures->textures[pageIdx];
void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize];
GXInitTexObj(texObj, pImg, mpGlyphBlocks[i]->textureWidth,
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)(u16)mpGlyphBlocks[i]->textureFormat,
+27 -4
View File
@@ -10,6 +10,11 @@
#include "SSystem/SComponent/c_math.h"
#include "d/d_com_inf_game.h"
#include "d/d_drawlist.h"
#include <typeindex>
#include "absl/container/flat_hash_map.h"
#include "client/TracyScoped.hpp"
#include "d/d_s_play.h"
#include "dusk/frame_interpolation.h"
#include "dusk/gx_helper.h"
@@ -1923,14 +1928,32 @@ int dDlst_list_c::set(dDlst_base_c**& p_start, dDlst_base_c**& p_end, dDlst_base
return 1;
}
#if TARGET_PC && (TRACY_ENABLE || PARTIAL_DEBUG)
static absl::flat_hash_map<std::type_index, const char*> typeDrawNames;
static const char* getTypeDrawName(dDlst_base_c* dlst) {
const auto& info = typeid(*dlst);
auto& elem = typeDrawNames[info];
if (elem) [[likely]] {
return elem;
}
const auto size = snprintf(nullptr, 0, "%s::draw()", info.name());
// Note: pointer is intentionally never freed, Tracy needs it.
const auto buf = static_cast<char*>(malloc(size+1));
snprintf(buf, size+1, "%s::draw()", info.name());
elem = buf;
return buf;
}
#endif
void dDlst_list_c::draw(dDlst_base_c** p_start, dDlst_base_c** p_end) {
for (; p_start < p_end; p_start++) {
dDlst_base_c* dlst = *p_start;
#if DEBUG && TARGET_PC
char buf[64];
snprintf(buf, sizeof(buf), "%s::draw()", typeid(dlst).name());
GXScopedDebugGroup scope(buf);
#if TARGET_PC && (TRACY_ENABLE || PARTIAL_DEBUG)
const auto name = getTypeDrawName(dlst);
GXScopedDebugGroup scope(name);
#endif
dlst->draw();
}
+1
View File
@@ -1562,6 +1562,7 @@ void dMeter2Draw_c::setAlphaLifeAnimeMax() {
}
void dMeter2Draw_c::drawKanteraScreen(u8 i_meterType) {
GX_AND_TRACY_SCOPED("drawKanteraScreen");
J2DGrafContext* graf_ctx = dComIfGp_getCurrentGrafPort();
mpMagicParent->setAlphaRate(mMeterAlphaRate[i_meterType]);