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

gpu_shader_line_dashed_uniform_color_info.hh « infos « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 57cb02c8484633d60f156275a4b269f76b63db32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright 2022 Blender Foundation. All rights reserved. */

/** \file
 * \ingroup gpu
 */

#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

/* We leverage hardware interpolation to compute distance along the line. */
GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface, "")
    .no_perspective(Type::VEC2, "stipple_start") /* In screen space */
    .flat(Type::VEC2, "stipple_pos");            /* In screen space */

GPU_SHADER_CREATE_INFO(gpu_shader_line_dashed)
    .vertex_out(flat_color_iface)
    .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
    .push_constant(Type::VEC2, "viewport_size")
    .push_constant(Type::FLOAT, "dash_width")
    .push_constant(Type::FLOAT, "dash_factor") /* if > 1.0, solid line. */
    /* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */
    .push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */
    .push_constant(Type::VEC4, "color")
    .push_constant(Type::VEC4, "color2")
    .vertex_out(gpu_shader_line_dashed_interface)
    .fragment_out(0, Type::VEC4, "fragColor")
    .fragment_source("gpu_shader_2D_line_dashed_frag.glsl");

GPU_SHADER_CREATE_INFO(gpu_shader_2D_line_dashed_uniform_color)
    .vertex_in(0, Type::VEC2, "pos")
    .vertex_source("gpu_shader_2D_line_dashed_uniform_color_vert.glsl")
    .additional_info("gpu_shader_line_dashed")
    .do_static_compilation(true);

GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
    .vertex_in(0, Type::VEC3, "pos")
    .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
    .additional_info("gpu_shader_line_dashed")
    .do_static_compilation(true);

GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)
    .push_constant(Type::MAT4, "ModelMatrix")
    .additional_info("gpu_shader_3D_line_dashed_uniform_color")
    .additional_info("gpu_clip_planes")
    .do_static_compilation(true);