mirror of
https://github.com/libretro/parallel-n64.git
synced 2026-11-07 12:37:50 -10:00
Rice crashed in the driver whenever it put a frame the CPU left in RDRAM on screen: COGL_FragmentProgramCombiner had no InitCombinerBlenderForSimpleTextureDraw, so the base version's fixed-function setup ran and DrawFrameBuffer drew with no program bound. It now samples the frame with the copy program. The krom ROMs that hit it (shade32, tlut16, zbuf16) are no longer skipped by the GL lane, and under the sanitizers they also showed Rice freeing its CTextures, which come from new, with free. Glide64's grLfbWriteRegion (the Puzzle League hack) drew nothing: it called glTexSubImage2D with glTexImage2D's arguments into a texture with no storage, drew with the default program, whose vertexOffset is never set, told the shader the texture was 1x1 while addressing it in texels, folded its strip on itself, never enabled its arrays, and was clipped and culled by whatever the frame left set. It now draws the image where it was written and puts the frame's state back as it found it. test_glitch64_lfb_write runs Glitch64 on Mesa through headless EGL and holds every pixel of the window to the image. Glide64's texture conversions (the path GLES takes) worked on the window's size in texels rather than the texture's - 640x480 texels for a 32x32 texture, past the end of the texture buffer at large window sizes - and touched one texel past the end besides; and every format went up as 32-bit RGBA. 565, intensity and intensity-alpha now go up as Glide lays them out, 4444 is rotated in place to GL's RGBA4 instead of widened, and rows narrower than 4 bytes upload with an unpack alignment of 1. test_glitch64_textures, built for desktop GL and for GLES 2, uploads every format at five sizes from a buffer exactly as large as the widest conversion needs and holds every texel to what the format means. Undefined behaviour UBSan found in the GL lane: - angrylion models the RDP's adders and shifters with int arithmetic that wraps as the hardware does; its objects are built with -fwrapv (Makefile and Android.mk), bit-exact and as fast. - glsm indexed its uniform cache with location -1 and with program names past it; such uniforms now go straight to GL. The core's glsm is edited in place: libretro-common upstream no longer has glsm, and this copy already carries the core's own changes. - lightning's x86 backend stored immediates through unaligned pointers into the code buffer; it stores them with memcpy. - Glide64 shifted a command byte into an int's sign bit and shifted negative texture row padding; Rice read matrix halves through unaligned pointers, negated INT_MIN for a viewport built from a VI size of 0 (the scale is kept until the VI has a size), and downcast its renderer before it was constructed. The GL lane's sanitizer run is now SANITIZER=address,undefined, runs the angrylion lane too, and both lanes fail on any sanitizer report. angrylion's filtered VI now draws straight into a lent frontend buffer with the overscan hidden (the buffer is the crop, and rows write only its columns) and for interlaced frames under bob deinterlacing (every line is drawn each frame). The E90 overlay takes the columns it draws into. The lend lane runs those, and one of krom's interlaced CPU tests, woven and bobbed.
91 lines
3.2 KiB
Makefile
91 lines
3.2 KiB
Makefile
LOCAL_PATH := $(call my-dir)
|
|
|
|
ROOT_DIR := $(LOCAL_PATH)/..
|
|
LIBRETRO_DIR := $(ROOT_DIR)/libretro
|
|
|
|
SOURCES_C :=
|
|
SOURCES_CXX :=
|
|
SOURCES_ASM :=
|
|
INCFLAGS :=
|
|
CFLAGS :=
|
|
CXXFLAGS :=
|
|
DYNAFLAGS :=
|
|
HAVE_NEON := 0
|
|
WITH_DYNAREC :=
|
|
|
|
HAVE_OPENGL := 1
|
|
GLES := 1
|
|
HAVE_PARALLEL := 1
|
|
HAVE_PARALLEL_RSP := 1
|
|
HAVE_THR_AL := 1
|
|
|
|
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
|
WITH_DYNAREC := aarch64
|
|
else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
|
WITH_DYNAREC := arm
|
|
HAVE_NEON := 1
|
|
else ifeq ($(TARGET_ARCH_ABI),x86)
|
|
# X86 dynarec isn't position independent, so it will not run on api 23+
|
|
# This core uses vulkan which is api 24+, so dynarec cannot be used
|
|
WITH_DYNAREC := bogus
|
|
else ifeq ($(TARGET_ARCH_ABI),x86_64)
|
|
# Both x86_64 dynarecs put their entry points (new_dyna_start, dyna_start) in
|
|
# nasm sources, and ndk-build has no assembler for those - the core links
|
|
# against symbols that were never built. Interpreters only here as well.
|
|
WITH_DYNAREC := bogus
|
|
endif
|
|
|
|
include $(ROOT_DIR)/Makefile.common
|
|
|
|
COREFLAGS := -ffast-math -DM64P_CORE_PROTOTYPES -DM64P_PLUGIN_API -D__LIBRETRO__ -DINLINE="inline" -DANDROID -DARM_FIX $(GLFLAGS) $(INCFLAGS) $(DYNAFLAGS)
|
|
|
|
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
|
|
ifneq ($(GIT_VERSION)," unknown")
|
|
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
|
endif
|
|
|
|
# GLideN64 resolves its headers from its own src/ and src/osal/ trees, and
|
|
# its names (Combiner.h, Config.h, N64.h) collide with the other video
|
|
# plugins, so it builds as its own module with those directories first on
|
|
# the include path - the same flags the Makefile's GLideN64 pattern rules
|
|
# use. The NDK ships no GL/glcorearb.h, so the copy in src/inc is used.
|
|
GLIDEN64_SRC := $(ROOT_DIR)/mupen64plus-video-gliden64/src
|
|
GLIDEN64_SOURCES := $(filter $(GLIDEN64_SRC)/%,$(SOURCES_CXX) $(SOURCES_C))
|
|
GLIDEN64_INCFLAGS := -I$(GLIDEN64_SRC) -I$(GLIDEN64_SRC)/osal -I$(GLIDEN64_SRC)/inc
|
|
|
|
ifneq ($(GLIDEN64_SOURCES),)
|
|
include $(CLEAR_VARS)
|
|
LOCAL_MODULE := gliden64
|
|
LOCAL_SRC_FILES := $(GLIDEN64_SOURCES)
|
|
LOCAL_CFLAGS := $(GLIDEN64_INCFLAGS) $(COREFLAGS) $(CFLAGS)
|
|
LOCAL_CXXFLAGS := -std=c++11 $(GLIDEN64_INCFLAGS) $(COREFLAGS) $(CXXFLAGS)
|
|
LOCAL_CPP_FEATURES := exceptions
|
|
LOCAL_ARM_NEON := true
|
|
LOCAL_ARM_MODE := arm
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
endif
|
|
|
|
include $(CLEAR_VARS)
|
|
LOCAL_MODULE := retro
|
|
LOCAL_SRC_FILES := $(filter-out $(GLIDEN64_SOURCES),$(SOURCES_CXX) $(SOURCES_C)) $(SOURCES_ASM)
|
|
ifneq ($(GLIDEN64_SOURCES),)
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := gliden64
|
|
endif
|
|
# -fcommon as in the Makefile: the C plugins' tentative definitions of the
|
|
# state GLideN64 also defines (gDP, gSP, GBI, the G_* opcodes, RDRAM, TMEM)
|
|
# merge with GLideN64's at link, and only one plugin is ever active.
|
|
# -fwrapv as the Makefile builds angrylion: its RDP model's int arithmetic
|
|
# wraps as the hardware's adders and shifters do.
|
|
LOCAL_CFLAGS := -fcommon -fwrapv $(COREFLAGS) $(CFLAGS)
|
|
LOCAL_CXXFLAGS := -std=c++11 $(COREFLAGS) $(CXXFLAGS)
|
|
LOCAL_LDFLAGS := -Wl,-version-script=$(LIBRETRO_DIR)/link.T
|
|
ifeq ($(GLES3),1)
|
|
LOCAL_LDLIBS := -lGLESv3 -llog
|
|
else
|
|
LOCAL_LDLIBS := -lGLESv2 -llog
|
|
endif
|
|
LOCAL_CPP_FEATURES := exceptions
|
|
LOCAL_ARM_NEON := true
|
|
LOCAL_ARM_MODE := arm
|
|
include $(BUILD_SHARED_LIBRARY)
|