2019-11-05 12:01:00 +01:00
|
|
|
/*************************************************************************/
|
2020-12-04 19:26:24 +01:00
|
|
|
/* effects_rd.h */
|
2019-11-05 12:01:00 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2022-01-03 21:27:34 +01:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2019-11-05 12:01:00 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2020-12-04 19:26:24 +01:00
|
|
|
#ifndef EFFECTS_RD_H
|
|
|
|
#define EFFECTS_RD_H
|
2019-07-27 15:23:24 +02:00
|
|
|
|
2019-08-26 22:43:58 +02:00
|
|
|
#include "core/math/camera_matrix.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/pipeline_cache_rd.h"
|
2021-07-20 13:40:16 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/blur_raster.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/bokeh_dof.glsl.gen.h"
|
2021-07-29 09:43:17 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/bokeh_dof_raster.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/copy.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/copy_to_fb.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/cube_to_dp.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/cubemap_downsampler.glsl.gen.h"
|
2021-07-27 15:33:47 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/cubemap_downsampler_raster.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/cubemap_filter.glsl.gen.h"
|
2021-07-27 15:33:47 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/cubemap_filter_raster.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/cubemap_roughness.glsl.gen.h"
|
2021-07-27 15:33:47 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/cubemap_roughness_raster.glsl.gen.h"
|
2021-11-23 22:16:03 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/fsr_upscale.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/luminance_reduce.glsl.gen.h"
|
2021-07-20 13:40:16 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/luminance_reduce_raster.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/resolve.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/roughness_limiter.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/screen_space_reflection.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/screen_space_reflection_filter.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/screen_space_reflection_scale.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/sort.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/specular_merge.glsl.gen.h"
|
2021-08-03 09:07:32 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/ss_effects_downsample.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssao.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssao_blur.glsl.gen.h"
|
2020-12-08 06:37:09 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssao_importance_map.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssao_interleave.glsl.gen.h"
|
2021-08-03 09:07:32 +02:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssil.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssil_blur.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssil_importance_map.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/ssil_interleave.glsl.gen.h"
|
2020-12-04 19:26:24 +01:00
|
|
|
#include "servers/rendering/renderer_rd/shaders/subsurface_scattering.glsl.gen.h"
|
|
|
|
#include "servers/rendering/renderer_rd/shaders/tonemap.glsl.gen.h"
|
2021-05-07 15:19:04 +02:00
|
|
|
#include "servers/rendering/renderer_scene_render.h"
|
2020-03-27 19:21:27 +01:00
|
|
|
|
|
|
|
#include "servers/rendering_server.h"
|
2019-07-27 15:23:24 +02:00
|
|
|
|
2020-12-04 19:26:24 +01:00
|
|
|
class EffectsRD {
|
2021-07-27 15:33:47 +02:00
|
|
|
private:
|
|
|
|
bool prefer_raster_effects;
|
|
|
|
|
2021-11-23 22:16:03 +01:00
|
|
|
enum FSRUpscalePass {
|
|
|
|
FSR_UPSCALE_PASS_EASU = 0,
|
|
|
|
FSR_UPSCALE_PASS_RCAS = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FSRUpscalePushConstant {
|
|
|
|
float resolution_width;
|
|
|
|
float resolution_height;
|
|
|
|
float upscaled_width;
|
|
|
|
float upscaled_height;
|
|
|
|
float sharpness;
|
|
|
|
int pass;
|
|
|
|
int _unused0, _unused1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FSRUpscale {
|
|
|
|
FSRUpscalePushConstant push_constant;
|
|
|
|
FsrUpscaleShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipeline;
|
|
|
|
} FSR_upscale;
|
|
|
|
|
2021-07-20 13:40:16 +02:00
|
|
|
enum BlurRasterMode {
|
2021-08-11 13:00:12 +02:00
|
|
|
BLUR_MIPMAP,
|
|
|
|
|
2021-07-20 13:40:16 +02:00
|
|
|
BLUR_MODE_GAUSSIAN_BLUR,
|
|
|
|
BLUR_MODE_GAUSSIAN_GLOW,
|
|
|
|
BLUR_MODE_GAUSSIAN_GLOW_AUTO_EXPOSURE,
|
2021-07-29 09:43:17 +02:00
|
|
|
BLUR_MODE_COPY,
|
2021-07-20 13:40:16 +02:00
|
|
|
|
|
|
|
BLUR_MODE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
BLUR_FLAG_HORIZONTAL = (1 << 0),
|
|
|
|
BLUR_FLAG_USE_ORTHOGONAL_PROJECTION = (1 << 1),
|
|
|
|
BLUR_FLAG_GLOW_FIRST_PASS = (1 << 2),
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BlurRasterPushConstant {
|
|
|
|
float pixel_size[2];
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t pad;
|
|
|
|
|
|
|
|
//glow
|
|
|
|
float glow_strength;
|
|
|
|
float glow_bloom;
|
|
|
|
float glow_hdr_threshold;
|
|
|
|
float glow_hdr_scale;
|
|
|
|
|
|
|
|
float glow_exposure;
|
|
|
|
float glow_white;
|
|
|
|
float glow_luminance_cap;
|
|
|
|
float glow_auto_exposure_grey;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BlurRaster {
|
|
|
|
BlurRasterPushConstant push_constant;
|
|
|
|
BlurRasterShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
PipelineCacheRD pipelines[BLUR_MODE_MAX];
|
|
|
|
} blur_raster;
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
enum CopyMode {
|
|
|
|
COPY_MODE_GAUSSIAN_COPY,
|
|
|
|
COPY_MODE_GAUSSIAN_COPY_8BIT,
|
|
|
|
COPY_MODE_GAUSSIAN_GLOW,
|
|
|
|
COPY_MODE_GAUSSIAN_GLOW_AUTO_EXPOSURE,
|
|
|
|
COPY_MODE_SIMPLY_COPY,
|
|
|
|
COPY_MODE_SIMPLY_COPY_8BIT,
|
|
|
|
COPY_MODE_SIMPLY_COPY_DEPTH,
|
2020-10-28 19:34:27 +01:00
|
|
|
COPY_MODE_SET_COLOR,
|
|
|
|
COPY_MODE_SET_COLOR_8BIT,
|
2020-04-11 19:43:12 +02:00
|
|
|
COPY_MODE_MIPMAP,
|
|
|
|
COPY_MODE_LINEARIZE_DEPTH,
|
2020-05-01 14:34:23 +02:00
|
|
|
COPY_MODE_CUBE_TO_PANORAMA,
|
|
|
|
COPY_MODE_CUBE_ARRAY_TO_PANORAMA,
|
2020-04-11 19:43:12 +02:00
|
|
|
COPY_MODE_MAX,
|
2019-07-27 15:23:24 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2020-04-11 19:43:12 +02:00
|
|
|
COPY_FLAG_HORIZONTAL = (1 << 0),
|
|
|
|
COPY_FLAG_USE_COPY_SECTION = (1 << 1),
|
|
|
|
COPY_FLAG_USE_ORTHOGONAL_PROJECTION = (1 << 2),
|
|
|
|
COPY_FLAG_DOF_NEAR_FIRST_TAP = (1 << 3),
|
|
|
|
COPY_FLAG_GLOW_FIRST_PASS = (1 << 4),
|
|
|
|
COPY_FLAG_FLIP_Y = (1 << 5),
|
|
|
|
COPY_FLAG_FORCE_LUMINANCE = (1 << 6),
|
2020-09-01 08:04:45 +02:00
|
|
|
COPY_FLAG_ALL_SOURCE = (1 << 7),
|
2020-10-28 19:34:27 +01:00
|
|
|
COPY_FLAG_HIGH_QUALITY_GLOW = (1 << 8),
|
|
|
|
COPY_FLAG_ALPHA_TO_ONE = (1 << 9),
|
2019-07-27 15:23:24 +02:00
|
|
|
};
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
struct CopyPushConstant {
|
|
|
|
int32_t section[4];
|
|
|
|
int32_t target[2];
|
2019-07-27 15:23:24 +02:00
|
|
|
uint32_t flags;
|
|
|
|
uint32_t pad;
|
2020-04-11 19:43:12 +02:00
|
|
|
// Glow.
|
2019-07-27 15:23:24 +02:00
|
|
|
float glow_strength;
|
|
|
|
float glow_bloom;
|
|
|
|
float glow_hdr_threshold;
|
|
|
|
float glow_hdr_scale;
|
2020-04-11 19:43:12 +02:00
|
|
|
|
2019-07-27 15:23:24 +02:00
|
|
|
float glow_exposure;
|
|
|
|
float glow_white;
|
|
|
|
float glow_luminance_cap;
|
|
|
|
float glow_auto_exposure_grey;
|
2020-04-11 19:43:12 +02:00
|
|
|
// DOF.
|
2019-07-27 15:23:24 +02:00
|
|
|
float camera_z_far;
|
|
|
|
float camera_z_near;
|
2020-04-11 19:43:12 +02:00
|
|
|
uint32_t pad2[2];
|
2020-10-28 19:34:27 +01:00
|
|
|
//SET color
|
|
|
|
float set_color[4];
|
2020-04-11 19:43:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Copy {
|
|
|
|
CopyPushConstant push_constant;
|
|
|
|
CopyShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[COPY_MODE_MAX];
|
|
|
|
|
|
|
|
} copy;
|
|
|
|
|
2020-04-14 05:05:21 +02:00
|
|
|
enum CopyToFBMode {
|
|
|
|
COPY_TO_FB_COPY,
|
2020-04-14 22:05:45 +02:00
|
|
|
COPY_TO_FB_COPY_PANORAMA_TO_DP,
|
2020-06-25 15:33:28 +02:00
|
|
|
COPY_TO_FB_COPY2,
|
2020-04-14 05:05:21 +02:00
|
|
|
COPY_TO_FB_MAX,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
struct CopyToFbPushConstant {
|
|
|
|
float section[4];
|
|
|
|
float pixel_size[2];
|
|
|
|
uint32_t flip_y;
|
|
|
|
uint32_t use_section;
|
2020-04-14 05:05:21 +02:00
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
uint32_t force_luminance;
|
2020-04-14 05:05:21 +02:00
|
|
|
uint32_t alpha_to_zero;
|
2020-06-25 15:33:28 +02:00
|
|
|
uint32_t srgb;
|
|
|
|
uint32_t pad;
|
2019-07-27 15:23:24 +02:00
|
|
|
};
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
struct CopyToFb {
|
|
|
|
CopyToFbPushConstant push_constant;
|
|
|
|
CopyToFbShaderRD shader;
|
2019-07-27 15:23:24 +02:00
|
|
|
RID shader_version;
|
2020-12-04 19:26:24 +01:00
|
|
|
PipelineCacheRD pipelines[COPY_TO_FB_MAX];
|
2019-07-27 15:23:24 +02:00
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
} copy_to_fb;
|
2019-07-27 15:23:24 +02:00
|
|
|
|
2019-08-26 22:43:58 +02:00
|
|
|
struct CubemapRoughnessPushConstant {
|
|
|
|
uint32_t face_id;
|
|
|
|
uint32_t sample_count;
|
|
|
|
float roughness;
|
|
|
|
uint32_t use_direct_write;
|
2020-03-01 02:16:50 +01:00
|
|
|
float face_size;
|
|
|
|
float pad[3];
|
2019-08-26 22:43:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CubemapRoughness {
|
|
|
|
CubemapRoughnessPushConstant push_constant;
|
2021-07-27 15:33:47 +02:00
|
|
|
CubemapRoughnessShaderRD compute_shader;
|
|
|
|
CubemapRoughnessRasterShaderRD raster_shader;
|
2019-08-26 22:43:58 +02:00
|
|
|
RID shader_version;
|
2021-07-27 15:33:47 +02:00
|
|
|
RID compute_pipeline;
|
|
|
|
PipelineCacheRD raster_pipeline;
|
2019-08-26 22:43:58 +02:00
|
|
|
} roughness;
|
|
|
|
|
2019-08-27 20:27:35 +02:00
|
|
|
enum TonemapMode {
|
|
|
|
TONEMAP_MODE_NORMAL,
|
|
|
|
TONEMAP_MODE_BICUBIC_GLOW_FILTER,
|
2020-11-23 02:51:31 +01:00
|
|
|
TONEMAP_MODE_1D_LUT,
|
|
|
|
TONEMAP_MODE_BICUBIC_GLOW_FILTER_1D_LUT,
|
2021-06-26 12:49:25 +02:00
|
|
|
TONEMAP_MODE_SUBPASS,
|
|
|
|
TONEMAP_MODE_SUBPASS_1D_LUT,
|
2021-05-07 15:19:04 +02:00
|
|
|
|
|
|
|
TONEMAP_MODE_NORMAL_MULTIVIEW,
|
|
|
|
TONEMAP_MODE_BICUBIC_GLOW_FILTER_MULTIVIEW,
|
|
|
|
TONEMAP_MODE_1D_LUT_MULTIVIEW,
|
|
|
|
TONEMAP_MODE_BICUBIC_GLOW_FILTER_1D_LUT_MULTIVIEW,
|
2021-06-26 12:49:25 +02:00
|
|
|
TONEMAP_MODE_SUBPASS_MULTIVIEW,
|
|
|
|
TONEMAP_MODE_SUBPASS_1D_LUT_MULTIVIEW,
|
2021-05-07 15:19:04 +02:00
|
|
|
|
2019-08-27 20:27:35 +02:00
|
|
|
TONEMAP_MODE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TonemapPushConstant {
|
2021-07-29 09:43:17 +02:00
|
|
|
float bcs[3]; // 12 - 12
|
|
|
|
uint32_t use_bcs; // 4 - 16
|
2019-08-27 20:27:35 +02:00
|
|
|
|
2021-07-29 09:43:17 +02:00
|
|
|
uint32_t use_glow; // 4 - 20
|
|
|
|
uint32_t use_auto_exposure; // 4 - 24
|
|
|
|
uint32_t use_color_correction; // 4 - 28
|
|
|
|
uint32_t tonemapper; // 4 - 32
|
2019-08-27 20:27:35 +02:00
|
|
|
|
2021-07-29 09:43:17 +02:00
|
|
|
uint32_t glow_texture_size[2]; // 8 - 40
|
|
|
|
float glow_intensity; // 4 - 44
|
|
|
|
uint32_t pad3; // 4 - 48
|
2020-09-20 00:02:32 +02:00
|
|
|
|
2021-07-29 09:43:17 +02:00
|
|
|
uint32_t glow_mode; // 4 - 52
|
|
|
|
float glow_levels[7]; // 28 - 80
|
2019-08-27 20:27:35 +02:00
|
|
|
|
2021-07-29 09:43:17 +02:00
|
|
|
float exposure; // 4 - 84
|
|
|
|
float white; // 4 - 88
|
|
|
|
float auto_exposure_grey; // 4 - 92
|
2021-07-26 13:31:15 +02:00
|
|
|
float luminance_multiplier; // 4 - 96
|
2020-04-12 06:49:10 +02:00
|
|
|
|
2021-07-29 09:43:17 +02:00
|
|
|
float pixel_size[2]; // 8 - 104
|
|
|
|
uint32_t use_fxaa; // 4 - 108
|
|
|
|
uint32_t use_debanding; // 4 - 112
|
2019-08-27 20:27:35 +02:00
|
|
|
};
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
/* tonemap actually writes to a framebuffer, which is
|
|
|
|
* better to do using the raster pipeline rather than
|
2020-11-23 02:51:31 +01:00
|
|
|
* compute, as that framebuffer might be in different formats
|
2020-04-11 19:43:12 +02:00
|
|
|
*/
|
2019-08-27 20:27:35 +02:00
|
|
|
struct Tonemap {
|
|
|
|
TonemapPushConstant push_constant;
|
|
|
|
TonemapShaderRD shader;
|
|
|
|
RID shader_version;
|
2020-12-04 19:26:24 +01:00
|
|
|
PipelineCacheRD pipelines[TONEMAP_MODE_MAX];
|
2019-08-27 20:27:35 +02:00
|
|
|
} tonemap;
|
|
|
|
|
2020-01-12 02:26:52 +01:00
|
|
|
enum LuminanceReduceMode {
|
|
|
|
LUMINANCE_REDUCE_READ,
|
|
|
|
LUMINANCE_REDUCE,
|
|
|
|
LUMINANCE_REDUCE_WRITE,
|
|
|
|
LUMINANCE_REDUCE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LuminanceReducePushConstant {
|
|
|
|
int32_t source_size[2];
|
|
|
|
float max_luminance;
|
|
|
|
float min_luminance;
|
|
|
|
float exposure_adjust;
|
|
|
|
float pad[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LuminanceReduce {
|
|
|
|
LuminanceReducePushConstant push_constant;
|
|
|
|
LuminanceReduceShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[LUMINANCE_REDUCE_MAX];
|
|
|
|
} luminance_reduce;
|
|
|
|
|
2021-07-20 13:40:16 +02:00
|
|
|
enum LuminanceReduceRasterMode {
|
|
|
|
LUMINANCE_REDUCE_FRAGMENT_FIRST,
|
|
|
|
LUMINANCE_REDUCE_FRAGMENT,
|
|
|
|
LUMINANCE_REDUCE_FRAGMENT_FINAL,
|
|
|
|
LUMINANCE_REDUCE_FRAGMENT_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LuminanceReduceRasterPushConstant {
|
|
|
|
int32_t source_size[2];
|
|
|
|
int32_t dest_size[2];
|
|
|
|
float exposure_adjust;
|
|
|
|
float min_luminance;
|
|
|
|
float max_luminance;
|
2021-07-26 13:31:15 +02:00
|
|
|
uint32_t pad1;
|
2021-07-20 13:40:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LuminanceReduceFragment {
|
|
|
|
LuminanceReduceRasterPushConstant push_constant;
|
|
|
|
LuminanceReduceRasterShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
PipelineCacheRD pipelines[LUMINANCE_REDUCE_FRAGMENT_MAX];
|
|
|
|
} luminance_reduce_raster;
|
|
|
|
|
2019-09-07 03:51:27 +02:00
|
|
|
struct CopyToDPPushConstant {
|
|
|
|
float z_far;
|
|
|
|
float z_near;
|
2021-08-04 17:18:06 +02:00
|
|
|
float texel_size[2];
|
2021-01-24 20:00:20 +01:00
|
|
|
float screen_rect[4];
|
2019-09-07 03:51:27 +02:00
|
|
|
};
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
struct CoptToDP {
|
|
|
|
CubeToDpShaderRD shader;
|
2019-09-07 03:51:27 +02:00
|
|
|
RID shader_version;
|
2021-01-24 20:00:20 +01:00
|
|
|
PipelineCacheRD pipeline;
|
2020-04-11 19:43:12 +02:00
|
|
|
} cube_to_dp;
|
2019-09-07 03:51:27 +02:00
|
|
|
|
2020-01-13 19:37:24 +01:00
|
|
|
struct BokehPushConstant {
|
|
|
|
uint32_t size[2];
|
|
|
|
float z_far;
|
|
|
|
float z_near;
|
|
|
|
|
|
|
|
uint32_t orthogonal;
|
|
|
|
float blur_size;
|
|
|
|
float blur_scale;
|
2020-01-16 01:23:21 +01:00
|
|
|
uint32_t steps;
|
2020-01-13 19:37:24 +01:00
|
|
|
|
|
|
|
uint32_t blur_near_active;
|
|
|
|
float blur_near_begin;
|
|
|
|
float blur_near_end;
|
|
|
|
uint32_t blur_far_active;
|
2020-01-16 01:23:21 +01:00
|
|
|
|
2020-01-13 19:37:24 +01:00
|
|
|
float blur_far_begin;
|
|
|
|
float blur_far_end;
|
2020-01-16 01:23:21 +01:00
|
|
|
uint32_t second_pass;
|
|
|
|
uint32_t half_size;
|
|
|
|
|
|
|
|
uint32_t use_jitter;
|
|
|
|
float jitter_seed;
|
|
|
|
uint32_t pad[2];
|
2020-01-13 19:37:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum BokehMode {
|
|
|
|
BOKEH_GEN_BLUR_SIZE,
|
2020-01-16 01:23:21 +01:00
|
|
|
BOKEH_GEN_BOKEH_BOX,
|
2021-07-29 09:43:17 +02:00
|
|
|
BOKEH_GEN_BOKEH_BOX_NOWEIGHT,
|
2020-01-16 01:23:21 +01:00
|
|
|
BOKEH_GEN_BOKEH_HEXAGONAL,
|
2021-07-29 09:43:17 +02:00
|
|
|
BOKEH_GEN_BOKEH_HEXAGONAL_NOWEIGHT,
|
2020-01-16 01:23:21 +01:00
|
|
|
BOKEH_GEN_BOKEH_CIRCULAR,
|
2020-01-13 19:37:24 +01:00
|
|
|
BOKEH_COMPOSITE,
|
|
|
|
BOKEH_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Bokeh {
|
|
|
|
BokehPushConstant push_constant;
|
2021-07-29 09:43:17 +02:00
|
|
|
BokehDofShaderRD compute_shader;
|
|
|
|
BokehDofRasterShaderRD raster_shader;
|
2020-01-13 19:37:24 +01:00
|
|
|
RID shader_version;
|
2021-07-29 09:43:17 +02:00
|
|
|
RID compute_pipelines[BOKEH_MAX];
|
|
|
|
PipelineCacheRD raster_pipelines[BOKEH_MAX];
|
2020-01-13 19:37:24 +01:00
|
|
|
} bokeh;
|
|
|
|
|
2021-08-03 09:07:32 +02:00
|
|
|
struct SSEffectsDownsamplePushConstant {
|
|
|
|
float pixel_size[2];
|
|
|
|
float z_far;
|
|
|
|
float z_near;
|
|
|
|
uint32_t orthogonal;
|
|
|
|
float radius_sq;
|
|
|
|
uint32_t pad[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SSEffectsMode {
|
|
|
|
SS_EFFECTS_DOWNSAMPLE,
|
|
|
|
SS_EFFECTS_DOWNSAMPLE_HALF_RES,
|
|
|
|
SS_EFFECTS_DOWNSAMPLE_MIPMAP,
|
|
|
|
SS_EFFECTS_DOWNSAMPLE_MIPMAP_HALF_RES,
|
|
|
|
SS_EFFECTS_DOWNSAMPLE_HALF,
|
|
|
|
SS_EFFECTS_DOWNSAMPLE_HALF_RES_HALF,
|
|
|
|
SS_EFFECTS_DOWNSAMPLE_FULL_MIPS,
|
|
|
|
SS_EFFECTS_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSEffectsGatherConstants {
|
|
|
|
float rotation_matrices[80]; //5 vec4s * 4
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSEffects {
|
|
|
|
SSEffectsDownsamplePushConstant downsample_push_constant;
|
|
|
|
SsEffectsDownsampleShaderRD downsample_shader;
|
|
|
|
RID downsample_shader_version;
|
|
|
|
RID downsample_uniform_set;
|
|
|
|
bool used_half_size_last_frame = false;
|
|
|
|
bool used_mips_last_frame = false;
|
|
|
|
bool used_full_mips_last_frame = false;
|
|
|
|
|
|
|
|
RID gather_constants_buffer;
|
|
|
|
|
|
|
|
RID mirror_sampler;
|
|
|
|
|
|
|
|
RID pipelines[SS_EFFECTS_MAX];
|
|
|
|
} ss_effects;
|
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
enum SSAOMode {
|
2020-12-08 06:37:09 +01:00
|
|
|
SSAO_GATHER,
|
|
|
|
SSAO_GATHER_BASE,
|
|
|
|
SSAO_GATHER_ADAPTIVE,
|
|
|
|
SSAO_GENERATE_IMPORTANCE_MAP,
|
|
|
|
SSAO_PROCESS_IMPORTANCE_MAPA,
|
|
|
|
SSAO_PROCESS_IMPORTANCE_MAPB,
|
2020-10-19 00:27:51 +02:00
|
|
|
SSAO_BLUR_PASS,
|
2020-12-08 06:37:09 +01:00
|
|
|
SSAO_BLUR_PASS_SMART,
|
|
|
|
SSAO_BLUR_PASS_WIDE,
|
|
|
|
SSAO_INTERLEAVE,
|
|
|
|
SSAO_INTERLEAVE_SMART,
|
|
|
|
SSAO_INTERLEAVE_HALF,
|
2020-01-25 11:18:55 +01:00
|
|
|
SSAO_MAX
|
|
|
|
};
|
|
|
|
|
2020-10-19 00:27:51 +02:00
|
|
|
struct SSAOGatherPushConstant {
|
|
|
|
int32_t screen_size[2];
|
2020-12-08 06:37:09 +01:00
|
|
|
int pass;
|
|
|
|
int quality;
|
|
|
|
|
|
|
|
float half_screen_pixel_size[2];
|
|
|
|
int size_multiplier;
|
|
|
|
float detail_intensity;
|
|
|
|
|
|
|
|
float NDC_to_view_mul[2];
|
|
|
|
float NDC_to_view_add[2];
|
|
|
|
|
|
|
|
float pad[2];
|
|
|
|
float half_screen_pixel_size_x025[2];
|
2020-10-19 00:27:51 +02:00
|
|
|
|
|
|
|
float radius;
|
2020-12-08 06:37:09 +01:00
|
|
|
float intensity;
|
|
|
|
float shadow_power;
|
|
|
|
float shadow_clamp;
|
2020-10-19 00:27:51 +02:00
|
|
|
|
2020-12-08 06:37:09 +01:00
|
|
|
float fade_out_mul;
|
|
|
|
float fade_out_add;
|
|
|
|
float horizon_angle_threshold;
|
|
|
|
float inv_radius_near_limit;
|
|
|
|
|
2021-08-03 09:07:32 +02:00
|
|
|
uint32_t is_orthogonal;
|
2020-12-08 06:37:09 +01:00
|
|
|
float neg_inv_radius;
|
|
|
|
float load_counter_avg_div;
|
|
|
|
float adaptive_sample_limit;
|
|
|
|
|
|
|
|
int32_t pass_coord_offset[2];
|
|
|
|
float pass_uv_offset[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSAOImportanceMapPushConstant {
|
|
|
|
float half_screen_pixel_size[2];
|
|
|
|
float intensity;
|
|
|
|
float power;
|
2020-01-25 11:18:55 +01:00
|
|
|
};
|
|
|
|
|
2020-10-19 00:27:51 +02:00
|
|
|
struct SSAOBlurPushConstant {
|
|
|
|
float edge_sharpness;
|
2020-12-08 06:37:09 +01:00
|
|
|
float pad;
|
|
|
|
float half_screen_pixel_size[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSAOInterleavePushConstant {
|
|
|
|
float inv_sharpness;
|
|
|
|
uint32_t size_modifier;
|
|
|
|
float pixel_size[2];
|
2020-01-25 11:18:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SSAO {
|
2020-10-19 00:27:51 +02:00
|
|
|
SSAOGatherPushConstant gather_push_constant;
|
|
|
|
SsaoShaderRD gather_shader;
|
|
|
|
RID gather_shader_version;
|
2020-12-08 06:37:09 +01:00
|
|
|
|
|
|
|
SSAOImportanceMapPushConstant importance_map_push_constant;
|
|
|
|
SsaoImportanceMapShaderRD importance_map_shader;
|
|
|
|
RID importance_map_shader_version;
|
|
|
|
RID importance_map_load_counter;
|
|
|
|
RID counter_uniform_set;
|
2020-01-25 11:18:55 +01:00
|
|
|
|
2020-10-19 00:27:51 +02:00
|
|
|
SSAOBlurPushConstant blur_push_constant;
|
|
|
|
SsaoBlurShaderRD blur_shader;
|
|
|
|
RID blur_shader_version;
|
2020-01-25 11:18:55 +01:00
|
|
|
|
2020-12-08 06:37:09 +01:00
|
|
|
SSAOInterleavePushConstant interleave_push_constant;
|
|
|
|
SsaoInterleaveShaderRD interleave_shader;
|
|
|
|
RID interleave_shader_version;
|
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
RID pipelines[SSAO_MAX];
|
|
|
|
} ssao;
|
|
|
|
|
2021-08-03 09:07:32 +02:00
|
|
|
enum SSILMode {
|
|
|
|
SSIL_GATHER,
|
|
|
|
SSIL_GATHER_BASE,
|
|
|
|
SSIL_GATHER_ADAPTIVE,
|
|
|
|
SSIL_GENERATE_IMPORTANCE_MAP,
|
|
|
|
SSIL_PROCESS_IMPORTANCE_MAPA,
|
|
|
|
SSIL_PROCESS_IMPORTANCE_MAPB,
|
|
|
|
SSIL_BLUR_PASS,
|
|
|
|
SSIL_BLUR_PASS_SMART,
|
|
|
|
SSIL_BLUR_PASS_WIDE,
|
|
|
|
SSIL_INTERLEAVE,
|
|
|
|
SSIL_INTERLEAVE_SMART,
|
|
|
|
SSIL_INTERLEAVE_HALF,
|
|
|
|
SSIL_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSILGatherPushConstant {
|
|
|
|
int32_t screen_size[2];
|
|
|
|
int pass;
|
|
|
|
int quality;
|
|
|
|
|
|
|
|
float half_screen_pixel_size[2];
|
|
|
|
float half_screen_pixel_size_x025[2];
|
|
|
|
|
|
|
|
float NDC_to_view_mul[2];
|
|
|
|
float NDC_to_view_add[2];
|
|
|
|
|
|
|
|
float pad2[2];
|
|
|
|
float z_near;
|
|
|
|
float z_far;
|
|
|
|
|
|
|
|
float radius;
|
|
|
|
float intensity;
|
|
|
|
int size_multiplier;
|
|
|
|
int pad;
|
|
|
|
|
|
|
|
float fade_out_mul;
|
|
|
|
float fade_out_add;
|
|
|
|
float normal_rejection_amount;
|
|
|
|
float inv_radius_near_limit;
|
|
|
|
|
|
|
|
uint32_t is_orthogonal;
|
|
|
|
float neg_inv_radius;
|
|
|
|
float load_counter_avg_div;
|
|
|
|
float adaptive_sample_limit;
|
|
|
|
|
|
|
|
int32_t pass_coord_offset[2];
|
|
|
|
float pass_uv_offset[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSILImportanceMapPushConstant {
|
|
|
|
float half_screen_pixel_size[2];
|
|
|
|
float intensity;
|
|
|
|
float pad;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSILBlurPushConstant {
|
|
|
|
float edge_sharpness;
|
|
|
|
float pad;
|
|
|
|
float half_screen_pixel_size[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSILInterleavePushConstant {
|
|
|
|
float inv_sharpness;
|
|
|
|
uint32_t size_modifier;
|
|
|
|
float pixel_size[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSILProjectionUniforms {
|
|
|
|
float inv_last_frame_projection_matrix[16];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSIL {
|
|
|
|
SSILGatherPushConstant gather_push_constant;
|
|
|
|
SsilShaderRD gather_shader;
|
|
|
|
RID gather_shader_version;
|
|
|
|
RID projection_uniform_buffer;
|
|
|
|
|
|
|
|
SSILImportanceMapPushConstant importance_map_push_constant;
|
|
|
|
SsilImportanceMapShaderRD importance_map_shader;
|
|
|
|
RID importance_map_shader_version;
|
|
|
|
RID importance_map_load_counter;
|
|
|
|
RID counter_uniform_set;
|
|
|
|
|
|
|
|
SSILBlurPushConstant blur_push_constant;
|
|
|
|
SsilBlurShaderRD blur_shader;
|
|
|
|
RID blur_shader_version;
|
|
|
|
|
|
|
|
SSILInterleavePushConstant interleave_push_constant;
|
|
|
|
SsilInterleaveShaderRD interleave_shader;
|
|
|
|
RID interleave_shader_version;
|
|
|
|
|
|
|
|
RID pipelines[SSIL_MAX];
|
|
|
|
} ssil;
|
|
|
|
|
2020-01-27 00:09:40 +01:00
|
|
|
struct RoughnessLimiterPushConstant {
|
|
|
|
int32_t screen_size[2];
|
|
|
|
float curve;
|
|
|
|
uint32_t pad;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RoughnessLimiter {
|
|
|
|
RoughnessLimiterPushConstant push_constant;
|
|
|
|
RoughnessLimiterShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipeline;
|
|
|
|
|
|
|
|
} roughness_limiter;
|
|
|
|
|
2020-02-21 00:27:34 +01:00
|
|
|
struct CubemapDownsamplerPushConstant {
|
|
|
|
uint32_t face_size;
|
2021-07-27 15:33:47 +02:00
|
|
|
uint32_t face_id;
|
|
|
|
float pad[2];
|
2020-02-21 00:27:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CubemapDownsampler {
|
|
|
|
CubemapDownsamplerPushConstant push_constant;
|
2021-07-27 15:33:47 +02:00
|
|
|
CubemapDownsamplerShaderRD compute_shader;
|
|
|
|
CubemapDownsamplerRasterShaderRD raster_shader;
|
2020-02-21 00:27:34 +01:00
|
|
|
RID shader_version;
|
2021-07-27 15:33:47 +02:00
|
|
|
RID compute_pipeline;
|
|
|
|
PipelineCacheRD raster_pipeline;
|
2020-02-21 00:27:34 +01:00
|
|
|
} cubemap_downsampler;
|
|
|
|
|
|
|
|
enum CubemapFilterMode {
|
|
|
|
FILTER_MODE_HIGH_QUALITY,
|
|
|
|
FILTER_MODE_LOW_QUALITY,
|
|
|
|
FILTER_MODE_HIGH_QUALITY_ARRAY,
|
|
|
|
FILTER_MODE_LOW_QUALITY_ARRAY,
|
|
|
|
FILTER_MODE_MAX,
|
|
|
|
};
|
|
|
|
|
2021-07-27 15:33:47 +02:00
|
|
|
struct CubemapFilterRasterPushConstant {
|
|
|
|
uint32_t mip_level;
|
|
|
|
uint32_t face_id;
|
|
|
|
float pad[2];
|
|
|
|
};
|
|
|
|
|
2020-02-21 00:27:34 +01:00
|
|
|
struct CubemapFilter {
|
2021-07-27 15:33:47 +02:00
|
|
|
CubemapFilterShaderRD compute_shader;
|
|
|
|
CubemapFilterRasterShaderRD raster_shader;
|
2020-02-21 00:27:34 +01:00
|
|
|
RID shader_version;
|
2021-07-27 15:33:47 +02:00
|
|
|
RID compute_pipelines[FILTER_MODE_MAX];
|
|
|
|
PipelineCacheRD raster_pipelines[FILTER_MODE_MAX];
|
|
|
|
|
2020-02-21 00:27:34 +01:00
|
|
|
RID uniform_set;
|
2020-02-28 18:06:22 +01:00
|
|
|
RID image_uniform_set;
|
2020-02-21 00:27:34 +01:00
|
|
|
RID coefficient_buffer;
|
|
|
|
bool use_high_quality;
|
|
|
|
|
|
|
|
} filter;
|
|
|
|
|
2020-04-02 04:24:52 +02:00
|
|
|
enum SpecularMergeMode {
|
|
|
|
SPECULAR_MERGE_ADD,
|
|
|
|
SPECULAR_MERGE_SSR,
|
|
|
|
SPECULAR_MERGE_ADDITIVE_ADD,
|
|
|
|
SPECULAR_MERGE_ADDITIVE_SSR,
|
|
|
|
SPECULAR_MERGE_MAX
|
|
|
|
};
|
|
|
|
|
2020-04-11 19:43:12 +02:00
|
|
|
/* Specular merge must be done using raster, rather than compute
|
|
|
|
* because it must continue the existing color buffer
|
|
|
|
*/
|
|
|
|
|
2020-04-02 04:24:52 +02:00
|
|
|
struct SpecularMerge {
|
|
|
|
SpecularMergeShaderRD shader;
|
|
|
|
RID shader_version;
|
2020-12-04 19:26:24 +01:00
|
|
|
PipelineCacheRD pipelines[SPECULAR_MERGE_MAX];
|
2020-04-02 04:24:52 +02:00
|
|
|
|
|
|
|
} specular_merge;
|
|
|
|
|
|
|
|
enum ScreenSpaceReflectionMode {
|
|
|
|
SCREEN_SPACE_REFLECTION_NORMAL,
|
|
|
|
SCREEN_SPACE_REFLECTION_ROUGH,
|
|
|
|
SCREEN_SPACE_REFLECTION_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScreenSpaceReflectionPushConstant {
|
|
|
|
float proj_info[4];
|
|
|
|
|
|
|
|
int32_t screen_size[2];
|
|
|
|
float camera_z_near;
|
|
|
|
float camera_z_far;
|
|
|
|
|
|
|
|
int32_t num_steps;
|
|
|
|
float depth_tolerance;
|
|
|
|
float distance_fade;
|
|
|
|
float curve_fade_in;
|
|
|
|
|
|
|
|
uint32_t orthogonal;
|
|
|
|
float filter_mipmap_levels;
|
|
|
|
uint32_t use_half_res;
|
|
|
|
uint8_t metallic_mask[4];
|
|
|
|
|
|
|
|
float projection[16];
|
2021-08-03 09:07:32 +02:00
|
|
|
float prev_projection[16];
|
2020-04-02 04:24:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ScreenSpaceReflection {
|
|
|
|
ScreenSpaceReflectionPushConstant push_constant;
|
|
|
|
ScreenSpaceReflectionShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[SCREEN_SPACE_REFLECTION_MAX];
|
|
|
|
|
|
|
|
} ssr;
|
|
|
|
|
|
|
|
struct ScreenSpaceReflectionFilterPushConstant {
|
|
|
|
float proj_info[4];
|
|
|
|
|
|
|
|
uint32_t orthogonal;
|
|
|
|
float edge_tolerance;
|
|
|
|
int32_t increment;
|
|
|
|
uint32_t pad;
|
|
|
|
|
|
|
|
int32_t screen_size[2];
|
|
|
|
uint32_t vertical;
|
|
|
|
uint32_t steps;
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
SCREEN_SPACE_REFLECTION_FILTER_HORIZONTAL,
|
|
|
|
SCREEN_SPACE_REFLECTION_FILTER_VERTICAL,
|
|
|
|
SCREEN_SPACE_REFLECTION_FILTER_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScreenSpaceReflectionFilter {
|
|
|
|
ScreenSpaceReflectionFilterPushConstant push_constant;
|
|
|
|
ScreenSpaceReflectionFilterShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[SCREEN_SPACE_REFLECTION_FILTER_MAX];
|
|
|
|
} ssr_filter;
|
|
|
|
|
|
|
|
struct ScreenSpaceReflectionScalePushConstant {
|
|
|
|
int32_t screen_size[2];
|
|
|
|
float camera_z_near;
|
|
|
|
float camera_z_far;
|
|
|
|
|
|
|
|
uint32_t orthogonal;
|
|
|
|
uint32_t filter;
|
|
|
|
uint32_t pad[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScreenSpaceReflectionScale {
|
|
|
|
ScreenSpaceReflectionScalePushConstant push_constant;
|
|
|
|
ScreenSpaceReflectionScaleShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipeline;
|
|
|
|
} ssr_scale;
|
|
|
|
|
2020-04-04 04:42:26 +02:00
|
|
|
struct SubSurfaceScatteringPushConstant {
|
|
|
|
int32_t screen_size[2];
|
|
|
|
float camera_z_far;
|
|
|
|
float camera_z_near;
|
|
|
|
|
|
|
|
uint32_t vertical;
|
|
|
|
uint32_t orthogonal;
|
|
|
|
float unit_size;
|
|
|
|
float scale;
|
|
|
|
|
|
|
|
float depth_scale;
|
|
|
|
uint32_t pad[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SubSurfaceScattering {
|
|
|
|
SubSurfaceScatteringPushConstant push_constant;
|
|
|
|
SubsurfaceScatteringShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[3]; //3 quality levels
|
|
|
|
} sss;
|
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
struct ResolvePushConstant {
|
|
|
|
int32_t screen_size[2];
|
|
|
|
int32_t samples;
|
|
|
|
uint32_t pad;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ResolveMode {
|
|
|
|
RESOLVE_MODE_GI,
|
2021-06-05 00:47:26 +02:00
|
|
|
RESOLVE_MODE_GI_VOXEL_GI,
|
2021-07-05 19:48:23 +02:00
|
|
|
RESOLVE_MODE_DEPTH,
|
2020-06-25 15:33:28 +02:00
|
|
|
RESOLVE_MODE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Resolve {
|
|
|
|
ResolvePushConstant push_constant;
|
|
|
|
ResolveShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[RESOLVE_MODE_MAX]; //3 quality levels
|
|
|
|
} resolve;
|
|
|
|
|
2020-08-19 15:38:24 +02:00
|
|
|
enum SortMode {
|
|
|
|
SORT_MODE_BLOCK,
|
|
|
|
SORT_MODE_STEP,
|
|
|
|
SORT_MODE_INNER,
|
|
|
|
SORT_MODE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Sort {
|
|
|
|
struct PushConstant {
|
|
|
|
uint32_t total_elements;
|
|
|
|
uint32_t pad[3];
|
|
|
|
int32_t job_params[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
SortShaderRD shader;
|
|
|
|
RID shader_version;
|
|
|
|
RID pipelines[SORT_MODE_MAX];
|
|
|
|
} sort;
|
|
|
|
|
2019-07-27 15:23:24 +02:00
|
|
|
RID default_sampler;
|
2020-01-10 01:40:26 +01:00
|
|
|
RID default_mipmap_sampler;
|
2019-07-27 15:23:24 +02:00
|
|
|
RID index_buffer;
|
|
|
|
RID index_array;
|
|
|
|
|
|
|
|
Map<RID, RID> texture_to_uniform_set_cache;
|
2021-06-26 12:49:25 +02:00
|
|
|
Map<RID, RID> input_to_uniform_set_cache;
|
2019-07-27 15:23:24 +02:00
|
|
|
|
2020-01-12 02:26:52 +01:00
|
|
|
Map<RID, RID> image_to_uniform_set_cache;
|
2020-04-02 04:24:52 +02:00
|
|
|
|
|
|
|
struct TexturePair {
|
|
|
|
RID texture1;
|
|
|
|
RID texture2;
|
|
|
|
_FORCE_INLINE_ bool operator<(const TexturePair &p_pair) const {
|
|
|
|
if (texture1 == p_pair.texture1) {
|
|
|
|
return texture2 < p_pair.texture2;
|
|
|
|
} else {
|
|
|
|
return texture1 < p_pair.texture1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-12-08 06:37:09 +01:00
|
|
|
struct TextureSamplerPair {
|
|
|
|
RID texture;
|
|
|
|
RID sampler;
|
|
|
|
_FORCE_INLINE_ bool operator<(const TextureSamplerPair &p_pair) const {
|
|
|
|
if (texture == p_pair.texture) {
|
|
|
|
return sampler < p_pair.sampler;
|
|
|
|
} else {
|
|
|
|
return texture < p_pair.texture;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-01-12 02:26:52 +01:00
|
|
|
Map<RID, RID> texture_to_compute_uniform_set_cache;
|
2020-04-02 04:24:52 +02:00
|
|
|
Map<TexturePair, RID> texture_pair_to_compute_uniform_set_cache;
|
|
|
|
Map<TexturePair, RID> image_pair_to_compute_uniform_set_cache;
|
2020-12-08 06:37:09 +01:00
|
|
|
Map<TextureSamplerPair, RID> texture_sampler_to_compute_uniform_set_cache;
|
2020-01-12 02:26:52 +01:00
|
|
|
|
|
|
|
RID _get_uniform_set_from_image(RID p_texture);
|
2021-06-26 12:49:25 +02:00
|
|
|
RID _get_uniform_set_for_input(RID p_texture);
|
2020-01-10 01:40:26 +01:00
|
|
|
RID _get_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
|
2020-01-12 02:26:52 +01:00
|
|
|
RID _get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
|
2020-12-08 06:37:09 +01:00
|
|
|
RID _get_compute_uniform_set_from_texture_and_sampler(RID p_texture, RID p_sampler);
|
2020-04-02 04:24:52 +02:00
|
|
|
RID _get_compute_uniform_set_from_texture_pair(RID p_texture, RID p_texture2, bool p_use_mipmaps = false);
|
|
|
|
RID _get_compute_uniform_set_from_image_pair(RID p_texture, RID p_texture2);
|
2019-07-27 15:23:24 +02:00
|
|
|
|
|
|
|
public:
|
2021-07-27 15:33:47 +02:00
|
|
|
bool get_prefer_raster_effects();
|
|
|
|
|
2021-11-23 22:16:03 +01:00
|
|
|
void fsr_upscale(RID p_source_rd_texture, RID p_secondary_texture, RID p_destination_texture, const Size2i &p_internal_size, const Size2i &p_size, float p_fsr_upscale_sharpness);
|
2020-06-25 15:33:28 +02:00
|
|
|
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());
|
2020-10-28 19:34:27 +01:00
|
|
|
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, bool p_alpha_to_one = false);
|
2020-05-01 14:34:23 +02:00
|
|
|
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);
|
2020-04-11 19:43:12 +02:00
|
|
|
void copy_depth_to_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false);
|
|
|
|
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);
|
2020-04-14 22:05:45 +02:00
|
|
|
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);
|
2020-04-11 19:43:12 +02:00
|
|
|
void gaussian_blur(RID p_source_rd_texture, RID p_texture, RID p_back_texture, const Rect2i &p_region, bool p_8bit_dst = false);
|
2020-10-28 19:34:27 +01:00
|
|
|
void set_color(RID p_dest_texture, const Color &p_color, const Rect2i &p_region, bool p_8bit_dst = false);
|
2021-10-31 16:11:42 +01:00
|
|
|
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_threshold = 1.0, float p_hdr_bleed_scale = 1.0, RID p_auto_exposure = RID(), float p_auto_exposure_grey = 1.0);
|
|
|
|
void gaussian_glow_raster(RID p_source_rd_texture, RID p_framebuffer_half, RID p_rd_texture_half, RID p_dest_framebuffer, const Vector2 &p_pixel_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_threshold = 1.0, float p_hdr_bleed_scale = 1.0, RID p_auto_exposure = RID(), float p_auto_exposure_grey = 1.0);
|
2020-01-10 01:40:26 +01:00
|
|
|
|
2021-07-27 15:33:47 +02:00
|
|
|
void cubemap_roughness(RID p_source_rd_texture, RID p_dest_texture, uint32_t p_face_id, uint32_t p_sample_count, float p_roughness, float p_size);
|
|
|
|
void cubemap_roughness_raster(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);
|
2020-04-11 19:43:12 +02:00
|
|
|
void make_mipmap(RID p_source_rd_texture, RID p_dest_texture, const Size2i &p_size);
|
2021-08-11 13:00:12 +02:00
|
|
|
void make_mipmap_raster(RID p_source_rd_texture, RID p_dest_framebuffer, const Size2i &p_size);
|
2021-08-04 17:18:06 +02:00
|
|
|
void copy_cubemap_to_dp(RID p_source_rd_texture, RID p_dst_framebuffer, const Rect2 &p_rect, const Vector2 &p_dst_size, float p_z_near, float p_z_far, bool p_dp_flip);
|
2020-01-12 02:26:52 +01:00
|
|
|
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);
|
2021-07-20 13:40:16 +02:00
|
|
|
void luminance_reduction_raster(RID p_source_texture, const Size2i p_source_size, const Vector<RID> p_reduce, Vector<RID> p_fb, RID p_prev_luminance, float p_min_luminance, float p_max_luminance, float p_adjust, bool p_set = false);
|
|
|
|
|
2021-07-29 09:43:17 +02:00
|
|
|
struct BokehBuffers {
|
|
|
|
// bokeh buffers
|
|
|
|
|
|
|
|
// textures
|
|
|
|
Size2i base_texture_size;
|
|
|
|
RID base_texture;
|
|
|
|
RID depth_texture;
|
|
|
|
RID secondary_texture;
|
|
|
|
RID half_texture[2];
|
|
|
|
|
|
|
|
// raster only
|
|
|
|
RID base_fb;
|
|
|
|
RID secondary_fb; // with weights
|
|
|
|
RID half_fb[2]; // with weights
|
|
|
|
RID base_weight_fb;
|
|
|
|
RID weight_texture[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
void bokeh_dof(const BokehBuffers &p_buffers, 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);
|
|
|
|
void bokeh_dof_raster(const BokehBuffers &p_buffers, 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_dof_blur_amount, RenderingServer::DOFBokehShape p_bokeh_shape, RS::DOFBlurQuality p_quality, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal);
|
2019-07-27 15:23:24 +02:00
|
|
|
|
2019-08-27 20:27:35 +02:00
|
|
|
struct TonemapSettings {
|
|
|
|
bool use_glow = false;
|
|
|
|
enum GlowMode {
|
|
|
|
GLOW_MODE_ADD,
|
|
|
|
GLOW_MODE_SCREEN,
|
|
|
|
GLOW_MODE_SOFTLIGHT,
|
2020-01-10 01:40:26 +01:00
|
|
|
GLOW_MODE_REPLACE,
|
|
|
|
GLOW_MODE_MIX
|
2019-08-27 20:27:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
GlowMode glow_mode = GLOW_MODE_ADD;
|
|
|
|
float glow_intensity = 1.0;
|
2020-09-20 00:02:32 +02:00
|
|
|
float glow_levels[7] = { 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0 };
|
2019-08-27 20:27:35 +02:00
|
|
|
Vector2i glow_texture_size;
|
|
|
|
bool glow_use_bicubic_upscale = false;
|
|
|
|
RID glow_texture;
|
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RS::EnvironmentToneMapper tonemap_mode = RS::ENV_TONE_MAPPER_LINEAR;
|
2019-08-27 20:27:35 +02:00
|
|
|
float exposure = 1.0;
|
|
|
|
float white = 1.0;
|
|
|
|
|
|
|
|
bool use_auto_exposure = false;
|
|
|
|
float auto_exposure_grey = 0.5;
|
|
|
|
RID exposure_texture;
|
2021-07-26 13:31:15 +02:00
|
|
|
float luminance_multiplier = 1.0;
|
2019-08-27 20:27:35 +02:00
|
|
|
|
|
|
|
bool use_bcs = false;
|
|
|
|
float brightness = 1.0;
|
|
|
|
float contrast = 1.0;
|
|
|
|
float saturation = 1.0;
|
|
|
|
|
|
|
|
bool use_color_correction = false;
|
2020-11-23 02:51:31 +01:00
|
|
|
bool use_1d_color_correction = false;
|
2019-08-27 20:27:35 +02:00
|
|
|
RID color_correction_texture;
|
2020-04-12 06:49:10 +02:00
|
|
|
|
|
|
|
bool use_fxaa = false;
|
2020-04-20 23:34:47 +02:00
|
|
|
bool use_debanding = false;
|
2020-04-12 06:49:10 +02:00
|
|
|
Vector2i texture_size;
|
2021-05-07 15:19:04 +02:00
|
|
|
uint32_t view_count = 1;
|
2019-08-27 20:27:35 +02:00
|
|
|
};
|
|
|
|
|
2020-12-08 06:37:09 +01:00
|
|
|
struct SSAOSettings {
|
|
|
|
float radius = 1.0;
|
|
|
|
float intensity = 2.0;
|
|
|
|
float power = 1.5;
|
|
|
|
float detail = 0.5;
|
|
|
|
float horizon = 0.06;
|
|
|
|
float sharpness = 0.98;
|
|
|
|
|
|
|
|
RS::EnvironmentSSAOQuality quality = RS::ENV_SSAO_QUALITY_MEDIUM;
|
|
|
|
bool half_size = false;
|
|
|
|
float adaptive_target = 0.5;
|
|
|
|
int blur_passes = 2;
|
|
|
|
float fadeout_from = 50.0;
|
|
|
|
float fadeout_to = 300.0;
|
|
|
|
|
2020-12-31 19:33:38 +01:00
|
|
|
Size2i full_screen_size = Size2i();
|
2020-12-08 06:37:09 +01:00
|
|
|
Size2i half_screen_size = Size2i();
|
2020-12-31 19:33:38 +01:00
|
|
|
Size2i quarter_screen_size = Size2i();
|
2020-12-08 06:37:09 +01:00
|
|
|
};
|
|
|
|
|
2021-08-03 09:07:32 +02:00
|
|
|
struct SSILSettings {
|
|
|
|
float radius = 1.0;
|
|
|
|
float intensity = 2.0;
|
|
|
|
float sharpness = 0.98;
|
|
|
|
float normal_rejection = 1.0;
|
|
|
|
|
|
|
|
RS::EnvironmentSSILQuality quality = RS::ENV_SSIL_QUALITY_MEDIUM;
|
|
|
|
bool half_size = true;
|
|
|
|
float adaptive_target = 0.5;
|
|
|
|
int blur_passes = 4;
|
|
|
|
float fadeout_from = 50.0;
|
|
|
|
float fadeout_to = 300.0;
|
|
|
|
|
|
|
|
Size2i full_screen_size = Size2i();
|
|
|
|
Size2i half_screen_size = Size2i();
|
|
|
|
Size2i quarter_screen_size = Size2i();
|
|
|
|
};
|
|
|
|
|
2019-08-27 20:27:35 +02:00
|
|
|
void tonemapper(RID p_source_color, RID p_dst_framebuffer, const TonemapSettings &p_settings);
|
2021-06-26 12:49:25 +02:00
|
|
|
void tonemapper(RD::DrawListID p_subpass_draw_list, RID p_source_color, RD::FramebufferFormatID p_dst_format_id, const TonemapSettings &p_settings);
|
2019-08-27 20:27:35 +02:00
|
|
|
|
2021-08-03 09:07:32 +02:00
|
|
|
void downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_mipmaps, RS::EnvironmentSSAOQuality p_ssao_quality, RS::EnvironmentSSILQuality p_ssil_quality, bool p_invalidate_uniform_set, bool p_ssao_half_size, bool p_ssil_half_size, Size2i p_full_screen_size, const CameraMatrix &p_projection);
|
|
|
|
|
2021-06-13 19:42:10 +02:00
|
|
|
void gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set);
|
2021-08-03 09:07:32 +02:00
|
|
|
void generate_ssao(RID p_normal_buffer, RID p_depth_mipmaps_texture, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets, RID &r_gather_uniform_set, RID &r_importance_map_uniform_set);
|
|
|
|
|
|
|
|
void gather_ssil(RD::ComputeListID p_compute_list, const Vector<RID> p_ssil_slices, const Vector<RID> p_edges_slices, const SSILSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set, RID p_projection_uniform_set);
|
|
|
|
void screen_space_indirect_lighting(RID p_diffuse, RID p_destination, RID p_normal_buffer, RID p_depth_mipmaps_texture, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_importance_map, RID p_importance_map_pong, RID p_edges, const Vector<RID> p_edges_slices, const CameraMatrix &p_projection, const CameraMatrix &p_last_projection, const SSILSettings &p_settings, bool p_invalidate_uniform_sets, RID &r_gather_uniform_set, RID &r_importance_map_uniform_set, RID &r_projection_uniform_set);
|
2020-01-25 11:18:55 +01:00
|
|
|
|
2020-01-27 00:09:40 +01:00
|
|
|
void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
|
2020-03-20 01:32:19 +01:00
|
|
|
void cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, const Size2i &p_size);
|
2021-07-27 15:33:47 +02:00
|
|
|
void cubemap_downsample_raster(RID p_source_cubemap, RID p_dest_framebuffer, uint32_t p_face_id, const Size2i &p_size);
|
2020-02-21 00:27:34 +01:00
|
|
|
void cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubemap, bool p_use_array);
|
2021-07-27 15:33:47 +02:00
|
|
|
void cubemap_filter_raster(RID p_source_cubemap, RID p_dest_framebuffer, uint32_t p_face_id, uint32_t p_mip_level);
|
2020-01-27 00:09:40 +01:00
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
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);
|
2020-04-02 04:24:52 +02:00
|
|
|
void merge_specular(RID p_dest_framebuffer, RID p_specular, RID p_base, RID p_reflection);
|
2020-04-04 04:42:26 +02:00
|
|
|
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);
|
2020-04-02 04:24:52 +02:00
|
|
|
|
2021-06-05 00:47:26 +02:00
|
|
|
void resolve_gi(RID p_source_depth, RID p_source_normal_roughness, RID p_source_voxel_gi, RID p_dest_depth, RID p_dest_normal_roughness, RID p_dest_voxel_gi, Vector2i p_screen_size, int p_samples, uint32_t p_barrier = RD::BARRIER_MASK_ALL);
|
2021-07-05 19:48:23 +02:00
|
|
|
void resolve_depth(RID p_source_depth, RID p_dest_depth, Vector2i p_screen_size, int p_samples, uint32_t p_barrier = RD::BARRIER_MASK_ALL);
|
2020-06-25 15:33:28 +02:00
|
|
|
|
2020-08-19 15:38:24 +02:00
|
|
|
void sort_buffer(RID p_uniform_set, int p_size);
|
|
|
|
|
2021-07-20 13:40:16 +02:00
|
|
|
EffectsRD(bool p_prefer_raster_effects);
|
2020-12-04 19:26:24 +01:00
|
|
|
~EffectsRD();
|
2019-07-27 15:23:24 +02:00
|
|
|
};
|
|
|
|
|
2019-09-15 11:58:38 +02:00
|
|
|
#endif // !RASTERIZER_EFFECTS_RD_H
|