Пример #1
0
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();
  }
}
Пример #2
0
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();
  }
}
Пример #3
0
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();
  }
}