Exemple #1
0
void EEVEE_shaders_lightprobe_shaders_init(void)
{
  BLI_assert(e_data.probe_filter_glossy_sh == NULL);
  char *shader_str = NULL;

  shader_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                datatoc_common_uniforms_lib_glsl,
                                datatoc_bsdf_common_lib_glsl,
                                datatoc_bsdf_sampling_lib_glsl,
                                datatoc_lightprobe_filter_glossy_frag_glsl);

  e_data.probe_filter_glossy_sh = DRW_shader_create(
      datatoc_lightprobe_vert_glsl, datatoc_lightprobe_geom_glsl, shader_str, filter_defines);

  e_data.probe_default_sh = DRW_shader_create_with_lib(datatoc_background_vert_glsl,
                                                       NULL,
                                                       datatoc_default_world_frag_glsl,
                                                       datatoc_common_view_lib_glsl,
                                                       NULL);

  MEM_freeN(shader_str);

  shader_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                datatoc_common_uniforms_lib_glsl,
                                datatoc_bsdf_common_lib_glsl,
                                datatoc_bsdf_sampling_lib_glsl,
                                datatoc_lightprobe_filter_diffuse_frag_glsl);

  e_data.probe_filter_diffuse_sh = DRW_shader_create_fullscreen(shader_str, filter_defines);

  MEM_freeN(shader_str);

  shader_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                datatoc_common_uniforms_lib_glsl,
                                datatoc_bsdf_common_lib_glsl,
                                datatoc_bsdf_sampling_lib_glsl,
                                datatoc_lightprobe_filter_visibility_frag_glsl);

  e_data.probe_filter_visibility_sh = DRW_shader_create_fullscreen(shader_str, filter_defines);

  MEM_freeN(shader_str);

  e_data.probe_grid_fill_sh = DRW_shader_create_fullscreen(datatoc_lightprobe_grid_fill_frag_glsl,
                                                           filter_defines);

  e_data.probe_planar_downsample_sh = DRW_shader_create(
      datatoc_lightprobe_planar_downsample_vert_glsl,
      datatoc_lightprobe_planar_downsample_geom_glsl,
      datatoc_lightprobe_planar_downsample_frag_glsl,
      NULL);
}
Exemple #2
0
GPUShader *EEVEE_shaders_probe_planar_display_sh_get(void)
{
  if (e_data.probe_planar_display_sh == NULL) {
    char *vert_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                      datatoc_lightprobe_planar_display_vert_glsl);

    char *shader_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                        datatoc_lightprobe_planar_display_frag_glsl);

    e_data.probe_planar_display_sh = DRW_shader_create(vert_str, NULL, shader_str, NULL);

    MEM_freeN(vert_str);
    MEM_freeN(shader_str);
  }
  return e_data.probe_planar_display_sh;
}
Exemple #3
0
GPUShader *EEVEE_shaders_probe_cube_display_sh_get(void)
{
  if (e_data.probe_cube_display_sh == NULL) {
    char *shader_str = BLI_string_joinN(datatoc_octahedron_lib_glsl,
                                        datatoc_common_view_lib_glsl,
                                        datatoc_common_uniforms_lib_glsl,
                                        datatoc_bsdf_common_lib_glsl,
                                        datatoc_lightprobe_lib_glsl,
                                        datatoc_lightprobe_cube_display_frag_glsl);

    char *vert_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                      datatoc_lightprobe_cube_display_vert_glsl);

    e_data.probe_cube_display_sh = DRW_shader_create(vert_str, NULL, shader_str, SHADER_DEFINES);

    MEM_freeN(vert_str);
    MEM_freeN(shader_str);
  }
  return e_data.probe_cube_display_sh;
}
Exemple #4
0
GPUShader *EEVEE_shaders_velocity_resolve_sh_get(void)
{
  if (e_data.velocity_resolve_sh == NULL) {
    char *frag_str = BLI_string_joinN(datatoc_common_uniforms_lib_glsl,
                                      datatoc_common_view_lib_glsl,
                                      datatoc_bsdf_common_lib_glsl,
                                      datatoc_effect_velocity_resolve_frag_glsl);

    e_data.velocity_resolve_sh = DRW_shader_create_fullscreen(frag_str, NULL);

    MEM_freeN(frag_str);
  }
  return e_data.velocity_resolve_sh;
}
Exemple #5
0
static void eevee_create_shader_occlusion(void)
{
  char *frag_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                    datatoc_common_uniforms_lib_glsl,
                                    datatoc_bsdf_common_lib_glsl,
                                    datatoc_ambient_occlusion_lib_glsl,
                                    datatoc_effect_gtao_frag_glsl);

  e_data.gtao_sh = DRW_shader_create_fullscreen(frag_str, NULL);
  e_data.gtao_layer_sh = DRW_shader_create_fullscreen(frag_str, "#define LAYERED_DEPTH\n");
  e_data.gtao_debug_sh = DRW_shader_create_fullscreen(frag_str, "#define DEBUG_AO\n");

  MEM_freeN(frag_str);
}
static struct GPUShader *eevee_effects_screen_raytrace_shader_get(int options)
{
  if (e_data.ssr_sh[options] == NULL) {
    char *ssr_shader_str = BLI_string_joinN(datatoc_common_view_lib_glsl,
                                            datatoc_common_uniforms_lib_glsl,
                                            datatoc_bsdf_common_lib_glsl,
                                            datatoc_bsdf_sampling_lib_glsl,
                                            datatoc_ambient_occlusion_lib_glsl,
                                            datatoc_octahedron_lib_glsl,
                                            datatoc_lightprobe_lib_glsl,
                                            datatoc_raytrace_lib_glsl,
                                            datatoc_effect_ssr_frag_glsl);

    DynStr *ds_defines = BLI_dynstr_new();
    BLI_dynstr_append(ds_defines, SHADER_DEFINES);
    if (options & SSR_RESOLVE) {
      BLI_dynstr_append(ds_defines, "#define STEP_RESOLVE\n");
    }
    else {
      BLI_dynstr_append(ds_defines, "#define STEP_RAYTRACE\n");
      BLI_dynstr_append(ds_defines, "#define PLANAR_PROBE_RAYTRACE\n");
    }
    if (options & SSR_FULL_TRACE) {
      BLI_dynstr_append(ds_defines, "#define FULLRES\n");
    }
    if (options & SSR_AO) {
      BLI_dynstr_append(ds_defines, "#define SSR_AO\n");
    }
    char *ssr_define_str = BLI_dynstr_get_cstring(ds_defines);
    BLI_dynstr_free(ds_defines);

    e_data.ssr_sh[options] = DRW_shader_create_fullscreen(ssr_shader_str, ssr_define_str);

    MEM_freeN(ssr_shader_str);
    MEM_freeN(ssr_define_str);
  }

  return e_data.ssr_sh[options];
}
Exemple #7
0
GPUShader *EEVEE_shaders_taa_resolve_sh_get(EEVEE_EffectsFlag enabled_effects)
{
  GPUShader **sh;
  const char *define = NULL;
  if (enabled_effects & EFFECT_TAA_REPROJECT) {
    sh = &e_data.taa_resolve_reproject_sh;
    define = "#define USE_REPROJECTION\n";
  }
  else {
    sh = &e_data.taa_resolve_sh;
  }
  if (*sh == NULL) {
    char *frag_str = BLI_string_joinN(datatoc_common_uniforms_lib_glsl,
                                      datatoc_common_view_lib_glsl,
                                      datatoc_bsdf_common_lib_glsl,
                                      datatoc_effect_temporal_aa_glsl);

    *sh = DRW_shader_create_fullscreen(frag_str, define);
    MEM_freeN(frag_str);
  }

  return *sh;
}