ScummVM API documentation
types.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BACKENDS_GRAPHICS_OPENGL_PIPELINES_LIBRETRO_TYPES_H
23 #define BACKENDS_GRAPHICS_OPENGL_PIPELINES_LIBRETRO_TYPES_H
24 
25 #include "graphics/opengl/system_headers.h"
26 #include "backends/graphics/opengl/texture.h"
27 
28 #if !USE_FORCED_GLES
29 #include "common/str.h"
30 #include "common/array.h"
31 #include "common/fs.h"
32 
33 namespace OpenGL {
34 namespace LibRetro {
35 
37 
38 enum FilteringMode {
39  kFilteringModeUnspecified,
40  kFilteringModeNearest,
41  kFilteringModeLinear
42 };
43 
44 struct ShaderTexture {
45  ShaderTexture() : id(), fileName(), filteringMode(kFilteringModeUnspecified) {}
46  ShaderTexture(const Common::String &i, const Common::String &fN, FilteringMode fM, WrapMode wM)
47  : id(i), fileName(fN), filteringMode(fM), wrapMode(wM) {}
48 
49  Common::String id;
50  Common::String fileName;
51  FilteringMode filteringMode;
52  WrapMode wrapMode;
53 };
54 
55 enum ScaleType {
56  kScaleTypeSource,
57  kScaleTypeViewport,
58  kScaleTypeAbsolute,
59  kScaleTypeFull
60 };
61 
62 inline void applyScale(const ScaleType type,
63  const float source, const float viewport,
64  const float scaleFloat, const uint scaleUint,
65  float *output) {
66  switch (type) {
67  case kScaleTypeSource:
68  *output = source * scaleFloat;
69  break;
70 
71  case kScaleTypeViewport:
72  *output = viewport * scaleFloat;
73  break;
74 
75  case kScaleTypeAbsolute:
76  *output = scaleUint;
77  break;
78 
79  case kScaleTypeFull:
80  *output = viewport;
81  break;
82  }
83 }
84 
85 struct ShaderPass {
86  Common::String fileName;
87  Common::String alias;
88 
89  FilteringMode filteringMode;
90  WrapMode wrapMode;
91  bool mipmapInput;
92 
93  bool floatFBO;
94  bool srgbFBO;
95 
96  uint frameCountMod;
97 
98  ScaleType scaleTypeX;
99  ScaleType scaleTypeY;
100 
101  float scaleXFloat;
102  float scaleYFloat;
103 
104  uint scaleXUint;
105  uint scaleYUint;
106 
107  void applyScale(const float sourceW, const float sourceH,
108  const float viewportW, const float viewportH,
109  float *outputW, float *outputH) const {
110  OpenGL::LibRetro::applyScale(scaleTypeX, sourceW, viewportW, scaleXFloat, scaleXUint, outputW);
111  OpenGL::LibRetro::applyScale(scaleTypeY, sourceH, viewportH, scaleYFloat, scaleYUint, outputH);
112  }
113 };
114 
115 struct ShaderPreset {
116  Common::Archive *container;
117  Common::Path basePath;
118 
120  TextureArray textures;
121 
123  PassArray passes;
124 
125  UniformsMap parameters;
126 };
127 
128 } // End of namespace LibRetro
129 } // End of namespace OpenGL
130 #endif // !USE_FORCED_GLES
131 
132 #endif
Definition: str.h:59
Definition: path.h:52
Definition: archive.h:141
Definition: types.h:85
Definition: types.h:44
Definition: renderbuffer.h:27
Definition: types.h:115