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,108 @@
|
|
|
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 "math-defs.h"
|
|
21
|
+
#include "vec3.h"
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Axis Aligned Bounding Box
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#define BOUNDS_OUTSIDE 1
|
|
32
|
+
#define BOUNDS_INSIDE 2
|
|
33
|
+
#define BOUNDS_PARTIAL 3
|
|
34
|
+
|
|
35
|
+
struct bounds {
|
|
36
|
+
struct vec3 min, max;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
static inline void bounds_zero(struct bounds *dst)
|
|
40
|
+
{
|
|
41
|
+
vec3_zero(&dst->min);
|
|
42
|
+
vec3_zero(&dst->max);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static inline void bounds_copy(struct bounds *dst, const struct bounds *b)
|
|
46
|
+
{
|
|
47
|
+
vec3_copy(&dst->min, &b->min);
|
|
48
|
+
vec3_copy(&dst->max, &b->max);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
EXPORT void bounds_move(struct bounds *dst, const struct bounds *b, const struct vec3 *v);
|
|
52
|
+
|
|
53
|
+
EXPORT void bounds_scale(struct bounds *dst, const struct bounds *b, const struct vec3 *v);
|
|
54
|
+
|
|
55
|
+
EXPORT void bounds_merge(struct bounds *dst, const struct bounds *b1, const struct bounds *b2);
|
|
56
|
+
EXPORT void bounds_merge_point(struct bounds *dst, const struct bounds *b, const struct vec3 *v);
|
|
57
|
+
|
|
58
|
+
EXPORT void bounds_get_point(struct vec3 *dst, const struct bounds *b, unsigned int i);
|
|
59
|
+
EXPORT void bounds_get_center(struct vec3 *dst, const struct bounds *b);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Note: transforms as OBB, then converts back to AABB, which can result in
|
|
63
|
+
* the actual size becoming larger than it originally was.
|
|
64
|
+
*/
|
|
65
|
+
EXPORT void bounds_transform(struct bounds *dst, const struct bounds *b, const struct matrix4 *m);
|
|
66
|
+
EXPORT void bounds_transform3x4(struct bounds *dst, const struct bounds *b, const struct matrix3 *m);
|
|
67
|
+
|
|
68
|
+
EXPORT bool bounds_intersection_ray(const struct bounds *b, const struct vec3 *orig, const struct vec3 *dir, float *t);
|
|
69
|
+
EXPORT bool bounds_intersection_line(const struct bounds *b, const struct vec3 *p1, const struct vec3 *p2, float *t);
|
|
70
|
+
|
|
71
|
+
EXPORT bool bounds_plane_test(const struct bounds *b, const struct plane *p);
|
|
72
|
+
EXPORT bool bounds_under_plane(const struct bounds *b, const struct plane *p);
|
|
73
|
+
|
|
74
|
+
static inline bool bounds_inside(const struct bounds *b, const struct bounds *test)
|
|
75
|
+
{
|
|
76
|
+
return test->min.x >= b->min.x && test->min.y >= b->min.y && test->min.z >= b->min.z &&
|
|
77
|
+
test->max.x <= b->max.x && test->max.y <= b->max.y && test->max.z <= b->max.z;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static inline bool bounds_vec3_inside(const struct bounds *b, const struct vec3 *v)
|
|
81
|
+
{
|
|
82
|
+
return v->x >= (b->min.x - EPSILON) && v->x <= (b->max.x + EPSILON) && v->y >= (b->min.y - EPSILON) &&
|
|
83
|
+
v->y <= (b->max.y + EPSILON) && v->z >= (b->min.z - EPSILON) && v->z <= (b->max.z + EPSILON);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
EXPORT bool bounds_intersects(const struct bounds *b, const struct bounds *test, float epsilon);
|
|
87
|
+
EXPORT bool bounds_intersects_obb(const struct bounds *b, const struct bounds *test, const struct matrix4 *m,
|
|
88
|
+
float epsilon);
|
|
89
|
+
EXPORT bool bounds_intersects_obb3x4(const struct bounds *b, const struct bounds *test, const struct matrix3 *m,
|
|
90
|
+
float epsilon);
|
|
91
|
+
|
|
92
|
+
static inline bool bounds_intersects_ray(const struct bounds *b, const struct vec3 *orig, const struct vec3 *dir)
|
|
93
|
+
{
|
|
94
|
+
float t;
|
|
95
|
+
return bounds_intersection_ray(b, orig, dir, &t);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static inline bool bounds_intersects_line(const struct bounds *b, const struct vec3 *p1, const struct vec3 *p2)
|
|
99
|
+
{
|
|
100
|
+
float t;
|
|
101
|
+
return bounds_intersection_line(b, p1, p2, &t);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
EXPORT float bounds_min_dist(const struct bounds *b, const struct plane *p);
|
|
105
|
+
|
|
106
|
+
#ifdef __cplusplus
|
|
107
|
+
}
|
|
108
|
+
#endif
|
|
@@ -0,0 +1,177 @@
|
|
|
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/c99defs.h>
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
EXPORT const char *device_get_name(void);
|
|
27
|
+
EXPORT const char *gpu_get_driver_version(void);
|
|
28
|
+
EXPORT const char *gpu_get_renderer(void);
|
|
29
|
+
EXPORT uint64_t gpu_get_dmem(void);
|
|
30
|
+
EXPORT uint64_t gpu_get_smem(void);
|
|
31
|
+
EXPORT int device_get_type(void);
|
|
32
|
+
EXPORT bool device_enum_adapters(gs_device_t *device, bool (*callback)(void *param, const char *name, uint32_t id),
|
|
33
|
+
void *param);
|
|
34
|
+
EXPORT const char *device_preprocessor_name(void);
|
|
35
|
+
EXPORT int device_create(gs_device_t **device, uint32_t adapter);
|
|
36
|
+
EXPORT void device_destroy(gs_device_t *device);
|
|
37
|
+
EXPORT void device_enter_context(gs_device_t *device);
|
|
38
|
+
EXPORT void device_leave_context(gs_device_t *device);
|
|
39
|
+
EXPORT void *device_get_device_obj(gs_device_t *device);
|
|
40
|
+
EXPORT gs_swapchain_t *device_swapchain_create(gs_device_t *device, const struct gs_init_data *data);
|
|
41
|
+
EXPORT void device_resize(gs_device_t *device, uint32_t x, uint32_t y);
|
|
42
|
+
EXPORT enum gs_color_space device_get_color_space(gs_device_t *device);
|
|
43
|
+
EXPORT void device_update_color_space(gs_device_t *device);
|
|
44
|
+
EXPORT void device_get_size(const gs_device_t *device, uint32_t *x, uint32_t *y);
|
|
45
|
+
EXPORT uint32_t device_get_width(const gs_device_t *device);
|
|
46
|
+
EXPORT uint32_t device_get_height(const gs_device_t *device);
|
|
47
|
+
EXPORT gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width, uint32_t height,
|
|
48
|
+
enum gs_color_format color_format, uint32_t levels, const uint8_t **data,
|
|
49
|
+
uint32_t flags);
|
|
50
|
+
EXPORT gs_texture_t *device_cubetexture_create(gs_device_t *device, uint32_t size, enum gs_color_format color_format,
|
|
51
|
+
uint32_t levels, const uint8_t **data, uint32_t flags);
|
|
52
|
+
EXPORT gs_texture_t *device_voltexture_create(gs_device_t *device, uint32_t width, uint32_t height, uint32_t depth,
|
|
53
|
+
enum gs_color_format color_format, uint32_t levels,
|
|
54
|
+
const uint8_t *const *data, uint32_t flags);
|
|
55
|
+
EXPORT gs_zstencil_t *device_zstencil_create(gs_device_t *device, uint32_t width, uint32_t height,
|
|
56
|
+
enum gs_zstencil_format format);
|
|
57
|
+
EXPORT gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, uint32_t width, uint32_t height,
|
|
58
|
+
enum gs_color_format color_format);
|
|
59
|
+
EXPORT gs_samplerstate_t *device_samplerstate_create(gs_device_t *device, const struct gs_sampler_info *info);
|
|
60
|
+
EXPORT gs_shader_t *device_vertexshader_create(gs_device_t *device, const char *shader, const char *file,
|
|
61
|
+
char **error_string);
|
|
62
|
+
EXPORT gs_shader_t *device_pixelshader_create(gs_device_t *device, const char *shader, const char *file,
|
|
63
|
+
char **error_string);
|
|
64
|
+
EXPORT gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device, struct gs_vb_data *data, uint32_t flags);
|
|
65
|
+
EXPORT gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device, enum gs_index_type type, void *indices,
|
|
66
|
+
size_t num, uint32_t flags);
|
|
67
|
+
EXPORT gs_timer_t *device_timer_create(gs_device_t *device);
|
|
68
|
+
EXPORT gs_timer_range_t *device_timer_range_create(gs_device_t *device);
|
|
69
|
+
EXPORT enum gs_texture_type device_get_texture_type(const gs_texture_t *texture);
|
|
70
|
+
EXPORT void device_load_vertexbuffer(gs_device_t *device, gs_vertbuffer_t *vertbuffer);
|
|
71
|
+
EXPORT void device_load_indexbuffer(gs_device_t *device, gs_indexbuffer_t *indexbuffer);
|
|
72
|
+
EXPORT void device_load_texture(gs_device_t *device, gs_texture_t *tex, int unit);
|
|
73
|
+
EXPORT void device_load_texture_srgb(gs_device_t *device, gs_texture_t *tex, int unit);
|
|
74
|
+
EXPORT void device_load_samplerstate(gs_device_t *device, gs_samplerstate_t *samplerstate, int unit);
|
|
75
|
+
EXPORT void device_load_vertexshader(gs_device_t *device, gs_shader_t *vertshader);
|
|
76
|
+
EXPORT void device_load_pixelshader(gs_device_t *device, gs_shader_t *pixelshader);
|
|
77
|
+
EXPORT void device_load_default_samplerstate(gs_device_t *device, bool b_3d, int unit);
|
|
78
|
+
EXPORT gs_shader_t *device_get_vertex_shader(const gs_device_t *device);
|
|
79
|
+
EXPORT gs_shader_t *device_get_pixel_shader(const gs_device_t *device);
|
|
80
|
+
EXPORT gs_texture_t *device_get_render_target(const gs_device_t *device);
|
|
81
|
+
EXPORT gs_zstencil_t *device_get_zstencil_target(const gs_device_t *device);
|
|
82
|
+
EXPORT void device_set_render_target(gs_device_t *device, gs_texture_t *tex, gs_zstencil_t *zstencil);
|
|
83
|
+
EXPORT void device_set_render_target_with_color_space(gs_device_t *device, gs_texture_t *tex, gs_zstencil_t *zstencil,
|
|
84
|
+
enum gs_color_space space);
|
|
85
|
+
EXPORT void device_set_cube_render_target(gs_device_t *device, gs_texture_t *cubetex, int side,
|
|
86
|
+
gs_zstencil_t *zstencil);
|
|
87
|
+
EXPORT void device_enable_framebuffer_srgb(gs_device_t *device, bool enable);
|
|
88
|
+
EXPORT bool device_framebuffer_srgb_enabled(gs_device_t *device);
|
|
89
|
+
EXPORT void device_copy_texture(gs_device_t *device, gs_texture_t *dst, gs_texture_t *src);
|
|
90
|
+
EXPORT void device_copy_texture_region(gs_device_t *device, gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
|
|
91
|
+
gs_texture_t *src, uint32_t src_x, uint32_t src_y, uint32_t src_w,
|
|
92
|
+
uint32_t src_h);
|
|
93
|
+
EXPORT void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst, gs_texture_t *src);
|
|
94
|
+
EXPORT void device_begin_frame(gs_device_t *device);
|
|
95
|
+
EXPORT void device_begin_scene(gs_device_t *device);
|
|
96
|
+
EXPORT void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode, uint32_t start_vert, uint32_t num_verts);
|
|
97
|
+
EXPORT void device_end_scene(gs_device_t *device);
|
|
98
|
+
EXPORT void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swapchain);
|
|
99
|
+
EXPORT void device_clear(gs_device_t *device, uint32_t clear_flags, const struct vec4 *color, float depth,
|
|
100
|
+
uint8_t stencil);
|
|
101
|
+
EXPORT bool device_is_present_ready(gs_device_t *device);
|
|
102
|
+
EXPORT void device_present(gs_device_t *device);
|
|
103
|
+
EXPORT void device_flush(gs_device_t *device);
|
|
104
|
+
EXPORT void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode);
|
|
105
|
+
EXPORT enum gs_cull_mode device_get_cull_mode(const gs_device_t *device);
|
|
106
|
+
EXPORT void device_enable_blending(gs_device_t *device, bool enable);
|
|
107
|
+
EXPORT void device_enable_depth_test(gs_device_t *device, bool enable);
|
|
108
|
+
EXPORT void device_enable_stencil_test(gs_device_t *device, bool enable);
|
|
109
|
+
EXPORT void device_enable_stencil_write(gs_device_t *device, bool enable);
|
|
110
|
+
EXPORT void device_enable_color(gs_device_t *device, bool red, bool green, bool blue, bool alpha);
|
|
111
|
+
EXPORT void device_blend_function(gs_device_t *device, enum gs_blend_type src, enum gs_blend_type dest);
|
|
112
|
+
EXPORT void device_blend_function_separate(gs_device_t *device, enum gs_blend_type src_c, enum gs_blend_type dest_c,
|
|
113
|
+
enum gs_blend_type src_a, enum gs_blend_type dest_a);
|
|
114
|
+
EXPORT void device_blend_op(gs_device_t *device, enum gs_blend_op_type op);
|
|
115
|
+
|
|
116
|
+
EXPORT void device_depth_function(gs_device_t *device, enum gs_depth_test test);
|
|
117
|
+
EXPORT void device_stencil_function(gs_device_t *device, enum gs_stencil_side side, enum gs_depth_test test);
|
|
118
|
+
EXPORT void device_stencil_op(gs_device_t *device, enum gs_stencil_side side, enum gs_stencil_op_type fail,
|
|
119
|
+
enum gs_stencil_op_type zfail, enum gs_stencil_op_type zpass);
|
|
120
|
+
EXPORT void device_set_viewport(gs_device_t *device, int x, int y, int width, int height);
|
|
121
|
+
EXPORT void device_get_viewport(const gs_device_t *device, struct gs_rect *rect);
|
|
122
|
+
EXPORT void device_set_scissor_rect(gs_device_t *device, const struct gs_rect *rect);
|
|
123
|
+
EXPORT void device_ortho(gs_device_t *device, float left, float right, float top, float bottom, float znear,
|
|
124
|
+
float zfar);
|
|
125
|
+
EXPORT void device_frustum(gs_device_t *device, float left, float right, float top, float bottom, float znear,
|
|
126
|
+
float zfar);
|
|
127
|
+
EXPORT void device_projection_push(gs_device_t *device);
|
|
128
|
+
EXPORT void device_projection_pop(gs_device_t *device);
|
|
129
|
+
EXPORT void device_debug_marker_begin(gs_device_t *device, const char *markername, const float color[4]);
|
|
130
|
+
EXPORT void device_debug_marker_end(gs_device_t *device);
|
|
131
|
+
EXPORT bool device_is_monitor_hdr(gs_device_t *device, void *monitor);
|
|
132
|
+
EXPORT bool device_shared_texture_available(void);
|
|
133
|
+
EXPORT bool device_nv12_available(gs_device_t *device);
|
|
134
|
+
EXPORT bool device_p010_available(gs_device_t *device);
|
|
135
|
+
|
|
136
|
+
#ifdef __APPLE__
|
|
137
|
+
EXPORT gs_texture_t *device_texture_create_from_iosurface(gs_device_t *device, void *iosurf);
|
|
138
|
+
EXPORT gs_texture_t *device_texture_open_shared(gs_device_t *device, uint32_t handle);
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
|
142
|
+
|
|
143
|
+
EXPORT gs_texture_t *device_texture_create_from_dmabuf(gs_device_t *device, unsigned int width, unsigned int height,
|
|
144
|
+
uint32_t drm_format, enum gs_color_format color_format,
|
|
145
|
+
uint32_t n_planes, const int *fds, const uint32_t *strides,
|
|
146
|
+
const uint32_t *offsets, const uint64_t *modifiers);
|
|
147
|
+
|
|
148
|
+
EXPORT bool device_query_dmabuf_capabilities(gs_device_t *device, enum gs_dmabuf_flags *gs_dmabuf_flags,
|
|
149
|
+
uint32_t **drm_formats, size_t *n_formats);
|
|
150
|
+
|
|
151
|
+
EXPORT bool device_query_dmabuf_modifiers_for_format(gs_device_t *device, uint32_t drm_format, uint64_t **modifiers,
|
|
152
|
+
size_t *n_modifiers);
|
|
153
|
+
|
|
154
|
+
EXPORT gs_texture_t *device_texture_create_from_pixmap(gs_device_t *device, uint32_t width, uint32_t height,
|
|
155
|
+
enum gs_color_format color_format, uint32_t target,
|
|
156
|
+
void *pixmap);
|
|
157
|
+
|
|
158
|
+
EXPORT bool device_query_sync_capabilities(gs_device_t *device);
|
|
159
|
+
|
|
160
|
+
EXPORT gs_sync_t *device_sync_create(gs_device_t *device);
|
|
161
|
+
|
|
162
|
+
EXPORT gs_sync_t *device_sync_create_from_syncobj_timeline_point(gs_device_t *device, int syncobj_fd,
|
|
163
|
+
uint64_t timeline_point);
|
|
164
|
+
|
|
165
|
+
EXPORT void device_sync_destroy(gs_device_t *device, gs_sync_t *sync);
|
|
166
|
+
|
|
167
|
+
EXPORT bool device_sync_export_syncobj_timeline_point(gs_device_t *device, gs_sync_t *sync, int syncobj_fd,
|
|
168
|
+
uint64_t timeline_point);
|
|
169
|
+
|
|
170
|
+
EXPORT bool device_sync_signal_syncobj_timeline_point(gs_device_t *device, int syncobj_fd, uint64_t timeline_point);
|
|
171
|
+
|
|
172
|
+
EXPORT bool device_sync_wait(gs_device_t *device, gs_sync_t *sync);
|
|
173
|
+
#endif
|
|
174
|
+
|
|
175
|
+
#ifdef __cplusplus
|
|
176
|
+
}
|
|
177
|
+
#endif
|
|
@@ -0,0 +1,290 @@
|
|
|
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/darray.h"
|
|
21
|
+
#include "../util/cf-parser.h"
|
|
22
|
+
#include "graphics.h"
|
|
23
|
+
#include "shader-parser.h"
|
|
24
|
+
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
struct dstr;
|
|
30
|
+
|
|
31
|
+
typedef DARRAY(struct ep_param) ep_param_array_t;
|
|
32
|
+
typedef DARRAY(struct ep_var) ep_var_array_t;
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* The effect parser takes an effect file and converts it into individual
|
|
36
|
+
* shaders for each technique's pass. It automatically writes all dependent
|
|
37
|
+
* structures/functions/parameters to the shader and builds shader text for
|
|
38
|
+
* each shader component of each pass.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/* ------------------------------------------------------------------------- */
|
|
42
|
+
/* effect parser var data */
|
|
43
|
+
|
|
44
|
+
enum ep_var_type { EP_VAR_NONE, EP_VAR_IN = EP_VAR_NONE, EP_VAR_INOUT, EP_VAR_OUT, EP_VAR_UNIFORM };
|
|
45
|
+
|
|
46
|
+
struct ep_var {
|
|
47
|
+
char *type, *name, *mapping;
|
|
48
|
+
enum ep_var_type var_type;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
static inline void ep_var_init(struct ep_var *epv)
|
|
52
|
+
{
|
|
53
|
+
memset(epv, 0, sizeof(struct ep_var));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static inline void ep_var_free(struct ep_var *epv)
|
|
57
|
+
{
|
|
58
|
+
bfree(epv->type);
|
|
59
|
+
bfree(epv->name);
|
|
60
|
+
bfree(epv->mapping);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* ------------------------------------------------------------------------- */
|
|
64
|
+
/* effect parser param data */
|
|
65
|
+
|
|
66
|
+
struct ep_param {
|
|
67
|
+
char *type, *name;
|
|
68
|
+
DARRAY(uint8_t) default_val;
|
|
69
|
+
DARRAY(char *) properties;
|
|
70
|
+
struct gs_effect_param *param;
|
|
71
|
+
bool is_const, is_property, is_uniform, is_texture, written;
|
|
72
|
+
int writeorder, array_count;
|
|
73
|
+
ep_param_array_t annotations;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
static inline void ep_param_init(struct ep_param *epp, char *type, char *name, bool is_property, bool is_const,
|
|
77
|
+
bool is_uniform)
|
|
78
|
+
{
|
|
79
|
+
epp->type = type;
|
|
80
|
+
epp->name = name;
|
|
81
|
+
epp->is_property = is_property;
|
|
82
|
+
epp->is_const = is_const;
|
|
83
|
+
epp->is_uniform = is_uniform;
|
|
84
|
+
epp->is_texture = (astrcmp_n(epp->type, "texture", 7) == 0);
|
|
85
|
+
epp->written = false;
|
|
86
|
+
epp->writeorder = false;
|
|
87
|
+
epp->array_count = 0;
|
|
88
|
+
da_init(epp->default_val);
|
|
89
|
+
da_init(epp->properties);
|
|
90
|
+
da_init(epp->annotations);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static inline void ep_param_free(struct ep_param *epp)
|
|
94
|
+
{
|
|
95
|
+
bfree(epp->type);
|
|
96
|
+
bfree(epp->name);
|
|
97
|
+
da_free(epp->default_val);
|
|
98
|
+
da_free(epp->properties);
|
|
99
|
+
|
|
100
|
+
for (size_t i = 0; i < epp->annotations.num; i++)
|
|
101
|
+
ep_param_free(epp->annotations.array + i);
|
|
102
|
+
da_free(epp->annotations);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ------------------------------------------------------------------------- */
|
|
106
|
+
/* effect parser struct data */
|
|
107
|
+
|
|
108
|
+
struct ep_struct {
|
|
109
|
+
char *name;
|
|
110
|
+
ep_var_array_t vars; /* struct ep_var */
|
|
111
|
+
bool written;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
static inline bool ep_struct_mapped(struct ep_struct *eps)
|
|
115
|
+
{
|
|
116
|
+
if (eps->vars.num > 0)
|
|
117
|
+
return eps->vars.array[0].mapping != NULL;
|
|
118
|
+
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static inline void ep_struct_init(struct ep_struct *eps)
|
|
123
|
+
{
|
|
124
|
+
memset(eps, 0, sizeof(struct ep_struct));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static inline void ep_struct_free(struct ep_struct *eps)
|
|
128
|
+
{
|
|
129
|
+
size_t i;
|
|
130
|
+
|
|
131
|
+
bfree(eps->name);
|
|
132
|
+
for (i = 0; i < eps->vars.num; i++)
|
|
133
|
+
ep_var_free(eps->vars.array + i);
|
|
134
|
+
da_free(eps->vars);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ------------------------------------------------------------------------- */
|
|
138
|
+
/* effect parser sampler data */
|
|
139
|
+
|
|
140
|
+
struct ep_sampler {
|
|
141
|
+
char *name;
|
|
142
|
+
DARRAY(char *) states;
|
|
143
|
+
DARRAY(char *) values;
|
|
144
|
+
|
|
145
|
+
bool written;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
static inline void ep_sampler_init(struct ep_sampler *eps)
|
|
149
|
+
{
|
|
150
|
+
memset(eps, 0, sizeof(struct ep_sampler));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static inline void ep_sampler_free(struct ep_sampler *eps)
|
|
154
|
+
{
|
|
155
|
+
size_t i;
|
|
156
|
+
|
|
157
|
+
for (i = 0; i < eps->states.num; i++)
|
|
158
|
+
bfree(eps->states.array[i]);
|
|
159
|
+
for (i = 0; i < eps->values.num; i++)
|
|
160
|
+
bfree(eps->values.array[i]);
|
|
161
|
+
|
|
162
|
+
bfree(eps->name);
|
|
163
|
+
da_free(eps->states);
|
|
164
|
+
da_free(eps->values);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* ------------------------------------------------------------------------- */
|
|
168
|
+
/* effect parser pass data */
|
|
169
|
+
|
|
170
|
+
struct ep_pass {
|
|
171
|
+
char *name;
|
|
172
|
+
cf_token_array_t vertex_program;
|
|
173
|
+
cf_token_array_t fragment_program;
|
|
174
|
+
struct gs_effect_pass *pass;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
static inline void ep_pass_init(struct ep_pass *epp)
|
|
178
|
+
{
|
|
179
|
+
memset(epp, 0, sizeof(struct ep_pass));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
static inline void ep_pass_free(struct ep_pass *epp)
|
|
183
|
+
{
|
|
184
|
+
bfree(epp->name);
|
|
185
|
+
da_free(epp->vertex_program);
|
|
186
|
+
da_free(epp->fragment_program);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* ------------------------------------------------------------------------- */
|
|
190
|
+
/* effect parser technique data */
|
|
191
|
+
|
|
192
|
+
struct ep_technique {
|
|
193
|
+
char *name;
|
|
194
|
+
DARRAY(struct ep_pass) passes; /* struct ep_pass */
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
static inline void ep_technique_init(struct ep_technique *ept)
|
|
198
|
+
{
|
|
199
|
+
memset(ept, 0, sizeof(struct ep_technique));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
static inline void ep_technique_free(struct ep_technique *ept)
|
|
203
|
+
{
|
|
204
|
+
size_t i;
|
|
205
|
+
|
|
206
|
+
for (i = 0; i < ept->passes.num; i++)
|
|
207
|
+
ep_pass_free(ept->passes.array + i);
|
|
208
|
+
|
|
209
|
+
bfree(ept->name);
|
|
210
|
+
da_free(ept->passes);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* ------------------------------------------------------------------------- */
|
|
214
|
+
/* effect parser function data */
|
|
215
|
+
|
|
216
|
+
struct ep_func {
|
|
217
|
+
char *name, *ret_type, *mapping;
|
|
218
|
+
struct dstr contents;
|
|
219
|
+
ep_var_array_t param_vars;
|
|
220
|
+
DARRAY(char *) func_deps;
|
|
221
|
+
DARRAY(char *) struct_deps;
|
|
222
|
+
DARRAY(char *) param_deps;
|
|
223
|
+
DARRAY(char *) sampler_deps;
|
|
224
|
+
bool written;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
static inline void ep_func_init(struct ep_func *epf, char *ret_type, char *name)
|
|
228
|
+
{
|
|
229
|
+
memset(epf, 0, sizeof(struct ep_func));
|
|
230
|
+
epf->name = name;
|
|
231
|
+
epf->ret_type = ret_type;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
static inline void ep_func_free(struct ep_func *epf)
|
|
235
|
+
{
|
|
236
|
+
size_t i;
|
|
237
|
+
for (i = 0; i < epf->param_vars.num; i++)
|
|
238
|
+
ep_var_free(epf->param_vars.array + i);
|
|
239
|
+
|
|
240
|
+
bfree(epf->name);
|
|
241
|
+
bfree(epf->ret_type);
|
|
242
|
+
bfree(epf->mapping);
|
|
243
|
+
dstr_free(&epf->contents);
|
|
244
|
+
da_free(epf->param_vars);
|
|
245
|
+
da_free(epf->func_deps);
|
|
246
|
+
da_free(epf->struct_deps);
|
|
247
|
+
da_free(epf->param_deps);
|
|
248
|
+
da_free(epf->sampler_deps);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* ------------------------------------------------------------------------- */
|
|
252
|
+
|
|
253
|
+
struct effect_parser {
|
|
254
|
+
gs_effect_t *effect;
|
|
255
|
+
|
|
256
|
+
ep_param_array_t params;
|
|
257
|
+
DARRAY(struct ep_struct) structs;
|
|
258
|
+
DARRAY(struct ep_func) funcs;
|
|
259
|
+
DARRAY(struct ep_sampler) samplers;
|
|
260
|
+
DARRAY(struct ep_technique) techniques;
|
|
261
|
+
|
|
262
|
+
/* internal vars */
|
|
263
|
+
DARRAY(struct cf_lexer) files;
|
|
264
|
+
cf_token_array_t tokens;
|
|
265
|
+
struct gs_effect_pass *cur_pass;
|
|
266
|
+
|
|
267
|
+
struct cf_parser cfp;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
static inline void ep_init(struct effect_parser *ep)
|
|
271
|
+
{
|
|
272
|
+
da_init(ep->params);
|
|
273
|
+
da_init(ep->structs);
|
|
274
|
+
da_init(ep->funcs);
|
|
275
|
+
da_init(ep->samplers);
|
|
276
|
+
da_init(ep->techniques);
|
|
277
|
+
da_init(ep->files);
|
|
278
|
+
da_init(ep->tokens);
|
|
279
|
+
|
|
280
|
+
ep->cur_pass = NULL;
|
|
281
|
+
cf_parser_init(&ep->cfp);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
extern void ep_free(struct effect_parser *ep);
|
|
285
|
+
|
|
286
|
+
extern bool ep_parse(struct effect_parser *ep, gs_effect_t *effect, const char *effect_string, const char *file);
|
|
287
|
+
|
|
288
|
+
#ifdef __cplusplus
|
|
289
|
+
}
|
|
290
|
+
#endif
|