Overlay: Port edit uv shaders to use shaderCreateInfo

This should have no functional changes.

Removed `antialiasing_vert.glsl` becaus it was actually a duplicate of
`common_fullscreen_vert.glsl`.
This commit is contained in:
Clément Foucault 2022-04-30 18:25:05 +02:00
parent b95601fa1a
commit 669349bfe4
Notes: blender-bot 2023-02-13 15:32:17 +01:00
Referenced by issue #97849, Blender 3.2 gpu shader overlay crash
7 changed files with 25 additions and 42 deletions

View File

@ -428,7 +428,6 @@ set(GLSL_SRC
engines/overlay/shaders/common_overlay_lib.glsl
engines/overlay/shaders/antialiasing_frag.glsl
engines/overlay/shaders/antialiasing_vert.glsl
engines/overlay/shaders/armature_dof_vert.glsl
engines/overlay/shaders/armature_dof_solid_frag.glsl
engines/overlay/shaders/armature_envelope_outline_vert.glsl

View File

@ -238,15 +238,7 @@ GPUShader *OVERLAY_shader_antialiasing(void)
{
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
if (!sh_data->antialiasing) {
sh_data->antialiasing = GPU_shader_create_from_arrays({
.vert = (const char *[]){datatoc_common_globals_lib_glsl,
datatoc_antialiasing_vert_glsl,
NULL},
.frag = (const char *[]){datatoc_common_globals_lib_glsl,
datatoc_antialiasing_frag_glsl,
NULL},
.defs = (const char *[]){NULL},
});
sh_data->antialiasing = GPU_shader_create_from_info_name("overlay_antialiasing");
}
return sh_data->antialiasing;
}
@ -1299,10 +1291,7 @@ GPUShader *OVERLAY_shader_xray_fade(void)
{
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
if (!sh_data->xray_fade) {
sh_data->xray_fade = GPU_shader_create_from_arrays({
.vert = (const char *[]){datatoc_common_fullscreen_vert_glsl, NULL},
.frag = (const char *[]){datatoc_xray_fade_frag_glsl, NULL},
});
sh_data->xray_fade = GPU_shader_create_from_info_name("overlay_xray_fade");
}
return sh_data->xray_fade;
}

View File

@ -1,15 +1,6 @@
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
uniform sampler2D colorTex;
uniform depth2D depthTex;
uniform sampler2D lineTex;
uniform bool doSmoothLines;
in vec2 uvs;
out vec4 fragColor;
#define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */
/**

View File

@ -1,11 +0,0 @@
out vec2 uvs;
void main()
{
int v = gl_VertexID % 3;
float x = float((v & 1) << 2);
float y = float((v & 2) << 1);
gl_Position = vec4(x - 1.0, y - 1.0, 1.0, 1.0);
uvs = vec2(x, y) * 0.5;
}

View File

@ -0,0 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(overlay_antialiasing)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.sampler(1, ImageType::FLOAT_2D, "colorTex")
.sampler(2, ImageType::FLOAT_2D, "lineTex")
.push_constant(Type::BOOL, "doSmoothLines")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("antialiasing_frag.glsl")
.additional_info("draw_fullscreen", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_xray_fade)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.sampler(1, ImageType::DEPTH_2D, "xrayDepthTex")
.push_constant(Type::FLOAT, "opacity")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("xray_fade_frag.glsl")
.additional_info("draw_fullscreen");

View File

@ -1,12 +1,4 @@
uniform sampler2D depthTex;
uniform sampler2D xrayDepthTex;
uniform float opacity;
in vec4 uvcoordsvar;
out vec4 fragColor;
void main()
{
float depth = texture(depthTex, uvcoordsvar.xy).r;

View File

@ -443,6 +443,7 @@ list(APPEND INC ${CMAKE_CURRENT_BINARY_DIR})
set(SRC_SHADER_CREATE_INFOS
../draw/engines/gpencil/shaders/infos/gpencil_info.hh
../draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh
../draw/engines/overlay/shaders/infos/antialiasing_info.hh
../draw/engines/overlay/shaders/infos/armature_info.hh
../draw/engines/overlay/shaders/infos/extra_info.hh
../draw/engines/overlay/shaders/infos/grid_info.hh