Skip to content

Commit

Permalink
Merge branch 'master' into libretro
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz committed Nov 14, 2024
2 parents cf0a1a1 + def41a5 commit 39999ef
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ OBJS += $(LCHDR)/src/libchdr_cdrom.o
OBJS += $(LCHDR)/src/libchdr_chd.o
OBJS += $(LCHDR)/src/libchdr_flac.o
OBJS += $(LCHDR)/src/libchdr_huffman.o
$(LCHDR)/src/%.o: CFLAGS += -Wno-unused -Wno-maybe-uninitialized -Wno-format -std=gnu11
$(LCHDR)/src/%.o: CFLAGS += -Wno-unused -Wno-maybe-uninitialized -std=gnu11
OBJS += $(LCHDR_LZMA)/src/Alloc.o
OBJS += $(LCHDR_LZMA)/src/CpuArch.o
OBJS += $(LCHDR_LZMA)/src/Delta.o
Expand Down
4 changes: 3 additions & 1 deletion Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,13 @@ else ifeq ($(platform), ctr)
CFLAGS += -DARM11 -D_3DS -D__3DS__
CFLAGS += -DNO_DYLIB -DGPU_UNAI_USE_FLOATMATH -DGPU_UNAI_USE_FLOAT_DIV_MULTINV
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
CFLAGS += -Wall -mword-relocations
CFLAGS += -mword-relocations
CFLAGS += -fomit-frame-pointer
CFLAGS_LAST += -O3
# CFLAGS += -funroll-loops # ~500K of bloat
CFLAGS += -Ifrontend/3ds -I$(CTRULIB)/include
CFLAGS += -Werror=implicit-function-declaration
CFLAGS += -Wno-format
CFLAGS += -DHAVE_UNISTD_H
CFLAGS += -DZ7_DECL_Int32_AS_long
CFLAGS += -DUSE_CTRULIB_2
Expand Down Expand Up @@ -402,6 +403,7 @@ else ifneq (,$(filter $(platform),ngc wii wiiu))
CFLAGS += -DHW_WUP
CFLAGS += -I frontend/wiiu
CFLAGS += -DZ7_DECL_Int32_AS_long
CFLAGS += -Wno-format
LIGHTREC_CUSTOM_MAP := 1
LIGHTREC_CUSTOM_MAP_OBJ := libpcsxcore/lightrec/mem_wiiu.o
LIGHTREC_CODE_INV := 1
Expand Down
4 changes: 0 additions & 4 deletions frontend/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -2639,10 +2639,6 @@ static void update_variables(bool in_flight)
* (480i, 512i) and has been obsoleted by
* pcsx_rearmed_gpu_unai_scale_hires */
pl_rearmed_cbs.gpu_unai.ilace_force = 0;
/* Note: This used to be an option, but it has no
* discernable effect and has been obsoleted by
* pcsx_rearmed_gpu_unai_scale_hires */
pl_rearmed_cbs.gpu_unai.pixel_skip = 0;

var.key = "pcsx_rearmed_gpu_unai_old_renderer";
var.value = NULL;
Expand Down
3 changes: 1 addition & 2 deletions frontend/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ void emu_set_default_config(void)
pl_rearmed_cbs.gpu_peops.dwActFixes = 1<<7;
pl_rearmed_cbs.gpu_unai.old_renderer = 0;
pl_rearmed_cbs.gpu_unai.ilace_force = 0;
pl_rearmed_cbs.gpu_unai.pixel_skip = 0;
pl_rearmed_cbs.gpu_unai.lighting = 1;
pl_rearmed_cbs.gpu_unai.fast_lighting = 0;
pl_rearmed_cbs.gpu_unai.blending = 1;
Expand Down Expand Up @@ -936,7 +935,7 @@ static int _OpenPlugins(void) {
#endif

ret = cdra_open();
if (ret < 0) { SysMessage(_("Error opening CD-ROM plugin!")); return -1; }
if (UsingIso() && ret < 0) { SysMessage(_("Error opening CD-ROM plugin!")); return -1; }
ret = SPU_open();
if (ret < 0) { SysMessage(_("Error opening SPU plugin!")); return -1; }
SPU_registerCallback(SPUirq);
Expand Down
2 changes: 0 additions & 2 deletions frontend/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ static const struct {
CE_INTVAL_P(gpu_peops.dwActFixes),
CE_INTVAL_P(gpu_unai.old_renderer),
CE_INTVAL_P(gpu_unai.ilace_force),
CE_INTVAL_P(gpu_unai.pixel_skip),
CE_INTVAL_P(gpu_unai.lighting),
CE_INTVAL_P(gpu_unai.fast_lighting),
CE_INTVAL_P(gpu_unai.blending),
Expand Down Expand Up @@ -1449,7 +1448,6 @@ static menu_entry e_menu_plugin_gpu_unai[] =
mee_onoff ("Lighting", 0, pl_rearmed_cbs.gpu_unai.lighting, 1),
mee_onoff ("Fast lighting", 0, pl_rearmed_cbs.gpu_unai.fast_lighting, 1),
mee_onoff ("Blending", 0, pl_rearmed_cbs.gpu_unai.blending, 1),
mee_onoff ("Pixel skip", 0, pl_rearmed_cbs.gpu_unai.pixel_skip, 1),
mee_end,
};

Expand Down
1 change: 0 additions & 1 deletion frontend/plugin_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ struct rearmed_cbs {
struct {
int old_renderer;
int ilace_force;
int pixel_skip;
int lighting;
int fast_lighting;
int blending;
Expand Down
65 changes: 15 additions & 50 deletions plugins/gpu_unai/gpulib_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,37 +285,13 @@ void renderer_finish(void)

void renderer_notify_res_change(void)
{
if (PixelSkipEnabled()) {
// Set blit_mask for high horizontal resolutions. This allows skipping
// rendering pixels that would never get displayed on low-resolution
// platforms that use simple pixel-dropping scaler.

switch (gpu.screen.hres)
{
case 512: gpu_unai.blit_mask = 0xa4; break; // GPU_BlitWWSWWSWS
case 640: gpu_unai.blit_mask = 0xaa; break; // GPU_BlitWS
default: gpu_unai.blit_mask = 0; break;
}
} else {
gpu_unai.blit_mask = 0;
}

if (LineSkipEnabled()) {
// Set rendering line-skip (only render every other line in high-res
// 480 vertical mode, or, optionally, force it for all video modes)
gpu_unai.ilace_mask = gpu_unai.config.ilace_force;

if (gpu.screen.vres == 480) {
if (gpu_unai.config.ilace_force) {
gpu_unai.ilace_mask = 3; // Only need 1/4 of lines
} else {
gpu_unai.ilace_mask = 1; // Only need 1/2 of lines
}
} else {
// Vert resolution changed from 480 to lower one
gpu_unai.ilace_mask = gpu_unai.config.ilace_force;
}
} else {
gpu_unai.ilace_mask = 0;
#ifndef HAVE_PRE_ARMV7 /* XXX */
if (gpu_unai.config.scale_hires)
#endif
{
gpu_unai.ilace_mask |= !!(gpu.status & PSX_GPU_STATUS_INTERLACE);
}

/*
Expand Down Expand Up @@ -413,17 +389,6 @@ int do_cmd_list(u32 *list_, int list_len,
if (IS_OLD_RENDERER())
return oldunai_do_cmd_list(list_, list_len, cycles_sum_out, cycles_last, last_cmd);

//TODO: set ilace_mask when resolution changes instead of every time,
// eliminate #ifdef below.
gpu_unai.ilace_mask = gpu_unai.config.ilace_force;

#ifdef HAVE_PRE_ARMV7 /* XXX */
gpu_unai.ilace_mask |= !!(gpu.status & PSX_GPU_STATUS_INTERLACE);
#endif
if (gpu_unai.config.scale_hires) {
gpu_unai.ilace_mask |= !!(gpu.status & PSX_GPU_STATUS_INTERLACE);
}

for (; list < list_end; list += 1 + len)
{
cmd = le32_to_u32(*list) >> 24;
Expand Down Expand Up @@ -453,7 +418,7 @@ int do_cmd_list(u32 *list_, int list_len,
case 0x22:
case 0x23: { // Monochrome 3-pt poly
PP driver = gpuPolySpanDrivers[
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Blending_Mode |
gpu_unai.Masking | Blending | gpu_unai.PixelMSB
];
Expand All @@ -469,7 +434,7 @@ int do_cmd_list(u32 *list_, int list_len,
gpuSetTexture(le32_to_u32(gpu_unai.PacketBuffer.U4[4]) >> 16);

u32 driver_idx =
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Dithering |
Blending_Mode | gpu_unai.TEXT_MODE |
gpu_unai.Masking | Blending | gpu_unai.PixelMSB;
Expand All @@ -491,7 +456,7 @@ int do_cmd_list(u32 *list_, int list_len,
case 0x2A:
case 0x2B: { // Monochrome 4-pt poly
PP driver = gpuPolySpanDrivers[
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Blending_Mode |
gpu_unai.Masking | Blending | gpu_unai.PixelMSB
];
Expand All @@ -507,7 +472,7 @@ int do_cmd_list(u32 *list_, int list_len,
gpuSetTexture(le32_to_u32(gpu_unai.PacketBuffer.U4[4]) >> 16);

u32 driver_idx =
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Dithering |
Blending_Mode | gpu_unai.TEXT_MODE |
gpu_unai.Masking | Blending | gpu_unai.PixelMSB;
Expand All @@ -533,7 +498,7 @@ int do_cmd_list(u32 *list_, int list_len,
// shouldn't apply. Until the original array of template
// instantiation ptrs is fixed, we're stuck with this. (TODO)
PP driver = gpuPolySpanDrivers[
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Dithering |
Blending_Mode |
gpu_unai.Masking | Blending | 129 | gpu_unai.PixelMSB
Expand All @@ -549,7 +514,7 @@ int do_cmd_list(u32 *list_, int list_len,
gpuSetCLUT (le32_to_u32(gpu_unai.PacketBuffer.U4[2]) >> 16);
gpuSetTexture (le32_to_u32(gpu_unai.PacketBuffer.U4[5]) >> 16);
PP driver = gpuPolySpanDrivers[
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Dithering |
Blending_Mode | gpu_unai.TEXT_MODE |
gpu_unai.Masking | Blending | ((Lighting)?129:0) | gpu_unai.PixelMSB
Expand All @@ -564,7 +529,7 @@ int do_cmd_list(u32 *list_, int list_len,
case 0x3B: { // Gouraud-shaded 4-pt poly
// See notes regarding '129' for 0x30..0x33 further above -senquack
PP driver = gpuPolySpanDrivers[
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Dithering |
Blending_Mode |
gpu_unai.Masking | Blending | 129 | gpu_unai.PixelMSB
Expand All @@ -580,7 +545,7 @@ int do_cmd_list(u32 *list_, int list_len,
gpuSetCLUT (le32_to_u32(gpu_unai.PacketBuffer.U4[2]) >> 16);
gpuSetTexture (le32_to_u32(gpu_unai.PacketBuffer.U4[5]) >> 16);
PP driver = gpuPolySpanDrivers[
(gpu_unai.blit_mask?1024:0) |
//(gpu_unai.blit_mask?1024:0) |
Dithering |
Blending_Mode | gpu_unai.TEXT_MODE |
gpu_unai.Masking | Blending | ((Lighting)?129:0) | gpu_unai.PixelMSB
Expand Down Expand Up @@ -842,6 +807,7 @@ void renderer_flush_queues(void)

void renderer_set_interlace(int enable, int is_odd)
{
renderer_notify_res_change();
}

#include "../../frontend/plugin_lib.h"
Expand All @@ -851,7 +817,6 @@ void renderer_set_config(const struct rearmed_cbs *cbs)
gpu_unai.vram = (le16_t *)gpu.vram;
gpu_unai.config.old_renderer = cbs->gpu_unai.old_renderer;
gpu_unai.config.ilace_force = cbs->gpu_unai.ilace_force;
gpu_unai.config.pixel_skip = cbs->gpu_unai.pixel_skip;
gpu_unai.config.lighting = cbs->gpu_unai.lighting;
gpu_unai.config.fast_lighting = cbs->gpu_unai.fast_lighting;
gpu_unai.config.blending = cbs->gpu_unai.blending;
Expand Down

0 comments on commit 39999ef

Please sign in to comment.