EEVEE: Port existing EEVEE shaders and generated materials to use GPUShaderCreateInfo.
Required by Metal backend for efficient shader compilation. EEVEE material resource binding permutations now controlled via CreateInfo and selected based on material options. Other existing CreateInfo's also modified to ensure explicitness for depth-writing mode. Other missing bindings also addressed to ensure full compliance with the Metal backend. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Differential Revision: https://developer.blender.org/D16243
This commit is contained in:
parent
2efdbeb58b
commit
6b8bb26c45
Notes:
blender-bot
2023-05-01 11:29:09 +02:00
Referenced by issue #103313, Regression: Crash on EEVEE when launch with --debug-gpu-force-workarounds Referenced by issue #96261, Metal Viewport Referenced by issue #106440, Regression: EEVEE: World lighting does not affect volumetrics Referenced by issue #107494, GPU debug mode creates excessive log, causing lack
|
@ -256,6 +256,7 @@ set(SRC
|
|||
engines/eevee/eevee_lightcache.h
|
||||
engines/eevee/eevee_lut.h
|
||||
engines/eevee/eevee_private.h
|
||||
engines/eevee/engine_eevee_shared_defines.h
|
||||
engines/eevee_next/eevee_camera.hh
|
||||
engines/eevee_next/eevee_cryptomatte.hh
|
||||
engines/eevee_next/eevee_depth_of_field.hh
|
||||
|
@ -316,6 +317,7 @@ set(GLSL_SRC
|
|||
engines/eevee/shaders/lightprobe_filter_visibility_frag.glsl
|
||||
engines/eevee/shaders/lightprobe_geom.glsl
|
||||
engines/eevee/shaders/lightprobe_vert.glsl
|
||||
engines/eevee/shaders/lightprobe_vert_no_geom.glsl
|
||||
engines/eevee/shaders/lightprobe_cube_display_frag.glsl
|
||||
engines/eevee/shaders/lightprobe_cube_display_vert.glsl
|
||||
engines/eevee/shaders/lightprobe_grid_display_frag.glsl
|
||||
|
@ -381,7 +383,6 @@ set(GLSL_SRC
|
|||
engines/eevee/shaders/raytrace_lib.glsl
|
||||
engines/eevee/shaders/renderpass_lib.glsl
|
||||
engines/eevee/shaders/renderpass_postprocess_frag.glsl
|
||||
engines/eevee/shaders/cryptomatte_lib.glsl
|
||||
engines/eevee/shaders/cryptomatte_frag.glsl
|
||||
engines/eevee/shaders/cryptomatte_vert.glsl
|
||||
engines/eevee/shaders/ltc_lib.glsl
|
||||
|
@ -400,6 +401,8 @@ set(GLSL_SRC
|
|||
engines/eevee/shaders/volumetric_scatter_frag.glsl
|
||||
engines/eevee/shaders/volumetric_integration_frag.glsl
|
||||
engines/eevee/shaders/world_vert.glsl
|
||||
engines/eevee/shaders/infos/engine_eevee_legacy_shared.h
|
||||
engines/eevee/engine_eevee_shared_defines.h
|
||||
|
||||
engines/eevee_next/shaders/eevee_attributes_lib.glsl
|
||||
engines/eevee_next/shaders/eevee_camera_lib.glsl
|
||||
|
|
|
@ -610,19 +610,22 @@ static void eevee_lightbake_context_enable(EEVEE_LightBake *lbake)
|
|||
|
||||
static void eevee_lightbake_context_disable(EEVEE_LightBake *lbake)
|
||||
{
|
||||
GPU_render_end();
|
||||
|
||||
if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) {
|
||||
DRW_opengl_context_disable();
|
||||
GPU_render_end();
|
||||
GPU_context_main_unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (lbake->gl_context) {
|
||||
DRW_gpu_render_context_disable(lbake->gpu_context);
|
||||
GPU_render_end();
|
||||
DRW_opengl_render_context_disable(lbake->gl_context);
|
||||
}
|
||||
else {
|
||||
DRW_opengl_context_disable();
|
||||
GPU_render_end();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ float *EEVEE_lut_update_ggx_btdf(int lut_size, int lut_depth)
|
|||
DRWPass *pass = DRW_pass_create(__func__, DRW_STATE_WRITE_COLOR);
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_ggx_refraction_lut_sh_get(), pass);
|
||||
DRW_shgroup_uniform_float_copy(grp, "sampleCount", 64.0f); /* Actual sample count is squared. */
|
||||
DRW_shgroup_uniform_float(grp, "z", &roughness, 1);
|
||||
DRW_shgroup_uniform_float(grp, "z_factor", &roughness, 1);
|
||||
DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
|
||||
|
||||
GPUTexture *tex = DRW_texture_create_2d_array(lut_size, lut_size, lut_depth, GPU_RG16F, 0, NULL);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "BKE_camera.h"
|
||||
|
||||
#include "engine_eevee_shared_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -28,18 +30,6 @@ struct RenderLayer;
|
|||
|
||||
extern struct DrawEngineType draw_engine_eevee_type;
|
||||
|
||||
/* Minimum UBO is 16384 bytes */
|
||||
#define MAX_PROBE 128 /* TODO: find size by dividing UBO max size by probe data size. */
|
||||
#define MAX_GRID 64 /* TODO: find size by dividing UBO max size by grid data size. */
|
||||
#define MAX_PLANAR 16 /* TODO: find size by dividing UBO max size by grid data size. */
|
||||
#define MAX_LIGHT 128 /* TODO: find size by dividing UBO max size by light data size. */
|
||||
#define MAX_CASCADE_NUM 4
|
||||
#define MAX_SHADOW 128 /* TODO: Make this depends on #GL_MAX_ARRAY_TEXTURE_LAYERS. */
|
||||
#define MAX_SHADOW_CASCADE 8
|
||||
#define MAX_SHADOW_CUBE (MAX_SHADOW - MAX_CASCADE_NUM * MAX_SHADOW_CASCADE)
|
||||
#define MAX_BLOOM_STEP 16
|
||||
#define MAX_AOVS 64
|
||||
|
||||
/* Special value chosen to not be altered by depth of field sample count. */
|
||||
#define TAA_MAX_SAMPLE 10000926
|
||||
|
||||
|
@ -55,23 +45,7 @@ extern struct DrawEngineType draw_engine_eevee_type;
|
|||
# define SHADER_IRRADIANCE "#define IRRADIANCE_HL2\n"
|
||||
#endif
|
||||
|
||||
/* Macro causes over indentation. */
|
||||
/* clang-format off */
|
||||
#define SHADER_DEFINES \
|
||||
"#define EEVEE_ENGINE\n" \
|
||||
"#define MAX_PROBE " STRINGIFY(MAX_PROBE) "\n" \
|
||||
"#define MAX_GRID " STRINGIFY(MAX_GRID) "\n" \
|
||||
"#define MAX_PLANAR " STRINGIFY(MAX_PLANAR) "\n" \
|
||||
"#define MAX_LIGHT " STRINGIFY(MAX_LIGHT) "\n" \
|
||||
"#define MAX_SHADOW " STRINGIFY(MAX_SHADOW) "\n" \
|
||||
"#define MAX_SHADOW_CUBE " STRINGIFY(MAX_SHADOW_CUBE) "\n" \
|
||||
"#define MAX_SHADOW_CASCADE " STRINGIFY(MAX_SHADOW_CASCADE) "\n" \
|
||||
"#define MAX_CASCADE_NUM " STRINGIFY(MAX_CASCADE_NUM) "\n" \
|
||||
SHADER_IRRADIANCE
|
||||
/* clang-format on */
|
||||
|
||||
#define EEVEE_PROBE_MAX min_ii(MAX_PROBE, GPU_max_texture_layers() / 6)
|
||||
#define EEVEE_VELOCITY_TILE_SIZE 32
|
||||
#define USE_VOLUME_OPTI (GPU_shader_image_load_store_support())
|
||||
|
||||
#define SWAP_DOUBLE_BUFFERS() \
|
||||
|
@ -194,19 +168,6 @@ typedef enum EEVEE_DofGatherPass {
|
|||
DOF_GATHER_MAX_PASS,
|
||||
} EEVEE_DofGatherPass;
|
||||
|
||||
#define DOF_TILE_DIVISOR 16
|
||||
#define DOF_BOKEH_LUT_SIZE 32
|
||||
#define DOF_GATHER_RING_COUNT 5
|
||||
#define DOF_DILATE_RING_COUNT 3
|
||||
#define DOF_FAST_GATHER_COC_ERROR 0.05
|
||||
|
||||
#define DOF_SHADER_DEFINES \
|
||||
"#define DOF_TILE_DIVISOR " STRINGIFY(DOF_TILE_DIVISOR) "\n" \
|
||||
"#define DOF_BOKEH_LUT_SIZE " STRINGIFY(DOF_BOKEH_LUT_SIZE) "\n" \
|
||||
"#define DOF_GATHER_RING_COUNT " STRINGIFY(DOF_GATHER_RING_COUNT) "\n" \
|
||||
"#define DOF_DILATE_RING_COUNT " STRINGIFY(DOF_DILATE_RING_COUNT) "\n" \
|
||||
"#define DOF_FAST_GATHER_COC_ERROR " STRINGIFY(DOF_FAST_GATHER_COC_ERROR) "\n"
|
||||
|
||||
/* ************ PROBE UBO ************* */
|
||||
|
||||
/* They are the same struct as their Cache siblings.
|
||||
|
@ -1295,13 +1256,14 @@ struct GPUMaterial *EEVEE_material_get(
|
|||
EEVEE_Data *vedata, struct Scene *scene, Material *ma, World *wo, int options);
|
||||
void EEVEE_shaders_free(void);
|
||||
|
||||
void eevee_shader_extra_init(void);
|
||||
void eevee_shader_extra_exit(void);
|
||||
void eevee_shader_material_create_info_amend(GPUMaterial *gpumat,
|
||||
GPUCodegenOutput *codegen,
|
||||
char *frag,
|
||||
GPUCodegenOutput *codegen_,
|
||||
char *vert,
|
||||
char *geom,
|
||||
char *frag,
|
||||
const char *vert_info_name,
|
||||
const char *geom_info_name,
|
||||
const char *frag_info_name,
|
||||
char *defines);
|
||||
GPUShader *eevee_shaders_sh_create_helper(const char *name,
|
||||
const char *vert_name,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,33 +17,14 @@
|
|||
|
||||
using blender::gpu::shader::StageInterfaceInfo;
|
||||
|
||||
static StageInterfaceInfo *stage_interface = nullptr;
|
||||
|
||||
void eevee_shader_extra_init()
|
||||
{
|
||||
if (stage_interface != nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace blender::gpu::shader;
|
||||
stage_interface = new StageInterfaceInfo("ShaderStageInterface", "");
|
||||
stage_interface->smooth(Type::VEC3, "worldPosition");
|
||||
stage_interface->smooth(Type::VEC3, "viewPosition");
|
||||
stage_interface->smooth(Type::VEC3, "worldNormal");
|
||||
stage_interface->smooth(Type::VEC3, "viewNormal");
|
||||
stage_interface->flat(Type::INT, "resourceIDFrag");
|
||||
}
|
||||
|
||||
void eevee_shader_extra_exit()
|
||||
{
|
||||
delete stage_interface;
|
||||
}
|
||||
|
||||
void eevee_shader_material_create_info_amend(GPUMaterial *gpumat,
|
||||
GPUCodegenOutput *codegen_,
|
||||
char *frag,
|
||||
char *vert,
|
||||
char *geom,
|
||||
char *frag,
|
||||
const char *vert_info_name,
|
||||
const char *geom_info_name,
|
||||
const char *frag_info_name,
|
||||
char *defines)
|
||||
{
|
||||
using namespace blender::gpu::shader;
|
||||
|
@ -58,7 +39,17 @@ void eevee_shader_material_create_info_amend(GPUMaterial *gpumat,
|
|||
GPUCodegenOutput &codegen = *codegen_;
|
||||
ShaderCreateInfo &info = *reinterpret_cast<ShaderCreateInfo *>(codegen.create_info);
|
||||
|
||||
info.legacy_resource_location(true);
|
||||
/* Append stage-specific create info. */
|
||||
if (vert_info_name) {
|
||||
info.additional_info(vert_info_name);
|
||||
}
|
||||
if (geom_info_name) {
|
||||
info.additional_info(geom_info_name);
|
||||
}
|
||||
if (frag_info_name) {
|
||||
info.additional_info(frag_info_name);
|
||||
}
|
||||
|
||||
info.auto_resource_location(true);
|
||||
|
||||
if (GPU_material_flag_get(gpumat, GPU_MATFLAG_SUBSURFACE)) {
|
||||
|
@ -76,6 +67,12 @@ void eevee_shader_material_create_info_amend(GPUMaterial *gpumat,
|
|||
info.define("USE_BARYCENTRICS");
|
||||
}
|
||||
|
||||
/* Lookdev - Add FragDepth. */
|
||||
if (options & VAR_MAT_LOOKDEV) {
|
||||
info.define("LOOKDEV");
|
||||
info.depth_write(DepthWrite::ANY);
|
||||
}
|
||||
|
||||
std::stringstream attr_load;
|
||||
|
||||
const bool do_fragment_attrib_load = is_background || is_volume;
|
||||
|
@ -124,7 +121,6 @@ void eevee_shader_material_create_info_amend(GPUMaterial *gpumat,
|
|||
|
||||
if (!is_volume) {
|
||||
info.define("EEVEE_GENERATED_INTERFACE");
|
||||
info.vertex_out(*stage_interface);
|
||||
}
|
||||
|
||||
attr_load << "void attrib_load()\n";
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#ifndef GPU_SHADER_EEVEE_LEGACY_DEFINES
|
||||
#define GPU_SHADER_EEVEE_LEGACY_DEFINES
|
||||
#ifdef GPU_SHADER
|
||||
# define EEVEE_ENGINE
|
||||
#endif
|
||||
|
||||
/* Minimum UBO is 16384 bytes. */
|
||||
#define MAX_PROBE 128 /* TODO: find size by dividing UBO max size by probe data size. */
|
||||
#define MAX_GRID 64 /* TODO: find size by dividing UBO max size by grid data size. */
|
||||
#define MAX_PLANAR 16 /* TODO: find size by dividing UBO max size by grid data size. */
|
||||
#define MAX_LIGHT 128 /* TODO: find size by dividing UBO max size by light data size. */
|
||||
#define MAX_CASCADE_NUM 4
|
||||
#define MAX_SHADOW 128 /* TODO: Make this depends on #GL_MAX_ARRAY_TEXTURE_LAYERS. */
|
||||
#define MAX_SHADOW_CASCADE 8
|
||||
#define MAX_SHADOW_CUBE (MAX_SHADOW - MAX_CASCADE_NUM * MAX_SHADOW_CASCADE)
|
||||
#define MAX_BLOOM_STEP 16
|
||||
#define MAX_AOVS 64
|
||||
|
||||
/* Motion Blur. */
|
||||
#define EEVEE_VELOCITY_TILE_SIZE 32
|
||||
|
||||
/* Depth of Field*/
|
||||
#define DOF_TILE_DIVISOR 16
|
||||
#define DOF_BOKEH_LUT_SIZE 32
|
||||
#define DOF_GATHER_RING_COUNT 5
|
||||
#define DOF_DILATE_RING_COUNT 3
|
||||
#define DOF_FAST_GATHER_COC_ERROR 0.05
|
||||
|
||||
#endif
|
|
@ -2,6 +2,7 @@
|
|||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_geom_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(raytrace_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
/* Based on Practical Realtime Strategies for Accurate Indirect Occlusion
|
||||
* http://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pdf
|
||||
|
@ -30,8 +31,6 @@
|
|||
# define gl_FragCoord vec4(0.0)
|
||||
#endif
|
||||
|
||||
uniform sampler2D horizonBuffer;
|
||||
|
||||
/* aoSettings flags */
|
||||
#define USE_AO 1
|
||||
#define USE_BENT_NORMAL 2
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
in vec2 pos;
|
||||
|
||||
RESOURCE_ID_VARYING
|
||||
|
||||
void main()
|
||||
{
|
||||
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(bsdf_sampling_lib.glsl)
|
||||
|
||||
uniform float sampleCount;
|
||||
|
||||
out vec2 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Make sure coordinates are covering the whole [0..1] range at texel center. */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(bsdf_sampling_lib.glsl)
|
||||
|
||||
uniform float sampleCount;
|
||||
uniform float z;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float x = floor(gl_FragCoord.x) / (LUT_SIZE - 1.0);
|
||||
|
@ -23,7 +18,7 @@ void main()
|
|||
y += critical_cos;
|
||||
float NV = clamp(y, 1e-4, 0.9999);
|
||||
|
||||
float a = z * z;
|
||||
float a = z_factor * z_factor;
|
||||
float a2 = clamp(a * a, 1e-8, 0.9999);
|
||||
|
||||
vec3 V = vec3(sqrt(1.0 - NV * NV), 0.0, NV);
|
||||
|
@ -72,7 +67,7 @@ void main()
|
|||
btdf_accum /= sampleCount * sampleCount;
|
||||
fresnel_accum /= sampleCount * sampleCount;
|
||||
|
||||
if (z == 0.0) {
|
||||
if (z_factor == 0.0) {
|
||||
/* Perfect mirror. Increased precision because the roughness is clamped. */
|
||||
fresnel_accum = F_eta(ior, NV);
|
||||
}
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
/* #pragma (common_uniforms_lib.glsl) */
|
||||
/* #pragma (renderpass_lib.glsl) */
|
||||
|
||||
#ifndef VOLUMETRICS
|
||||
|
||||
uniform int outputSsrId; /* Default = 1; */
|
||||
uniform int outputSssId; /* Default = 1; */
|
||||
|
||||
#endif
|
||||
|
||||
struct Closure {
|
||||
#ifdef VOLUMETRICS
|
||||
vec3 absorption;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#define COMMON_UNIFORMS_LIB
|
||||
|
||||
#if !defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
/* keep in sync with CommonUniformBlock */
|
||||
layout(std140) uniform common_block
|
||||
{
|
||||
mat4 pastViewProjectionMatrix;
|
||||
|
@ -49,6 +51,14 @@ layout(std140) uniform common_block
|
|||
vec4 planarClipPlane;
|
||||
};
|
||||
|
||||
#endif /* !USE_GPU_SHADER_CREATE_INFO */
|
||||
|
||||
#ifdef USE_GPU_SHADER_CREATE_INFO
|
||||
# ifndef EEVEE_SHADER_SHARED_H
|
||||
# error Missing eevee_legacy_common_lib additional create info on shader create info
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* rayType (keep in sync with ray_type) */
|
||||
#define EEVEE_RAY_CAMERA 0
|
||||
#define EEVEE_RAY_SHADOW 1
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
* tables.
|
||||
* \{ */
|
||||
|
||||
#if !defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
|
||||
uniform sampler2DArray utilTex;
|
||||
|
||||
#endif
|
||||
|
||||
#define LUT_SIZE 64
|
||||
|
||||
#define LTC_MAT_LAYER 0
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
uniform vec4 cryptohash;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/* NOTE: this lib is included in the cryptomatte vertex shader to work around the issue that eevee
|
||||
* cannot use create infos for its static shaders. Keep in sync with draw_shader_shared.h */
|
||||
#ifdef HAIR_SHADER
|
||||
/* Define the maximum number of attribute we allow in a curves UBO.
|
||||
* This should be kept in sync with `GPU_ATTR_MAX` */
|
||||
# define DRW_ATTRIBUTE_PER_CURVES_MAX 15
|
||||
|
||||
struct CurvesInfos {
|
||||
/* Per attribute scope, follows loading order.
|
||||
* NOTE: uint as bool in GLSL is 4 bytes.
|
||||
* NOTE: GLSL pad arrays of scalar to 16 bytes (std140). */
|
||||
uvec4 is_point_attribute[DRW_ATTRIBUTE_PER_CURVES_MAX];
|
||||
};
|
||||
layout(std140) uniform drw_curves
|
||||
{
|
||||
CurvesInfos _drw_curves;
|
||||
};
|
||||
# define drw_curves (_drw_curves)
|
||||
#endif
|
|
@ -3,5 +3,4 @@
|
|||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_attribute_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(cryptomatte_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(surface_vert.glsl)
|
||||
|
|
|
@ -60,7 +60,14 @@ vec3 cubemap_adj_xy(float face)
|
|||
}
|
||||
}
|
||||
|
||||
# ifdef GPU_METAL
|
||||
template<typename T>
|
||||
vec4 cubemap_seamless(thread _mtl_combined_image_sampler_2d_array<T, access::sample> *tex,
|
||||
vec4 cubevec,
|
||||
float lod)
|
||||
# else
|
||||
vec4 cubemap_seamless(sampler2DArray tex, vec4 cubevec, float lod)
|
||||
# endif
|
||||
{
|
||||
/* Manual Cube map Layer indexing. */
|
||||
float face = cubemap_face_index(cubevec.xyz);
|
||||
|
@ -116,7 +123,14 @@ vec4 cubemap_seamless(sampler2DArray tex, vec4 cubevec, float lod)
|
|||
}
|
||||
}
|
||||
|
||||
# ifdef GPU_METAL
|
||||
template<typename T, access A>
|
||||
vec4 textureLod_cubemapArray(thread _mtl_combined_image_sampler_2d_array<T, A> tex,
|
||||
vec4 cubevec,
|
||||
float lod)
|
||||
# else
|
||||
vec4 textureLod_cubemapArray(sampler2DArray tex, vec4 cubevec, float lod)
|
||||
# endif
|
||||
{
|
||||
float lod1 = floor(lod);
|
||||
float lod2 = ceil(lod);
|
||||
|
|
|
@ -28,26 +28,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
uniform sampler2D sourceBuffer; /* Buffer to filter */
|
||||
uniform vec2 sourceBufferTexelSize;
|
||||
|
||||
/* Step Blit */
|
||||
uniform vec4 curveThreshold;
|
||||
uniform float clampIntensity;
|
||||
|
||||
/* Step Upsample */
|
||||
uniform sampler2D baseBuffer; /* Previous accumulation buffer */
|
||||
uniform vec2 baseBufferTexelSize;
|
||||
uniform float sampleScale;
|
||||
|
||||
/* Step Resolve */
|
||||
uniform vec3 bloomColor;
|
||||
uniform bool bloomAddBase;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
/* -------------- Utils ------------- */
|
||||
|
||||
/* 3-tap median filter */
|
||||
|
|
|
@ -9,16 +9,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
uniform float bokehSides;
|
||||
uniform float bokehRotation;
|
||||
uniform vec2 bokehAnisotropyInv;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
layout(location = 0) out vec2 outGatherLut;
|
||||
layout(location = 1) out float outScatterLut;
|
||||
layout(location = 2) out float outResolveLut;
|
||||
|
||||
float polygon_sides_length(float sides_count)
|
||||
{
|
||||
return 2.0 * sin(M_PI / sides_count);
|
||||
|
|
|
@ -6,18 +6,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
/* 1/16th of fullres. */
|
||||
uniform sampler2D cocTilesFgBuffer;
|
||||
uniform sampler2D cocTilesBgBuffer;
|
||||
|
||||
uniform int ringCount;
|
||||
uniform int ringWidthMultiplier;
|
||||
uniform bool dilateSlightFocus;
|
||||
|
||||
/* 1/16th of fullres. Same format as input. */
|
||||
layout(location = 0) out vec4 outFgCoc;
|
||||
layout(location = 1) out vec3 outBgCoc;
|
||||
|
||||
const float tile_to_fullres_factor = float(DOF_TILE_DIVISOR);
|
||||
|
||||
/* Error introduced by the random offset of the gathering kernel's center. */
|
||||
|
|
|
@ -8,13 +8,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
/* Half resolution. */
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D cocBuffer;
|
||||
|
||||
/* Quarter resolution. */
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 halfres_texel_size = 1.0 / vec2(textureSize(colorBuffer, 0).xy);
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D weightBuffer;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(location = 1) out float outWeight;
|
||||
|
||||
/* From:
|
||||
* Implementing Median Filters in XC4000E FPGAs
|
||||
* JOHN L. SMITH, Univision Technologies Inc., Billerica, MA
|
||||
|
|
|
@ -9,13 +9,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
/* Half resolution. */
|
||||
uniform sampler2D halfResCocBuffer;
|
||||
|
||||
/* 1/8th of halfResCocBuffer resolution. So 1/16th of fullres. */
|
||||
layout(location = 0) out vec4 outFgCoc;
|
||||
layout(location = 1) out vec3 outBgCoc;
|
||||
|
||||
const int halfres_tile_divisor = DOF_TILE_DIVISOR / 2;
|
||||
|
||||
void main()
|
||||
|
|
|
@ -12,32 +12,7 @@
|
|||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
/* Mipmapped input buffers, halfres but with padding to ensure mipmap alignment. */
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D cocBuffer;
|
||||
|
||||
/* Same input buffer but with a bilinear sampler object. */
|
||||
uniform sampler2D colorBufferBilinear;
|
||||
|
||||
/* CoC Min&Max tile buffer at 1/16th of fullres. */
|
||||
uniform sampler2D cocTilesFgBuffer;
|
||||
uniform sampler2D cocTilesBgBuffer;
|
||||
|
||||
uniform sampler2D bokehLut;
|
||||
|
||||
/* Used to correct the padding in the color and CoC buffers. */
|
||||
uniform vec2 gatherInputUvCorrection;
|
||||
|
||||
uniform vec2 gatherOutputTexelSize;
|
||||
|
||||
uniform vec2 bokehAnisotropy;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(location = 1) out float outWeight;
|
||||
#ifndef DOF_HOLEFILL_PASS
|
||||
layout(location = 2) out vec2 outOcclusion;
|
||||
#else
|
||||
|
||||
#ifdef DOF_HOLEFILL_PASS
|
||||
/* Dirty global variable that isn't used. So it should get optimized out. */
|
||||
vec2 outOcclusion;
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
uniform vec4 cocParams;
|
||||
|
||||
#define cocMul cocParams[0] /* distance * aperturesize * invsensorsize */
|
||||
#define cocBias cocParams[1] /* aperturesize * invsensorsize */
|
||||
#define cocNear cocParams[2] /* Near view depths value. */
|
||||
|
|
|
@ -6,31 +6,8 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
/** Inputs:
|
||||
* COPY_PASS: Is output of setup pass (halfres) and downsample pass (quarter res).
|
||||
* REDUCE_PASS: Is previous Gather input miplvl (halfres >> miplvl).
|
||||
*/
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D cocBuffer;
|
||||
uniform sampler2D downsampledBuffer;
|
||||
|
||||
uniform vec2 bokehAnisotropy;
|
||||
uniform float scatterColorThreshold;
|
||||
uniform float scatterCocThreshold;
|
||||
uniform float scatterColorNeighborMax;
|
||||
uniform float colorNeighborClamping;
|
||||
|
||||
/** Outputs:
|
||||
* COPY_PASS: Gather input mip0.
|
||||
* REDUCE_PASS: Is next Gather input miplvl (halfres >> miplvl).
|
||||
*/
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(location = 1) out float outCoc;
|
||||
|
||||
#ifdef COPY_PASS
|
||||
|
||||
layout(location = 2) out vec3 outScatterColor;
|
||||
|
||||
/* NOTE: Do not compare alpha as it is not scattered by the scatter pass. */
|
||||
float dof_scatter_neighborhood_rejection(vec3 color)
|
||||
{
|
||||
|
|
|
@ -10,28 +10,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
uniform sampler2D fullResColorBuffer;
|
||||
uniform sampler2D fullResDepthBuffer;
|
||||
|
||||
uniform sampler2D bgColorBuffer;
|
||||
uniform sampler2D bgWeightBuffer;
|
||||
uniform sampler2D bgTileBuffer;
|
||||
|
||||
uniform sampler2D fgColorBuffer;
|
||||
uniform sampler2D fgWeightBuffer;
|
||||
uniform sampler2D fgTileBuffer;
|
||||
|
||||
uniform sampler2D holefillColorBuffer;
|
||||
uniform sampler2D holefillWeightBuffer;
|
||||
|
||||
uniform sampler2D bokehLut;
|
||||
|
||||
uniform float bokehMaxSize;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void dof_slight_focus_gather(float radius, out vec4 out_color, out float out_weight)
|
||||
{
|
||||
/* offset coord to avoid correlation with sampling pattern. */
|
||||
|
|
|
@ -8,22 +8,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
uniform sampler2D occlusionBuffer;
|
||||
uniform sampler2D bokehLut;
|
||||
|
||||
uniform vec2 bokehAnisotropyInv;
|
||||
|
||||
flat in vec4 color1;
|
||||
flat in vec4 color2;
|
||||
flat in vec4 color3;
|
||||
flat in vec4 color4;
|
||||
flat in vec4 weights;
|
||||
flat in vec4 cocs;
|
||||
flat in vec2 spritepos;
|
||||
flat in float spritesize; /* MaxCoC */
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
float bokeh_shape(vec2 center)
|
||||
{
|
||||
vec2 co = gl_FragCoord.xy - center;
|
||||
|
|
|
@ -1,27 +1,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
uniform vec2 targetTexelSize;
|
||||
uniform int spritePerRow;
|
||||
uniform vec2 bokehAnisotropy;
|
||||
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D cocBuffer;
|
||||
|
||||
/* Scatter pass, calculate a triangle covering the CoC.
|
||||
* We render to a half resolution target with double width so we can
|
||||
* separate near and far fields. We also generate only one triangle per group of 4 pixels
|
||||
* to limit overdraw. */
|
||||
|
||||
flat out vec4 color1;
|
||||
flat out vec4 color2;
|
||||
flat out vec4 color3;
|
||||
flat out vec4 color4;
|
||||
flat out vec4 weights;
|
||||
flat out vec4 cocs;
|
||||
flat out vec2 spritepos;
|
||||
flat out float spritesize;
|
||||
|
||||
/* Load 4 Circle of confusion values. texel_co is centered around the 4 taps. */
|
||||
vec4 fetch_cocs(vec2 texel_co)
|
||||
{
|
||||
|
|
|
@ -8,16 +8,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(effect_dof_lib.glsl)
|
||||
|
||||
/* Full resolution. */
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D depthBuffer;
|
||||
|
||||
uniform float bokehMaxSize;
|
||||
|
||||
/* Half resolution. */
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(location = 1) out vec2 outCoc; /* x: Downsample CoC, y: Max slight focus abs CoC */
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 fullres_texel_size = 1.0 / vec2(textureSize(colorBuffer, 0).xy);
|
||||
|
|
|
@ -4,39 +4,36 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
uniform samplerCube source;
|
||||
uniform float texelSize;
|
||||
|
||||
flat in int fFace;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
const vec3 maj_axes[6] = vec3[6](vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0),
|
||||
vec3(0.0, 1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(0.0, 0.0, -1.0));
|
||||
const vec3 x_axis[6] = vec3[6](vec3(0.0, 0.0, -1.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0));
|
||||
const vec3 y_axis[6] = vec3[6](vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(0.0, 0.0, -1.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0));
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
/* Global scope arrays get allocated using local memory in Metal. Moving inside function scope to
|
||||
* reduce register pressure. */
|
||||
const vec3 maj_axes[6] = vec3[6](vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0),
|
||||
vec3(0.0, 1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(0.0, 0.0, -1.0));
|
||||
const vec3 x_axis[6] = vec3[6](vec3(0.0, 0.0, -1.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0));
|
||||
const vec3 y_axis[6] = vec3[6](vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(0.0, 0.0, -1.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0));
|
||||
|
||||
vec2 uvs = gl_FragCoord.xy * texelSize;
|
||||
|
||||
uvs = 2.0 * uvs - 1.0;
|
||||
|
||||
vec3 cubevec = x_axis[fFace] * uvs.x + y_axis[fFace] * uvs.y + maj_axes[fFace];
|
||||
vec3 cubevec = x_axis[geom_iface.fFace] * uvs.x + y_axis[geom_iface.fFace] * uvs.y +
|
||||
maj_axes[geom_iface.fFace];
|
||||
|
||||
FragColor = textureLod(source, cubevec, 0.0);
|
||||
}
|
||||
|
|
|
@ -6,15 +6,6 @@
|
|||
* Do a gaussian filter using 4 bilinear texture samples.
|
||||
*/
|
||||
|
||||
uniform sampler2D source;
|
||||
uniform float fireflyFactor;
|
||||
|
||||
#ifndef COPY_SRC
|
||||
uniform vec2 texelSize;
|
||||
#endif
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
#ifdef COPY_SRC
|
||||
|
|
|
@ -10,12 +10,6 @@
|
|||
* The final integration is done at the resolve stage with the shading normal.
|
||||
*/
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform sampler2D normalBuffer;
|
||||
|
||||
/* Similar to https://atyuwen.github.io/posts/normal-reconstruction/.
|
||||
* This samples the depth buffer 4 time for each direction to get the most correct
|
||||
* implicit normal reconstruction out of the depth buffer. */
|
||||
|
|
|
@ -7,17 +7,6 @@
|
|||
* avoid mipmapping misalignment.
|
||||
*/
|
||||
|
||||
#ifdef LAYERED
|
||||
uniform sampler2DArray depthBuffer;
|
||||
uniform int depthLayer;
|
||||
#else
|
||||
uniform sampler2D depthBuffer;
|
||||
#endif
|
||||
|
||||
#ifndef COPY_DEPTH
|
||||
uniform vec2 texelSize;
|
||||
#endif
|
||||
|
||||
#ifdef LAYERED
|
||||
# define sampleLowerMip(t) texture(depthBuffer, vec3(t, depthLayer)).r
|
||||
# define gatherLowerMip(t) textureGather(depthBuffer, vec3(t, depthLayer))
|
||||
|
@ -36,12 +25,6 @@ uniform vec2 texelSize;
|
|||
# define minmax4(a, b, c, d) max(max(max(a, b), c), d)
|
||||
#endif
|
||||
|
||||
/* On some AMD card / driver combination, it is needed otherwise,
|
||||
* the shader does not write anything. */
|
||||
#if (defined(GPU_INTEL) || defined(GPU_ATI)) && defined(GPU_OPENGL)
|
||||
out vec4 fragColor;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texel = gl_FragCoord.xy;
|
||||
|
|
|
@ -2,16 +2,10 @@
|
|||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
/* Convert depth to Mist factor */
|
||||
uniform vec3 mistSettings;
|
||||
uniform depth2D depthBuffer;
|
||||
|
||||
#define mistStart mistSettings.x
|
||||
#define mistInvDistance mistSettings.y
|
||||
#define mistFalloff mistSettings.z
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texel_size = 1.0 / vec2(textureSize(depthBuffer, 0)).xy;
|
||||
|
|
|
@ -10,28 +10,13 @@
|
|||
* Next Generation Post Processing in Call of Duty Advanced Warfare
|
||||
* by Jorge Jimenez
|
||||
*/
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform depth2D depthBuffer;
|
||||
uniform sampler2D velocityBuffer;
|
||||
uniform sampler2D tileMaxBuffer;
|
||||
|
||||
#define KERNEL 8
|
||||
|
||||
uniform float depthScale;
|
||||
uniform ivec2 tileBufferSize;
|
||||
uniform vec2 viewportSize;
|
||||
uniform vec2 viewportSizeInv;
|
||||
uniform bool isPerspective;
|
||||
uniform vec2 nearFar; /* Near & far view depths values */
|
||||
|
||||
#define linear_depth(z) \
|
||||
((isPerspective) ? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \
|
||||
z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
#define saturate(a) clamp(a, 0.0, 1.0)
|
||||
|
||||
vec2 spread_compare(float center_motion_length, float sample_motion_length, float offset_length)
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
* https://media.contentapi.ea.com/content/dam/ea/seed/presentations/dd18-seed-raytracing-in-hybrid-real-time-rendering.pdf
|
||||
*/
|
||||
|
||||
uniform ivec2 halfresOffset;
|
||||
|
||||
struct HitData {
|
||||
/** Hit direction scaled by intersection time. */
|
||||
vec3 hit_dir;
|
||||
|
|
|
@ -18,18 +18,6 @@
|
|||
* https://media.contentapi.ea.com/content/dam/ea/seed/presentations/dd18-seed-raytracing-in-hybrid-real-time-rendering.pdf
|
||||
*/
|
||||
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D normalBuffer;
|
||||
uniform sampler2D specroughBuffer;
|
||||
uniform sampler2D hitBuffer;
|
||||
uniform sampler2D hitDepth;
|
||||
|
||||
uniform int samplePoolOffset;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
vec4 ssr_get_scene_color_and_mask(vec3 hit_vP, int planar_index, float mip)
|
||||
{
|
||||
vec2 uv;
|
||||
|
|
|
@ -17,16 +17,6 @@
|
|||
* https://media.contentapi.ea.com/content/dam/ea/seed/presentations/dd18-seed-raytracing-in-hybrid-real-time-rendering.pdf
|
||||
*/
|
||||
|
||||
uniform sampler2D normalBuffer;
|
||||
uniform sampler2D specroughBuffer;
|
||||
uniform vec2 targetSize;
|
||||
uniform float randomScale;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
layout(location = 0) out vec4 hitData;
|
||||
layout(location = 1) out float hitDepth;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
|
||||
|
|
|
@ -6,22 +6,6 @@
|
|||
|
||||
/* Based on Separable SSS. by Jorge Jimenez and Diego Gutierrez */
|
||||
|
||||
#define MAX_SSS_SAMPLES 65
|
||||
layout(std140) uniform sssProfile
|
||||
{
|
||||
vec4 sss_kernel[MAX_SSS_SAMPLES];
|
||||
vec4 radii_max_radius;
|
||||
float avg_inv_radius;
|
||||
int sss_samples;
|
||||
};
|
||||
|
||||
uniform sampler2D depthBuffer;
|
||||
uniform sampler2D sssIrradiance;
|
||||
uniform sampler2D sssRadius;
|
||||
uniform sampler2D sssAlbedo;
|
||||
|
||||
layout(location = 0) out vec4 sssRadiance;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 pixel_size = 1.0 / vec2(textureSize(depthBuffer, 0).xy); /* TODO: precompute. */
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
uniform sampler2D colorBuffer;
|
||||
/*uniform sampler2D colorBuffer;
|
||||
uniform depth2D depthBuffer;
|
||||
uniform sampler2D colorHistoryBuffer;
|
||||
|
||||
uniform mat4 prevViewProjectionMatrix;
|
||||
|
||||
out vec4 FragColor;
|
||||
out vec4 FragColor;*/
|
||||
|
||||
#ifdef USE_REPROJECTION
|
||||
|
||||
|
@ -105,8 +105,6 @@ void main()
|
|||
|
||||
#else
|
||||
|
||||
uniform float alpha;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 texel = ivec2(gl_FragCoord.xy);
|
||||
|
|
|
@ -4,29 +4,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(lights_lib.glsl)
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform depth2D depthBuffer;
|
||||
uniform sampler1D sssTexProfile;
|
||||
uniform sampler2D sssRadius;
|
||||
uniform sampler2DArray sssShadowCubes;
|
||||
uniform sampler2DArray sssShadowCascades;
|
||||
|
||||
#define MAX_SSS_SAMPLES 65
|
||||
#define SSS_LUT_SIZE 64.0
|
||||
#define SSS_LUT_SCALE ((SSS_LUT_SIZE - 1.0) / float(SSS_LUT_SIZE))
|
||||
#define SSS_LUT_BIAS (0.5 / float(SSS_LUT_SIZE))
|
||||
|
||||
layout(std140) uniform sssProfile
|
||||
{
|
||||
vec4 sss_kernel[MAX_SSS_SAMPLES];
|
||||
vec4 radii_max_radius;
|
||||
float avg_inv_radius;
|
||||
int sss_samples;
|
||||
};
|
||||
|
||||
vec3 sss_profile(float s)
|
||||
{
|
||||
s /= radii_max_radius.w * avg_inv_radius;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
uniform depth2D depthBuffer;
|
||||
|
||||
uniform mat4 prevViewProjMatrix;
|
||||
uniform mat4 currViewProjMatrixInv;
|
||||
uniform mat4 nextViewProjMatrix;
|
||||
|
||||
out vec4 outData;
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Extract pixel motion vector from camera movement. */
|
||||
|
|
|
@ -8,13 +8,6 @@
|
|||
* Adapted from G3D Innovation Engine implementation.
|
||||
*/
|
||||
|
||||
uniform sampler2D velocityBuffer;
|
||||
uniform vec2 viewportSize;
|
||||
uniform vec2 viewportSizeInv;
|
||||
uniform ivec2 velocityBufferSize;
|
||||
|
||||
out vec4 tileMaxVelocity;
|
||||
|
||||
vec4 sample_velocity(ivec2 texel)
|
||||
{
|
||||
texel = clamp(texel, ivec2(0), velocityBufferSize - 1);
|
||||
|
@ -30,8 +23,6 @@ vec4 encode_velocity(vec4 velocity)
|
|||
|
||||
#ifdef TILE_GATHER
|
||||
|
||||
uniform ivec2 gatherStep;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 max_motion = vec4(0.0);
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_common)
|
||||
.push_constant(Type::VEC2, "sourceBufferTexelSize")
|
||||
.push_constant(Type::VEC4, "curveThreshold")
|
||||
.push_constant(Type::FLOAT, "clampIntensity")
|
||||
.push_constant(Type::VEC2, "baseBufferTexelSize")
|
||||
.push_constant(Type::FLOAT, "sampleScale")
|
||||
.push_constant(Type::VEC3, "bloomColor")
|
||||
.push_constant(Type::BOOL, "bloomAddBase")
|
||||
.sampler(0, ImageType::FLOAT_2D, "sourceBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "baseBuffer")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("effect_bloom_frag.glsl");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_blit)
|
||||
.define("STEP_BLIT")
|
||||
.additional_info("eevee_legacy_bloom_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_blit_hq)
|
||||
.define("HIGH_QUALITY")
|
||||
.additional_info("eevee_legacy_bloom_blit")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_downsample)
|
||||
.define("STEP_DOWNSAMPLE")
|
||||
.additional_info("eevee_legacy_bloom_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_downsample_hq)
|
||||
.define("HIGH_QUALITY")
|
||||
.additional_info("eevee_legacy_bloom_downsample")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_upsample)
|
||||
.define("STEP_UPSAMPLE")
|
||||
.additional_info("eevee_legacy_bloom_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_upsample_hq)
|
||||
.define("HIGH_QUALITY")
|
||||
.additional_info("eevee_legacy_bloom_upsample")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve)
|
||||
.define("STEP_RESOLVE")
|
||||
.additional_info("eevee_legacy_bloom_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve_hq)
|
||||
.define("HIGH_QUALITY")
|
||||
.additional_info("eevee_legacy_bloom_resolve")
|
||||
.do_static_compilation(true);
|
|
@ -0,0 +1,208 @@
|
|||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
#pragma once
|
||||
|
||||
/* EEVEE defines. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_defines_info).typedef_source("engine_eevee_shared_defines.h");
|
||||
|
||||
/* Only specifies bindings for common_uniform_lib.glsl. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_common_lib)
|
||||
.typedef_source("engine_eevee_shared_defines.h")
|
||||
.typedef_source("engine_eevee_legacy_shared.h")
|
||||
.uniform_buf(1, "CommonUniformBlock", "common_block", Frequency::PASS);
|
||||
|
||||
/* Only specifies bindings for irradiance_lib.glsl. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_irradiance_lib)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.sampler(1, ImageType::FLOAT_2D_ARRAY, "irradianceGrid");
|
||||
|
||||
/* Utiltex Lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_common_utiltex_lib)
|
||||
.sampler(2, ImageType::FLOAT_2D_ARRAY, "utilTex");
|
||||
|
||||
/* Raytrace lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_raytrace_lib)
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.sampler(3, ImageType::FLOAT_2D, "maxzBuffer")
|
||||
.sampler(4, ImageType::DEPTH_2D_ARRAY, "planarDepth");
|
||||
|
||||
/* Ambient occlusion lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ambient_occlusion_lib)
|
||||
.additional_info("eevee_legacy_raytrace_lib")
|
||||
.sampler(5, ImageType::FLOAT_2D, "horizonBuffer");
|
||||
|
||||
/* Lightprobe lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_lib)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_ambient_occlusion_lib")
|
||||
.additional_info("eevee_legacy_irradiance_lib")
|
||||
.sampler(6, ImageType::FLOAT_2D_ARRAY, "probePlanars")
|
||||
.sampler(7, ImageType::FLOAT_CUBE_ARRAY, "probeCubes")
|
||||
.uniform_buf(2, "ProbeBlock", "probe_block", Frequency::PASS)
|
||||
.uniform_buf(3, "GridBlock", "grid_block", Frequency::PASS)
|
||||
.uniform_buf(4, "PlanarBlock", "planar_block", Frequency::PASS);
|
||||
|
||||
/* LTC Lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ltc_lib).additional_info("eevee_legacy_common_utiltex_lib");
|
||||
|
||||
/* Lights lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lights_lib)
|
||||
.additional_info("eevee_legacy_ltc_lib")
|
||||
.additional_info("eevee_legacy_raytrace_lib")
|
||||
.uniform_buf(5, "ShadowBlock", "shadow_block", Frequency::PASS)
|
||||
.uniform_buf(6, "LightBlock", "light_block", Frequency::PASS)
|
||||
.sampler(8, ImageType::SHADOW_2D_ARRAY, "shadowCubeTexture")
|
||||
.sampler(9, ImageType::SHADOW_2D_ARRAY, "shadowCascadeTexture");
|
||||
|
||||
/* Hair lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_hair_lib)
|
||||
.additional_info("draw_hair")
|
||||
.sampler(10, ImageType::UINT_BUFFER, "hairStrandBuffer")
|
||||
.sampler(11, ImageType::UINT_BUFFER, "hairStrandSegBuffer");
|
||||
|
||||
/* SSR Lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ssr_lib)
|
||||
.additional_info("eevee_legacy_raytrace_lib")
|
||||
.push_constant(Type::FLOAT, "refractionDepth")
|
||||
.sampler(12, ImageType::FLOAT_2D, "refractColorBuffer");
|
||||
|
||||
/* renderpass_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_renderpass_lib)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.uniform_buf(12, "RenderpassBlock", "renderpass_block", Frequency::PASS);
|
||||
|
||||
/* Reflection lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_reflection_lib)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.push_constant(Type::IVEC2, "halfresOffset");
|
||||
|
||||
/* Volumetric lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumetric_lib)
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_irradiance_lib")
|
||||
.sampler(13, ImageType::FLOAT_3D, "inScattering")
|
||||
.sampler(14, ImageType::FLOAT_3D, "inTransmittance");
|
||||
|
||||
/* eevee_legacy_cryptomatte_lib. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_cryptomatte_lib).additional_info("draw_curves_infos");
|
||||
|
||||
/* ----- SURFACE LIB ----- */
|
||||
/* Surface lib has several different components depending on how it is used.
|
||||
* Differing root permutations need to be generated and included depending
|
||||
* on use-case. */
|
||||
|
||||
/* SURFACE LIB INTERFACES */
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_surface_common_iface, "")
|
||||
.smooth(Type::VEC3, "worldPosition")
|
||||
.smooth(Type::VEC3, "viewPosition")
|
||||
.smooth(Type::VEC3, "worldNormal")
|
||||
.smooth(Type::VEC3, "viewNormal");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_surface_point_cloud_iface, "")
|
||||
.smooth(Type::FLOAT, "pointRadius")
|
||||
.smooth(Type::FLOAT, "pointPosition")
|
||||
.flat(Type::INT, "pointID");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_surface_hair_iface, "")
|
||||
.smooth(Type::VEC3, "hairTangent")
|
||||
.smooth(Type::FLOAT, "hairThickTime")
|
||||
.smooth(Type::FLOAT, "hairThickness")
|
||||
.smooth(Type::FLOAT, "hairTime")
|
||||
.flat(Type::INT, "hairStrandID")
|
||||
.smooth(Type::VEC2, "hairBary");
|
||||
|
||||
/* Surface lib components */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_common)
|
||||
.vertex_out(eevee_legacy_surface_common_iface);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_hair)
|
||||
.define("USE_SURFACE_LIB_HAIR")
|
||||
/* Hair still uses the common interface as well. */
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.vertex_out(eevee_legacy_surface_hair_iface);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_pointcloud)
|
||||
.define("USE_SURFACE_LIB_POINTCLOUD")
|
||||
/* Pointcloud still uses the common interface as well. */
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.vertex_out(eevee_legacy_surface_point_cloud_iface);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_step_resolve).define("STEP_RESOLVE");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_step_raytrace).define("STEP_RAYTRACE");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_world_background).define("WORLD_BACKGROUND");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_step_probe_capture).define("PROBE_CAPTURE");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_use_barycentrics).define("USE_BARYCENTRICS");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_codegen_lib).define("CODEGEN_LIB");
|
||||
|
||||
/* Surface lib permutations. */
|
||||
|
||||
/* Basic - lookdev world frag */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_surface_lib_lookdev)
|
||||
.additional_info("eevee_legacy_surface_lib_common");
|
||||
|
||||
/** Closure evaluation libraries **/
|
||||
|
||||
/* eevee_legacy_closure_type_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_type_lib)
|
||||
.push_constant(Type::INT, "outputSsrId")
|
||||
.push_constant(Type::INT, "outputSssId");
|
||||
|
||||
/* eevee_legacy_closure_eval_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_lib)
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_diffuse_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_diffuse_lib)
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_ambient_occlusion_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_glossy_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_glossy_lib)
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_ambient_occlusion_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_refraction_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_refraction_lib)
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_ambient_occlusion_lib")
|
||||
.additional_info("eevee_legacy_ssr_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_translucent_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_translucent_lib)
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_ambient_occlusion_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_surface_lib*/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_surface_lib)
|
||||
.additional_info("eevee_legacy_closure_eval_diffuse_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_glossy_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_refraction_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_translucent_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
|
@ -0,0 +1,289 @@
|
|||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* DOF Lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_dof_lib)
|
||||
.additional_info("draw_view")
|
||||
.push_constant(Type::VEC4, "cocParams");
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_bokeh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_bokeh)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_bokeh_frag.glsl")
|
||||
.push_constant(Type::FLOAT, "bokehSides")
|
||||
.push_constant(Type::FLOAT, "bokehRotation")
|
||||
.push_constant(Type::VEC2, "bokehAnisotropyInv")
|
||||
.fragment_out(0, Type::VEC2, "outGatherLut")
|
||||
.fragment_out(1, Type::FLOAT, "outScatterLut")
|
||||
.fragment_out(2, Type::FLOAT, "outResolveLut")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_setup_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_setup)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_setup_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.push_constant(Type::FLOAT, "bokehMaxSize")
|
||||
.fragment_out(0, Type::VEC4, "outColor")
|
||||
.fragment_out(1, Type::VEC2, "outCoc")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_flatten_tiles_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_flatten_tiles)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_flatten_tiles_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "halfResCocBuffer")
|
||||
.fragment_out(0, Type::VEC4, "outFgCoc")
|
||||
.fragment_out(1, Type::VEC3, "outBgCoc")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_dilate_tiles_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_dilate_tiles_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_dilate_tiles_frag.glsl")
|
||||
.push_constant(Type::INT, "ringCount")
|
||||
.push_constant(Type::INT, "ringWidthMultiplier")
|
||||
.push_constant(Type::BOOL, "dilateSlightFocus")
|
||||
.sampler(0, ImageType::FLOAT_2D, "cocTilesFgBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "cocTilesBgBuffer")
|
||||
.fragment_out(0, Type::VEC4, "outFgCoc")
|
||||
.fragment_out(1, Type::VEC3, "outBgCoc")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_dilate_tiles_MINMAX)
|
||||
.define("DILATE_MODE_MIN_MAX")
|
||||
.additional_info("eevee_legacy_depth_of_field_dilate_tiles_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_dilate_tiles_MINABS)
|
||||
.define("DILATE_MODE_MIN_ABS")
|
||||
.additional_info("eevee_legacy_depth_of_field_dilate_tiles_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_downsample_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_downsample)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_downsample_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "cocBuffer")
|
||||
.fragment_out(0, Type::VEC4, "outColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_reduce_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_reduce_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_reduce_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "cocBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "downsampledBuffer")
|
||||
.push_constant(Type::VEC2, "bokehAnisotropy")
|
||||
.push_constant(Type::FLOAT, "scatterColorThreshold")
|
||||
.push_constant(Type::FLOAT, "scatterCocThreshold")
|
||||
.push_constant(Type::FLOAT, "scatterColorNeighborMax")
|
||||
.push_constant(Type::FLOAT, "colorNeighborClamping")
|
||||
.fragment_out(0, Type::VEC4, "outColor")
|
||||
.fragment_out(1, Type::FLOAT, "outCoc")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_reduce_COPY_PASS)
|
||||
.define("COPY_PASS")
|
||||
.fragment_out(2, Type::VEC3, "outScatterColor")
|
||||
.additional_info("eevee_legacy_depth_of_field_reduce_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_reduce_REDUCE_PASS)
|
||||
.define("REDUCE_PASS")
|
||||
.additional_info("eevee_legacy_depth_of_field_reduce_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_gather_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_gather_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "cocBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "colorBufferBilinear")
|
||||
.sampler(3, ImageType::FLOAT_2D, "cocTilesFgBuffer")
|
||||
.sampler(4, ImageType::FLOAT_2D, "cocTilesBgBuffer")
|
||||
.sampler(5, ImageType::FLOAT_2D, "bokehLut")
|
||||
.push_constant(Type::VEC2, "gatherInputUvCorrection")
|
||||
.push_constant(Type::VEC2, "gatherOutputTexelSize")
|
||||
.push_constant(Type::VEC2, "bokehAnisotropy")
|
||||
.fragment_out(0, Type::VEC4, "outColor")
|
||||
.fragment_out(1, Type::FLOAT, "outWeight")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_bokeh).define("DOF_BOKEH_TEXTURE");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_FOREGROUND)
|
||||
.define("DOF_FOREGROUND_PASS")
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_common")
|
||||
.fragment_out(2, Type::VEC2, "outOcclusion") /* NOT DOF_HOLEFILL_PASS */
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_BACKGROUND)
|
||||
.define("DOF_BACKGROUND_PASS")
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_common")
|
||||
.fragment_out(2, Type::VEC2, "outOcclusion") /* NOT DOF_HOLEFILL_PASS */
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_HOLEFILL)
|
||||
.define("DOF_BACKGROUND_PASS")
|
||||
.define("DOF_HOLEFILL_PASS")
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_FOREGROUND_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_bokeh")
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_FOREGROUND")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_BACKGROUND_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_bokeh")
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_BACKGROUND")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_gather_HOLEFILL_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_bokeh")
|
||||
.additional_info("eevee_legacy_depth_of_field_gather_HOLEFILL")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_filter_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_filter)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_filter_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "weightBuffer")
|
||||
.fragment_out(0, Type::VEC4, "outColor")
|
||||
.fragment_out(1, Type::FLOAT, "outWeight")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_scatter_get */
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_dof_scatter_iface, "")
|
||||
.flat(Type::VEC4, "color1")
|
||||
.flat(Type::VEC4, "color2")
|
||||
.flat(Type::VEC4, "color3")
|
||||
.flat(Type::VEC4, "color4")
|
||||
.flat(Type::VEC4, "weights")
|
||||
.flat(Type::VEC4, "cocs")
|
||||
.flat(Type::VEC2, "spritepos")
|
||||
.flat(Type::FLOAT, "spritesize");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_scatter_common)
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.vertex_source("effect_dof_scatter_vert.glsl")
|
||||
.fragment_source("effect_dof_scatter_frag.glsl")
|
||||
.vertex_out(eevee_legacy_dof_scatter_iface)
|
||||
.push_constant(Type::VEC2, "targetTexelSize")
|
||||
.push_constant(Type::INT, "spritePerRow")
|
||||
.push_constant(Type::VEC2, "bokehAnisotropy")
|
||||
.push_constant(Type::VEC2, "bokehAnisotropyInv")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "cocBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "occlusionBuffer")
|
||||
.sampler(3, ImageType::FLOAT_2D, "bokehLut")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_scatter_bokeh).define("DOF_BOKEH_TEXTURE");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_scatter_FOREGROUND)
|
||||
.define("DOF_FOREGROUND_PASS")
|
||||
.additional_info("eevee_legacy_depth_of_field_scatter_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_scatter_BACKGROUND)
|
||||
.define("DOF_BACKGROUND_PASS")
|
||||
.additional_info("eevee_legacy_depth_of_field_scatter_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_scatter_FOREGROUND_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_scatter_bokeh")
|
||||
.additional_info("eevee_legacy_depth_of_field_scatter_FOREGROUND")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_scatter_BACKGROUND_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_scatter_bokeh")
|
||||
.additional_info("eevee_legacy_depth_of_field_scatter_BACKGROUND")
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_depth_of_field_resolve_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_common)
|
||||
.define("DOF_RESOLVE_PASS")
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_dof_lib")
|
||||
.fragment_source("effect_dof_resolve_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "fullResColorBuffer")
|
||||
.sampler(1, ImageType::DEPTH_2D, "fullResDepthBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "bgColorBuffer")
|
||||
.sampler(3, ImageType::FLOAT_2D, "bgWeightBuffer")
|
||||
.sampler(4, ImageType::FLOAT_2D, "bgTileBuffer")
|
||||
.sampler(5, ImageType::FLOAT_2D, "fgColorBuffer")
|
||||
.sampler(6, ImageType::FLOAT_2D, "fgWeightBuffer")
|
||||
.sampler(7, ImageType::FLOAT_2D, "fgTileBuffer")
|
||||
.sampler(8, ImageType::FLOAT_2D, "holefillColorBuffer")
|
||||
.sampler(9, ImageType::FLOAT_2D, "holefillWeightBuffer")
|
||||
.sampler(10, ImageType::FLOAT_2D, "bokehLut")
|
||||
.push_constant(Type::FLOAT, "bokehMaxSize")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_bokeh).define("DOF_BOKEH_TEXTURE");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_HQ)
|
||||
.define("DOF_SLIGHT_FOCUS_DENSITY", "4")
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_LQ)
|
||||
.define("DOF_SLIGHT_FOCUS_DENSITY", "2")
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_common")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_HQ_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_HQ")
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_bokeh")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_LQ_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_LQ")
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_bokeh")
|
||||
.do_static_compilation(true);
|
|
@ -0,0 +1,352 @@
|
|||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* effect_minmaxz_frag permutation inputs. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minmaxz_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("effect_minmaxz_frag.glsl")
|
||||
.fragment_out(0, Type::VEC4, "fragColor") /* Needed by certain drivers. */
|
||||
.depth_write(DepthWrite::ANY);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minmaxz_layered_common)
|
||||
.define("LAYERED")
|
||||
.sampler(0, ImageType::DEPTH_2D_ARRAY, "depthBuffer")
|
||||
.push_constant(Type::INT, "depthLayer");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minmaxz_non_layered_common)
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minmaxz_non_copy).push_constant(Type::VEC2, "texelSize");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minmaxz_copy).define("COPY_DEPTH");
|
||||
|
||||
/* Permutations. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minz_downlevel)
|
||||
.define("MIN_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_copy")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_maxz_downlevel)
|
||||
.define("MAX_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_copy")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minz_downdepth)
|
||||
.define("MIN_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_copy")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_maxz_downdepth)
|
||||
.define("MAX_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_copy")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minz_downdepth_layer)
|
||||
.define("MIN_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_copy")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_maxz_downdepth_layer)
|
||||
.define("MAX_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_copy")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_maxz_copydepth_layer)
|
||||
.define("MAX_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_copy")
|
||||
.additional_info("eevee_legacy_minmaxz_layered_common")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_minz_copydepth)
|
||||
.define("MIN_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_copy")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_layered_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_maxz_copydepth)
|
||||
.define("MAX_PASS")
|
||||
.additional_info("eevee_legacy_minmaxz_copy")
|
||||
.additional_info("eevee_legacy_minmaxz_common")
|
||||
.additional_info("eevee_legacy_minmaxz_non_layered_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_update_noise_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_update_noise)
|
||||
.sampler(0, ImageType::FLOAT_2D, "blueNoise")
|
||||
.push_constant(Type::VEC3, "offsets")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("update_noise_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_taa_resolve_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_taa_resolve)
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "colorHistoryBuffer")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view")
|
||||
.fragment_source("effect_temporal_aa.glsl")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_taa_resolve_basic)
|
||||
.push_constant(Type::FLOAT, "alpha")
|
||||
.additional_info("eevee_legacy_taa_resolve")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_taa_resolve_reprojection)
|
||||
.define("USE_REPROJECTION")
|
||||
.sampler(2, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.push_constant(Type::MAT4, "prevViewProjectionMatrix")
|
||||
.additional_info("eevee_legacy_taa_resolve")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_velocity_resolve_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_velocity_resolve)
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.push_constant(Type::MAT4, "prevViewProjMatrix")
|
||||
.push_constant(Type::MAT4, "currViewProjMatrixInv")
|
||||
.push_constant(Type::MAT4, "nextViewProjMatrix")
|
||||
.fragment_out(0, Type::VEC4, "outData")
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("effect_velocity_resolve_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_downsample_sh_get */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_downsample_shared)
|
||||
.additional_info("draw_fullscreen")
|
||||
.sampler(0, ImageType::FLOAT_2D, "source")
|
||||
.push_constant(Type::FLOAT, "fireflyFactor")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.fragment_source("effect_downsample_frag.glsl")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_downsample)
|
||||
.additional_info("eevee_legacy_downsample_shared")
|
||||
.push_constant(Type::VEC2, "texelSize")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_color_copy_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_color_copy)
|
||||
.define("COPY_SRC")
|
||||
.additional_info("eevee_legacy_downsample_shared")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_ambient_occlusion_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ambient_occlusion)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_ambient_occlusion_lib")
|
||||
.additional_info("draw_fullscreen")
|
||||
.sampler(0, ImageType::FLOAT_2D, "normalBuffer")
|
||||
.push_constant(Type::FLOAT, "fireflyFactor")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.fragment_source("effect_gtao_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_ambient_occlusion_debug_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ambient_occlusion_debug)
|
||||
.define("DEBUG_AO")
|
||||
.define("ENABLE_DEFERED_AO")
|
||||
.additional_info("eevee_legacy_ambient_occlusion")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_reflection_trace_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_reflection_trace)
|
||||
.additional_info("eevee_legacy_surface_lib_step_raytrace")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_raytrace_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_reflection_lib")
|
||||
.additional_info("draw_fullscreen")
|
||||
.sampler(0, ImageType::FLOAT_2D, "normalBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "specroughBuffer")
|
||||
.push_constant(Type::VEC2, "targetSize")
|
||||
.push_constant(Type::FLOAT, "randomScale")
|
||||
.fragment_out(0, Type::VEC4, "hitData")
|
||||
.fragment_out(1, Type::FLOAT, "hitDepth")
|
||||
.fragment_source("effect_reflection_trace_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_reflection_resolve_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_reflection_resolve)
|
||||
.additional_info("eevee_legacy_surface_lib_step_resolve")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_raytrace_lib")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_reflection_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_glossy_lib")
|
||||
.additional_info("draw_fullscreen")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "normalBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "specroughBuffer")
|
||||
.sampler(3, ImageType::FLOAT_2D, "hitBuffer")
|
||||
.sampler(4, ImageType::FLOAT_2D, "hitDepth")
|
||||
.push_constant(Type::INT, "samplePoolOffset")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.fragment_source("effect_reflection_resolve_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_subsurface_first_pass_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_shader_effect_subsurface_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.fragment_out(0, Type::VEC4, "sssRadiance")
|
||||
.fragment_source("effect_subsurface_frag.glsl")
|
||||
.uniform_buf(0, "SSSProfileBlock", "sssProfile", Frequency::PASS)
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "sssIrradiance")
|
||||
.sampler(2, ImageType::FLOAT_2D, "sssRadius")
|
||||
.sampler(3, ImageType::FLOAT_2D, "sssAlbedo")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_shader_effect_subsurface_common_FIRST_PASS)
|
||||
.define("FIRST_PASS")
|
||||
.additional_info("eevee_legacy_shader_effect_subsurface_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_shader_effect_subsurface_common_SECOND_PASS)
|
||||
.define("SECOND_PASS")
|
||||
.additional_info("eevee_legacy_shader_effect_subsurface_common")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_subsurface_translucency_sh_get */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_shader_effect_subsurface_translucency)
|
||||
.define("EEVEE_TRANSLUCENCY")
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.fragment_source("effect_translucency_frag.glsl")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(1, ImageType::FLOAT_1D, "sssTexProfile")
|
||||
.sampler(1, ImageType::FLOAT_2D, "sssRadius")
|
||||
.sampler(1, ImageType::FLOAT_2D_ARRAY, "sssShadowCubes")
|
||||
.sampler(1, ImageType::FLOAT_2D_ARRAY, "sssShadowCascades")
|
||||
.uniform_buf(0, "SSSProfileBlock", "sssProfile", Frequency::PASS)
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_renderpasses_post_process_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_post_process)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.fragment_source("renderpass_postprocess_frag.glsl")
|
||||
.push_constant(Type::INT, "postProcessType")
|
||||
.push_constant(Type::INT, "currentSample")
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "inputBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "inputSecondLightBuffer")
|
||||
.sampler(3, ImageType::FLOAT_2D, "inputColorBuffer")
|
||||
.sampler(4, ImageType::FLOAT_2D, "inputTransmittanceBuffer")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_mist_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_mist_FIRST_PASS)
|
||||
.define("FIRST_PASS")
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.fragment_source("effect_mist_frag.glsl")
|
||||
.push_constant(Type::VEC3, "mistSettings")
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_ggx_lut_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ggx_lut_bsdf)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.fragment_source("bsdf_lut_frag.glsl")
|
||||
.push_constant(Type::FLOAT, "sampleCount")
|
||||
.fragment_out(0, Type::VEC2, "FragColor")
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_ggx_lut_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_ggx_lut_btdf)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.fragment_source("btdf_lut_frag.glsl")
|
||||
.push_constant(Type::FLOAT, "sampleCount")
|
||||
.push_constant(Type::FLOAT, "z_factor")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* Cryptomatte */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_cryptomatte_common)
|
||||
.additional_info("eevee_legacy_closure_type_lib")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_cryptomatte_lib")
|
||||
.push_constant(Type::VEC4, "cryptohash")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("cryptomatte_vert.glsl")
|
||||
.fragment_source("cryptomatte_frag.glsl");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_cryptomatte_hair)
|
||||
.define("HAIR_SHADER")
|
||||
.define("NO_ATTRIB_LOAD")
|
||||
.additional_info("eevee_legacy_cryptomatte_common")
|
||||
.additional_info("eevee_legacy_mateiral_surface_vert_hair")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_cryptomatte_mesh)
|
||||
.define("MESH_SHADER")
|
||||
.define("NO_ATTRIB_LOAD")
|
||||
.additional_info("eevee_legacy_cryptomatte_common")
|
||||
.additional_info("eevee_legacy_material_surface_vert")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
|
@ -0,0 +1,290 @@
|
|||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* EEVEE_shaders_probe_filter_glossy_sh_get */
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_lightprobe_vert_geom_iface, "vert_iface")
|
||||
.smooth(Type::VEC4, "vPos")
|
||||
.flat(Type::INT, "face");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_lightprobe_geom_frag_iface, "geom_iface")
|
||||
.smooth(Type::VEC3, "worldPosition")
|
||||
.smooth(Type::VEC3, "viewPosition")
|
||||
.smooth(Type::VEC3, "worldNormal")
|
||||
.smooth(Type::VEC3, "viewNormal")
|
||||
.flat(Type::INT, "fFace");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_vert)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_source("lightprobe_vert.glsl")
|
||||
.vertex_out(eevee_legacy_lightprobe_vert_geom_iface)
|
||||
.builtins(BuiltinBits::INSTANCE_ID);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_vert_no_geom)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.push_constant(Type::INT, "Layer")
|
||||
.vertex_source("lightprobe_vert_no_geom.glsl")
|
||||
.vertex_out(eevee_legacy_lightprobe_geom_frag_iface)
|
||||
.builtins(BuiltinBits::INSTANCE_ID);
|
||||
#endif
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_geom)
|
||||
.geometry_source("lightprobe_geom.glsl")
|
||||
.geometry_out(eevee_legacy_lightprobe_geom_frag_iface)
|
||||
.push_constant(Type::INT, "Layer")
|
||||
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_filter_glossy_no_geom)
|
||||
.additional_info("eevee_legacy_lightprobe_vert_no_geom")
|
||||
.fragment_source("lightprobe_filter_glossy_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_CUBE, "probeHdr")
|
||||
.push_constant(Type::FLOAT, "probe_roughness")
|
||||
.push_constant(Type::FLOAT, "texelSize")
|
||||
.push_constant(Type::FLOAT, "lodFactor")
|
||||
.push_constant(Type::FLOAT, "lodMax")
|
||||
.push_constant(Type::FLOAT, "paddingSize")
|
||||
.push_constant(Type::FLOAT, "intensityFac")
|
||||
.push_constant(Type::FLOAT, "fireflyFactor")
|
||||
.push_constant(Type::FLOAT, "sampleCount")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_filter_glossy)
|
||||
.additional_info("eevee_legacy_lightprobe_vert")
|
||||
.additional_info("eevee_legacy_lightprobe_geom")
|
||||
.fragment_source("lightprobe_filter_glossy_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_CUBE, "probeHdr")
|
||||
.push_constant(Type::FLOAT, "probe_roughness")
|
||||
.push_constant(Type::FLOAT, "texelSize")
|
||||
.push_constant(Type::FLOAT, "lodFactor")
|
||||
.push_constant(Type::FLOAT, "lodMax")
|
||||
.push_constant(Type::FLOAT, "paddingSize")
|
||||
.push_constant(Type::FLOAT, "intensityFac")
|
||||
.push_constant(Type::FLOAT, "fireflyFactor")
|
||||
.push_constant(Type::FLOAT, "sampleCount")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_effect_downsample_cube_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_downsample_cube)
|
||||
.additional_info("eevee_legacy_lightprobe_vert")
|
||||
.additional_info("eevee_legacy_lightprobe_geom")
|
||||
.fragment_source("effect_downsample_cube_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_CUBE, "source")
|
||||
.push_constant(Type::FLOAT, "texelSize")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_downsample_cube_no_geom)
|
||||
.additional_info("eevee_legacy_lightprobe_vert_no_geom")
|
||||
.fragment_source("effect_downsample_cube_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_CUBE, "source")
|
||||
.push_constant(Type::FLOAT, "texelSize")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
/* EEVEE_shaders_probe_filter_diffuse_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_filter_diffuse)
|
||||
.additional_info("eevee_legacy_irradiance_lib")
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("lightprobe_filter_diffuse_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_CUBE, "probeHdr")
|
||||
.push_constant(Type::INT, "probeSize")
|
||||
.push_constant(Type::FLOAT, "lodFactor")
|
||||
.push_constant(Type::FLOAT, "lodMax")
|
||||
.push_constant(Type::FLOAT, "intensityFac")
|
||||
.push_constant(Type::FLOAT, "sampleCount")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_filter_diffuse_sh_l2)
|
||||
.define("IRRADIANCE_SH_L2")
|
||||
.additional_info("eevee_legacy_probe_filter_diffuse")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_filter_diffuse_hl2)
|
||||
.define("IRRADIANCE_HL2")
|
||||
.additional_info("eevee_legacy_probe_filter_diffuse")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_probe_filter_visibility_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_filter_visiblity)
|
||||
.define("IRRADIANCE_HL2")
|
||||
.additional_info("eevee_legacy_irradiance_lib")
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("lightprobe_filter_visibility_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_CUBE, "probeDepth")
|
||||
.push_constant(Type::INT, "outputSize")
|
||||
.push_constant(Type::FLOAT, "lodFactor")
|
||||
.push_constant(Type::FLOAT, "storedTexelSize")
|
||||
.push_constant(Type::FLOAT, "lodMax")
|
||||
.push_constant(Type::FLOAT, "nearClip")
|
||||
.push_constant(Type::FLOAT, "farClip")
|
||||
.push_constant(Type::FLOAT, "visibilityRange")
|
||||
.push_constant(Type::FLOAT, "visibilityBlur")
|
||||
.push_constant(Type::FLOAT, "sampleCount")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_probe_grid_fill_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_grid_fill)
|
||||
.additional_info("draw_fullscreen")
|
||||
.fragment_source("lightprobe_grid_fill_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D_ARRAY, "irradianceGrid")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_grid_fill_sh_l2)
|
||||
.define("IRRADIANCE_SH_L2")
|
||||
.additional_info("eevee_legacy_probe_grid_fill")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_grid_fill_hl2)
|
||||
.define("IRRADIANCE_HL2")
|
||||
.additional_info("eevee_legacy_probe_grid_fill")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_probe_planar_display_sh_get */
|
||||
GPU_SHADER_INTERFACE_INFO(legacy_probe_planar_iface, "")
|
||||
.smooth(Type::VEC3, "worldPosition")
|
||||
.flat(Type::INT, "probeIdx");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_probe_planar_display)
|
||||
.sampler(0, ImageType::FLOAT_2D_ARRAY, "probePlanars")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::INT, "probe_id")
|
||||
.vertex_in(2, Type::MAT4, "probe_mat")
|
||||
.vertex_out(legacy_probe_planar_iface)
|
||||
.vertex_source("lightprobe_planar_display_vert.glsl")
|
||||
.fragment_source("lightprobe_planar_display_frag.glsl")
|
||||
.additional_info("draw_view")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_studiolight_probe_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_studiolight_probe)
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.additional_info("eevee_legacy_surface_lib_lookdev")
|
||||
.vertex_in(0, Type::VEC2, "pos")
|
||||
.sampler(0, ImageType::FLOAT_2D, "studioLight")
|
||||
.push_constant(Type::FLOAT, "backgroundAlpha")
|
||||
.push_constant(Type::MAT3, "StudioLightMatrix")
|
||||
.push_constant(Type::FLOAT, "studioLightIntensity")
|
||||
.push_constant(Type::FLOAT, "studioLightBlur")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.vertex_source("background_vert.glsl")
|
||||
.fragment_source("lookdev_world_frag.glsl")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_studiolight_background_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_studiolight_background)
|
||||
.define("LOOKDEV_BG")
|
||||
.additional_info("eevee_legacy_studiolight_probe")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_probe_planar_downsample_sh_get */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_probe_planar_downsample_vert_geom_iface,
|
||||
"lightprobe_vert_iface")
|
||||
.flat(Type::INT, "instance")
|
||||
.smooth(Type::VEC2, "vPos");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_probe_planar_downsample_geom_frag_iface,
|
||||
"lightprobe_geom_iface")
|
||||
.flat(Type::FLOAT, "layer");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_planar_downsample_common)
|
||||
.vertex_source("lightprobe_planar_downsample_vert.glsl")
|
||||
.fragment_source("lightprobe_planar_downsample_frag.glsl")
|
||||
.vertex_out(eevee_legacy_probe_planar_downsample_vert_geom_iface)
|
||||
.sampler(0, ImageType::FLOAT_2D_ARRAY, "source")
|
||||
.push_constant(Type::FLOAT, "fireflyFactor")
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_planar_downsample)
|
||||
.additional_info("eevee_legacy_lightprobe_planar_downsample_common")
|
||||
.geometry_source("lightprobe_planar_downsample_geom.glsl")
|
||||
.geometry_out(eevee_legacy_probe_planar_downsample_geom_frag_iface)
|
||||
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3)
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_planar_downsample_no_geom)
|
||||
.additional_info("eevee_legacy_lightprobe_planar_downsample_common")
|
||||
.vertex_out(eevee_legacy_probe_planar_downsample_geom_frag_iface)
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
/* EEVEE_shaders_probe_cube_display_sh_get */
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_lightprobe_cube_display_iface, "")
|
||||
.flat(Type::INT, "pid")
|
||||
.smooth(Type::VEC2, "quadCoord");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_cube_display)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_lightprobe_lib")
|
||||
.vertex_source("lightprobe_cube_display_vert.glsl")
|
||||
.fragment_source("lightprobe_cube_display_frag.glsl")
|
||||
.vertex_out(eevee_legacy_lightprobe_cube_display_iface)
|
||||
.push_constant(Type::FLOAT, "sphere_size")
|
||||
.push_constant(Type::VEC3, "screen_vecs", 2)
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_probe_grid_display_sh_get */
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_lightprobe_grid_display_iface, "")
|
||||
.flat(Type::INT, "cellOffset")
|
||||
.smooth(Type::VEC2, "quadCoord");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_grid_display_common)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_irradiance_lib")
|
||||
.vertex_source("lightprobe_grid_display_vert.glsl")
|
||||
.fragment_source("lightprobe_grid_display_frag.glsl")
|
||||
.vertex_out(eevee_legacy_lightprobe_grid_display_iface)
|
||||
.push_constant(Type::FLOAT, "sphere_size")
|
||||
.push_constant(Type::INT, "offset")
|
||||
.push_constant(Type::IVEC3, "grid_resolution")
|
||||
.push_constant(Type::VEC3, "corner")
|
||||
.push_constant(Type::VEC3, "increment_x")
|
||||
.push_constant(Type::VEC3, "increment_y")
|
||||
.push_constant(Type::VEC3, "increment_z")
|
||||
.push_constant(Type::VEC3, "screen_vecs", 2)
|
||||
.fragment_out(0, Type::VEC4, "FragColor")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_grid_display_common_sh_l2)
|
||||
.define("IRRADIANCE_SH_L2")
|
||||
.additional_info("eevee_legacy_lightprobe_grid_display_common")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_lightprobe_grid_display_common_hl2)
|
||||
.define("IRRADIANCE_HL2")
|
||||
.additional_info("eevee_legacy_lightprobe_grid_display_common")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
|
@ -0,0 +1,185 @@
|
|||
#include "eevee_legacy_volume_info.hh"
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* For EEVEE Materials prepared in `eevee_shader_material_create_info_amend`,
|
||||
* differing permutations are generated based on material options.
|
||||
*
|
||||
* Sources, e.g.
|
||||
* -> datatoc_volumetric_vert_glsl
|
||||
* -> datatoc_world_vert_glsl
|
||||
* -> datatoc_surface_vert_glsl
|
||||
*
|
||||
* Are not included in the create-infos, but should have a corresponding
|
||||
* Create info block, which defines bindings and other library requirements.
|
||||
*/
|
||||
|
||||
/*** EMPTY EEVEE STUB COMMON INCLUDES following 'eevee_empty.glsl' and
|
||||
* 'eevee_empty_volume.glsl'****/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_empty_base)
|
||||
.additional_info("eevee_legacy_closure_type_lib")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_modelmat")
|
||||
.additional_info("draw_view");
|
||||
|
||||
/* Volumetrics skips uniform bindings in `closure_type_lib`. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_empty_base_volume)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_modelmat")
|
||||
.additional_info("draw_view");
|
||||
|
||||
/**** MATERIAL VERTEX SHADER PERMUTATIONS ****/
|
||||
|
||||
/** -- Volumetric -- **/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_volumetric_vert)
|
||||
.additional_info("eevee_legacy_material_empty_base_volume")
|
||||
.vertex_out(legacy_volume_vert_geom_iface)
|
||||
.additional_info("draw_resource_id_varying");
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_volumetric_vert_no_geom)
|
||||
.additional_info("eevee_legacy_material_empty_base_volume")
|
||||
.vertex_out(legacy_volume_vert_geom_iface)
|
||||
.vertex_out(legacy_volume_geom_frag_iface)
|
||||
.additional_info("draw_resource_id_varying");
|
||||
#endif
|
||||
|
||||
/** -- World Shader -- **/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_world_vert)
|
||||
.additional_info("eevee_legacy_material_empty_base")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_surface_lib")
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.vertex_in(0, Type::VEC2, "pos");
|
||||
|
||||
/** -- Surface Shader -- **/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_surface_vert_common)
|
||||
.additional_info("eevee_legacy_material_empty_base")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_surface_lib");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_surface_vert)
|
||||
.additional_info("eevee_legacy_material_surface_vert_common")
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::VEC3, "nor");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_mateiral_surface_vert_hair)
|
||||
.additional_info("eevee_legacy_material_surface_vert_common")
|
||||
.additional_info("eevee_legacy_surface_lib_hair")
|
||||
.additional_info("eevee_legacy_hair_lib");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_mateiral_surface_vert_pointcloud)
|
||||
.additional_info("draw_pointcloud")
|
||||
.additional_info("eevee_legacy_material_surface_vert_common")
|
||||
.additional_info("eevee_legacy_surface_lib_pointcloud")
|
||||
.auto_resource_location(true);
|
||||
|
||||
/**** MATERIAL GEOMETRY SHADER PERMUTATIONS ****/
|
||||
/** -- Volumetric -- **/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_volumetric_geom)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.geometry_out(legacy_volume_geom_frag_iface)
|
||||
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3)
|
||||
.additional_info("draw_resource_id_varying");
|
||||
|
||||
/**** MATERIAL FRAGMENT SHADER PERMUTATIONS ****/
|
||||
|
||||
/** -- Volumetric Shader -- **/
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_volumetric_frag)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.fragment_out(0, Type::VEC4, "volumeScattering")
|
||||
.fragment_out(1, Type::VEC4, "volumeExtinction")
|
||||
.fragment_out(2, Type::VEC4, "volumeEmissive")
|
||||
.fragment_out(3, Type::VEC4, "volumePhase");
|
||||
|
||||
/** -- Prepass Shader -- **/
|
||||
|
||||
/* Common info for all `prepass_frag` variants. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_common)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_closure_eval_surface_lib");
|
||||
|
||||
/* Common info for all `prepass_frag_opaque` variants. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_opaque_common)
|
||||
.additional_info("eevee_legacy_material_prepass_frag_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_opaque)
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.additional_info("eevee_legacy_material_prepass_frag_opaque_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_opaque_hair)
|
||||
.additional_info("eevee_legacy_surface_lib_hair")
|
||||
.additional_info("eevee_legacy_material_prepass_frag_opaque_common")
|
||||
.additional_info("draw_hair");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_opaque_pointcloud)
|
||||
.additional_info("eevee_legacy_material_prepass_frag_opaque_common")
|
||||
.additional_info("draw_pointcloud");
|
||||
|
||||
/* Common info for all `prepass_frag_alpha_hash` variants. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_alpha_hash_common)
|
||||
.define("USE_ALPHA_HASH")
|
||||
.additional_info("eevee_legacy_material_prepass_frag_common")
|
||||
.push_constant(Type::FLOAT, "alphaClipThreshold");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_alpha_hash)
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.additional_info("eevee_legacy_material_prepass_frag_alpha_hash_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_alpha_hash_hair)
|
||||
.additional_info("eevee_legacy_surface_lib_hair")
|
||||
.additional_info("eevee_legacy_material_prepass_frag_alpha_hash_common")
|
||||
.additional_info("draw_hair");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_alpha_hash_pointcloud)
|
||||
.additional_info("eevee_legacy_surface_lib_pointcloud")
|
||||
.additional_info("eevee_legacy_material_prepass_frag_alpha_hash_common")
|
||||
.additional_info("draw_pointcloud");
|
||||
|
||||
/** -- Surface Shader -- **/
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_surface_frag_common)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_surface_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.push_constant(Type::FLOAT, "backgroundAlpha");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_surface_frag_opaque)
|
||||
.additional_info("eevee_legacy_material_surface_frag_common")
|
||||
.fragment_out(0, Type::VEC4, "outRadiance")
|
||||
.fragment_out(1, Type::VEC2, "ssrNormals")
|
||||
.fragment_out(2, Type::VEC4, "ssrData")
|
||||
.fragment_out(3, Type::VEC3, "sssIrradiance")
|
||||
.fragment_out(4, Type::FLOAT, "sssRadius")
|
||||
.fragment_out(5, Type::VEC3, "sssAlbedo");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_material_surface_frag_alpha_blend)
|
||||
.define("USE_ALPHA_BLEND")
|
||||
.additional_info("eevee_legacy_material_surface_frag_common")
|
||||
.fragment_out(0, Type::VEC4, "outRadiance", DualBlend::SRC_0)
|
||||
.fragment_out(0, Type::VEC4, "outTransmittance", DualBlend::SRC_1);
|
||||
|
||||
/* hair_refine_shader_transform_feedback_create */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(legacy_hair_refine_shader_transform_feedback_iface, "")
|
||||
.smooth(Type::VEC4, "finalColor");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(legacy_hair_refine_shader_transform_feedback)
|
||||
.define("HAIR_PHASE_SUBDIV")
|
||||
.define("USE_TF")
|
||||
.additional_info("eevee_legacy_hair_lib")
|
||||
.vertex_source("common_hair_refine_vert.glsl")
|
||||
.vertex_out(legacy_hair_refine_shader_transform_feedback_iface)
|
||||
.transform_feedback_mode(GPU_SHADER_TFB_POINTS)
|
||||
.transform_feedback_output_name("finalColor")
|
||||
.do_static_compilation(true);
|
|
@ -0,0 +1,87 @@
|
|||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* EEVEE_shaders_effect_motion_blur_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.fragment_source("effect_motion_blur_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
|
||||
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.sampler(2, ImageType::FLOAT_2D, "velocityBuffer")
|
||||
.sampler(3, ImageType::FLOAT_2D, "tileMaxBuffer")
|
||||
.push_constant(Type::FLOAT, "depthScale")
|
||||
.push_constant(Type::IVEC2, "tileBufferSize")
|
||||
.push_constant(Type::VEC2, "viewportSize")
|
||||
.push_constant(Type::VEC2, "viewportSizeInv")
|
||||
.push_constant(Type::BOOL, "isPerspective")
|
||||
.push_constant(Type::VEC2, "nearFar")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_effect_motion_blur_object_sh_get */
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_legacy_motion_object_iface, "")
|
||||
.smooth(Type::VEC3, "currWorldPos")
|
||||
.smooth(Type::VEC3, "prevWorldPos")
|
||||
.smooth(Type::VEC3, "nextWorldPos");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur_object_common)
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.vertex_source("object_motion_vert.glsl")
|
||||
.fragment_source("object_motion_frag.glsl")
|
||||
.vertex_out(eevee_legacy_motion_object_iface)
|
||||
.fragment_out(0, Type::VEC4, "outData")
|
||||
.push_constant(Type::MAT4, "currModelMatrix")
|
||||
.push_constant(Type::MAT4, "prevModelMatrix")
|
||||
.push_constant(Type::MAT4, "nextModelMatrix")
|
||||
.push_constant(Type::MAT4, "prevViewProjMatrix")
|
||||
.push_constant(Type::MAT4, "currViewProjMatrix")
|
||||
.push_constant(Type::MAT4, "nextViewProjMatrix")
|
||||
.push_constant(Type::BOOL, "useDeform");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur_object_hair)
|
||||
.define("HAIR")
|
||||
.define("HAIR_SHADER")
|
||||
.additional_info("eevee_legacy_hair_lib")
|
||||
.additional_info("eevee_legacy_effect_motion_blur_object_common")
|
||||
.sampler(0, ImageType::FLOAT_BUFFER, "prvBuffer")
|
||||
.sampler(1, ImageType::FLOAT_BUFFER, "nxtBuffer")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur_object)
|
||||
.additional_info("eevee_legacy_effect_motion_blur_object_common")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::VEC3, "prv")
|
||||
.vertex_in(2, Type::VEC3, "nxt")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
/* EEVEE_shaders_effect_motion_blur_velocity_tiles_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur_velocity_tiles_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_defines_info")
|
||||
.fragment_source("effect_velocity_tile_frag.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "velocityBuffer")
|
||||
.push_constant(Type::VEC2, "viewportSize")
|
||||
.push_constant(Type::VEC2, "viewportSizeInv")
|
||||
.push_constant(Type::IVEC2, "velocityBufferSize")
|
||||
.fragment_out(0, Type::VEC4, "tileMaxVelocity")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur_velocity_tiles_GATHER)
|
||||
.define("TILE_GATHER")
|
||||
.additional_info("eevee_legacy_effect_motion_blur_velocity_tiles_common")
|
||||
.push_constant(Type::IVEC2, "gatherStep")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_motion_blur_velocity_tiles_EXPANSION)
|
||||
.define("TILE_EXPANSION")
|
||||
.additional_info("eevee_legacy_effect_motion_blur_velocity_tiles_common")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* EEVEE_shaders_shadow_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_shader_shadow)
|
||||
.additional_info("draw_view")
|
||||
.additional_info("draw_modelmat")
|
||||
.additional_info("draw_curves_infos")
|
||||
.additional_info("eevee_legacy_hair_lib")
|
||||
.additional_info("eevee_legacy_surface_lib_common")
|
||||
.additional_info("eevee_legacy_surface_lib_hair")
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::VEC3, "nor")
|
||||
.vertex_source("shadow_vert.glsl")
|
||||
.fragment_source("shadow_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_shadow_accum_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_shader_shadow_accum)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("eevee_legacy_common_utiltex_lib")
|
||||
.additional_info("eevee_legacy_lights_lib")
|
||||
.fragment_source("shadow_accum_frag.glsl")
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
|
@ -0,0 +1,215 @@
|
|||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Voluemtric iface. */
|
||||
GPU_SHADER_INTERFACE_INFO(legacy_volume_vert_geom_iface, "volumetric_vert_iface")
|
||||
.smooth(Type::VEC4, "vPos");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(legacy_volume_geom_frag_iface, "volumetric_geom_iface")
|
||||
.flat(Type::INT, "slice");
|
||||
|
||||
/* EEVEE_shaders_volumes_clear_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_clear)
|
||||
.define("STANDALONE")
|
||||
.define("VOLUMETRICS")
|
||||
.define("CLEAR")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.vertex_source("volumetric_vert.glsl")
|
||||
.geometry_source("volumetric_geom.glsl")
|
||||
.fragment_source("volumetric_frag.glsl")
|
||||
.vertex_out(legacy_volume_vert_geom_iface)
|
||||
.geometry_out(legacy_volume_geom_frag_iface)
|
||||
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3)
|
||||
.fragment_out(0, Type::VEC4, "volumeScattering")
|
||||
.fragment_out(1, Type::VEC4, "volumeExtinction")
|
||||
.fragment_out(2, Type::VEC4, "volumeEmissive")
|
||||
.fragment_out(3, Type::VEC4, "volumePhase")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
/* Non-geometry shader equivalent for multilayered rendering.
|
||||
* NOTE: Layer selection can be done in vertex shader, and thus
|
||||
* vertex shader emits both vertex and geometry shader output
|
||||
* interfaces. */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_clear_no_geom)
|
||||
.define("STANDALONE")
|
||||
.define("VOLUMETRICS")
|
||||
.define("CLEAR")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.vertex_source("volumetric_vert.glsl")
|
||||
.fragment_source("volumetric_frag.glsl")
|
||||
.vertex_out(legacy_volume_vert_geom_iface)
|
||||
.vertex_out(legacy_volume_geom_frag_iface)
|
||||
.fragment_out(0, Type::VEC4, "volumeScattering")
|
||||
.fragment_out(1, Type::VEC4, "volumeExtinction")
|
||||
.fragment_out(2, Type::VEC4, "volumeEmissive")
|
||||
.fragment_out(3, Type::VEC4, "volumePhase")
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
/* EEVEE_shaders_volumes_scatter_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_scatter_common)
|
||||
.define("STANDALONE")
|
||||
.define("VOLUMETRICS")
|
||||
.define("VOLUME_SHADOW")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
/* NOTE: Unique sampler IDs assigned for consistency between library includes,
|
||||
* and to avoid unique assignment collision validation error.
|
||||
* However, resources will be auto assigned locations within shader usage. */
|
||||
.sampler(15, ImageType::FLOAT_3D, "volumeScattering")
|
||||
.sampler(16, ImageType::FLOAT_3D, "volumeExtinction")
|
||||
.sampler(17, ImageType::FLOAT_3D, "volumeEmission")
|
||||
.sampler(18, ImageType::FLOAT_3D, "volumePhase")
|
||||
.sampler(19, ImageType::FLOAT_3D, "historyScattering")
|
||||
.sampler(20, ImageType::FLOAT_3D, "historyTransmittance")
|
||||
|
||||
.fragment_out(0, Type::VEC4, "outScattering")
|
||||
.fragment_out(1, Type::VEC4, "outTransmittance")
|
||||
.vertex_source("volumetric_vert.glsl")
|
||||
.fragment_source("volumetric_scatter_frag.glsl")
|
||||
.vertex_out(legacy_volume_vert_geom_iface);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_scatter)
|
||||
.additional_info("eevee_legacy_volumes_scatter_common")
|
||||
.geometry_source("volumetric_geom.glsl")
|
||||
.geometry_out(legacy_volume_geom_frag_iface)
|
||||
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3)
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_scatter_no_geom)
|
||||
.additional_info("eevee_legacy_volumes_scatter_common")
|
||||
.vertex_out(legacy_volume_geom_frag_iface)
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
/* EEVEE_shaders_volumes_scatter_with_lights_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_scatter_with_lights_common).define("VOLUME_LIGHTING");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_scatter_with_lights)
|
||||
.additional_info("eevee_legacy_volumes_scatter_with_lights_common")
|
||||
.additional_info("eevee_legacy_volumes_scatter")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_scatter_with_lights_no_geom)
|
||||
.additional_info("eevee_legacy_volumes_scatter_with_lights_common")
|
||||
.additional_info("eevee_legacy_volumes_scatter_no_geom")
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
/* EEVEE_shaders_volumes_integration_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_common)
|
||||
.define("STANDALONE")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.additional_info("draw_resource_id_varying")
|
||||
/* NOTE: Unique sampler IDs assigned for consistency between library includes,
|
||||
* and to avoid unique assignment collision validation error.
|
||||
* However, resources will be auto assigned locations within shader usage. */
|
||||
.sampler(20, ImageType::FLOAT_3D, "volumeScattering")
|
||||
.sampler(21, ImageType::FLOAT_3D, "volumeExtinction")
|
||||
.vertex_out(legacy_volume_vert_geom_iface)
|
||||
.vertex_source("volumetric_vert.glsl")
|
||||
.fragment_source("volumetric_integration_frag.glsl");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_common_opti)
|
||||
.define("USE_VOLUME_OPTI")
|
||||
.image(0, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "finalScattering_img")
|
||||
.image(1, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "finalTransmittance_img");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_common_no_opti)
|
||||
.fragment_out(0, Type::VEC3, "finalScattering")
|
||||
.fragment_out(1, Type::VEC3, "finalTransmittance");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_common_geom)
|
||||
.additional_info("eevee_legacy_volumes_integration_common")
|
||||
.geometry_source("volumetric_geom.glsl")
|
||||
.geometry_out(legacy_volume_geom_frag_iface)
|
||||
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_common_no_geom)
|
||||
.additional_info("eevee_legacy_volumes_integration_common")
|
||||
.vertex_out(legacy_volume_geom_frag_iface);
|
||||
#endif
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration)
|
||||
.additional_info("eevee_legacy_volumes_integration_common_geom")
|
||||
.additional_info("eevee_legacy_volumes_integration_common_no_opti")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_OPTI)
|
||||
.additional_info("eevee_legacy_volumes_integration_common_geom")
|
||||
.additional_info("eevee_legacy_volumes_integration_common_opti")
|
||||
.do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_no_geom)
|
||||
.additional_info("eevee_legacy_volumes_integration_common_no_geom")
|
||||
.additional_info("eevee_legacy_volumes_integration_common_no_opti")
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_integration_OPTI_no_geom)
|
||||
.additional_info("eevee_legacy_volumes_integration_common_no_geom")
|
||||
.additional_info("eevee_legacy_volumes_integration_common_opti")
|
||||
// .do_static_compilation(true)
|
||||
.auto_resource_location(true);
|
||||
#endif
|
||||
|
||||
/* EEVEE_shaders_volumes_resolve_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_resolve_common)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.sampler(0, ImageType::DEPTH_2D, "inSceneDepth")
|
||||
.fragment_source("volumetric_resolve_frag.glsl")
|
||||
.auto_resource_location(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_resolve)
|
||||
.additional_info("eevee_legacy_volumes_resolve_common")
|
||||
.fragment_out(0, Type::VEC4, "FragColor0", DualBlend::SRC_0)
|
||||
.fragment_out(0, Type::VEC4, "FragColor1", DualBlend::SRC_1)
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_resolve_accum)
|
||||
.define("VOLUMETRICS_ACCUM")
|
||||
.additional_info("eevee_legacy_volumes_resolve_common")
|
||||
.fragment_out(0, Type::VEC4, "FragColor0")
|
||||
.fragment_out(1, Type::VEC4, "FragColor1")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* EEVEE_shaders_volumes_accum_sh_get */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_volumes_accum)
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("eevee_legacy_common_lib")
|
||||
.additional_info("draw_view")
|
||||
.additional_info("eevee_legacy_volumetric_lib")
|
||||
.fragment_out(0, Type::VEC4, "FragColor0")
|
||||
.fragment_out(1, Type::VEC4, "FragColor1")
|
||||
.fragment_source("volumetric_accum_frag.glsl")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
|
@ -0,0 +1,261 @@
|
|||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
*/
|
||||
#ifndef EEVEE_SHADER_SHARED_H
|
||||
#define EEVEE_SHADER_SHARED_H
|
||||
#ifndef GPU_SHADER
|
||||
typedef struct CommonUniformBlock CommonUniformBlock;
|
||||
#endif
|
||||
|
||||
#ifdef GPU_SHADER
|
||||
/* Catch for non-create info cass. */
|
||||
# ifndef BLI_STATIC_ASSERT_ALIGN
|
||||
# define BLI_STATIC_ASSERT_ALIGN(type, alignment)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct CommonUniformBlock {
|
||||
mat4 pastViewProjectionMatrix;
|
||||
vec4 hizUvScale; /* To correct mip level texel misalignment */
|
||||
/* Ambient Occlusion */
|
||||
vec4 aoParameters[2];
|
||||
/* Volumetric */
|
||||
ivec4 volTexSize;
|
||||
vec4 volDepthParameters; /* Parameters to the volume Z equation */
|
||||
vec4 volInvTexSize;
|
||||
vec4 volJitter;
|
||||
vec4 volCoordScale; /* To convert volume uvs to screen uvs */
|
||||
float volHistoryAlpha;
|
||||
float volShadowSteps;
|
||||
bool volUseLights;
|
||||
bool volUseSoftShadows;
|
||||
/* Screen Space Reflections */
|
||||
vec4 ssrParameters;
|
||||
float ssrBorderFac;
|
||||
float ssrMaxRoughness;
|
||||
float ssrFireflyFac;
|
||||
float ssrBrdfBias;
|
||||
bool ssrToggle;
|
||||
bool ssrefractToggle;
|
||||
/* SubSurface Scattering */
|
||||
float sssJitterThreshold;
|
||||
bool sssToggle;
|
||||
/* Specular */
|
||||
bool specToggle;
|
||||
/* Lights */
|
||||
int laNumLight;
|
||||
/* Probes */
|
||||
int prbNumPlanar;
|
||||
int prbNumRenderCube;
|
||||
int prbNumRenderGrid;
|
||||
int prbIrradianceVisSize;
|
||||
float prbIrradianceSmooth;
|
||||
float prbLodCubeMax;
|
||||
/* Misc */
|
||||
int rayType;
|
||||
float rayDepth;
|
||||
float alphaHashOffset;
|
||||
float alphaHashScale;
|
||||
vec4 cameraUvScaleBias;
|
||||
vec4 planarClipPlane;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(CommonUniformBlock, 16)
|
||||
|
||||
struct CubeData {
|
||||
vec4 position_type;
|
||||
vec4 attenuation_fac_type;
|
||||
mat4 influencemat;
|
||||
mat4 parallaxmat;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(CubeData, 16)
|
||||
|
||||
struct PlanarData {
|
||||
vec4 plane_equation;
|
||||
vec4 clip_vec_x_fade_scale;
|
||||
vec4 clip_vec_y_fade_bias;
|
||||
vec4 clip_edges;
|
||||
vec4 facing_scale_bias;
|
||||
mat4 reflectionmat; /* transform world space into reflection texture space */
|
||||
mat4 unused;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(PlanarData, 16)
|
||||
|
||||
struct GridData {
|
||||
mat4 localmat;
|
||||
ivec4 resolution_offset;
|
||||
vec4 ws_corner_atten_scale; /* world space corner position */
|
||||
vec4 ws_increment_x_atten_bias; /* world space vector between 2 opposite cells */
|
||||
vec4 ws_increment_y_lvl_bias;
|
||||
vec4 ws_increment_z;
|
||||
vec4 vis_bias_bleed_range;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(GridData, 16)
|
||||
|
||||
struct ProbeBlock {
|
||||
CubeData probes_data[MAX_PROBE];
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ProbeBlock, 16)
|
||||
|
||||
struct GridBlock {
|
||||
GridData grids_data[MAX_GRID];
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(GridBlock, 16)
|
||||
|
||||
struct PlanarBlock {
|
||||
PlanarData planars_data[MAX_PLANAR];
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(PlanarBlock, 16)
|
||||
|
||||
#ifndef MAX_CASCADE_NUM
|
||||
# define MAX_CASCADE_NUM 4
|
||||
#endif
|
||||
|
||||
struct ShadowData {
|
||||
vec4 near_far_bias_id;
|
||||
vec4 contact_shadow_data;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ShadowData, 16)
|
||||
|
||||
struct ShadowCubeData {
|
||||
mat4 shadowmat;
|
||||
vec4 position;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ShadowCubeData, 16)
|
||||
|
||||
struct ShadowCascadeData {
|
||||
mat4 shadowmat[MAX_CASCADE_NUM];
|
||||
vec4 split_start_distances;
|
||||
vec4 split_end_distances;
|
||||
vec4 shadow_vec_id;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ShadowCascadeData, 16)
|
||||
|
||||
struct ShadowBlock {
|
||||
ShadowData shadows_data[MAX_SHADOW];
|
||||
ShadowCubeData shadows_cube_data[MAX_SHADOW_CUBE];
|
||||
ShadowCascadeData shadows_cascade_data[MAX_SHADOW_CASCADE];
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ShadowBlock, 16)
|
||||
|
||||
struct LightData {
|
||||
vec4 position_influence; /* w : InfluenceRadius (inversed and squared) */
|
||||
vec4 color_influence_volume; /* w : InfluenceRadius but for Volume power */
|
||||
vec4 spotdata_radius_shadow; /* x : spot size, y : spot blend, z : radius, w: shadow id */
|
||||
vec4 rightvec_sizex; /* xyz: Normalized up vector, w: area size X or spot scale X */
|
||||
vec4 upvec_sizey; /* xyz: Normalized right vector, w: area size Y or spot scale Y */
|
||||
vec4 forwardvec_type; /* xyz: Normalized forward vector, w: Light Type */
|
||||
vec4 diff_spec_volume; /* xyz: Diffuse/Spec/Volume power, w: radius for volumetric. */
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(LightData, 16)
|
||||
|
||||
struct LightBlock {
|
||||
LightData lights_data[MAX_LIGHT];
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(LightBlock, 16)
|
||||
|
||||
struct RenderpassBlock {
|
||||
bool renderPassDiffuse;
|
||||
bool renderPassDiffuseLight;
|
||||
bool renderPassGlossy;
|
||||
bool renderPassGlossyLight;
|
||||
bool renderPassEmit;
|
||||
bool renderPassSSSColor;
|
||||
bool renderPassEnvironment;
|
||||
bool renderPassAOV;
|
||||
uint renderPassAOVActive;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(RenderpassBlock, 16)
|
||||
|
||||
#define MAX_SSS_SAMPLES 65
|
||||
#define SSS_LUT_SIZE 64.0
|
||||
#define SSS_LUT_SCALE ((SSS_LUT_SIZE - 1.0) / float(SSS_LUT_SIZE))
|
||||
#define SSS_LUT_BIAS (0.5 / float(SSS_LUT_SIZE))
|
||||
|
||||
struct SSSProfileBlock {
|
||||
vec4 sss_kernel[MAX_SSS_SAMPLES];
|
||||
vec4 radii_max_radius;
|
||||
float avg_inv_radius;
|
||||
int sss_samples;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(SSSProfileBlock, 16)
|
||||
|
||||
#ifdef GPU_SHADER
|
||||
|
||||
# if defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
|
||||
/* Keep compatibility_with old global scope syntax. */
|
||||
# define pastViewProjectionMatrix common_block.pastViewProjectionMatrix
|
||||
# define hizUvScale common_block.hizUvScale
|
||||
# define aoParameters common_block.aoParameters
|
||||
# define volTexSize common_block.volTexSize
|
||||
# define volDepthParameters common_block.volDepthParameters
|
||||
# define volInvTexSize common_block.volInvTexSize
|
||||
# define volJitter common_block.volJitter
|
||||
# define volCoordScale common_block.volCoordScale
|
||||
# define volHistoryAlpha common_block.volHistoryAlpha
|
||||
# define volShadowSteps common_block.volShadowSteps
|
||||
# define volUseLights common_block.volUseLights
|
||||
# define volUseSoftShadows common_block.volUseSoftShadows
|
||||
# define ssrParameters common_block.ssrParameters
|
||||
# define ssrBorderFac common_block.ssrBorderFac
|
||||
# define ssrMaxRoughness common_block.ssrMaxRoughness
|
||||
# define ssrFireflyFac common_block.ssrFireflyFac
|
||||
# define ssrBrdfBias common_block.ssrBrdfBias
|
||||
# define ssrToggle common_block.ssrToggle
|
||||
# define ssrefractToggle common_block.ssrefractToggle
|
||||
# define sssJitterThreshold common_block.sssJitterThreshold
|
||||
# define sssToggle common_block.sssToggle
|
||||
# define specToggle common_block.specToggle
|
||||
# define laNumLight common_block.laNumLight
|
||||
# define prbNumPlanar common_block.prbNumPlanar
|
||||
# define prbNumRenderCube common_block.prbNumRenderCube
|
||||
# define prbNumRenderGrid common_block.prbNumRenderGrid
|
||||
# define prbIrradianceVisSize common_block.prbIrradianceVisSize
|
||||
# define prbIrradianceSmooth common_block.prbIrradianceSmooth
|
||||
# define prbLodCubeMax common_block.prbLodCubeMax
|
||||
# define rayType common_block.rayType
|
||||
# define rayDepth common_block.rayDepth
|
||||
# define alphaHashOffset common_block.alphaHashOffset
|
||||
# define alphaHashScale common_block.alphaHashScale
|
||||
# define cameraUvScaleBias common_block.cameraUvScaleBias
|
||||
# define planarClipPlane common_block.planarClipPlane
|
||||
|
||||
/* ProbeBlock */
|
||||
# define probes_data probe_block.probes_data
|
||||
|
||||
/* GridBlock */
|
||||
# define grids_data grid_block.grids_data
|
||||
|
||||
/* PlanarBlock */
|
||||
# define planars_data planar_block.planars_data
|
||||
|
||||
/* ShadowBlock */
|
||||
# define shadows_data shadow_block.shadows_data
|
||||
# define shadows_cube_data shadow_block.shadows_cube_data
|
||||
# define shadows_cascade_data shadow_block.shadows_cascade_data
|
||||
|
||||
/* LightBlock */
|
||||
# define lights_data light_block.lights_data
|
||||
|
||||
/* RenderpassBlock */
|
||||
# define renderPassDiffuse renderpass_block.renderPassDiffuse
|
||||
# define renderPassDiffuseLight renderpass_block.renderPassDiffuseLight
|
||||
# define renderPassGlossy renderpass_block.renderPassGlossy
|
||||
# define renderPassGlossyLight renderpass_block.renderPassGlossyLight
|
||||
# define renderPassEmit renderpass_block.renderPassEmit
|
||||
# define renderPassSSSColor renderpass_block.renderPassSSSColor
|
||||
# define renderPassEnvironment renderpass_block.renderPassEnvironment
|
||||
# define renderPassAOV renderpass_block.renderPassAOV
|
||||
# define renderPassAOVActive renderpass_block.renderPassAOVActive
|
||||
|
||||
/* SSSProfileBlock */
|
||||
# define sss_kernel sssProfile.sss_kernel
|
||||
# define radii_max_radius sssProfile.radii_max_radius
|
||||
# define avg_inv_radius sssProfile.avg_inv_radius
|
||||
# define sss_samples sssProfile.sss_samples
|
||||
|
||||
# endif /* USE_GPU_SHADER_CREATE_INFO */
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -23,14 +23,6 @@ struct IrradianceData {
|
|||
|
||||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Resources
|
||||
* \{ */
|
||||
|
||||
uniform sampler2DArray irradianceGrid;
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Functions
|
||||
* \{ */
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(lightprobe_lib.glsl)
|
||||
|
||||
flat in int pid;
|
||||
in vec2 quadCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float dist_sqr = dot(quadCoord, quadCoord);
|
||||
|
|
|
@ -1,34 +1,18 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
/* XXX TODO: fix code duplication. */
|
||||
struct CubeData {
|
||||
vec4 position_type;
|
||||
vec4 attenuation_fac_type;
|
||||
mat4 influencemat;
|
||||
mat4 parallaxmat;
|
||||
};
|
||||
|
||||
layout(std140) uniform probe_block
|
||||
{
|
||||
CubeData probes_data[MAX_PROBE];
|
||||
};
|
||||
|
||||
uniform float sphere_size;
|
||||
|
||||
flat out int pid;
|
||||
out vec2 quadCoord;
|
||||
|
||||
const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
|
||||
vec2(1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
|
||||
vec2(1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(-1.0, 1.0));
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Constant array moved inside function scope.
|
||||
* Minimises local register allocation in MSL. */
|
||||
const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
|
||||
vec2(1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
|
||||
vec2(1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(-1.0, 1.0));
|
||||
|
||||
pid = 1 + (gl_VertexID / 6); /* +1 for the world */
|
||||
int vert_id = gl_VertexID % 6;
|
||||
|
||||
|
|
|
@ -4,18 +4,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_math_geom_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(irradiance_lib.glsl)
|
||||
|
||||
uniform samplerCube probeHdr;
|
||||
uniform int probeSize;
|
||||
uniform float lodFactor;
|
||||
uniform float lodMax;
|
||||
uniform float intensityFac;
|
||||
|
||||
uniform float sampleCount;
|
||||
|
||||
in vec3 worldPosition;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
#define M_4PI 12.5663706143591729
|
||||
|
||||
const mat3 CUBE_ROTATIONS[6] = mat3[](
|
||||
|
|
|
@ -3,21 +3,6 @@
|
|||
#pragma BLENDER_REQUIRE(bsdf_sampling_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_geom_lib.glsl)
|
||||
|
||||
uniform samplerCube probeHdr;
|
||||
uniform float probe_roughness;
|
||||
uniform float texelSize;
|
||||
uniform float lodFactor;
|
||||
uniform float lodMax;
|
||||
uniform float paddingSize;
|
||||
uniform float intensityFac;
|
||||
uniform float fireflyFactor;
|
||||
|
||||
uniform float sampleCount;
|
||||
|
||||
in vec3 worldPosition;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 octahedral_to_cubemap_proj(vec2 co)
|
||||
{
|
||||
co = co * 2.0 - 1.0;
|
||||
|
@ -36,7 +21,7 @@ void main()
|
|||
{
|
||||
vec3 N, T, B, V;
|
||||
|
||||
vec3 R = normalize(worldPosition);
|
||||
vec3 R = normalize(geom_iface.worldPosition);
|
||||
|
||||
/* Isotropic assumption */
|
||||
N = V = R;
|
||||
|
|
|
@ -4,20 +4,6 @@
|
|||
#pragma BLENDER_REQUIRE(bsdf_sampling_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(irradiance_lib.glsl)
|
||||
|
||||
uniform samplerCube probeDepth;
|
||||
uniform int outputSize;
|
||||
uniform float lodFactor;
|
||||
uniform float storedTexelSize;
|
||||
uniform float lodMax;
|
||||
uniform float nearClip;
|
||||
uniform float farClip;
|
||||
uniform float visibilityRange;
|
||||
uniform float visibilityBlur;
|
||||
|
||||
uniform float sampleCount;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 octahedral_to_cubemap_proj(vec2 co)
|
||||
{
|
||||
co = co * 2.0 - 1.0;
|
||||
|
|
|
@ -1,18 +1,4 @@
|
|||
|
||||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices = 3) out;
|
||||
|
||||
uniform int Layer;
|
||||
|
||||
in vec4 vPos[];
|
||||
flat in int face[];
|
||||
flat out int fFace;
|
||||
|
||||
out vec3 worldPosition;
|
||||
out vec3 viewPosition; /* Required. otherwise generate linking error. */
|
||||
out vec3 worldNormal; /* Required. otherwise generate linking error. */
|
||||
out vec3 viewNormal; /* Required. otherwise generate linking error. */
|
||||
|
||||
const vec3 maj_axes[6] = vec3[6](vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0),
|
||||
vec3(0.0, 1.0, 0.0),
|
||||
|
@ -34,12 +20,14 @@ const vec3 y_axis[6] = vec3[6](vec3(0.0, -1.0, 0.0),
|
|||
|
||||
void main()
|
||||
{
|
||||
fFace = face[0];
|
||||
gl_Layer = Layer + fFace;
|
||||
geom_iface.fFace = vert_iface[0].face;
|
||||
gl_Layer = Layer + geom_iface.fFace;
|
||||
|
||||
for (int v = 0; v < 3; v++) {
|
||||
gl_Position = vPos[v];
|
||||
worldPosition = x_axis[fFace] * vPos[v].x + y_axis[fFace] * vPos[v].y + maj_axes[fFace];
|
||||
gl_Position = vert_iface[v].vPos;
|
||||
geom_iface.worldPosition = x_axis[geom_iface.fFace] * vert_iface[v].vPos.x +
|
||||
y_axis[geom_iface.fFace] * vert_iface[v].vPos.y +
|
||||
maj_axes[geom_iface.fFace];
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(irradiance_lib.glsl)
|
||||
|
||||
flat in int cellOffset;
|
||||
in vec2 quadCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float dist_sqr = dot(quadCoord, quadCoord);
|
||||
|
|
|
@ -1,27 +1,18 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
uniform float sphere_size;
|
||||
uniform int offset;
|
||||
uniform ivec3 grid_resolution;
|
||||
uniform vec3 corner;
|
||||
uniform vec3 increment_x;
|
||||
uniform vec3 increment_y;
|
||||
uniform vec3 increment_z;
|
||||
|
||||
flat out int cellOffset;
|
||||
out vec2 quadCoord;
|
||||
|
||||
const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
|
||||
vec2(1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
|
||||
vec2(1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(-1.0, 1.0));
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Constant array moved inside function scope.
|
||||
* Minimises local register allocation in MSL. */
|
||||
const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
|
||||
vec2(1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
|
||||
vec2(1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(-1.0, 1.0));
|
||||
|
||||
int cell_id = gl_VertexID / 6;
|
||||
int vert_id = gl_VertexID % 6;
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
uniform sampler2DArray irradianceGrid;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(engine_eevee_legacy_shared.h)
|
||||
#pragma BLENDER_REQUIRE(common_math_geom_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
|
@ -9,17 +10,14 @@
|
|||
|
||||
/* ----------- Uniforms --------- */
|
||||
|
||||
#if !defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
|
||||
uniform sampler2DArray probePlanars;
|
||||
uniform samplerCubeArray probeCubes;
|
||||
|
||||
/* ----------- Structures --------- */
|
||||
#endif
|
||||
|
||||
struct CubeData {
|
||||
vec4 position_type;
|
||||
vec4 attenuation_fac_type;
|
||||
mat4 influencemat;
|
||||
mat4 parallaxmat;
|
||||
};
|
||||
/* ----------- Structures --------- */
|
||||
|
||||
#define PROBE_PARALLAX_BOX 1.0
|
||||
#define PROBE_ATTENUATION_BOX 1.0
|
||||
|
@ -29,16 +27,6 @@ struct CubeData {
|
|||
#define p_atten_fac attenuation_fac_type.x
|
||||
#define p_atten_type attenuation_fac_type.y
|
||||
|
||||
struct PlanarData {
|
||||
vec4 plane_equation;
|
||||
vec4 clip_vec_x_fade_scale;
|
||||
vec4 clip_vec_y_fade_bias;
|
||||
vec4 clip_edges;
|
||||
vec4 facing_scale_bias;
|
||||
mat4 reflectionmat; /* transform world space into reflection texture space */
|
||||
mat4 unused;
|
||||
};
|
||||
|
||||
#define pl_plane_eq plane_equation
|
||||
#define pl_normal plane_equation.xyz
|
||||
#define pl_facing_scale facing_scale_bias.x
|
||||
|
@ -49,16 +37,6 @@ struct PlanarData {
|
|||
#define pl_clip_pos_y clip_vec_y_fade_bias.xyz
|
||||
#define pl_clip_edges clip_edges
|
||||
|
||||
struct GridData {
|
||||
mat4 localmat;
|
||||
ivec4 resolution_offset;
|
||||
vec4 ws_corner_atten_scale; /* world space corner position */
|
||||
vec4 ws_increment_x_atten_bias; /* world space vector between 2 opposite cells */
|
||||
vec4 ws_increment_y_lvl_bias;
|
||||
vec4 ws_increment_z;
|
||||
vec4 vis_bias_bleed_range;
|
||||
};
|
||||
|
||||
#define g_corner ws_corner_atten_scale.xyz
|
||||
#define g_atten_scale ws_corner_atten_scale.w
|
||||
#define g_atten_bias ws_increment_x_atten_bias.w
|
||||
|
@ -82,21 +60,28 @@ struct GridData {
|
|||
# define MAX_PLANAR 1
|
||||
#endif
|
||||
|
||||
#if !defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
|
||||
layout(std140) uniform probe_block
|
||||
{
|
||||
CubeData probes_data[MAX_PROBE];
|
||||
ProbeBlock _probe_block;
|
||||
};
|
||||
|
||||
layout(std140) uniform grid_block
|
||||
{
|
||||
GridData grids_data[MAX_GRID];
|
||||
GridBlock _grid_block;
|
||||
};
|
||||
|
||||
layout(std140) uniform planar_block
|
||||
{
|
||||
PlanarData planars_data[MAX_PLANAR];
|
||||
PlanarBlock _planar_block;
|
||||
};
|
||||
|
||||
# define probes_data _probe_block.probes_data
|
||||
# define grids_data _grid_block.grids_data
|
||||
# define planars_data _planar_block.planars_data
|
||||
|
||||
#endif
|
||||
/* ----------- Functions --------- */
|
||||
|
||||
float probe_attenuation_cube(int pd_id, vec3 P)
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
uniform sampler2DArray probePlanars;
|
||||
|
||||
in vec3 worldPosition;
|
||||
flat in int probeIdx;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 refco = ProjectionMatrix * (ViewMatrix * vec4(worldPosition, 1.0));
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
in vec3 pos;
|
||||
|
||||
in int probe_id;
|
||||
in mat4 probe_mat;
|
||||
|
||||
out vec3 worldPosition;
|
||||
flat out int probeIdx;
|
||||
|
||||
void main()
|
||||
{
|
||||
worldPosition = (probe_mat * vec4(-pos.x, pos.y, 0.0, 1.0)).xyz;
|
||||
|
|
|
@ -4,30 +4,22 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
uniform sampler2DArray source;
|
||||
uniform float fireflyFactor;
|
||||
|
||||
in vec2 uvs;
|
||||
flat in float layer;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
#if 0
|
||||
/* Reconstructing Target uvs like this avoid missing pixels if NPO2 */
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 / vec2(textureSize(source, 0).xy);
|
||||
|
||||
FragColor = textureLod(source, vec3(uvs, layer), 0.0);
|
||||
FragColor = textureLod(source, vec3(uvs, lightprobe_geom_iface.layer), 0.0);
|
||||
#else
|
||||
vec2 texel_size = 1.0 / vec2(textureSize(source, 0).xy);
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 * texel_size;
|
||||
vec4 ofs = texel_size.xyxy * vec4(0.75, 0.75, -0.75, -0.75);
|
||||
|
||||
FragColor = textureLod(source, vec3(uvs + ofs.xy, layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.xw, layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.zy, layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.zw, layer), 0.0);
|
||||
FragColor = textureLod(source, vec3(uvs + ofs.xy, lightprobe_geom_iface.layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.xw, lightprobe_geom_iface.layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.zy, lightprobe_geom_iface.layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.zw, lightprobe_geom_iface.layer), 0.0);
|
||||
FragColor *= 0.25;
|
||||
|
||||
/* Clamped brightness. */
|
||||
|
|
|
@ -2,23 +2,18 @@
|
|||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices = 3) out;
|
||||
|
||||
in int instance[];
|
||||
in vec2 vPos[];
|
||||
|
||||
flat out float layer;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Layer = instance[0];
|
||||
layer = float(instance[0]);
|
||||
gl_Layer = lightprobe_vert_iface[0].instance;
|
||||
lightprobe_geom_iface.layer = float(lightprobe_vert_iface[0].instance);
|
||||
|
||||
gl_Position = vec4(vPos[0], 0.0, 1.0);
|
||||
gl_Position = vec4(lightprobe_vert_iface[0].vPos, 0.0, 1.0);
|
||||
EmitVertex();
|
||||
|
||||
gl_Position = vec4(vPos[1], 0.0, 1.0);
|
||||
gl_Position = vec4(lightprobe_vert_iface[1].vPos, 0.0, 1.0);
|
||||
EmitVertex();
|
||||
|
||||
gl_Position = vec4(vPos[2], 0.0, 1.0);
|
||||
gl_Position = vec4(lightprobe_vert_iface[2].vPos, 0.0, 1.0);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
|
||||
out int instance;
|
||||
out vec2 vPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
int v = gl_VertexID % 3;
|
||||
vPos.x = -1.0 + float((v & 1) << 2);
|
||||
vPos.y = -1.0 + float((v & 2) << 1);
|
||||
lightprobe_vert_iface.vPos.x = -1.0 + float((v & 1) << 2);
|
||||
lightprobe_vert_iface.vPos.y = -1.0 + float((v & 2) << 1);
|
||||
|
||||
instance = gl_VertexID / 3;
|
||||
lightprobe_vert_iface.instance = gl_VertexID / 3;
|
||||
|
||||
#ifdef GPU_METAL
|
||||
MTLRenderTargetArrayIndex = lightprobe_vert_iface.instance;
|
||||
lightprobe_geom_iface.layer = float(lightprobe_vert_iface.instance);
|
||||
gl_Position = vec4(lightprobe_vert_iface.vPos, 0.0, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
|
||||
in vec3 pos;
|
||||
|
||||
out vec4 vPos;
|
||||
flat out int face;
|
||||
|
||||
void main()
|
||||
{
|
||||
vPos = vec4(pos, 1.0);
|
||||
face = gl_InstanceID;
|
||||
vert_iface.vPos = vec4(pos, 1.0);
|
||||
vert_iface.face = gl_InstanceID;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
/* Non-geometry shader equivalent for eevee_legacy_lightprobe_vert + eevee_legacy_lightprobe_geom.
|
||||
* generates geometry instance per cubeface for multi-layered rendering. */
|
||||
void main()
|
||||
{
|
||||
|
||||
const vec3 maj_axes[6] = vec3[6](vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0),
|
||||
vec3(0.0, 1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(0.0, 0.0, -1.0));
|
||||
const vec3 x_axis[6] = vec3[6](vec3(0.0, 0.0, -1.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
vec3(-1.0, 0.0, 0.0));
|
||||
const vec3 y_axis[6] = vec3[6](vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0),
|
||||
vec3(0.0, 0.0, -1.0),
|
||||
vec3(0.0, -1.0, 0.0),
|
||||
vec3(0.0, -1.0, 0.0));
|
||||
geom_iface.fFace = gl_InstanceID;
|
||||
gl_Position = vec4(pos.xyz, 1.0);
|
||||
geom_iface.worldPosition = x_axis[geom_iface.fFace] * pos.x + y_axis[geom_iface.fFace] * pos.y +
|
||||
maj_axes[geom_iface.fFace];
|
||||
|
||||
#ifdef GPU_METAL
|
||||
/* In the Metal API, gl_Layer equivalent is specified in the vertex shader for multilayered
|
||||
* rendering support. */
|
||||
MTLRenderTargetArrayIndex = Layer + geom_iface.fFace;
|
||||
#endif
|
||||
}
|
|
@ -1,27 +1,15 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(engine_eevee_shared_defines.h)
|
||||
#pragma BLENDER_REQUIRE(engine_eevee_legacy_shared.h)
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_geom_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(raytrace_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(ltc_lib.glsl)
|
||||
|
||||
#ifndef MAX_CASCADE_NUM
|
||||
# define MAX_CASCADE_NUM 4
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Structure
|
||||
* \{ */
|
||||
|
||||
struct LightData {
|
||||
vec4 position_influence; /* w : InfluenceRadius (inversed and squared) */
|
||||
vec4 color_influence_volume; /* w : InfluenceRadius but for Volume power */
|
||||
vec4 spotdata_radius_shadow; /* x : spot size, y : spot blend, z : radius, w: shadow id */
|
||||
vec4 rightvec_sizex; /* xyz: Normalized up vector, w: area size X or spot scale X */
|
||||
vec4 upvec_sizey; /* xyz: Normalized right vector, w: area size Y or spot scale Y */
|
||||
vec4 forwardvec_type; /* xyz: Normalized forward vector, w: Light Type */
|
||||
vec4 diff_spec_volume; /* xyz: Diffuse/Spec/Volume power, w: radius for volumetric. */
|
||||
};
|
||||
|
||||
/* convenience aliases */
|
||||
#define l_color color_influence_volume.rgb
|
||||
#define l_diff diff_spec_volume.x
|
||||
|
@ -42,23 +30,6 @@ struct LightData {
|
|||
#define l_radius spotdata_radius_shadow.z
|
||||
#define l_shadowid spotdata_radius_shadow.w
|
||||
|
||||
struct ShadowData {
|
||||
vec4 near_far_bias_id;
|
||||
vec4 contact_shadow_data;
|
||||
};
|
||||
|
||||
struct ShadowCubeData {
|
||||
mat4 shadowmat;
|
||||
vec4 position;
|
||||
};
|
||||
|
||||
struct ShadowCascadeData {
|
||||
mat4 shadowmat[MAX_CASCADE_NUM];
|
||||
vec4 split_start_distances;
|
||||
vec4 split_end_distances;
|
||||
vec4 shadow_vec_id;
|
||||
};
|
||||
|
||||
/* convenience aliases */
|
||||
#define sh_near near_far_bias_id.x
|
||||
#define sh_far near_far_bias_id.y
|
||||
|
@ -77,21 +48,35 @@ struct ShadowCascadeData {
|
|||
/** \name Resources
|
||||
* \{ */
|
||||
|
||||
#if !defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
|
||||
layout(std140) uniform shadow_block
|
||||
{
|
||||
ShadowData shadows_data[MAX_SHADOW];
|
||||
ShadowCubeData shadows_cube_data[MAX_SHADOW_CUBE];
|
||||
ShadowCascadeData shadows_cascade_data[MAX_SHADOW_CASCADE];
|
||||
ShadowBlock _shadow_block;
|
||||
};
|
||||
|
||||
layout(std140) uniform light_block
|
||||
{
|
||||
LightData lights_data[MAX_LIGHT];
|
||||
LightBlock _light_block;
|
||||
};
|
||||
|
||||
uniform depth2DArrayShadow shadowCubeTexture;
|
||||
uniform depth2DArrayShadow shadowCascadeTexture;
|
||||
|
||||
/* Keep original syntax: ShadowBlock */
|
||||
# define shadows_data _shadow_block.shadows_data
|
||||
# define shadows_cube_data _shadow_block.shadows_cube_data
|
||||
# define shadows_cascade_data _shadow_block.shadows_cascade_data
|
||||
|
||||
/* Keep original syntax: LightBlock */
|
||||
# define lights_data _light_block.lights_data
|
||||
|
||||
#else
|
||||
# ifndef EEVEE_SHADER_SHARED_H
|
||||
# error Ensure eevee_legacy_common_lib is included.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -4,15 +4,6 @@
|
|||
#pragma BLENDER_REQUIRE(lightprobe_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
uniform sampler2D studioLight;
|
||||
|
||||
uniform float backgroundAlpha;
|
||||
uniform mat3 StudioLightMatrix;
|
||||
uniform float studioLightIntensity; /* Default 1.0; */
|
||||
uniform float studioLightBlur; /* Default 0.0; */
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 background_transform_to_world(vec3 viewvec)
|
||||
{
|
||||
vec4 v = (ProjectionMatrix[3][3] == 0.0) ? vec4(viewvec, 1.0) : vec4(0.0, 0.0, 1.0, 1.0);
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
* Project page: https://eheitzresearch.wordpress.com/415-2/
|
||||
*/
|
||||
|
||||
/* Ensure common_utiltex_lib is included first. */
|
||||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
|
||||
#define USE_LTC
|
||||
|
||||
/* Diffuse *clipped* sphere integral. */
|
||||
|
@ -141,7 +144,11 @@ mat3 ltc_matrix(vec4 lut)
|
|||
return Minv;
|
||||
}
|
||||
|
||||
#ifdef GPU_METAL
|
||||
void ltc_transform_quad(vec3 N, vec3 V, mat3 Minv, thread vec3 *corners)
|
||||
#else
|
||||
void ltc_transform_quad(vec3 N, vec3 V, mat3 Minv, inout vec3 corners[4])
|
||||
#endif
|
||||
{
|
||||
/* Avoid dot(N, V) == 1 in ortho mode, leading T1 normalize to fail. */
|
||||
V = normalize(V + 1e-8);
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
|
||||
uniform mat4 prevViewProjMatrix;
|
||||
uniform mat4 currViewProjMatrix;
|
||||
uniform mat4 nextViewProjMatrix;
|
||||
|
||||
in vec3 prevWorldPos;
|
||||
in vec3 currWorldPos;
|
||||
in vec3 nextWorldPos;
|
||||
|
||||
out vec4 outData;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 prev_wpos = prevViewProjMatrix * vec4(prevWorldPos, 1.0);
|
||||
|
|
|
@ -2,24 +2,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_hair_lib.glsl)
|
||||
|
||||
uniform mat4 currModelMatrix;
|
||||
uniform mat4 prevModelMatrix;
|
||||
uniform mat4 nextModelMatrix;
|
||||
uniform bool useDeform;
|
||||
|
||||
#ifdef HAIR
|
||||
uniform samplerBuffer prvBuffer; /* RGBA32F */
|
||||
uniform samplerBuffer nxtBuffer; /* RGBA32F */
|
||||
#else
|
||||
in vec3 pos;
|
||||
in vec3 prv; /* Previous frame position. */
|
||||
in vec3 nxt; /* Next frame position. */
|
||||
#endif
|
||||
|
||||
out vec3 currWorldPos;
|
||||
out vec3 prevWorldPos;
|
||||
out vec3 nextWorldPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
#ifdef USE_ALPHA_HASH
|
||||
/* A value of -1.0 will disable alpha clip and use alpha hash. */
|
||||
uniform float alphaClipThreshold;
|
||||
|
||||
/* From the paper "Hashed Alpha Testing" by Chris Wyman and Morgan McGuire */
|
||||
float hash(vec2 a)
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
* Screen-Space Raytracing functions.
|
||||
*/
|
||||
|
||||
uniform sampler2D maxzBuffer;
|
||||
uniform sampler2DArray planarDepth;
|
||||
|
||||
struct Ray {
|
||||
vec3 origin;
|
||||
/* Ray direction premultiplied by its maximum length. */
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
#define EEVEE_AOV_HASH_COLOR_TYPE_MASK 1u
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Resources
|
||||
* \{ */
|
||||
|
||||
layout(std140) uniform renderpass_block
|
||||
{
|
||||
bool renderPassDiffuse;
|
||||
bool renderPassDiffuseLight;
|
||||
bool renderPassGlossy;
|
||||
bool renderPassGlossyLight;
|
||||
bool renderPassEmit;
|
||||
bool renderPassSSSColor;
|
||||
bool renderPassEnvironment;
|
||||
bool renderPassAOV;
|
||||
uint renderPassAOVActive;
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Functions
|
||||
* \{ */
|
||||
|
|
|
@ -13,17 +13,6 @@
|
|||
#define PASS_POST_TWO_LIGHT_BUFFERS 8
|
||||
#define PASS_POST_ACCUMULATED_TRANSMITTANCE_COLOR 9
|
||||
|
||||
uniform int postProcessType;
|
||||
uniform int currentSample;
|
||||
|
||||
uniform depth2D depthBuffer;
|
||||
uniform sampler2D inputBuffer;
|
||||
uniform sampler2D inputSecondLightBuffer;
|
||||
uniform sampler2D inputColorBuffer;
|
||||
uniform sampler2D inputTransmittanceBuffer;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
vec3 safe_divide_even_color(vec3 a, vec3 b)
|
||||
{
|
||||
vec3 result = vec3((b.r != 0.0) ? a.r / b.r : 0.0,
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_utiltex_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(lights_lib.glsl)
|
||||
|
||||
uniform depth2D depthBuffer;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (laNumLight == 0) {
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
#pragma BLENDER_REQUIRE(common_hair_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
in vec3 pos;
|
||||
in vec3 nor;
|
||||
|
||||
void main()
|
||||
{
|
||||
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
#define BTDF_BIAS 0.85
|
||||
|
||||
uniform sampler2D refractColorBuffer;
|
||||
|
||||
uniform float refractionDepth;
|
||||
|
||||
vec4 screen_space_refraction(vec3 vP, vec3 N, vec3 V, float ior, float roughnessSquared, vec4 rand)
|
||||
{
|
||||
float alpha = max(0.002, roughnessSquared);
|
||||
|
|
|
@ -11,23 +11,6 @@
|
|||
#pragma BLENDER_REQUIRE(volumetric_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(renderpass_lib.glsl)
|
||||
|
||||
#ifdef USE_ALPHA_BLEND
|
||||
/* Use dual source blending to be able to make a whole range of effects. */
|
||||
layout(location = 0, index = 0) out vec4 outRadiance;
|
||||
layout(location = 0, index = 1) out vec4 outTransmittance;
|
||||
|
||||
#else /* OPAQUE */
|
||||
layout(location = 0) out vec4 outRadiance;
|
||||
layout(location = 1) out vec2 ssrNormals;
|
||||
layout(location = 2) out vec4 ssrData;
|
||||
layout(location = 3) out vec3 sssIrradiance;
|
||||
layout(location = 4) out float sssRadius;
|
||||
layout(location = 5) out vec3 sssAlbedo;
|
||||
|
||||
#endif
|
||||
|
||||
uniform float backgroundAlpha;
|
||||
|
||||
#ifdef EEVEE_DISPLACEMENT_BUMP
|
||||
|
||||
# ifndef GPU_METAL
|
||||
|
@ -68,7 +51,11 @@ void main()
|
|||
#endif
|
||||
|
||||
#if defined(WORLD_BACKGROUND) || defined(PROBE_CAPTURE)
|
||||
|
||||
/* Skip attribute load for shaders which do not require this part of the path. E.g. Cryptomatte. */
|
||||
# ifndef NO_ATTRIB_LOAD
|
||||
attrib_load();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
out_ssr_color = vec3(0.0);
|
||||
|
|
|
@ -3,48 +3,56 @@
|
|||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
#define SURFACE_INTERFACE \
|
||||
vec3 worldPosition; \
|
||||
vec3 viewPosition; \
|
||||
vec3 worldNormal; \
|
||||
vec3 viewNormal;
|
||||
|
||||
#ifndef IN_OUT
|
||||
# if defined(GPU_VERTEX_SHADER)
|
||||
# define IN_OUT out
|
||||
# elif defined(GPU_FRAGMENT_SHADER)
|
||||
# define IN_OUT in
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef EEVEE_GENERATED_INTERFACE
|
||||
# if defined(STEP_RESOLVE) || defined(STEP_RAYTRACE)
|
||||
/* SSR will set these global variables itself.
|
||||
/* Global interface for SSR.
|
||||
* SSR will set these global variables itself.
|
||||
* Also make false positive compiler warnings disappear by setting values. */
|
||||
vec3 worldPosition = vec3(0);
|
||||
vec3 viewPosition = vec3(0);
|
||||
vec3 worldNormal = vec3(0);
|
||||
vec3 viewNormal = vec3(0);
|
||||
#define SSR_INTERFACE \
|
||||
vec3 worldPosition = vec3(0); \
|
||||
vec3 viewPosition = vec3(0); \
|
||||
vec3 worldNormal = vec3(0); \
|
||||
vec3 viewNormal = vec3(0);
|
||||
|
||||
# elif defined(GPU_GEOMETRY_SHADER)
|
||||
/* Skip interface declaration when using create-info. */
|
||||
#ifndef USE_GPU_SHADER_CREATE_INFO
|
||||
|
||||
# define SURFACE_INTERFACE \
|
||||
vec3 worldPosition; \
|
||||
vec3 viewPosition; \
|
||||
vec3 worldNormal; \
|
||||
vec3 viewNormal;
|
||||
|
||||
# ifndef IN_OUT
|
||||
# if defined(GPU_VERTEX_SHADER)
|
||||
# define IN_OUT out
|
||||
# elif defined(GPU_FRAGMENT_SHADER)
|
||||
# define IN_OUT in
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef EEVEE_GENERATED_INTERFACE
|
||||
# if defined(STEP_RESOLVE) || defined(STEP_RAYTRACE)
|
||||
|
||||
SSR_INTERFACE
|
||||
|
||||
# elif defined(GPU_GEOMETRY_SHADER)
|
||||
in ShaderStageInterface{SURFACE_INTERFACE} dataIn[];
|
||||
|
||||
out ShaderStageInterface{SURFACE_INTERFACE} dataOut;
|
||||
|
||||
# define PASS_SURFACE_INTERFACE(vert) \
|
||||
dataOut.worldPosition = dataIn[vert].worldPosition; \
|
||||
dataOut.viewPosition = dataIn[vert].viewPosition; \
|
||||
dataOut.worldNormal = dataIn[vert].worldNormal; \
|
||||
dataOut.viewNormal = dataIn[vert].viewNormal;
|
||||
# define PASS_SURFACE_INTERFACE(vert) \
|
||||
dataOut.worldPosition = dataIn[vert].worldPosition; \
|
||||
dataOut.viewPosition = dataIn[vert].viewPosition; \
|
||||
dataOut.worldNormal = dataIn[vert].worldNormal; \
|
||||
dataOut.viewNormal = dataIn[vert].viewNormal;
|
||||
|
||||
# else /* GPU_VERTEX_SHADER || GPU_FRAGMENT_SHADER*/
|
||||
# else /* GPU_VERTEX_SHADER || GPU_FRAGMENT_SHADER*/
|
||||
|
||||
IN_OUT ShaderStageInterface{SURFACE_INTERFACE};
|
||||
|
||||
# endif
|
||||
#endif /* EEVEE_GENERATED_INTERFACE */
|
||||
# endif
|
||||
# endif /* EEVEE_GENERATED_INTERFACE */
|
||||
|
||||
#ifdef HAIR_SHADER
|
||||
# ifdef HAIR_SHADER
|
||||
IN_OUT ShaderHairInterface
|
||||
{
|
||||
/* world space */
|
||||
|
@ -55,9 +63,9 @@ IN_OUT ShaderHairInterface
|
|||
flat int hairStrandID;
|
||||
vec2 hairBary;
|
||||
};
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef POINTCLOUD_SHADER
|
||||
# ifdef POINTCLOUD_SHADER
|
||||
IN_OUT ShaderPointCloudInterface
|
||||
{
|
||||
/* world space */
|
||||
|
@ -65,7 +73,28 @@ IN_OUT ShaderPointCloudInterface
|
|||
float pointPosition;
|
||||
flat int pointID;
|
||||
};
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#else
|
||||
/** Checks to ensure create-info is setup correctly. **/
|
||||
# ifdef HAIR_SHADER
|
||||
# ifndef USE_SURFACE_LIB_HAIR
|
||||
#error Ensure CreateInfo eevee_legacy_surface_lib_hair is included if using surface library with a hair shader.
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef POINTCLOUD_SHADER
|
||||
# ifndef USE_SURFACE_LIB_POINTCLOUD
|
||||
#error Ensure CreateInfo eevee_legacy_surface_lib_pointcloud is included if using surface library with a hair shader.
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* SSR Global Interface. */
|
||||
# if defined(STEP_RESOLVE) || defined(STEP_RAYTRACE)
|
||||
SSR_INTERFACE
|
||||
# endif
|
||||
|
||||
#endif /* USE_GPU_SHADER_CREATE_INFO */
|
||||
|
||||
#if defined(GPU_FRAGMENT_SHADER) && defined(CODEGEN_LIB)
|
||||
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
#pragma BLENDER_REQUIRE(closure_eval_surface_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
#ifndef HAIR_SHADER
|
||||
in vec3 pos;
|
||||
in vec3 nor;
|
||||
#endif
|
||||
|
||||
RESOURCE_ID_VARYING
|
||||
|
||||
void main()
|
||||
|
@ -58,7 +53,9 @@ void main()
|
|||
/* No need to normalize since this is just a rotation. */
|
||||
viewNormal = normal_world_to_view(worldNormal);
|
||||
|
||||
# ifndef NO_ATTRIB_LOAD
|
||||
attrib_load();
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
uniform sampler2D blueNoise;
|
||||
uniform vec3 offsets;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 blue_noise = texelFetch(blueNoise, ivec2(gl_FragCoord.xy), 0).xyz;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
/* This shader is used to add default values to the volume accum textures.
|
||||
* so it looks similar (transmittance = 1, scattering = 0) */
|
||||
layout(location = 0) out vec4 FragColor0;
|
||||
layout(location = 1) out vec4 FragColor1;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor0 = vec4(0.0);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
/* Store volumetric properties into the froxel textures. */
|
||||
|
||||
flat in int slice;
|
||||
|
||||
/* WARNING: these are not attributes, these are global vars. */
|
||||
vec3 worldPosition = vec3(0.0);
|
||||
vec3 objectPosition = vec3(0.0);
|
||||
|
@ -15,11 +13,6 @@ vec3 viewPosition = vec3(0.0);
|
|||
vec3 viewNormal = vec3(0.0);
|
||||
vec3 volumeOrco = vec3(0.0);
|
||||
|
||||
layout(location = 0) out vec4 volumeScattering;
|
||||
layout(location = 1) out vec4 volumeExtinction;
|
||||
layout(location = 2) out vec4 volumeEmissive;
|
||||
layout(location = 3) out vec4 volumePhase;
|
||||
|
||||
int attr_id = 0;
|
||||
|
||||
#ifndef CLEAR
|
||||
|
@ -70,7 +63,7 @@ vec3 coordinate_incoming(vec3 P)
|
|||
|
||||
void main()
|
||||
{
|
||||
ivec3 volume_cell = ivec3(ivec2(gl_FragCoord.xy), slice);
|
||||
ivec3 volume_cell = ivec3(ivec2(gl_FragCoord.xy), volumetric_geom_iface.slice);
|
||||
vec3 ndc_cell = volume_to_ndc((vec3(volume_cell) + volJitter.xyz) * volInvTexSize.xyz);
|
||||
|
||||
viewPosition = get_view_space_from_depth(ndc_cell.xy, ndc_cell.z);
|
||||
|
@ -97,7 +90,9 @@ void main()
|
|||
volumePhase = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
#else
|
||||
g_data = init_globals();
|
||||
# ifndef NO_ATTRIB_LOAD
|
||||
attrib_load();
|
||||
# endif
|
||||
Closure cl = nodetree_exec();
|
||||
# ifdef MESH_SHADER
|
||||
cl.scatter *= drw_volume.density_scale;
|
||||
|
|
|
@ -1,41 +1,30 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
#ifdef STANDALONE
|
||||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices = 3) out;
|
||||
#endif
|
||||
|
||||
in vec4 vPos[];
|
||||
|
||||
flat out int slice;
|
||||
|
||||
RESOURCE_ID_VARYING
|
||||
|
||||
#ifdef MESH_SHADER
|
||||
/* TODO: tight slices. */
|
||||
void main()
|
||||
{
|
||||
gl_Layer = slice = int(vPos[0].z);
|
||||
gl_Layer = volumetric_geom_iface.slice = int(volumetric_vert_iface[0].vPos.z);
|
||||
|
||||
PASS_RESOURCE_ID
|
||||
|
||||
# ifdef USE_ATTR
|
||||
pass_attr(0);
|
||||
# endif
|
||||
gl_Position = vPos[0].xyww;
|
||||
gl_Position = volumetric_vert_iface[0].vPos.xyww;
|
||||
EmitVertex();
|
||||
|
||||
# ifdef USE_ATTR
|
||||
pass_attr(1);
|
||||
# endif
|
||||
gl_Position = vPos[1].xyww;
|
||||
gl_Position = volumetric_vert_iface[1].vPos.xyww;
|
||||
EmitVertex();
|
||||
|
||||
# ifdef USE_ATTR
|
||||
pass_attr(2);
|
||||
# endif
|
||||
gl_Position = vPos[2].xyww;
|
||||
gl_Position = volumetric_vert_iface[2].vPos.xyww;
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
|
@ -48,26 +37,26 @@ void main()
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_Layer = slice = int(vPos[0].z);
|
||||
gl_Layer = volumetric_geom_iface.slice = int(volumetric_vert_iface[0].vPos.z);
|
||||
|
||||
PASS_RESOURCE_ID
|
||||
|
||||
# ifdef USE_ATTR
|
||||
pass_attr(0);
|
||||
# endif
|
||||
gl_Position = vPos[0].xyww;
|
||||
gl_Position = volumetric_vert_iface[0].vPos.xyww;
|
||||
EmitVertex();
|
||||
|
||||
# ifdef USE_ATTR
|
||||
pass_attr(1);
|
||||
# endif
|
||||
gl_Position = vPos[1].xyww;
|
||||
gl_Position = volumetric_vert_iface[1].vPos.xyww;
|
||||
EmitVertex();
|
||||
|
||||
# ifdef USE_ATTR
|
||||
pass_attr(2);
|
||||
# endif
|
||||
gl_Position = vPos[2].xyww;
|
||||
gl_Position = volumetric_vert_iface[2].vPos.xyww;
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
|
|
|
@ -7,21 +7,10 @@
|
|||
/* Step 3 : Integrate for each froxel the final amount of light
|
||||
* scattered back to the viewer and the amount of transmittance. */
|
||||
|
||||
uniform sampler3D volumeScattering; /* Result of the scatter step */
|
||||
uniform sampler3D volumeExtinction;
|
||||
|
||||
/* Globals when using OPTI */
|
||||
#ifdef USE_VOLUME_OPTI
|
||||
uniform layout(r11f_g11f_b10f) writeonly restrict image3D finalScattering_img;
|
||||
uniform layout(r11f_g11f_b10f) writeonly restrict image3D finalTransmittance_img;
|
||||
|
||||
vec3 finalScattering;
|
||||
vec3 finalTransmittance;
|
||||
#else
|
||||
|
||||
flat in int slice;
|
||||
|
||||
layout(location = 0) out vec3 finalScattering;
|
||||
layout(location = 1) out vec3 finalTransmittance;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
|
@ -50,6 +39,8 @@ void main()
|
|||
#ifdef USE_VOLUME_OPTI
|
||||
int slice = textureSize(volumeScattering, 0).z;
|
||||
ivec2 texco = ivec2(gl_FragCoord.xy);
|
||||
#else
|
||||
int slice = volumetric_geom_iface.slice;
|
||||
#endif
|
||||
for (int i = 0; i <= slice; i++) {
|
||||
ivec3 volume_cell = ivec3(ivec2(gl_FragCoord.xy), i);
|
||||
|
|
|
@ -186,9 +186,6 @@ vec3 irradiance_volumetric(vec3 wpos)
|
|||
#endif
|
||||
}
|
||||
|
||||
uniform sampler3D inScattering;
|
||||
uniform sampler3D inTransmittance;
|
||||
|
||||
void volumetric_resolve(vec2 frag_uvs,
|
||||
float frag_depth,
|
||||
out vec3 transmittance,
|
||||
|
|
|
@ -6,17 +6,6 @@
|
|||
|
||||
/* Step 4 : Apply final integration on top of the scene color. */
|
||||
|
||||
uniform sampler2D inSceneDepth;
|
||||
|
||||
/* Blend equation is : FragColor0 + FragColor1 * DstColor */
|
||||
#ifdef VOLUMETRICS_ACCUM
|
||||
layout(location = 0) out vec4 FragColor0;
|
||||
layout(location = 1) out vec4 FragColor1;
|
||||
#else
|
||||
layout(location = 0, index = 0) out vec4 FragColor0;
|
||||
layout(location = 0, index = 1) out vec4 FragColor1;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uvs = gl_FragCoord.xy / vec2(textureSize(inSceneDepth, 0));
|
||||
|
|
|
@ -7,22 +7,9 @@
|
|||
/* Step 2 : Evaluate all light scattering for each froxels.
|
||||
* Also do the temporal reprojection to fight aliasing artifacts. */
|
||||
|
||||
uniform sampler3D volumeScattering;
|
||||
uniform sampler3D volumeExtinction;
|
||||
uniform sampler3D volumeEmission;
|
||||
uniform sampler3D volumePhase;
|
||||
|
||||
uniform sampler3D historyScattering;
|
||||
uniform sampler3D historyTransmittance;
|
||||
|
||||
flat in int slice;
|
||||
|
||||
layout(location = 0) out vec4 outScattering;
|
||||
layout(location = 1) out vec4 outTransmittance;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec3 volume_cell = ivec3(ivec2(gl_FragCoord.xy), slice);
|
||||
ivec3 volume_cell = ivec3(ivec2(gl_FragCoord.xy), volumetric_geom_iface.slice);
|
||||
|
||||
/* Emission */
|
||||
outScattering = texelFetch(volumeEmission, volume_cell, 0);
|
||||
|
@ -65,7 +52,8 @@ void main()
|
|||
|
||||
/* Temporal supersampling */
|
||||
/* Note : this uses the cell non-jittered position (texel center). */
|
||||
vec3 curr_ndc = volume_to_ndc(vec3(gl_FragCoord.xy, float(slice) + 0.5) * volInvTexSize.xyz);
|
||||
vec3 curr_ndc = volume_to_ndc(vec3(gl_FragCoord.xy, float(volumetric_geom_iface.slice) + 0.5) *
|
||||
volInvTexSize.xyz);
|
||||
vec3 wpos = get_world_space_from_depth(curr_ndc.xy, curr_ndc.z);
|
||||
vec3 prev_ndc = project_point(pastViewProjectionMatrix, wpos);
|
||||
vec3 prev_volume = ndc_to_volume(prev_ndc * 0.5 + 0.5);
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
out vec4 vPos;
|
||||
|
||||
RESOURCE_ID_VARYING
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Generate Triangle : less memory fetches from a VBO */
|
||||
|
@ -24,12 +20,18 @@ void main()
|
|||
* -1 0 --------------- 2
|
||||
* -1 0 1 ex
|
||||
*/
|
||||
vPos.x = float(v_id / 2) * 4.0 - 1.0; /* int divisor round down */
|
||||
vPos.y = float(v_id % 2) * 4.0 - 1.0;
|
||||
vPos.z = float(t_id);
|
||||
vPos.w = 1.0;
|
||||
volumetric_vert_iface.vPos.x = float(v_id / 2) * 4.0 - 1.0; /* int divisor round down */
|
||||
volumetric_vert_iface.vPos.y = float(v_id % 2) * 4.0 - 1.0;
|
||||
volumetric_vert_iface.vPos.z = float(t_id);
|
||||
volumetric_vert_iface.vPos.w = 1.0;
|
||||
|
||||
PASS_RESOURCE_ID
|
||||
|
||||
#ifdef GPU_METAL
|
||||
volumetric_geom_iface.slice = int(volumetric_vert_iface.vPos.z);
|
||||
MTLRenderTargetArrayIndex = int(volumetric_vert_iface.vPos.z);
|
||||
gl_Position = volumetric_vert_iface.vPos.xyww;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Stubs */
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
#pragma BLENDER_REQUIRE(closure_eval_surface_lib.glsl)
|
||||
|
||||
in vec2 pos;
|
||||
|
||||
RESOURCE_ID_VARYING
|
||||
|
||||
void main()
|
||||
|
|
|
@ -725,7 +725,8 @@ BLI_STATIC_ASSERT_ALIGN(SubsurfaceData, 16)
|
|||
#define UTIL_DISK_INTEGRAL_LAYER 3
|
||||
#define UTIL_DISK_INTEGRAL_COMP 2
|
||||
|
||||
#ifndef __cplusplus
|
||||
/* __cplusplus is true when compiling with MSL, so include if inside a shader. */
|
||||
#if !defined(__cplusplus) || defined(GPU_SHADER)
|
||||
/* Fetch texel. Wrapping if above range. */
|
||||
float4 utility_tx_fetch(sampler2DArray util_tx, float2 texel, float layer)
|
||||
{
|
||||
|
@ -741,7 +742,8 @@ float4 utility_tx_sample(sampler2DArray util_tx, float2 uv, float layer)
|
|||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* __cplusplus is true when compiling with MSL, so ensure we are not inside a shader. */
|
||||
#if defined(__cplusplus) && !defined(GPU_SHADER)
|
||||
|
||||
using AOVsInfoDataBuf = draw::StorageBuffer<AOVsInfoData>;
|
||||
using CameraDataBuf = draw::UniformBuffer<CameraData>;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
bool cryptomatte_can_merge_sample(vec2 dst, vec2 src)
|
||||
{
|
||||
if (dst == vec2(0.0, 0.0)) {
|
||||
if (all(equal(dst, vec2(0.0, 0.0)))) {
|
||||
return true;
|
||||
}
|
||||
if (dst.x == src.x) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue