rasterizer_effects_rd.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /*************************************************************************/
  2. /* rasterizer_effects_rd.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef RASTERIZER_EFFECTS_RD_H
  31. #define RASTERIZER_EFFECTS_RD_H
  32. #include "core/math/camera_matrix.h"
  33. #include "servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
  34. #include "servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl.gen.h"
  35. #include "servers/rendering/rasterizer_rd/shaders/copy.glsl.gen.h"
  36. #include "servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl.gen.h"
  37. #include "servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl.gen.h"
  38. #include "servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl.gen.h"
  39. #include "servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl.gen.h"
  40. #include "servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl.gen.h"
  41. #include "servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl.gen.h"
  42. #include "servers/rendering/rasterizer_rd/shaders/resolve.glsl.gen.h"
  43. #include "servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl.gen.h"
  44. #include "servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl.gen.h"
  45. #include "servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl.gen.h"
  46. #include "servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl.gen.h"
  47. #include "servers/rendering/rasterizer_rd/shaders/shadow_reduce.glsl.gen.h"
  48. #include "servers/rendering/rasterizer_rd/shaders/sort.glsl.gen.h"
  49. #include "servers/rendering/rasterizer_rd/shaders/specular_merge.glsl.gen.h"
  50. #include "servers/rendering/rasterizer_rd/shaders/ssao.glsl.gen.h"
  51. #include "servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl.gen.h"
  52. #include "servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl.gen.h"
  53. #include "servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl.gen.h"
  54. #include "servers/rendering/rasterizer_rd/shaders/tonemap.glsl.gen.h"
  55. #include "servers/rendering_server.h"
  56. class RasterizerEffectsRD {
  57. enum CopyMode {
  58. COPY_MODE_GAUSSIAN_COPY,
  59. COPY_MODE_GAUSSIAN_COPY_8BIT,
  60. COPY_MODE_GAUSSIAN_GLOW,
  61. COPY_MODE_GAUSSIAN_GLOW_AUTO_EXPOSURE,
  62. COPY_MODE_SIMPLY_COPY,
  63. COPY_MODE_SIMPLY_COPY_8BIT,
  64. COPY_MODE_SIMPLY_COPY_DEPTH,
  65. COPY_MODE_MIPMAP,
  66. COPY_MODE_LINEARIZE_DEPTH,
  67. COPY_MODE_CUBE_TO_PANORAMA,
  68. COPY_MODE_CUBE_ARRAY_TO_PANORAMA,
  69. COPY_MODE_MAX,
  70. };
  71. enum {
  72. COPY_FLAG_HORIZONTAL = (1 << 0),
  73. COPY_FLAG_USE_COPY_SECTION = (1 << 1),
  74. COPY_FLAG_USE_ORTHOGONAL_PROJECTION = (1 << 2),
  75. COPY_FLAG_DOF_NEAR_FIRST_TAP = (1 << 3),
  76. COPY_FLAG_GLOW_FIRST_PASS = (1 << 4),
  77. COPY_FLAG_FLIP_Y = (1 << 5),
  78. COPY_FLAG_FORCE_LUMINANCE = (1 << 6),
  79. COPY_FLAG_ALL_SOURCE = (1 << 7),
  80. COPY_FLAG_HIGH_QUALITY_GLOW = (1 << 8)
  81. };
  82. struct CopyPushConstant {
  83. int32_t section[4];
  84. int32_t target[2];
  85. uint32_t flags;
  86. uint32_t pad;
  87. // Glow.
  88. float glow_strength;
  89. float glow_bloom;
  90. float glow_hdr_threshold;
  91. float glow_hdr_scale;
  92. float glow_exposure;
  93. float glow_white;
  94. float glow_luminance_cap;
  95. float glow_auto_exposure_grey;
  96. // DOF.
  97. float camera_z_far;
  98. float camera_z_near;
  99. uint32_t pad2[2];
  100. };
  101. struct Copy {
  102. CopyPushConstant push_constant;
  103. CopyShaderRD shader;
  104. RID shader_version;
  105. RID pipelines[COPY_MODE_MAX];
  106. } copy;
  107. enum CopyToFBMode {
  108. COPY_TO_FB_COPY,
  109. COPY_TO_FB_COPY_PANORAMA_TO_DP,
  110. COPY_TO_FB_COPY2,
  111. COPY_TO_FB_MAX,
  112. };
  113. struct CopyToFbPushConstant {
  114. float section[4];
  115. float pixel_size[2];
  116. uint32_t flip_y;
  117. uint32_t use_section;
  118. uint32_t force_luminance;
  119. uint32_t alpha_to_zero;
  120. uint32_t srgb;
  121. uint32_t pad;
  122. };
  123. struct CopyToFb {
  124. CopyToFbPushConstant push_constant;
  125. CopyToFbShaderRD shader;
  126. RID shader_version;
  127. RenderPipelineVertexFormatCacheRD pipelines[COPY_TO_FB_MAX];
  128. } copy_to_fb;
  129. struct CubemapRoughnessPushConstant {
  130. uint32_t face_id;
  131. uint32_t sample_count;
  132. float roughness;
  133. uint32_t use_direct_write;
  134. float face_size;
  135. float pad[3];
  136. };
  137. struct CubemapRoughness {
  138. CubemapRoughnessPushConstant push_constant;
  139. CubemapRoughnessShaderRD shader;
  140. RID shader_version;
  141. RID pipeline;
  142. } roughness;
  143. enum TonemapMode {
  144. TONEMAP_MODE_NORMAL,
  145. TONEMAP_MODE_BICUBIC_GLOW_FILTER,
  146. TONEMAP_MODE_MAX
  147. };
  148. struct TonemapPushConstant {
  149. float bcs[3];
  150. uint32_t use_bcs;
  151. uint32_t use_glow;
  152. uint32_t use_auto_exposure;
  153. uint32_t use_color_correction;
  154. uint32_t tonemapper;
  155. uint32_t glow_texture_size[2];
  156. float glow_intensity;
  157. uint32_t pad3;
  158. uint32_t glow_mode;
  159. float glow_levels[7];
  160. float exposure;
  161. float white;
  162. float auto_exposure_grey;
  163. uint32_t pad2;
  164. float pixel_size[2];
  165. uint32_t use_fxaa;
  166. uint32_t pad;
  167. };
  168. /* tonemap actually writes to a framebuffer, which is
  169. * better to do using the raster pipeline rather than
  170. * comptute, as that framebuffer might be in different formats
  171. */
  172. struct Tonemap {
  173. TonemapPushConstant push_constant;
  174. TonemapShaderRD shader;
  175. RID shader_version;
  176. RenderPipelineVertexFormatCacheRD pipelines[TONEMAP_MODE_MAX];
  177. } tonemap;
  178. enum LuminanceReduceMode {
  179. LUMINANCE_REDUCE_READ,
  180. LUMINANCE_REDUCE,
  181. LUMINANCE_REDUCE_WRITE,
  182. LUMINANCE_REDUCE_MAX
  183. };
  184. struct LuminanceReducePushConstant {
  185. int32_t source_size[2];
  186. float max_luminance;
  187. float min_luminance;
  188. float exposure_adjust;
  189. float pad[3];
  190. };
  191. struct LuminanceReduce {
  192. LuminanceReducePushConstant push_constant;
  193. LuminanceReduceShaderRD shader;
  194. RID shader_version;
  195. RID pipelines[LUMINANCE_REDUCE_MAX];
  196. } luminance_reduce;
  197. struct CopyToDPPushConstant {
  198. int32_t screen_size[2];
  199. int32_t dest_offset[2];
  200. float bias;
  201. float z_far;
  202. float z_near;
  203. uint32_t z_flip;
  204. };
  205. struct CoptToDP {
  206. CubeToDpShaderRD shader;
  207. RID shader_version;
  208. RID pipeline;
  209. } cube_to_dp;
  210. struct BokehPushConstant {
  211. uint32_t size[2];
  212. float z_far;
  213. float z_near;
  214. uint32_t orthogonal;
  215. float blur_size;
  216. float blur_scale;
  217. uint32_t steps;
  218. uint32_t blur_near_active;
  219. float blur_near_begin;
  220. float blur_near_end;
  221. uint32_t blur_far_active;
  222. float blur_far_begin;
  223. float blur_far_end;
  224. uint32_t second_pass;
  225. uint32_t half_size;
  226. uint32_t use_jitter;
  227. float jitter_seed;
  228. uint32_t pad[2];
  229. };
  230. enum BokehMode {
  231. BOKEH_GEN_BLUR_SIZE,
  232. BOKEH_GEN_BOKEH_BOX,
  233. BOKEH_GEN_BOKEH_HEXAGONAL,
  234. BOKEH_GEN_BOKEH_CIRCULAR,
  235. BOKEH_COMPOSITE,
  236. BOKEH_MAX
  237. };
  238. struct Bokeh {
  239. BokehPushConstant push_constant;
  240. BokehDofShaderRD shader;
  241. RID shader_version;
  242. RID pipelines[BOKEH_MAX];
  243. } bokeh;
  244. enum SSAOMode {
  245. SSAO_MINIFY_FIRST,
  246. SSAO_MINIFY_MIPMAP,
  247. SSAO_GATHER_LOW,
  248. SSAO_GATHER_MEDIUM,
  249. SSAO_GATHER_HIGH,
  250. SSAO_GATHER_ULTRA,
  251. SSAO_GATHER_LOW_HALF,
  252. SSAO_GATHER_MEDIUM_HALF,
  253. SSAO_GATHER_HIGH_HALF,
  254. SSAO_GATHER_ULTRA_HALF,
  255. SSAO_BLUR_PASS,
  256. SSAO_BLUR_PASS_HALF,
  257. SSAO_BLUR_UPSCALE,
  258. SSAO_MAX
  259. };
  260. struct SSAOMinifyPushConstant {
  261. float pixel_size[2];
  262. float z_far;
  263. float z_near;
  264. int32_t source_size[2];
  265. uint32_t orthogonal;
  266. uint32_t pad;
  267. };
  268. struct SSAOGatherPushConstant {
  269. int32_t screen_size[2];
  270. float z_far;
  271. float z_near;
  272. uint32_t orthogonal;
  273. float intensity_div_r6;
  274. float radius;
  275. float bias;
  276. float proj_info[4];
  277. float pixel_size[2];
  278. float proj_scale;
  279. uint32_t pad;
  280. };
  281. struct SSAOBlurPushConstant {
  282. float edge_sharpness;
  283. int32_t filter_scale;
  284. float z_far;
  285. float z_near;
  286. uint32_t orthogonal;
  287. uint32_t pad[3];
  288. int32_t axis[2];
  289. int32_t screen_size[2];
  290. };
  291. struct SSAO {
  292. SSAOMinifyPushConstant minify_push_constant;
  293. SsaoMinifyShaderRD minify_shader;
  294. RID minify_shader_version;
  295. SSAOGatherPushConstant gather_push_constant;
  296. SsaoShaderRD gather_shader;
  297. RID gather_shader_version;
  298. SSAOBlurPushConstant blur_push_constant;
  299. SsaoBlurShaderRD blur_shader;
  300. RID blur_shader_version;
  301. RID pipelines[SSAO_MAX];
  302. } ssao;
  303. struct RoughnessLimiterPushConstant {
  304. int32_t screen_size[2];
  305. float curve;
  306. uint32_t pad;
  307. };
  308. struct RoughnessLimiter {
  309. RoughnessLimiterPushConstant push_constant;
  310. RoughnessLimiterShaderRD shader;
  311. RID shader_version;
  312. RID pipeline;
  313. } roughness_limiter;
  314. struct CubemapDownsamplerPushConstant {
  315. uint32_t face_size;
  316. float pad[3];
  317. };
  318. struct CubemapDownsampler {
  319. CubemapDownsamplerPushConstant push_constant;
  320. CubemapDownsamplerShaderRD shader;
  321. RID shader_version;
  322. RID pipeline;
  323. } cubemap_downsampler;
  324. enum CubemapFilterMode {
  325. FILTER_MODE_HIGH_QUALITY,
  326. FILTER_MODE_LOW_QUALITY,
  327. FILTER_MODE_HIGH_QUALITY_ARRAY,
  328. FILTER_MODE_LOW_QUALITY_ARRAY,
  329. FILTER_MODE_MAX,
  330. };
  331. struct CubemapFilter {
  332. CubemapFilterShaderRD shader;
  333. RID shader_version;
  334. RID pipelines[FILTER_MODE_MAX];
  335. RID uniform_set;
  336. RID image_uniform_set;
  337. RID coefficient_buffer;
  338. bool use_high_quality;
  339. } filter;
  340. struct SkyPushConstant {
  341. float orientation[12];
  342. float proj[4];
  343. float position[3];
  344. float multiplier;
  345. float time;
  346. float pad[3];
  347. };
  348. enum SpecularMergeMode {
  349. SPECULAR_MERGE_ADD,
  350. SPECULAR_MERGE_SSR,
  351. SPECULAR_MERGE_ADDITIVE_ADD,
  352. SPECULAR_MERGE_ADDITIVE_SSR,
  353. SPECULAR_MERGE_MAX
  354. };
  355. /* Specular merge must be done using raster, rather than compute
  356. * because it must continue the existing color buffer
  357. */
  358. struct SpecularMerge {
  359. SpecularMergeShaderRD shader;
  360. RID shader_version;
  361. RenderPipelineVertexFormatCacheRD pipelines[SPECULAR_MERGE_MAX];
  362. } specular_merge;
  363. enum ScreenSpaceReflectionMode {
  364. SCREEN_SPACE_REFLECTION_NORMAL,
  365. SCREEN_SPACE_REFLECTION_ROUGH,
  366. SCREEN_SPACE_REFLECTION_MAX,
  367. };
  368. struct ScreenSpaceReflectionPushConstant {
  369. float proj_info[4];
  370. int32_t screen_size[2];
  371. float camera_z_near;
  372. float camera_z_far;
  373. int32_t num_steps;
  374. float depth_tolerance;
  375. float distance_fade;
  376. float curve_fade_in;
  377. uint32_t orthogonal;
  378. float filter_mipmap_levels;
  379. uint32_t use_half_res;
  380. uint8_t metallic_mask[4];
  381. float projection[16];
  382. };
  383. struct ScreenSpaceReflection {
  384. ScreenSpaceReflectionPushConstant push_constant;
  385. ScreenSpaceReflectionShaderRD shader;
  386. RID shader_version;
  387. RID pipelines[SCREEN_SPACE_REFLECTION_MAX];
  388. } ssr;
  389. struct ScreenSpaceReflectionFilterPushConstant {
  390. float proj_info[4];
  391. uint32_t orthogonal;
  392. float edge_tolerance;
  393. int32_t increment;
  394. uint32_t pad;
  395. int32_t screen_size[2];
  396. uint32_t vertical;
  397. uint32_t steps;
  398. };
  399. enum {
  400. SCREEN_SPACE_REFLECTION_FILTER_HORIZONTAL,
  401. SCREEN_SPACE_REFLECTION_FILTER_VERTICAL,
  402. SCREEN_SPACE_REFLECTION_FILTER_MAX,
  403. };
  404. struct ScreenSpaceReflectionFilter {
  405. ScreenSpaceReflectionFilterPushConstant push_constant;
  406. ScreenSpaceReflectionFilterShaderRD shader;
  407. RID shader_version;
  408. RID pipelines[SCREEN_SPACE_REFLECTION_FILTER_MAX];
  409. } ssr_filter;
  410. struct ScreenSpaceReflectionScalePushConstant {
  411. int32_t screen_size[2];
  412. float camera_z_near;
  413. float camera_z_far;
  414. uint32_t orthogonal;
  415. uint32_t filter;
  416. uint32_t pad[2];
  417. };
  418. struct ScreenSpaceReflectionScale {
  419. ScreenSpaceReflectionScalePushConstant push_constant;
  420. ScreenSpaceReflectionScaleShaderRD shader;
  421. RID shader_version;
  422. RID pipeline;
  423. } ssr_scale;
  424. struct SubSurfaceScatteringPushConstant {
  425. int32_t screen_size[2];
  426. float camera_z_far;
  427. float camera_z_near;
  428. uint32_t vertical;
  429. uint32_t orthogonal;
  430. float unit_size;
  431. float scale;
  432. float depth_scale;
  433. uint32_t pad[3];
  434. };
  435. struct SubSurfaceScattering {
  436. SubSurfaceScatteringPushConstant push_constant;
  437. SubsurfaceScatteringShaderRD shader;
  438. RID shader_version;
  439. RID pipelines[3]; //3 quality levels
  440. } sss;
  441. struct ResolvePushConstant {
  442. int32_t screen_size[2];
  443. int32_t samples;
  444. uint32_t pad;
  445. };
  446. enum ResolveMode {
  447. RESOLVE_MODE_GI,
  448. RESOLVE_MODE_GI_GIPROBE,
  449. RESOLVE_MODE_MAX
  450. };
  451. struct Resolve {
  452. ResolvePushConstant push_constant;
  453. ResolveShaderRD shader;
  454. RID shader_version;
  455. RID pipelines[RESOLVE_MODE_MAX]; //3 quality levels
  456. } resolve;
  457. enum ShadowReduceMode {
  458. SHADOW_REDUCE_REDUCE,
  459. SHADOW_REDUCE_FILTER,
  460. SHADOW_REDUCE_MAX
  461. };
  462. struct ShadowReduce {
  463. ShadowReduceShaderRD shader;
  464. RID shader_version;
  465. RID pipelines[SHADOW_REDUCE_MAX];
  466. } shadow_reduce;
  467. enum SortMode {
  468. SORT_MODE_BLOCK,
  469. SORT_MODE_STEP,
  470. SORT_MODE_INNER,
  471. SORT_MODE_MAX
  472. };
  473. struct Sort {
  474. struct PushConstant {
  475. uint32_t total_elements;
  476. uint32_t pad[3];
  477. int32_t job_params[4];
  478. };
  479. SortShaderRD shader;
  480. RID shader_version;
  481. RID pipelines[SORT_MODE_MAX];
  482. } sort;
  483. RID default_sampler;
  484. RID default_mipmap_sampler;
  485. RID index_buffer;
  486. RID index_array;
  487. Map<RID, RID> texture_to_uniform_set_cache;
  488. Map<RID, RID> image_to_uniform_set_cache;
  489. struct TexturePair {
  490. RID texture1;
  491. RID texture2;
  492. _FORCE_INLINE_ bool operator<(const TexturePair &p_pair) const {
  493. if (texture1 == p_pair.texture1) {
  494. return texture2 < p_pair.texture2;
  495. } else {
  496. return texture1 < p_pair.texture1;
  497. }
  498. }
  499. };
  500. Map<RID, RID> texture_to_compute_uniform_set_cache;
  501. Map<TexturePair, RID> texture_pair_to_compute_uniform_set_cache;
  502. Map<TexturePair, RID> image_pair_to_compute_uniform_set_cache;
  503. RID _get_uniform_set_from_image(RID p_texture);
  504. RID _get_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
  505. RID _get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
  506. RID _get_compute_uniform_set_from_texture_pair(RID p_texture, RID p_texture2, bool p_use_mipmaps = false);
  507. RID _get_compute_uniform_set_from_image_pair(RID p_texture, RID p_texture2);
  508. public:
  509. void copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false, bool p_force_luminance = false, bool p_alpha_to_zero = false, bool p_srgb = false, RID p_secondary = RID());
  510. void copy_to_rect(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, bool p_flip_y = false, bool p_force_luminance = false, bool p_all_source = false, bool p_8_bit_dst = false);
  511. void copy_cubemap_to_panorama(RID p_source_cube, RID p_dest_panorama, const Size2i &p_panorama_size, float p_lod, bool p_is_array);
  512. void copy_depth_to_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false);
  513. void copy_depth_to_rect_and_linearize(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, bool p_flip_y, float p_z_near, float p_z_far);
  514. void copy_to_atlas_fb(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2 &p_uv_rect, RD::DrawListID p_draw_list, bool p_flip_y = false, bool p_panorama = false);
  515. void gaussian_blur(RID p_source_rd_texture, RID p_texture, RID p_back_texture, const Rect2i &p_region, bool p_8bit_dst = false);
  516. void gaussian_glow(RID p_source_rd_texture, RID p_back_texture, const Size2i &p_size, float p_strength = 1.0, bool p_high_quality = false, bool p_first_pass = false, float p_luminance_cap = 16.0, float p_exposure = 1.0, float p_bloom = 0.0, float p_hdr_bleed_treshold = 1.0, float p_hdr_bleed_scale = 1.0, RID p_auto_exposure = RID(), float p_auto_exposure_grey = 1.0);
  517. void cubemap_roughness(RID p_source_rd_texture, RID p_dest_framebuffer, uint32_t p_face_id, uint32_t p_sample_count, float p_roughness, float p_size);
  518. void make_mipmap(RID p_source_rd_texture, RID p_dest_texture, const Size2i &p_size);
  519. void copy_cubemap_to_dp(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, float p_z_near, float p_z_far, float p_bias, bool p_dp_flip);
  520. void luminance_reduction(RID p_source_texture, const Size2i p_source_size, const Vector<RID> p_reduce, RID p_prev_luminance, float p_min_luminance, float p_max_luminance, float p_adjust, bool p_set = false);
  521. void bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i &p_base_texture_size, RID p_secondary_texture, RID p_bokeh_texture1, RID p_bokeh_texture2, bool p_dof_far, float p_dof_far_begin, float p_dof_far_size, bool p_dof_near, float p_dof_near_begin, float p_dof_near_size, float p_bokeh_size, RS::DOFBokehShape p_bokeh_shape, RS::DOFBlurQuality p_quality, bool p_use_jitter, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal);
  522. struct TonemapSettings {
  523. bool use_glow = false;
  524. enum GlowMode {
  525. GLOW_MODE_ADD,
  526. GLOW_MODE_SCREEN,
  527. GLOW_MODE_SOFTLIGHT,
  528. GLOW_MODE_REPLACE,
  529. GLOW_MODE_MIX
  530. };
  531. GlowMode glow_mode = GLOW_MODE_ADD;
  532. float glow_intensity = 1.0;
  533. float glow_levels[7] = { 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0 };
  534. Vector2i glow_texture_size;
  535. bool glow_use_bicubic_upscale = false;
  536. RID glow_texture;
  537. RS::EnvironmentToneMapper tonemap_mode = RS::ENV_TONE_MAPPER_LINEAR;
  538. float exposure = 1.0;
  539. float white = 1.0;
  540. bool use_auto_exposure = false;
  541. float auto_exposure_grey = 0.5;
  542. RID exposure_texture;
  543. bool use_bcs = false;
  544. float brightness = 1.0;
  545. float contrast = 1.0;
  546. float saturation = 1.0;
  547. bool use_color_correction = false;
  548. RID color_correction_texture;
  549. bool use_fxaa = false;
  550. Vector2i texture_size;
  551. };
  552. void tonemapper(RID p_source_color, RID p_dst_framebuffer, const TonemapSettings &p_settings);
  553. void generate_ssao(RID p_depth_buffer, RID p_normal_buffer, const Size2i &p_depth_buffer_size, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao1, bool p_half_size, RID p_ao2, RID p_upscale_buffer, float p_intensity, float p_radius, float p_bias, const CameraMatrix &p_projection, RS::EnvironmentSSAOQuality p_quality, RS::EnvironmentSSAOBlur p_blur, float p_edge_sharpness);
  554. void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
  555. void cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, const Size2i &p_size);
  556. void cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubemap, bool p_use_array);
  557. void render_sky(RD::DrawListID p_list, float p_time, RID p_fb, RID p_samplers, RID p_fog, RenderPipelineVertexFormatCacheRD *p_pipeline, RID p_uniform_set, RID p_texture_set, const CameraMatrix &p_camera, const Basis &p_orientation, float p_multiplier, const Vector3 &p_position);
  558. void screen_space_reflection(RID p_diffuse, RID p_normal_roughness, RS::EnvironmentSSRRoughnessQuality p_roughness_quality, RID p_blur_radius, RID p_blur_radius2, RID p_metallic, const Color &p_metallic_mask, RID p_depth, RID p_scale_depth, RID p_scale_normal, RID p_output, RID p_output_blur, const Size2i &p_screen_size, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const CameraMatrix &p_camera);
  559. void merge_specular(RID p_dest_framebuffer, RID p_specular, RID p_base, RID p_reflection);
  560. void sub_surface_scattering(RID p_diffuse, RID p_diffuse2, RID p_depth, const CameraMatrix &p_camera, const Size2i &p_screen_size, float p_scale, float p_depth_scale, RS::SubSurfaceScatteringQuality p_quality);
  561. void resolve_gi(RID p_source_depth, RID p_source_normal_roughness, RID p_source_giprobe, RID p_dest_depth, RID p_dest_normal_roughness, RID p_dest_giprobe, Vector2i p_screen_size, int p_samples);
  562. void reduce_shadow(RID p_source_shadow, RID p_dest_shadow, const Size2i &p_source_size, const Rect2i &p_source_rect, int p_shrink_limit, RenderingDevice::ComputeListID compute_list);
  563. void filter_shadow(RID p_shadow, RID p_backing_shadow, const Size2i &p_source_size, const Rect2i &p_source_rect, RS::EnvVolumetricFogShadowFilter p_filter, RenderingDevice::ComputeListID compute_list, bool p_vertical = true, bool p_horizontal = true);
  564. void sort_buffer(RID p_uniform_set, int p_size);
  565. RasterizerEffectsRD();
  566. ~RasterizerEffectsRD();
  567. };
  568. #endif // !RASTERIZER_EFFECTS_RD_H