noobs 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYING +339 -0
- package/README.md +46 -0
- package/bin/64bit/obs.lib +0 -0
- package/binding.gyp +23 -0
- package/dist/bin/Qt6Core.dll +0 -0
- package/dist/bin/Qt6Gui.dll +0 -0
- package/dist/bin/Qt6Network.dll +0 -0
- package/dist/bin/Qt6Svg.dll +0 -0
- package/dist/bin/Qt6Widgets.dll +0 -0
- package/dist/bin/Qt6Xml.dll +0 -0
- package/dist/bin/avcodec-61.dll +0 -0
- package/dist/bin/avdevice-61.dll +0 -0
- package/dist/bin/avfilter-10.dll +0 -0
- package/dist/bin/avformat-61.dll +0 -0
- package/dist/bin/avutil-59.dll +0 -0
- package/dist/bin/datachannel.dll +0 -0
- package/dist/bin/libcurl.dll +0 -0
- package/dist/bin/libobs-d3d11.dll +0 -0
- package/dist/bin/libobs-opengl.dll +0 -0
- package/dist/bin/libobs-winrt.dll +0 -0
- package/dist/bin/librist.dll +0 -0
- package/dist/bin/libx264-164.dll +0 -0
- package/dist/bin/lua51.dll +0 -0
- package/dist/bin/obs-amf-test.exe +0 -0
- package/dist/bin/obs-ffmpeg-mux.exe +0 -0
- package/dist/bin/obs-frontend-api.dll +0 -0
- package/dist/bin/obs-scripting.dll +0 -0
- package/dist/bin/obs.dll +0 -0
- package/dist/bin/srt.dll +0 -0
- package/dist/bin/swresample-5.dll +0 -0
- package/dist/bin/swscale-8.dll +0 -0
- package/dist/bin/w32-pthreads.dll +0 -0
- package/dist/bin/zlib.dll +0 -0
- package/dist/effects/area.effect +250 -0
- package/dist/effects/bicubic_scale.effect +236 -0
- package/dist/effects/bilinear_lowres_scale.effect +123 -0
- package/dist/effects/color.effect +172 -0
- package/dist/effects/default.effect +254 -0
- package/dist/effects/default_rect.effect +84 -0
- package/dist/effects/deinterlace_base.effect +325 -0
- package/dist/effects/deinterlace_blend.effect +21 -0
- package/dist/effects/deinterlace_blend_2x.effect +21 -0
- package/dist/effects/deinterlace_discard.effect +21 -0
- package/dist/effects/deinterlace_discard_2x.effect +21 -0
- package/dist/effects/deinterlace_linear.effect +21 -0
- package/dist/effects/deinterlace_linear_2x.effect +21 -0
- package/dist/effects/deinterlace_yadif.effect +21 -0
- package/dist/effects/deinterlace_yadif_2x.effect +21 -0
- package/dist/effects/format_conversion.effect +1823 -0
- package/dist/effects/lanczos_scale.effect +292 -0
- package/dist/effects/opaque.effect +159 -0
- package/dist/effects/premultiplied_alpha.effect +38 -0
- package/dist/effects/repeat.effect +36 -0
- package/dist/effects/solid.effect +80 -0
- package/dist/noobs.node +0 -0
- package/dist/plugins/obs-ffmpeg.dll +0 -0
- package/dist/plugins/obs-x264.dll +0 -0
- package/dist/plugins/win-capture.dll +0 -0
- package/include/audio-monitoring/osx/mac-helpers.h +13 -0
- package/include/audio-monitoring/pulse/pulseaudio-wrapper.h +212 -0
- package/include/audio-monitoring/win32/wasapi-output.h +22 -0
- package/include/callback/calldata.h +195 -0
- package/include/callback/decl.h +61 -0
- package/include/callback/proc.h +52 -0
- package/include/callback/signal.h +73 -0
- package/include/graphics/axisang.h +65 -0
- package/include/graphics/bounds.h +108 -0
- package/include/graphics/device-exports.h +177 -0
- package/include/graphics/effect-parser.h +290 -0
- package/include/graphics/effect.h +190 -0
- package/include/graphics/graphics-internal.h +335 -0
- package/include/graphics/graphics.h +1024 -0
- package/include/graphics/half.h +100 -0
- package/include/graphics/image-file.h +124 -0
- package/include/graphics/input.h +34 -0
- package/include/graphics/libnsgif/libnsgif.h +142 -0
- package/include/graphics/math-defs.h +45 -0
- package/include/graphics/math-extra.h +61 -0
- package/include/graphics/matrix3.h +98 -0
- package/include/graphics/matrix4.h +102 -0
- package/include/graphics/plane.h +85 -0
- package/include/graphics/quat.h +170 -0
- package/include/graphics/shader-parser.h +273 -0
- package/include/graphics/srgb.h +177 -0
- package/include/graphics/vec2.h +148 -0
- package/include/graphics/vec3.h +224 -0
- package/include/graphics/vec4.h +241 -0
- package/include/media-io/audio-io.h +228 -0
- package/include/media-io/audio-math.h +43 -0
- package/include/media-io/audio-resampler.h +44 -0
- package/include/media-io/format-conversion.h +50 -0
- package/include/media-io/frame-rate.h +29 -0
- package/include/media-io/media-io-defs.h +20 -0
- package/include/media-io/media-remux.h +37 -0
- package/include/media-io/video-frame.h +64 -0
- package/include/media-io/video-io.h +338 -0
- package/include/media-io/video-scaler.h +43 -0
- package/include/obs-audio-controls.h +250 -0
- package/include/obs-av1.h +47 -0
- package/include/obs-avc.h +55 -0
- package/include/obs-config.h +52 -0
- package/include/obs-data.h +311 -0
- package/include/obs-defs.h +52 -0
- package/include/obs-encoder.h +361 -0
- package/include/obs-ffmpeg-compat.h +13 -0
- package/include/obs-hevc.h +81 -0
- package/include/obs-hotkey.h +271 -0
- package/include/obs-hotkeys.h +653 -0
- package/include/obs-interaction.h +56 -0
- package/include/obs-internal.h +1459 -0
- package/include/obs-missing-files.h +53 -0
- package/include/obs-module.h +181 -0
- package/include/obs-nal.h +37 -0
- package/include/obs-nix-platform.h +53 -0
- package/include/obs-nix-wayland.h +24 -0
- package/include/obs-nix-x11.h +22 -0
- package/include/obs-nix.h +42 -0
- package/include/obs-output.h +96 -0
- package/include/obs-properties.h +364 -0
- package/include/obs-scene.h +127 -0
- package/include/obs-service.h +115 -0
- package/include/obs-source.h +568 -0
- package/include/obs.h +2608 -0
- package/include/obsconfig.h +13 -0
- package/include/obsversion.h +5 -0
- package/include/util/apple/cfstring-utils.h +16 -0
- package/include/util/array-serializer.h +37 -0
- package/include/util/base.h +97 -0
- package/include/util/bitstream.h +28 -0
- package/include/util/bmem.h +94 -0
- package/include/util/buffered-file-serializer.h +32 -0
- package/include/util/c99defs.h +75 -0
- package/include/util/cf-lexer.h +199 -0
- package/include/util/cf-parser.h +281 -0
- package/include/util/circlebuf.h +319 -0
- package/include/util/config-file.h +103 -0
- package/include/util/crc32.h +29 -0
- package/include/util/curl/curl-helper.h +35 -0
- package/include/util/darray.h +606 -0
- package/include/util/deque.h +319 -0
- package/include/util/dstr.h +320 -0
- package/include/util/file-serializer.h +34 -0
- package/include/util/lexer.h +273 -0
- package/include/util/pipe.h +52 -0
- package/include/util/platform.h +223 -0
- package/include/util/profiler.h +97 -0
- package/include/util/serializer.h +158 -0
- package/include/util/simde/check.h +285 -0
- package/include/util/simde/debug-trap.h +117 -0
- package/include/util/simde/hedley.h +2123 -0
- package/include/util/simde/simde-align.h +481 -0
- package/include/util/simde/simde-arch.h +537 -0
- package/include/util/simde/simde-common.h +918 -0
- package/include/util/simde/simde-constify.h +925 -0
- package/include/util/simde/simde-detect-clang.h +114 -0
- package/include/util/simde/simde-diagnostic.h +447 -0
- package/include/util/simde/simde-features.h +550 -0
- package/include/util/simde/simde-math.h +1858 -0
- package/include/util/simde/x86/mmx.h +2456 -0
- package/include/util/simde/x86/sse.h +4479 -0
- package/include/util/simde/x86/sse2.h +7549 -0
- package/include/util/source-profiler.h +66 -0
- package/include/util/sse-intrin.h +32 -0
- package/include/util/task.h +22 -0
- package/include/util/text-lookup.h +45 -0
- package/include/util/threading-posix.h +77 -0
- package/include/util/threading-windows.h +142 -0
- package/include/util/threading.h +103 -0
- package/include/util/utf8.h +35 -0
- package/include/util/uthash.h +34 -0
- package/include/util/util_uint128.h +108 -0
- package/include/util/util_uint64.h +34 -0
- package/include/util/windows/device-enum.h +14 -0
- package/include/util/windows/obfuscate.h +16 -0
- package/include/util/windows/win-registry.h +37 -0
- package/include/util/windows/win-version.h +57 -0
- package/include/util/windows/window-helpers.h +47 -0
- package/index.d.ts +38 -0
- package/index.js +8 -0
- package/package.json +31 -0
- package/src/main.cpp +321 -0
- package/src/obs_interface.cpp +605 -0
- package/src/obs_interface.h +74 -0
- package/src/utils.cpp +80 -0
- package/src/utils.h +3 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "effect-parser.h"
|
|
21
|
+
#include "graphics.h"
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
typedef DARRAY(struct gs_effect_param) gs_effect_param_array_t;
|
|
28
|
+
typedef DARRAY(struct pass_shaderparam) pass_shaderparam_array_t;
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* Effects introduce a means of bundling together shader text into one
|
|
32
|
+
* file with shared functions and parameters. This is done because often
|
|
33
|
+
* shaders must be duplicated when you need to alter minor aspects of the code
|
|
34
|
+
* that cannot be done via constants. Effects allow developers to easily
|
|
35
|
+
* switch shaders and set constants that can be used between shaders.
|
|
36
|
+
*
|
|
37
|
+
* Effects are built via the effect parser, and shaders are automatically
|
|
38
|
+
* generated for each technique's pass.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/* ------------------------------------------------------------------------- */
|
|
42
|
+
|
|
43
|
+
enum effect_section { EFFECT_PARAM, EFFECT_TECHNIQUE, EFFECT_SAMPLER, EFFECT_PASS, EFFECT_ANNOTATION };
|
|
44
|
+
|
|
45
|
+
/* ------------------------------------------------------------------------- */
|
|
46
|
+
|
|
47
|
+
struct gs_effect_param {
|
|
48
|
+
char *name;
|
|
49
|
+
enum effect_section section;
|
|
50
|
+
|
|
51
|
+
enum gs_shader_param_type type;
|
|
52
|
+
|
|
53
|
+
bool changed;
|
|
54
|
+
DARRAY(uint8_t) cur_val;
|
|
55
|
+
DARRAY(uint8_t) default_val;
|
|
56
|
+
|
|
57
|
+
gs_effect_t *effect;
|
|
58
|
+
gs_samplerstate_t *next_sampler;
|
|
59
|
+
|
|
60
|
+
/*char *full_name;
|
|
61
|
+
float scroller_min, scroller_max, scroller_inc, scroller_mul;*/
|
|
62
|
+
gs_effect_param_array_t annotations;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
static inline void effect_param_init(struct gs_effect_param *param)
|
|
66
|
+
{
|
|
67
|
+
memset(param, 0, sizeof(struct gs_effect_param));
|
|
68
|
+
da_init(param->annotations);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static inline void effect_param_free(struct gs_effect_param *param)
|
|
72
|
+
{
|
|
73
|
+
bfree(param->name);
|
|
74
|
+
//bfree(param->full_name);
|
|
75
|
+
da_free(param->cur_val);
|
|
76
|
+
da_free(param->default_val);
|
|
77
|
+
|
|
78
|
+
size_t i;
|
|
79
|
+
for (i = 0; i < param->annotations.num; i++)
|
|
80
|
+
effect_param_free(param->annotations.array + i);
|
|
81
|
+
|
|
82
|
+
da_free(param->annotations);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
EXPORT void effect_param_parse_property(gs_eparam_t *param, const char *property);
|
|
86
|
+
|
|
87
|
+
/* ------------------------------------------------------------------------- */
|
|
88
|
+
|
|
89
|
+
struct pass_shaderparam {
|
|
90
|
+
struct gs_effect_param *eparam;
|
|
91
|
+
gs_sparam_t *sparam;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
struct gs_effect_pass {
|
|
95
|
+
char *name;
|
|
96
|
+
enum effect_section section;
|
|
97
|
+
|
|
98
|
+
gs_shader_t *vertshader;
|
|
99
|
+
gs_shader_t *pixelshader;
|
|
100
|
+
pass_shaderparam_array_t vertshader_params;
|
|
101
|
+
pass_shaderparam_array_t pixelshader_params;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
static inline void effect_pass_init(struct gs_effect_pass *pass)
|
|
105
|
+
{
|
|
106
|
+
memset(pass, 0, sizeof(struct gs_effect_pass));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static inline void effect_pass_free(struct gs_effect_pass *pass)
|
|
110
|
+
{
|
|
111
|
+
bfree(pass->name);
|
|
112
|
+
da_free(pass->vertshader_params);
|
|
113
|
+
da_free(pass->pixelshader_params);
|
|
114
|
+
|
|
115
|
+
gs_shader_destroy(pass->vertshader);
|
|
116
|
+
gs_shader_destroy(pass->pixelshader);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* ------------------------------------------------------------------------- */
|
|
120
|
+
|
|
121
|
+
struct gs_effect_technique {
|
|
122
|
+
char *name;
|
|
123
|
+
enum effect_section section;
|
|
124
|
+
struct gs_effect *effect;
|
|
125
|
+
|
|
126
|
+
DARRAY(struct gs_effect_pass) passes;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
static inline void effect_technique_init(struct gs_effect_technique *t)
|
|
130
|
+
{
|
|
131
|
+
memset(t, 0, sizeof(struct gs_effect_technique));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static inline void effect_technique_free(struct gs_effect_technique *t)
|
|
135
|
+
{
|
|
136
|
+
size_t i;
|
|
137
|
+
for (i = 0; i < t->passes.num; i++)
|
|
138
|
+
effect_pass_free(t->passes.array + i);
|
|
139
|
+
|
|
140
|
+
da_free(t->passes);
|
|
141
|
+
bfree(t->name);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* ------------------------------------------------------------------------- */
|
|
145
|
+
|
|
146
|
+
struct gs_effect {
|
|
147
|
+
bool processing;
|
|
148
|
+
bool cached;
|
|
149
|
+
char *effect_path, *effect_dir;
|
|
150
|
+
|
|
151
|
+
gs_effect_param_array_t params;
|
|
152
|
+
DARRAY(struct gs_effect_technique) techniques;
|
|
153
|
+
|
|
154
|
+
struct gs_effect_technique *cur_technique;
|
|
155
|
+
struct gs_effect_pass *cur_pass;
|
|
156
|
+
|
|
157
|
+
gs_eparam_t *view_proj, *world, *scale;
|
|
158
|
+
graphics_t *graphics;
|
|
159
|
+
|
|
160
|
+
struct gs_effect *next;
|
|
161
|
+
|
|
162
|
+
size_t loop_pass;
|
|
163
|
+
bool looping;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
static inline void effect_init(gs_effect_t *effect)
|
|
167
|
+
{
|
|
168
|
+
memset(effect, 0, sizeof(struct gs_effect));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static inline void effect_free(gs_effect_t *effect)
|
|
172
|
+
{
|
|
173
|
+
size_t i;
|
|
174
|
+
for (i = 0; i < effect->params.num; i++)
|
|
175
|
+
effect_param_free(effect->params.array + i);
|
|
176
|
+
for (i = 0; i < effect->techniques.num; i++)
|
|
177
|
+
effect_technique_free(effect->techniques.array + i);
|
|
178
|
+
|
|
179
|
+
da_free(effect->params);
|
|
180
|
+
da_free(effect->techniques);
|
|
181
|
+
|
|
182
|
+
bfree(effect->effect_path);
|
|
183
|
+
bfree(effect->effect_dir);
|
|
184
|
+
effect->effect_path = NULL;
|
|
185
|
+
effect->effect_dir = NULL;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
#ifdef __cplusplus
|
|
189
|
+
}
|
|
190
|
+
#endif
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "../util/threading.h"
|
|
21
|
+
#include "../util/darray.h"
|
|
22
|
+
#include "graphics.h"
|
|
23
|
+
#include "matrix3.h"
|
|
24
|
+
#include "matrix4.h"
|
|
25
|
+
|
|
26
|
+
/* ========================================================================= *
|
|
27
|
+
* Exports *
|
|
28
|
+
* ========================================================================= */
|
|
29
|
+
|
|
30
|
+
struct gs_exports {
|
|
31
|
+
const char *(*device_get_name)(void);
|
|
32
|
+
const char *(*gpu_get_driver_version)(void);
|
|
33
|
+
const char *(*gpu_get_renderer)(void);
|
|
34
|
+
uint64_t (*gpu_get_dmem)(void);
|
|
35
|
+
uint64_t (*gpu_get_smem)(void);
|
|
36
|
+
int (*device_get_type)(void);
|
|
37
|
+
bool (*device_enum_adapters)(gs_device_t *device, bool (*callback)(void *, const char *, uint32_t), void *);
|
|
38
|
+
const char *(*device_preprocessor_name)(void);
|
|
39
|
+
int (*device_create)(gs_device_t **device, uint32_t adapter);
|
|
40
|
+
void (*device_destroy)(gs_device_t *device);
|
|
41
|
+
void (*device_enter_context)(gs_device_t *device);
|
|
42
|
+
void (*device_leave_context)(gs_device_t *device);
|
|
43
|
+
void *(*device_get_device_obj)(gs_device_t *device);
|
|
44
|
+
gs_swapchain_t *(*device_swapchain_create)(gs_device_t *device, const struct gs_init_data *data);
|
|
45
|
+
void (*device_resize)(gs_device_t *device, uint32_t x, uint32_t y);
|
|
46
|
+
enum gs_color_space (*device_get_color_space)(gs_device_t *device);
|
|
47
|
+
void (*device_update_color_space)(gs_device_t *device);
|
|
48
|
+
void (*device_get_size)(const gs_device_t *device, uint32_t *x, uint32_t *y);
|
|
49
|
+
uint32_t (*device_get_width)(const gs_device_t *device);
|
|
50
|
+
uint32_t (*device_get_height)(const gs_device_t *device);
|
|
51
|
+
gs_texture_t *(*device_texture_create)(gs_device_t *device, uint32_t width, uint32_t height,
|
|
52
|
+
enum gs_color_format color_format, uint32_t levels, const uint8_t **data,
|
|
53
|
+
uint32_t flags);
|
|
54
|
+
gs_texture_t *(*device_cubetexture_create)(gs_device_t *device, uint32_t size,
|
|
55
|
+
enum gs_color_format color_format, uint32_t levels,
|
|
56
|
+
const uint8_t **data, uint32_t flags);
|
|
57
|
+
gs_texture_t *(*device_voltexture_create)(gs_device_t *device, uint32_t width, uint32_t height, uint32_t depth,
|
|
58
|
+
enum gs_color_format color_format, uint32_t levels,
|
|
59
|
+
const uint8_t *const *data, uint32_t flags);
|
|
60
|
+
gs_zstencil_t *(*device_zstencil_create)(gs_device_t *device, uint32_t width, uint32_t height,
|
|
61
|
+
enum gs_zstencil_format format);
|
|
62
|
+
gs_stagesurf_t *(*device_stagesurface_create)(gs_device_t *device, uint32_t width, uint32_t height,
|
|
63
|
+
enum gs_color_format color_format);
|
|
64
|
+
gs_samplerstate_t *(*device_samplerstate_create)(gs_device_t *device, const struct gs_sampler_info *info);
|
|
65
|
+
gs_shader_t *(*device_vertexshader_create)(gs_device_t *device, const char *shader, const char *file,
|
|
66
|
+
char **error_string);
|
|
67
|
+
gs_shader_t *(*device_pixelshader_create)(gs_device_t *device, const char *shader, const char *file,
|
|
68
|
+
char **error_string);
|
|
69
|
+
gs_vertbuffer_t *(*device_vertexbuffer_create)(gs_device_t *device, struct gs_vb_data *data, uint32_t flags);
|
|
70
|
+
gs_indexbuffer_t *(*device_indexbuffer_create)(gs_device_t *device, enum gs_index_type type, void *indices,
|
|
71
|
+
size_t num, uint32_t flags);
|
|
72
|
+
gs_timer_t *(*device_timer_create)(gs_device_t *device);
|
|
73
|
+
gs_timer_range_t *(*device_timer_range_create)(gs_device_t *device);
|
|
74
|
+
enum gs_texture_type (*device_get_texture_type)(const gs_texture_t *texture);
|
|
75
|
+
void (*device_load_vertexbuffer)(gs_device_t *device, gs_vertbuffer_t *vertbuffer);
|
|
76
|
+
void (*device_load_indexbuffer)(gs_device_t *device, gs_indexbuffer_t *indexbuffer);
|
|
77
|
+
void (*device_load_texture)(gs_device_t *device, gs_texture_t *tex, int unit);
|
|
78
|
+
void (*device_load_samplerstate)(gs_device_t *device, gs_samplerstate_t *samplerstate, int unit);
|
|
79
|
+
void (*device_load_vertexshader)(gs_device_t *device, gs_shader_t *vertshader);
|
|
80
|
+
void (*device_load_pixelshader)(gs_device_t *device, gs_shader_t *pixelshader);
|
|
81
|
+
void (*device_load_default_samplerstate)(gs_device_t *device, bool b_3d, int unit);
|
|
82
|
+
gs_shader_t *(*device_get_vertex_shader)(const gs_device_t *device);
|
|
83
|
+
gs_shader_t *(*device_get_pixel_shader)(const gs_device_t *device);
|
|
84
|
+
gs_texture_t *(*device_get_render_target)(const gs_device_t *device);
|
|
85
|
+
gs_zstencil_t *(*device_get_zstencil_target)(const gs_device_t *device);
|
|
86
|
+
void (*device_set_render_target)(gs_device_t *device, gs_texture_t *tex, gs_zstencil_t *zstencil);
|
|
87
|
+
void (*device_set_render_target_with_color_space)(gs_device_t *device, gs_texture_t *tex,
|
|
88
|
+
gs_zstencil_t *zstencil, enum gs_color_space space);
|
|
89
|
+
void (*device_set_cube_render_target)(gs_device_t *device, gs_texture_t *cubetex, int side,
|
|
90
|
+
gs_zstencil_t *zstencil);
|
|
91
|
+
void (*device_enable_framebuffer_srgb)(gs_device_t *device, bool enable);
|
|
92
|
+
bool (*device_framebuffer_srgb_enabled)(gs_device_t *device);
|
|
93
|
+
void (*device_copy_texture)(gs_device_t *device, gs_texture_t *dst, gs_texture_t *src);
|
|
94
|
+
void (*device_copy_texture_region)(gs_device_t *device, gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
|
|
95
|
+
gs_texture_t *src, uint32_t src_x, uint32_t src_y, uint32_t src_w,
|
|
96
|
+
uint32_t src_h);
|
|
97
|
+
void (*device_stage_texture)(gs_device_t *device, gs_stagesurf_t *dst, gs_texture_t *src);
|
|
98
|
+
void (*device_begin_frame)(gs_device_t *device);
|
|
99
|
+
void (*device_begin_scene)(gs_device_t *device);
|
|
100
|
+
void (*device_draw)(gs_device_t *device, enum gs_draw_mode draw_mode, uint32_t start_vert, uint32_t num_verts);
|
|
101
|
+
void (*device_end_scene)(gs_device_t *device);
|
|
102
|
+
void (*device_load_swapchain)(gs_device_t *device, gs_swapchain_t *swaphchain);
|
|
103
|
+
void (*device_clear)(gs_device_t *device, uint32_t clear_flags, const struct vec4 *color, float depth,
|
|
104
|
+
uint8_t stencil);
|
|
105
|
+
bool (*device_is_present_ready)(gs_device_t *device);
|
|
106
|
+
void (*device_present)(gs_device_t *device);
|
|
107
|
+
void (*device_flush)(gs_device_t *device);
|
|
108
|
+
void (*device_set_cull_mode)(gs_device_t *device, enum gs_cull_mode mode);
|
|
109
|
+
enum gs_cull_mode (*device_get_cull_mode)(const gs_device_t *device);
|
|
110
|
+
void (*device_enable_blending)(gs_device_t *device, bool enable);
|
|
111
|
+
void (*device_enable_depth_test)(gs_device_t *device, bool enable);
|
|
112
|
+
void (*device_enable_stencil_test)(gs_device_t *device, bool enable);
|
|
113
|
+
void (*device_enable_stencil_write)(gs_device_t *device, bool enable);
|
|
114
|
+
void (*device_enable_color)(gs_device_t *device, bool red, bool green, bool blue, bool alpha);
|
|
115
|
+
void (*device_blend_function)(gs_device_t *device, enum gs_blend_type src, enum gs_blend_type dest);
|
|
116
|
+
void (*device_blend_function_separate)(gs_device_t *device, enum gs_blend_type src_c, enum gs_blend_type dest_c,
|
|
117
|
+
enum gs_blend_type src_a, enum gs_blend_type dest_a);
|
|
118
|
+
void (*device_blend_op)(gs_device_t *device, enum gs_blend_op_type op);
|
|
119
|
+
|
|
120
|
+
void (*device_depth_function)(gs_device_t *device, enum gs_depth_test test);
|
|
121
|
+
void (*device_stencil_function)(gs_device_t *device, enum gs_stencil_side side, enum gs_depth_test test);
|
|
122
|
+
void (*device_stencil_op)(gs_device_t *device, enum gs_stencil_side side, enum gs_stencil_op_type fail,
|
|
123
|
+
enum gs_stencil_op_type zfail, enum gs_stencil_op_type zpass);
|
|
124
|
+
void (*device_set_viewport)(gs_device_t *device, int x, int y, int width, int height);
|
|
125
|
+
void (*device_get_viewport)(const gs_device_t *device, struct gs_rect *rect);
|
|
126
|
+
void (*device_set_scissor_rect)(gs_device_t *device, const struct gs_rect *rect);
|
|
127
|
+
void (*device_ortho)(gs_device_t *device, float left, float right, float top, float bottom, float znear,
|
|
128
|
+
float zfar);
|
|
129
|
+
void (*device_frustum)(gs_device_t *device, float left, float right, float top, float bottom, float znear,
|
|
130
|
+
float zfar);
|
|
131
|
+
void (*device_projection_push)(gs_device_t *device);
|
|
132
|
+
void (*device_projection_pop)(gs_device_t *device);
|
|
133
|
+
|
|
134
|
+
void (*gs_swapchain_destroy)(gs_swapchain_t *swapchain);
|
|
135
|
+
|
|
136
|
+
void (*gs_texture_destroy)(gs_texture_t *tex);
|
|
137
|
+
uint32_t (*gs_texture_get_width)(const gs_texture_t *tex);
|
|
138
|
+
uint32_t (*gs_texture_get_height)(const gs_texture_t *tex);
|
|
139
|
+
enum gs_color_format (*gs_texture_get_color_format)(const gs_texture_t *tex);
|
|
140
|
+
bool (*gs_texture_map)(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize);
|
|
141
|
+
void (*gs_texture_unmap)(gs_texture_t *tex);
|
|
142
|
+
bool (*gs_texture_is_rect)(const gs_texture_t *tex);
|
|
143
|
+
void *(*gs_texture_get_obj)(const gs_texture_t *tex);
|
|
144
|
+
|
|
145
|
+
void (*gs_cubetexture_destroy)(gs_texture_t *cubetex);
|
|
146
|
+
uint32_t (*gs_cubetexture_get_size)(const gs_texture_t *cubetex);
|
|
147
|
+
enum gs_color_format (*gs_cubetexture_get_color_format)(const gs_texture_t *cubetex);
|
|
148
|
+
|
|
149
|
+
void (*gs_voltexture_destroy)(gs_texture_t *voltex);
|
|
150
|
+
uint32_t (*gs_voltexture_get_width)(const gs_texture_t *voltex);
|
|
151
|
+
uint32_t (*gs_voltexture_get_height)(const gs_texture_t *voltex);
|
|
152
|
+
uint32_t (*gs_voltexture_get_depth)(const gs_texture_t *voltex);
|
|
153
|
+
enum gs_color_format (*gs_voltexture_get_color_format)(const gs_texture_t *voltex);
|
|
154
|
+
|
|
155
|
+
void (*gs_stagesurface_destroy)(gs_stagesurf_t *stagesurf);
|
|
156
|
+
uint32_t (*gs_stagesurface_get_width)(const gs_stagesurf_t *stagesurf);
|
|
157
|
+
uint32_t (*gs_stagesurface_get_height)(const gs_stagesurf_t *stagesurf);
|
|
158
|
+
enum gs_color_format (*gs_stagesurface_get_color_format)(const gs_stagesurf_t *stagesurf);
|
|
159
|
+
bool (*gs_stagesurface_map)(gs_stagesurf_t *stagesurf, uint8_t **data, uint32_t *linesize);
|
|
160
|
+
void (*gs_stagesurface_unmap)(gs_stagesurf_t *stagesurf);
|
|
161
|
+
|
|
162
|
+
void (*gs_zstencil_destroy)(gs_zstencil_t *zstencil);
|
|
163
|
+
|
|
164
|
+
void (*gs_samplerstate_destroy)(gs_samplerstate_t *samplerstate);
|
|
165
|
+
|
|
166
|
+
void (*gs_vertexbuffer_destroy)(gs_vertbuffer_t *vertbuffer);
|
|
167
|
+
void (*gs_vertexbuffer_flush)(gs_vertbuffer_t *vertbuffer);
|
|
168
|
+
void (*gs_vertexbuffer_flush_direct)(gs_vertbuffer_t *vertbuffer, const struct gs_vb_data *data);
|
|
169
|
+
struct gs_vb_data *(*gs_vertexbuffer_get_data)(const gs_vertbuffer_t *vertbuffer);
|
|
170
|
+
|
|
171
|
+
void (*gs_indexbuffer_destroy)(gs_indexbuffer_t *indexbuffer);
|
|
172
|
+
void (*gs_indexbuffer_flush)(gs_indexbuffer_t *indexbuffer);
|
|
173
|
+
void (*gs_indexbuffer_flush_direct)(gs_indexbuffer_t *indexbuffer, const void *data);
|
|
174
|
+
void *(*gs_indexbuffer_get_data)(const gs_indexbuffer_t *indexbuffer);
|
|
175
|
+
size_t (*gs_indexbuffer_get_num_indices)(const gs_indexbuffer_t *indexbuffer);
|
|
176
|
+
enum gs_index_type (*gs_indexbuffer_get_type)(const gs_indexbuffer_t *indexbuffer);
|
|
177
|
+
|
|
178
|
+
void (*gs_timer_destroy)(gs_timer_t *timer);
|
|
179
|
+
void (*gs_timer_begin)(gs_timer_t *timer);
|
|
180
|
+
void (*gs_timer_end)(gs_timer_t *timer);
|
|
181
|
+
bool (*gs_timer_get_data)(gs_timer_t *timer, uint64_t *ticks);
|
|
182
|
+
void (*gs_timer_range_destroy)(gs_timer_range_t *range);
|
|
183
|
+
bool (*gs_timer_range_begin)(gs_timer_range_t *range);
|
|
184
|
+
bool (*gs_timer_range_end)(gs_timer_range_t *range);
|
|
185
|
+
bool (*gs_timer_range_get_data)(gs_timer_range_t *range, bool *disjoint, uint64_t *frequency);
|
|
186
|
+
|
|
187
|
+
void (*gs_shader_destroy)(gs_shader_t *shader);
|
|
188
|
+
int (*gs_shader_get_num_params)(const gs_shader_t *shader);
|
|
189
|
+
gs_sparam_t *(*gs_shader_get_param_by_idx)(gs_shader_t *shader, uint32_t param);
|
|
190
|
+
gs_sparam_t *(*gs_shader_get_param_by_name)(gs_shader_t *shader, const char *name);
|
|
191
|
+
gs_sparam_t *(*gs_shader_get_viewproj_matrix)(const gs_shader_t *shader);
|
|
192
|
+
gs_sparam_t *(*gs_shader_get_world_matrix)(const gs_shader_t *shader);
|
|
193
|
+
void (*gs_shader_get_param_info)(const gs_sparam_t *param, struct gs_shader_param_info *info);
|
|
194
|
+
void (*gs_shader_set_bool)(gs_sparam_t *param, bool val);
|
|
195
|
+
void (*gs_shader_set_float)(gs_sparam_t *param, float val);
|
|
196
|
+
void (*gs_shader_set_int)(gs_sparam_t *param, int val);
|
|
197
|
+
void (*gs_shader_set_matrix3)(gs_sparam_t *param, const struct matrix3 *val);
|
|
198
|
+
void (*gs_shader_set_matrix4)(gs_sparam_t *param, const struct matrix4 *val);
|
|
199
|
+
void (*gs_shader_set_vec2)(gs_sparam_t *param, const struct vec2 *val);
|
|
200
|
+
void (*gs_shader_set_vec3)(gs_sparam_t *param, const struct vec3 *val);
|
|
201
|
+
void (*gs_shader_set_vec4)(gs_sparam_t *param, const struct vec4 *val);
|
|
202
|
+
void (*gs_shader_set_texture)(gs_sparam_t *param, gs_texture_t *val);
|
|
203
|
+
void (*gs_shader_set_val)(gs_sparam_t *param, const void *val, size_t size);
|
|
204
|
+
void (*gs_shader_set_default)(gs_sparam_t *param);
|
|
205
|
+
void (*gs_shader_set_next_sampler)(gs_sparam_t *param, gs_samplerstate_t *sampler);
|
|
206
|
+
|
|
207
|
+
bool (*device_nv12_available)(gs_device_t *device);
|
|
208
|
+
bool (*device_p010_available)(gs_device_t *device);
|
|
209
|
+
bool (*device_texture_create_nv12)(gs_device_t *device, gs_texture_t **tex_y, gs_texture_t **tex_uv,
|
|
210
|
+
uint32_t width, uint32_t height, uint32_t flags);
|
|
211
|
+
bool (*device_texture_create_p010)(gs_device_t *device, gs_texture_t **tex_y, gs_texture_t **tex_uv,
|
|
212
|
+
uint32_t width, uint32_t height, uint32_t flags);
|
|
213
|
+
|
|
214
|
+
bool (*device_is_monitor_hdr)(gs_device_t *device, void *monitor);
|
|
215
|
+
|
|
216
|
+
void (*device_debug_marker_begin)(gs_device_t *device, const char *markername, const float color[4]);
|
|
217
|
+
void (*device_debug_marker_end)(gs_device_t *device);
|
|
218
|
+
|
|
219
|
+
uint32_t (*gs_get_adapter_count)(void);
|
|
220
|
+
|
|
221
|
+
#ifdef __APPLE__
|
|
222
|
+
/* OSX/Cocoa specific functions */
|
|
223
|
+
gs_texture_t *(*device_texture_create_from_iosurface)(gs_device_t *dev, void *iosurf);
|
|
224
|
+
gs_texture_t *(*device_texture_open_shared)(gs_device_t *dev, uint32_t handle);
|
|
225
|
+
bool (*gs_texture_rebind_iosurface)(gs_texture_t *texture, void *iosurf);
|
|
226
|
+
bool (*device_shared_texture_available)(void);
|
|
227
|
+
|
|
228
|
+
#elif _WIN32
|
|
229
|
+
bool (*device_gdi_texture_available)(void);
|
|
230
|
+
bool (*device_shared_texture_available)(void);
|
|
231
|
+
|
|
232
|
+
bool (*device_get_duplicator_monitor_info)(gs_device_t *device, int monitor_idx,
|
|
233
|
+
struct gs_monitor_info *monitor_info);
|
|
234
|
+
int (*device_duplicator_get_monitor_index)(gs_device_t *device, void *monitor);
|
|
235
|
+
|
|
236
|
+
gs_duplicator_t *(*device_duplicator_create)(gs_device_t *device, int monitor_idx);
|
|
237
|
+
void (*gs_duplicator_destroy)(gs_duplicator_t *duplicator);
|
|
238
|
+
|
|
239
|
+
bool (*gs_duplicator_update_frame)(gs_duplicator_t *duplicator);
|
|
240
|
+
gs_texture_t *(*gs_duplicator_get_texture)(gs_duplicator_t *duplicator);
|
|
241
|
+
enum gs_color_space (*gs_duplicator_get_color_space)(gs_duplicator_t *duplicator);
|
|
242
|
+
float (*gs_duplicator_get_sdr_white_level)(gs_duplicator_t *duplicator);
|
|
243
|
+
|
|
244
|
+
bool (*device_can_adapter_fast_clear)(gs_device_t *device);
|
|
245
|
+
|
|
246
|
+
gs_texture_t *(*device_texture_create_gdi)(gs_device_t *device, uint32_t width, uint32_t height);
|
|
247
|
+
|
|
248
|
+
void *(*gs_texture_get_dc)(gs_texture_t *gdi_tex);
|
|
249
|
+
void (*gs_texture_release_dc)(gs_texture_t *gdi_tex);
|
|
250
|
+
|
|
251
|
+
gs_texture_t *(*device_texture_open_shared)(gs_device_t *device, uint32_t handle);
|
|
252
|
+
gs_texture_t *(*device_texture_open_nt_shared)(gs_device_t *device, uint32_t handle);
|
|
253
|
+
uint32_t (*device_texture_get_shared_handle)(gs_texture_t *tex);
|
|
254
|
+
gs_texture_t *(*device_texture_wrap_obj)(gs_device_t *device, void *obj);
|
|
255
|
+
int (*device_texture_acquire_sync)(gs_texture_t *tex, uint64_t key, uint32_t ms);
|
|
256
|
+
int (*device_texture_release_sync)(gs_texture_t *tex, uint64_t key);
|
|
257
|
+
|
|
258
|
+
gs_stagesurf_t *(*device_stagesurface_create_nv12)(gs_device_t *device, uint32_t width, uint32_t height);
|
|
259
|
+
gs_stagesurf_t *(*device_stagesurface_create_p010)(gs_device_t *device, uint32_t width, uint32_t height);
|
|
260
|
+
void (*device_register_loss_callbacks)(gs_device_t *device, const struct gs_device_loss *callbacks);
|
|
261
|
+
void (*device_unregister_loss_callbacks)(gs_device_t *device, void *data);
|
|
262
|
+
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
|
263
|
+
struct gs_texture *(*device_texture_create_from_dmabuf)(gs_device_t *device, unsigned int width,
|
|
264
|
+
unsigned int height, uint32_t drm_format,
|
|
265
|
+
enum gs_color_format color_format, uint32_t n_planes,
|
|
266
|
+
const int *fds, const uint32_t *strides,
|
|
267
|
+
const uint32_t *offsets, const uint64_t *modifiers);
|
|
268
|
+
bool (*device_query_dmabuf_capabilities)(gs_device_t *device, enum gs_dmabuf_flags *dmabuf_flags,
|
|
269
|
+
uint32_t **drm_formats, size_t *n_formats);
|
|
270
|
+
bool (*device_query_dmabuf_modifiers_for_format)(gs_device_t *device, uint32_t drm_format, uint64_t **modifiers,
|
|
271
|
+
size_t *n_modifiers);
|
|
272
|
+
struct gs_texture *(*device_texture_create_from_pixmap)(gs_device_t *device, uint32_t width, uint32_t height,
|
|
273
|
+
enum gs_color_format color_format, uint32_t target,
|
|
274
|
+
void *pixmap);
|
|
275
|
+
bool (*device_query_sync_capabilities)(gs_device_t *device);
|
|
276
|
+
gs_sync_t *(*device_sync_create)(gs_device_t *device);
|
|
277
|
+
gs_sync_t *(*device_sync_create_from_syncobj_timeline_point)(gs_device_t *device, int syncobj_fd,
|
|
278
|
+
uint64_t timeline_point);
|
|
279
|
+
void (*device_sync_destroy)(gs_device_t *device, gs_sync_t *sync);
|
|
280
|
+
bool (*device_sync_export_syncobj_timeline_point)(gs_device_t *device, gs_sync_t *sync, int syncobj_fd,
|
|
281
|
+
uint64_t timeline_point);
|
|
282
|
+
bool (*device_sync_signal_syncobj_timeline_point)(gs_device_t *device, int syncobj_fd, uint64_t timeline_point);
|
|
283
|
+
bool (*device_sync_wait)(gs_device_t *device, gs_sync_t *sync);
|
|
284
|
+
#endif
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/* ========================================================================= *
|
|
288
|
+
* Graphics Subsystem Data *
|
|
289
|
+
* ========================================================================= */
|
|
290
|
+
|
|
291
|
+
struct blend_state {
|
|
292
|
+
bool enabled;
|
|
293
|
+
enum gs_blend_type src_c;
|
|
294
|
+
enum gs_blend_type dest_c;
|
|
295
|
+
enum gs_blend_type src_a;
|
|
296
|
+
enum gs_blend_type dest_a;
|
|
297
|
+
enum gs_blend_op_type op;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
struct graphics_subsystem {
|
|
301
|
+
void *module;
|
|
302
|
+
gs_device_t *device;
|
|
303
|
+
struct gs_exports exports;
|
|
304
|
+
|
|
305
|
+
DARRAY(struct gs_rect) viewport_stack;
|
|
306
|
+
|
|
307
|
+
DARRAY(struct matrix4) matrix_stack;
|
|
308
|
+
size_t cur_matrix;
|
|
309
|
+
|
|
310
|
+
struct matrix4 projection;
|
|
311
|
+
struct gs_effect *cur_effect;
|
|
312
|
+
|
|
313
|
+
gs_vertbuffer_t *sprite_buffer;
|
|
314
|
+
gs_vertbuffer_t *flipped_sprite_buffer;
|
|
315
|
+
gs_vertbuffer_t *subregion_buffer;
|
|
316
|
+
|
|
317
|
+
bool using_immediate;
|
|
318
|
+
struct gs_vb_data *vbd;
|
|
319
|
+
gs_vertbuffer_t *immediate_vertbuffer;
|
|
320
|
+
DARRAY(struct vec3) verts;
|
|
321
|
+
DARRAY(struct vec3) norms;
|
|
322
|
+
DARRAY(uint32_t) colors;
|
|
323
|
+
DARRAY(struct vec2) texverts[16];
|
|
324
|
+
|
|
325
|
+
pthread_mutex_t effect_mutex;
|
|
326
|
+
struct gs_effect *first_effect;
|
|
327
|
+
|
|
328
|
+
pthread_mutex_t mutex;
|
|
329
|
+
volatile long ref;
|
|
330
|
+
|
|
331
|
+
struct blend_state cur_blend_state;
|
|
332
|
+
DARRAY(struct blend_state) blend_state_stack;
|
|
333
|
+
|
|
334
|
+
bool linear_srgb;
|
|
335
|
+
};
|