Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-12-02 03:40:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-12-02 15:15:52 +0300
commit9516921c05bd9fee5c94942eb8e38f47ba7e4351 (patch)
treeda007fc17bc6a02f849dae2e8f76f5ab304fe4dc /source/blender/gpu/intern/gpu_shader.c
parent1f6c3699a836d485ed37f443cd0fcd19e978dbb6 (diff)
Overlay Engine: Refactor & Cleanup
This is the unification of all overlays into one overlay engine as described in T65347. I went over all the code making it more future proof with less hacks and removing old / not relevent parts. Goals / Acheivements: - Remove internal shader usage (only drw shaders) - Remove viewportSize and viewportSizeInv and put them in gloabl ubo - Fixed some drawing issues: Missing probe option and Missing Alt+B clipping of some shader - Remove old (legacy) shaders dependancy (not using view UBO). - Less shader variation (less compilation time at first load and less patching needed for vulkan) - removed some geom shaders when I could - Remove static e_data (except shaders storage where it is OK) - Clear the way to fix some anoying limitations (dithered transparency, background image compositing etc...) - Wireframe drawing now uses the same batching capabilities as workbench & eevee (indirect drawing). - Reduced complexity, removed ~3000 Lines of code in draw (also removed a lot of unused shader in GPU). - Post AA to avoid complexity and cost of MSAA. Remaining issues: - ~~Armature edits, overlay toggles, (... others?) are not refreshing viewport after AA is complete~~ - FXAA is not the best for wires, maybe investigate SMAA - Maybe do something more temporally stable for AA. - ~~Paint overlays are not working with AA.~~ - ~~infront objects are difficult to select.~~ - ~~the infront wires sometimes goes through they solid counterpart (missing clear maybe?) (toggle overlays on-off when using infront+wireframe overlay in solid shading)~~ Note: I made some decision to change slightly the appearance of some objects to simplify their drawing. Namely the empty arrows end (which is now hollow/wire) and distance points of the cameras/spots being done by lines. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6296
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader.c')
-rw-r--r--source/blender/gpu/intern/gpu_shader.c112
1 files changed, 1 insertions, 111 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 5df73d1a0c6..ae2c7864e36 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -102,20 +102,7 @@ extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
extern char datatoc_gpu_shader_3D_passthrough_vert_glsl[];
extern char datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl[];
-extern char datatoc_gpu_shader_instance_vert_glsl[];
extern char datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl[];
-extern char datatoc_gpu_shader_instance_variying_size_variying_id_vert_glsl[];
-extern char datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl[];
-extern char datatoc_gpu_shader_instance_screenspace_variying_color_vert_glsl[];
-extern char datatoc_gpu_shader_instance_screen_aligned_vert_glsl[];
-extern char datatoc_gpu_shader_instance_camera_vert_glsl[];
-extern char datatoc_gpu_shader_instance_distance_line_vert_glsl[];
-extern char datatoc_gpu_shader_instance_edges_variying_color_geom_glsl[];
-extern char datatoc_gpu_shader_instance_edges_variying_color_vert_glsl[];
-extern char datatoc_gpu_shader_instance_mball_handles_vert_glsl[];
-
-extern char datatoc_gpu_shader_3D_groundpoint_vert_glsl[];
-extern char datatoc_gpu_shader_3D_groundline_geom_glsl[];
extern char datatoc_gpu_shader_point_uniform_color_frag_glsl[];
extern char datatoc_gpu_shader_point_uniform_color_aa_frag_glsl[];
@@ -141,14 +128,10 @@ extern char datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl[];
extern char datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl[];
extern char datatoc_gpu_shader_2D_line_dashed_frag_glsl[];
-extern char datatoc_gpu_shader_2D_line_dashed_geom_glsl[];
extern char datatoc_gpu_shader_3D_line_dashed_uniform_color_vert_glsl[];
extern char datatoc_gpu_shader_text_vert_glsl[];
-extern char datatoc_gpu_shader_text_geom_glsl[];
extern char datatoc_gpu_shader_text_frag_glsl[];
-extern char datatoc_gpu_shader_text_simple_vert_glsl[];
-extern char datatoc_gpu_shader_text_simple_geom_glsl[];
extern char datatoc_gpu_shader_keyframe_diamond_vert_glsl[];
extern char datatoc_gpu_shader_keyframe_diamond_frag_glsl[];
@@ -885,13 +868,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
[GPU_SHADER_TEXT] =
{
.vert = datatoc_gpu_shader_text_vert_glsl,
- .geom = datatoc_gpu_shader_text_geom_glsl,
- .frag = datatoc_gpu_shader_text_frag_glsl,
- },
- [GPU_SHADER_TEXT_SIMPLE] =
- {
- .vert = datatoc_gpu_shader_text_simple_vert_glsl,
- .geom = datatoc_gpu_shader_text_simple_geom_glsl,
.frag = datatoc_gpu_shader_text_frag_glsl,
},
[GPU_SHADER_KEYFRAME_DIAMOND] =
@@ -1105,70 +1081,17 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
.frag = datatoc_gpu_shader_uniform_color_frag_glsl,
},
- [GPU_SHADER_3D_GROUNDPOINT] =
- {
- .vert = datatoc_gpu_shader_3D_groundpoint_vert_glsl,
- .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl,
- },
- [GPU_SHADER_3D_GROUNDLINE] =
- {
- .vert = datatoc_gpu_shader_3D_passthrough_vert_glsl,
- .geom = datatoc_gpu_shader_3D_groundline_geom_glsl,
- .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
- },
-
[GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] =
{
.vert = datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl,
- .geom = datatoc_gpu_shader_2D_line_dashed_geom_glsl,
.frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl,
},
[GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR] =
{
.vert = datatoc_gpu_shader_3D_line_dashed_uniform_color_vert_glsl,
- .geom = datatoc_gpu_shader_2D_line_dashed_geom_glsl,
.frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl,
},
- [GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR] =
- {
- .vert = datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl,
- .frag = datatoc_gpu_shader_simple_lighting_frag_glsl,
- .defs = "#define USE_INSTANCE_COLOR\n",
- },
- [GPU_SHADER_3D_OBJECTSPACE_VARIYING_COLOR] =
- {
- .vert = datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
- [GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR] =
- {
- .vert = datatoc_gpu_shader_instance_screenspace_variying_color_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
- [GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS] =
- {
- .vert = datatoc_gpu_shader_instance_screen_aligned_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- .defs = "#define AXIS_NAME\n",
- },
- [GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED] =
- {
- .vert = datatoc_gpu_shader_instance_screen_aligned_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
-
- [GPU_SHADER_CAMERA] =
- {
- .vert = datatoc_gpu_shader_instance_camera_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
- [GPU_SHADER_DISTANCE_LINES] =
- {
- .vert = datatoc_gpu_shader_instance_distance_line_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
-
[GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR] =
{
.vert = datatoc_gpu_shader_2D_vert_glsl,
@@ -1225,34 +1148,12 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
.frag = datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl,
},
- [GPU_SHADER_INSTANCE_UNIFORM_COLOR] =
- {
- .vert = datatoc_gpu_shader_instance_vert_glsl,
- .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
- },
- [GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE] =
- {
- .vert = datatoc_gpu_shader_instance_variying_size_variying_id_vert_glsl,
- .frag = datatoc_gpu_shader_flat_id_frag_glsl,
- .defs = "#define UNIFORM_SCALE\n",
- },
[GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE] =
{
.vert = datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
.frag = datatoc_gpu_shader_flat_color_frag_glsl,
.defs = "#define UNIFORM_SCALE\n",
},
- [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE] =
- {
- .vert = datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
- [GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR] =
- {
- .vert = datatoc_gpu_shader_instance_edges_variying_color_vert_glsl,
- .geom = datatoc_gpu_shader_instance_edges_variying_color_geom_glsl,
- .frag = datatoc_gpu_shader_flat_color_frag_glsl,
- },
[GPU_SHADER_2D_AREA_EDGES] =
{
@@ -1366,22 +1267,11 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader,
GPU_SHADER_3D_UNIFORM_COLOR,
GPU_SHADER_3D_SMOOTH_COLOR,
GPU_SHADER_3D_DEPTH_ONLY,
- GPU_SHADER_CAMERA,
GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE,
- GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE,
GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA,
GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA,
- GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR,
- GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED,
-
- GPU_SHADER_3D_GROUNDLINE,
- GPU_SHADER_3D_GROUNDPOINT,
- GPU_SHADER_DISTANCE_LINES,
- GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR) ||
- ELEM(shader,
GPU_SHADER_3D_FLAT_COLOR,
- GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR,
- GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE));
+ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR));
const char *world_clip_lib = datatoc_gpu_shader_cfg_world_clip_lib_glsl;
const char *world_clip_def = "#define USE_WORLD_CLIP_PLANES\n";
/* In rare cases geometry shaders calculate clipping themselves. */