static void basic_draw_scene(void *vedata) { BASIC_PassList *psl = ((BASIC_Data *)vedata)->psl; DRW_draw_pass(psl->depth_pass); DRW_draw_pass(psl->depth_pass_cull); }
/* Draw time ! Control rendering pipeline from here */ static void EDIT_TEXT_draw_scene(void *vedata) { EDIT_TEXT_PassList *psl = ((EDIT_TEXT_Data *)vedata)->psl; EDIT_TEXT_FramebufferList *fbl = ((EDIT_TEXT_Data *)vedata)->fbl; /* Default framebuffer and texture */ DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); UNUSED_VARS(fbl, dfbl, dtxl); /* Show / hide entire passes, swap framebuffers ... whatever you fancy */ /* * DRW_framebuffer_texture_detach(dtxl->depth); * DRW_framebuffer_bind(fbl->custom_fb); * DRW_draw_pass(psl->pass); * DRW_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0); * DRW_framebuffer_bind(dfbl->default_fb); */ DRW_draw_pass(psl->wire_pass); if (!DRW_pass_is_empty(psl->text_box_pass)) { DRW_draw_pass(psl->text_box_pass); } set_inverted_drawing(1); DRW_draw_pass(psl->overlay_select_pass); DRW_draw_pass(psl->overlay_cursor_pass); set_inverted_drawing(0); /* If you changed framebuffer, double check you rebind * the default one with its textures attached before finishing */ }
void EEVEE_reflection_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) { EEVEE_PassList *psl = vedata->psl; EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_StorageList *stl = vedata->stl; EEVEE_TextureList *txl = vedata->txl; EEVEE_EffectsInfo *effects = stl->effects; if (((effects->enabled_effects & EFFECT_SSR) != 0) && stl->g_data->valid_double_buffer) { DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); e_data.depth_src = dtxl->depth; DRW_stats_group_start("SSR"); /* Raytrace. */ GPU_framebuffer_bind(fbl->screen_tracing_fb); DRW_draw_pass(psl->ssr_raytrace); EEVEE_downsample_buffer(vedata, txl->color_double_buffer, 9); /* Resolve at fullres */ int sample = (DRW_state_is_image_render()) ? effects->taa_render_sample : effects->taa_current_sample; /* Doing a neighbor shift only after a few iteration. * We wait for a prime number of cycles to avoid noise correlation. * This reduces variance faster. */ effects->ssr_neighbor_ofs = ((sample / 5) % 8) * 4; switch ((sample / 11) % 4) { case 0: effects->ssr_halfres_ofs[0] = 0; effects->ssr_halfres_ofs[1] = 0; break; case 1: effects->ssr_halfres_ofs[0] = 0; effects->ssr_halfres_ofs[1] = 1; break; case 2: effects->ssr_halfres_ofs[0] = 1; effects->ssr_halfres_ofs[1] = 0; break; case 4: effects->ssr_halfres_ofs[0] = 1; effects->ssr_halfres_ofs[1] = 1; break; } GPU_framebuffer_bind(fbl->main_color_fb); DRW_draw_pass(psl->ssr_resolve); /* Restore */ GPU_framebuffer_bind(fbl->main_fb); DRW_stats_group_end(); } }
void EEVEE_occlusion_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata, struct GPUTexture *depth_src, int layer) { EEVEE_PassList *psl = vedata->psl; EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_StorageList *stl = vedata->stl; EEVEE_EffectsInfo *effects = stl->effects; if ((effects->enabled_effects & EFFECT_GTAO) != 0) { DRW_stats_group_start("GTAO Horizon Scan"); effects->ao_src_depth = depth_src; effects->ao_depth_layer = layer; GPU_framebuffer_bind(fbl->gtao_fb); if (layer >= 0) { DRW_draw_pass(psl->ao_horizon_search_layer); } else { DRW_draw_pass(psl->ao_horizon_search); } if (GPU_mip_render_workaround() || GPU_type_matches(GPU_DEVICE_INTEL_UHD, GPU_OS_WIN, GPU_DRIVER_ANY)) { /* Fix dot corruption on intel HD5XX/HD6XX series. */ GPU_flush(); } /* Restore */ GPU_framebuffer_bind(fbl->main_fb); DRW_stats_group_end(); } }
void EEVEE_occlusion_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) { EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_PassList *psl = vedata->psl; if (fbl->ao_accum_fb != NULL) { DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); /* Update the min_max/horizon buffers so the refracion materials appear in it. */ EEVEE_create_minmax_buffer(vedata, dtxl->depth, -1); EEVEE_occlusion_compute(sldata, vedata, dtxl->depth, -1); GPU_framebuffer_bind(fbl->ao_accum_fb); DRW_draw_pass(psl->ao_accum_ps); /* Restore */ GPU_framebuffer_bind(fbl->main_fb); } }
void EEVEE_occlusion_draw_debug(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) { EEVEE_PassList *psl = vedata->psl; EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_StorageList *stl = vedata->stl; EEVEE_EffectsInfo *effects = stl->effects; if (((effects->enabled_effects & EFFECT_GTAO) != 0) && (G.debug_value == 6)) { DRW_stats_group_start("GTAO Debug"); GPU_framebuffer_bind(fbl->gtao_debug_fb); DRW_draw_pass(psl->ao_horizon_debug); /* Restore */ GPU_framebuffer_bind(fbl->main_fb); DRW_stats_group_end(); } }