diff options
author | Clément Foucault <fclem> | 2022-09-02 14:48:55 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-09-02 14:51:43 +0300 |
commit | de818d81c3f9868ca78399fa7f106bed893e540f (patch) | |
tree | f98d9d42e4684ec165a25d82889224f6603ef835 /source/blender/gpu/intern | |
parent | f366d197db24cf611866a8d847b4022a6a46504e (diff) |
Fix T98190: EEVEE: Very slow rendering on Intel HD Graphics 4400
This particular GPU driver does not constant fold all the way in order
to discard the unused branches.
To workaround that, we introduce a series of material flag that generates
defines that only keep used branches.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D15852
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.cc b/source/blender/gpu/intern/gpu_codegen.cc index 82441c3c89c..a05bf51242f 100644 --- a/source/blender/gpu/intern/gpu_codegen.cc +++ b/source/blender/gpu/intern/gpu_codegen.cc @@ -351,6 +351,24 @@ void GPUCodegen::generate_resources() { GPUCodegenCreateInfo &info = *create_info; + /* Ref. T98190: Defines are optimizations for old compilers. + * Might become unecessary with EEVEE-Next. */ + if (GPU_material_flag_get(&mat, GPU_MATFLAG_PRINCIPLED_CLEARCOAT)) { + info.define("PRINCIPLED_CLEARCOAT"); + } + if (GPU_material_flag_get(&mat, GPU_MATFLAG_PRINCIPLED_METALLIC)) { + info.define("PRINCIPLED_METALLIC"); + } + if (GPU_material_flag_get(&mat, GPU_MATFLAG_PRINCIPLED_DIELECTRIC)) { + info.define("PRINCIPLED_DIELECTRIC"); + } + if (GPU_material_flag_get(&mat, GPU_MATFLAG_PRINCIPLED_GLASS)) { + info.define("PRINCIPLED_GLASS"); + } + if (GPU_material_flag_get(&mat, GPU_MATFLAG_PRINCIPLED_ANY)) { + info.define("PRINCIPLED_ANY"); + } + std::stringstream ss; /* Textures. */ |