GPU: GLSL compilation as C++ for gpu static shaders

Allow compilation of shaders using C++ for linting and
IDE support.

Related #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/128724
This commit is contained in:
Clément Foucault
2024-11-12 18:53:34 +01:00
committed by Clément Foucault
parent e19030a69e
commit 091004f1b8
125 changed files with 722 additions and 81 deletions

View File

@@ -95,6 +95,10 @@ if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
# Allow to specify language per file.
if(POLICY CMP0119)
cmake_policy(SET CMP0119 NEW)
endif()
# -----------------------------------------------------------------------------
# Load Blender's Local Macros
@@ -883,6 +887,18 @@ mark_as_advanced(
WITH_GPU_SHADER_ASSERT
)
if(POLICY CMP0119)
option(WITH_GPU_SHADER_CPP_COMPILATION "\
Compiler shaders using C++. \
Allows testing Metal compilation on other platform and enable C++ IDE support for shader code"
OFF
)
mark_as_advanced(WITH_GPU_SHADER_CPP_COMPILATION)
else()
set(WITH_GPU_SHADER_CPP_COMPILATION OFF)
endif()
# OpenGL
if(NOT APPLE)
option(WITH_OPENGL_BACKEND "Enable OpenGL support as graphic backend" ON)

View File

@@ -155,6 +155,7 @@ add_subdirectory(ikplugin)
add_subdirectory(simulation)
add_subdirectory(geometry)
add_subdirectory(gpu)
add_subdirectory(gpu/shaders)
add_subdirectory(imbuf)
add_subdirectory(imbuf/intern/oiio)
add_subdirectory(nodes)

View File

@@ -117,7 +117,7 @@ static void shader_patch_edit_mesh_normal_common(gpu::shader::ShaderCreateInfo &
shader_patch_common(info);
info.defines_.clear(); /* Removes WORKAROUND_INDEX_LOAD_INCLUDE. */
info.vertex_inputs_.clear();
info.additional_info("gpu_index_load");
info.additional_info("gpu_index_buffer_load");
info.storage_buf(1, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY);
}

View File

@@ -135,7 +135,7 @@ VERTEX_SOURCE("overlay_armature_shape_outline_next_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
@@ -255,7 +255,7 @@ FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl")
TYPEDEF_SOURCE("overlay_shader_shared.h")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()

View File

@@ -173,7 +173,7 @@ FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(overlay_edit_mesh_common)
GPU_SHADER_CREATE_END()
@@ -464,7 +464,7 @@ FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
@@ -657,7 +657,7 @@ FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
@@ -738,7 +738,7 @@ FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
@@ -794,7 +794,7 @@ FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
@@ -1066,7 +1066,7 @@ FRAGMENT_SOURCE("overlay_depth_only_frag.glsl")
ADDITIONAL_INFO(draw_globals)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_resource_handle_new)
GPU_SHADER_CREATE_END()

View File

@@ -282,7 +282,7 @@ FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_motion_path_line_next_vert.glsl")
FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()

View File

@@ -78,7 +78,7 @@ ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_mesh_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
PUSH_CONSTANT(IVEC2, gpu_attr_0)
VERTEX_SOURCE("overlay_outline_prepass_wire_vert.glsl")

View File

@@ -127,6 +127,6 @@ FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()

View File

@@ -16,7 +16,7 @@ STORAGE_BUF_FREQ(3, READ, float, pos[], GEOMETRY)
PUSH_CONSTANT(IVEC2, gpu_attr_3)
UNIFORM_BUF(1, ShadowPassData, pass_data)
TYPEDEF_SOURCE("workbench_shader_shared.h")
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)

View File

@@ -242,11 +242,12 @@
# define PUSH_CONSTANT(type, name) const type name = type(1);
# define PUSH_CONSTANT_ARRAY(type, name, array_size) const type name[array_size] = {type(1)};
# define UNIFORM_BUF(slot, type_name, name) const type_name name = {};
# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name = {};
# define UNIFORM_BUF(slot, type_name, name) const type_name name = {type_name()};
# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name = {type_name()};
# define STORAGE_BUF(slot, qualifiers, type_name, name) qualifiers type_name name = {};
# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) qualifiers type_name name = {};
# define STORAGE_BUF(slot, qualifiers, type_name, name) qualifiers type_name name = {type_name()};
# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \
qualifiers type_name name = {type_name()};
# define SAMPLER(slot, type, name) _##type(sampler) name;
# define SAMPLER_FREQ(slot, type, name, freq) _##type(sampler) name;

View File

@@ -0,0 +1,110 @@
# SPDX-FileCopyrightText: 2024 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(INC_GLSL
.
..
../intern
common
infos
)
set(SRC_GLSL_VERT
gpu_shader_2D_area_borders_vert.glsl
gpu_shader_2D_image_rect_vert.glsl
gpu_shader_2D_image_vert.glsl
gpu_shader_2D_nodelink_vert.glsl
gpu_shader_2D_point_uniform_size_aa_vert.glsl
gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl
gpu_shader_2D_point_varying_size_varying_color_vert.glsl
gpu_shader_2D_vert.glsl
gpu_shader_2D_widget_base_vert.glsl
gpu_shader_2D_widget_shadow_vert.glsl
gpu_shader_3D_clipped_uniform_color_vert.glsl
gpu_shader_3D_flat_color_vert.glsl
gpu_shader_3D_image_vert.glsl
gpu_shader_3D_line_dashed_uniform_color_vert.glsl
gpu_shader_3D_normal_vert.glsl
gpu_shader_3D_point_uniform_size_aa_vert.glsl
gpu_shader_3D_point_varying_size_varying_color_vert.glsl
gpu_shader_3D_smooth_color_vert.glsl
gpu_shader_display_fallback_vert.glsl
gpu_shader_gpencil_stroke_vert.glsl
gpu_shader_icon_multi_vert.glsl
gpu_shader_icon_vert.glsl
gpu_shader_keyframe_shape_vert.glsl
gpu_shader_sequencer_strips_vert.glsl
gpu_shader_sequencer_thumbs_vert.glsl
gpu_shader_text_vert.glsl
)
set(SRC_GLSL_FRAG
gpu_shader_2D_area_borders_frag.glsl
gpu_shader_2D_line_dashed_frag.glsl
gpu_shader_2D_nodelink_frag.glsl
gpu_shader_2D_widget_base_frag.glsl
gpu_shader_2D_widget_shadow_frag.glsl
gpu_shader_3D_polyline_frag.glsl
gpu_shader_3D_smooth_color_frag.glsl
gpu_shader_checker_frag.glsl
gpu_shader_depth_only_frag.glsl
gpu_shader_diag_stripes_frag.glsl
gpu_shader_display_fallback_frag.glsl
gpu_shader_flat_color_frag.glsl
gpu_shader_gpencil_stroke_frag.glsl
gpu_shader_icon_frag.glsl
gpu_shader_image_color_frag.glsl
gpu_shader_image_desaturate_frag.glsl
gpu_shader_image_frag.glsl
gpu_shader_image_overlays_merge_frag.glsl
gpu_shader_image_overlays_stereo_merge_frag.glsl
gpu_shader_image_shuffle_color_frag.glsl
gpu_shader_keyframe_shape_frag.glsl
gpu_shader_point_uniform_color_aa_frag.glsl
gpu_shader_point_uniform_color_outline_aa_frag.glsl
gpu_shader_point_varying_color_frag.glsl
gpu_shader_sequencer_strips_frag.glsl
gpu_shader_sequencer_thumbs_frag.glsl
gpu_shader_simple_lighting_frag.glsl
gpu_shader_text_frag.glsl
gpu_shader_uniform_color_frag.glsl
)
set(SRC_GLSL_COMP
# TODO rename them properly to enable compilatio
# gpu_shader_index_2d_array_lines.glsl
# gpu_shader_index_2d_array_points.glsl
# gpu_shader_index_2d_array_tris.glsl
)
set(SRC_GLSL_LIB
common/gpu_shader_print_lib.glsl
)
add_definitions(-DGPU_SHADER)
function(compile_sources_as_cpp
executable
sources
define
)
foreach(glsl_file ${sources})
set_source_files_properties(${glsl_file} PROPERTIES LANGUAGE CXX)
endforeach()
add_library(${executable} OBJECT ${sources})
set_target_properties(${executable} PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(${executable} PUBLIC ${INC_GLSL})
target_compile_definitions(${executable} PRIVATE ${define})
endfunction()
# Compile shaders with shader code.
if (WITH_GPU_SHADER_CPP_COMPILATION)
compile_sources_as_cpp(gpu_cpp_shaders_vert "${SRC_GLSL_VERT}" "GPU_VERTEX_SHADER")
compile_sources_as_cpp(gpu_cpp_shaders_frag "${SRC_GLSL_FRAG}" "GPU_FRAGMENT_SHADER")
compile_sources_as_cpp(gpu_cpp_shaders_lib "${SRC_GLSL_LIB}" "GPU_FRAGMENT_SHADER")
endif()

View File

@@ -4,6 +4,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/**
* Library to read packed vertex buffer data of a `gpu::Batch` using a SSBO rather than using input
* assembly. It is **not** needed to use these macros if the data is known to be aligned and

View File

@@ -4,6 +4,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/** \param f: Offset from texel center in pixel space. */
void cubic_bspline_coefficients(vec2 f, out vec2 w0, out vec2 w1, out vec2 w2, out vec2 w3)
{

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
void valtorgb_opti_constant(
float fac, float edge, vec4 color1, vec4 color2, out vec4 outcol, out float outalpha)
{

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
void rgb_to_hsv(vec4 rgb, out vec4 outcol)
{
float cmax, cmin, h, s, v, cdelta;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
vec4 white_balance(vec4 color, vec4 black_level, vec4 white_level)
{
vec4 range = max(white_level - black_level, vec4(1e-5f));

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/* ***** Jenkins Lookup3 Hash Functions ***** */
/* Source: http://burtleburtle.net/bob/c/lookup3.c */

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
#include "gpu_shader_common_math_utils.glsl"
void math_add(float a, float b, float c, out float result)

View File

@@ -4,6 +4,10 @@
/* Float Math */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/* WORKAROUND: To be removed once we port all code to use `gpu_shader_math_base_lib.glsl`. */
#ifndef GPU_SHADER_MATH_BASE_LIB_GLSL

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
#include "gpu_shader_common_color_utils.glsl"
void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol)

View File

@@ -4,6 +4,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/*
* For debugging purpose mainly.
* From https://www.shadertoy.com/view/4dsSzr

View File

@@ -4,6 +4,10 @@
#pragma once
#include "infos/gpu_index_load_info.hh"
SHADER_LIBRARY_CREATE_INFO(gpu_index_buffer_load)
/**
* Library to read the index buffer of a `gpu::Batch` using a SSBO rather than using `gl_VertexID`.
* This is required for primitive expansion without geometry shader.
@@ -13,7 +17,7 @@
#ifndef WORKAROUND_INDEX_LOAD_INCLUDE
# ifndef GPU_INDEX_LOAD
# error Missing gpu_index_load create info dependency
# error Missing gpu_index_buffer_load create info dependency
# endif
/**

View File

@@ -18,7 +18,7 @@ struct Angle {
/* Angle in radian. */
float angle;
# ifdef GPU_METAL
# ifdef __cplusplus
Angle() = default;
Angle(float angle_) : angle(angle_){};
# endif
@@ -28,7 +28,7 @@ struct AxisAngle {
vec3 axis;
float angle;
# ifdef GPU_METAL
# ifdef __cplusplus
AxisAngle() = default;
AxisAngle(vec3 axis_, float angle_) : axis(axis_), angle(angle_){};
# endif
@@ -41,7 +41,7 @@ AxisAngle AxisAngle_identity()
struct Quaternion {
float x, y, z, w;
# ifdef GPU_METAL
# ifdef __cplusplus
Quaternion() = default;
Quaternion(float x_, float y_, float z_, float w_) : x(x_), y(y_), z(z_), w(w_){};
# endif
@@ -59,7 +59,7 @@ Quaternion Quaternion_identity()
struct EulerXYZ {
float x, y, z;
# ifdef GPU_METAL
# ifdef __cplusplus
EulerXYZ() = default;
EulerXYZ(float x_, float y_, float z_) : x(x_), y(y_), z(z_){};
# endif

View File

@@ -4,6 +4,10 @@
#pragma once
#include "infos/gpu_shader_print_info.hh"
SHADER_LIBRARY_CREATE_INFO(gpu_print)
uint print_data(uint offset, uint data)
{
if (offset < GPU_SHADER_PRINTF_MAX_CAPACITY) {

View File

@@ -4,6 +4,10 @@
#pragma once
#include "infos/gpu_shader_sequencer_info.hh"
SHADER_LIBRARY_CREATE_INFO(gpu_shader_sequencer_strips)
/* Signed distance to rounded box, centered at origin.
* Reference: https://iquilezles.org/articles/distfunctions2d/ */
float sdf_rounded_box(vec2 pos, vec2 size, float radius)

View File

@@ -4,6 +4,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/**
* Software implementation of encoding and decoding of shared exponent texture as described by the
* OpenGL extension EXT_texture_shared_exponent Appendix

View File

@@ -9,6 +9,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/**
* _______ ___ ___ ___ ___
* / || \/ | / \ / \

View File

@@ -4,6 +4,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/* clang-format off */
#ifndef GPU_METAL
bool is_integer(bool v) { return true; }

View File

@@ -4,6 +4,8 @@
#pragma once
#include "gpu_glsl_cpp_stubs.hh"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_UTILDEFINES_GLSL
# define GPU_SHADER_UTILDEFINES_GLSL

View File

@@ -647,9 +647,8 @@ template<typename T> T abs(T) RET;
template<typename T> T max(T, T) RET;
template<typename T> T min(T, T) RET;
template<typename T> T sign(T) RET;
template<typename T> T clamp(T, T, T) RET;
template<typename T> T clamp(T, double, double) RET;
template<typename T, typename U> T clamp(T, U, U) RET;
template<typename T> T clamp(T, double, double) RET;
template<typename T, typename U> T max(T, U) RET;
template<typename T, typename U> T min(T, U) RET;
/* TODO(fclem): These should be restricted to floats. */
@@ -658,7 +657,9 @@ template<typename T> T exp(T) RET;
template<typename T> T exp2(T) RET;
template<typename T> T floor(T) RET;
template<typename T> T fma(T, T, T) RET;
#ifndef _MSC_VER /* Avoid function redefinition which triggers a compile time error. */
double fma(double, double, double) RET;
#endif
template<typename T> T fract(T) RET;
template<typename T> T frexp(T, T) RET;
template<typename T> T inversesqrt(T) RET;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_area_borders_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_area_borders)
void main()
{
/* Should be 0.8 but minimize the AA on the edges. */

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_area_borders_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_area_borders)
void main()
{
int corner_id = (gl_VertexID / cornerLen) % 4;

View File

@@ -7,6 +7,10 @@
* does not need any vertex input (producing less call to immBegin/End)
*/
#include "infos/gpu_shader_2D_image_rect_color_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color)
void main()
{
vec2 uv;

View File

@@ -2,14 +2,9 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef USE_GPU_SHADER_CREATE_INFO
uniform mat4 ModelViewProjectionMatrix;
#include "infos/gpu_shader_2D_image_info.hh"
/* Keep in sync with intern/opencolorio/gpu_shader_display_transform_vertex.glsl */
in vec2 texCoord;
in vec2 pos;
out vec2 texCoord_interp;
#endif
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_image_common)
void main()
{

View File

@@ -9,6 +9,10 @@
* Dashed is performed in screen space.
*/
#include "infos/gpu_shader_line_dashed_uniform_color_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
void main()
{
float distance_along_line = distance(stipple_pos, stipple_start);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_nodelink_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_nodelink)
#define ANTIALIAS 0.75
float get_line_alpha(float center, float relative_radius)
@@ -16,7 +20,6 @@ void main()
float dash_frag_alpha = 1.0;
if (dashFactor < 1.0) {
float distance_along_line = lineLength * lineUV.x;
float normalized_distance = fract(distance_along_line / dashLength);
/* Checking if `normalized_distance <= dashFactor` is already enough for a basic
* dash, however we want to handle a nice anti-alias. */

View File

@@ -12,6 +12,10 @@
* `pos` is the verts position in the curve tangent space
*/
#include "infos/gpu_shader_2D_nodelink_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_nodelink)
#define MID_VERTEX 65
void main()

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_point_varying_size_varying_color_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_checker_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_checker)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_widget_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_widget_shared)
vec3 compute_masks(vec2 uv)
{
bool upper_half = uv.y > outRectSize.y * 0.5;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_widget_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_widget_base)
#define recti parameters[widgetID * MAX_PARAM + 0]
#define rect parameters[widgetID * MAX_PARAM + 1]
#define radsi parameters[widgetID * MAX_PARAM + 2].x
@@ -25,7 +29,7 @@
#define doAlphaCheck (alphaDiscard < 0.0)
#define discardFactor abs(alphaDiscard)
vec2 do_widget(void)
vec2 do_widget()
{
/* Offset to avoid losing pixels (mimics conservative rasterization). */
const vec2 ofs = vec2(0.5, -0.5);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_widget_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow)
void main()
{
fragColor = vec4(0.0);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_widget_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow)
#define BIT_RANGE(x) uint((1 << x) - 1)
/* 2 bits for corner */

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_uniform_color_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_flat_color_info.hh"
#include "gpu_shader_cfg_world_clip_lib.glsl"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
void main()
{
vec4 pos_4d = vec4(pos, 1.0);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_image_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_image_common)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos.xyz, 1.0f);

View File

@@ -9,8 +9,12 @@
* Dashed is performed in screen space.
*/
#include "infos/gpu_shader_line_dashed_uniform_color_info.hh"
#include "gpu_shader_cfg_world_clip_lib.glsl"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)
void main()
{
vec4 pos_4d = vec4(pos, 1.0);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_simple_lighting_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_simple_lighting)
void main()
{
normal = normalize(NormalMatrix * nor);

View File

@@ -2,7 +2,9 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_cfg_world_clip_lib.glsl"
#include "infos/gpu_shader_3D_point_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
void main()
{
@@ -19,8 +21,4 @@ void main()
/* Convert to PointCoord units. */
radii /= size;
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((clipPlanes.ClipModelMatrix * pos_4d).xyz);
#endif
}

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_point_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_polyline_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color)
void main()
{
#ifdef CLIP

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_smooth_color_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
void main()
{
fragColor = finalColor;

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_smooth_color_info.hh"
#include "gpu_shader_cfg_world_clip_lib.glsl"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_depth_only_info.hh"
#include "gpu_shader_cfg_world_clip_lib.glsl"
VERTEX_SHADER_CREATE_INFO(gpu_shader_3D_depth_only)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);

View File

@@ -4,28 +4,26 @@
#pragma once
#ifdef USE_WORLD_CLIP_PLANES
# if defined(GPU_VERTEX_SHADER) || defined(GPU_GEOMETRY_SHADER)
#include "infos/gpu_clip_planes_info.hh"
/* When all shaders are builtin shaders are migrated this could be applied directly. */
# ifdef USE_GPU_SHADER_CREATE_INFO
# define WorldClipPlanes clipPlanes.world
# else
uniform vec4 WorldClipPlanes[6];
# endif
#ifdef GPU_FRAGMENT_SHADER
# error File should not be included in fragment shader
#endif
#ifdef USE_WORLD_CLIP_PLANES
VERTEX_SHADER_CREATE_INFO(gpu_clip_planes)
void world_clip_planes_calc_clip_distance(vec3 wpos)
{
vec4 pos = vec4(wpos, 1.0);
gl_ClipDistance[0] = dot(WorldClipPlanes[0], pos);
gl_ClipDistance[1] = dot(WorldClipPlanes[1], pos);
gl_ClipDistance[2] = dot(WorldClipPlanes[2], pos);
gl_ClipDistance[3] = dot(WorldClipPlanes[3], pos);
gl_ClipDistance[4] = dot(WorldClipPlanes[4], pos);
gl_ClipDistance[5] = dot(WorldClipPlanes[5], pos);
gl_ClipDistance[0] = dot(clipPlanes.world[0], pos);
gl_ClipDistance[1] = dot(clipPlanes.world[1], pos);
gl_ClipDistance[2] = dot(clipPlanes.world[2], pos);
gl_ClipDistance[3] = dot(clipPlanes.world[3], pos);
gl_ClipDistance[4] = dot(clipPlanes.world[4], pos);
gl_ClipDistance[5] = dot(clipPlanes.world[5], pos);
}
# endif
#endif

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_checker_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_checker)
void main()
{
vec2 phase = mod(gl_FragCoord.xy, (size * 2));

View File

@@ -4,13 +4,13 @@
#pragma once
#include "infos/gpu_srgb_to_framebuffer_space_info.hh"
SHADER_LIBRARY_CREATE_INFO(gpu_srgb_to_framebuffer_space)
/* Undefine the macro that avoids compilation errors. */
#undef blender_srgb_to_framebuffer_space
#ifndef USE_GPU_SHADER_CREATE_INFO
uniform bool srgbTarget = false;
#endif
vec4 blender_srgb_to_framebuffer_space(vec4 in_color)
{
if (srgbTarget) {

View File

@@ -2,6 +2,8 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_depth_only_info.hh"
void main()
{
/* No color output, only depth (line below is implicit). */

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_diag_stripes_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes)
void main()
{
float phase = mod((gl_FragCoord.x + gl_FragCoord.y), float(size1 + size2));

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_overlays_merge_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback)
void main()
{
fragColor = texture(image_texture, texCoord_interp);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_overlays_merge_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback)
vec2 normalize_coordinates()
{
return (vec2(2.0) * (pos / fullscreen)) - vec2(1.0);

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_flat_color_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
void main()
{
fragColor = finalColor;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_gpencil_stroke_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
void main()
{
const vec2 center = vec2(0, 0.5);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_gpencil_stroke_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
#include "gpu_shader_attribute_load_lib.glsl"
#include "gpu_shader_math_base_lib.glsl"
#include "gpu_shader_utildefines_lib.glsl"

View File

@@ -10,6 +10,10 @@
* the rounded corner, and the rectangle sides.
*/
#include "infos/gpu_shader_icon_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_icon)
void main()
{
/* Sample texture with LOD BIAS. Used instead of custom LOD bias in GPU_SAMPLER_CUSTOM_ICON. */

View File

@@ -7,6 +7,10 @@
* does not need any vertex input (producing less call to immBegin/End)
*/
#include "infos/gpu_shader_icon_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_icon_multi)
void main()
{
vec4 rect = multi_icon_data.calls_data[gl_InstanceID * 3];

View File

@@ -7,6 +7,10 @@
* does not need any vertex input (producing less call to immBegin/End)
*/
#include "infos/gpu_shader_icon_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_icon)
void main()
{
vec2 uv;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_rect_color_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color)
void main()
{
fragColor = texture(image, texCoord_interp) * color;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_desaturate_color_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color)
void main()
{
vec4 tex = texture(image, texCoord_interp);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_image_common)
void main()
{
fragColor = texture(image, texCoord_interp);

View File

@@ -4,16 +4,9 @@
/* Merge overlays texture on top of image texture and transform to display space (assume sRGB) */
#ifndef USE_GPU_SHADER_CREATE_INFO
uniform sampler2D image_texture;
uniform sampler2D overlays_texture;
uniform bool display_transform;
uniform bool overlay;
#include "infos/gpu_shader_2D_image_overlays_merge_info.hh"
in vec2 texCoord_interp;
out vec4 fragColor;
#endif
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge)
float linearrgb_to_srgb(float c)
{

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge)
#define S3D_DISPLAY_ANAGLYPH 0
#define S3D_DISPLAY_INTERLACE 1

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_image_shuffle_color_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color)
void main()
{
vec4 sampled_color = texture(image, texCoord_interp);

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_index_info.hh"
COMPUTE_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines)
/**
* Constructs a 2D array index buffer with 'ncurves' rows and 'elements_per_curve*2'
* columns. Each row contains 'elements_per_curve' pairs of indexes.

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_index_info.hh"
COMPUTE_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points)
/**
* Constructs a simple 2D array index buffer, with 'ncurves' rows and 'elements_per_curve'
* columns. Each row contains 'elements_per_curve-1' indexes and a restart index.

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_index_info.hh"
COMPUTE_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris)
/**
* Constructs a 2D array index buffer, with 'ncurves' rows and 'elements_per_curve*6' columns.
* The index buffer can be used to draw 'ncurves' triangle strips with 'elements_per_curve*2'

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_keyframe_shape_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_keyframe_shape)
#define diagonal_scale sqrt(0.5)
#define minmax_bias 0.7

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_keyframe_shape_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_keyframe_shape)
#define line_falloff 1.0
#define circle_scale sqrt(2.0 / 3.1416)
#define square_scale sqrt(0.5)

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa)
void main()
{
float dist = length(gl_PointCoord - vec2(0.5));

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa)
void main()
{
float dist = length(gl_PointCoord - vec2(0.5));

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_2D_point_varying_size_varying_color_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color)
void main()
{
vec2 centered = gl_PointCoord - vec2(0.5);
@@ -13,14 +17,5 @@ void main()
discard;
}
#if defined(VERT)
fragColor = finalColor;
float midStroke = 0.5 * rad_squared;
if (vertexCrease > 0.0 && dist_squared > midStroke) {
fragColor.rgb = mix(finalColor.rgb, colorEdgeCrease.rgb, vertexCrease);
}
#else
fragColor = finalColor;
#endif
}

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_sequencer_info.hh"
#include "gpu_shader_sequencer_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_sequencer_strips)
vec3 color_shade(vec3 rgb, float shade)
{
rgb += vec3(shade / 255.0);
@@ -39,7 +43,7 @@ void main()
SeqStripDrawData strip = strip_data[strip_id];
vec2 pos1, pos2, size, center, pos;
float radius;
float radius = 0.0;
strip_box(strip.left_handle,
strip.right_handle,
strip.bottom,

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_sequencer_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_sequencer_strips)
void main()
{
int id = gl_InstanceID;

View File

@@ -2,13 +2,17 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_sequencer_info.hh"
#include "gpu_shader_sequencer_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs)
void main()
{
SeqStripThumbData thumb = thumb_data[thumb_id];
vec2 pos1, pos2, size, center, pos;
float radius;
float radius = 0.0;
strip_box(thumb.left,
thumb.right,
thumb.bottom,

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_sequencer_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs)
void main()
{
int id = gl_InstanceID;

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_simple_lighting_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_simple_lighting)
void main()
{
fragColor = simple_lighting_data.l_color;

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_text_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_text)
/* Font texture is conceptually laid out like a big 1D buffer: each glyph
* rectangle is flattened in row-major order into a "pixel strip". Inside
* the texture, glyphs strips are put one after another. The texture pixel

View File

@@ -2,6 +2,10 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_text_info.hh"
VERTEX_SHADER_CREATE_INFO(gpu_shader_text)
void main()
{
color_flat = col;

View File

@@ -2,8 +2,12 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "infos/gpu_shader_3D_uniform_color_info.hh"
#include "gpu_shader_colorspace_lib.glsl"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color)
void main()
{
fragColor = blender_srgb_to_framebuffer_space(color);

View File

@@ -6,6 +6,15 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# define USE_WORLD_CLIP_PLANES
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_clip_planes)

View File

@@ -8,9 +8,18 @@
#pragma once
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# define GPU_INDEX_LOAD
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_index_load)
GPU_SHADER_CREATE_INFO(gpu_index_buffer_load)
PUSH_CONSTANT(BOOL, gpu_index_no_buffer)
PUSH_CONSTANT(BOOL, gpu_index_16bit)
PUSH_CONSTANT(INT, gpu_index_base_index)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(smooth_uv_iface)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes)

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_shader_2D_image_info.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_shader_2D_image_info.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(nodelink_iface)

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,16 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
# define widgetID 0
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_info.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,15 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_info.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,16 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_info.hh"
# include "gpu_interface_info.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color)

View File

@@ -6,6 +6,15 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
# define SMOOTH_WIDTH 1.0
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,15 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_info.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,15 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_info.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)

View File

@@ -6,12 +6,19 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, interp)
SMOOTH(VEC4, mColor)
SMOOTH(VEC2, mTexCoord)
GPU_SHADER_NAMED_INTERFACE_END(geometry_out)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
TYPEDEF_SOURCE("GPU_shader_shared.hh")

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# define DO_CORNER_MASKING
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface)

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_info.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,10 +6,16 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_print)
STORAGE_BUF_FREQ(GPU_SHADER_PRINTF_SLOT, READ_WRITE, uint, gpu_print_buf[], PASS)
DEFINE_VALUE("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY))
DEFINE("GPU_PRINT")
GPU_SHADER_CREATE_END()

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(smooth_normal_iface)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"

View File

@@ -6,6 +6,14 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(text_iface)

View File

@@ -6,6 +6,13 @@
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_glsl_cpp_stubs.hh"
# include "gpu_srgb_to_framebuffer_space_info.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space)