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:
committed by
Clément Foucault
parent
2efdbeb58b
commit
6b8bb26c45
@@ -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,
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "GPU_capabilities.h"
|
||||
#include "GPU_context.h"
|
||||
#include "GPU_material.h"
|
||||
#include "GPU_shader.h"
|
||||
|
||||
@@ -26,13 +27,6 @@
|
||||
#include "eevee_engine.h"
|
||||
#include "eevee_private.h"
|
||||
|
||||
static const char *filter_defines =
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
"#define IRRADIANCE_SH_L2\n";
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
"#define IRRADIANCE_HL2\n";
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
/* Lookdev */
|
||||
struct GPUShader *studiolight_probe_sh;
|
||||
@@ -165,6 +159,7 @@ static struct {
|
||||
} world;
|
||||
} e_data = {nullptr}; /* Engine data */
|
||||
|
||||
extern "C" char datatoc_engine_eevee_legacy_shared_h[];
|
||||
extern "C" char datatoc_common_hair_lib_glsl[];
|
||||
extern "C" char datatoc_common_math_lib_glsl[];
|
||||
extern "C" char datatoc_common_math_geom_lib_glsl[];
|
||||
@@ -172,65 +167,17 @@ extern "C" char datatoc_common_view_lib_glsl[];
|
||||
extern "C" char datatoc_gpu_shader_codegen_lib_glsl[];
|
||||
|
||||
extern "C" char datatoc_ambient_occlusion_lib_glsl[];
|
||||
extern "C" char datatoc_background_vert_glsl[];
|
||||
extern "C" char datatoc_bsdf_common_lib_glsl[];
|
||||
extern "C" char datatoc_bsdf_lut_frag_glsl[];
|
||||
extern "C" char datatoc_bsdf_sampling_lib_glsl[];
|
||||
extern "C" char datatoc_btdf_lut_frag_glsl[];
|
||||
extern "C" char datatoc_closure_type_lib_glsl[];
|
||||
extern "C" char datatoc_closure_eval_volume_lib_glsl[];
|
||||
extern "C" char datatoc_common_uniforms_lib_glsl[];
|
||||
extern "C" char datatoc_common_utiltex_lib_glsl[];
|
||||
extern "C" char datatoc_cryptomatte_lib_glsl[];
|
||||
extern "C" char datatoc_cryptomatte_frag_glsl[];
|
||||
extern "C" char datatoc_cryptomatte_vert_glsl[];
|
||||
extern "C" char datatoc_cubemap_lib_glsl[];
|
||||
extern "C" char datatoc_default_frag_glsl[];
|
||||
extern "C" char datatoc_lookdev_world_frag_glsl[];
|
||||
extern "C" char datatoc_effect_bloom_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_bokeh_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_dilate_tiles_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_downsample_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_filter_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_flatten_tiles_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_gather_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_lib_glsl[];
|
||||
extern "C" char datatoc_effect_dof_reduce_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_resolve_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_scatter_frag_glsl[];
|
||||
extern "C" char datatoc_effect_dof_scatter_vert_glsl[];
|
||||
extern "C" char datatoc_effect_dof_setup_frag_glsl[];
|
||||
extern "C" char datatoc_effect_downsample_cube_frag_glsl[];
|
||||
extern "C" char datatoc_effect_downsample_frag_glsl[];
|
||||
extern "C" char datatoc_effect_gtao_frag_glsl[];
|
||||
extern "C" char datatoc_effect_minmaxz_frag_glsl[];
|
||||
extern "C" char datatoc_effect_mist_frag_glsl[];
|
||||
extern "C" char datatoc_effect_motion_blur_frag_glsl[];
|
||||
extern "C" char datatoc_effect_reflection_lib_glsl[];
|
||||
extern "C" char datatoc_effect_reflection_resolve_frag_glsl[];
|
||||
extern "C" char datatoc_effect_reflection_trace_frag_glsl[];
|
||||
extern "C" char datatoc_effect_subsurface_frag_glsl[];
|
||||
extern "C" char datatoc_effect_temporal_aa_glsl[];
|
||||
extern "C" char datatoc_effect_translucency_frag_glsl[];
|
||||
extern "C" char datatoc_effect_velocity_resolve_frag_glsl[];
|
||||
extern "C" char datatoc_effect_velocity_tile_frag_glsl[];
|
||||
extern "C" char datatoc_irradiance_lib_glsl[];
|
||||
extern "C" char datatoc_lightprobe_cube_display_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_cube_display_vert_glsl[];
|
||||
extern "C" char datatoc_lightprobe_filter_diffuse_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_filter_glossy_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_filter_visibility_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_geom_glsl[];
|
||||
extern "C" char datatoc_lightprobe_grid_display_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_grid_display_vert_glsl[];
|
||||
extern "C" char datatoc_lightprobe_grid_fill_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_lib_glsl[];
|
||||
extern "C" char datatoc_lightprobe_planar_display_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_planar_display_vert_glsl[];
|
||||
extern "C" char datatoc_lightprobe_planar_downsample_frag_glsl[];
|
||||
extern "C" char datatoc_lightprobe_planar_downsample_geom_glsl[];
|
||||
extern "C" char datatoc_lightprobe_planar_downsample_vert_glsl[];
|
||||
extern "C" char datatoc_lightprobe_vert_glsl[];
|
||||
extern "C" char datatoc_lights_lib_glsl[];
|
||||
extern "C" char datatoc_closure_eval_lib_glsl[];
|
||||
extern "C" char datatoc_closure_eval_surface_lib_glsl[];
|
||||
@@ -239,30 +186,19 @@ extern "C" char datatoc_closure_eval_glossy_lib_glsl[];
|
||||
extern "C" char datatoc_closure_eval_refraction_lib_glsl[];
|
||||
extern "C" char datatoc_closure_eval_translucent_lib_glsl[];
|
||||
extern "C" char datatoc_ltc_lib_glsl[];
|
||||
extern "C" char datatoc_object_motion_frag_glsl[];
|
||||
extern "C" char datatoc_object_motion_vert_glsl[];
|
||||
extern "C" char datatoc_octahedron_lib_glsl[];
|
||||
extern "C" char datatoc_prepass_frag_glsl[];
|
||||
extern "C" char datatoc_random_lib_glsl[];
|
||||
extern "C" char datatoc_raytrace_lib_glsl[];
|
||||
extern "C" char datatoc_renderpass_lib_glsl[];
|
||||
extern "C" char datatoc_renderpass_postprocess_frag_glsl[];
|
||||
extern "C" char datatoc_shadow_accum_frag_glsl[];
|
||||
extern "C" char datatoc_shadow_frag_glsl[];
|
||||
extern "C" char datatoc_shadow_vert_glsl[];
|
||||
extern "C" char datatoc_ssr_lib_glsl[];
|
||||
extern "C" char datatoc_surface_frag_glsl[];
|
||||
extern "C" char datatoc_surface_geom_glsl[];
|
||||
extern "C" char datatoc_surface_lib_glsl[];
|
||||
extern "C" char datatoc_surface_vert_glsl[];
|
||||
extern "C" char datatoc_update_noise_frag_glsl[];
|
||||
extern "C" char datatoc_volumetric_accum_frag_glsl[];
|
||||
extern "C" char datatoc_volumetric_frag_glsl[];
|
||||
extern "C" char datatoc_volumetric_geom_glsl[];
|
||||
extern "C" char datatoc_volumetric_integration_frag_glsl[];
|
||||
extern "C" char datatoc_volumetric_lib_glsl[];
|
||||
extern "C" char datatoc_volumetric_resolve_frag_glsl[];
|
||||
extern "C" char datatoc_volumetric_scatter_frag_glsl[];
|
||||
extern "C" char datatoc_volumetric_vert_glsl[];
|
||||
extern "C" char datatoc_world_vert_glsl[];
|
||||
|
||||
@@ -273,6 +209,7 @@ static void eevee_shader_library_ensure(void)
|
||||
if (e_data.lib == nullptr) {
|
||||
e_data.lib = DRW_shader_library_create();
|
||||
/* NOTE: These need to be ordered by dependencies. */
|
||||
DRW_SHADER_LIB_ADD_SHARED(e_data.lib, engine_eevee_legacy_shared);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, common_math_lib);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, common_math_geom_lib);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, common_hair_lib);
|
||||
@@ -305,7 +242,6 @@ static void eevee_shader_library_ensure(void)
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, closure_eval_refraction_lib);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, closure_eval_surface_lib);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, closure_eval_volume_lib);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, cryptomatte_lib);
|
||||
DRW_SHADER_LIB_ADD(e_data.lib, surface_vert);
|
||||
|
||||
e_data.surface_lit_frag = DRW_shader_library_create_shader_string(e_data.lib,
|
||||
@@ -321,7 +257,6 @@ static void eevee_shader_library_ensure(void)
|
||||
|
||||
void EEVEE_shaders_material_shaders_init(void)
|
||||
{
|
||||
eevee_shader_extra_init();
|
||||
eevee_shader_library_ensure();
|
||||
}
|
||||
|
||||
@@ -333,117 +268,115 @@ DRWShaderLibrary *EEVEE_shader_lib_get(void)
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_filter_glossy_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_filter_glossy_sh == nullptr) {
|
||||
e_data.probe_filter_glossy_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_lightprobe_vert_glsl,
|
||||
datatoc_lightprobe_geom_glsl,
|
||||
datatoc_lightprobe_filter_glossy_frag_glsl,
|
||||
e_data.lib,
|
||||
filter_defines);
|
||||
if (e_data.probe_filter_glossy_sh == NULL) {
|
||||
e_data.probe_filter_glossy_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_probe_filter_glossy");
|
||||
}
|
||||
return e_data.probe_filter_glossy_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_filter_diffuse_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_filter_diffuse_sh == nullptr) {
|
||||
e_data.probe_filter_diffuse_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_lightprobe_filter_diffuse_frag_glsl, e_data.lib, filter_defines);
|
||||
if (e_data.probe_filter_diffuse_sh == NULL) {
|
||||
const char *create_info_name =
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
"eevee_legacy_probe_filter_diffuse_sh_l2";
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
"eevee_legacy_probe_filter_diffuse_hl2";
|
||||
#else
|
||||
nullptr;
|
||||
/* Should not reach this case. Either mode above should be defined. */
|
||||
BLI_assert_unreachable();
|
||||
#endif
|
||||
e_data.probe_filter_diffuse_sh = DRW_shader_create_from_info_name(create_info_name);
|
||||
}
|
||||
return e_data.probe_filter_diffuse_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_filter_visibility_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_filter_visibility_sh == nullptr) {
|
||||
e_data.probe_filter_visibility_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_lightprobe_filter_visibility_frag_glsl, e_data.lib, filter_defines);
|
||||
if (e_data.probe_filter_visibility_sh == NULL) {
|
||||
e_data.probe_filter_visibility_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_probe_filter_visiblity");
|
||||
}
|
||||
return e_data.probe_filter_visibility_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_grid_fill_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_grid_fill_sh == nullptr) {
|
||||
e_data.probe_grid_fill_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_lightprobe_grid_fill_frag_glsl, e_data.lib, filter_defines);
|
||||
if (e_data.probe_grid_fill_sh == NULL) {
|
||||
const char *create_info_name =
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
"eevee_legacy_probe_grid_fill_sh_l2";
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
"eevee_legacy_probe_grid_fill_hl2";
|
||||
#else
|
||||
nullptr;
|
||||
/* Should not reach this case. `data_size` will not be defined otherwise. */
|
||||
BLI_assert_unreachable();
|
||||
#endif
|
||||
e_data.probe_grid_fill_sh = DRW_shader_create_from_info_name(create_info_name);
|
||||
}
|
||||
return e_data.probe_grid_fill_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_planar_downsample_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_planar_downsample_sh == nullptr) {
|
||||
e_data.probe_planar_downsample_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_lightprobe_planar_downsample_vert_glsl,
|
||||
datatoc_lightprobe_planar_downsample_geom_glsl,
|
||||
datatoc_lightprobe_planar_downsample_frag_glsl,
|
||||
e_data.lib,
|
||||
nullptr);
|
||||
if (e_data.probe_planar_downsample_sh == NULL) {
|
||||
e_data.probe_planar_downsample_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_lightprobe_planar_downsample");
|
||||
}
|
||||
return e_data.probe_planar_downsample_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_studiolight_probe_sh_get(void)
|
||||
{
|
||||
if (e_data.studiolight_probe_sh == nullptr) {
|
||||
e_data.studiolight_probe_sh = DRW_shader_create_with_shaderlib(datatoc_background_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_lookdev_world_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES);
|
||||
if (e_data.studiolight_probe_sh == NULL) {
|
||||
e_data.studiolight_probe_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_studiolight_probe");
|
||||
}
|
||||
return e_data.studiolight_probe_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_studiolight_background_sh_get(void)
|
||||
{
|
||||
if (e_data.studiolight_background_sh == nullptr) {
|
||||
e_data.studiolight_background_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_background_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_lookdev_world_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define LOOKDEV_BG\n" SHADER_DEFINES);
|
||||
if (e_data.studiolight_background_sh == NULL) {
|
||||
e_data.studiolight_background_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_studiolight_background");
|
||||
}
|
||||
return e_data.studiolight_background_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_cube_display_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_cube_display_sh == nullptr) {
|
||||
e_data.probe_cube_display_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_lightprobe_cube_display_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_lightprobe_cube_display_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES);
|
||||
if (e_data.probe_cube_display_sh == NULL) {
|
||||
e_data.probe_cube_display_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_lightprobe_cube_display");
|
||||
}
|
||||
return e_data.probe_cube_display_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_grid_display_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_grid_display_sh == nullptr) {
|
||||
e_data.probe_grid_display_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_lightprobe_grid_display_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_lightprobe_grid_display_frag_glsl,
|
||||
e_data.lib,
|
||||
filter_defines);
|
||||
if (e_data.probe_grid_display_sh == NULL) {
|
||||
const char *probe_display_grid_info_name = NULL;
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
probe_display_grid_info_name = "eevee_legacy_lightprobe_grid_display_common_sh_l2";
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
probe_display_grid_info_name = "eevee_legacy_lightprobe_grid_display_common_hl2";
|
||||
#endif
|
||||
BLI_assert(probe_display_grid_info_name != NULL);
|
||||
|
||||
e_data.probe_grid_display_sh = DRW_shader_create_from_info_name(probe_display_grid_info_name);
|
||||
}
|
||||
return e_data.probe_grid_display_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_probe_planar_display_sh_get(void)
|
||||
{
|
||||
if (e_data.probe_planar_display_sh == nullptr) {
|
||||
e_data.probe_planar_display_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_lightprobe_planar_display_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_lightprobe_planar_display_frag_glsl,
|
||||
e_data.lib,
|
||||
nullptr);
|
||||
if (e_data.probe_planar_display_sh == NULL) {
|
||||
e_data.probe_planar_display_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_probe_planar_display");
|
||||
}
|
||||
return e_data.probe_planar_display_sh;
|
||||
}
|
||||
@@ -454,118 +387,100 @@ GPUShader *EEVEE_shaders_probe_planar_display_sh_get(void)
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_color_copy_sh_get(void)
|
||||
{
|
||||
if (e_data.color_copy_sh == nullptr) {
|
||||
e_data.color_copy_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_downsample_frag_glsl, e_data.lib, "#define COPY_SRC\n");
|
||||
if (e_data.color_copy_sh == NULL) {
|
||||
e_data.color_copy_sh = DRW_shader_create_from_info_name("eevee_legacy_color_copy");
|
||||
}
|
||||
return e_data.color_copy_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_downsample_sh_get(void)
|
||||
{
|
||||
if (e_data.downsample_sh == nullptr) {
|
||||
e_data.downsample_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_downsample_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.downsample_sh == NULL) {
|
||||
e_data.downsample_sh = DRW_shader_create_from_info_name("eevee_legacy_downsample");
|
||||
}
|
||||
return e_data.downsample_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_downsample_cube_sh_get(void)
|
||||
{
|
||||
if (e_data.downsample_cube_sh == nullptr) {
|
||||
e_data.downsample_cube_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_lightprobe_vert_glsl,
|
||||
datatoc_lightprobe_geom_glsl,
|
||||
datatoc_effect_downsample_cube_frag_glsl,
|
||||
e_data.lib,
|
||||
nullptr);
|
||||
if (e_data.downsample_cube_sh == NULL) {
|
||||
e_data.downsample_cube_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_downsample_cube");
|
||||
}
|
||||
return e_data.downsample_cube_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_minz_downlevel_sh_get(void)
|
||||
{
|
||||
if (e_data.minz_downlevel_sh == nullptr) {
|
||||
e_data.minz_downlevel_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MIN_PASS\n");
|
||||
if (e_data.minz_downlevel_sh == NULL) {
|
||||
e_data.minz_downlevel_sh = DRW_shader_create_from_info_name("eevee_legacy_minz_downlevel");
|
||||
}
|
||||
return e_data.minz_downlevel_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_maxz_downlevel_sh_get(void)
|
||||
{
|
||||
if (e_data.maxz_downlevel_sh == nullptr) {
|
||||
e_data.maxz_downlevel_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MAX_PASS\n");
|
||||
if (e_data.maxz_downlevel_sh == NULL) {
|
||||
e_data.maxz_downlevel_sh = DRW_shader_create_from_info_name("eevee_legacy_maxz_downlevel");
|
||||
}
|
||||
return e_data.maxz_downlevel_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_minz_downdepth_sh_get(void)
|
||||
{
|
||||
if (e_data.minz_downdepth_sh == nullptr) {
|
||||
e_data.minz_downdepth_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MIN_PASS\n");
|
||||
if (e_data.minz_downdepth_sh == NULL) {
|
||||
e_data.minz_downdepth_sh = DRW_shader_create_from_info_name("eevee_legacy_minz_downdepth");
|
||||
}
|
||||
return e_data.minz_downdepth_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_maxz_downdepth_sh_get(void)
|
||||
{
|
||||
if (e_data.maxz_downdepth_sh == nullptr) {
|
||||
e_data.maxz_downdepth_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MAX_PASS\n");
|
||||
if (e_data.maxz_downdepth_sh == NULL) {
|
||||
e_data.maxz_downdepth_sh = DRW_shader_create_from_info_name("eevee_legacy_maxz_downdepth");
|
||||
}
|
||||
return e_data.maxz_downdepth_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_minz_downdepth_layer_sh_get(void)
|
||||
{
|
||||
if (e_data.minz_downdepth_layer_sh == nullptr) {
|
||||
e_data.minz_downdepth_layer_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MIN_PASS\n"
|
||||
"#define LAYERED\n");
|
||||
if (e_data.minz_downdepth_layer_sh == NULL) {
|
||||
e_data.minz_downdepth_layer_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_minz_downdepth_layer");
|
||||
}
|
||||
return e_data.minz_downdepth_layer_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_maxz_downdepth_layer_sh_get(void)
|
||||
{
|
||||
if (e_data.maxz_downdepth_layer_sh == nullptr) {
|
||||
e_data.maxz_downdepth_layer_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MAX_PASS\n"
|
||||
"#define LAYERED\n");
|
||||
if (e_data.maxz_downdepth_layer_sh == NULL) {
|
||||
e_data.maxz_downdepth_layer_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_maxz_downdepth_layer");
|
||||
}
|
||||
return e_data.maxz_downdepth_layer_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_maxz_copydepth_layer_sh_get(void)
|
||||
{
|
||||
if (e_data.maxz_copydepth_layer_sh == nullptr) {
|
||||
e_data.maxz_copydepth_layer_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MAX_PASS\n"
|
||||
"#define COPY_DEPTH\n"
|
||||
"#define LAYERED\n");
|
||||
if (e_data.maxz_copydepth_layer_sh == NULL) {
|
||||
e_data.maxz_copydepth_layer_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_maxz_copydepth_layer");
|
||||
}
|
||||
return e_data.maxz_copydepth_layer_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_minz_copydepth_sh_get(void)
|
||||
{
|
||||
if (e_data.minz_copydepth_sh == nullptr) {
|
||||
e_data.minz_copydepth_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MIN_PASS\n"
|
||||
"#define COPY_DEPTH\n");
|
||||
if (e_data.minz_copydepth_sh == NULL) {
|
||||
e_data.minz_copydepth_sh = DRW_shader_create_from_info_name("eevee_legacy_minz_copydepth");
|
||||
}
|
||||
return e_data.minz_copydepth_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_maxz_copydepth_sh_get(void)
|
||||
{
|
||||
if (e_data.maxz_copydepth_sh == nullptr) {
|
||||
e_data.maxz_copydepth_sh = DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
|
||||
"#define MAX_PASS\n"
|
||||
"#define COPY_DEPTH\n");
|
||||
if (e_data.maxz_copydepth_sh == NULL) {
|
||||
e_data.maxz_copydepth_sh = DRW_shader_create_from_info_name("eevee_legacy_maxz_copydepth");
|
||||
}
|
||||
return e_data.maxz_copydepth_sh;
|
||||
}
|
||||
@@ -578,18 +493,16 @@ GPUShader *EEVEE_shaders_effect_maxz_copydepth_sh_get(void)
|
||||
|
||||
GPUShader *EEVEE_shaders_ggx_lut_sh_get(void)
|
||||
{
|
||||
if (e_data.ggx_lut_sh == nullptr) {
|
||||
e_data.ggx_lut_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_bsdf_lut_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.ggx_lut_sh == NULL) {
|
||||
e_data.ggx_lut_sh = DRW_shader_create_from_info_name("eevee_legacy_ggx_lut_bsdf");
|
||||
}
|
||||
return e_data.ggx_lut_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_ggx_refraction_lut_sh_get(void)
|
||||
{
|
||||
if (e_data.ggx_refraction_lut_sh == nullptr) {
|
||||
e_data.ggx_refraction_lut_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_btdf_lut_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.ggx_refraction_lut_sh == NULL) {
|
||||
e_data.ggx_refraction_lut_sh = DRW_shader_create_from_info_name("eevee_legacy_ggx_lut_btdf");
|
||||
}
|
||||
return e_data.ggx_refraction_lut_sh;
|
||||
}
|
||||
@@ -602,9 +515,8 @@ GPUShader *EEVEE_shaders_ggx_refraction_lut_sh_get(void)
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_mist_sh_get(void)
|
||||
{
|
||||
if (e_data.mist_sh == nullptr) {
|
||||
e_data.mist_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_mist_frag_glsl, e_data.lib, "#define FIRST_PASS\n");
|
||||
if (e_data.mist_sh == NULL) {
|
||||
e_data.mist_sh = DRW_shader_create_from_info_name("eevee_legacy_effect_mist_FIRST_PASS");
|
||||
}
|
||||
return e_data.mist_sh;
|
||||
}
|
||||
@@ -618,52 +530,44 @@ GPUShader *EEVEE_shaders_effect_mist_sh_get(void)
|
||||
#define TILE_SIZE_STR "#define EEVEE_VELOCITY_TILE_SIZE " STRINGIFY(EEVEE_VELOCITY_TILE_SIZE) "\n"
|
||||
GPUShader *EEVEE_shaders_effect_motion_blur_sh_get(void)
|
||||
{
|
||||
if (e_data.motion_blur_sh == nullptr) {
|
||||
e_data.motion_blur_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_motion_blur_frag_glsl, e_data.lib, TILE_SIZE_STR);
|
||||
if (e_data.motion_blur_sh == NULL) {
|
||||
e_data.motion_blur_sh = DRW_shader_create_from_info_name("eevee_legacy_effect_motion_blur");
|
||||
}
|
||||
return e_data.motion_blur_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_motion_blur_object_sh_get(void)
|
||||
{
|
||||
if (e_data.motion_blur_object_sh == nullptr) {
|
||||
e_data.motion_blur_object_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_object_motion_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_object_motion_frag_glsl,
|
||||
e_data.lib,
|
||||
nullptr);
|
||||
if (e_data.motion_blur_object_sh == NULL) {
|
||||
e_data.motion_blur_object_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_motion_blur_object");
|
||||
}
|
||||
return e_data.motion_blur_object_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_motion_blur_hair_sh_get(void)
|
||||
{
|
||||
if (e_data.motion_blur_hair_sh == nullptr) {
|
||||
e_data.motion_blur_hair_sh = DRW_shader_create_with_shaderlib(datatoc_object_motion_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_object_motion_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define HAIR\n");
|
||||
if (e_data.motion_blur_hair_sh == NULL) {
|
||||
e_data.motion_blur_hair_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_motion_blur_object_hair");
|
||||
}
|
||||
return e_data.motion_blur_hair_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_motion_blur_velocity_tiles_sh_get(void)
|
||||
{
|
||||
if (e_data.velocity_tiles_sh == nullptr) {
|
||||
e_data.velocity_tiles_sh = DRW_shader_create_fullscreen(datatoc_effect_velocity_tile_frag_glsl,
|
||||
"#define TILE_GATHER\n" TILE_SIZE_STR);
|
||||
if (e_data.velocity_tiles_sh == NULL) {
|
||||
e_data.velocity_tiles_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_motion_blur_velocity_tiles_GATHER");
|
||||
}
|
||||
return e_data.velocity_tiles_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_motion_blur_velocity_tiles_expand_sh_get(void)
|
||||
{
|
||||
if (e_data.velocity_tiles_expand_sh == nullptr) {
|
||||
e_data.velocity_tiles_expand_sh = DRW_shader_create_fullscreen(
|
||||
datatoc_effect_velocity_tile_frag_glsl, "#define TILE_EXPANSION\n" TILE_SIZE_STR);
|
||||
if (e_data.velocity_tiles_expand_sh == NULL) {
|
||||
e_data.velocity_tiles_expand_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_motion_blur_velocity_tiles_EXPANSION");
|
||||
}
|
||||
return e_data.velocity_tiles_expand_sh;
|
||||
}
|
||||
@@ -678,21 +582,17 @@ GPUShader *EEVEE_shaders_effect_motion_blur_velocity_tiles_expand_sh_get(void)
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_ambient_occlusion_sh_get(void)
|
||||
{
|
||||
if (e_data.gtao_sh == nullptr) {
|
||||
e_data.gtao_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_gtao_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.gtao_sh == NULL) {
|
||||
e_data.gtao_sh = DRW_shader_create_from_info_name("eevee_legacy_ambient_occlusion");
|
||||
}
|
||||
return e_data.gtao_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_effect_ambient_occlusion_debug_sh_get(void)
|
||||
{
|
||||
if (e_data.gtao_debug_sh == nullptr) {
|
||||
e_data.gtao_debug_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_gtao_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define DEBUG_AO\n"
|
||||
"#define ENABLE_DEFERED_AO");
|
||||
if (e_data.gtao_debug_sh == NULL) {
|
||||
e_data.gtao_debug_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_ambient_occlusion_debug");
|
||||
}
|
||||
return e_data.gtao_debug_sh;
|
||||
}
|
||||
@@ -705,9 +605,8 @@ GPUShader *EEVEE_shaders_effect_ambient_occlusion_debug_sh_get(void)
|
||||
|
||||
GPUShader *EEVEE_shaders_renderpasses_post_process_sh_get(void)
|
||||
{
|
||||
if (e_data.postprocess_sh == nullptr) {
|
||||
e_data.postprocess_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_renderpass_postprocess_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.postprocess_sh == NULL) {
|
||||
e_data.postprocess_sh = DRW_shader_create_from_info_name("eevee_legacy_post_process");
|
||||
}
|
||||
return e_data.postprocess_sh;
|
||||
}
|
||||
@@ -721,24 +620,16 @@ GPUShader *EEVEE_shaders_renderpasses_post_process_sh_get(void)
|
||||
GPUShader *EEVEE_shaders_cryptomatte_sh_get(bool is_hair)
|
||||
{
|
||||
const int index = is_hair ? 1 : 0;
|
||||
if (e_data.cryptomatte_sh[index] == nullptr) {
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
BLI_dynstr_append(ds, SHADER_DEFINES);
|
||||
BLI_dynstr_append(ds, "#define attrib_load() \n");
|
||||
if (e_data.cryptomatte_sh[index] == NULL) {
|
||||
const char *crytomatte_sh_info_name = NULL;
|
||||
if (is_hair) {
|
||||
BLI_dynstr_append(ds, "#define HAIR_SHADER\n");
|
||||
crytomatte_sh_info_name = "eevee_legacy_cryptomatte_hair";
|
||||
}
|
||||
else {
|
||||
BLI_dynstr_append(ds, "#define MESH_SHADER\n");
|
||||
crytomatte_sh_info_name = "eevee_legacy_cryptomatte_mesh";
|
||||
}
|
||||
char *defines = BLI_dynstr_get_cstring(ds);
|
||||
e_data.cryptomatte_sh[index] = DRW_shader_create_with_shaderlib(datatoc_cryptomatte_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_cryptomatte_frag_glsl,
|
||||
e_data.lib,
|
||||
defines);
|
||||
BLI_dynstr_free(ds);
|
||||
MEM_freeN(defines);
|
||||
|
||||
e_data.cryptomatte_sh[index] = DRW_shader_create_from_info_name(crytomatte_sh_info_name);
|
||||
}
|
||||
return e_data.cryptomatte_sh[index];
|
||||
}
|
||||
@@ -751,22 +642,18 @@ GPUShader *EEVEE_shaders_cryptomatte_sh_get(bool is_hair)
|
||||
|
||||
struct GPUShader *EEVEE_shaders_effect_reflection_trace_sh_get(void)
|
||||
{
|
||||
if (e_data.reflection_trace == nullptr) {
|
||||
e_data.reflection_trace = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_reflection_trace_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES "#define STEP_RAYTRACE\n");
|
||||
if (e_data.reflection_trace == NULL) {
|
||||
e_data.reflection_trace = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_reflection_trace");
|
||||
}
|
||||
return e_data.reflection_trace;
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_effect_reflection_resolve_sh_get(void)
|
||||
{
|
||||
if (e_data.reflection_resolve == nullptr) {
|
||||
e_data.reflection_resolve = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_reflection_resolve_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES "#define STEP_RESOLVE\n");
|
||||
if (e_data.reflection_resolve == NULL) {
|
||||
e_data.reflection_resolve = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_effect_reflection_resolve");
|
||||
}
|
||||
return e_data.reflection_resolve;
|
||||
}
|
||||
@@ -779,18 +666,16 @@ struct GPUShader *EEVEE_shaders_effect_reflection_resolve_sh_get(void)
|
||||
|
||||
struct GPUShader *EEVEE_shaders_shadow_sh_get()
|
||||
{
|
||||
if (e_data.shadow_sh == nullptr) {
|
||||
e_data.shadow_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_shadow_vert_glsl, nullptr, datatoc_shadow_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.shadow_sh == NULL) {
|
||||
e_data.shadow_sh = DRW_shader_create_from_info_name("eevee_legacy_shader_shadow");
|
||||
}
|
||||
return e_data.shadow_sh;
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_shadow_accum_sh_get()
|
||||
{
|
||||
if (e_data.shadow_accum_sh == nullptr) {
|
||||
e_data.shadow_accum_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_shadow_accum_frag_glsl, e_data.lib, SHADER_DEFINES);
|
||||
if (e_data.shadow_accum_sh == NULL) {
|
||||
e_data.shadow_accum_sh = DRW_shader_create_from_info_name("eevee_legacy_shader_shadow_accum");
|
||||
}
|
||||
return e_data.shadow_accum_sh;
|
||||
}
|
||||
@@ -803,29 +688,28 @@ struct GPUShader *EEVEE_shaders_shadow_accum_sh_get()
|
||||
|
||||
struct GPUShader *EEVEE_shaders_subsurface_first_pass_sh_get()
|
||||
{
|
||||
if (e_data.sss_sh[0] == nullptr) {
|
||||
e_data.sss_sh[0] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_subsurface_frag_glsl, e_data.lib, "#define FIRST_PASS\n");
|
||||
if (e_data.sss_sh[0] == NULL) {
|
||||
e_data.sss_sh[0] = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_shader_effect_subsurface_common_FIRST_PASS");
|
||||
}
|
||||
return e_data.sss_sh[0];
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_subsurface_second_pass_sh_get()
|
||||
{
|
||||
if (e_data.sss_sh[1] == nullptr) {
|
||||
e_data.sss_sh[1] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_subsurface_frag_glsl, e_data.lib, "#define SECOND_PASS\n");
|
||||
if (e_data.sss_sh[1] == NULL) {
|
||||
|
||||
e_data.sss_sh[1] = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_shader_effect_subsurface_common_SECOND_PASS");
|
||||
}
|
||||
return e_data.sss_sh[1];
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_subsurface_translucency_sh_get()
|
||||
{
|
||||
if (e_data.sss_sh[2] == nullptr) {
|
||||
e_data.sss_sh[2] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_translucency_frag_glsl,
|
||||
e_data.lib,
|
||||
"#define EEVEE_TRANSLUCENCY\n" SHADER_DEFINES);
|
||||
if (e_data.sss_sh[2] == NULL) {
|
||||
e_data.sss_sh[2] = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_shader_effect_subsurface_translucency");
|
||||
}
|
||||
return e_data.sss_sh[2];
|
||||
}
|
||||
@@ -838,62 +722,35 @@ struct GPUShader *EEVEE_shaders_subsurface_translucency_sh_get()
|
||||
|
||||
struct GPUShader *EEVEE_shaders_volumes_clear_sh_get()
|
||||
{
|
||||
if (e_data.volumetric_clear_sh == nullptr) {
|
||||
e_data.volumetric_clear_sh = DRW_shader_create_with_shaderlib(datatoc_volumetric_vert_glsl,
|
||||
datatoc_volumetric_geom_glsl,
|
||||
datatoc_volumetric_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES
|
||||
"#define STANDALONE\n"
|
||||
"#define VOLUMETRICS\n"
|
||||
"#define CLEAR\n");
|
||||
if (e_data.volumetric_clear_sh == NULL) {
|
||||
e_data.volumetric_clear_sh = DRW_shader_create_from_info_name("eevee_legacy_volumes_clear");
|
||||
}
|
||||
return e_data.volumetric_clear_sh;
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_volumes_scatter_sh_get()
|
||||
{
|
||||
if (e_data.scatter_sh == nullptr) {
|
||||
e_data.scatter_sh = DRW_shader_create_with_shaderlib(datatoc_volumetric_vert_glsl,
|
||||
datatoc_volumetric_geom_glsl,
|
||||
datatoc_volumetric_scatter_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES
|
||||
"#define STANDALONE\n"
|
||||
"#define VOLUMETRICS\n"
|
||||
"#define VOLUME_SHADOW\n");
|
||||
if (e_data.scatter_sh == NULL) {
|
||||
e_data.scatter_sh = DRW_shader_create_from_info_name("eevee_legacy_volumes_scatter");
|
||||
}
|
||||
return e_data.scatter_sh;
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_volumes_scatter_with_lights_sh_get()
|
||||
{
|
||||
if (e_data.scatter_with_lights_sh == nullptr) {
|
||||
e_data.scatter_with_lights_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_volumetric_vert_glsl,
|
||||
datatoc_volumetric_geom_glsl,
|
||||
datatoc_volumetric_scatter_frag_glsl,
|
||||
e_data.lib,
|
||||
SHADER_DEFINES
|
||||
"#define STANDALONE\n"
|
||||
"#define VOLUMETRICS\n"
|
||||
"#define VOLUME_LIGHTING\n"
|
||||
"#define VOLUME_SHADOW\n");
|
||||
if (e_data.scatter_with_lights_sh == NULL) {
|
||||
e_data.scatter_with_lights_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_volumes_scatter_with_lights");
|
||||
}
|
||||
return e_data.scatter_with_lights_sh;
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_volumes_integration_sh_get()
|
||||
{
|
||||
if (e_data.volumetric_integration_sh == nullptr) {
|
||||
e_data.volumetric_integration_sh = DRW_shader_create_with_shaderlib(
|
||||
datatoc_volumetric_vert_glsl,
|
||||
datatoc_volumetric_geom_glsl,
|
||||
datatoc_volumetric_integration_frag_glsl,
|
||||
e_data.lib,
|
||||
USE_VOLUME_OPTI ? "#define USE_VOLUME_OPTI\n"
|
||||
"#define STANDALONE\n" SHADER_DEFINES :
|
||||
"#define STANDALONE\n" SHADER_DEFINES);
|
||||
if (e_data.volumetric_integration_sh == NULL) {
|
||||
e_data.volumetric_integration_sh = DRW_shader_create_from_info_name(
|
||||
(USE_VOLUME_OPTI) ? "eevee_legacy_volumes_integration_OPTI" :
|
||||
"eevee_legacy_volumes_integration");
|
||||
}
|
||||
return e_data.volumetric_integration_sh;
|
||||
}
|
||||
@@ -901,20 +758,17 @@ struct GPUShader *EEVEE_shaders_volumes_integration_sh_get()
|
||||
struct GPUShader *EEVEE_shaders_volumes_resolve_sh_get(bool accum)
|
||||
{
|
||||
const int index = accum ? 1 : 0;
|
||||
if (e_data.volumetric_resolve_sh[index] == nullptr) {
|
||||
e_data.volumetric_resolve_sh[index] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_volumetric_resolve_frag_glsl,
|
||||
e_data.lib,
|
||||
accum ? "#define VOLUMETRICS_ACCUM\n" SHADER_DEFINES : SHADER_DEFINES);
|
||||
if (e_data.volumetric_resolve_sh[index] == NULL) {
|
||||
e_data.volumetric_resolve_sh[index] = DRW_shader_create_from_info_name(
|
||||
(accum) ? "eevee_legacy_volumes_resolve_accum" : "eevee_legacy_volumes_resolve");
|
||||
}
|
||||
return e_data.volumetric_resolve_sh[index];
|
||||
}
|
||||
|
||||
struct GPUShader *EEVEE_shaders_volumes_accum_sh_get()
|
||||
{
|
||||
if (e_data.volumetric_accum_sh == nullptr) {
|
||||
e_data.volumetric_accum_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_volumetric_accum_frag_glsl, e_data.lib, SHADER_DEFINES);
|
||||
if (e_data.volumetric_accum_sh == NULL) {
|
||||
e_data.volumetric_accum_sh = DRW_shader_create_from_info_name("eevee_legacy_volumes_accum");
|
||||
}
|
||||
return e_data.volumetric_accum_sh;
|
||||
}
|
||||
@@ -923,39 +777,35 @@ struct GPUShader *EEVEE_shaders_volumes_accum_sh_get()
|
||||
|
||||
GPUShader *EEVEE_shaders_velocity_resolve_sh_get(void)
|
||||
{
|
||||
if (e_data.velocity_resolve_sh == nullptr) {
|
||||
e_data.velocity_resolve_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_velocity_resolve_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.velocity_resolve_sh == NULL) {
|
||||
e_data.velocity_resolve_sh = DRW_shader_create_from_info_name("eevee_legacy_velocity_resolve");
|
||||
}
|
||||
return e_data.velocity_resolve_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_update_noise_sh_get(void)
|
||||
{
|
||||
if (e_data.update_noise_sh == nullptr) {
|
||||
e_data.update_noise_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_update_noise_frag_glsl, e_data.lib, nullptr);
|
||||
if (e_data.update_noise_sh == NULL) {
|
||||
e_data.update_noise_sh = DRW_shader_create_from_info_name("eevee_legacy_update_noise");
|
||||
}
|
||||
return e_data.update_noise_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_taa_resolve_sh_get(EEVEE_EffectsFlag enabled_effects)
|
||||
{
|
||||
GPUShader **sh;
|
||||
const char *define = nullptr;
|
||||
if (enabled_effects & EFFECT_TAA_REPROJECT) {
|
||||
sh = &e_data.taa_resolve_reproject_sh;
|
||||
define = "#define USE_REPROJECTION\n";
|
||||
if (e_data.taa_resolve_reproject_sh == NULL) {
|
||||
e_data.taa_resolve_reproject_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_taa_resolve_reprojection");
|
||||
}
|
||||
return e_data.taa_resolve_reproject_sh;
|
||||
}
|
||||
else {
|
||||
sh = &e_data.taa_resolve_sh;
|
||||
if (e_data.taa_resolve_sh == NULL) {
|
||||
e_data.taa_resolve_sh = DRW_shader_create_from_info_name("eevee_legacy_taa_resolve_basic");
|
||||
}
|
||||
return e_data.taa_resolve_sh;
|
||||
}
|
||||
if (*sh == nullptr) {
|
||||
*sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_temporal_aa_glsl, e_data.lib, define);
|
||||
}
|
||||
|
||||
return *sh;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -966,12 +816,9 @@ GPUShader *EEVEE_shaders_bloom_blit_get(bool high_quality)
|
||||
{
|
||||
int index = high_quality ? 1 : 0;
|
||||
|
||||
if (e_data.bloom_blit_sh[index] == nullptr) {
|
||||
const char *define = high_quality ? "#define STEP_BLIT\n"
|
||||
"#define HIGH_QUALITY\n" :
|
||||
"#define STEP_BLIT\n";
|
||||
e_data.bloom_blit_sh[index] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_bloom_frag_glsl, e_data.lib, define);
|
||||
if (e_data.bloom_blit_sh[index] == NULL) {
|
||||
e_data.bloom_blit_sh[index] = DRW_shader_create_from_info_name(
|
||||
high_quality ? "eevee_legacy_bloom_blit_hq" : "eevee_legacy_bloom_blit");
|
||||
}
|
||||
return e_data.bloom_blit_sh[index];
|
||||
}
|
||||
@@ -980,12 +827,9 @@ GPUShader *EEVEE_shaders_bloom_downsample_get(bool high_quality)
|
||||
{
|
||||
int index = high_quality ? 1 : 0;
|
||||
|
||||
if (e_data.bloom_downsample_sh[index] == nullptr) {
|
||||
const char *define = high_quality ? "#define STEP_DOWNSAMPLE\n"
|
||||
"#define HIGH_QUALITY\n" :
|
||||
"#define STEP_DOWNSAMPLE\n";
|
||||
e_data.bloom_downsample_sh[index] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_bloom_frag_glsl, e_data.lib, define);
|
||||
if (e_data.bloom_downsample_sh[index] == NULL) {
|
||||
e_data.bloom_downsample_sh[index] = DRW_shader_create_from_info_name(
|
||||
high_quality ? "eevee_legacy_bloom_downsample_hq" : "eevee_legacy_bloom_downsample");
|
||||
}
|
||||
return e_data.bloom_downsample_sh[index];
|
||||
}
|
||||
@@ -994,12 +838,9 @@ GPUShader *EEVEE_shaders_bloom_upsample_get(bool high_quality)
|
||||
{
|
||||
int index = high_quality ? 1 : 0;
|
||||
|
||||
if (e_data.bloom_upsample_sh[index] == nullptr) {
|
||||
const char *define = high_quality ? "#define STEP_UPSAMPLE\n"
|
||||
"#define HIGH_QUALITY\n" :
|
||||
"#define STEP_UPSAMPLE\n";
|
||||
e_data.bloom_upsample_sh[index] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_bloom_frag_glsl, e_data.lib, define);
|
||||
if (e_data.bloom_upsample_sh[index] == NULL) {
|
||||
e_data.bloom_upsample_sh[index] = DRW_shader_create_from_info_name(
|
||||
high_quality ? "eevee_legacy_bloom_upsample_hq" : "eevee_legacy_bloom_upsample");
|
||||
}
|
||||
return e_data.bloom_upsample_sh[index];
|
||||
}
|
||||
@@ -1008,12 +849,9 @@ GPUShader *EEVEE_shaders_bloom_resolve_get(bool high_quality)
|
||||
{
|
||||
int index = high_quality ? 1 : 0;
|
||||
|
||||
if (e_data.bloom_resolve_sh[index] == nullptr) {
|
||||
const char *define = high_quality ? "#define STEP_RESOLVE\n"
|
||||
"#define HIGH_QUALITY\n" :
|
||||
"#define STEP_RESOLVE\n";
|
||||
e_data.bloom_resolve_sh[index] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_bloom_frag_glsl, e_data.lib, define);
|
||||
if (e_data.bloom_resolve_sh[index] == NULL) {
|
||||
e_data.bloom_resolve_sh[index] = DRW_shader_create_from_info_name(
|
||||
high_quality ? "eevee_legacy_bloom_resolve_hq" : "eevee_legacy_bloom_resolve");
|
||||
}
|
||||
return e_data.bloom_resolve_sh[index];
|
||||
}
|
||||
@@ -1026,27 +864,25 @@ GPUShader *EEVEE_shaders_bloom_resolve_get(bool high_quality)
|
||||
|
||||
GPUShader *EEVEE_shaders_depth_of_field_bokeh_get(void)
|
||||
{
|
||||
if (e_data.dof_bokeh_sh == nullptr) {
|
||||
e_data.dof_bokeh_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_bokeh_frag_glsl, e_data.lib, DOF_SHADER_DEFINES);
|
||||
if (e_data.dof_bokeh_sh == NULL) {
|
||||
e_data.dof_bokeh_sh = DRW_shader_create_from_info_name("eevee_legacy_depth_of_field_bokeh");
|
||||
}
|
||||
return e_data.dof_bokeh_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_depth_of_field_setup_get(void)
|
||||
{
|
||||
if (e_data.dof_setup_sh == nullptr) {
|
||||
e_data.dof_setup_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_setup_frag_glsl, e_data.lib, DOF_SHADER_DEFINES);
|
||||
if (e_data.dof_setup_sh == NULL) {
|
||||
e_data.dof_setup_sh = DRW_shader_create_from_info_name("eevee_legacy_depth_of_field_setup");
|
||||
}
|
||||
return e_data.dof_setup_sh;
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_depth_of_field_flatten_tiles_get(void)
|
||||
{
|
||||
if (e_data.dof_flatten_tiles_sh == nullptr) {
|
||||
e_data.dof_flatten_tiles_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_flatten_tiles_frag_glsl, e_data.lib, DOF_SHADER_DEFINES);
|
||||
if (e_data.dof_flatten_tiles_sh == NULL) {
|
||||
e_data.dof_flatten_tiles_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_depth_of_field_flatten_tiles");
|
||||
}
|
||||
return e_data.dof_flatten_tiles_sh;
|
||||
}
|
||||
@@ -1054,21 +890,20 @@ GPUShader *EEVEE_shaders_depth_of_field_flatten_tiles_get(void)
|
||||
GPUShader *EEVEE_shaders_depth_of_field_dilate_tiles_get(bool b_pass)
|
||||
{
|
||||
int pass = b_pass;
|
||||
if (e_data.dof_dilate_tiles_sh[pass] == nullptr) {
|
||||
e_data.dof_dilate_tiles_sh[pass] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_dilate_tiles_frag_glsl,
|
||||
e_data.lib,
|
||||
(pass == 0) ? DOF_SHADER_DEFINES "#define DILATE_MODE_MIN_MAX\n" :
|
||||
DOF_SHADER_DEFINES "#define DILATE_MODE_MIN_ABS\n");
|
||||
if (e_data.dof_dilate_tiles_sh[pass] == NULL) {
|
||||
|
||||
e_data.dof_dilate_tiles_sh[pass] = DRW_shader_create_from_info_name(
|
||||
(pass == 0) ? "eevee_legacy_depth_of_field_dilate_tiles_MINMAX" :
|
||||
"eevee_legacy_depth_of_field_dilate_tiles_MINABS");
|
||||
}
|
||||
return e_data.dof_dilate_tiles_sh[pass];
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_depth_of_field_downsample_get(void)
|
||||
{
|
||||
if (e_data.dof_downsample_sh == nullptr) {
|
||||
e_data.dof_downsample_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_downsample_frag_glsl, e_data.lib, DOF_SHADER_DEFINES);
|
||||
if (e_data.dof_downsample_sh == NULL) {
|
||||
e_data.dof_downsample_sh = DRW_shader_create_from_info_name(
|
||||
"eevee_legacy_depth_of_field_downsample");
|
||||
}
|
||||
return e_data.dof_downsample_sh;
|
||||
}
|
||||
@@ -1076,12 +911,10 @@ GPUShader *EEVEE_shaders_depth_of_field_downsample_get(void)
|
||||
GPUShader *EEVEE_shaders_depth_of_field_reduce_get(bool b_is_copy_pass)
|
||||
{
|
||||
int is_copy_pass = b_is_copy_pass;
|
||||
if (e_data.dof_reduce_sh[is_copy_pass] == nullptr) {
|
||||
e_data.dof_reduce_sh[is_copy_pass] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_reduce_frag_glsl,
|
||||
e_data.lib,
|
||||
(is_copy_pass) ? DOF_SHADER_DEFINES "#define COPY_PASS\n" :
|
||||
DOF_SHADER_DEFINES "#define REDUCE_PASS\n");
|
||||
if (e_data.dof_reduce_sh[is_copy_pass] == NULL) {
|
||||
e_data.dof_reduce_sh[is_copy_pass] = DRW_shader_create_from_info_name(
|
||||
(is_copy_pass) ? "eevee_legacy_depth_of_field_reduce_COPY_PASS" :
|
||||
"eevee_legacy_depth_of_field_reduce_REDUCE_PASS");
|
||||
}
|
||||
return e_data.dof_reduce_sh[is_copy_pass];
|
||||
}
|
||||
@@ -1089,47 +922,39 @@ GPUShader *EEVEE_shaders_depth_of_field_reduce_get(bool b_is_copy_pass)
|
||||
GPUShader *EEVEE_shaders_depth_of_field_gather_get(EEVEE_DofGatherPass pass, bool b_use_bokeh_tx)
|
||||
{
|
||||
int use_bokeh_tx = b_use_bokeh_tx;
|
||||
if (e_data.dof_gather_sh[pass][use_bokeh_tx] == nullptr) {
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
|
||||
BLI_dynstr_append(ds, DOF_SHADER_DEFINES);
|
||||
|
||||
if (e_data.dof_gather_sh[pass][use_bokeh_tx] == NULL) {
|
||||
const char *dof_gather_info_name = NULL;
|
||||
switch (pass) {
|
||||
case DOF_GATHER_FOREGROUND:
|
||||
BLI_dynstr_append(ds, "#define DOF_FOREGROUND_PASS\n");
|
||||
dof_gather_info_name = (b_use_bokeh_tx) ?
|
||||
"eevee_legacy_depth_of_field_gather_FOREGROUND_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_gather_FOREGROUND";
|
||||
break;
|
||||
case DOF_GATHER_BACKGROUND:
|
||||
BLI_dynstr_append(ds, "#define DOF_BACKGROUND_PASS\n");
|
||||
dof_gather_info_name = (b_use_bokeh_tx) ?
|
||||
"eevee_legacy_depth_of_field_gather_BACKGROUND_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_gather_BACKGROUND";
|
||||
break;
|
||||
case DOF_GATHER_HOLEFILL:
|
||||
BLI_dynstr_append(ds,
|
||||
"#define DOF_BACKGROUND_PASS\n"
|
||||
"#define DOF_HOLEFILL_PASS\n");
|
||||
dof_gather_info_name = (b_use_bokeh_tx) ?
|
||||
"eevee_legacy_depth_of_field_gather_HOLEFILL_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_gather_HOLEFILL";
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
if (use_bokeh_tx) {
|
||||
BLI_dynstr_append(ds, "#define DOF_BOKEH_TEXTURE\n");
|
||||
}
|
||||
|
||||
char *define = BLI_dynstr_get_cstring(ds);
|
||||
BLI_dynstr_free(ds);
|
||||
|
||||
e_data.dof_gather_sh[pass][use_bokeh_tx] = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_gather_frag_glsl, e_data.lib, define);
|
||||
|
||||
MEM_freeN(define);
|
||||
BLI_assert(dof_gather_info_name != NULL);
|
||||
e_data.dof_gather_sh[pass][use_bokeh_tx] = DRW_shader_create_from_info_name(
|
||||
dof_gather_info_name);
|
||||
}
|
||||
return e_data.dof_gather_sh[pass][use_bokeh_tx];
|
||||
}
|
||||
|
||||
GPUShader *EEVEE_shaders_depth_of_field_filter_get(void)
|
||||
{
|
||||
if (e_data.dof_filter_sh == nullptr) {
|
||||
e_data.dof_filter_sh = DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_filter_frag_glsl, e_data.lib, DOF_SHADER_DEFINES);
|
||||
if (e_data.dof_filter_sh == NULL) {
|
||||
e_data.dof_filter_sh = DRW_shader_create_from_info_name("eevee_legacy_depth_of_field_filter");
|
||||
}
|
||||
return e_data.dof_filter_sh;
|
||||
}
|
||||
@@ -1138,28 +963,21 @@ GPUShader *EEVEE_shaders_depth_of_field_scatter_get(bool b_is_foreground, bool b
|
||||
{
|
||||
int is_foreground = b_is_foreground;
|
||||
int use_bokeh_tx = b_use_bokeh_tx;
|
||||
if (e_data.dof_scatter_sh[is_foreground][use_bokeh_tx] == nullptr) {
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
|
||||
BLI_dynstr_append(ds, DOF_SHADER_DEFINES);
|
||||
BLI_dynstr_append(
|
||||
ds, (is_foreground) ? "#define DOF_FOREGROUND_PASS\n" : "#define DOF_BACKGROUND_PASS\n");
|
||||
|
||||
if (use_bokeh_tx) {
|
||||
BLI_dynstr_append(ds, "#define DOF_BOKEH_TEXTURE\n");
|
||||
if (e_data.dof_scatter_sh[is_foreground][use_bokeh_tx] == NULL) {
|
||||
const char *dof_filter_info_name = NULL;
|
||||
if (b_is_foreground) {
|
||||
dof_filter_info_name = (b_use_bokeh_tx) ?
|
||||
"eevee_legacy_depth_of_field_scatter_FOREGROUND_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_scatter_FOREGROUND";
|
||||
}
|
||||
|
||||
char *define = BLI_dynstr_get_cstring(ds);
|
||||
BLI_dynstr_free(ds);
|
||||
|
||||
e_data.dof_scatter_sh[is_foreground][use_bokeh_tx] = DRW_shader_create_with_shaderlib(
|
||||
datatoc_effect_dof_scatter_vert_glsl,
|
||||
nullptr,
|
||||
datatoc_effect_dof_scatter_frag_glsl,
|
||||
e_data.lib,
|
||||
define);
|
||||
|
||||
MEM_freeN(define);
|
||||
else {
|
||||
dof_filter_info_name = (b_use_bokeh_tx) ?
|
||||
"eevee_legacy_depth_of_field_scatter_BACKGROUND_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_scatter_BACKGROUND";
|
||||
}
|
||||
BLI_assert(dof_filter_info_name != NULL);
|
||||
e_data.dof_scatter_sh[is_foreground][use_bokeh_tx] = DRW_shader_create_from_info_name(
|
||||
dof_filter_info_name);
|
||||
}
|
||||
return e_data.dof_scatter_sh[is_foreground][use_bokeh_tx];
|
||||
}
|
||||
@@ -1168,26 +986,20 @@ GPUShader *EEVEE_shaders_depth_of_field_resolve_get(bool b_use_bokeh_tx, bool b_
|
||||
{
|
||||
int use_hq_gather = b_use_hq_gather;
|
||||
int use_bokeh_tx = b_use_bokeh_tx;
|
||||
if (e_data.dof_resolve_sh[use_bokeh_tx][use_hq_gather] == nullptr) {
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
if (e_data.dof_resolve_sh[use_bokeh_tx][use_hq_gather] == NULL) {
|
||||
const char *dof_resolve_info_name = NULL;
|
||||
|
||||
BLI_dynstr_append(ds, DOF_SHADER_DEFINES);
|
||||
BLI_dynstr_append(ds, "#define DOF_RESOLVE_PASS\n");
|
||||
|
||||
if (use_bokeh_tx) {
|
||||
BLI_dynstr_append(ds, "#define DOF_BOKEH_TEXTURE\n");
|
||||
if (b_use_hq_gather) {
|
||||
dof_resolve_info_name = (b_use_bokeh_tx) ? "eevee_legacy_depth_of_field_resolve_HQ_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_resolve_HQ";
|
||||
}
|
||||
|
||||
BLI_dynstr_appendf(ds, "#define DOF_SLIGHT_FOCUS_DENSITY %d\n", use_hq_gather ? 4 : 2);
|
||||
|
||||
char *define = BLI_dynstr_get_cstring(ds);
|
||||
BLI_dynstr_free(ds);
|
||||
|
||||
e_data.dof_resolve_sh[use_bokeh_tx][use_hq_gather] =
|
||||
DRW_shader_create_fullscreen_with_shaderlib(
|
||||
datatoc_effect_dof_resolve_frag_glsl, e_data.lib, define);
|
||||
|
||||
MEM_freeN(define);
|
||||
else {
|
||||
dof_resolve_info_name = (b_use_bokeh_tx) ? "eevee_legacy_depth_of_field_resolve_LQ_BOKEH" :
|
||||
"eevee_legacy_depth_of_field_resolve_LQ";
|
||||
}
|
||||
BLI_assert(dof_resolve_info_name != NULL);
|
||||
e_data.dof_resolve_sh[use_bokeh_tx][use_hq_gather] = DRW_shader_create_from_info_name(
|
||||
dof_resolve_info_name);
|
||||
}
|
||||
return e_data.dof_resolve_sh[use_bokeh_tx][use_hq_gather];
|
||||
}
|
||||
@@ -1343,12 +1155,143 @@ World *EEVEE_world_default_get(void)
|
||||
return e_data.default_world;
|
||||
}
|
||||
|
||||
/* Select create info configuration and base source for given material types.
|
||||
* Each configuration has an associated base source and create-info.
|
||||
* Source is provided separately, rather than via create-info as source is manipulated
|
||||
* by `eevee_shader_material_create_info_amend`.
|
||||
*
|
||||
* We also retain the previous behaviour for ensuring library includes occur in the
|
||||
* correct order. */
|
||||
static const char *eevee_get_vert_info(int options, char **r_src)
|
||||
{
|
||||
const char *info_name = NULL;
|
||||
|
||||
/* Permutations */
|
||||
const bool is_hair = (options & (VAR_MAT_HAIR)) != 0;
|
||||
const bool is_point_cloud = (options & (VAR_MAT_POINTCLOUD)) != 0;
|
||||
|
||||
if ((options & VAR_MAT_VOLUME) != 0) {
|
||||
*r_src = DRW_shader_library_create_shader_string(e_data.lib, datatoc_volumetric_vert_glsl);
|
||||
info_name = "eevee_legacy_material_volumetric_vert";
|
||||
}
|
||||
else if ((options & (VAR_WORLD_PROBE | VAR_WORLD_BACKGROUND)) != 0) {
|
||||
*r_src = DRW_shader_library_create_shader_string(e_data.lib, datatoc_world_vert_glsl);
|
||||
info_name = "eevee_legacy_material_world_vert";
|
||||
}
|
||||
else {
|
||||
*r_src = DRW_shader_library_create_shader_string(e_data.lib, datatoc_surface_vert_glsl);
|
||||
if (is_hair) {
|
||||
info_name = "eevee_legacy_mateiral_surface_vert_hair";
|
||||
}
|
||||
else if (is_point_cloud) {
|
||||
info_name = "eevee_legacy_mateiral_surface_vert_pointcloud";
|
||||
}
|
||||
else {
|
||||
info_name = "eevee_legacy_material_surface_vert";
|
||||
}
|
||||
}
|
||||
|
||||
return info_name;
|
||||
}
|
||||
|
||||
static const char *eevee_get_geom_info(int options, char **r_src)
|
||||
{
|
||||
const char *info_name = NULL;
|
||||
if (GPU_backend_get_type() == GPU_BACKEND_METAL) {
|
||||
/* Geometry shading is unsupported in Metal. Vertex-shader based workarounds will instead
|
||||
* be injected where appropriate. For volumetric rendering, volumetric_vert_no_geom replaces
|
||||
* the default volumetric_vert + volumetric_geom combination.
|
||||
* See: `source/blender/gpu/intern/gpu_shader_create_info.cc` for further details. */
|
||||
*r_src = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((options & VAR_MAT_VOLUME) != 0) {
|
||||
*r_src = DRW_shader_library_create_shader_string(e_data.lib, datatoc_volumetric_geom_glsl);
|
||||
info_name = "eevee_legacy_material_volumetric_geom";
|
||||
}
|
||||
|
||||
return info_name;
|
||||
}
|
||||
|
||||
static const char *eevee_get_frag_info(int options, char **r_src)
|
||||
{
|
||||
const char *info_name = NULL;
|
||||
|
||||
const bool is_alpha_hash = ((options & VAR_MAT_HASH) != 0);
|
||||
bool is_alpha_blend = ((options & VAR_MAT_BLEND) != 0);
|
||||
const bool is_hair = (options & (VAR_MAT_HAIR)) != 0;
|
||||
const bool is_point_cloud = (options & (VAR_MAT_POINTCLOUD)) != 0;
|
||||
|
||||
if ((options & VAR_MAT_VOLUME) != 0) {
|
||||
/* -- VOLUME FRAG -
|
||||
* Select create info permutation for `volume_frag`. */
|
||||
info_name = "eevee_legacy_material_volumetric_frag";
|
||||
*r_src = DRW_shader_library_create_shader_string(e_data.lib, datatoc_volumetric_frag_glsl);
|
||||
}
|
||||
else if ((options & VAR_MAT_DEPTH) != 0) {
|
||||
/* -- PREPASS FRAG -
|
||||
* Select create info permutation for `prepass_frag`. */
|
||||
|
||||
if (is_alpha_hash) {
|
||||
/* Alpha hash material variants. */
|
||||
if (is_hair) {
|
||||
info_name = "eevee_legacy_material_prepass_frag_alpha_hash_hair";
|
||||
}
|
||||
else if (is_point_cloud) {
|
||||
info_name = "eevee_legacy_material_prepass_frag_alpha_hash_pointcloud";
|
||||
}
|
||||
else {
|
||||
info_name = "eevee_legacy_material_prepass_frag_alpha_hash";
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Opaque material variants. */
|
||||
if (is_hair) {
|
||||
info_name = "eevee_legacy_material_prepass_frag_opaque_hair";
|
||||
}
|
||||
else if (is_point_cloud) {
|
||||
info_name = "eevee_legacy_material_prepass_frag_opaque_pointcloud";
|
||||
}
|
||||
else {
|
||||
info_name = "eevee_legacy_material_prepass_frag_opaque";
|
||||
}
|
||||
}
|
||||
*r_src = BLI_strdup(e_data.surface_prepass_frag);
|
||||
}
|
||||
else {
|
||||
/* -- SURFACE FRAG --
|
||||
* Select create info permutation for `surface_frag`. */
|
||||
if (is_alpha_blend) {
|
||||
info_name = "eevee_legacy_material_surface_frag_alpha_blend";
|
||||
}
|
||||
else {
|
||||
info_name = "eevee_legacy_material_surface_frag_opaque";
|
||||
}
|
||||
*r_src = BLI_strdup(e_data.surface_lit_frag);
|
||||
}
|
||||
|
||||
return info_name;
|
||||
}
|
||||
|
||||
static char *eevee_get_defines(int options)
|
||||
{
|
||||
char *str = nullptr;
|
||||
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
BLI_dynstr_append(ds, SHADER_DEFINES);
|
||||
|
||||
/* Global EEVEE defines included for CreateInfo shaders via `engine_eevee_shared_defines.h` in
|
||||
* eevee_legacy_common_lib CreateInfo. */
|
||||
|
||||
/* Defines which affect bindings are instead injected via CreateInfo permutations. To specify new
|
||||
* permutations, references to GPUShaderCreateInfo variants should be fetched in:
|
||||
* `eevee_get_vert/geom/frag_info(..)`
|
||||
*
|
||||
* CreateInfo's for EEVEE materials are declared in:
|
||||
* `eevee/shaders/infos/eevee_legacy_material_info.hh`
|
||||
*
|
||||
* This function should only contain defines which alter behaviour, but do not affect shader
|
||||
* resources. */
|
||||
|
||||
if ((options & VAR_WORLD_BACKGROUND) != 0) {
|
||||
BLI_dynstr_append(ds, "#define WORLD_BACKGROUND\n");
|
||||
@@ -1362,27 +1305,12 @@ static char *eevee_get_defines(int options)
|
||||
if ((options & VAR_MAT_DEPTH) != 0) {
|
||||
BLI_dynstr_append(ds, "#define DEPTH_SHADER\n");
|
||||
}
|
||||
if ((options & VAR_MAT_HAIR) != 0) {
|
||||
BLI_dynstr_append(ds, "#define HAIR_SHADER\n");
|
||||
}
|
||||
if ((options & VAR_MAT_POINTCLOUD) != 0) {
|
||||
BLI_dynstr_append(ds, "#define POINTCLOUD_SHADER\n");
|
||||
}
|
||||
if ((options & VAR_WORLD_PROBE) != 0) {
|
||||
BLI_dynstr_append(ds, "#define PROBE_CAPTURE\n");
|
||||
}
|
||||
if ((options & VAR_MAT_HASH) != 0) {
|
||||
BLI_dynstr_append(ds, "#define USE_ALPHA_HASH\n");
|
||||
}
|
||||
if ((options & VAR_MAT_BLEND) != 0) {
|
||||
BLI_dynstr_append(ds, "#define USE_ALPHA_BLEND\n");
|
||||
}
|
||||
if ((options & VAR_MAT_REFRACT) != 0) {
|
||||
BLI_dynstr_append(ds, "#define USE_REFRACTION\n");
|
||||
}
|
||||
if ((options & VAR_MAT_LOOKDEV) != 0) {
|
||||
BLI_dynstr_append(ds, "#define LOOKDEV\n");
|
||||
}
|
||||
if ((options & VAR_MAT_HOLDOUT) != 0) {
|
||||
BLI_dynstr_append(ds, "#define HOLDOUT\n");
|
||||
}
|
||||
@@ -1393,63 +1321,23 @@ static char *eevee_get_defines(int options)
|
||||
return str;
|
||||
}
|
||||
|
||||
static char *eevee_get_vert(int options)
|
||||
{
|
||||
char *str = nullptr;
|
||||
|
||||
if ((options & VAR_MAT_VOLUME) != 0) {
|
||||
str = DRW_shader_library_create_shader_string(e_data.lib, datatoc_volumetric_vert_glsl);
|
||||
}
|
||||
else if ((options & (VAR_WORLD_PROBE | VAR_WORLD_BACKGROUND)) != 0) {
|
||||
str = DRW_shader_library_create_shader_string(e_data.lib, datatoc_world_vert_glsl);
|
||||
}
|
||||
else {
|
||||
str = DRW_shader_library_create_shader_string(e_data.lib, datatoc_surface_vert_glsl);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static char *eevee_get_geom(int options)
|
||||
{
|
||||
char *str = nullptr;
|
||||
|
||||
if ((options & VAR_MAT_VOLUME) != 0) {
|
||||
str = DRW_shader_library_create_shader_string(e_data.lib, datatoc_volumetric_geom_glsl);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static char *eevee_get_frag(int options)
|
||||
{
|
||||
char *str = nullptr;
|
||||
|
||||
if ((options & VAR_MAT_VOLUME) != 0) {
|
||||
str = DRW_shader_library_create_shader_string(e_data.lib, datatoc_volumetric_frag_glsl);
|
||||
}
|
||||
else if ((options & VAR_MAT_DEPTH) != 0) {
|
||||
str = BLI_strdup(e_data.surface_prepass_frag);
|
||||
}
|
||||
else {
|
||||
str = BLI_strdup(e_data.surface_lit_frag);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static void eevee_material_post_eval(void *UNUSED(thunk),
|
||||
GPUMaterial *mat,
|
||||
GPUCodegenOutput *codegen)
|
||||
{
|
||||
/* Fetch material-specific Create-info's and source. */
|
||||
uint64_t options = GPU_material_uuid_get(mat);
|
||||
char *vert = NULL;
|
||||
char *geom = NULL;
|
||||
char *frag = NULL;
|
||||
|
||||
char *vert = eevee_get_vert(options);
|
||||
char *geom = eevee_get_geom(options);
|
||||
char *frag = eevee_get_frag(options);
|
||||
const char *vert_info_name = eevee_get_vert_info(options, &vert);
|
||||
const char *geom_info_name = eevee_get_geom_info(options, &geom);
|
||||
const char *frag_info_name = eevee_get_frag_info(options, &frag);
|
||||
char *defines = eevee_get_defines(options);
|
||||
|
||||
eevee_shader_material_create_info_amend(mat, codegen, frag, vert, geom, defines);
|
||||
eevee_shader_material_create_info_amend(
|
||||
mat, codegen, vert, geom, frag, vert_info_name, geom_info_name, frag_info_name, defines);
|
||||
|
||||
MEM_SAFE_FREE(defines);
|
||||
MEM_SAFE_FREE(vert);
|
||||
@@ -1525,7 +1413,6 @@ struct GPUMaterial *EEVEE_material_get(
|
||||
|
||||
void EEVEE_shaders_free(void)
|
||||
{
|
||||
eevee_shader_extra_exit();
|
||||
MEM_SAFE_FREE(e_data.surface_prepass_frag);
|
||||
MEM_SAFE_FREE(e_data.surface_lit_frag);
|
||||
MEM_SAFE_FREE(e_data.surface_geom_barycentric);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -134,7 +134,7 @@ void film_sample_accum_mist(FilmSample samp, inout float accum)
|
||||
return;
|
||||
}
|
||||
float depth = texelFetch(depth_tx, samp.texel, 0).x;
|
||||
vec2 uv = (vec2(samp.texel) + 0.5) / textureSize(depth_tx, 0).xy;
|
||||
vec2 uv = (vec2(samp.texel) + 0.5) / vec2(textureSize(depth_tx, 0).xy);
|
||||
vec3 vP = get_view_space_from_depth(uv, depth);
|
||||
bool is_persp = ProjectionMatrix[3][3] == 0.0;
|
||||
float mist = (is_persp) ? length(vP) : abs(vP.z);
|
||||
@@ -159,10 +159,17 @@ void film_sample_accum_combined(FilmSample samp, inout vec4 accum, inout float w
|
||||
weight_accum += weight;
|
||||
}
|
||||
|
||||
#ifdef GPU_METAL
|
||||
void film_sample_cryptomatte_accum(FilmSample samp,
|
||||
int layer,
|
||||
sampler2D tex,
|
||||
thread vec2 *crypto_samples)
|
||||
#else
|
||||
void film_sample_cryptomatte_accum(FilmSample samp,
|
||||
int layer,
|
||||
sampler2D tex,
|
||||
inout vec2 crypto_samples[4])
|
||||
#endif
|
||||
{
|
||||
float hash = texelFetch(tex, samp.texel, 0)[layer];
|
||||
/* Find existing entry. */
|
||||
@@ -257,7 +264,11 @@ vec2 film_pixel_history_motion_vector(ivec2 texel_sample)
|
||||
/* \a t is inter-pixel position. 0 means perfectly on a pixel center.
|
||||
* Returns weights in both dimensions.
|
||||
* Multiply each dimension weights to get final pixel weights. */
|
||||
#ifdef GPU_METAL
|
||||
void film_get_catmull_rom_weights(vec2 t, thread vec2 *weights)
|
||||
#else
|
||||
void film_get_catmull_rom_weights(vec2 t, out vec2 weights[4])
|
||||
#endif
|
||||
{
|
||||
vec2 t2 = t * t;
|
||||
vec2 t3 = t2 * t;
|
||||
@@ -436,7 +447,7 @@ float film_history_blend_factor(float velocity,
|
||||
/* Linearly blend when history gets below to 25% of the bbox size. */
|
||||
blend *= saturate(distance_to_luma_clip * 4.0 + 0.1);
|
||||
/* Discard out of view history. */
|
||||
if (any(lessThan(texel, vec2(0))) || any(greaterThanEqual(texel, film_buf.extent))) {
|
||||
if (any(lessThan(texel, vec2(0))) || any(greaterThanEqual(texel, vec2(film_buf.extent)))) {
|
||||
blend = 1.0;
|
||||
}
|
||||
/* Discard history if invalid. */
|
||||
@@ -655,7 +666,7 @@ void film_process_data(ivec2 texel_film, out vec4 out_color, out float out_depth
|
||||
float depth = texelFetch(depth_tx, film_sample.texel, 0).x;
|
||||
vec4 vector = velocity_resolve(vector_tx, film_sample.texel, depth);
|
||||
/* Transform to pixel space. */
|
||||
vector *= vec4(film_buf.render_extent, -film_buf.render_extent);
|
||||
vector *= vec4(vec2(film_buf.render_extent), -vec2(film_buf.render_extent));
|
||||
|
||||
film_store_depth(texel_film, depth, out_depth);
|
||||
film_store_data(texel_film, film_buf.normal_id, normal, out_color);
|
||||
|
||||
@@ -39,7 +39,8 @@ GPU_SHADER_CREATE_INFO(eevee_film_frag)
|
||||
.do_static_compilation(true)
|
||||
.fragment_out(0, Type::VEC4, "out_color")
|
||||
.fragment_source("eevee_film_frag.glsl")
|
||||
.additional_info("draw_fullscreen", "eevee_film");
|
||||
.additional_info("draw_fullscreen", "eevee_film")
|
||||
.depth_write(DepthWrite::ANY);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_film_comp)
|
||||
.do_static_compilation(true)
|
||||
|
||||
@@ -49,7 +49,8 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid)
|
||||
.vertex_out(overlay_armature_sphere_solid_iface)
|
||||
.vertex_source("overlay_armature_sphere_solid_vert.glsl")
|
||||
.fragment_source("overlay_armature_sphere_solid_frag.glsl")
|
||||
.additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
|
||||
.additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals")
|
||||
.depth_write(DepthWrite::ANY);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped)
|
||||
.do_static_compilation(true)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifdef USE_CAVITY
|
||||
|
||||
void cavity_compute(vec2 screenco,
|
||||
sampler2D depthBuffer,
|
||||
depth2D depthBuffer,
|
||||
sampler2D normalBuffer,
|
||||
out float cavities,
|
||||
out float edges)
|
||||
|
||||
@@ -198,7 +198,7 @@ void DRW_texture_free(struct GPUTexture *tex);
|
||||
} while (0)
|
||||
|
||||
/* Shaders */
|
||||
|
||||
struct GPUShader *DRW_shader_create_from_info_name(const char *info_name);
|
||||
struct GPUShader *DRW_shader_create_ex(
|
||||
const char *vert, const char *geom, const char *frag, const char *defines, const char *name);
|
||||
struct GPUShader *DRW_shader_create_with_lib_ex(const char *vert,
|
||||
@@ -271,6 +271,9 @@ void DRW_shader_library_add_file(DRWShaderLibrary *lib,
|
||||
#define DRW_SHADER_LIB_ADD(lib, lib_name) \
|
||||
DRW_shader_library_add_file(lib, datatoc_##lib_name##_glsl, STRINGIFY(lib_name) ".glsl")
|
||||
|
||||
#define DRW_SHADER_LIB_ADD_SHARED(lib, lib_name) \
|
||||
DRW_shader_library_add_file(lib, datatoc_##lib_name##_h, STRINGIFY(lib_name) ".h")
|
||||
|
||||
/**
|
||||
* \return an allocN'ed string containing the shader code with its dependencies prepended.
|
||||
* Caller must free the string with #MEM_freeN after use.
|
||||
|
||||
@@ -2828,7 +2828,7 @@ void DRW_draw_depth_object(
|
||||
for (int i = 0; i < 6; i++) {
|
||||
copy_v4_v4(planes.world[i], rv3d->clip_local[i]);
|
||||
}
|
||||
copy_m4_m4(planes.ModelMatrix, object->object_to_world);
|
||||
copy_m4_m4(planes.ClipModelMatrix, object->object_to_world);
|
||||
}
|
||||
|
||||
drw_batch_cache_validate(object);
|
||||
@@ -3131,10 +3131,9 @@ void DRW_render_context_enable(Render *render)
|
||||
|
||||
void DRW_render_context_disable(Render *render)
|
||||
{
|
||||
GPU_render_end();
|
||||
|
||||
if (GPU_use_main_context_workaround()) {
|
||||
DRW_opengl_context_disable();
|
||||
GPU_render_end();
|
||||
GPU_context_main_unlock();
|
||||
return;
|
||||
}
|
||||
@@ -3144,11 +3143,14 @@ void DRW_render_context_disable(Render *render)
|
||||
if (re_gl_context != NULL) {
|
||||
void *re_gpu_context = NULL;
|
||||
re_gpu_context = RE_gpu_context_get(render);
|
||||
/* GPU rendering may occur during context disable. */
|
||||
DRW_gpu_render_context_disable(re_gpu_context);
|
||||
GPU_render_end();
|
||||
DRW_opengl_render_context_disable(re_gl_context);
|
||||
}
|
||||
else {
|
||||
DRW_opengl_context_disable();
|
||||
GPU_render_end();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,11 @@ void DRW_deferred_shader_remove(GPUMaterial *mat)
|
||||
|
||||
/** \{ */
|
||||
|
||||
GPUShader *DRW_shader_create_from_info_name(const char *info_name)
|
||||
{
|
||||
return GPU_shader_create_from_info_name(info_name);
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_ex(
|
||||
const char *vert, const char *geom, const char *frag, const char *defines, const char *name)
|
||||
{
|
||||
|
||||
@@ -39,21 +39,7 @@ static GPUShader *hair_refine_shader_compute_create(ParticleRefineShader /*refin
|
||||
|
||||
static GPUShader *hair_refine_shader_transform_feedback_create(ParticleRefineShader /*refinement*/)
|
||||
{
|
||||
GPUShader *sh = nullptr;
|
||||
|
||||
std::string shader_src = std::string(datatoc_common_hair_lib_glsl) +
|
||||
std::string(datatoc_common_hair_refine_vert_glsl);
|
||||
|
||||
const char *var_names[1] = {"finalColor"};
|
||||
sh = DRW_shader_create_with_transform_feedback(shader_src.c_str(),
|
||||
nullptr,
|
||||
"#define HAIR_PHASE_SUBDIV\n"
|
||||
"#define USE_TF\n",
|
||||
GPU_SHADER_TFB_POINTS,
|
||||
var_names,
|
||||
1);
|
||||
|
||||
return sh;
|
||||
return GPU_shader_create_from_info_name("legacy_hair_refine_shader_transform_feedback");
|
||||
}
|
||||
|
||||
static GPUShader *hair_refine_shader_transform_feedback_workaround_create(
|
||||
|
||||
@@ -22,7 +22,8 @@ typedef struct DRWDebugPrintBuffer DRWDebugPrintBuffer;
|
||||
typedef struct DRWDebugVert DRWDebugVert;
|
||||
typedef struct DRWDebugDrawBuffer DRWDebugDrawBuffer;
|
||||
|
||||
# ifdef __cplusplus
|
||||
/* __cplusplus is true when compiling with MSL. */
|
||||
# if defined(__cplusplus) && !defined(GPU_SHADER)
|
||||
/* C++ only forward declarations. */
|
||||
struct Object;
|
||||
struct ViewLayer;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Prototype of functions to implement to load attributes data.
|
||||
* Implementation changes based on object data type. */
|
||||
|
||||
#ifndef GPU_METAL /* MSL does not require prototypes. */
|
||||
vec3 attr_load_orco(vec4 orco);
|
||||
vec4 attr_load_tangent(vec4 tangent);
|
||||
vec4 attr_load_vec4(vec4 attr);
|
||||
@@ -26,3 +27,4 @@ float attr_load_float(sampler3D tex);
|
||||
float attr_load_temperature_post(float attr);
|
||||
vec4 attr_load_color_post(vec4 attr);
|
||||
vec4 attr_load_uniform(vec4 attr, const uint attr_hash);
|
||||
#endif
|
||||
|
||||
@@ -5,10 +5,15 @@
|
||||
* of data the CPU has to precompute and transfer for each update.
|
||||
*/
|
||||
|
||||
#define COMMON_HAIR_LIB
|
||||
/* Avoid including hair functionality for shaders and materials which do not require hair.
|
||||
* Required to prevent compilation failure for missing shader inputs and uniforms when hair library
|
||||
* is included via other libraries. These are only specified in the ShaderCreateInfo when needed.
|
||||
*/
|
||||
#ifdef HAIR_SHADER
|
||||
# define COMMON_HAIR_LIB
|
||||
|
||||
/* TODO(fclem): Keep documentation but remove the uniform declaration. */
|
||||
#ifndef USE_GPU_SHADER_CREATE_INFO
|
||||
# ifndef USE_GPU_SHADER_CREATE_INFO
|
||||
|
||||
/**
|
||||
* hairStrandsRes: Number of points per hair strand.
|
||||
@@ -46,10 +51,14 @@ uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
|
||||
/* Not used, use one buffer per uv layer */
|
||||
// uniform samplerBuffer hairUVBuffer; /* RG32F */
|
||||
// uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
|
||||
#endif
|
||||
# else
|
||||
# ifndef DRW_HAIR_INFO
|
||||
# error Ensure createInfo includes `draw_hair` for general use or `eevee_legacy_hair_lib` for EEVEE.
|
||||
# endif
|
||||
# endif /* !USE_GPU_SHADER_CREATE_INFO */
|
||||
|
||||
#define point_position xyz
|
||||
#define point_time w /* Position along the hair length */
|
||||
# define point_position xyz
|
||||
# define point_time w /* Position along the hair length */
|
||||
|
||||
/* -- Subdivision stage -- */
|
||||
/**
|
||||
@@ -60,7 +69,7 @@ uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
|
||||
* If no more subdivision is needed, we can skip this step.
|
||||
*/
|
||||
|
||||
#ifdef GPU_VERTEX_SHADER
|
||||
# ifdef GPU_VERTEX_SHADER
|
||||
float hair_get_local_time()
|
||||
{
|
||||
return float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
|
||||
@@ -70,9 +79,9 @@ int hair_get_id()
|
||||
{
|
||||
return gl_VertexID / hairStrandsRes;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef GPU_COMPUTE_SHADER
|
||||
# ifdef GPU_COMPUTE_SHADER
|
||||
float hair_get_local_time()
|
||||
{
|
||||
return float(gl_GlobalInvocationID.y) / float(hairStrandsRes - 1);
|
||||
@@ -82,9 +91,9 @@ int hair_get_id()
|
||||
{
|
||||
return int(gl_GlobalInvocationID.x) + hairStrandOffset;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef HAIR_PHASE_SUBDIV
|
||||
# ifdef HAIR_PHASE_SUBDIV
|
||||
int hair_get_base_id(float local_time, int strand_segments, out float interp_time)
|
||||
{
|
||||
float time_per_strand_seg = 1.0 / float(strand_segments);
|
||||
@@ -122,14 +131,14 @@ void hair_get_interp_attrs(
|
||||
data3 = data2 * 2.0 - data1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* -- Drawing stage -- */
|
||||
/**
|
||||
* For final drawing, the vertex index and the number of vertex per segment
|
||||
*/
|
||||
|
||||
#if !defined(HAIR_PHASE_SUBDIV) && defined(GPU_VERTEX_SHADER)
|
||||
# if !defined(HAIR_PHASE_SUBDIV) && defined(GPU_VERTEX_SHADER)
|
||||
|
||||
int hair_get_strand_id(void)
|
||||
{
|
||||
@@ -160,9 +169,9 @@ float hair_shaperadius(float shape, float root, float tip, float time)
|
||||
return (radius * (root - tip)) + tip;
|
||||
}
|
||||
|
||||
# if defined(OS_MAC) && defined(GPU_OPENGL)
|
||||
# if defined(OS_MAC) && defined(GPU_OPENGL)
|
||||
in float dummy;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
void hair_get_center_pos_tan_binor_time(bool is_persp,
|
||||
mat4 invmodel_mat,
|
||||
@@ -179,11 +188,11 @@ void hair_get_center_pos_tan_binor_time(bool is_persp,
|
||||
wpos = data.point_position;
|
||||
time = data.point_time;
|
||||
|
||||
# if defined(OS_MAC) && defined(GPU_OPENGL)
|
||||
# if defined(OS_MAC) && defined(GPU_OPENGL)
|
||||
/* Generate a dummy read to avoid the driver bug with shaders having no
|
||||
* vertex reads on macOS (T60171) */
|
||||
wpos.y += dummy * 0.0;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
if (time == 0.0) {
|
||||
/* Hair root */
|
||||
@@ -270,7 +279,7 @@ vec2 hair_get_barycentric(void)
|
||||
return vec2(float((id % 2) == 1), float(((id % 4) % 3) > 0));
|
||||
}
|
||||
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* To be fed the result of hair_get_barycentric from vertex shader. */
|
||||
vec2 hair_resolve_barycentric(vec2 vert_barycentric)
|
||||
@@ -288,11 +297,11 @@ vec4 hair_get_weights_cardinal(float t)
|
||||
{
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
#if defined(CARDINAL)
|
||||
# if defined(CARDINAL)
|
||||
float fc = 0.71;
|
||||
#else /* defined(CATMULL_ROM) */
|
||||
# else /* defined(CATMULL_ROM) */
|
||||
float fc = 0.5;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
vec4 weights;
|
||||
/* GLSL Optimized version of key_curve_position_weights() */
|
||||
@@ -324,3 +333,4 @@ vec4 hair_interp_data(vec4 v0, vec4 v1, vec4 v2, vec4 v3, vec4 w)
|
||||
{
|
||||
return v0 * w.x + v1 * w.y + v2 * w.z + v3 * w.w;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_hair_lib.glsl)
|
||||
|
||||
#ifdef USE_TF
|
||||
out vec4 finalColor;
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float interp_time;
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
|
||||
/* NOTE: To be used with UNIFORM_RESOURCE_ID and INSTANCED_ATTR as define. */
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#ifdef POINTCLOUD_SHADER
|
||||
# define COMMON_POINTCLOUD_LIB
|
||||
|
||||
# ifndef USE_GPU_SHADER_CREATE_INFO
|
||||
# ifndef DRW_SHADER_SHARED_H
|
||||
|
||||
in vec4 pos; /* Position and radius. */
|
||||
|
||||
/* ---- Instanced attribs ---- */
|
||||
|
||||
in vec3 pos_inst;
|
||||
in vec3 nor;
|
||||
|
||||
# endif
|
||||
# else
|
||||
# ifndef DRW_POINTCLOUD_INFO
|
||||
# error Ensure createInfo includes `draw_pointcloud`.
|
||||
# endif
|
||||
# endif /* !USE_GPU_SHADER_CREATE_INFO */
|
||||
|
||||
int pointcloud_get_point_id()
|
||||
{
|
||||
@@ -98,3 +117,4 @@ vec2 pointcloud_get_barycentric(void)
|
||||
/* TODO: To be implemented. */
|
||||
return vec2(0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3,26 +3,8 @@
|
||||
#ifndef COMMON_VIEW_LIB_GLSL
|
||||
#define COMMON_VIEW_LIB_GLSL
|
||||
|
||||
/* Temporary until we fully make the switch. */
|
||||
#if !defined(USE_GPU_SHADER_CREATE_INFO)
|
||||
|
||||
# define DRW_RESOURCE_CHUNK_LEN 512
|
||||
|
||||
/* keep in sync with DRWManager.view_data */
|
||||
layout(std140) uniform viewBlock
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ViewMatrixInverse;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 ProjectionMatrixInverse;
|
||||
};
|
||||
|
||||
#endif /* USE_GPU_SHADER_CREATE_INFO */
|
||||
|
||||
#ifdef USE_GPU_SHADER_CREATE_INFO
|
||||
# ifndef DRW_RESOURCE_CHUNK_LEN
|
||||
# error Missing draw_view additional create info on shader create info
|
||||
# endif
|
||||
#ifndef DRW_RESOURCE_CHUNK_LEN
|
||||
# error Missing draw_view additional create info on shader create info
|
||||
#endif
|
||||
|
||||
/* Not supported anymore. TODO(fclem): Add back support. */
|
||||
@@ -39,7 +21,7 @@ vec3 cameraVec(vec3 P)
|
||||
|
||||
#ifdef COMMON_GLOBALS_LIB
|
||||
/* TODO move to overlay engine. */
|
||||
float mul_project_m4_v3_zfac(in vec3 co)
|
||||
float mul_project_m4_v3_zfac(vec3 co)
|
||||
{
|
||||
vec3 vP = (ViewMatrix * vec4(co, 1.0)).xyz;
|
||||
return pixelFac * ((ProjectionMatrix[0][3] * vP.x) + (ProjectionMatrix[1][3] * vP.y) +
|
||||
@@ -144,7 +126,7 @@ uniform int drw_ResourceID;
|
||||
# define PASS_RESOURCE_ID drw_ResourceID_iface.resource_index = resource_id;
|
||||
|
||||
# elif defined(GPU_GEOMETRY_SHADER)
|
||||
# define resource_id drw_ResourceID_iface_in[0].index
|
||||
# define resource_id drw_ResourceID_iface_in[0].resource_index
|
||||
# define PASS_RESOURCE_ID drw_ResourceID_iface_out.resource_index = resource_id;
|
||||
|
||||
# elif defined(GPU_FRAGMENT_SHADER)
|
||||
|
||||
@@ -23,6 +23,8 @@ GPU_SHADER_CREATE_INFO(draw_hair_refine_compute)
|
||||
.push_constant(Type::INT, "hairStrandOffset")
|
||||
.compute_source("common_hair_refine_comp.glsl")
|
||||
.define("HAIR_PHASE_SUBDIV")
|
||||
.define("HAIR_SHADER")
|
||||
.define("DRW_HAIR_INFO")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(draw_hair_refine_transform_feedback_workaround_iface, "")
|
||||
|
||||
@@ -101,6 +101,8 @@ GPU_SHADER_CREATE_INFO(draw_globals)
|
||||
GPU_SHADER_CREATE_INFO(draw_mesh).additional_info("draw_modelmat", "draw_resource_id");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(draw_hair)
|
||||
.define("HAIR_SHADER")
|
||||
.define("DRW_HAIR_INFO")
|
||||
.sampler(15, ImageType::FLOAT_BUFFER, "hairPointBuffer")
|
||||
/* TODO(@fclem): Pack these into one UBO. */
|
||||
.push_constant(Type::INT, "hairStrandsRes")
|
||||
@@ -115,6 +117,11 @@ GPU_SHADER_CREATE_INFO(draw_hair)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(draw_pointcloud)
|
||||
.sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH)
|
||||
.define("POINTCLOUD_SHADER")
|
||||
.define("DRW_POINTCLOUD_INFO")
|
||||
.vertex_in(0, Type::VEC4, "pos")
|
||||
.vertex_in(1, Type::VEC3, "pos_inst")
|
||||
.vertex_in(2, Type::VEC3, "nor")
|
||||
.additional_info("draw_modelmat_instanced_attr", "draw_resource_id_uniform");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(draw_volume).additional_info("draw_modelmat", "draw_resource_id_uniform");
|
||||
|
||||
@@ -445,7 +445,7 @@ static void draw_marker_line(const uchar *color, int xpos, int ymin, int ymax)
|
||||
immUniformColor4ubv(color);
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2f(pos, xpos, ymin);
|
||||
|
||||
@@ -1733,7 +1733,7 @@ static void annotation_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_pt
|
||||
immUniformColor4f(1.0f, 0.39f, 0.39f, 0.78f);
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform1f("dash_width", 12.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_circle_wire_2d(shdr_pos,
|
||||
x,
|
||||
|
||||
@@ -2425,7 +2425,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
|
||||
immUniformColor4f(1.0f, 0.39f, 0.39f, 0.78f);
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform1f("dash_width", 12.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_circle_wire_2d(shdr_pos,
|
||||
x,
|
||||
|
||||
@@ -1706,7 +1706,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y)
|
||||
immUniformColor4f(1.0f, 0.39f, 0.39f, 0.78f);
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform1f("dash_width", 12.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_circle_wire_2d(shdr_pos,
|
||||
x,
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static void ui_draw_colorband_handle(uint shdr_pos,
|
||||
immUniform4f("color", 0.8f, 0.8f, 0.8f, 1.0f);
|
||||
immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
immUniform1f("dash_width", active ? 4.0f : 2.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2f(shdr_pos, x, y1);
|
||||
|
||||
@@ -475,7 +475,7 @@ static void mask_draw_curve_type(const bContext *C,
|
||||
immUniform4fv("color", colors[0]);
|
||||
immUniform4fv("color2", colors[1]);
|
||||
immUniform1f("dash_width", 4.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
GPU_line_width(1.0f);
|
||||
|
||||
mask_draw_array(pos, draw_method, points, tot_point);
|
||||
|
||||
@@ -179,7 +179,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
|
||||
immUniform4f("color", 0.0f, 0.0f, 0.0f, alpha);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, alpha);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ static void draw_stabilization_border(
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_box_wire_2d(shdr_pos, 0.0f, 0.0f, width, height);
|
||||
|
||||
@@ -777,14 +777,14 @@ static void draw_marker_areas(SpaceClip *sc,
|
||||
marker->pattern_corners[3])) {
|
||||
GPU_point_size(tiny ? 1.0f : 2.0f);
|
||||
|
||||
immUniform1f("dash_factor", 2.0f); /* Solid "line" */
|
||||
immUniform1f("udash_factor", 2.0f); /* Solid "line" */
|
||||
|
||||
immBegin(GPU_PRIM_POINTS, 1);
|
||||
immVertex2f(shdr_pos, pos[0], pos[1]);
|
||||
immEnd();
|
||||
}
|
||||
else {
|
||||
immUniform1f("dash_factor", 2.0f); /* Solid line */
|
||||
immUniform1f("udash_factor", 2.0f); /* Solid line */
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 8);
|
||||
|
||||
@@ -804,7 +804,7 @@ static void draw_marker_areas(SpaceClip *sc,
|
||||
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
GPU_logic_op_xor_set(true);
|
||||
|
||||
@@ -825,10 +825,10 @@ static void draw_marker_areas(SpaceClip *sc,
|
||||
|
||||
if (tiny) {
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
}
|
||||
else {
|
||||
immUniform1f("dash_factor", 2.0f); /* Solid line */
|
||||
immUniform1f("udash_factor", 2.0f); /* Solid line */
|
||||
}
|
||||
|
||||
if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) {
|
||||
@@ -1298,10 +1298,10 @@ static void draw_plane_marker_ex(SpaceClip *sc,
|
||||
|
||||
if (stipple) {
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
}
|
||||
else {
|
||||
immUniform1f("dash_factor", 2.0f); /* Solid line */
|
||||
immUniform1f("udash_factor", 2.0f); /* Solid line */
|
||||
}
|
||||
|
||||
if (draw_outline) {
|
||||
|
||||
@@ -89,7 +89,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm,
|
||||
immUniform1i("colors_len", 0); /* Simple dashes. */
|
||||
immUniformColor3f(0.0f, 0.0f, 0.0f);
|
||||
immUniform1f("dash_width", 10.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
/* draw two black lines showing the standard reference levels */
|
||||
|
||||
@@ -1049,7 +1049,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
|
||||
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
|
||||
immUniform1i("colors_len", 0); /* Simple dashes. */
|
||||
immUniform1f("dash_width", 4.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
}
|
||||
else {
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
|
||||
@@ -1208,7 +1208,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
|
||||
immUniformColor3fv(fcu->color);
|
||||
|
||||
immUniform1f("dash_width", 40.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
GPU_line_width(2.0f);
|
||||
|
||||
/* draw 1-1 line, stretching just past the screen limits
|
||||
@@ -1238,7 +1238,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
|
||||
/* draw dotted lines leading towards this point from both axes ....... */
|
||||
immUniformColor3f(0.9f, 0.9f, 0.9f);
|
||||
immUniform1f("dash_width", 10.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
GPU_line_width(1.0f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, (y <= v2d->cur.ymax) ? 4 : 2);
|
||||
@@ -1318,7 +1318,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
|
||||
|
||||
immUniform1i("colors_len", 0); /* Simple dashes. */
|
||||
immUniform1f("dash_width", 20.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
const bool draw_extrapolation = (sipo->flag & SIPO_NO_DRAW_EXTRAPOLATION) == 0;
|
||||
/* the ghost curves are simply sampled F-Curves stored in sipo->runtime.ghost_curves */
|
||||
|
||||
@@ -458,7 +458,7 @@ void draw_image_sample_line(SpaceImage *sima)
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
immUniform1f("dash_width", 2.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2fv(shdr_dashed_pos, hist->co[0]);
|
||||
|
||||
@@ -187,7 +187,7 @@ static void nla_actionclip_draw_markers(
|
||||
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
}
|
||||
else {
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
@@ -391,12 +391,12 @@ static uint nla_draw_use_dashed_outlines(const float color[4], bool muted)
|
||||
if (muted) {
|
||||
/* dotted - and slightly thicker for readability of the dashes */
|
||||
immUniform1f("dash_width", 5.0f);
|
||||
immUniform1f("dash_factor", 0.4f);
|
||||
immUniform1f("udash_factor", 0.4f);
|
||||
GPU_line_width(1.5f);
|
||||
}
|
||||
else {
|
||||
/* solid line */
|
||||
immUniform1f("dash_factor", 2.0f);
|
||||
immUniform1f("udash_factor", 2.0f);
|
||||
GPU_line_width(1.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -3450,7 +3450,7 @@ static void outliner_draw_hierarchy_line(
|
||||
const short line_padding = UI_UNIT_Y / 4.0f;
|
||||
|
||||
/* >= is 1.0 for un-dashed lines. */
|
||||
immUniform1f("dash_factor", draw_dashed ? 0.5f : 1.0f);
|
||||
immUniform1f("udash_factor", draw_dashed ? 0.5f : 1.0f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
/* Intentionally draw from top to bottom, so collapsing a child item doesn't make the dashes
|
||||
|
||||
@@ -1654,7 +1654,7 @@ static void sequencer_draw_borders_overlay(const SpaceSeq *sseq,
|
||||
immUniformThemeColor(TH_BACK);
|
||||
immUniform1i("colors_len", 0); /* Simple dashes. */
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_box_wire_2d(shdr_pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
|
||||
|
||||
@@ -2662,7 +2662,7 @@ static void draw_overlap_frame_indicator(const struct Scene *scene, const View2D
|
||||
/* Shader may have color set from past usage - reset it. */
|
||||
immUniform1i("colors_len", 0);
|
||||
immUniform1f("dash_width", 20.0f * U.pixelsize);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
immUniformThemeColor(TH_CFRAME);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
|
||||
@@ -444,7 +444,7 @@ void ED_view3d_cursor_snap_draw_util(RegionView3D *rv3d,
|
||||
GPU_viewport_size_get_f(viewport_size);
|
||||
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
||||
immUniform1f("dash_width", 6.0f * U.pixelsize);
|
||||
immUniform1f("dash_factor", 1.0f / 4.0f);
|
||||
immUniform1f("udash_factor", 1.0f / 4.0f);
|
||||
immUniformColor4ubv(color_line);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
|
||||
@@ -631,7 +631,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region,
|
||||
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
/* outer line not to confuse with object selection */
|
||||
if (v3d->flag2 & V3D_LOCK_CAMERA) {
|
||||
@@ -812,7 +812,7 @@ static void drawrenderborder(ARegion *region, View3D *v3d)
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniform4f("color", 1.0f, 0.25f, 0.25f, 1.0f);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_box_wire_2d(shdr_pos,
|
||||
v3d->render_border.xmin * region->winx,
|
||||
|
||||
@@ -695,7 +695,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
|
||||
immUniform4f("color", 0.67f, 0.67f, 0.67f, 1.0f);
|
||||
immUniform4f("color2", col[0], col[1], col[2], col[3]);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINE_STRIP, 3);
|
||||
|
||||
@@ -764,7 +764,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
|
||||
immUniform4f("color", 0.67f, 0.67f, 0.67f, 1.0f);
|
||||
immUniform4f("color2", col[0], col[1], col[2], col[3]);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
|
||||
|
||||
@@ -780,7 +780,7 @@ void drawConstraint(TransInfo *t)
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 2.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex3fv(shdr_pos, t->center_global);
|
||||
|
||||
@@ -121,7 +121,7 @@ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customd
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniformThemeColor3(TH_VIEW_OVERLAY);
|
||||
immUniform1f("dash_width", DASH_LENGTH);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2fv(pos_id, cent);
|
||||
immVertex2f(pos_id, tmval[0], tmval[1]);
|
||||
|
||||
@@ -449,7 +449,7 @@ void drawVertSlide(TransInfo *t)
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex3fv(shdr_pos, curr_sv->co_orig_3d);
|
||||
|
||||
@@ -526,7 +526,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *region, void *arg_
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
immUniformThemeColor3(TH_VIEW_OVERLAY);
|
||||
immUniform1f("dash_width", 6.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2fv(shdr_pos, mval_src);
|
||||
|
||||
@@ -49,7 +49,7 @@ void ED_image_draw_cursor(ARegion *region, const float cursor[2])
|
||||
immUniform4f("color", 1.0f, 0.0f, 0.0f, 1.0f);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 8.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 8);
|
||||
|
||||
@@ -70,7 +70,7 @@ void ED_image_draw_cursor(ARegion *region, const float cursor[2])
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
immUniform1f("dash_width", 2.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 8);
|
||||
|
||||
|
||||
@@ -574,6 +574,17 @@ set(SRC_SHADER_CREATE_INFOS
|
||||
../draw/engines/workbench/shaders/infos/workbench_shadow_info.hh
|
||||
../draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh
|
||||
../draw/engines/workbench/shaders/infos/workbench_volume_info.hh
|
||||
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_lightprobe_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_volume_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_shadow_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_material_info.hh
|
||||
../draw/engines/eevee/shaders/infos/eevee_legacy_motion_blur_info.hh
|
||||
|
||||
../draw/engines/image/shaders/infos/engine_image_info.hh
|
||||
../draw/intern/shaders/draw_debug_info.hh
|
||||
../draw/intern/shaders/draw_fullscreen_info.hh
|
||||
|
||||
@@ -46,6 +46,7 @@ bool GPU_use_hq_normals_workaround(void);
|
||||
bool GPU_clear_viewport_workaround(void);
|
||||
bool GPU_crappy_amd_driver(void);
|
||||
|
||||
bool GPU_geometry_shader_support(void);
|
||||
bool GPU_compute_shader_support(void);
|
||||
bool GPU_shader_storage_buffer_objects_support(void);
|
||||
bool GPU_shader_image_load_store_support(void);
|
||||
|
||||
@@ -48,7 +48,7 @@ struct GPencilStrokeData {
|
||||
BLI_STATIC_ASSERT_ALIGN(struct GPencilStrokeData, 16)
|
||||
|
||||
struct GPUClipPlanes {
|
||||
float4x4 ModelMatrix;
|
||||
float4x4 ClipModelMatrix;
|
||||
float4 world[6];
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(struct GPUClipPlanes, 16)
|
||||
|
||||
@@ -161,6 +161,11 @@ bool GPU_compute_shader_support()
|
||||
return GCaps.compute_shader_support;
|
||||
}
|
||||
|
||||
bool GPU_geometry_shader_support()
|
||||
{
|
||||
return GCaps.geometry_shader_support;
|
||||
}
|
||||
|
||||
bool GPU_shader_storage_buffer_objects_support()
|
||||
{
|
||||
return GCaps.shader_storage_buffer_objects_support;
|
||||
|
||||
@@ -42,6 +42,7 @@ struct GPUCapabilities {
|
||||
|
||||
bool mem_stats_support = false;
|
||||
bool compute_shader_support = false;
|
||||
bool geometry_shader_support = false;
|
||||
bool shader_storage_buffer_objects_support = false;
|
||||
bool shader_image_load_store_support = false;
|
||||
bool shader_draw_parameters_support = false;
|
||||
|
||||
@@ -392,6 +392,10 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
|
||||
shader->compute_shader_from_glsl(sources);
|
||||
}
|
||||
|
||||
if (info.tf_type_ != GPU_SHADER_TFB_NONE && info.tf_names_.size() > 0) {
|
||||
shader->transform_feedback_names_set(info.tf_names_.as_span(), info.tf_type_);
|
||||
}
|
||||
|
||||
if (!shader->finalize(&info)) {
|
||||
delete shader;
|
||||
GPU_debug_group_end();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
#include "GPU_capabilities.h"
|
||||
#include "GPU_context.h"
|
||||
#include "GPU_platform.h"
|
||||
#include "GPU_shader.h"
|
||||
#include "GPU_texture.h"
|
||||
@@ -43,6 +44,8 @@ void ShaderCreateInfo::finalize()
|
||||
validate_vertex_attributes();
|
||||
|
||||
for (auto &info_name : additional_infos_) {
|
||||
|
||||
/* Fetch create info. */
|
||||
const ShaderCreateInfo &info = *reinterpret_cast<const ShaderCreateInfo *>(
|
||||
gpu_shader_create_info_get(info_name.c_str()));
|
||||
|
||||
@@ -51,18 +54,22 @@ void ShaderCreateInfo::finalize()
|
||||
|
||||
interface_names_size_ += info.interface_names_size_;
|
||||
|
||||
vertex_inputs_.extend(info.vertex_inputs_);
|
||||
fragment_outputs_.extend(info.fragment_outputs_);
|
||||
vertex_out_interfaces_.extend(info.vertex_out_interfaces_);
|
||||
geometry_out_interfaces_.extend(info.geometry_out_interfaces_);
|
||||
/* NOTE: EEVEE Materials can result in nested includes. To avoid duplicate
|
||||
* shader resources, we need to avoid inserting duplicates.
|
||||
* TODO: Optimize create info preparation to include each individual "additional_info"
|
||||
* only a single time. */
|
||||
vertex_inputs_.extend_non_duplicates(info.vertex_inputs_);
|
||||
fragment_outputs_.extend_non_duplicates(info.fragment_outputs_);
|
||||
vertex_out_interfaces_.extend_non_duplicates(info.vertex_out_interfaces_);
|
||||
geometry_out_interfaces_.extend_non_duplicates(info.geometry_out_interfaces_);
|
||||
|
||||
validate_vertex_attributes(&info);
|
||||
|
||||
push_constants_.extend(info.push_constants_);
|
||||
defines_.extend(info.defines_);
|
||||
|
||||
batch_resources_.extend(info.batch_resources_);
|
||||
pass_resources_.extend(info.pass_resources_);
|
||||
/* Insert with duplicate check. */
|
||||
push_constants_.extend_non_duplicates(info.push_constants_);
|
||||
defines_.extend_non_duplicates(info.defines_);
|
||||
batch_resources_.extend_non_duplicates(info.batch_resources_);
|
||||
pass_resources_.extend_non_duplicates(info.pass_resources_);
|
||||
typedef_sources_.extend_non_duplicates(info.typedef_sources_);
|
||||
|
||||
if (info.early_fragment_test_) {
|
||||
@@ -70,7 +77,7 @@ void ShaderCreateInfo::finalize()
|
||||
}
|
||||
/* Override depth-write with additional info if this specifies a writing mode
|
||||
* other than the default. */
|
||||
if (info.depth_write_ != DepthWrite::UNCHANGED) {
|
||||
if (info.depth_write_ != DepthWrite::NONE) {
|
||||
depth_write_ = info.depth_write_;
|
||||
}
|
||||
|
||||
@@ -150,7 +157,7 @@ std::string ShaderCreateInfo::check_error() const
|
||||
if (this->vertex_source_.is_empty()) {
|
||||
error += "Missing vertex shader in " + this->name_ + ".\n";
|
||||
}
|
||||
if (this->fragment_source_.is_empty()) {
|
||||
if (tf_type_ == GPU_SHADER_TFB_NONE && this->fragment_source_.is_empty()) {
|
||||
error += "Missing fragment shader in " + this->name_ + ".\n";
|
||||
}
|
||||
}
|
||||
@@ -298,8 +305,12 @@ void gpu_shader_create_info_init()
|
||||
|
||||
/* WORKAROUND: Replace draw_mesh info with the legacy one for systems that have problems with UBO
|
||||
* indexing. */
|
||||
if (GPU_type_matches(GPU_DEVICE_INTEL | GPU_DEVICE_INTEL_UHD, GPU_OS_ANY, GPU_DRIVER_ANY) ||
|
||||
GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY) || GPU_crappy_amd_driver()) {
|
||||
if (GPU_type_matches_ex(GPU_DEVICE_INTEL | GPU_DEVICE_INTEL_UHD,
|
||||
GPU_OS_ANY,
|
||||
GPU_DRIVER_ANY,
|
||||
GPU_BACKEND_OPENGL) ||
|
||||
GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_OPENGL) ||
|
||||
GPU_crappy_amd_driver()) {
|
||||
draw_modelmat = draw_modelmat_legacy;
|
||||
}
|
||||
|
||||
@@ -308,9 +319,9 @@ void gpu_shader_create_info_init()
|
||||
draw_resource_id_new = draw_resource_id_fallback;
|
||||
}
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
/* Metal-specific alternatives for Geometry shaders. */
|
||||
if (GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_METAL)) {
|
||||
|
||||
/* 3D polyline. */
|
||||
gpu_shader_3D_polyline_uniform_color = gpu_shader_3D_polyline_uniform_color_no_geom;
|
||||
gpu_shader_3D_polyline_flat_color = gpu_shader_3D_polyline_flat_color_no_geom;
|
||||
@@ -331,7 +342,23 @@ void gpu_shader_create_info_init()
|
||||
/* Overlay Motion Path Line. */
|
||||
overlay_motion_path_line = overlay_motion_path_line_no_geom;
|
||||
overlay_motion_path_line_clipped = overlay_motion_path_line_clipped_no_geom;
|
||||
|
||||
/* Downsample Cube/Proe rendering. */
|
||||
eevee_legacy_effect_downsample_cube = eevee_legacy_effect_downsample_cube_no_geom;
|
||||
eevee_legacy_probe_filter_glossy = eevee_legacy_probe_filter_glossy_no_geom;
|
||||
eevee_legacy_lightprobe_planar_downsample = eevee_legacy_lightprobe_planar_downsample_no_geom;
|
||||
|
||||
/* EEVEE Volumetrics */
|
||||
eevee_legacy_volumes_clear = eevee_legacy_volumes_clear_no_geom;
|
||||
eevee_legacy_volumes_scatter = eevee_legacy_volumes_scatter_no_geom;
|
||||
eevee_legacy_volumes_scatter_with_lights = eevee_legacy_volumes_scatter_with_lights_no_geom;
|
||||
eevee_legacy_volumes_integration = eevee_legacy_volumes_integration_no_geom;
|
||||
eevee_legacy_volumes_integration_OPTI = eevee_legacy_volumes_integration_OPTI_no_geom;
|
||||
|
||||
/* EEVEE Volumetric Material */
|
||||
eevee_legacy_material_volumetric_vert = eevee_legacy_material_volumetric_vert_no_geom;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (ShaderCreateInfo *info : g_create_infos->values()) {
|
||||
if (info->do_static_compilation_) {
|
||||
@@ -377,6 +404,7 @@ bool gpu_shader_create_info_compile_all()
|
||||
info->finalize();
|
||||
if (info->do_static_compilation_) {
|
||||
if ((GPU_compute_shader_support() == false && info->compute_source_ != nullptr) ||
|
||||
(GPU_geometry_shader_support() == false && info->geometry_source_ != nullptr) ||
|
||||
(GPU_shader_image_load_store_support() == false && info->has_resource_image()) ||
|
||||
(GPU_shader_storage_buffer_objects_support() == false && info->has_resource_storage())) {
|
||||
skipped++;
|
||||
|
||||
@@ -189,8 +189,8 @@ ENUM_OPERATORS(BuiltinBits, BuiltinBits::USE_DEBUG_PRINT);
|
||||
* https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_conservative_depth.txt
|
||||
*/
|
||||
enum class DepthWrite {
|
||||
/* UNCHANGED specified as default to indicate gl_FragDepth is not used. */
|
||||
UNCHANGED = 0,
|
||||
/* NONE specified as default to indicate gl_FragDepth is not used. */
|
||||
NONE = 0,
|
||||
ANY,
|
||||
GREATER,
|
||||
LESS,
|
||||
@@ -344,7 +344,7 @@ struct ShaderCreateInfo {
|
||||
/** If true, force the use of the GL shader introspection for resource location. */
|
||||
bool legacy_resource_location_ = false;
|
||||
/** Allow optimization when fragment shader writes to `gl_FragDepth`. */
|
||||
DepthWrite depth_write_ = DepthWrite::UNCHANGED;
|
||||
DepthWrite depth_write_ = DepthWrite::NONE;
|
||||
/**
|
||||
* Maximum length of all the resource names including each null terminator.
|
||||
* Only for names used by #gpu::ShaderInterface.
|
||||
@@ -377,7 +377,7 @@ struct ShaderCreateInfo {
|
||||
Type type;
|
||||
StringRefNull name;
|
||||
|
||||
bool operator==(const VertIn &b)
|
||||
bool operator==(const VertIn &b) const
|
||||
{
|
||||
TEST_EQUAL(*this, b, index);
|
||||
TEST_EQUAL(*this, b, type);
|
||||
@@ -426,7 +426,7 @@ struct ShaderCreateInfo {
|
||||
DualBlend blend;
|
||||
StringRefNull name;
|
||||
|
||||
bool operator==(const FragOut &b)
|
||||
bool operator==(const FragOut &b) const
|
||||
{
|
||||
TEST_EQUAL(*this, b, index);
|
||||
TEST_EQUAL(*this, b, type);
|
||||
@@ -480,7 +480,7 @@ struct ShaderCreateInfo {
|
||||
|
||||
Resource(BindType type, int _slot) : bind_type(type), slot(_slot){};
|
||||
|
||||
bool operator==(const Resource &b)
|
||||
bool operator==(const Resource &b) const
|
||||
{
|
||||
TEST_EQUAL(*this, b, bind_type);
|
||||
TEST_EQUAL(*this, b, slot);
|
||||
@@ -525,7 +525,7 @@ struct ShaderCreateInfo {
|
||||
StringRefNull name;
|
||||
int array_size;
|
||||
|
||||
bool operator==(const PushConst &b)
|
||||
bool operator==(const PushConst &b) const
|
||||
{
|
||||
TEST_EQUAL(*this, b, type);
|
||||
TEST_EQUAL(*this, b, name);
|
||||
@@ -548,6 +548,10 @@ struct ShaderCreateInfo {
|
||||
*/
|
||||
Vector<StringRefNull> additional_infos_;
|
||||
|
||||
/* Transform feedback properties. */
|
||||
eGPUShaderTFBType tf_type_ = GPU_SHADER_TFB_NONE;
|
||||
Vector<const char *> tf_names_;
|
||||
|
||||
public:
|
||||
ShaderCreateInfo(const char *name) : name_(name){};
|
||||
~ShaderCreateInfo(){};
|
||||
@@ -829,6 +833,27 @@ struct ShaderCreateInfo {
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Transform feedback properties
|
||||
*
|
||||
* Transform feedback enablement and output binding assignmnt.
|
||||
* \{ */
|
||||
|
||||
Self &transform_feedback_mode(eGPUShaderTFBType tf_mode)
|
||||
{
|
||||
BLI_assert(tf_mode != GPU_SHADER_TFB_NONE);
|
||||
tf_type_ = tf_mode;
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
Self &transform_feedback_output_name(const char *name)
|
||||
{
|
||||
BLI_assert(tf_type_ != GPU_SHADER_TFB_NONE);
|
||||
tf_names_.append(name);
|
||||
return *(Self *)this;
|
||||
}
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Recursive evaluation.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "gpu_shader_create_info.hh"
|
||||
#include "gpu_shader_dependency_private.h"
|
||||
|
||||
#include "GPU_context.h"
|
||||
|
||||
extern "C" {
|
||||
#define SHADER_SOURCE(datatoc, filename, filepath) extern char datatoc[];
|
||||
#include "glsl_compositor_source_list.h"
|
||||
@@ -268,6 +270,12 @@ struct GPUSource {
|
||||
int64_t last_pos = 0;
|
||||
const bool is_cpp = filename.endswith(".hh");
|
||||
|
||||
/* Metal Shading language is based on C++ and supports C++-style enumerations.
|
||||
* For these cases, we do not need to perform auto-replacement. */
|
||||
if (is_cpp && GPU_backend_get_type() == GPU_BACKEND_METAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
cursor = find_keyword(input, "enum ", cursor + 1);
|
||||
if (cursor == -1) {
|
||||
|
||||
@@ -23,14 +23,17 @@ GPU_SHADER_CREATE_INFO(depth_2d_update_info_base)
|
||||
GPU_SHADER_CREATE_INFO(depth_2d_update_float)
|
||||
.fragment_source("depth_2d_update_float_frag.glsl")
|
||||
.additional_info("depth_2d_update_info_base")
|
||||
.do_static_compilation(true);
|
||||
// .do_static_compilation(true)
|
||||
.depth_write(DepthWrite::ANY);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(depth_2d_update_int24)
|
||||
.fragment_source("depth_2d_update_int24_frag.glsl")
|
||||
.additional_info("depth_2d_update_info_base")
|
||||
.do_static_compilation(true);
|
||||
// .do_static_compilation(true)
|
||||
.depth_write(DepthWrite::ANY);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(depth_2d_update_int32)
|
||||
.fragment_source("depth_2d_update_int32_frag.glsl")
|
||||
.additional_info("depth_2d_update_info_base")
|
||||
.do_static_compilation(true);
|
||||
// .do_static_compilation(true)
|
||||
.depth_write(DepthWrite::ANY);
|
||||
|
||||
@@ -396,6 +396,7 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
|
||||
/* TODO(Metal): Add support? */
|
||||
GCaps.shader_draw_parameters_support = false;
|
||||
GCaps.compute_shader_support = false; /* TODO(Metal): Add compute support. */
|
||||
GCaps.geometry_shader_support = false;
|
||||
GCaps.shader_storage_buffer_objects_support =
|
||||
false; /* TODO(Metal): implement Storage Buffer support. */
|
||||
|
||||
|
||||
@@ -657,7 +657,7 @@ inline const char *to_string_msl(const shader::Interpolation &interp)
|
||||
{
|
||||
switch (interp) {
|
||||
case shader::Interpolation::SMOOTH:
|
||||
return "[[smooth]]";
|
||||
return "[[center_perspective]]";
|
||||
case shader::Interpolation::FLAT:
|
||||
return "[[flat]]";
|
||||
case shader::Interpolation::NO_PERSPECTIVE:
|
||||
|
||||
@@ -165,8 +165,9 @@ static bool is_program_word(const char *chr, int *len)
|
||||
int numchars = 0;
|
||||
for (const char *c = chr; *c != '\0'; c++) {
|
||||
char ch = *c;
|
||||
/* Note: Hash (`#`) is not valid in var names, but is used by Closure macro patterns. */
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
|
||||
(numchars > 0 && ch >= '0' && ch <= '9') || ch == '_') {
|
||||
(numchars > 0 && ch >= '0' && ch <= '9') || ch == '_' || ch == '#') {
|
||||
numchars++;
|
||||
}
|
||||
else {
|
||||
@@ -674,8 +675,9 @@ bool MTLShader::generate_msl_from_glsl(const shader::ShaderCreateInfo *info)
|
||||
|
||||
/* NOTE(Metal): FragDepth output mode specified in create-info 'DepthWrite depth_write_'.
|
||||
* If parsing without create-info, manual extraction will be required. */
|
||||
msl_iface.uses_gl_FragDepth = shd_builder_->glsl_fragment_source_.find("gl_FragDepth") !=
|
||||
std::string::npos;
|
||||
msl_iface.uses_gl_FragDepth = (info->depth_write_ != DepthWrite::NONE) &&
|
||||
shd_builder_->glsl_fragment_source_.find("gl_FragDepth") !=
|
||||
std::string::npos;
|
||||
msl_iface.depth_write = info->depth_write_;
|
||||
}
|
||||
|
||||
@@ -1194,6 +1196,27 @@ void MSLGeneratorInterface::prepare_from_createinfo(const shader::ShaderCreateIn
|
||||
/** Prepare textures and uniform blocks.
|
||||
* Perform across both resource categories and extract both
|
||||
* texture samplers and image types. */
|
||||
|
||||
/* NOTE: Metal requires Samplers and images to share slots. We will re-map these.
|
||||
* If `auto_resource_location_` is not used, then slot collision could occur and
|
||||
* this should be resolved in the original create-info. */
|
||||
int texture_slot_id = 0;
|
||||
|
||||
/* Determine max sampler slot for image resource offset, when not using auto resource location,
|
||||
* as image resources cannot overlap sampler ranges. */
|
||||
int max_sampler_slot = 0;
|
||||
if (!create_info_->auto_resource_location_) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
const Vector<ShaderCreateInfo::Resource> &resources = (i == 0) ? info->pass_resources_ :
|
||||
info->batch_resources_;
|
||||
for (const ShaderCreateInfo::Resource &res : resources) {
|
||||
if (res.bind_type == shader::ShaderCreateInfo::Resource::BindType::SAMPLER) {
|
||||
max_sampler_slot = max_ii(res.slot, max_sampler_slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
const Vector<ShaderCreateInfo::Resource> &resources = (i == 0) ? info->pass_resources_ :
|
||||
info->batch_resources_;
|
||||
@@ -1203,6 +1226,13 @@ void MSLGeneratorInterface::prepare_from_createinfo(const shader::ShaderCreateIn
|
||||
switch (res.bind_type) {
|
||||
case shader::ShaderCreateInfo::Resource::BindType::SAMPLER: {
|
||||
|
||||
/* Re-map sampler slot to share texture indices with images.
|
||||
* Only applies if `auto_resource_location_` is enabled. */
|
||||
BLI_assert(res.slot >= 0 && res.slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
unsigned int used_slot = (create_info_->auto_resource_location_) ? (texture_slot_id++) :
|
||||
res.slot;
|
||||
BLI_assert(used_slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
|
||||
/* Samplers to have access::sample by default. */
|
||||
MSLTextureSamplerAccess access = MSLTextureSamplerAccess::TEXTURE_ACCESS_SAMPLE;
|
||||
/* TextureBuffers must have read/write/read-write access pattern. */
|
||||
@@ -1211,13 +1241,23 @@ void MSLGeneratorInterface::prepare_from_createinfo(const shader::ShaderCreateIn
|
||||
res.sampler.type == ImageType::UINT_BUFFER) {
|
||||
access = MSLTextureSamplerAccess::TEXTURE_ACCESS_READ;
|
||||
}
|
||||
BLI_assert(res.slot >= 0 && res.slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
|
||||
MSLTextureSampler msl_tex(
|
||||
ShaderStage::BOTH, res.sampler.type, res.sampler.name, access, res.slot);
|
||||
ShaderStage::BOTH, res.sampler.type, res.sampler.name, access, used_slot);
|
||||
texture_samplers.append(msl_tex);
|
||||
} break;
|
||||
|
||||
case shader::ShaderCreateInfo::Resource::BindType::IMAGE: {
|
||||
|
||||
/* Re-map sampler slot to share texture indices with samplers.
|
||||
* Automatically applies if `auto_resource_location_` is enabled.
|
||||
* Otherwise, if not using automatic resource location, offset by max sampler slot. */
|
||||
BLI_assert(res.slot >= 0 && res.slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
unsigned int used_slot = (create_info_->auto_resource_location_) ?
|
||||
(texture_slot_id++) :
|
||||
res.slot + max_sampler_slot + 1;
|
||||
BLI_assert(used_slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
|
||||
/* Flatten qualifier flags into final access state. */
|
||||
MSLTextureSamplerAccess access;
|
||||
if (bool(res.image.qualifiers & Qualifier::READ_WRITE)) {
|
||||
@@ -1229,9 +1269,9 @@ void MSLGeneratorInterface::prepare_from_createinfo(const shader::ShaderCreateIn
|
||||
else {
|
||||
access = MSLTextureSamplerAccess::TEXTURE_ACCESS_READ;
|
||||
}
|
||||
BLI_assert(res.slot >= 0 && res.slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
BLI_assert(used_slot >= 0 && used_slot < MTL_MAX_TEXTURE_SLOTS);
|
||||
MSLTextureSampler msl_tex(
|
||||
ShaderStage::BOTH, res.image.type, res.image.name, access, res.slot);
|
||||
ShaderStage::BOTH, res.image.type, res.image.name, access, used_slot);
|
||||
texture_samplers.append(msl_tex);
|
||||
} break;
|
||||
|
||||
|
||||
@@ -510,6 +510,7 @@ void GLBackend::capabilities_init()
|
||||
GCaps.shader_draw_parameters_support = epoxy_has_gl_extension("GL_ARB_shader_draw_parameters");
|
||||
GCaps.compute_shader_support = epoxy_has_gl_extension("GL_ARB_compute_shader") &&
|
||||
epoxy_gl_version() >= 43;
|
||||
GCaps.geometry_shader_support = true;
|
||||
GCaps.max_samplers = GCaps.max_textures;
|
||||
|
||||
if (GCaps.compute_shader_support) {
|
||||
|
||||
@@ -10,13 +10,13 @@ void main()
|
||||
{
|
||||
float distance_along_line = distance(stipple_pos, stipple_start);
|
||||
/* Solid line case, simple. */
|
||||
if (dash_factor >= 1.0f) {
|
||||
if (udash_factor >= 1.0f) {
|
||||
fragColor = color;
|
||||
}
|
||||
/* Actually dashed line... */
|
||||
else {
|
||||
float normalized_distance = fract(distance_along_line / dash_width);
|
||||
if (normalized_distance <= dash_factor) {
|
||||
if (normalized_distance <= udash_factor) {
|
||||
fragColor = color;
|
||||
}
|
||||
else if (colors_len > 0) {
|
||||
|
||||
@@ -7,6 +7,6 @@ void main()
|
||||
finalColor = color;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ModelMatrix * pos_4d).xyz);
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ClipModelMatrix * pos_4d).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ void main()
|
||||
radii /= size;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ModelMatrix * pos_4d).xyz);
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ClipModelMatrix * pos_4d).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ void main()
|
||||
finalColor = color;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ClipModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ void main()
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance((clipPlanes.ClipModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
float phase = mod((gl_FragCoord.x + gl_FragCoord.y), (size1 + size2));
|
||||
float phase = mod((gl_FragCoord.x + gl_FragCoord.y), float(size1 + size2));
|
||||
|
||||
if (phase < size1) {
|
||||
fragColor = color1;
|
||||
|
||||
@@ -19,7 +19,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
|
||||
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
|
||||
.push_constant(Type::VEC2, "viewport_size")
|
||||
.push_constant(Type::FLOAT, "dash_width")
|
||||
.push_constant(Type::FLOAT, "dash_factor") /* if > 1.0, solid line. */
|
||||
.push_constant(Type::FLOAT, "udash_factor") /* if > 1.0, solid line. */
|
||||
/* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */
|
||||
.push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */
|
||||
.push_constant(Type::VEC4, "color")
|
||||
|
||||
@@ -40,12 +40,14 @@
|
||||
#define vec3_1010102_Inorm int
|
||||
|
||||
/* Strip GLSL Decorators. */
|
||||
#define in
|
||||
#define flat
|
||||
#define smooth
|
||||
#define noperspective
|
||||
#define layout(std140) struct
|
||||
#define uniform
|
||||
#if 0
|
||||
# define in
|
||||
# define flat
|
||||
# define smooth
|
||||
# define noperspective
|
||||
# define layout(std140) struct
|
||||
# define uniform
|
||||
#endif
|
||||
|
||||
/* Used to replace 'out' in function parameters with threadlocal reference
|
||||
* shortened to avoid expanding the glsl source string. */
|
||||
@@ -131,6 +133,7 @@ struct SStruct {
|
||||
#define texelFetch _texelFetch_internal
|
||||
#define texelFetchOffset(__tex, __texel, __lod, __offset) \
|
||||
_texelFetch_internal(__tex, __texel, __lod, __offset)
|
||||
#define imageLoad(__image, __coord) _texelFetch_internal(__image, __coord, 0)
|
||||
#define texture2(__tex, __uv) _texture_internal_samp(__tex, __uv)
|
||||
#define texture3(__tex, __uv, _bias) _texture_internal_bias(__tex, __uv, bias(float(_bias)))
|
||||
#define textureLod(__tex, __uv, __lod) _texture_internal_level(__tex, __uv, level(float(__lod)))
|
||||
@@ -164,7 +167,9 @@ union _msl_return_float {
|
||||
* type, as return types are specific to the signature of 'tex'. */
|
||||
/* Texture Read. */
|
||||
template<typename S, typename T, access A>
|
||||
inline vec<S, 4> _texelFetch_internal(thread _mtl_combined_image_sampler_1d<S, A> tex, T texel)
|
||||
inline vec<S, 4> _texelFetch_internal(thread _mtl_combined_image_sampler_1d<S, A> tex,
|
||||
T texel,
|
||||
uint lod = 0)
|
||||
{
|
||||
float w = tex.texture->get_width();
|
||||
if (texel >= 0 && texel < w) {
|
||||
@@ -177,7 +182,7 @@ inline vec<S, 4> _texelFetch_internal(thread _mtl_combined_image_sampler_1d<S, A
|
||||
|
||||
template<typename S, typename T>
|
||||
inline vec<S, 4> _texelFetch_internal(
|
||||
const thread _mtl_combined_image_sampler_buffer<S, access::read> tex, T texel)
|
||||
const thread _mtl_combined_image_sampler_buffer<S, access::read> tex, T texel, uint lod = 0)
|
||||
{
|
||||
float w = tex.texture->get_width();
|
||||
if (texel >= 0 && texel < w) {
|
||||
@@ -607,6 +612,15 @@ inline float4 _texture_gather_internal(
|
||||
return tex.texture->gather(*tex.samp, uv, offset);
|
||||
}
|
||||
|
||||
inline float4 _texture_gather_internal(
|
||||
thread _mtl_combined_image_sampler_depth_2d_array<float, access::sample> tex,
|
||||
float3 uva,
|
||||
const int comp = 0,
|
||||
int2 offset = int2(0))
|
||||
{
|
||||
return tex.texture->gather(*tex.samp, uva.xy, uint(uva.z), offset);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline vec<T, 4> _texture_gather_internal(
|
||||
thread _mtl_combined_image_sampler_2d<T, access::sample> tex,
|
||||
@@ -620,11 +634,11 @@ inline vec<T, 4> _texture_gather_internal(
|
||||
template<typename T>
|
||||
inline vec<T, 4> _texture_gather_internal(
|
||||
thread _mtl_combined_image_sampler_2d_array<T, access::sample> tex,
|
||||
float2 uv,
|
||||
float3 uva,
|
||||
const int comp = 0,
|
||||
int2 offset = int2(0))
|
||||
{
|
||||
return tex.texture->gather(*tex.samp, uv, offset);
|
||||
return tex.texture->gather(*tex.samp, uva.xy, uint(uva.z), offset);
|
||||
}
|
||||
|
||||
/* Texture write support. */
|
||||
@@ -640,6 +654,20 @@ inline void _texture_write_internal(thread _mtl_combined_image_sampler_2d<S, A>
|
||||
}
|
||||
}
|
||||
|
||||
template<typename S, typename T, access A>
|
||||
inline void _texture_write_internal(thread _mtl_combined_image_sampler_2d_array<S, A> tex,
|
||||
T _coord,
|
||||
vec<S, 4> value)
|
||||
{
|
||||
float w = tex.texture->get_width();
|
||||
float h = tex.texture->get_height();
|
||||
float d = tex.texture->get_array_size();
|
||||
if (_coord.x >= 0 && _coord.x < w && _coord.y >= 0 && _coord.y < h && _coord.z >= 0 &&
|
||||
_coord.z < d) {
|
||||
tex.texture->write(value, uint2(_coord.xy), _coord.z);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename S, typename T, access A>
|
||||
inline void _texture_write_internal(thread _mtl_combined_image_sampler_3d<S, A> tex,
|
||||
T _coord,
|
||||
@@ -813,7 +841,29 @@ inline float4 intBitsToFloat(int4 f)
|
||||
return as_type<float4>(f);
|
||||
}
|
||||
|
||||
inline float uintBitsToFloat(uint f)
|
||||
{
|
||||
return as_type<float>(f);
|
||||
}
|
||||
|
||||
inline float2 uintBitsToFloat(uint2 f)
|
||||
{
|
||||
return as_type<float2>(f);
|
||||
}
|
||||
|
||||
inline float3 uintBitsToFloat(uint3 f)
|
||||
{
|
||||
return as_type<float3>(f);
|
||||
}
|
||||
|
||||
inline float4 uintBitsToFloat(uint4 f)
|
||||
{
|
||||
return as_type<float4>(f);
|
||||
}
|
||||
|
||||
/* Texture size functions. Add texture types as needed. */
|
||||
#define imageSize(image) textureSize(image, 0)
|
||||
|
||||
template<typename T, access A>
|
||||
int textureSize(thread _mtl_combined_image_sampler_1d<T, A> image, uint lod)
|
||||
{
|
||||
@@ -900,19 +950,24 @@ int _mtlmod(int a, int b)
|
||||
return a - b * (a / b);
|
||||
}
|
||||
|
||||
float _mtlmod(float a, float b)
|
||||
{
|
||||
return a - b * floor(a / b);
|
||||
}
|
||||
|
||||
template<typename T, int n> vec<T, n> _mtlmod(vec<T, n> x, vec<T, n> y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
return x - (y * floor(x / y));
|
||||
}
|
||||
|
||||
template<typename T, int n, typename U> vec<T, n> _mtlmod(vec<T, n> x, U y)
|
||||
{
|
||||
return x - vec<T, n>(y) * floor(x / vec<T, n>(y));
|
||||
return x - (vec<T, n>(y) * floor(x / vec<T, n>(y)));
|
||||
}
|
||||
|
||||
template<typename T, typename U, int n> vec<U, n> _mtlmod(T x, vec<U, n> y)
|
||||
{
|
||||
return vec<U, n>(x) - y * floor(vec<U, n>(x) / y);
|
||||
return vec<U, n>(x) - (y * floor(vec<U, n>(x) / y));
|
||||
}
|
||||
|
||||
/* Mathematical functions. */
|
||||
@@ -1055,6 +1110,34 @@ mat3 MAT3(vec3 a, vec3 b, vec3 c)
|
||||
{
|
||||
return mat3(a, b, c);
|
||||
}
|
||||
mat3 MAT3(vec3 a, vec3 b, float c1, float c2, float c3)
|
||||
{
|
||||
return mat3(a, b, vec3(c1, c2, c3));
|
||||
}
|
||||
mat3 MAT3(vec3 a, float b1, float b2, float b3, vec3 c)
|
||||
{
|
||||
return mat3(a, vec3(b1, b2, b3), c);
|
||||
}
|
||||
mat3 MAT3(vec3 a, float b1, float b2, float b3, float c1, float c2, float c3)
|
||||
{
|
||||
return mat3(a, vec3(b1, b2, b3), vec3(c1, c2, c3));
|
||||
}
|
||||
mat3 MAT3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
|
||||
{
|
||||
return mat3(vec3(a1, a2, a3), vec3(b1, b2, b3), vec3(c1, c2, c3));
|
||||
}
|
||||
mat3 MAT3(float a1, float a2, float a3, vec3 b, vec3 c)
|
||||
{
|
||||
return mat3(vec3(a1, a2, a3), b, c);
|
||||
}
|
||||
mat3 MAT3(float a1, float a2, float a3, vec3 b, float c1, float c2, float c3)
|
||||
{
|
||||
return mat3(vec3(a1, a2, a3), b, vec3(c1, c2, c3));
|
||||
}
|
||||
mat3 MAT3(float a1, float a2, float a3, float b1, float b2, float b3, vec3 c)
|
||||
{
|
||||
return mat3(vec3(a1, a2, a3), vec3(b1, b2, b3), c);
|
||||
}
|
||||
mat3 MAT3(float f)
|
||||
{
|
||||
return mat3(f);
|
||||
|
||||
@@ -185,7 +185,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
|
||||
immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 8.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
float xmin = (float)rect->xmin;
|
||||
float ymin = (float)rect->ymin;
|
||||
@@ -228,7 +228,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
|
||||
immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 8.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_box_wire_2d(
|
||||
shdr_pos, (float)rect->xmin, (float)rect->ymin, (float)rect->xmax, (float)rect->ymax);
|
||||
@@ -267,7 +267,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
|
||||
immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 4.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
imm_draw_circle_wire_2d(shdr_pos, (float)rect->xmin, (float)rect->ymin, (float)rect->xmax, 40);
|
||||
|
||||
@@ -371,7 +371,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
|
||||
immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 2.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin((gt->type == WM_GESTURE_LASSO) ? GPU_PRIM_LINE_LOOP : GPU_PRIM_LINE_STRIP, numverts);
|
||||
|
||||
@@ -405,7 +405,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
|
||||
immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
|
||||
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1f("dash_width", 8.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniform1f("udash_factor", 0.5f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user