24 std::string info_name_;
73 return prepass_[
int(geometry_type)][
int(pipeline_type)][
int(lighting_type)][
int(shader_type)]
80 bool curvature =
false,
83 return resolve_[
int(lighting_type)][cavity][curvature][shadow].
get();
88 return shadow_[depth_pass][manifold][cap].
get();
93 return volume_[smoke][interpolation][coba][slice].
get();
104 "workbench_shadow_visibility_compute_dynamic_pass_type"};
184 const char *name =
nullptr;
187 bool premultiplied =
false;
212 static const int max_samples_ = 512;
217 int sample_count_ = 0;
218 bool curvature_enabled_ =
false;
219 bool cavity_enabled_ =
false;
226 void load_samples_buf(
int ssao_samples);
232 Texture stencil_copy_tx_ =
"stencil_copy_tx";
265 return stencil_copy_tx_;
308 using TextureSubPassKey = std::pair<GPUTexture *, eGeometryType>;
314 bool is_empty_ =
false;
391#define DEBUG_SHADOW_VOLUME 0
395 enum PassType { PASS = 0, FAIL, FORCED_FAIL, MAX };
397 class ShadowView :
public View {
398 bool force_fail_method_ =
false;
401 ShadowPass::PassType current_pass_type_ = PASS;
407 ShadowView() :
View(
"ShadowPass.View"){};
409 void setup(
View &view,
float3 light_direction,
bool force_fail_method);
410 bool debug_object_culling(
Object *ob);
411 void set_mode(PassType type);
417 bool debug_freeze)
override;
426 PassMain pass_ps_ = {
"Shadow.Pass"};
427 PassMain fail_ps_ = {
"Shadow.Fail"};
430 PassMain forced_fail_ps_ = {
"Shadow.ForcedFail"};
434 PassMain::Sub *&get_pass_ptr(PassType type,
bool manifold,
bool cap =
false);
446 const bool has_transp_mat);
450 GPUTexture &depth_stencil_tx,
452 bool force_fail_method);
463 Texture dummy_shadow_tx_ = {
"Volume.Dummy Shadow Tx"};
464 Texture dummy_volume_tx_ = {
"Volume.Dummy Volume Tx"};
465 Texture dummy_coba_tx_ = {
"Volume.Dummy Coba Tx"};
467 GPUTexture *stencil_tx_ =
nullptr;
487 void draw_slice_ps(
Manager &manager,
493 void draw_volume_ps(
Manager &manager,
503 bool enabled_ =
false;
516 static const int kernel_radius_ = 3;
517 static const int samples_len_ = (kernel_radius_ * 2 + 1) * (kernel_radius_ * 2 + 1);
519 bool enabled_ =
false;
534 PassSimple down_ps_ = {
"Workbench.DoF.DownSample"};
535 PassSimple down2_ps_ = {
"Workbench.DoF.DownSample2"};
537 PassSimple blur2_ps_ = {
"Workbench.DoF.Blur2"};
538 PassSimple resolve_ps_ = {
"Workbench.DoF.Resolve"};
540 float aperture_size_ = 0;
542 float invsensor_size_ = 0;
556 void setup_samples();
561 bool enabled_ =
false;
563 float weight_accum_ = 0;
565 float weights_[9] = {0};
567 float weights_sum_ = 0;
569 Texture sample0_depth_tx_ = {
"sample0_depth_tx"};
570 Texture sample0_depth_in_front_tx_ = {
"sample0_depth_in_front_tx"};
572 Texture taa_accumulation_tx_ = {
"taa_accumulation_tx"};
573 Texture smaa_search_tx_ = {
"smaa_search_tx"};
574 Texture smaa_area_tx_ = {
"smaa_area_tx"};
578 Framebuffer taa_accumulation_fb_ = {
"taa_accumulation_fb"};
581 Framebuffer smaa_resolve_fb_ = {
"smaa_resolve_fb"};
582 Framebuffer overlay_depth_fb_ = {
"overlay_depth_fb"};
585 float smaa_mix_factor_ = 0;
587 PassSimple taa_accumulation_ps_ = {
"TAA.Accumulation"};
588 PassSimple smaa_edge_detect_ps_ = {
"SMAA.EdgeDetect"};
589 PassSimple smaa_aa_weight_ps_ = {
"SMAA.BlendWeights"};
590 PassSimple smaa_resolve_ps_ = {
"SMAA.Resolve"};
591 PassSimple overlay_depth_ps_ = {
"Overlay Depth"};
606 GPUTexture *depth_in_front_tx);
@ V3D_SHADING_SINGLE_COLOR
#define DRW_SHADER_FREE_SAFE(shader)
bool GPU_texture_view_support()
#define GPU_ATTACHMENT_TEXTURE(_texture)
GPUShader * GPU_shader_create_from_info_name(const char *info_name)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
struct GPUShader GPUShader
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
void submit(PassSimple &pass, View &view)
bool ensure_2d(eGPUTextureFormat format, int2 extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
GPUTexture * stencil_view(bool cube_as_array=false)
View(const char *name, int view_len=1, bool procedural=false)
void clear_color(float4 color)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceHandle handle={0}, uint custom_id=0)
void state_set(DRWState state, int clip_plane_count=0)
void state_stencil(uint8_t write_mask, uint8_t reference, uint8_t compare_mask)
void shader_set(GPUShader *shader)
detail::PassBase< command::DrawMultiBuf > Sub
void setup_view(View &view, const SceneState &scene_state)
void draw(Manager &manager, View &view, const SceneState &scene_state, SceneResources &resources, GPUTexture *depth_in_front_tx)
void sync(const SceneState &scene_state, SceneResources &resources)
void setup_resolve_pass(PassSimple &pass, SceneResources &resources)
void sync(SceneResources &resources)
void draw(Manager &manager, View &view, SceneResources &resources, int2 resolution)
MeshPass(const char *name)
PassMain::Sub & get_subpass(eGeometryType geometry_type, const MaterialTexture *texture=nullptr)
void init_pass(SceneResources &resources, DRWState state, int clip_planes)
void init_subpasses(ePipelineType pipeline, eLightingType lighting, bool clip)
void sync(const SceneState &scene_state, SceneResources &resources)
GPUTexture * deferred_ps_stencil_tx
MeshPass gbuffer_in_front_ps_
TextureFromPool gbuffer_material_tx
Texture shadow_depth_stencil_tx
Framebuffer gbuffer_in_front_fb
TextureFromPool gbuffer_normal_tx
void draw(Manager &manager, SceneResources &resources)
void sync(SceneResources &resources)
StaticShader smaa_aa_weight
GPUShader * volume_get(bool smoke, int interpolation, bool coba, bool slice)
StaticShader taa_accumulation
static ShaderCache & get()
StaticShader extract_stencil
StaticShader transparent_resolve
GPUShader * resolve_get(eLightingType lighting_type, bool cavity=false, bool curvature=false, bool shadow=false)
GPUShader * shadow_get(bool depth_pass, bool manifold, bool cap=false)
StaticShader shadow_visibility_static
StaticShader smaa_resolve
StaticShader dof_downsample
StaticShader smaa_edge_detect
GPUShader * prepass_get(eGeometryType geometry_type, ePipelineType pipeline_type, eLightingType lighting_type, eShaderType shader_type, bool clip)
StaticShader shadow_visibility_dynamic
StaticShader overlay_depth
void draw(Manager &manager, View &view, SceneResources &resources, GPUTexture &depth_stencil_tx, bool force_fail_method)
void object_sync(SceneState &scene_state, ObjectRef &ob_ref, ResourceHandle handle, const bool has_transp_mat)
StaticShader(StaticShader &&other)=default
StaticShader(std::string info_name)
StaticShader & operator=(StaticShader &&other)=default
GPUTexture * extract(Manager &manager, Texture &stencil_src)
void sync(const SceneState &scene_state, SceneResources &resources)
TextureFromPool accumulation_tx
MeshPass accumulation_in_front_ps_
void sync(const SceneState &scene_state, SceneResources &resources)
MeshPass accumulation_ps_
Framebuffer transparent_fb
TextureFromPool reveal_tx
void sync(SceneResources &resources)
void object_sync_volume(Manager &manager, SceneResources &resources, const SceneState &scene_state, ObjectRef &ob_ref, float3 color)
void draw(Manager &manager, View &view, SceneResources &resources)
void object_sync_modifier(Manager &manager, SceneResources &resources, const SceneState &scene_state, ObjectRef &ob_ref, ModifierData *md)
@ DRW_STATE_STENCIL_NEQUAL
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
BLI_INLINE float fb(float length, float L)
detail::Pass< command::DrawCommandBuf > PassSimple
ImageGPUTextures get_material_texture(GPUSamplerState &sampler_state)
static constexpr int geometry_type_len
static constexpr int lighting_type_len
static constexpr int shader_type_len
static constexpr int pipeline_type_len
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
static constexpr GPUSamplerState default_sampler()
static MatBase identity()
GPUSamplerState sampler_state
MaterialTexture()=default
static uint32_t pack_data(float metallic, float roughness, float alpha)
bool use_per_material_batches
MaterialTexture image_paint_override
ObjectState(const SceneState &scene_state, const SceneResources &resources, Object *ob)
eV3DShadingColorType color_type
bool show_missing_texture
StencilViewWorkaround stencil_view
static const int jitter_tx_size
UniformBuffer< WorldData > world_buf
Framebuffer clear_depth_only_fb
void load_jitter_tx(int total_samples)
MaterialTexture missing_texture
StorageVectorBuffer< Material > material_buf
TextureRef depth_in_front_tx
Texture dummy_tile_array_tx
TextureFromPool object_id_tx
Framebuffer clear_in_front_fb
Texture dummy_tile_data_tx
UniformArrayBuffer< float4, 6 > clip_planes_buf
StringRefNull current_matcap
eLightingType lighting_type
bool reset_taa_next_sample
Material material_attribute_color
float4x4 view_projection_matrix
Vector< float4 > clip_planes
Material material_override
eContextObjectMode object_mode
DrawEngineType draw_engine_workbench