GPencil: Use ShaderCreateInfo for fullscreen shaders
Simple port. Shouldn't break anything.
This commit is contained in:
@@ -136,19 +136,7 @@ GPUShader *GPENCIL_shader_geometry_get(void)
|
||||
GPUShader *GPENCIL_shader_layer_blend_get(void)
|
||||
{
|
||||
if (!g_shaders.layer_blend_sh) {
|
||||
g_shaders.layer_blend_sh = GPU_shader_create_from_arrays({
|
||||
.vert =
|
||||
(const char *[]){
|
||||
datatoc_common_fullscreen_vert_glsl,
|
||||
NULL,
|
||||
},
|
||||
.frag =
|
||||
(const char *[]){
|
||||
datatoc_gpencil_common_lib_glsl,
|
||||
datatoc_gpencil_layer_blend_frag_glsl,
|
||||
NULL,
|
||||
},
|
||||
});
|
||||
g_shaders.layer_blend_sh = GPU_shader_create_from_info_name("gpencil_layer_blend");
|
||||
}
|
||||
return g_shaders.layer_blend_sh;
|
||||
}
|
||||
@@ -156,8 +144,7 @@ GPUShader *GPENCIL_shader_layer_blend_get(void)
|
||||
GPUShader *GPENCIL_shader_mask_invert_get(void)
|
||||
{
|
||||
if (!g_shaders.mask_invert_sh) {
|
||||
g_shaders.mask_invert_sh = DRW_shader_create_fullscreen(datatoc_gpencil_mask_invert_frag_glsl,
|
||||
NULL);
|
||||
g_shaders.mask_invert_sh = GPU_shader_create_from_info_name("gpencil_mask_invert");
|
||||
}
|
||||
return g_shaders.mask_invert_sh;
|
||||
}
|
||||
@@ -165,19 +152,7 @@ GPUShader *GPENCIL_shader_mask_invert_get(void)
|
||||
GPUShader *GPENCIL_shader_depth_merge_get(void)
|
||||
{
|
||||
if (!g_shaders.depth_merge_sh) {
|
||||
g_shaders.depth_merge_sh = GPU_shader_create_from_arrays({
|
||||
.vert =
|
||||
(const char *[]){
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_gpencil_depth_merge_vert_glsl,
|
||||
NULL,
|
||||
},
|
||||
.frag =
|
||||
(const char *[]){
|
||||
datatoc_gpencil_depth_merge_frag_glsl,
|
||||
NULL,
|
||||
},
|
||||
});
|
||||
g_shaders.depth_merge_sh = GPU_shader_create_from_info_name("gpencil_depth_merge");
|
||||
}
|
||||
return g_shaders.depth_merge_sh;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
uniform sampler2D depthBuf;
|
||||
uniform bool strokeOrder3d;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = textureLod(depthBuf, gl_FragCoord.xy / vec2(textureSize(depthBuf, 0)), 0).r;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
uniform vec4 gpModelMatrix[4];
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 model_matrix = mat4(gpModelMatrix[0], gpModelMatrix[1], gpModelMatrix[2], gpModelMatrix[3]);
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
|
||||
uniform sampler2D colorBuf;
|
||||
uniform sampler2D revealBuf;
|
||||
uniform sampler2D maskBuf;
|
||||
uniform int blendMode;
|
||||
uniform float blendOpacity;
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
/* Reminder: This is considered SRC color in blend equations.
|
||||
* Same operation on all buffers. */
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out vec4 fragRevealage;
|
||||
#pragma BLENDER_REQUIRE(gpencil_common_lib.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
|
||||
in vec4 uvcoordsvar;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out vec4 fragRevealage;
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Blend mode does the inversion. */
|
||||
|
||||
@@ -2,6 +2,42 @@
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Fullscreen shaders
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_layer_blend)
|
||||
.do_static_compilation(true)
|
||||
.sampler(0, ImageType::FLOAT_2D, "colorBuf")
|
||||
.sampler(1, ImageType::FLOAT_2D, "revealBuf")
|
||||
.sampler(2, ImageType::FLOAT_2D, "maskBuf")
|
||||
.push_constant(Type::INT, "blendMode")
|
||||
.push_constant(Type::FLOAT, "blendOpacity")
|
||||
/* Reminder: This is considered SRC color in blend equations.
|
||||
* Same operation on all buffers. */
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.fragment_out(1, Type::VEC4, "fragRevealage")
|
||||
.fragment_source("gpencil_layer_blend_frag.glsl")
|
||||
.additional_info("draw_fullscreen");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_mask_invert)
|
||||
.do_static_compilation(true)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.fragment_out(1, Type::VEC4, "fragRevealage")
|
||||
.fragment_source("gpencil_mask_invert_frag.glsl")
|
||||
.additional_info("draw_fullscreen");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_depth_merge)
|
||||
.do_static_compilation(true)
|
||||
.push_constant(Type::VEC4, "gpModelMatrix", 4)
|
||||
.push_constant(Type::BOOL, "strokeOrder3d")
|
||||
.sampler(0, ImageType::DEPTH_2D, "depthBuf")
|
||||
.vertex_source("gpencil_depth_merge_vert.glsl")
|
||||
.fragment_source("gpencil_depth_merge_frag.glsl")
|
||||
.additional_info("draw_view");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Anti-Aliasing
|
||||
* \{ */
|
||||
|
||||
Reference in New Issue
Block a user