renderer: decouple models and sprite_batch init/shutdown from main render system
This commit is contained in:
parent
2fdf9baf36
commit
50056eb41a
8 changed files with 34 additions and 20 deletions
|
@ -20,6 +20,8 @@
|
|||
#include "menu/mainmenu.h"
|
||||
#include "menu/savereplay.h"
|
||||
#include "progress.h"
|
||||
#include "renderer/common/models.h"
|
||||
#include "renderer/common/sprite_batch.h"
|
||||
#include "replay/demoplayer.h"
|
||||
#include "replay/struct.h"
|
||||
#include "replay/tsrtool.h"
|
||||
|
@ -67,6 +69,8 @@ static void taisei_shutdown(void) {
|
|||
gamemode_shutdown();
|
||||
taskmgr_global_shutdown();
|
||||
audio_shutdown();
|
||||
r_models_shutdown();
|
||||
r_sprite_batch_shutdown();
|
||||
video_shutdown();
|
||||
gamepad_shutdown();
|
||||
stageinfo_shutdown();
|
||||
|
@ -409,6 +413,8 @@ static void main_post_vfsinit(CallChainResult ccr) {
|
|||
});
|
||||
filewatch_init();
|
||||
res_init();
|
||||
r_models_init();
|
||||
r_sprite_batch_init();
|
||||
r_post_init();
|
||||
|
||||
res_group_init(&ctx->rg);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
#include "common/backend.h"
|
||||
#include "common/matstack.h"
|
||||
#include "common/models.h"
|
||||
#include "common/sprite_batch.h"
|
||||
#include "common/sprite_batch_internal.h"
|
||||
#include "common/state.h"
|
||||
#include "coroutine/coroutine.h"
|
||||
#include "resource/resource.h"
|
||||
|
@ -36,8 +35,6 @@ void r_init(void) {
|
|||
|
||||
void r_post_init(void) {
|
||||
B.post_init();
|
||||
_r_models_init();
|
||||
_r_sprite_batch_init();
|
||||
|
||||
res_group_init(&R.rg);
|
||||
|
||||
|
@ -76,8 +73,6 @@ void r_release_resources(void) {
|
|||
|
||||
void r_shutdown(void) {
|
||||
_r_state_shutdown();
|
||||
_r_sprite_batch_shutdown();
|
||||
_r_models_shutdown();
|
||||
B.shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ static struct {
|
|||
Model quad;
|
||||
} _r_models;
|
||||
|
||||
void _r_models_init(void) {
|
||||
void r_models_init(void) {
|
||||
VertexAttribSpec spec[] = {
|
||||
{ 3, VA_FLOAT, VA_CONVERT_FLOAT }, // position
|
||||
{ 2, VA_FLOAT, VA_CONVERT_FLOAT }, // texcoord
|
||||
|
@ -54,7 +54,7 @@ void _r_models_init(void) {
|
|||
r_model_add_static(&_r_models.quad, PRIM_TRIANGLE_STRIP, 4, quad, 0, NULL);
|
||||
}
|
||||
|
||||
void _r_models_shutdown(void) {
|
||||
void r_models_shutdown(void) {
|
||||
r_vertex_array_destroy(_r_models.varr);
|
||||
r_vertex_buffer_destroy(_r_models.vbuf);
|
||||
r_index_buffer_destroy(_r_models.ibuf);
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
void _r_models_init(void);
|
||||
void _r_models_shutdown(void);
|
||||
void r_models_init(void);
|
||||
void r_models_shutdown(void);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) 2012-2024, Andrei Alexeyev <akari@taisei-project.org>.
|
||||
*/
|
||||
|
||||
#include "sprite_batch.h"
|
||||
#include "sprite_batch_internal.h"
|
||||
|
||||
#include "../api.h"
|
||||
#include "util/glm.h"
|
||||
|
@ -54,7 +54,7 @@ static struct SpriteBatchState {
|
|||
#endif
|
||||
} _r_sprite_batch;
|
||||
|
||||
void _r_sprite_batch_init(void) {
|
||||
void r_sprite_batch_init(void) {
|
||||
#if SPRITE_BATCH_STATS
|
||||
preload_resource(RES_FONT, "monotiny", RESF_PERMANENT);
|
||||
#endif
|
||||
|
@ -111,7 +111,7 @@ void _r_sprite_batch_init(void) {
|
|||
_r_sprite_batch.renderer_features = r_features();
|
||||
}
|
||||
|
||||
void _r_sprite_batch_shutdown(void) {
|
||||
void r_sprite_batch_shutdown(void) {
|
||||
r_vertex_array_destroy(_r_sprite_batch.varr);
|
||||
r_vertex_buffer_destroy(_r_sprite_batch.vbuf);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,5 @@
|
|||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "../api.h"
|
||||
|
||||
void _r_sprite_batch_init(void);
|
||||
void _r_sprite_batch_shutdown(void);
|
||||
void _r_sprite_batch_end_frame(void);
|
||||
void _r_sprite_batch_texture_deleted(Texture *tex);
|
||||
void r_sprite_batch_init(void);
|
||||
void r_sprite_batch_shutdown(void);
|
||||
|
|
17
src/renderer/common/sprite_batch_internal.h
Normal file
17
src/renderer/common/sprite_batch_internal.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT License.
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2024, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2024, Andrei Alexeyev <akari@taisei-project.org>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "sprite_batch.h" // IWYU pragma: export
|
||||
|
||||
#include "../api.h"
|
||||
|
||||
void _r_sprite_batch_end_frame(void);
|
||||
void _r_sprite_batch_texture_deleted(Texture *tex);
|
|
@ -11,7 +11,7 @@
|
|||
#include "../api.h"
|
||||
#include "../common/backend.h"
|
||||
#include "../common/matstack.h"
|
||||
#include "../common/sprite_batch.h"
|
||||
#include "../common/sprite_batch_internal.h"
|
||||
#include "../glcommon/debug.h"
|
||||
#include "../glcommon/vtable.h"
|
||||
#include "common_buffer.h"
|
||||
|
|
Loading…
Reference in a new issue