PSP: Use fast clear

This commit is contained in:
UnknownShadow200 2024-06-26 21:15:48 +10:00
parent 79a996d6cd
commit feb3aa9c8c
5 changed files with 46 additions and 12 deletions

View file

@ -1,6 +1,12 @@
TARGET = ClassiCube-psp
SOURCES = $(wildcard src/*.c) $(wildcard third_party/bearssl/src/*.c)
OBJS = $(patsubst %.c, %.o, $(SOURCES))
PSP_EBOOT_TITLE = ClassiCube
PSP_EBOOT_ICON = misc/psp/ICON0.png
BUILD_DIR := build-psp
SOURCE_DIRS := src third_party/bearssl/src
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
INCDIR = third_party/bearssl/inc
CFLAGS = -g -O1 -fno-math-errno
@ -10,11 +16,12 @@ LIBDIR =
LDFLAGS =
LIBS = -lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl
BUILD_PRX = 1
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(OBJS:%.o=%.d)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = ClassiCube
PSP_EBOOT_ICON = misc/psp/ICON0.png
BUILD_PRX = 1
EXTRA_TARGETS = $(BUILD_DIR) EBOOT.PBP
ifeq ($(strip $(PSPSDK)),)
$(warning "Please set PSPSDK variables in your environment. For example:")
@ -26,3 +33,21 @@ $(error Failed to find PSPSDK installation)
endif
include $(PSPSDK)/lib/build.mak
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o : third_party/bearssl/src/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Dependency tracking
$(DEPFILES):
include $(wildcard $(DEPFILES))

View file

@ -19,6 +19,7 @@
#define FB_SIZE (BUFFER_WIDTH * SCREEN_HEIGHT * 4)
static unsigned int __attribute__((aligned(16))) list[262144];
#define GE_CMD_TEXTUREMAPENABLE 0x1E
/*########################################################################################################################*
*---------------------------------------------------------General---------------------------------------------------------*
@ -264,7 +265,7 @@ void Gfx_BeginFrame(void) {
}
void Gfx_ClearBuffers(GfxBuffers buffers) {
int targets = 0;
int targets = GU_FAST_CLEAR_BIT;
if (buffers & GFX_BUFFER_COLOR) targets |= GU_COLOR_BUFFER_BIT;
if (buffers & GFX_BUFFER_DEPTH) targets |= GU_DEPTH_BUFFER_BIT;
@ -297,6 +298,7 @@ static int vb_size;
GfxResourceID Gfx_CreateIb2(int count, Gfx_FillIBFunc fillFunc, void* obj) {
fillFunc(gfx_indices, count, obj);
return gfx_indices;
}
void Gfx_BindIb(GfxResourceID ib) { }

View file

@ -196,6 +196,10 @@ static void OnMouseWheel(void* obj, float delta) {
Launcher_Active->MouseWheel(Launcher_Active, delta);
}
static void OnClosing(void* obj) {
Launcher_ShouldExit = true;
}
/*########################################################################################################################*
*-----------------------------------------------------------Main body-----------------------------------------------------*
@ -203,6 +207,7 @@ static void OnMouseWheel(void* obj, float delta) {
static void Launcher_Init(void) {
Event_Register_(&WindowEvents.Resized, NULL, OnResize);
Event_Register_(&WindowEvents.StateChanged, NULL, OnResize);
Event_Register_(&WindowEvents.Closing, NULL, OnClosing);
Event_Register_(&InputEvents.Down, NULL, OnInputDown);
Event_Register_(&InputEvents.Wheel, NULL, OnMouseWheel);

View file

@ -106,7 +106,9 @@ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_
void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); }
#endif
void Window_Destroy(void) { }
void Window_Destroy(void) {
SDL_DestroyWindow(win_handle);
}
void Window_SetTitle(const cc_string* title) {
char str[NATIVE_STR_LEN];
@ -318,7 +320,6 @@ void Window_ProcessEvents(float delta) {
case SDL_QUIT:
Window_Main.Exists = false;
Event_RaiseVoid(&WindowEvents.Closing);
SDL_DestroyWindow(win_handle);
break;
case SDL_RENDER_DEVICE_RESET:

View file

@ -90,7 +90,9 @@ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_
void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); }
#endif
void Window_Destroy(void) { }
void Window_Destroy(void) {
SDL_DestroyWindow(win_handle);
}
void Window_SetTitle(const cc_string* title) {
char str[NATIVE_STR_LEN];
@ -280,7 +282,6 @@ void Window_ProcessEvents(float delta) {
case SDL_EVENT_QUIT:
Window_Main.Exists = false;
Event_RaiseVoid(&WindowEvents.Closing);
SDL_DestroyWindow(win_handle);
break;
case SDL_EVENT_RENDER_DEVICE_RESET: