Skip to content

Rinnegatamante/vitaGL

Repository files navigation

vitaGL is an opensource openGL driver for PSVITA development. It acts as a wrapper between openGL and sceGxm and allows to use a subset of openGL functions with full hardware acceleration by translating the code to sceGxm equivalent.

Prerequisites

In order to run an homebrew made with vitaGL, you are going to need libshacccg.suprx extracted and decrypted on your console. You can refer to this guide for more details about its extraction: https://samilops2.gitbook.io/vita-troubleshooting-guide/shader-compiler/extract-libshacccg.suprx
If you want your homebrew to not be hard dependant from libshacccg.suprx, you can either:

Build Instructions

In order to build vitaGL use the following command: make install.
These are all the available flags usable when compiling the library:

Debug Flags

Flag Description
HAVE_SHARK_LOG=1 Enables logging support in runtime shader compiler.
LOG_ERRORS=1 Errors will be logged with sceClibPrintf.
LOG_ERRORS=2 Errors will be logged to ux0:data/vitaGL.log.
HAVE_DEBUGGER=1 Enables lightweighted on screen debugger interface.
HAVE_DEBUGGER=2 Enables lightweighted on screen debugger interface with extra information (devkit only).
HAVE_RAZOR=1 Enables debugging features through Razor debugger (retail and devkit compatible).
HAVE_RAZOR=2 Enables debugging features through Razor debugger (retail and devkit compatible) with ImGui interface.
HAVE_DEVKIT=1 Enables extra debugging features through Razor debugger available only for devkit users.
HAVE_DEVKIT=2 Enables extra debugging features through Razor debugger available only for devkit users with ImGui interface.

Compatibility Flags

Flag Description
HAVE_CUSTOM_HEAP=1 Replaces sceClib heap implementation with custom one (Less efficient but safer).
HAVE_GLSL_SUPPORT=1 Enables experimental GLSL to CG auto translation for shader sources.
SOFTFP_ABI=1 Compiles the library in soft floating point compatibility mode.
STORE_DEPTH_STENCIL=1 Makes all framebuffers depth/stencil surfaces to be load/stored on memory. Makes the rendering slower but more compliant with OpenGL standards.
HAVE_HIGH_FFP_TEXUNITS=1 Enables support for more than 2 texunits for fixed function pipeline at the cost of some performance loss.
HAVE_DISPLAY_LISTS=1 Enables support for display lists at the cost of some performance loss.
SAFE_ETC1=1 Disables hardware support for ETC1 textures. Makes ETC1 textures usage less efficient but allows for proper debugging in Razor.
SAFE_DRAW=1 Makes some optimizations in the drawing pipeline less efficient but can solve some glitches.
UNPURE_TEXFORMATS=1 Enables support for texture dimensions different than 2D (tex2D is still required in shader code).
HAVE_VITA3K_SUPPORT=1 Disables several features in order to make vitaGL compatible with Vita3K. Requires vitaShaRK compiled with https://github.com/Rinnegatamante/vitaShaRK/blob/master/source/vitashark.c#L24 uncommented.

Speedhack Flags

Flag Description
NO_TEX_COMBINER=1 Disables texture combiner support (GL_COMBINE) for faster fixed function pipeline code execution.
NO_DEBUG=1 Disables most of the error handling features (Faster CPU code execution but code may be non compliant to all OpenGL standards).
BUFFERS_SPEEDHACK=1 Enables faster vertex buffer copying. May cause crashes.
DRAW_SPEEDHACK=1 Enables faster code for draw calls. May cause crashes.
MATH_SPEEDHACK=1 Enables faster code for matrix math calls. May cause glitches.
TEXTURES_SPEEDHACK=1 Makes glTexSubImage2D/glTexSubImage1D non fully OpenGL compliant but makes rendering pipeline slightly faster. Incompatible with HAVE_TEXTURE_CACHE=1.
SAMPLERS_SPEEDHACK=1 Enables faster code for samplers resolution during shaders usage. May cause glitches.
SHADER_COMPILER_SPEEDHACK=1 Enables faster code for glShaderSource. May cause errors.
PRIMITIVES_SPEEDHACK=1 Makes draw calls more efficient but GL_LINES and GL_POINTS primitives usage may cause glitches.

Misc Flags

Flag Description
HAVE_TEXTURE_CACHE=1 Adds file caching for textures not used since a lot of time, acting like a sort of swap implementation to increase effective available memory. (Experimental)
NO_DMAC=1 Disables sceDmacMemcpy usage. In some rare instances, it can improve framerate.
HAVE_UNFLIPPED_FBOS=1 Framebuffers objects won't be internally flipped to match OpenGL standards.
HAVE_WVP_ON_GPU=1 Moves calculation of the wvp in fixed function pipeline codepath to the GPU. Reduces CPU workload and increases GPU one.
SHARED_RENDERTARGETS=1 Makes small framebuffers objects use shared rendertargets instead of dedicated ones.
SHARED_RENDERTARGETS=2 Makes small framebuffers objects use shared rendertargets instead of dedicated ones and adds a mechanism for recycling older rendertargets.
CIRCULAR_VERTEX_POOL=1 Makes temporary data buffers being handled with a circular pool.
HAVE_PTHREAD=1 Use pthread instead of sceKernel for starting garbage collector thread.
SINGLE_THREADED_GC=1 Makes the garbage collector run on main thread.
PHYCONT_ON_DEMAND=1 Makes the physically contiguous RAM be handled with separate memblocks instead of an heap.
UNPURE_TEXTURES=1 Makes legal to upload textures without base level.
HAVE_WRAPPED_ALLOCATORS=1 Allows usage of vgl allocators inside wrapped allocators.
HAVE_SHADER_CACHE=1 Enables fast automatic file caching (based on XH3 xxHash algorithm) for application provided shaders.

Samples

You can find samples in the samples folder in this repository.

Help and Troubleshooting

If you plan to use vitaGL for one of your projects, you can find an official channel to get help with it on Vita Nuova discord server: https://discord.gg/PyCaBx9

Projects actually using vitaGL

Here you can find a list of projects using vitaGL:

Direct OpenGL Usage:
Aerofoil Vita - Port of Glider PRO
Anomaly 2 Vita - Port of Anomaly 2
Anomaly Defenders Vita - Port of Anomaly Defenders
Anomaly Korea - Port of Anomaly Korea
Anomaly WE Vita - Port of Anomaly Warzone Earth HD
AvP Gold - Port of Aliens versus Predator: Gold Edition
Baba Is You Vita - Port of Baba Is You
Billy Frontier Vita - Port of Billy Frontier
Bugdom - Port of Bugdom
bc2_vita - Port of Battlefield Bad Company 2 Mobile
Crazy Taxi Vita - Port of Crazy Taxi Classic
Cro-Mag Rally Vita - Port of Cro-Mag Rally
CrossCraft Classic - Multiplatform Minecraft Classic clone
d3es-vita - Port of Doom 3
Daedalus X64 - Port of Daedalus X64 (N64 Emulator)
Dead Space Vita - Port of Dead Space (Android)
Death Road to Canada Lite - Port of Death Road to Canada
Doom64EX - Port of Doom64EX (Doom 64 sourceport)
Fade to Black - Port of Fade to Black
Fahrenheit Vita - Port of Fahrenheit: Indigo Prophecy
FF3-Vita - Port of Final Fantasy III (3D Remake)
FF4-Vita - Port of Final Fantasy IV (3D Remake)
FF4AY_Vita - Port of Final Fantasy IV: The After Years (3D Remake)
FF5-Vita - Port of Final Fantasy V
Flycast - Port of Flycast (Dreamcast Emulator)
Funky Smugglers Vita - Port of Funky Smugglers
Hassey Collection - Port of Galcon 2: Galactic Conquest and BREAKFINITY
Hurrican - Port of Hurrican
Isotope 244 Collection - Port of Machines at War 3 and Land Air Sea Warfare
JetMan 3D - Fanmade remake of Jetpac for ZX Spectrum
jfduke3d-vita - Port of JFDuke3D (Duke Nukem 3D sourceport)
jfsw-vita - Port of JFSW (Shadow Warrior Classic sourceport)
Lugaru HD - Port of Lugaru
Mass Effect Infiltrator Vita - Port of Mass Effect: Infiltrator
Nanosaur Vita - Port of Nanosaur
Nazi Zombies Portable - Port of Nazi Zombies Portable
Neverball Vita - Port of Neverball
Neverputt Vita - Port of Neverputt
Pekka Kana 2 Vita - Port of Pekka Kana 2
Poppy Kart Collection - Port of Poppy Kart and Poppy Kart 2
prboom-plus - Port of PrBoom Plus (Doom engine sourceport)
Quakespasm-Spiked - Port of Quakespasm Spiked (Limit removed Quake Engine sourceport)
Rigel Engine - Port of Duke Nukem II
RVGL Vita - Port of RVGL
rvm_soniccd-vitagl - Port of rvm_soniccd (Sonic CD decompilation)
Sleepwalker's Journey Vita - Port of Sleepwalker's Journey
sm64-vita - Port of Super Mario 64
srb2-vita - Port of Sonic Robo Blast 2
StaticJK - Port of Star Wars: Jedi Academy
TheXTech Vita - Port of Super Mario Bros X
Tomb Raider 1 & 2 Classic Collection - Port of Tomb Raider and Tomb Raider 2
TWoM Vita - Port of This War of Mine and This War of Mine: Stories - Father's Promise
VITA Homebrew Sorter - App to sort your app.db
VitaDB Downloader - Homebrew store app
VITAlbum - Filebrowser and image viewer app
vitaET - Port of ET: Legacy (Wolfenstein: Enemy Territory)
vitaHexenII - Port of Hexen II
vitaQuake - Port of Quake I and mission packs
vitaQuakeII -Port of Quake II and mission packs
vitaQuakeIII - Port of ioquake3 (Quake III: Arena, Quake III: Team Arena, OpenArena, Urban Terror)
vitaRTCW - Port of iortcw (Return to Castle Wolfenstein)
vitaVoyager - Port of lilium-voyager (Star Trek Voyager: Elite Force)
vitaXash3D - Port of Xash3D (Half Life, Counter Strike 1.6)
World of Goo Vita - Port of World of Goo
YoYo Loader - Loader for Game Maker Studio made games

Libraries:
imgui_vita - Port of dear imGui
sdl12_gl - SDL 1.2 Vita port adapted to work with vitaGL as renderer backend
SDL2_vitagl - SDL2 Vita port adapted to work with vitaGL as renderer backend

sdl12_gl Apps:
Dstroy Vita - Port of Dstroy
meritous - Port of meritous
SuperMarioWar - Port of Super Mario War
vitaWolfen - Port of Wolf4SDL (Wolfenstein 3D)
Zelda3T - Port of Zelda: Time to Triumph
ZeldaNSQ - Port of Zelda: Navi's Quest
ZeldaOLB - Port of Zelda: Oni Link Begins
ZeldaROTH - Port of Zelda: Return of the Hylian

About

openGL wrapper for PSVITA.

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages