2019-08-19 00:40:52 +02:00
|
|
|
#define M_PI 3.14159265359
|
|
|
|
#define ROUGHNESS_MAX_LOD 5
|
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
#define MAX_GI_PROBES 8
|
|
|
|
|
2019-09-07 03:51:27 +02:00
|
|
|
layout(push_constant, binding = 0, std430) uniform DrawCall {
|
|
|
|
uint instance_index;
|
2020-05-01 14:34:23 +02:00
|
|
|
uint pad; //16 bits minimum size
|
|
|
|
vec2 bake_uv2_offset; //used for bake to uv2, ignored otherwise
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
draw_call;
|
2019-09-07 03:51:27 +02:00
|
|
|
|
2019-10-03 22:39:08 +02:00
|
|
|
/* Set 0 Scene data that never changes, ever */
|
2019-08-26 22:43:58 +02:00
|
|
|
|
|
|
|
#define SAMPLER_NEAREST_CLAMP 0
|
|
|
|
#define SAMPLER_LINEAR_CLAMP 1
|
2020-02-20 00:31:43 +01:00
|
|
|
#define SAMPLER_NEAREST_WITH_MIPMAPS_CLAMP 2
|
2019-08-26 22:43:58 +02:00
|
|
|
#define SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP 3
|
2020-02-20 00:31:43 +01:00
|
|
|
#define SAMPLER_NEAREST_WITH_MIPMAPS_ANISOTROPIC_CLAMP 4
|
2019-08-26 22:43:58 +02:00
|
|
|
#define SAMPLER_LINEAR_WITH_MIPMAPS_ANISOTROPIC_CLAMP 5
|
|
|
|
#define SAMPLER_NEAREST_REPEAT 6
|
|
|
|
#define SAMPLER_LINEAR_REPEAT 7
|
2020-02-20 00:31:43 +01:00
|
|
|
#define SAMPLER_NEAREST_WITH_MIPMAPS_REPEAT 8
|
2019-08-26 22:43:58 +02:00
|
|
|
#define SAMPLER_LINEAR_WITH_MIPMAPS_REPEAT 9
|
2020-02-20 00:31:43 +01:00
|
|
|
#define SAMPLER_NEAREST_WITH_MIPMAPS_ANISOTROPIC_REPEAT 10
|
2019-08-26 22:43:58 +02:00
|
|
|
#define SAMPLER_LINEAR_WITH_MIPMAPS_ANISOTROPIC_REPEAT 11
|
|
|
|
|
2019-10-03 22:39:08 +02:00
|
|
|
layout(set = 0, binding = 1) uniform sampler material_samplers[12];
|
2019-08-26 22:43:58 +02:00
|
|
|
|
2019-10-03 22:39:08 +02:00
|
|
|
layout(set = 0, binding = 2) uniform sampler shadow_sampler;
|
2019-09-07 03:51:27 +02:00
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
#define SDFGI_MAX_CASCADES 8
|
|
|
|
|
2019-11-05 12:01:00 +01:00
|
|
|
layout(set = 0, binding = 3, std140) uniform SceneData {
|
2019-08-19 00:40:52 +02:00
|
|
|
mat4 projection_matrix;
|
|
|
|
mat4 inv_projection_matrix;
|
|
|
|
|
|
|
|
mat4 camera_matrix;
|
|
|
|
mat4 inv_camera_matrix;
|
|
|
|
|
|
|
|
vec2 viewport_size;
|
|
|
|
vec2 screen_pixel_size;
|
|
|
|
|
|
|
|
float time;
|
|
|
|
float reflection_multiplier; // one normally, zero when rendering reflections
|
|
|
|
|
2020-04-08 03:51:52 +02:00
|
|
|
bool pancake_shadows;
|
2020-04-10 11:30:36 +02:00
|
|
|
uint pad;
|
|
|
|
|
|
|
|
//use vec4s because std140 doesnt play nice with vec2s, z and w are wasted
|
|
|
|
vec4 directional_penumbra_shadow_kernel[32];
|
|
|
|
vec4 directional_soft_shadow_kernel[32];
|
|
|
|
vec4 penumbra_shadow_kernel[32];
|
|
|
|
vec4 soft_shadow_kernel[32];
|
2020-04-08 03:51:52 +02:00
|
|
|
|
2020-04-10 11:30:36 +02:00
|
|
|
uint directional_penumbra_shadow_samples;
|
|
|
|
uint directional_soft_shadow_samples;
|
|
|
|
uint penumbra_shadow_samples;
|
|
|
|
uint soft_shadow_samples;
|
2020-04-09 20:11:15 +02:00
|
|
|
|
2019-08-26 22:43:58 +02:00
|
|
|
vec4 ambient_light_color_energy;
|
|
|
|
|
|
|
|
float ambient_color_sky_mix;
|
|
|
|
bool use_ambient_light;
|
|
|
|
bool use_ambient_cubemap;
|
|
|
|
bool use_reflection_cubemap;
|
|
|
|
|
|
|
|
mat3 radiance_inverse_xform;
|
|
|
|
|
2019-09-07 03:51:27 +02:00
|
|
|
vec2 shadow_atlas_pixel_size;
|
|
|
|
vec2 directional_shadow_pixel_size;
|
|
|
|
|
|
|
|
uint directional_light_count;
|
|
|
|
float dual_paraboloid_side;
|
|
|
|
float z_far;
|
2020-01-21 18:24:22 +01:00
|
|
|
float z_near;
|
2019-09-07 03:51:27 +02:00
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
bool ssao_enabled;
|
|
|
|
float ssao_light_affect;
|
|
|
|
float ssao_ao_affect;
|
2020-01-27 00:09:40 +01:00
|
|
|
bool roughness_limiter_enabled;
|
2020-01-25 11:18:55 +01:00
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
float roughness_limiter_amount;
|
|
|
|
float roughness_limiter_limit;
|
|
|
|
uvec2 roughness_limiter_pad;
|
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
vec4 ao_color;
|
2020-06-25 15:33:28 +02:00
|
|
|
|
|
|
|
mat4 sdf_to_bounds;
|
|
|
|
|
|
|
|
ivec3 sdf_offset;
|
2020-05-01 14:34:23 +02:00
|
|
|
bool material_uv2_mode;
|
2020-06-25 15:33:28 +02:00
|
|
|
|
|
|
|
ivec3 sdf_size;
|
|
|
|
bool gi_upscale_for_msaa;
|
2020-01-25 11:18:55 +01:00
|
|
|
|
2019-08-19 00:40:52 +02:00
|
|
|
#if 0
|
|
|
|
vec4 ambient_light_color;
|
|
|
|
vec4 bg_color;
|
|
|
|
|
|
|
|
vec4 fog_color_enabled;
|
|
|
|
vec4 fog_sun_color_amount;
|
|
|
|
|
|
|
|
float ambient_energy;
|
|
|
|
float bg_energy;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
vec2 shadow_atlas_pixel_size;
|
|
|
|
vec2 directional_shadow_pixel_size;
|
|
|
|
|
|
|
|
float z_far;
|
|
|
|
|
|
|
|
float subsurface_scatter_width;
|
|
|
|
float ambient_occlusion_affect_light;
|
|
|
|
float ambient_occlusion_affect_ao_channel;
|
|
|
|
float opaque_prepass_threshold;
|
|
|
|
|
|
|
|
bool fog_depth_enabled;
|
|
|
|
float fog_depth_begin;
|
|
|
|
float fog_depth_end;
|
|
|
|
float fog_density;
|
|
|
|
float fog_depth_curve;
|
|
|
|
bool fog_transmit_enabled;
|
|
|
|
float fog_transmit_curve;
|
|
|
|
bool fog_height_enabled;
|
|
|
|
float fog_height_min;
|
|
|
|
float fog_height_max;
|
|
|
|
float fog_height_curve;
|
|
|
|
#endif
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2020-02-11 14:01:43 +01:00
|
|
|
scene_data;
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
#define INSTANCE_FLAGS_USE_GI_BUFFERS (1 << 6)
|
|
|
|
#define INSTANCE_FLAGS_USE_SDFGI (1 << 7)
|
2020-05-01 14:34:23 +02:00
|
|
|
#define INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE (1 << 8)
|
|
|
|
#define INSTANCE_FLAGS_USE_LIGHTMAP (1 << 9)
|
|
|
|
#define INSTANCE_FLAGS_USE_SH_LIGHTMAP (1 << 10)
|
|
|
|
#define INSTANCE_FLAGS_USE_GIPROBE (1 << 11)
|
2019-11-05 12:01:00 +01:00
|
|
|
#define INSTANCE_FLAGS_MULTIMESH (1 << 12)
|
|
|
|
#define INSTANCE_FLAGS_MULTIMESH_FORMAT_2D (1 << 13)
|
|
|
|
#define INSTANCE_FLAGS_MULTIMESH_HAS_COLOR (1 << 14)
|
|
|
|
#define INSTANCE_FLAGS_MULTIMESH_HAS_CUSTOM_DATA (1 << 15)
|
2019-09-14 05:37:42 +02:00
|
|
|
#define INSTANCE_FLAGS_MULTIMESH_STRIDE_SHIFT 16
|
|
|
|
//3 bits of stride
|
|
|
|
#define INSTANCE_FLAGS_MULTIMESH_STRIDE_MASK 0x7
|
|
|
|
|
2019-09-23 23:53:05 +02:00
|
|
|
#define INSTANCE_FLAGS_SKELETON (1 << 19)
|
2019-09-14 05:37:42 +02:00
|
|
|
|
2019-09-07 03:51:27 +02:00
|
|
|
struct InstanceData {
|
|
|
|
mat4 transform;
|
|
|
|
mat4 normal_transform;
|
|
|
|
uint flags;
|
2020-04-17 04:52:00 +02:00
|
|
|
uint instance_uniforms_ofs; //base offset in global buffer for instance variables
|
2020-05-01 14:34:23 +02:00
|
|
|
uint gi_offset; //GI information when using lightmapping (VCT or lightmap index)
|
2019-09-07 03:51:27 +02:00
|
|
|
uint layer_mask;
|
2020-05-01 14:34:23 +02:00
|
|
|
vec4 lightmap_uv_scale;
|
2019-09-07 03:51:27 +02:00
|
|
|
};
|
|
|
|
|
2020-04-14 05:05:21 +02:00
|
|
|
layout(set = 0, binding = 4, std430) restrict readonly buffer Instances {
|
2019-11-05 12:01:00 +01:00
|
|
|
InstanceData data[];
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
instances;
|
2019-09-07 03:51:27 +02:00
|
|
|
|
2020-04-08 03:51:52 +02:00
|
|
|
struct LightData { //this structure needs to be as packed as possible
|
2019-09-07 03:51:27 +02:00
|
|
|
vec3 position;
|
|
|
|
float inv_radius;
|
|
|
|
vec3 direction;
|
2020-04-09 20:11:15 +02:00
|
|
|
float size;
|
2019-09-07 03:51:27 +02:00
|
|
|
uint attenuation_energy; //attenuation
|
|
|
|
uint color_specular; //rgb color, a specular (8 bit unorm)
|
|
|
|
uint cone_attenuation_angle; // attenuation and angle, (16bit float)
|
|
|
|
uint shadow_color_enabled; //shadow rgb color, a>0.5 enabled (8bit unorm)
|
2020-04-14 22:05:45 +02:00
|
|
|
vec4 atlas_rect; // rect in the shadow atlas
|
2019-09-07 03:51:27 +02:00
|
|
|
mat4 shadow_matrix;
|
2020-04-08 03:51:52 +02:00
|
|
|
float shadow_bias;
|
|
|
|
float shadow_normal_bias;
|
|
|
|
float transmittance_bias;
|
2020-04-09 20:11:15 +02:00
|
|
|
float soft_shadow_size; // for spot, it's the size in uv coordinates of the light, for omni it's the span angle
|
2020-04-10 11:30:36 +02:00
|
|
|
float soft_shadow_scale; // scales the shadow kernel for blurrier shadows
|
2020-04-09 20:11:15 +02:00
|
|
|
uint mask;
|
2020-04-10 11:30:36 +02:00
|
|
|
uint pad[2];
|
2020-04-14 22:05:45 +02:00
|
|
|
vec4 projector_rect; //projector rect in srgb decal atlas
|
2019-09-07 03:51:27 +02:00
|
|
|
};
|
|
|
|
|
2020-04-14 05:05:21 +02:00
|
|
|
layout(set = 0, binding = 5, std430) restrict readonly buffer Lights {
|
2020-04-08 03:51:52 +02:00
|
|
|
LightData data[];
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
lights;
|
2019-09-07 03:51:27 +02:00
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
#define REFLECTION_AMBIENT_DISABLED 0
|
|
|
|
#define REFLECTION_AMBIENT_ENVIRONMENT 1
|
|
|
|
#define REFLECTION_AMBIENT_COLOR 2
|
|
|
|
|
2019-10-03 22:39:08 +02:00
|
|
|
struct ReflectionData {
|
|
|
|
vec3 box_extents;
|
|
|
|
float index;
|
|
|
|
vec3 box_offset;
|
|
|
|
uint mask;
|
|
|
|
vec4 params; // intensity, 0, interior , boxproject
|
2020-06-25 15:33:28 +02:00
|
|
|
vec3 ambient; // ambient color
|
|
|
|
uint ambient_mode;
|
2019-10-03 22:39:08 +02:00
|
|
|
mat4 local_matrix; // up to here for spot and omni, rest is for directional
|
|
|
|
// notes: for ambientblend, use distance to edge to blend between already existing global environment
|
|
|
|
};
|
|
|
|
|
2020-07-23 01:39:09 +02:00
|
|
|
layout(set = 0, binding = 6) buffer restrict readonly ReflectionProbeData {
|
|
|
|
ReflectionData data[];
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
reflections;
|
2019-08-19 00:40:52 +02:00
|
|
|
|
|
|
|
struct DirectionalLightData {
|
2019-09-07 03:51:27 +02:00
|
|
|
vec3 direction;
|
|
|
|
float energy;
|
|
|
|
vec3 color;
|
2020-04-09 20:11:15 +02:00
|
|
|
float size;
|
2019-09-07 03:51:27 +02:00
|
|
|
float specular;
|
2019-09-07 19:38:17 +02:00
|
|
|
uint mask;
|
2020-04-09 20:11:15 +02:00
|
|
|
float softshadow_angle;
|
2020-04-10 11:30:36 +02:00
|
|
|
float soft_shadow_scale;
|
2019-09-07 19:38:17 +02:00
|
|
|
bool blend_splits;
|
2019-09-07 03:51:27 +02:00
|
|
|
bool shadow_enabled;
|
2019-09-07 19:38:17 +02:00
|
|
|
float fade_from;
|
|
|
|
float fade_to;
|
2020-04-08 03:51:52 +02:00
|
|
|
vec4 shadow_bias;
|
|
|
|
vec4 shadow_normal_bias;
|
|
|
|
vec4 shadow_transmittance_bias;
|
|
|
|
vec4 shadow_transmittance_z_scale;
|
2020-04-09 20:11:15 +02:00
|
|
|
vec4 shadow_range_begin;
|
2019-09-07 03:51:27 +02:00
|
|
|
vec4 shadow_split_offsets;
|
2019-08-19 00:40:52 +02:00
|
|
|
mat4 shadow_matrix1;
|
|
|
|
mat4 shadow_matrix2;
|
|
|
|
mat4 shadow_matrix3;
|
|
|
|
mat4 shadow_matrix4;
|
2020-04-08 03:51:52 +02:00
|
|
|
vec4 shadow_color1;
|
|
|
|
vec4 shadow_color2;
|
|
|
|
vec4 shadow_color3;
|
|
|
|
vec4 shadow_color4;
|
2020-04-09 20:11:15 +02:00
|
|
|
vec2 uv_scale1;
|
|
|
|
vec2 uv_scale2;
|
|
|
|
vec2 uv_scale3;
|
|
|
|
vec2 uv_scale4;
|
2019-08-19 00:40:52 +02:00
|
|
|
};
|
|
|
|
|
2019-11-05 12:01:00 +01:00
|
|
|
layout(set = 0, binding = 7, std140) uniform DirectionalLights {
|
2019-09-07 03:51:27 +02:00
|
|
|
DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
directional_lights;
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
#define LIGHTMAP_FLAG_USE_DIRECTION 1
|
|
|
|
#define LIGHTMAP_FLAG_USE_SPECULAR_DIRECTION 2
|
|
|
|
|
|
|
|
struct Lightmap {
|
|
|
|
mat3 normal_xform;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(set = 0, binding = 10, std140) restrict readonly buffer Lightmaps {
|
|
|
|
Lightmap data[];
|
|
|
|
}
|
|
|
|
lightmaps;
|
|
|
|
|
|
|
|
layout(set = 0, binding = 11) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES];
|
|
|
|
|
|
|
|
struct LightmapCapture {
|
|
|
|
vec4 sh[9];
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(set = 0, binding = 12, std140) restrict readonly buffer LightmapCaptures {
|
|
|
|
LightmapCapture data[];
|
|
|
|
}
|
|
|
|
lightmap_captures;
|
|
|
|
|
2020-01-21 18:24:22 +01:00
|
|
|
#define CLUSTER_COUNTER_SHIFT 20
|
|
|
|
#define CLUSTER_POINTER_MASK ((1 << CLUSTER_COUNTER_SHIFT) - 1)
|
|
|
|
#define CLUSTER_COUNTER_MASK 0xfff
|
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
layout(set = 0, binding = 13) uniform texture2D decal_atlas;
|
|
|
|
layout(set = 0, binding = 14) uniform texture2D decal_atlas_srgb;
|
2020-04-14 05:05:21 +02:00
|
|
|
|
|
|
|
struct DecalData {
|
|
|
|
mat4 xform; //to decal transform
|
|
|
|
vec3 inv_extents;
|
|
|
|
float albedo_mix;
|
|
|
|
vec4 albedo_rect;
|
|
|
|
vec4 normal_rect;
|
|
|
|
vec4 orm_rect;
|
|
|
|
vec4 emission_rect;
|
|
|
|
vec4 modulate;
|
|
|
|
float emission_energy;
|
|
|
|
uint mask;
|
|
|
|
float upper_fade;
|
|
|
|
float lower_fade;
|
|
|
|
mat3x4 normal_xform;
|
|
|
|
vec3 normal;
|
|
|
|
float normal_fade;
|
|
|
|
};
|
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
layout(set = 0, binding = 15, std430) restrict readonly buffer Decals {
|
2020-04-14 05:05:21 +02:00
|
|
|
DecalData data[];
|
|
|
|
}
|
|
|
|
decals;
|
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
layout(set = 0, binding = 16) uniform utexture3D cluster_texture;
|
2020-01-21 18:24:22 +01:00
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
layout(set = 0, binding = 17, std430) restrict readonly buffer ClusterData {
|
2020-01-21 18:24:22 +01:00
|
|
|
uint indices[];
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
cluster_data;
|
2020-01-21 18:24:22 +01:00
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas;
|
2020-01-25 11:18:55 +01:00
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
layout(set = 0, binding = 19, std430) restrict readonly buffer GlobalVariableData {
|
2020-04-17 04:52:00 +02:00
|
|
|
vec4 data[];
|
|
|
|
}
|
|
|
|
global_variables;
|
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
struct SDFGIProbeCascadeData {
|
|
|
|
vec3 position;
|
|
|
|
float to_probe;
|
|
|
|
ivec3 probe_world_offset;
|
|
|
|
float to_cell; // 1/bounds * grid_size
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(set = 0, binding = 20, std140) uniform SDFGI {
|
|
|
|
vec3 grid_size;
|
|
|
|
uint max_cascades;
|
|
|
|
|
|
|
|
bool use_occlusion;
|
|
|
|
int probe_axis_size;
|
|
|
|
float probe_to_uvw;
|
|
|
|
float normal_bias;
|
|
|
|
|
|
|
|
vec3 lightprobe_tex_pixel_size;
|
|
|
|
float energy;
|
|
|
|
|
|
|
|
vec3 lightprobe_uv_offset;
|
|
|
|
float y_mult;
|
|
|
|
|
|
|
|
vec3 occlusion_clamp;
|
|
|
|
uint pad3;
|
|
|
|
|
|
|
|
vec3 occlusion_renormalize;
|
|
|
|
uint pad4;
|
|
|
|
|
|
|
|
vec3 cascade_probe_size;
|
|
|
|
uint pad5;
|
|
|
|
|
|
|
|
SDFGIProbeCascadeData cascades[SDFGI_MAX_CASCADES];
|
|
|
|
}
|
|
|
|
sdfgi;
|
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
// decal atlas
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
/* Set 1, Radiance */
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2019-09-07 03:51:27 +02:00
|
|
|
#ifdef USE_RADIANCE_CUBEMAP_ARRAY
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
layout(set = 1, binding = 0) uniform textureCubeArray radiance_cubemap;
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2019-09-07 03:51:27 +02:00
|
|
|
#else
|
2019-08-19 00:40:52 +02:00
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
layout(set = 1, binding = 0) uniform textureCube radiance_cubemap;
|
2019-08-19 00:40:52 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
/* Set 2, Reflection and Shadow Atlases (view dependant) */
|
|
|
|
|
|
|
|
layout(set = 2, binding = 0) uniform textureCubeArray reflection_atlas;
|
|
|
|
|
|
|
|
layout(set = 2, binding = 1) uniform texture2D shadow_atlas;
|
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
layout(set = 2, binding = 2) uniform texture3D gi_probe_textures[MAX_GI_PROBES];
|
|
|
|
|
2020-05-01 14:34:23 +02:00
|
|
|
/* Set 3, Render Buffers */
|
2019-10-03 22:39:08 +02:00
|
|
|
|
2020-06-25 15:33:28 +02:00
|
|
|
#ifdef MODE_RENDER_SDF
|
|
|
|
|
|
|
|
layout(r16ui, set = 3, binding = 0) uniform restrict writeonly uimage3D albedo_volume_grid;
|
|
|
|
layout(r32ui, set = 3, binding = 1) uniform restrict writeonly uimage3D emission_grid;
|
|
|
|
layout(r32ui, set = 3, binding = 2) uniform restrict writeonly uimage3D emission_aniso_grid;
|
|
|
|
layout(r32ui, set = 3, binding = 3) uniform restrict uimage3D geom_facing_grid;
|
|
|
|
|
|
|
|
//still need to be present for shaders that use it, so remap them to something
|
|
|
|
#define depth_buffer shadow_atlas
|
|
|
|
#define color_buffer shadow_atlas
|
|
|
|
#define normal_roughness_buffer shadow_atlas
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
layout(set = 3, binding = 0) uniform texture2D depth_buffer;
|
|
|
|
layout(set = 3, binding = 1) uniform texture2D color_buffer;
|
2020-06-25 15:33:28 +02:00
|
|
|
layout(set = 3, binding = 2) uniform texture2D normal_roughness_buffer;
|
2020-01-25 11:18:55 +01:00
|
|
|
layout(set = 3, binding = 4) uniform texture2D ao_buffer;
|
2020-06-25 15:33:28 +02:00
|
|
|
layout(set = 3, binding = 5) uniform texture2D ambient_buffer;
|
|
|
|
layout(set = 3, binding = 6) uniform texture2D reflection_buffer;
|
|
|
|
|
|
|
|
layout(set = 3, binding = 7) uniform texture2DArray sdfgi_lightprobe_texture;
|
|
|
|
|
|
|
|
layout(set = 3, binding = 8) uniform texture3D sdfgi_occlusion_cascades;
|
|
|
|
|
|
|
|
struct GIProbeData {
|
|
|
|
mat4 xform;
|
|
|
|
vec3 bounds;
|
|
|
|
float dynamic_range;
|
|
|
|
|
|
|
|
float bias;
|
|
|
|
float normal_bias;
|
|
|
|
bool blend_ambient;
|
|
|
|
uint texture_slot;
|
|
|
|
|
|
|
|
float anisotropy_strength;
|
|
|
|
float ambient_occlusion;
|
|
|
|
float ambient_occlusion_size;
|
|
|
|
uint pad2;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(set = 3, binding = 9, std140) uniform GIProbes {
|
|
|
|
GIProbeData data[MAX_GI_PROBES];
|
|
|
|
}
|
|
|
|
gi_probes;
|
|
|
|
|
|
|
|
#endif
|
2019-10-03 22:39:08 +02:00
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
/* Set 4 Skeleton & Instancing (Multimesh) */
|
2019-10-03 22:39:08 +02:00
|
|
|
|
2020-04-14 05:05:21 +02:00
|
|
|
layout(set = 4, binding = 0, std430) restrict readonly buffer Transforms {
|
2019-11-05 12:01:00 +01:00
|
|
|
vec4 data[];
|
2020-02-11 14:01:43 +01:00
|
|
|
}
|
|
|
|
transforms;
|
2019-10-03 22:39:08 +02:00
|
|
|
|
2020-01-25 11:18:55 +01:00
|
|
|
/* Set 5 User Material */
|