mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-05 10:47:27 -04:00
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
#ifndef DUSK_GX_HELPER_H
|
|
#define DUSK_GX_HELPER_H
|
|
|
|
#include <cstring>
|
|
|
|
#include <dolphin/gx/GXAurora.h>
|
|
#include <dolphin/gx/GXExtra.h>
|
|
#include "tracy/Tracy.hpp"
|
|
|
|
#define GX_DEBUG_GROUP(name, ...) \
|
|
do { \
|
|
GXPushDebugGroup(#name); \
|
|
name(__VA_ARGS__); \
|
|
GXPopDebugGroup(); \
|
|
} while (0)
|
|
|
|
#ifdef TARGET_PC
|
|
class GXTexObjRAII : public GXTexObj {
|
|
public:
|
|
GXTexObjRAII() : GXTexObj() {}
|
|
~GXTexObjRAII() { GXDestroyTexObj(this); }
|
|
|
|
void reset() { GXDestroyTexObj(this); }
|
|
|
|
GXTexObjRAII(const GXTexObjRAII&) = delete;
|
|
GXTexObjRAII& operator=(const GXTexObjRAII&) = delete;
|
|
GXTexObjRAII(GXTexObjRAII&& o) = delete;/*noexcept : GXTexObj(o) {
|
|
std::memset(static_cast<GXTexObj*>(&o), 0, sizeof(GXTexObj));
|
|
}*/
|
|
GXTexObjRAII& operator=(GXTexObjRAII&& o) = delete;/*noexcept {
|
|
if (this != &o) {
|
|
GXDestroyTexObj(this);
|
|
std::memcpy(static_cast<GXTexObj*>(this), &o, sizeof(GXTexObj));
|
|
std::memset(static_cast<GXTexObj*>(&o), 0, sizeof(GXTexObj));
|
|
}
|
|
return *this;
|
|
}*/
|
|
};
|
|
static_assert(sizeof(GXTexObjRAII) == sizeof(GXTexObj),
|
|
"GXTexObjRAII should have the same size as GXTexObj");
|
|
typedef GXTexObjRAII TGXTexObj;
|
|
#else
|
|
typedef GXTexObj TGXTexObj;
|
|
#endif
|
|
|
|
struct GXScopedDebugGroup {
|
|
explicit GXScopedDebugGroup(const char* text) {
|
|
GXPushDebugGroup(text);
|
|
}
|
|
~GXScopedDebugGroup() {
|
|
GXPopDebugGroup();
|
|
}
|
|
};
|
|
|
|
#define GX_AND_TRACY_SCOPED(name) GXScopedDebugGroup scope(name); ZoneScopedN(name);
|
|
|
|
#endif // DUSK_GX_HELPER_H
|