Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_screen_raytrace.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (e_data.ssr_sh[options] == NULL) { | ||||
| MEM_freeN(ssr_shader_str); | MEM_freeN(ssr_shader_str); | ||||
| MEM_freeN(ssr_define_str); | MEM_freeN(ssr_define_str); | ||||
| } | } | ||||
| return e_data.ssr_sh[options]; | return e_data.ssr_sh[options]; | ||||
| } | } | ||||
| int EEVEE_screen_raytrace_init(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *vedata) | int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| const float *viewport_size = DRW_viewport_size_get(); | const float *viewport_size = DRW_viewport_size_get(); | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| SceneLayer *scene_layer = draw_ctx->scene_layer; | ViewLayer *view_layer = draw_ctx->view_layer; | ||||
| IDProperty *props = BKE_scene_layer_engine_evaluated_get(scene_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); | IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); | ||||
| /* Compute pixel size, (shared with contact shadows) */ | /* Compute pixel size, (shared with contact shadows) */ | ||||
| copy_v2_v2(effects->ssr_pixelsize, viewport_size); | copy_v2_v2(effects->ssr_pixelsize, viewport_size); | ||||
| invert_v2(effects->ssr_pixelsize); | invert_v2(effects->ssr_pixelsize); | ||||
| if (BKE_collection_engine_property_value_get_bool(props, "ssr_enable")) { | if (BKE_collection_engine_property_value_get_bool(props, "ssr_enable")) { | ||||
| const bool use_refraction = BKE_collection_engine_property_value_get_bool(props, "ssr_refraction"); | const bool use_refraction = BKE_collection_engine_property_value_get_bool(props, "ssr_refraction"); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) | ||||
| DRW_FRAMEBUFFER_FREE_SAFE(fbl->screen_tracing_fb); | DRW_FRAMEBUFFER_FREE_SAFE(fbl->screen_tracing_fb); | ||||
| for (int i = 0; i < 4; ++i) { | for (int i = 0; i < 4; ++i) { | ||||
| stl->g_data->ssr_hit_output[i] = NULL; | stl->g_data->ssr_hit_output[i] = NULL; | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| void EEVEE_screen_raytrace_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata) | void EEVEE_screen_raytrace_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = vedata->psl; | EEVEE_PassList *psl = vedata->psl; | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get(); | struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get(); | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | else { | ||||
| /* Use shadow_pool as fallback to avoid sampling problem on certain platform, see: T52593 */ | /* Use shadow_pool as fallback to avoid sampling problem on certain platform, see: T52593 */ | ||||
| DRW_shgroup_uniform_buffer(grp, "horizonBuffer", &sldata->shadow_pool); | DRW_shgroup_uniform_buffer(grp, "horizonBuffer", &sldata->shadow_pool); | ||||
| } | } | ||||
| DRW_shgroup_call_add(grp, quad, NULL); | DRW_shgroup_call_add(grp, quad, NULL); | ||||
| } | } | ||||
| } | } | ||||
| void EEVEE_refraction_compute(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *vedata) | void EEVEE_refraction_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| if ((effects->enabled_effects & EFFECT_REFRACT) != 0) { | if ((effects->enabled_effects & EFFECT_REFRACT) != 0) { | ||||
| DRW_framebuffer_texture_attach(fbl->refract_fb, txl->refract_color, 0, 0); | DRW_framebuffer_texture_attach(fbl->refract_fb, txl->refract_color, 0, 0); | ||||
| DRW_framebuffer_blit(fbl->main, fbl->refract_fb, false, false); | DRW_framebuffer_blit(fbl->main, fbl->refract_fb, false, false); | ||||
| EEVEE_downsample_buffer(vedata, fbl->downsample_fb, txl->refract_color, 9); | EEVEE_downsample_buffer(vedata, fbl->downsample_fb, txl->refract_color, 9); | ||||
| /* Restore */ | /* Restore */ | ||||
| DRW_framebuffer_bind(fbl->main); | DRW_framebuffer_bind(fbl->main); | ||||
| } | } | ||||
| } | } | ||||
| void EEVEE_reflection_compute(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *vedata) | void EEVEE_reflection_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = vedata->psl; | EEVEE_PassList *psl = vedata->psl; | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| if (((effects->enabled_effects & EFFECT_SSR) != 0) && stl->g_data->valid_double_buffer) { | if (((effects->enabled_effects & EFFECT_SSR) != 0) && stl->g_data->valid_double_buffer) { | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||