Merge branch 'blender-v3.2-release'
This commit is contained in:
@@ -64,7 +64,7 @@ static void eevee_lookdev_hdri_preview_init(EEVEE_Data *vedata, EEVEE_ViewLayerD
|
||||
|
||||
DRW_PASS_CREATE(psl->lookdev_diffuse_pass, state);
|
||||
grp = DRW_shgroup_create(sh, psl->lookdev_diffuse_pass);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, false, false);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, -1.0f, false, false);
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
DRW_shgroup_call(grp, sphere, NULL);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ static void eevee_lookdev_hdri_preview_init(EEVEE_Data *vedata, EEVEE_ViewLayerD
|
||||
|
||||
DRW_PASS_CREATE(psl->lookdev_glossy_pass, state);
|
||||
grp = DRW_shgroup_create(sh, psl->lookdev_glossy_pass);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, false, false);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, -1.0f, false, false);
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
DRW_shgroup_call(grp, sphere, NULL);
|
||||
}
|
||||
|
@@ -67,6 +67,7 @@ void EEVEE_material_bind_resources(DRWShadingGroup *shgrp,
|
||||
EEVEE_Data *vedata,
|
||||
const int *ssr_id,
|
||||
const float *refract_depth,
|
||||
const float alpha_clip_threshold,
|
||||
bool use_ssrefraction,
|
||||
bool use_alpha_blend)
|
||||
{
|
||||
@@ -91,6 +92,8 @@ void EEVEE_material_bind_resources(DRWShadingGroup *shgrp,
|
||||
DRW_shgroup_uniform_block(shgrp, "common_block", sldata->common_ubo);
|
||||
DRW_shgroup_uniform_block_ref(shgrp, "renderpass_block", &pd->renderpass_ubo);
|
||||
|
||||
DRW_shgroup_uniform_float_copy(shgrp, "alphaClipThreshold", alpha_clip_threshold);
|
||||
|
||||
DRW_shgroup_uniform_int_copy(shgrp, "outputSssId", 1);
|
||||
DRW_shgroup_uniform_texture(shgrp, "utilTex", e_data.util_tex);
|
||||
if (use_diffuse || use_glossy || use_refract) {
|
||||
@@ -480,6 +483,8 @@ BLI_INLINE void material_shadow(EEVEE_Data *vedata,
|
||||
/* Shadow Pass */
|
||||
const bool use_shadow_shader = ma->use_nodes && ma->nodetree &&
|
||||
ELEM(ma->blend_shadow, MA_BS_CLIP, MA_BS_HASHED);
|
||||
float alpha_clip_threshold = (ma->blend_shadow == MA_BS_CLIP) ? ma->alpha_threshold : -1.0f;
|
||||
|
||||
int mat_options = VAR_MAT_MESH | VAR_MAT_DEPTH;
|
||||
SET_FLAG_FROM_TEST(mat_options, use_shadow_shader, VAR_MAT_HASH);
|
||||
SET_FLAG_FROM_TEST(mat_options, is_hair, VAR_MAT_HAIR);
|
||||
@@ -503,7 +508,8 @@ BLI_INLINE void material_shadow(EEVEE_Data *vedata,
|
||||
}
|
||||
else {
|
||||
*grp_p = grp = DRW_shgroup_create(sh, psl->shadow_pass);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, false, false);
|
||||
EEVEE_material_bind_resources(
|
||||
grp, gpumat, sldata, vedata, NULL, NULL, alpha_clip_threshold, false, false);
|
||||
}
|
||||
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
@@ -533,6 +539,7 @@ static EeveeMaterialCache material_opaque(EEVEE_Data *vedata,
|
||||
const bool use_ssrefract = use_gpumat && ((ma->blend_flag & MA_BL_SS_REFRACTION) != 0) &&
|
||||
((effects->enabled_effects & EFFECT_REFRACT) != 0);
|
||||
const bool use_depth_shader = use_gpumat && ELEM(ma->blend_method, MA_BM_CLIP, MA_BM_HASHED);
|
||||
float alpha_clip_threshold = (ma->blend_method == MA_BM_CLIP) ? ma->alpha_threshold : -1.0f;
|
||||
|
||||
/* HACK: Assume the struct will never be smaller than our variations.
|
||||
* This allow us to only keep one ghash and avoid bigger keys comparisons/hashing. */
|
||||
@@ -581,7 +588,8 @@ static EeveeMaterialCache material_opaque(EEVEE_Data *vedata,
|
||||
}
|
||||
else {
|
||||
*grp_p = grp = DRW_shgroup_create(sh, depth_ps);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, false, false);
|
||||
EEVEE_material_bind_resources(
|
||||
grp, gpumat, sldata, vedata, NULL, NULL, alpha_clip_threshold, false, false);
|
||||
}
|
||||
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
@@ -630,8 +638,15 @@ static EeveeMaterialCache material_opaque(EEVEE_Data *vedata,
|
||||
}
|
||||
else {
|
||||
*grp_p = grp = DRW_shgroup_create(sh, shading_pass);
|
||||
EEVEE_material_bind_resources(
|
||||
grp, gpumat, sldata, vedata, &ssr_id, &ma->refract_depth, use_ssrefract, false);
|
||||
EEVEE_material_bind_resources(grp,
|
||||
gpumat,
|
||||
sldata,
|
||||
vedata,
|
||||
&ssr_id,
|
||||
&ma->refract_depth,
|
||||
alpha_clip_threshold,
|
||||
use_ssrefract,
|
||||
false);
|
||||
}
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
|
||||
@@ -677,7 +692,7 @@ static EeveeMaterialCache material_transparent(EEVEE_Data *vedata,
|
||||
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->transparent_pass);
|
||||
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, false, true);
|
||||
EEVEE_material_bind_resources(grp, gpumat, sldata, vedata, NULL, NULL, -1.0f, false, true);
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
|
||||
cur_state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||
@@ -699,7 +714,7 @@ static EeveeMaterialCache material_transparent(EEVEE_Data *vedata,
|
||||
psl->transparent_pass);
|
||||
|
||||
EEVEE_material_bind_resources(
|
||||
grp, gpumat, sldata, vedata, &ssr_id, &ma->refract_depth, use_ssrefract, true);
|
||||
grp, gpumat, sldata, vedata, &ssr_id, &ma->refract_depth, -1.0f, use_ssrefract, true);
|
||||
DRW_shgroup_add_material_resources(grp, gpumat);
|
||||
|
||||
cur_state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_CUSTOM;
|
||||
|
@@ -1141,6 +1141,7 @@ void EEVEE_material_bind_resources(DRWShadingGroup *shgrp,
|
||||
EEVEE_Data *vedata,
|
||||
const int *ssr_id,
|
||||
const float *refract_depth,
|
||||
const float alpha_clip_threshold,
|
||||
bool use_ssrefraction,
|
||||
bool use_alpha_blend);
|
||||
/* eevee_lights.c */
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#pragma BLENDER_REQUIRE(closure_eval_translucent_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(renderpass_lib.glsl)
|
||||
|
||||
#ifdef USE_SHADER_TO_RGBA
|
||||
#if defined(USE_SHADER_TO_RGBA) || defined(USE_ALPHA_BLEND)
|
||||
bool do_sss = false;
|
||||
bool do_ssr = false;
|
||||
#else
|
||||
|
@@ -49,7 +49,7 @@ struct Closure {
|
||||
#ifndef GPU_METAL
|
||||
/* Prototype */
|
||||
Closure nodetree_exec();
|
||||
vec4 closure_to_rgba(Closure);
|
||||
vec4 closure_to_rgba(Closure cl);
|
||||
void output_aov(vec4 color, float value, uint hash);
|
||||
vec3 coordinate_camera(vec3 P);
|
||||
vec3 coordinate_screen(vec3 P);
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#pragma BLENDER_REQUIRE(surface_lib.glsl)
|
||||
|
||||
#ifdef USE_ALPHA_HASH
|
||||
/* A value of -1.0 will disable alpha clip and use alpha hash. */
|
||||
uniform float alphaClipThreshold;
|
||||
|
||||
/* From the paper "Hashed Alpha Testing" by Chris Wyman and Morgan McGuire */
|
||||
float hash(vec2 a)
|
||||
@@ -76,9 +78,16 @@ void main()
|
||||
|
||||
float opacity = saturate(1.0 - avg(cl.transmittance));
|
||||
|
||||
/* Hashed Alpha Testing */
|
||||
if (opacity < hashed_alpha_threshold(worldPosition)) {
|
||||
discard;
|
||||
if (alphaClipThreshold == -1.0) {
|
||||
/* NOTE: uniform control flow required for dFdx(). */
|
||||
if (opacity < hashed_alpha_threshold(worldPosition)) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (opacity <= alphaClipThreshold) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -57,3 +57,23 @@ float F_eta(float a, float b)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
vec3 coordinate_camera(vec3 P)
|
||||
{
|
||||
return vec3(0.0);
|
||||
}
|
||||
|
||||
vec3 coordinate_screen(vec3 P)
|
||||
{
|
||||
return vec3(0.0);
|
||||
}
|
||||
|
||||
vec3 coordinate_reflect(vec3 P, vec3 N)
|
||||
{
|
||||
return vec3(0.0);
|
||||
}
|
||||
|
||||
vec3 coordinate_incoming(vec3 P)
|
||||
{
|
||||
return vec3(0.0);
|
||||
}
|
@@ -168,6 +168,7 @@ static void gpu_material_free_single(GPUMaterial *material)
|
||||
if (material->sss_tex_profile != NULL) {
|
||||
GPU_texture_free(material->sss_tex_profile);
|
||||
}
|
||||
MEM_freeN(material);
|
||||
}
|
||||
|
||||
void GPU_material_free(ListBase *gpumaterial)
|
||||
@@ -176,7 +177,6 @@ void GPU_material_free(ListBase *gpumaterial)
|
||||
GPUMaterial *material = link->data;
|
||||
DRW_deferred_shader_remove(material);
|
||||
gpu_material_free_single(material);
|
||||
MEM_freeN(material);
|
||||
}
|
||||
BLI_freelistN(gpumaterial);
|
||||
}
|
||||
|
@@ -18,4 +18,5 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only_clipped)
|
||||
.additional_info("gpu_shader_3D_depth_only")
|
||||
.additional_info("gpu_clip_planes");
|
||||
.additional_info("gpu_clip_planes")
|
||||
.do_static_compilation(true);
|
||||
|
@@ -21,4 +21,5 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped)
|
||||
.additional_info("gpu_shader_3D_flat_color")
|
||||
.additional_info("gpu_clip_planes");
|
||||
.additional_info("gpu_clip_planes")
|
||||
.do_static_compilation(true);
|
||||
|
@@ -41,4 +41,5 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped)
|
||||
.additional_info("gpu_shader_3D_point_uniform_size_uniform_color_aa")
|
||||
.additional_info("gpu_clip_planes");
|
||||
.additional_info("gpu_clip_planes")
|
||||
.do_static_compilation(true);
|
||||
|
@@ -21,4 +21,5 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped)
|
||||
.additional_info("gpu_shader_3D_smooth_color")
|
||||
.additional_info("gpu_clip_planes");
|
||||
.additional_info("gpu_clip_planes")
|
||||
.do_static_compilation(true);
|
||||
|
@@ -154,7 +154,7 @@ GPUTexture *IMB_touch_gpu_texture(
|
||||
|
||||
GPUTexture *tex;
|
||||
if (layers > 0) {
|
||||
tex = GPU_texture_create_2d_array(name, w, h, layers, 1, tex_format, NULL);
|
||||
tex = GPU_texture_create_2d_array(name, w, h, layers, 9999, tex_format, NULL);
|
||||
}
|
||||
else {
|
||||
tex = GPU_texture_create_2d(name, w, h, 9999, tex_format, NULL);
|
||||
|
@@ -578,6 +578,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm,
|
||||
|
||||
wm_window_swap_buffers(win);
|
||||
|
||||
/* Clear double buffer to avoids flickering of new windows on certain drivers. (See T97600) */
|
||||
GPU_clear_color(0.55f, 0.55f, 0.55f, 1.0f);
|
||||
|
||||
// GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user