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.
Files changed (185) hide show
  1. package/COPYING +339 -0
  2. package/README.md +46 -0
  3. package/bin/64bit/obs.lib +0 -0
  4. package/binding.gyp +23 -0
  5. package/dist/bin/Qt6Core.dll +0 -0
  6. package/dist/bin/Qt6Gui.dll +0 -0
  7. package/dist/bin/Qt6Network.dll +0 -0
  8. package/dist/bin/Qt6Svg.dll +0 -0
  9. package/dist/bin/Qt6Widgets.dll +0 -0
  10. package/dist/bin/Qt6Xml.dll +0 -0
  11. package/dist/bin/avcodec-61.dll +0 -0
  12. package/dist/bin/avdevice-61.dll +0 -0
  13. package/dist/bin/avfilter-10.dll +0 -0
  14. package/dist/bin/avformat-61.dll +0 -0
  15. package/dist/bin/avutil-59.dll +0 -0
  16. package/dist/bin/datachannel.dll +0 -0
  17. package/dist/bin/libcurl.dll +0 -0
  18. package/dist/bin/libobs-d3d11.dll +0 -0
  19. package/dist/bin/libobs-opengl.dll +0 -0
  20. package/dist/bin/libobs-winrt.dll +0 -0
  21. package/dist/bin/librist.dll +0 -0
  22. package/dist/bin/libx264-164.dll +0 -0
  23. package/dist/bin/lua51.dll +0 -0
  24. package/dist/bin/obs-amf-test.exe +0 -0
  25. package/dist/bin/obs-ffmpeg-mux.exe +0 -0
  26. package/dist/bin/obs-frontend-api.dll +0 -0
  27. package/dist/bin/obs-scripting.dll +0 -0
  28. package/dist/bin/obs.dll +0 -0
  29. package/dist/bin/srt.dll +0 -0
  30. package/dist/bin/swresample-5.dll +0 -0
  31. package/dist/bin/swscale-8.dll +0 -0
  32. package/dist/bin/w32-pthreads.dll +0 -0
  33. package/dist/bin/zlib.dll +0 -0
  34. package/dist/effects/area.effect +250 -0
  35. package/dist/effects/bicubic_scale.effect +236 -0
  36. package/dist/effects/bilinear_lowres_scale.effect +123 -0
  37. package/dist/effects/color.effect +172 -0
  38. package/dist/effects/default.effect +254 -0
  39. package/dist/effects/default_rect.effect +84 -0
  40. package/dist/effects/deinterlace_base.effect +325 -0
  41. package/dist/effects/deinterlace_blend.effect +21 -0
  42. package/dist/effects/deinterlace_blend_2x.effect +21 -0
  43. package/dist/effects/deinterlace_discard.effect +21 -0
  44. package/dist/effects/deinterlace_discard_2x.effect +21 -0
  45. package/dist/effects/deinterlace_linear.effect +21 -0
  46. package/dist/effects/deinterlace_linear_2x.effect +21 -0
  47. package/dist/effects/deinterlace_yadif.effect +21 -0
  48. package/dist/effects/deinterlace_yadif_2x.effect +21 -0
  49. package/dist/effects/format_conversion.effect +1823 -0
  50. package/dist/effects/lanczos_scale.effect +292 -0
  51. package/dist/effects/opaque.effect +159 -0
  52. package/dist/effects/premultiplied_alpha.effect +38 -0
  53. package/dist/effects/repeat.effect +36 -0
  54. package/dist/effects/solid.effect +80 -0
  55. package/dist/noobs.node +0 -0
  56. package/dist/plugins/obs-ffmpeg.dll +0 -0
  57. package/dist/plugins/obs-x264.dll +0 -0
  58. package/dist/plugins/win-capture.dll +0 -0
  59. package/include/audio-monitoring/osx/mac-helpers.h +13 -0
  60. package/include/audio-monitoring/pulse/pulseaudio-wrapper.h +212 -0
  61. package/include/audio-monitoring/win32/wasapi-output.h +22 -0
  62. package/include/callback/calldata.h +195 -0
  63. package/include/callback/decl.h +61 -0
  64. package/include/callback/proc.h +52 -0
  65. package/include/callback/signal.h +73 -0
  66. package/include/graphics/axisang.h +65 -0
  67. package/include/graphics/bounds.h +108 -0
  68. package/include/graphics/device-exports.h +177 -0
  69. package/include/graphics/effect-parser.h +290 -0
  70. package/include/graphics/effect.h +190 -0
  71. package/include/graphics/graphics-internal.h +335 -0
  72. package/include/graphics/graphics.h +1024 -0
  73. package/include/graphics/half.h +100 -0
  74. package/include/graphics/image-file.h +124 -0
  75. package/include/graphics/input.h +34 -0
  76. package/include/graphics/libnsgif/libnsgif.h +142 -0
  77. package/include/graphics/math-defs.h +45 -0
  78. package/include/graphics/math-extra.h +61 -0
  79. package/include/graphics/matrix3.h +98 -0
  80. package/include/graphics/matrix4.h +102 -0
  81. package/include/graphics/plane.h +85 -0
  82. package/include/graphics/quat.h +170 -0
  83. package/include/graphics/shader-parser.h +273 -0
  84. package/include/graphics/srgb.h +177 -0
  85. package/include/graphics/vec2.h +148 -0
  86. package/include/graphics/vec3.h +224 -0
  87. package/include/graphics/vec4.h +241 -0
  88. package/include/media-io/audio-io.h +228 -0
  89. package/include/media-io/audio-math.h +43 -0
  90. package/include/media-io/audio-resampler.h +44 -0
  91. package/include/media-io/format-conversion.h +50 -0
  92. package/include/media-io/frame-rate.h +29 -0
  93. package/include/media-io/media-io-defs.h +20 -0
  94. package/include/media-io/media-remux.h +37 -0
  95. package/include/media-io/video-frame.h +64 -0
  96. package/include/media-io/video-io.h +338 -0
  97. package/include/media-io/video-scaler.h +43 -0
  98. package/include/obs-audio-controls.h +250 -0
  99. package/include/obs-av1.h +47 -0
  100. package/include/obs-avc.h +55 -0
  101. package/include/obs-config.h +52 -0
  102. package/include/obs-data.h +311 -0
  103. package/include/obs-defs.h +52 -0
  104. package/include/obs-encoder.h +361 -0
  105. package/include/obs-ffmpeg-compat.h +13 -0
  106. package/include/obs-hevc.h +81 -0
  107. package/include/obs-hotkey.h +271 -0
  108. package/include/obs-hotkeys.h +653 -0
  109. package/include/obs-interaction.h +56 -0
  110. package/include/obs-internal.h +1459 -0
  111. package/include/obs-missing-files.h +53 -0
  112. package/include/obs-module.h +181 -0
  113. package/include/obs-nal.h +37 -0
  114. package/include/obs-nix-platform.h +53 -0
  115. package/include/obs-nix-wayland.h +24 -0
  116. package/include/obs-nix-x11.h +22 -0
  117. package/include/obs-nix.h +42 -0
  118. package/include/obs-output.h +96 -0
  119. package/include/obs-properties.h +364 -0
  120. package/include/obs-scene.h +127 -0
  121. package/include/obs-service.h +115 -0
  122. package/include/obs-source.h +568 -0
  123. package/include/obs.h +2608 -0
  124. package/include/obsconfig.h +13 -0
  125. package/include/obsversion.h +5 -0
  126. package/include/util/apple/cfstring-utils.h +16 -0
  127. package/include/util/array-serializer.h +37 -0
  128. package/include/util/base.h +97 -0
  129. package/include/util/bitstream.h +28 -0
  130. package/include/util/bmem.h +94 -0
  131. package/include/util/buffered-file-serializer.h +32 -0
  132. package/include/util/c99defs.h +75 -0
  133. package/include/util/cf-lexer.h +199 -0
  134. package/include/util/cf-parser.h +281 -0
  135. package/include/util/circlebuf.h +319 -0
  136. package/include/util/config-file.h +103 -0
  137. package/include/util/crc32.h +29 -0
  138. package/include/util/curl/curl-helper.h +35 -0
  139. package/include/util/darray.h +606 -0
  140. package/include/util/deque.h +319 -0
  141. package/include/util/dstr.h +320 -0
  142. package/include/util/file-serializer.h +34 -0
  143. package/include/util/lexer.h +273 -0
  144. package/include/util/pipe.h +52 -0
  145. package/include/util/platform.h +223 -0
  146. package/include/util/profiler.h +97 -0
  147. package/include/util/serializer.h +158 -0
  148. package/include/util/simde/check.h +285 -0
  149. package/include/util/simde/debug-trap.h +117 -0
  150. package/include/util/simde/hedley.h +2123 -0
  151. package/include/util/simde/simde-align.h +481 -0
  152. package/include/util/simde/simde-arch.h +537 -0
  153. package/include/util/simde/simde-common.h +918 -0
  154. package/include/util/simde/simde-constify.h +925 -0
  155. package/include/util/simde/simde-detect-clang.h +114 -0
  156. package/include/util/simde/simde-diagnostic.h +447 -0
  157. package/include/util/simde/simde-features.h +550 -0
  158. package/include/util/simde/simde-math.h +1858 -0
  159. package/include/util/simde/x86/mmx.h +2456 -0
  160. package/include/util/simde/x86/sse.h +4479 -0
  161. package/include/util/simde/x86/sse2.h +7549 -0
  162. package/include/util/source-profiler.h +66 -0
  163. package/include/util/sse-intrin.h +32 -0
  164. package/include/util/task.h +22 -0
  165. package/include/util/text-lookup.h +45 -0
  166. package/include/util/threading-posix.h +77 -0
  167. package/include/util/threading-windows.h +142 -0
  168. package/include/util/threading.h +103 -0
  169. package/include/util/utf8.h +35 -0
  170. package/include/util/uthash.h +34 -0
  171. package/include/util/util_uint128.h +108 -0
  172. package/include/util/util_uint64.h +34 -0
  173. package/include/util/windows/device-enum.h +14 -0
  174. package/include/util/windows/obfuscate.h +16 -0
  175. package/include/util/windows/win-registry.h +37 -0
  176. package/include/util/windows/win-version.h +57 -0
  177. package/include/util/windows/window-helpers.h +47 -0
  178. package/index.d.ts +38 -0
  179. package/index.js +8 -0
  180. package/package.json +31 -0
  181. package/src/main.cpp +321 -0
  182. package/src/obs_interface.cpp +605 -0
  183. package/src/obs_interface.h +74 -0
  184. package/src/utils.cpp +80 -0
  185. package/src/utils.h +3 -0
@@ -0,0 +1,292 @@
1
+ /*
2
+ * lanczos sharper
3
+ * note - this shader is adapted from the GPL bsnes shader, very good stuff
4
+ * there.
5
+ */
6
+
7
+ #include "color.effect"
8
+
9
+ uniform float4x4 ViewProj;
10
+ uniform texture2d image;
11
+ uniform float2 base_dimension;
12
+ uniform float2 base_dimension_i;
13
+ uniform float undistort_factor = 1.0;
14
+ uniform float multiplier;
15
+
16
+ sampler_state textureSampler
17
+ {
18
+ AddressU = Clamp;
19
+ AddressV = Clamp;
20
+ Filter = Linear;
21
+ };
22
+
23
+ struct VertData {
24
+ float4 pos : POSITION;
25
+ float2 uv : TEXCOORD0;
26
+ };
27
+
28
+ struct VertOut {
29
+ float2 uv : TEXCOORD0;
30
+ float4 pos : POSITION;
31
+ };
32
+
33
+ struct FragData {
34
+ float2 uv : TEXCOORD0;
35
+ };
36
+
37
+ VertOut VSDefault(VertData v_in)
38
+ {
39
+ VertOut vert_out;
40
+ vert_out.uv = v_in.uv * base_dimension;
41
+ vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
42
+
43
+ return vert_out;
44
+ }
45
+
46
+ float weight(float x)
47
+ {
48
+ float x_pi = x * 3.141592654;
49
+ return 3.0 * sin(x_pi) * sin(x_pi * (1.0 / 3.0)) / (x_pi * x_pi);
50
+ }
51
+
52
+ void weight6(float f_neg, out float3 tap012, out float3 tap345)
53
+ {
54
+ tap012 = float3(
55
+ weight(f_neg - 2.0),
56
+ weight(f_neg - 1.0),
57
+ min(1.0, weight(f_neg))); // Replace NaN with 1.0.
58
+ tap345 = float3(
59
+ weight(f_neg + 1.0),
60
+ weight(f_neg + 2.0),
61
+ weight(f_neg + 3.0));
62
+
63
+ // Normalize weights
64
+ float sum = tap012.x + tap012.y + tap012.z + tap345.x + tap345.y + tap345.z;
65
+ float sum_i = 1.0 / sum;
66
+ tap012 = tap012 * sum_i;
67
+ tap345 = tap345 * sum_i;
68
+ }
69
+
70
+ float AspectUndistortX(float x, float a)
71
+ {
72
+ // The higher the power, the longer the linear part will be.
73
+ return (1.0 - a) * (x * x * x * x * x) + a * x;
74
+ }
75
+
76
+ float AspectUndistortU(float u)
77
+ {
78
+ // Normalize texture coord to -1.0 to 1.0 range, and back.
79
+ return AspectUndistortX((u - 0.5) * 2.0, undistort_factor) * 0.5 + 0.5;
80
+ }
81
+
82
+ float2 undistort_coord(float xpos, float ypos)
83
+ {
84
+ return float2(AspectUndistortU(xpos), ypos);
85
+ }
86
+
87
+ float4 undistort_pixel(float xpos, float ypos)
88
+ {
89
+ return image.Sample(textureSampler, undistort_coord(xpos, ypos));
90
+ }
91
+
92
+ float4 undistort_line(float3 xpos012, float3 xpos345, float ypos, float3 rowtap012,
93
+ float3 rowtap345)
94
+ {
95
+ return
96
+ undistort_pixel(xpos012.x, ypos) * rowtap012.x +
97
+ undistort_pixel(xpos012.y, ypos) * rowtap012.y +
98
+ undistort_pixel(xpos012.z, ypos) * rowtap012.z +
99
+ undistort_pixel(xpos345.x, ypos) * rowtap345.x +
100
+ undistort_pixel(xpos345.y, ypos) * rowtap345.y +
101
+ undistort_pixel(xpos345.z, ypos) * rowtap345.z;
102
+ }
103
+
104
+ float4 DrawLanczos(FragData f_in, bool undistort)
105
+ {
106
+ float2 pos = f_in.uv;
107
+ float2 pos2 = floor(pos - 0.5) + 0.5;
108
+ float2 f_neg = pos2 - pos;
109
+
110
+ float3 rowtap012, rowtap345;
111
+ weight6(f_neg.x, rowtap012, rowtap345);
112
+
113
+ float3 coltap012, coltap345;
114
+ weight6(f_neg.y, coltap012, coltap345);
115
+
116
+ float2 uv2 = pos2 * base_dimension_i;
117
+ float2 uv1 = uv2 - base_dimension_i;
118
+ float2 uv0 = uv1 - base_dimension_i;
119
+ float2 uv3 = uv2 + base_dimension_i;
120
+ float2 uv4 = uv3 + base_dimension_i;
121
+ float2 uv5 = uv4 + base_dimension_i;
122
+
123
+ if (undistort) {
124
+ float3 xpos012 = float3(uv0.x, uv1.x, uv2.x);
125
+ float3 xpos345 = float3(uv3.x, uv4.x, uv5.x);
126
+ return undistort_line(xpos012, xpos345, uv0.y, rowtap012, rowtap345) * coltap012.x +
127
+ undistort_line(xpos012, xpos345, uv1.y, rowtap012, rowtap345) * coltap012.y +
128
+ undistort_line(xpos012, xpos345, uv2.y, rowtap012, rowtap345) * coltap012.z +
129
+ undistort_line(xpos012, xpos345, uv3.y, rowtap012, rowtap345) * coltap345.x +
130
+ undistort_line(xpos012, xpos345, uv4.y, rowtap012, rowtap345) * coltap345.y +
131
+ undistort_line(xpos012, xpos345, uv5.y, rowtap012, rowtap345) * coltap345.z;
132
+ }
133
+
134
+ float u_weight_sum = rowtap012.z + rowtap345.x;
135
+ float u_middle_offset = rowtap345.x * base_dimension_i.x / u_weight_sum;
136
+ float u_middle = uv2.x + u_middle_offset;
137
+
138
+ float v_weight_sum = coltap012.z + coltap345.x;
139
+ float v_middle_offset = coltap345.x * base_dimension_i.y / v_weight_sum;
140
+ float v_middle = uv2.y + v_middle_offset;
141
+
142
+ float2 coord_limit = base_dimension - 0.5;
143
+ float2 coord0_f = max(uv0 * base_dimension, 0.5);
144
+ float2 coord1_f = max(uv1 * base_dimension, 0.5);
145
+ float2 coord4_f = min(uv4 * base_dimension, coord_limit);
146
+ float2 coord5_f = min(uv5 * base_dimension, coord_limit);
147
+
148
+ int2 coord0 = int2(coord0_f);
149
+ int2 coord1 = int2(coord1_f);
150
+ int2 coord4 = int2(coord4_f);
151
+ int2 coord5 = int2(coord5_f);
152
+
153
+ float4 row0 = image.Load(int3(coord0, 0)) * rowtap012.x;
154
+ row0 += image.Load(int3(coord1.x, coord0.y, 0)) * rowtap012.y;
155
+ row0 += image.Sample(textureSampler, float2(u_middle, uv0.y)) * u_weight_sum;
156
+ row0 += image.Load(int3(coord4.x, coord0.y, 0)) * rowtap345.y;
157
+ row0 += image.Load(int3(coord5.x, coord0.y, 0)) * rowtap345.z;
158
+ float4 total = row0 * coltap012.x;
159
+
160
+ float4 row1 = image.Load(int3(coord0.x, coord1.y, 0)) * rowtap012.x;
161
+ row1 += image.Load(int3(coord1.x, coord1.y, 0)) * rowtap012.y;
162
+ row1 += image.Sample(textureSampler, float2(u_middle, uv1.y)) * u_weight_sum;
163
+ row1 += image.Load(int3(coord4.x, coord1.y, 0)) * rowtap345.y;
164
+ row1 += image.Load(int3(coord5.x, coord1.y, 0)) * rowtap345.z;
165
+ total += row1 * coltap012.y;
166
+
167
+ float4 row23 = image.Sample(textureSampler, float2(uv0.x, v_middle)) * rowtap012.x;
168
+ row23 += image.Sample(textureSampler, float2(uv1.x, v_middle)) * rowtap012.y;
169
+ row23 += image.Sample(textureSampler, float2(u_middle, v_middle)) * u_weight_sum;
170
+ row23 += image.Sample(textureSampler, float2(uv4.x, v_middle)) * rowtap345.y;
171
+ row23 += image.Sample(textureSampler, float2(uv5.x, v_middle)) * rowtap345.z;
172
+ total += row23 * v_weight_sum;
173
+
174
+ float4 row4 = image.Load(int3(coord0.x, coord4.y, 0)) * rowtap012.x;
175
+ row4 += image.Load(int3(coord1.x, coord4.y, 0)) * rowtap012.y;
176
+ row4 += image.Sample(textureSampler, float2(u_middle, uv4.y)) * u_weight_sum;
177
+ row4 += image.Load(int3(coord4.x, coord4.y, 0)) * rowtap345.y;
178
+ row4 += image.Load(int3(coord5.x, coord4.y, 0)) * rowtap345.z;
179
+ total += row4 * coltap345.y;
180
+
181
+ float4 row5 = image.Load(int3(coord0.x, coord5.y, 0)) * rowtap012.x;
182
+ row5 += image.Load(int3(coord1.x, coord5.y, 0)) * rowtap012.y;
183
+ row5 += image.Sample(textureSampler, float2(u_middle, uv5.y)) * u_weight_sum;
184
+ row5 += image.Load(int3(coord4.x, coord5.y, 0)) * rowtap345.y;
185
+ row5 += image.Load(int3(coord5, 0)) * rowtap345.z;
186
+ total += row5 * coltap345.z;
187
+
188
+ return total;
189
+ }
190
+
191
+ float4 PSDrawLanczosRGBA(FragData f_in, bool undistort) : TARGET
192
+ {
193
+ return DrawLanczos(f_in, undistort);
194
+ }
195
+
196
+ float4 PSDrawLanczosRGBAMultiply(FragData f_in, bool undistort) : TARGET
197
+ {
198
+ float4 rgba = DrawLanczos(f_in, undistort);
199
+ rgba.rgb *= multiplier;
200
+ return rgba;
201
+ }
202
+
203
+ float4 PSDrawLanczosRGBATonemap(FragData f_in, bool undistort) : TARGET
204
+ {
205
+ float4 rgba = DrawLanczos(f_in, undistort);
206
+ rgba.rgb = rec709_to_rec2020(rgba.rgb);
207
+ rgba.rgb = reinhard(rgba.rgb);
208
+ rgba.rgb = rec2020_to_rec709(rgba.rgb);
209
+ return rgba;
210
+ }
211
+
212
+ float4 PSDrawLanczosRGBAMultiplyTonemap(FragData f_in, bool undistort) : TARGET
213
+ {
214
+ float4 rgba = DrawLanczos(f_in, undistort);
215
+ rgba.rgb *= multiplier;
216
+ rgba.rgb = rec709_to_rec2020(rgba.rgb);
217
+ rgba.rgb = reinhard(rgba.rgb);
218
+ rgba.rgb = rec2020_to_rec709(rgba.rgb);
219
+ return rgba;
220
+ }
221
+
222
+ technique Draw
223
+ {
224
+ pass
225
+ {
226
+ vertex_shader = VSDefault(v_in);
227
+ pixel_shader = PSDrawLanczosRGBA(f_in, false);
228
+ }
229
+ }
230
+
231
+ technique DrawMultiply
232
+ {
233
+ pass
234
+ {
235
+ vertex_shader = VSDefault(v_in);
236
+ pixel_shader = PSDrawLanczosRGBAMultiply(f_in, false);
237
+ }
238
+ }
239
+
240
+ technique DrawTonemap
241
+ {
242
+ pass
243
+ {
244
+ vertex_shader = VSDefault(v_in);
245
+ pixel_shader = PSDrawLanczosRGBATonemap(f_in, false);
246
+ }
247
+ }
248
+
249
+ technique DrawMultiplyTonemap
250
+ {
251
+ pass
252
+ {
253
+ vertex_shader = VSDefault(v_in);
254
+ pixel_shader = PSDrawLanczosRGBAMultiplyTonemap(f_in, false);
255
+ }
256
+ }
257
+
258
+ technique DrawUndistort
259
+ {
260
+ pass
261
+ {
262
+ vertex_shader = VSDefault(v_in);
263
+ pixel_shader = PSDrawLanczosRGBA(f_in, true);
264
+ }
265
+ }
266
+
267
+ technique DrawUndistortMultiply
268
+ {
269
+ pass
270
+ {
271
+ vertex_shader = VSDefault(v_in);
272
+ pixel_shader = PSDrawLanczosRGBAMultiply(f_in, true);
273
+ }
274
+ }
275
+
276
+ technique DrawUndistortTonemap
277
+ {
278
+ pass
279
+ {
280
+ vertex_shader = VSDefault(v_in);
281
+ pixel_shader = PSDrawLanczosRGBATonemap(f_in, true);
282
+ }
283
+ }
284
+
285
+ technique DrawUndistortMultiplyTonemap
286
+ {
287
+ pass
288
+ {
289
+ vertex_shader = VSDefault(v_in);
290
+ pixel_shader = PSDrawLanczosRGBAMultiplyTonemap(f_in, true);
291
+ }
292
+ }
@@ -0,0 +1,159 @@
1
+ #include "color.effect"
2
+
3
+ uniform float4x4 ViewProj;
4
+ uniform texture2d image;
5
+ uniform float multiplier;
6
+
7
+ sampler_state def_sampler {
8
+ Filter = Linear;
9
+ AddressU = Clamp;
10
+ AddressV = Clamp;
11
+ };
12
+
13
+ struct VertInOut {
14
+ float4 pos : POSITION;
15
+ float2 uv : TEXCOORD0;
16
+ };
17
+
18
+ VertInOut VSDefault(VertInOut vert_in)
19
+ {
20
+ VertInOut vert_out;
21
+ vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
22
+ vert_out.uv = vert_in.uv;
23
+ return vert_out;
24
+ }
25
+
26
+ float4 PSDraw(VertInOut vert_in) : TARGET
27
+ {
28
+ return float4(image.Sample(def_sampler, vert_in.uv).rgb, 1.0);
29
+ }
30
+
31
+ float4 PSDrawSrgbDecompress(VertInOut vert_in) : TARGET
32
+ {
33
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
34
+ rgb = srgb_nonlinear_to_linear(rgb);
35
+ return float4(rgb, 1.0);
36
+ }
37
+
38
+ float4 PSDrawSrgbDecompressMultiply(VertInOut vert_in) : TARGET
39
+ {
40
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
41
+ rgb = srgb_nonlinear_to_linear(rgb);
42
+ rgb *= multiplier;
43
+ return float4(rgb, 1.0);
44
+ }
45
+
46
+ float4 PSDrawMultiply(VertInOut vert_in) : TARGET
47
+ {
48
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
49
+ rgb *= multiplier;
50
+ return float4(rgb, 1.0);
51
+ }
52
+
53
+ float4 PSDrawTonemap(VertInOut vert_in) : TARGET
54
+ {
55
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
56
+ rgb = rec709_to_rec2020(rgb);
57
+ rgb = reinhard(rgb);
58
+ rgb = rec2020_to_rec709(rgb);
59
+ return float4(rgb, 1.0);
60
+ }
61
+
62
+ float4 PSDrawMultiplyTonemap(VertInOut vert_in) : TARGET
63
+ {
64
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
65
+ rgb *= multiplier;
66
+ rgb = rec709_to_rec2020(rgb);
67
+ rgb = reinhard(rgb);
68
+ rgb = rec2020_to_rec709(rgb);
69
+ return float4(rgb, 1.0);
70
+ }
71
+
72
+ float4 PSDrawPQ(VertInOut vert_in) : TARGET
73
+ {
74
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
75
+ rgb = st2084_to_linear(rgb) * multiplier;
76
+ rgb = rec2020_to_rec709(rgb);
77
+ return float4(rgb, 1.0);
78
+ }
79
+
80
+ float4 PSDrawTonemapPQ(VertInOut vert_in) : TARGET
81
+ {
82
+ float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
83
+ rgb = st2084_to_linear(rgb) * multiplier;
84
+ rgb = reinhard(rgb);
85
+ rgb = rec2020_to_rec709(rgb);
86
+ return float4(rgb, 1.0);
87
+ }
88
+
89
+ technique Draw
90
+ {
91
+ pass
92
+ {
93
+ vertex_shader = VSDefault(vert_in);
94
+ pixel_shader = PSDraw(vert_in);
95
+ }
96
+ }
97
+
98
+ technique DrawSrgbDecompress
99
+ {
100
+ pass
101
+ {
102
+ vertex_shader = VSDefault(vert_in);
103
+ pixel_shader = PSDrawSrgbDecompress(vert_in);
104
+ }
105
+ }
106
+
107
+ technique DrawSrgbDecompressMultiply
108
+ {
109
+ pass
110
+ {
111
+ vertex_shader = VSDefault(vert_in);
112
+ pixel_shader = PSDrawSrgbDecompressMultiply(vert_in);
113
+ }
114
+ }
115
+
116
+ technique DrawMultiply
117
+ {
118
+ pass
119
+ {
120
+ vertex_shader = VSDefault(vert_in);
121
+ pixel_shader = PSDrawMultiply(vert_in);
122
+ }
123
+ }
124
+
125
+ technique DrawTonemap
126
+ {
127
+ pass
128
+ {
129
+ vertex_shader = VSDefault(vert_in);
130
+ pixel_shader = PSDrawTonemap(vert_in);
131
+ }
132
+ }
133
+
134
+ technique DrawMultiplyTonemap
135
+ {
136
+ pass
137
+ {
138
+ vertex_shader = VSDefault(vert_in);
139
+ pixel_shader = PSDrawMultiplyTonemap(vert_in);
140
+ }
141
+ }
142
+
143
+ technique DrawPQ
144
+ {
145
+ pass
146
+ {
147
+ vertex_shader = VSDefault(vert_in);
148
+ pixel_shader = PSDrawPQ(vert_in);
149
+ }
150
+ }
151
+
152
+ technique DrawTonemapPQ
153
+ {
154
+ pass
155
+ {
156
+ vertex_shader = VSDefault(vert_in);
157
+ pixel_shader = PSDrawTonemapPQ(vert_in);
158
+ }
159
+ }
@@ -0,0 +1,38 @@
1
+ uniform float4x4 ViewProj;
2
+ uniform texture2d image;
3
+
4
+ sampler_state def_sampler {
5
+ Filter = Linear;
6
+ AddressU = Clamp;
7
+ AddressV = Clamp;
8
+ };
9
+
10
+ struct VertInOut {
11
+ float4 pos : POSITION;
12
+ float2 uv : TEXCOORD0;
13
+ };
14
+
15
+ VertInOut VSDefault(VertInOut vert_in)
16
+ {
17
+ VertInOut vert_out;
18
+ vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
19
+ vert_out.uv = vert_in.uv;
20
+ return vert_out;
21
+ }
22
+
23
+ float4 PSDraw(VertInOut vert_in) : TARGET
24
+ {
25
+ float4 rgba = image.Sample(def_sampler, vert_in.uv);
26
+ if (rgba.a > 0.0)
27
+ rgba.rgb /= rgba.a;
28
+ return saturate(rgba);
29
+ }
30
+
31
+ technique Draw
32
+ {
33
+ pass
34
+ {
35
+ vertex_shader = VSDefault(vert_in);
36
+ pixel_shader = PSDraw(vert_in);
37
+ }
38
+ }
@@ -0,0 +1,36 @@
1
+ uniform float4x4 ViewProj;
2
+ uniform texture2d image;
3
+ uniform float2 scale;
4
+
5
+ sampler_state def_sampler {
6
+ Filter = Linear;
7
+ AddressU = Repeat;
8
+ AddressV = Repeat;
9
+ };
10
+
11
+ struct VertInOut {
12
+ float4 pos : POSITION;
13
+ float2 uv : TEXCOORD0;
14
+ };
15
+
16
+ VertInOut VSDefault(VertInOut vert_in)
17
+ {
18
+ VertInOut vert_out;
19
+ vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
20
+ vert_out.uv = vert_in.uv * scale;
21
+ return vert_out;
22
+ }
23
+
24
+ float4 PSDrawBare(VertInOut vert_in) : TARGET
25
+ {
26
+ return image.Sample(def_sampler, vert_in.uv);
27
+ }
28
+
29
+ technique Draw
30
+ {
31
+ pass
32
+ {
33
+ vertex_shader = VSDefault(vert_in);
34
+ pixel_shader = PSDrawBare(vert_in);
35
+ }
36
+ }
@@ -0,0 +1,80 @@
1
+ uniform float4x4 ViewProj;
2
+ uniform float4 color = {1.0, 1.0, 1.0, 1.0};
3
+
4
+ uniform float4 randomvals1;
5
+ uniform float4 randomvals2;
6
+ uniform float4 randomvals3;
7
+
8
+ struct SolidVertInOut {
9
+ float4 pos : POSITION;
10
+ };
11
+
12
+ SolidVertInOut VSSolid(SolidVertInOut vert_in)
13
+ {
14
+ SolidVertInOut vert_out;
15
+ vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
16
+ return vert_out;
17
+ }
18
+
19
+ float4 PSSolid(SolidVertInOut vert_in) : TARGET
20
+ {
21
+ return color;
22
+ }
23
+
24
+ float rand(float4 pos, float4 rand_vals)
25
+ {
26
+ return 0.5 + 0.5 * frac(sin(dot(pos.xy, float2(rand_vals.x, rand_vals.y))) * rand_vals.z);
27
+ }
28
+
29
+ float4 PSRandom(SolidVertInOut vert_in) : TARGET
30
+ {
31
+ return float4(rand(vert_in.pos, randomvals1),
32
+ rand(vert_in.pos, randomvals2),
33
+ rand(vert_in.pos, randomvals3),
34
+ 1.0);
35
+ }
36
+
37
+ struct SolidColoredVertInOut {
38
+ float4 pos : POSITION;
39
+ float4 color : COLOR;
40
+ };
41
+
42
+ SolidColoredVertInOut VSSolidColored(SolidColoredVertInOut vert_in)
43
+ {
44
+ SolidColoredVertInOut vert_out;
45
+ vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
46
+ vert_out.color = vert_in.color;
47
+ return vert_out;
48
+ }
49
+
50
+ float4 PSSolidColored(SolidColoredVertInOut vert_in) : TARGET
51
+ {
52
+ return vert_in.color * color;
53
+ }
54
+
55
+ technique Solid
56
+ {
57
+ pass
58
+ {
59
+ vertex_shader = VSSolid(vert_in);
60
+ pixel_shader = PSSolid(vert_in);
61
+ }
62
+ }
63
+
64
+ technique SolidColored
65
+ {
66
+ pass
67
+ {
68
+ vertex_shader = VSSolidColored(vert_in);
69
+ pixel_shader = PSSolidColored(vert_in);
70
+ }
71
+ }
72
+
73
+ technique Random
74
+ {
75
+ pass
76
+ {
77
+ vertex_shader = VSSolid(vert_in);
78
+ pixel_shader = PSRandom(vert_in);
79
+ }
80
+ }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ #pragma once
2
+
3
+ static bool success_(OSStatus stat, const char *func, const char *call)
4
+ {
5
+ if (stat != noErr) {
6
+ blog(LOG_WARNING, "%s: %s failed: %d", func, call, (int)stat);
7
+ return false;
8
+ }
9
+
10
+ return true;
11
+ }
12
+
13
+ #define success(stat, call) success_(stat, __FUNCTION__, call)