forked from djyt/cannonball
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vita: better image quality, support non-fullscreen modes
- Loading branch information
Showing
45 changed files
with
884 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// | ||
// Adapted for vanilla c by rsn8887 on 11/13/2017 | ||
// Created by cpasjuste on 18/12/16. | ||
// | ||
|
||
// use https://github.com/frangarcj/vita2dlib/tree/fbo | ||
// and https://github.com/frangarcj/vita-shader-collection/releases | ||
|
||
#include "psp2_shader.h" | ||
|
||
#include <lcd3x_v.h> | ||
#include <lcd3x_f.h> | ||
#include <gtu_v.h> | ||
#include <gtu_f.h> | ||
#include <texture_v.h> | ||
#include <texture_f.h> | ||
#include <opaque_v.h> | ||
#include <bicubic_f.h> | ||
#include <xbr_2x_v.h> | ||
#include <xbr_2x_f.h> | ||
#include <xbr_2x_fast_v.h> | ||
#include <xbr_2x_fast_f.h> | ||
#include <advanced_aa_v.h> | ||
#include <advanced_aa_f.h> | ||
#include <scale2x_f.h> | ||
#include <scale2x_v.h> | ||
#include <sharp_bilinear_f.h> | ||
#include <sharp_bilinear_v.h> | ||
#include <sharp_bilinear_simple_f.h> | ||
#include <sharp_bilinear_simple_v.h> | ||
//#include "xbr_2x_noblend_f.h" | ||
//#include "xbr_2x_noblend_v.h" | ||
#include <fxaa_v.h> | ||
#include <fxaa_f.h> | ||
#include <crt_easymode_f.h> | ||
|
||
|
||
vita2d_shader *setPSP2Shader(PSP2Shader shaderType) { | ||
|
||
vita2d_shader *shader; | ||
switch (shaderType) { | ||
|
||
case LCD3X: | ||
shader = vita2d_create_shader((SceGxmProgram *) lcd3x_v, (SceGxmProgram *) lcd3x_f); | ||
break; | ||
case SCALE2X: | ||
shader = vita2d_create_shader((SceGxmProgram *) scale2x_v, (SceGxmProgram *) scale2x_f); | ||
break; | ||
case AAA: | ||
shader = vita2d_create_shader((SceGxmProgram *) advanced_aa_v, (SceGxmProgram *) advanced_aa_f); | ||
break; | ||
case SHARP_BILINEAR: | ||
shader = vita2d_create_shader((SceGxmProgram *) sharp_bilinear_v, (SceGxmProgram *) sharp_bilinear_f); | ||
break; | ||
case SHARP_BILINEAR_SIMPLE: | ||
shader = vita2d_create_shader((SceGxmProgram *) sharp_bilinear_simple_v, (SceGxmProgram *) sharp_bilinear_simple_f); | ||
break; | ||
case FXAA: | ||
shader = vita2d_create_shader((SceGxmProgram *) fxaa_v, (SceGxmProgram *) fxaa_f); | ||
break; | ||
default: | ||
shader = vita2d_create_shader((SceGxmProgram *) texture_v, (SceGxmProgram *) texture_f); | ||
break; | ||
} | ||
|
||
vita2d_texture_set_program(shader->vertexProgram, shader->fragmentProgram); | ||
vita2d_texture_set_wvp(shader->wvpParam); | ||
vita2d_texture_set_vertexInput(&shader->vertexInput); | ||
vita2d_texture_set_fragmentInput(&shader->fragmentInput); | ||
|
||
for(int i=0; i<3; i++) { | ||
vita2d_start_drawing(); | ||
vita2d_clear_screen(); | ||
vita2d_wait_rendering_done(); | ||
vita2d_swap_buffers(); | ||
} | ||
|
||
return shader; | ||
} | ||
|
||
void clearPSP2Shader(vita2d_shader *shader) { | ||
if (shader != NULL) { | ||
vita2d_wait_rendering_done(); | ||
vita2d_free_shader(shader); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Adapted for vanilla c by rsn8887 on 11/13/2017 | ||
// Created by cpasjuste on 18/12/16. | ||
// | ||
|
||
#ifndef PSP2_SHADER_H | ||
#define PSP2_SHADER_H | ||
|
||
#include <vita2d_fbo.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
enum PSP2Shader { | ||
NONE = 0, | ||
LCD3X, | ||
SCALE2X, | ||
AAA, | ||
SHARP_BILINEAR, | ||
SHARP_BILINEAR_SIMPLE, | ||
FXAA, | ||
}; | ||
typedef enum PSP2Shader PSP2Shader; | ||
|
||
void clearPSP2Shader(vita2d_shader *shader); | ||
vita2d_shader *setPSP2Shader(PSP2Shader shaderType); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif //PSP2_SHADER_H |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/advanced_aa_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _advanced_aa_f_h_ | ||
#define _advanced_aa_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char advanced_aa_f[]; | ||
extern const int advanced_aa_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_advanced_aa_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/advanced_aa_v.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _advanced_aa_v_h_ | ||
#define _advanced_aa_v_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char advanced_aa_v[]; | ||
extern const int advanced_aa_v_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_advanced_aa_v_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/alpha_blend_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _alpha_blend_f_h_ | ||
#define _alpha_blend_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char alpha_blend_f[]; | ||
extern const int alpha_blend_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_alpha_blend_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/alpha_blend_v.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _alpha_blend_v_h_ | ||
#define _alpha_blend_v_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char alpha_blend_v[]; | ||
extern const int alpha_blend_v_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_alpha_blend_v_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/bicubic_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _bicubic_f_h_ | ||
#define _bicubic_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char bicubic_f[]; | ||
extern const int bicubic_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_bicubic_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/clear_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _clear_f_h_ | ||
#define _clear_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char clear_f[]; | ||
extern const int clear_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_clear_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/clear_v.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _clear_v_h_ | ||
#define _clear_v_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char clear_v[]; | ||
extern const int clear_v_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_clear_v_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/color_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _color_f_h_ | ||
#define _color_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char color_f[]; | ||
extern const int color_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_color_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/color_v.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _color_v_h_ | ||
#define _color_v_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char color_v[]; | ||
extern const int color_v_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_color_v_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/crt_easymode_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _crt_easymode_f_h_ | ||
#define _crt_easymode_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char crt_easymode_f[]; | ||
extern const int crt_easymode_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_crt_easymode_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/fxaa_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _fxaa_f_h_ | ||
#define _fxaa_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char fxaa_f[]; | ||
extern const int fxaa_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_fxaa_f_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/fxaa_v.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _fxaa_v_h_ | ||
#define _fxaa_v_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char fxaa_v[]; | ||
extern const int fxaa_v_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_fxaa_v_h_ | ||
//--------------------------------------------------------------------------------- |
14 changes: 14 additions & 0 deletions
14
src/main/psp2/vitashaderlibs/vita-shader-collection/includes/gtu_f.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
This file was autogenerated by raw2c. | ||
Visit http://www.devkitpro.org | ||
*/ | ||
|
||
//--------------------------------------------------------------------------------- | ||
#ifndef _gtu_f_h_ | ||
#define _gtu_f_h_ | ||
//--------------------------------------------------------------------------------- | ||
extern const unsigned char gtu_f[]; | ||
extern const int gtu_f_size; | ||
//--------------------------------------------------------------------------------- | ||
#endif //_gtu_f_h_ | ||
//--------------------------------------------------------------------------------- |
Oops, something went wrong.