[nostalgia/core/userland] Cleanup shader cleanup with unique_ptr-like GLobject type

This commit is contained in:
2021-03-20 15:31:13 -05:00
parent 896a7a0a96
commit 47a43fecb1
3 changed files with 64 additions and 22 deletions
+2 -4
View File
@@ -38,7 +38,7 @@ struct Background: public Bufferset {
};
struct GlImplData {
GLuint bgShader = 0;
Program bgShader;
int64_t prevFpsCheckTime = 0;
uint64_t draws = 0;
std::array<Background, 4> backgrounds;
@@ -191,7 +191,7 @@ static void drawBackgrounds(GlImplData *id) {
ox::Error init(Context *ctx) {
const auto id = new GlImplData;
ctx->setRendererData(id);
oxReturnError(buildShaderProgram(bgvshad, bgfshad).get(&id->bgShader));
oxReturnError(buildShaderProgram(bgvshad, bgfshad).moveTo(&id->bgShader));
for (auto &bg : id->backgrounds) {
initBackgroundBufferset(ctx, id->bgShader, &bg);
}
@@ -200,8 +200,6 @@ ox::Error init(Context *ctx) {
ox::Error shutdown(Context *ctx) {
const auto id = ctx->rendererData<GlImplData>();
glDeleteProgram(id->bgShader);
id->bgShader = 0;
for (auto &bg : id->backgrounds) {
destroy(bg);
}