EEVEE: Optimise texture usage flags #107037
|
@ -42,8 +42,9 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
|
|||
effects->blit_texel_size[0] = 1.0f / (float)blitsize[0];
|
||||
effects->blit_texel_size[1] = 1.0f / (float)blitsize[1];
|
||||
|
||||
effects->bloom_blit = DRW_texture_pool_query_2d(
|
||||
blitsize[0], blitsize[1], GPU_R11F_G11F_B10F, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
effects->bloom_blit = DRW_texture_pool_query_2d_ex(
|
||||
blitsize[0], blitsize[1], GPU_R11F_G11F_B10F, usage, &draw_engine_eevee_type);
|
||||
|
||||
GPU_framebuffer_ensure_config(
|
||||
&fbl->bloom_blit_fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(effects->bloom_blit)});
|
||||
|
@ -83,8 +84,11 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
|
|||
effects->downsamp_texel_size[i][0] = 1.0f / (float)texsize[0];
|
||||
effects->downsamp_texel_size[i][1] = 1.0f / (float)texsize[1];
|
||||
|
||||
effects->bloom_downsample[i] = DRW_texture_pool_query_2d(
|
||||
texsize[0], texsize[1], GPU_R11F_G11F_B10F, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage downsample_usage = GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_ATTACHMENT |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
effects->bloom_downsample[i] = DRW_texture_pool_query_2d_ex(
|
||||
texsize[0], texsize[1], GPU_R11F_G11F_B10F, downsample_usage, &draw_engine_eevee_type);
|
||||
GPU_framebuffer_ensure_config(
|
||||
&fbl->bloom_down_fb[i],
|
||||
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(effects->bloom_downsample[i])});
|
||||
|
@ -99,8 +103,12 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
|
|||
texsize[0] = MAX2(texsize[0], 2);
|
||||
texsize[1] = MAX2(texsize[1], 2);
|
||||
|
||||
effects->bloom_upsample[i] = DRW_texture_pool_query_2d(
|
||||
texsize[0], texsize[1], GPU_R11F_G11F_B10F, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage upsample_usage = GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_ATTACHMENT |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
|
||||
effects->bloom_upsample[i] = DRW_texture_pool_query_2d_ex(
|
||||
texsize[0], texsize[1], GPU_R11F_G11F_B10F, upsample_usage, &draw_engine_eevee_type);
|
||||
GPU_framebuffer_ensure_config(
|
||||
&fbl->bloom_accum_fb[i],
|
||||
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(effects->bloom_upsample[i])});
|
||||
|
|
|
@ -576,7 +576,8 @@ static void dof_reduce_pass_init(EEVEE_FramebufferList *fbl,
|
|||
DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
|
||||
|
||||
void *owner = (void *)&EEVEE_depth_of_field_init;
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
fx->dof_downsample_tx = DRW_texture_pool_query_2d_ex(
|
||||
UNPACK2(quater_res), COLOR_FORMAT, usage, owner);
|
||||
|
||||
|
|
|
@ -118,8 +118,13 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
|
|||
});
|
||||
}
|
||||
else {
|
||||
DRW_texture_ensure_2d(
|
||||
&txl->maxzbuffer, UNPACK2(effects->hiz_size), GPU_DEPTH_COMPONENT24, DRW_TEX_MIPMAP);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
DRW_texture_ensure_2d_ex(&txl->maxzbuffer,
|
||||
UNPACK2(effects->hiz_size),
|
||||
GPU_DEPTH_COMPONENT24,
|
||||
usage,
|
||||
DRW_TEX_MIPMAP);
|
||||
GPU_framebuffer_ensure_config(&fbl->maxzbuffer_fb,
|
||||
{
|
||||
GPU_ATTACHMENT_TEXTURE(txl->maxzbuffer),
|
||||
|
@ -146,10 +151,13 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
|
|||
* Used for SSReflections & SSRefractions.
|
||||
*/
|
||||
if ((effects->enabled_effects & EFFECT_RADIANCE_BUFFER) != 0) {
|
||||
DRW_texture_ensure_2d(&txl->filtered_radiance,
|
||||
UNPACK2(effects->hiz_size),
|
||||
GPU_R11F_G11F_B10F,
|
||||
DRW_TEX_FILTER | DRW_TEX_MIPMAP);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
DRW_texture_ensure_2d_ex(&txl->filtered_radiance,
|
||||
UNPACK2(effects->hiz_size),
|
||||
GPU_R11F_G11F_B10F,
|
||||
usage,
|
||||
DRW_TEX_FILTER | DRW_TEX_MIPMAP);
|
||||
|
||||
GPU_framebuffer_ensure_config(&fbl->radiance_filtered_fb,
|
||||
{
|
||||
|
@ -166,8 +174,9 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
|
|||
* Normal buffer for deferred passes.
|
||||
*/
|
||||
if ((effects->enabled_effects & EFFECT_NORMAL_BUFFER) != 0) {
|
||||
effects->ssr_normal_input = DRW_texture_pool_query_2d(
|
||||
size_fs[0], size_fs[1], GPU_RG16, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
effects->ssr_normal_input = DRW_texture_pool_query_2d_ex(
|
||||
size_fs[0], size_fs[1], GPU_RG16, usage, &draw_engine_eevee_type);
|
||||
|
||||
GPU_framebuffer_texture_attach(fbl->main_fb, effects->ssr_normal_input, 1, 0);
|
||||
}
|
||||
|
@ -179,8 +188,9 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
|
|||
* Motion vector buffer for correct TAA / motion blur.
|
||||
*/
|
||||
if ((effects->enabled_effects & EFFECT_VELOCITY_BUFFER) != 0) {
|
||||
effects->velocity_tx = DRW_texture_pool_query_2d(
|
||||
size_fs[0], size_fs[1], GPU_RGBA16, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
effects->velocity_tx = DRW_texture_pool_query_2d_ex(
|
||||
size_fs[0], size_fs[1], GPU_RGBA16, usage, &draw_engine_eevee_type);
|
||||
|
||||
GPU_framebuffer_ensure_config(&fbl->velocity_fb,
|
||||
{
|
||||
|
|
|
@ -101,22 +101,28 @@ static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref)
|
|||
|
||||
/* We need an Array texture so allocate it ourself */
|
||||
if (!txl->planar_pool) {
|
||||
eGPUTextureUsage planar_usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
eGPUTextureUsage planar_usage_depth = GPU_TEXTURE_USAGE_ATTACHMENT |
|
||||
GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
if (num_planar_ref > 0) {
|
||||
txl->planar_pool = DRW_texture_create_2d_array(width,
|
||||
height,
|
||||
num_planar_ref,
|
||||
GPU_R11F_G11F_B10F,
|
||||
DRW_TEX_FILTER | DRW_TEX_MIPMAP,
|
||||
NULL);
|
||||
txl->planar_depth = DRW_texture_create_2d_array(
|
||||
width, height, num_planar_ref, GPU_DEPTH_COMPONENT24, 0, NULL);
|
||||
txl->planar_pool = DRW_texture_create_2d_array_ex(width,
|
||||
height,
|
||||
num_planar_ref,
|
||||
GPU_R11F_G11F_B10F,
|
||||
planar_usage,
|
||||
DRW_TEX_FILTER | DRW_TEX_MIPMAP,
|
||||
NULL);
|
||||
txl->planar_depth = DRW_texture_create_2d_array_ex(
|
||||
width, height, num_planar_ref, GPU_DEPTH_COMPONENT24, planar_usage_depth, 0, NULL);
|
||||
}
|
||||
else if (num_planar_ref == 0) {
|
||||
/* Makes Opengl Happy : Create a placeholder texture that will never be sampled but still
|
||||
* bound to shader. */
|
||||
txl->planar_pool = DRW_texture_create_2d_array(
|
||||
1, 1, 1, GPU_RGBA8, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL);
|
||||
txl->planar_depth = DRW_texture_create_2d_array(1, 1, 1, GPU_DEPTH_COMPONENT24, 0, NULL);
|
||||
txl->planar_pool = DRW_texture_create_2d_array_ex(
|
||||
1, 1, 1, GPU_RGBA8, planar_usage, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL);
|
||||
txl->planar_depth = DRW_texture_create_2d_array_ex(
|
||||
1, 1, 1, GPU_DEPTH_COMPONENT24, planar_usage_depth, 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,8 +188,10 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
|
||||
/* Placeholder planar pool: used when rendering planar reflections (avoid dependency loop). */
|
||||
if (!e_data.planar_pool_placeholder) {
|
||||
e_data.planar_pool_placeholder = DRW_texture_create_2d_array(
|
||||
1, 1, 1, GPU_RGBA8, DRW_TEX_FILTER, NULL);
|
||||
eGPUTextureUsage planar_usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW;
|
||||
e_data.planar_pool_placeholder = DRW_texture_create_2d_array_ex(
|
||||
1, 1, 1, GPU_RGBA8, planar_usage, DRW_TEX_FILTER, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,8 +197,9 @@ static void eevee_init_util_texture(void)
|
|||
texels_layer += 64 * 64;
|
||||
}
|
||||
|
||||
e_data.util_tex = DRW_texture_create_2d_array(
|
||||
64, 64, layers, GPU_RGBA16F, DRW_TEX_FILTER | DRW_TEX_WRAP, (float *)texels);
|
||||
eGPUTextureUsage util_usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
e_data.util_tex = DRW_texture_create_2d_array_ex(
|
||||
64, 64, layers, GPU_RGBA16F, util_usage, DRW_TEX_FILTER | DRW_TEX_WRAP, (float *)texels);
|
||||
|
||||
MEM_freeN(texels);
|
||||
#if RUNTIME_LUT_CREATION
|
||||
|
|
|
@ -36,8 +36,10 @@ int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
|
||||
|
||||
if (!e_data.dummy_horizon_tx) {
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
const float pixel[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
e_data.dummy_horizon_tx = DRW_texture_create_2d(1, 1, GPU_RGBA8, DRW_TEX_WRAP, pixel);
|
||||
e_data.dummy_horizon_tx = DRW_texture_create_2d_ex(
|
||||
1, 1, GPU_RGBA8, usage, DRW_TEX_WRAP, pixel);
|
||||
}
|
||||
|
||||
if (scene_eval->eevee.flag & SCE_EEVEE_GTAO_ENABLED ||
|
||||
|
@ -61,8 +63,9 @@ int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
|
||||
common_data->ao_bounce_fac = (scene_eval->eevee.flag & SCE_EEVEE_GTAO_BOUNCE) ? 1.0f : 0.0f;
|
||||
|
||||
effects->gtao_horizons_renderpass = DRW_texture_pool_query_2d(
|
||||
UNPACK2(effects->hiz_size), GPU_RGBA8, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
effects->gtao_horizons_renderpass = DRW_texture_pool_query_2d_ex(
|
||||
UNPACK2(effects->hiz_size), GPU_RGBA8, usage, &draw_engine_eevee_type);
|
||||
GPU_framebuffer_ensure_config(
|
||||
&fbl->gtao_fb,
|
||||
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(effects->gtao_horizons_renderpass)});
|
||||
|
|
|
@ -72,13 +72,17 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
common_data->ssr_uv_scale[1] = size_fs[1] / ((float)tracing_res[1] * divisor);
|
||||
|
||||
/* MRT for the shading pass in order to output needed data for the SSR pass. */
|
||||
effects->ssr_specrough_input = DRW_texture_pool_query_2d(UNPACK2(size_fs), format, owner);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
effects->ssr_specrough_input = DRW_texture_pool_query_2d_ex(
|
||||
UNPACK2(size_fs), format, usage, owner);
|
||||
|
||||
GPU_framebuffer_texture_attach(fbl->main_fb, effects->ssr_specrough_input, 2, 0);
|
||||
|
||||
/* Ray-tracing output. */
|
||||
effects->ssr_hit_output = DRW_texture_pool_query_2d(UNPACK2(tracing_res), GPU_RGBA16F, owner);
|
||||
effects->ssr_hit_depth = DRW_texture_pool_query_2d(UNPACK2(tracing_res), GPU_R16F, owner);
|
||||
effects->ssr_hit_output = DRW_texture_pool_query_2d_ex(
|
||||
UNPACK2(tracing_res), GPU_RGBA16F, usage, owner);
|
||||
effects->ssr_hit_depth = DRW_texture_pool_query_2d_ex(
|
||||
UNPACK2(tracing_res), GPU_R16F, usage, owner);
|
||||
|
||||
GPU_framebuffer_ensure_config(&fbl->screen_tracing_fb,
|
||||
{
|
||||
|
|
|
@ -213,22 +213,26 @@ void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
linfo->cache_num_cascade_layer = linfo->num_cascade_layer;
|
||||
}
|
||||
|
||||
eGPUTextureUsage shadow_usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
if (!sldata->shadow_cube_pool) {
|
||||
sldata->shadow_cube_pool = DRW_texture_create_2d_array(linfo->shadow_cube_size,
|
||||
linfo->shadow_cube_size,
|
||||
max_ii(1, linfo->num_cube_layer * 6),
|
||||
shadow_pool_format,
|
||||
DRW_TEX_FILTER | DRW_TEX_COMPARE,
|
||||
NULL);
|
||||
sldata->shadow_cube_pool = DRW_texture_create_2d_array_ex(linfo->shadow_cube_size,
|
||||
linfo->shadow_cube_size,
|
||||
max_ii(1, linfo->num_cube_layer * 6),
|
||||
shadow_pool_format,
|
||||
shadow_usage,
|
||||
DRW_TEX_FILTER | DRW_TEX_COMPARE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!sldata->shadow_cascade_pool) {
|
||||
sldata->shadow_cascade_pool = DRW_texture_create_2d_array(linfo->shadow_cascade_size,
|
||||
linfo->shadow_cascade_size,
|
||||
max_ii(1, linfo->num_cascade_layer),
|
||||
shadow_pool_format,
|
||||
DRW_TEX_FILTER | DRW_TEX_COMPARE,
|
||||
NULL);
|
||||
sldata->shadow_cascade_pool = DRW_texture_create_2d_array_ex(
|
||||
linfo->shadow_cascade_size,
|
||||
linfo->shadow_cascade_size,
|
||||
max_ii(1, linfo->num_cascade_layer),
|
||||
shadow_pool_format,
|
||||
shadow_usage,
|
||||
DRW_TEX_FILTER | DRW_TEX_COMPARE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (sldata->shadow_fb == NULL) {
|
||||
|
|
|
@ -36,16 +36,18 @@ void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
* as the depth buffer we are sampling from. This could be avoided if the stencil is
|
||||
* a separate texture but that needs OpenGL 4.4 or ARB_texture_stencil8.
|
||||
* OR OpenGL 4.3 / ARB_ES3_compatibility if using a render-buffer instead. */
|
||||
effects->sss_stencil = DRW_texture_pool_query_2d(
|
||||
fs_size[0], fs_size[1], GPU_DEPTH24_STENCIL8, &draw_engine_eevee_type);
|
||||
effects->sss_blur = DRW_texture_pool_query_2d(
|
||||
fs_size[0], fs_size[1], GPU_R11F_G11F_B10F, &draw_engine_eevee_type);
|
||||
effects->sss_irradiance = DRW_texture_pool_query_2d(
|
||||
fs_size[0], fs_size[1], GPU_R11F_G11F_B10F, &draw_engine_eevee_type);
|
||||
effects->sss_radius = DRW_texture_pool_query_2d(
|
||||
fs_size[0], fs_size[1], GPU_R16F, &draw_engine_eevee_type);
|
||||
effects->sss_albedo = DRW_texture_pool_query_2d(
|
||||
fs_size[0], fs_size[1], GPU_R11F_G11F_B10F, &draw_engine_eevee_type);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
|
||||
effects->sss_stencil = DRW_texture_pool_query_2d_ex(
|
||||
fs_size[0], fs_size[1], GPU_DEPTH24_STENCIL8, usage, &draw_engine_eevee_type);
|
||||
effects->sss_blur = DRW_texture_pool_query_2d_ex(
|
||||
fs_size[0], fs_size[1], GPU_R11F_G11F_B10F, usage, &draw_engine_eevee_type);
|
||||
effects->sss_irradiance = DRW_texture_pool_query_2d_ex(
|
||||
fs_size[0], fs_size[1], GPU_R11F_G11F_B10F, usage, &draw_engine_eevee_type);
|
||||
effects->sss_radius = DRW_texture_pool_query_2d_ex(
|
||||
fs_size[0], fs_size[1], GPU_R16F, usage, &draw_engine_eevee_type);
|
||||
effects->sss_albedo = DRW_texture_pool_query_2d_ex(
|
||||
fs_size[0], fs_size[1], GPU_R11F_G11F_B10F, usage, &draw_engine_eevee_type);
|
||||
|
||||
GPUTexture *stencil_tex = effects->sss_stencil;
|
||||
|
||||
|
|
|
@ -192,8 +192,11 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
if (!e_data.dummy_scatter) {
|
||||
const float scatter[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
const float transmit[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
e_data.dummy_scatter = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, scatter);
|
||||
e_data.dummy_transmit = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, transmit);
|
||||
eGPUTextureUsage dummy_usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
e_data.dummy_scatter = DRW_texture_create_3d_ex(
|
||||
1, 1, 1, GPU_RGBA8, dummy_usage, DRW_TEX_WRAP, scatter);
|
||||
e_data.dummy_transmit = DRW_texture_create_3d_ex(
|
||||
1, 1, 1, GPU_RGBA8, dummy_usage, DRW_TEX_WRAP, transmit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,31 +427,54 @@ void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
if (txl->volume_prop_scattering == NULL) {
|
||||
/* Volume properties: We evaluate all volumetric objects
|
||||
* and store their final properties into each froxel */
|
||||
txl->volume_prop_scattering = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_prop_extinction = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_prop_emission = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_prop_phase = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_RG16F, DRW_TEX_FILTER, NULL);
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
txl->volume_prop_scattering = DRW_texture_create_3d_ex(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, usage, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_prop_extinction = DRW_texture_create_3d_ex(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, usage, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_prop_emission = DRW_texture_create_3d_ex(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, usage, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_prop_phase = DRW_texture_create_3d_ex(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_RG16F, usage, DRW_TEX_FILTER, NULL);
|
||||
|
||||
/* Volume scattering: We compute for each froxel the
|
||||
* Scattered light towards the view. We also resolve temporal
|
||||
* super sampling during this stage. */
|
||||
txl->volume_scatter = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_transmit = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
eGPUTextureUsage usage_write = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_SHADER_WRITE;
|
||||
txl->volume_scatter = DRW_texture_create_3d_ex(tex_size[0],
|
||||
tex_size[1],
|
||||
tex_size[2],
|
||||
GPU_R11F_G11F_B10F,
|
||||
usage_write,
|
||||
DRW_TEX_FILTER,
|
||||
NULL);
|
||||
txl->volume_transmit = DRW_texture_create_3d_ex(tex_size[0],
|
||||
tex_size[1],
|
||||
tex_size[2],
|
||||
GPU_R11F_G11F_B10F,
|
||||
usage_write,
|
||||
DRW_TEX_FILTER,
|
||||
NULL);
|
||||
|
||||
/* Final integration: We compute for each froxel the
|
||||
* amount of scattered light and extinction coef at this
|
||||
* given depth. We use these textures as double buffer
|
||||
* for the volumetric history. */
|
||||
txl->volume_scatter_history = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_transmit_history = DRW_texture_create_3d(
|
||||
tex_size[0], tex_size[1], tex_size[2], GPU_R11F_G11F_B10F, DRW_TEX_FILTER, NULL);
|
||||
txl->volume_scatter_history = DRW_texture_create_3d_ex(tex_size[0],
|
||||
tex_size[1],
|
||||
tex_size[2],
|
||||
GPU_R11F_G11F_B10F,
|
||||
usage_write,
|
||||
DRW_TEX_FILTER,
|
||||
NULL);
|
||||
txl->volume_transmit_history = DRW_texture_create_3d_ex(tex_size[0],
|
||||
tex_size[1],
|
||||
tex_size[2],
|
||||
GPU_R11F_G11F_B10F,
|
||||
usage_write,
|
||||
DRW_TEX_FILTER,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GPU_framebuffer_ensure_config(&fbl->volumetric_fb,
|
||||
|
|
|
@ -239,7 +239,7 @@ static void gpu_material_sky_texture_build(GPUMaterial *mat)
|
|||
mat->sky_builder->current_layer,
|
||||
1,
|
||||
GPU_RGBA32F,
|
||||
GPU_TEXTURE_USAGE_GENERAL,
|
||||
GPU_TEXTURE_USAGE_SHADER_READ,
|
||||
(float *)mat->sky_builder->pixels);
|
||||
|
||||
MEM_freeN(mat->sky_builder);
|
||||
|
|
Loading…
Reference in New Issue