RetroArch
video_shader_parse.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  * Copyright (C) 2011-2017 - Daniel De Matteis
4  *
5  * RetroArch is free software: you can redistribute it and/or modify it under the terms
6  * of the GNU General Public License as published by the Free Software Found-
7  * ation, either version 3 of the License, or (at your option) any later version.
8  *
9  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with RetroArch.
14  * If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __VIDEO_SHADER_PARSE_H
18 #define __VIDEO_SHADER_PARSE_H
19 
20 #include "video_state_tracker.h"
21 
22 #include <boolean.h>
23 #include <retro_common_api.h>
24 #include <retro_miscellaneous.h>
25 #include <file/config_file.h>
26 
28 
29 #ifndef GFX_MAX_SHADERS
30 #define GFX_MAX_SHADERS 26
31 #endif
32 
33 #ifndef GFX_MAX_TEXTURES
34 #define GFX_MAX_TEXTURES 8
35 #endif
36 
37 #ifndef GFX_MAX_VARIABLES
38 #define GFX_MAX_VARIABLES 64
39 #endif
40 
41 #ifndef GFX_MAX_PARAMETERS
42 #define GFX_MAX_PARAMETERS 128
43 #endif
44 
45 #ifndef GFX_MAX_FRAME_HISTORY
46 #define GFX_MAX_FRAME_HISTORY 128
47 #endif
48 
49 
51 {
58 };
59 
61 {
65 };
66 
67 enum
68 {
73 };
74 
76 {
77  RARCH_WRAP_BORDER = 0, /* Kinda deprecated, but keep as default.
78  Will be translated to EDGE in GLES. */
84 };
85 
87 {
90  float scale_x;
91  float scale_y;
92  bool fp_fbo;
93  bool srgb_fbo;
94  bool valid;
95  unsigned abs_x;
96  unsigned abs_y;
97 };
98 
100 {
101  char id[64];
102  char desc[64];
103  float current;
104  float minimum;
105  float initial;
106  float maximum;
107  float step;
108  int pass;
109 };
110 
112 {
113  struct
114  {
116  struct
117  {
118  char *vertex; /* Dynamically allocated. Must be free'd. */
119  char *fragment; /* Dynamically allocated. Must be free'd. */
120  } string;
121  } source;
122 
123  char alias[64];
126  bool mipmap;
127  unsigned filter;
128  unsigned frame_count_mod;
129  bool feedback;
130 };
131 
133 {
134  char id[64];
137  bool mipmap;
138  unsigned filter;
139 };
140 
141 /* This is pretty big, shouldn't be put on the stack.
142  * Avoid lots of allocation for convenience. */
144 {
146 
147  char prefix[64];
148  char script_class[512];
151  char *script; /* Dynamically allocated. Must be free'd. Only used by XML. */
152 
153  bool modern; /* Only used for XML shaders. */
154 
155  unsigned passes;
156  unsigned luts;
157  unsigned num_parameters;
158  unsigned variables;
159  /* If < 0, no feedback pass is used. Otherwise,
160  * the FBO after pass #N is passed a texture to next frame. */
163 
165 
167 
170 };
171 
183  struct video_shader *shader);
184 
194  struct video_shader *shader);
195 
205  const char *ref_path);
206 
217  struct video_shader *shader);
218 
229  struct video_shader *shader);
230 
243  enum rarch_shader_type fallback);
244 
246  const char *ext, bool *is_preset);
247 
249 
250 bool video_shader_any_supported(void);
251 
253 
255 
256 #endif
GLenum GLenum variable
Definition: glext.h:9938
#define GFX_MAX_VARIABLES
Definition: video_shader_parse.h:38
bool video_shader_resolve_current_parameters(config_file_t *conf, struct video_shader *shader)
Definition: video_shader_parse.c:435
GLuint shader
Definition: glext.h:6670
bool feedback
Definition: video_shader_parse.h:129
unsigned frame_count_mod
Definition: video_shader_parse.h:128
struct video_shader_pass::@700 source
enum rarch_shader_type video_shader_get_type_from_ext(const char *ext, bool *is_preset)
Definition: video_shader_parse.c:1134
Definition: video_shader_parse.h:56
Definition: video_shader_parse.h:62
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
Definition: video_shader_parse.h:80
float current
Definition: video_shader_parse.h:103
float scale_y
Definition: video_shader_parse.h:91
int pass
Definition: video_shader_parse.h:108
Definition: video_shader_parse.h:63
void video_shader_write_conf_cgp(config_file_t *conf, struct video_shader *shader)
Definition: video_shader_parse.c:952
char * fragment
Definition: video_shader_parse.h:119
GLsizei const GLchar ** path
Definition: glext.h:7901
Definition: video_shader_parse.h:69
bool video_shader_check_for_changes(void)
Definition: video_shader_parse.c:1343
enum rarch_shader_type video_shader_parse_type(const char *path, enum rarch_shader_type fallback)
Definition: video_shader_parse.c:1288
char script_path[PATH_MAX_LENGTH]
Definition: video_shader_parse.h:149
#define GFX_MAX_TEXTURES
Definition: video_shader_parse.h:34
enum gfx_wrap_type wrap
Definition: video_shader_parse.h:136
Definition: video_shader_parse.h:99
Definition: video_shader_parse.h:72
float scale_x
Definition: video_shader_parse.h:90
#define PATH_MAX_LENGTH
Definition: retro_miscellaneous.h:83
bool video_shader_is_supported(enum rarch_shader_type type)
Definition: video_shader_parse.c:1101
unsigned filter
Definition: video_shader_parse.h:127
Definition: video_shader_parse.h:143
int feedback_pass
Definition: video_shader_parse.h:161
unsigned abs_y
Definition: video_shader_parse.h:96
Definition: video_shader_parse.h:71
struct gfx_fbo_scale fbo
Definition: video_shader_parse.h:124
char desc[64]
Definition: video_shader_parse.h:102
gfx_scale_type
Definition: video_shader_parse.h:60
GLenum type
Definition: glext.h:6233
enum gfx_scale_type type_x
Definition: video_shader_parse.h:88
Definition: video_shader_parse.h:55
rarch_shader_type
Definition: video_shader_parse.h:50
char alias[64]
Definition: video_shader_parse.h:123
Definition: video_shader_parse.h:83
float initial
Definition: video_shader_parse.h:105
Definition: video_shader_parse.h:52
Definition: video_shader_parse.h:54
Definition: video_shader_parse.h:81
Definition: video_shader_parse.h:79
int history_size
Definition: video_shader_parse.h:162
enum rarch_shader_type type
Definition: video_shader_parse.h:145
Definition: video_shader_parse.h:86
struct video_shader_lut lut[GFX_MAX_TEXTURES]
Definition: video_shader_parse.h:166
float step
Definition: video_shader_parse.h:107
char * vertex
Definition: video_shader_parse.h:118
void video_shader_resolve_relative(struct video_shader *shader, const char *ref_path)
Definition: video_shader_parse.c:1307
Definition: video_shader_parse.h:57
unsigned passes
Definition: video_shader_parse.h:155
unsigned filter
Definition: video_shader_parse.h:138
Definition: video_shader_parse.h:132
Definition: video_shader_parse.h:53
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
enum gfx_wrap_type wrap
Definition: video_shader_parse.h:125
Definition: video_shader_parse.h:111
bool fp_fbo
Definition: video_shader_parse.h:92
bool modern
Definition: video_shader_parse.h:153
Definition: config_file.h:55
unsigned luts
Definition: video_shader_parse.h:156
Definition: video_shader_parse.h:82
Definition: video_shader_parse.h:70
char prefix[64]
Definition: video_shader_parse.h:147
bool video_shader_read_conf_cgp(config_file_t *conf, struct video_shader *shader)
Definition: video_shader_parse.c:718
float maximum
Definition: video_shader_parse.h:106
bool mipmap
Definition: video_shader_parse.h:137
bool video_shader_resolve_parameters(config_file_t *conf, struct video_shader *shader)
Definition: video_shader_parse.c:489
float minimum
Definition: video_shader_parse.h:104
unsigned abs_x
Definition: video_shader_parse.h:95
struct video_shader_pass::@700::@701 string
char * script
Definition: video_shader_parse.h:151
char script_class[512]
Definition: video_shader_parse.h:148
unsigned variables
Definition: video_shader_parse.h:158
struct video_shader_parameter parameters[GFX_MAX_PARAMETERS]
Definition: video_shader_parse.h:168
unsigned num_parameters
Definition: video_shader_parse.h:157
gfx_wrap_type
Definition: video_shader_parse.h:75
struct video_shader_pass pass[GFX_MAX_SHADERS]
Definition: video_shader_parse.h:164
#define GFX_MAX_PARAMETERS
Definition: video_shader_parse.h:42
#define GFX_MAX_SHADERS
Definition: video_shader_parse.h:30
enum gfx_scale_type type_y
Definition: video_shader_parse.h:89
Definition: video_state_tracker.h:45
bool srgb_fbo
Definition: video_shader_parse.h:93
bool video_shader_any_supported(void)
Definition: video_shader_parse.c:1122
bool mipmap
Definition: video_shader_parse.h:126
Definition: video_shader_parse.h:77
bool valid
Definition: video_shader_parse.h:94
Definition: video_shader_parse.h:64