Add Chromium-only Blender WebEngine parity work

This commit is contained in:
mes123456
2026-08-12 04:47:48 -04:00
commit 9fd26010f6
18225 changed files with 11622124 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#ifdef GLSL_CPP_STUBS
# define USE_WORLD_CLIP_PLANES
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_clip_planes)
UNIFORM_BUF_FREQ(1, GPUClipPlanes, clipPlanes, PASS)
BUILTINS(BuiltinBits::CLIP_DISTANCES)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
DEFINE("USE_WORLD_CLIP_PLANES")
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,30 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#pragma once
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#ifdef GLSL_CPP_STUBS
# define GPU_INDEX_LOAD
#endif
#include "gpu_shader_create_info.hh"
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)
STORAGE_BUF_FREQ(GPU_SSBO_INDEX_BUF_SLOT, read, uint, gpu_index_buf[], GEOMETRY)
DEFINE("GPU_INDEX_LOAD")
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,41 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#pragma once
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(flat_color_iface)
FLAT(float4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_INTERFACE_INFO(no_perspective_color_iface)
NO_PERSPECTIVE(float4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_INTERFACE_INFO(smooth_color_iface)
SMOOTH(float4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_INTERFACE_INFO(smooth_tex_coord_interp_iface)
SMOOTH(float2, texCoord_interp)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_INTERFACE_INFO(smooth_radii_iface)
SMOOTH(float2, radii)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_INTERFACE_INFO(smooth_radii_outline_iface)
SMOOTH(float4, radii)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_INTERFACE_INFO(icon_interp_iface)
FLAT(float4, final_color)
SMOOTH(float2, texCoord_interp)
SMOOTH(float2, mask_coord_interp)
GPU_SHADER_INTERFACE_END()

View File

@@ -0,0 +1,37 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(smooth_uv_iface)
SMOOTH(float2, uv)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders)
VERTEX_IN(0, float2, pos)
VERTEX_OUT(smooth_uv_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, rect)
PUSH_CONSTANT(float4, color)
/* Amount of pixels the border can cover. Scales rounded corner radius. */
PUSH_CONSTANT(float, scale)
/* Width of the border relative to the scale. Also affects rounded corner radius. */
PUSH_CONSTANT(float, width)
PUSH_CONSTANT(int, cornerLen)
VERTEX_SOURCE("gpu_shader_2D_area_borders_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_area_borders_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,28 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker)
VERTEX_IN(0, float2, pos)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color1)
PUSH_CONSTANT(float4, color2)
PUSH_CONSTANT(int, size)
VERTEX_SOURCE("gpu_shader_2D_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_checker_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,29 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes)
VERTEX_IN(0, float2, pos)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color1)
PUSH_CONSTANT(float4, color2)
PUSH_CONSTANT(int, size1)
PUSH_CONSTANT(int, size2)
VERTEX_SOURCE("gpu_shader_2D_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_diag_stripes_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,25 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_shader_2D_image_infos.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color)
ADDITIONAL_INFO(gpu_shader_2D_image_common)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float, factor)
FRAGMENT_SOURCE("gpu_shader_image_desaturate_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,30 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common)
VERTEX_IN(0, float2, pos)
VERTEX_IN(1, float2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
SAMPLER(0, sampler2D, image)
VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,47 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge)
VERTEX_IN(0, float2, pos)
VERTEX_IN(1, float2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(bool, display_transform)
PUSH_CONSTANT(bool, overlay)
PUSH_CONSTANT(bool, use_hdr_display)
/* Sampler slots should match OCIO's. */
SAMPLER(0, sampler2D, image_texture)
SAMPLER(1, sampler2D, overlays_texture)
VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_image_overlays_merge_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Cycles display driver fallback shader. */
GPU_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback)
VERTEX_IN(0, float2, pos)
VERTEX_IN(1, float2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float2, fullscreen)
SAMPLER(0, sampler2D, image_texture)
VERTEX_SOURCE("gpu_shader_display_fallback_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_display_fallback_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,29 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge)
VERTEX_IN(0, float2, pos)
FRAGMENT_OUT(0, float4, overlayColor)
FRAGMENT_OUT(1, float4, imageColor)
SAMPLER(0, sampler2D, imageTexture)
SAMPLER(1, sampler2D, overlayTexture)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(int, stereoDisplaySettings)
VERTEX_SOURCE("gpu_shader_2D_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_image_overlays_stereo_merge_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,33 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float4, rect_icon)
PUSH_CONSTANT(float4, rect_geom)
SAMPLER(0, sampler2D, image)
VERTEX_SOURCE("gpu_shader_2D_image_rect_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,25 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_shader_2D_image_infos.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color)
ADDITIONAL_INFO(gpu_shader_2D_image_common)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float4, shuffle)
FRAGMENT_SOURCE("gpu_shader_image_shuffle_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,60 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
#endif
#ifdef GLSL_CPP_STUBS
# define widgetID 0
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_node_socket_iface)
FLAT(float4, finalColor)
FLAT(float4, finalOutlineColor)
FLAT(float, finalDotRadius)
FLAT(float, finalOutlineThickness)
FLAT(float, AAsize)
FLAT(float2, extrusion)
FLAT(int, finalShape)
SMOOTH(float2, uv)
GPU_SHADER_INTERFACE_END()
/* TODO(lone_noel): Share with C code. */
#define MAX_SOCKET_PARAMETERS 4
#define MAX_SOCKET_INSTANCE 32
GPU_SHADER_CREATE_INFO(gpu_shader_2D_node_socket_shared)
DEFINE_VALUE("MAX_SOCKET_PARAMETERS", STRINGIFY(MAX_SOCKET_PARAMETERS))
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
VERTEX_OUT(gpu_node_socket_iface)
FRAGMENT_OUT(0, float4, fragColor)
VERTEX_SOURCE("gpu_shader_2D_node_socket_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_node_socket_frag.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_node_socket)
DO_STATIC_COMPILATION()
/* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems
* to be violated in some drivers. For example, macOS 10.15f.4 and Intel Iris
* causes #78307 when using gl_InstanceID outside of instance. */
DEFINE_VALUE("widgetID", "0")
PUSH_CONSTANT_ARRAY(float4, parameters, MAX_SOCKET_PARAMETERS)
ADDITIONAL_INFO(gpu_shader_2D_node_socket_shared)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_node_socket_inst)
DO_STATIC_COMPILATION()
DEFINE_VALUE("widgetID", "gl_InstanceID")
BUILTINS(BuiltinBits::INSTANCE_ID)
PUSH_CONSTANT_ARRAY(float4, parameters, (MAX_SOCKET_PARAMETERS * MAX_SOCKET_INSTANCE))
ADDITIONAL_INFO(gpu_shader_2D_node_socket_shared)
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,31 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa)
VERTEX_IN(0, float2, pos)
VERTEX_OUT(smooth_radii_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float, size)
VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_aa_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,31 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa)
VERTEX_IN(0, float2, pos)
VERTEX_OUT(smooth_radii_outline_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float4, outlineColor)
PUSH_CONSTANT(float, size)
PUSH_CONSTANT(float, outlineWidth)
VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_point_uniform_color_outline_aa_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,29 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color)
VERTEX_IN(0, float2, pos)
VERTEX_IN(1, float, size)
VERTEX_IN(2, float4, color)
VERTEX_OUT(smooth_color_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_2D_point_varying_size_varying_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,39 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#ifdef GLSL_CPP_STUBS
# define widgetID 0
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface)
SMOOTH(float, shadowFalloff)
SMOOTH(float, innerMask)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow)
DO_STATIC_COMPILATION()
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT_ARRAY(float4, parameters, 4)
PUSH_CONSTANT(float, alpha)
VERTEX_IN(0, uint, vflag)
VERTEX_OUT(gpu_widget_shadow_iface)
FRAGMENT_OUT(0, float4, fragColor)
VERTEX_SOURCE("gpu_shader_2D_widget_shadow_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_widget_shadow_frag.glsl")
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,33 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only)
VERTEX_IN(0, float3, pos)
VERTEX_OUT(flat_color_iface)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_3D_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only_clipped)
ADDITIONAL_INFO(gpu_shader_3D_depth_only)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,38 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_infos.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
VERTEX_IN(0, float3, pos)
VERTEX_IN(1, float4, color)
VERTEX_OUT(flat_color_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float, size)
VERTEX_SOURCE("gpu_shader_3D_flat_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped)
ADDITIONAL_INFO(gpu_shader_3D_flat_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,58 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_common)
VERTEX_IN(0, float3, pos)
VERTEX_IN(1, float2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
SAMPLER(0, sampler2D, image)
VERTEX_SOURCE("gpu_shader_3D_image_vert.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_image)
ADDITIONAL_INFO(gpu_shader_3D_image_common)
FRAGMENT_SOURCE("gpu_shader_image_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_scene_linear)
ADDITIONAL_INFO(gpu_shader_3D_image_common)
ADDITIONAL_INFO(gpu_scene_linear_to_rec709_space)
FRAGMENT_SOURCE("gpu_shader_image_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_color)
ADDITIONAL_INFO(gpu_shader_3D_image_common)
PUSH_CONSTANT(float4, color)
FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_color_scene_linear)
ADDITIONAL_INFO(gpu_shader_3D_image_common)
ADDITIONAL_INFO(gpu_scene_linear_to_rec709_space)
PUSH_CONSTANT(float4, color)
FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,76 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_infos.hh"
# include "gpu_interface_infos.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color)
VERTEX_IN(0, float3, pos)
VERTEX_IN(1, float4, color)
VERTEX_IN(2, float, size)
VERTEX_OUT(smooth_color_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_3D_point_varying_size_varying_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
VERTEX_IN(0, float3, pos)
VERTEX_OUT(smooth_radii_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float, size)
VERTEX_SOURCE("gpu_shader_3D_point_uniform_size_aa_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped)
ADDITIONAL_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_flat_color)
VERTEX_IN(0, float3, pos)
VERTEX_IN(1, float4, color)
VERTEX_OUT(flat_color_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float, size)
VERTEX_SOURCE("gpu_shader_3D_point_flat_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_color)
VERTEX_IN(0, float3, pos)
VERTEX_OUT(flat_color_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float, size)
VERTEX_SOURCE("gpu_shader_3D_point_flat_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,83 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_index_load_infos.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#ifdef GLSL_CPP_STUBS
# define SMOOTH_WIDTH 1.0f
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_shader_3D_polyline_iface)
SMOOTH(float4, final_color)
SMOOTH(float, clip)
NO_PERSPECTIVE(float, smoothline)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline)
DEFINE_VALUE("SMOOTH_WIDTH", "1.0f")
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float2, viewportSize)
PUSH_CONSTANT(float, lineWidth)
PUSH_CONSTANT(bool, lineSmooth)
STORAGE_BUF_FREQ(GPU_SSBO_POLYLINE_POS_BUF_SLOT, read, float, pos[], GEOMETRY)
PUSH_CONSTANT(int2, gpu_attr_0)
PUSH_CONSTANT(int3, gpu_vert_stride_count_offset)
PUSH_CONSTANT(int, gpu_attr_0_len)
PUSH_CONSTANT(bool, gpu_attr_0_fetch_int)
PUSH_CONSTANT(bool, gpu_attr_1_fetch_unorm8)
VERTEX_OUT(gpu_shader_3D_polyline_iface)
FRAGMENT_OUT(0, float4, fragColor)
VERTEX_SOURCE("gpu_shader_3D_polyline_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
ADDITIONAL_INFO(gpu_index_buffer_load)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color)
DO_STATIC_COMPILATION()
DEFINE("UNIFORM")
PUSH_CONSTANT(float4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped)
DO_STATIC_COMPILATION()
/* TODO(fclem): Put in a UBO to fit the 128byte requirement. */
PUSH_CONSTANT(float4x4, ModelMatrix)
PUSH_CONSTANT(float4, ClipPlane)
DEFINE("CLIP")
ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color)
DO_STATIC_COMPILATION()
DEFINE("FLAT")
STORAGE_BUF_FREQ(GPU_SSBO_POLYLINE_COL_BUF_SLOT, read, float, color[], GEOMETRY)
PUSH_CONSTANT(int2, gpu_attr_1)
PUSH_CONSTANT(int, gpu_attr_1_len)
ADDITIONAL_INFO(gpu_shader_3D_polyline)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color)
DO_STATIC_COMPILATION()
DEFINE("SMOOTH")
STORAGE_BUF_FREQ(GPU_SSBO_POLYLINE_COL_BUF_SLOT, read, float, color[], GEOMETRY)
PUSH_CONSTANT(int2, gpu_attr_1)
PUSH_CONSTANT(int, gpu_attr_1_len)
ADDITIONAL_INFO(gpu_shader_3D_polyline)
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,37 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_infos.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
VERTEX_IN(0, float3, pos)
VERTEX_IN(1, float4, color)
VERTEX_OUT(smooth_color_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_3D_smooth_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_3D_smooth_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped)
ADDITIONAL_INFO(gpu_shader_3D_smooth_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,52 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_infos.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)
VERTEX_IN(0, float3, pos)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
VERTEX_SOURCE("gpu_shader_3D_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped)
ADDITIONAL_INFO(gpu_shader_3D_uniform_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Confusing naming convention. But this is a version with only one local clip plane. */
GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color)
VERTEX_IN(0, float3, pos)
FRAGMENT_OUT(0, float4, fragColor)
DEFINE("USE_WORLD_CLIP_PLANES") /** WORKAROUND: Metal needs it. */
BUILTINS(BuiltinBits::CLIP_DISTANCES)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, color)
/* TODO(@fclem): Put those two to one UBO. */
PUSH_CONSTANT(float4x4, ModelMatrix)
PUSH_CONSTANT(float4, ClipPlane)
VERTEX_SOURCE("gpu_shader_3D_clipped_uniform_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,19 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_fullscreen_iface)
SMOOTH(float2, screen_uv)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_fullscreen)
VERTEX_OUT(gpu_fullscreen_iface)
VERTEX_SOURCE("gpu_shader_fullscreen_vert.glsl")
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,34 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, interp)
SMOOTH(float4, mColor)
SMOOTH(float2, mTexCoord)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
STORAGE_BUF_FREQ(0, read, GreasePencilStrokeData, gp_vert_data[], GEOMETRY)
VERTEX_OUT(gpencil_stroke_vert_iface)
FRAGMENT_OUT(0, float4, fragColor)
UNIFORM_BUF(0, GPencilStrokeData, gpencil_stroke_data)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4x4, ProjectionMatrix)
FRAGMENT_SOURCE("gpu_shader_gpencil_stroke_frag.glsl")
VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,47 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_icon_shared)
VERTEX_OUT(icon_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float4, finalColor)
PUSH_CONSTANT(float4, rect_icon)
PUSH_CONSTANT(float4, rect_geom)
PUSH_CONSTANT(float, text_width)
SAMPLER(0, sampler2D, image)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_icon)
COMPILATION_CONSTANT(bool, do_corner_masking, true)
VERTEX_SOURCE("gpu_shader_icon_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_icon_frag.glsl")
ADDITIONAL_INFO(gpu_shader_icon_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_icon_multi)
COMPILATION_CONSTANT(bool, do_corner_masking, false)
VERTEX_IN(0, float2, pos)
UNIFORM_BUF(0, MultiIconCallData, multi_icon_data)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_SOURCE("gpu_shader_icon_multi_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_icon_frag.glsl")
ADDITIONAL_INFO(gpu_shader_icon_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,44 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points)
LOCAL_GROUP_SIZE(16, 16, 1)
PUSH_CONSTANT(int, elements_per_curve)
PUSH_CONSTANT(int, ncurves)
STORAGE_BUF(0, write, uint, out_indices[])
COMPUTE_SOURCE("gpu_shader_index_2d_array_points.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines)
LOCAL_GROUP_SIZE(16, 16, 1)
PUSH_CONSTANT(int, elements_per_curve)
PUSH_CONSTANT(int, ncurves)
STORAGE_BUF(0, write, uint, out_indices[])
COMPUTE_SOURCE("gpu_shader_index_2d_array_lines.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris)
LOCAL_GROUP_SIZE(16, 16, 1)
PUSH_CONSTANT(int, elements_per_curve)
PUSH_CONSTANT(int, ncurves)
STORAGE_BUF(0, write, uint, out_indices[])
COMPUTE_SOURCE("gpu_shader_index_2d_array_tris.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,41 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface)
FLAT(float4, finalColor)
FLAT(float4, finalOutlineColor)
FLAT(float4, radii)
FLAT(float4, thresholds)
FLAT(uint, finalFlags)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_keyframe_shape)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_IN(0, float4, color)
VERTEX_IN(1, float4, outlineColor)
VERTEX_IN(2, float2, pos)
VERTEX_IN(3, float, size)
VERTEX_IN(4, uint, flags)
VERTEX_OUT(keyframe_shape_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float2, ViewportSize)
PUSH_CONSTANT(float, outline_scale)
VERTEX_SOURCE("gpu_shader_keyframe_shape_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_keyframe_shape_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,49 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_clip_planes_infos.hh"
#endif
#include "gpu_interface_infos.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(float2, stipple_start) /* In screen space */
FLAT(float2, stipple_pos)
GPU_SHADER_INTERFACE_END() /* In screen space */
GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
VERTEX_IN(0, float3, pos)
VERTEX_OUT(flat_color_iface)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float2, viewport_size)
PUSH_CONSTANT(float, dash_width)
PUSH_CONSTANT(float, udash_factor) /* if > 1.0f, solid line. */
/* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */
PUSH_CONSTANT(int, colors_len) /* Enabled if > 0, 1 for solid line. */
PUSH_CONSTANT(float4, color)
PUSH_CONSTANT(float4, color2)
VERTEX_OUT(gpu_shader_line_dashed_interface)
FRAGMENT_OUT(0, float4, fragColor)
VERTEX_SOURCE("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_line_dashed_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)
PUSH_CONSTANT(float4x4, ModelMatrix)
ADDITIONAL_INFO(gpu_shader_3D_line_dashed_uniform_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,21 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.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))
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,108 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_shader_fullscreen_infos.hh"
#endif
#include "gpu_interface_infos.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface)
NO_PERSPECTIVE(float2, co_interp)
FLAT(uint, strip_id)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips)
VERTEX_OUT(gpu_seq_strip_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
UNIFORM_BUF(0, SeqStripDrawData, strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN])
UNIFORM_BUF(1, SeqContextDrawData, context_data)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_SOURCE("gpu_shader_sequencer_strips_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_sequencer_strips_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface)
NO_PERSPECTIVE(float2, pos_interp)
NO_PERSPECTIVE(float2, texCoord_interp)
FLAT(uint, thumb_id)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs)
VERTEX_OUT(gpu_seq_thumb_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
UNIFORM_BUF(0, SeqStripThumbData, thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN])
UNIFORM_BUF(1, SeqContextDrawData, context_data)
SAMPLER(0, sampler2D, image)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_SOURCE("gpu_shader_sequencer_thumbs_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_sequencer_thumbs_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(gpu_seq_scope_iface)
SMOOTH(float4, finalColor)
SMOOTH(float2, radii)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_scope_raster)
LOCAL_GROUP_SIZE(16, 16)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float3, scope_luma_coeffs)
PUSH_CONSTANT(float, scope_point_size)
PUSH_CONSTANT(float, inv_render_scale)
PUSH_CONSTANT(bool, img_premultiplied)
PUSH_CONSTANT(bool, scope_is_hdr)
PUSH_CONSTANT(float3x3, scope_gamut_to_rec709)
PUSH_CONSTANT(float3x3, scope_yuv_matrix)
PUSH_CONSTANT(int, image_width)
PUSH_CONSTANT(int, image_height)
PUSH_CONSTANT(int, scope_mode)
PUSH_CONSTANT(int, view_width)
PUSH_CONSTANT(int, view_height)
SAMPLER(0, sampler2D, image)
STORAGE_BUF(0, read_write, SeqScopeRasterData, raster_buf[])
TYPEDEF_SOURCE("GPU_shader_shared.hh")
COMPUTE_SOURCE("gpu_shader_sequencer_scope_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_scope_resolve)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(int, view_width)
PUSH_CONSTANT(int, view_height)
PUSH_CONSTANT(float, alpha_exponent)
STORAGE_BUF(0, read, SeqScopeRasterData, raster_buf[])
TYPEDEF_SOURCE("GPU_shader_shared.hh")
FRAGMENT_SOURCE("gpu_shader_sequencer_scope_frag.glsl")
ADDITIONAL_INFO(gpu_fullscreen)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_zebra)
VERTEX_IN(0, float2, pos)
VERTEX_IN(1, float2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float, zebra_limit)
PUSH_CONSTANT(bool, img_premultiplied)
SAMPLER(0, sampler2D, image)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_sequencer_zebra_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,34 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(smooth_normal_iface)
SMOOTH(float3, normal)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting)
VERTEX_IN(0, float3, pos)
VERTEX_IN(1, float3, nor)
VERTEX_OUT(smooth_normal_iface)
FRAGMENT_OUT(0, float4, fragColor)
UNIFORM_BUF_FREQ(0, SimpleLightingData, simple_lighting_data, PASS)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(float3x3, NormalMatrix)
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_SOURCE("gpu_shader_3D_normal_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_simple_lighting_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,183 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_shader_fullscreen_infos.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_compute_1d_test)
LOCAL_GROUP_SIZE(1)
IMAGE(1, SFLOAT_32_32_32_32, write, image1D, img_output)
COMPUTE_SOURCE("gpu_compute_1d_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_2d_test)
LOCAL_GROUP_SIZE(1, 1)
IMAGE(1, SFLOAT_32_32_32_32, write, image2D, img_output)
COMPUTE_SOURCE("gpu_compute_2d_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_ibo_test)
LOCAL_GROUP_SIZE(1)
STORAGE_BUF(0, write, uint, out_indices[])
COMPUTE_SOURCE("gpu_compute_ibo_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test)
LOCAL_GROUP_SIZE(1)
STORAGE_BUF(0, write, float4, out_positions[])
COMPUTE_SOURCE("gpu_compute_vbo_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_test)
LOCAL_GROUP_SIZE(1)
STORAGE_BUF(0, write, int, data_out[])
COMPUTE_SOURCE("gpu_compute_ssbo_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test)
LOCAL_GROUP_SIZE(1)
STORAGE_BUF(0, write, int, data0[])
STORAGE_BUF(1, write, int, data1[])
COMPUTE_SOURCE("gpu_compute_dummy_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Push constants. */
GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test)
LOCAL_GROUP_SIZE(1)
STORAGE_BUF(0, write, float, data_out[])
COMPUTE_SOURCE("gpu_push_constants_test.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_push_constants_test)
ADDITIONAL_INFO(gpu_push_constants_base_test)
PUSH_CONSTANT(float, float_in)
PUSH_CONSTANT(float2, vec2_in)
PUSH_CONSTANT(float3, vec3_in)
PUSH_CONSTANT(float4, vec4_in)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Push constants size test. */
GPU_SHADER_CREATE_INFO(gpu_push_constants_128bytes_test)
ADDITIONAL_INFO(gpu_push_constants_test)
PUSH_CONSTANT_ARRAY(float, filler, 20)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_push_constants_256bytes_test)
ADDITIONAL_INFO(gpu_push_constants_128bytes_test)
PUSH_CONSTANT_ARRAY(float, filler2, 32)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_push_constants_512bytes_test)
ADDITIONAL_INFO(gpu_push_constants_256bytes_test)
PUSH_CONSTANT_ARRAY(float, filler3, 64)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_push_constants_8192bytes_test)
ADDITIONAL_INFO(gpu_push_constants_512bytes_test)
PUSH_CONSTANT_ARRAY(float, filler4, 1920)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_buffer_texture_test)
LOCAL_GROUP_SIZE(1)
SAMPLER(0, samplerBuffer, bufferTexture)
STORAGE_BUF(0, write, float, data_out[])
COMPUTE_SOURCE("gpu_buffer_texture_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_sampler_arg_buf_test)
/* Leave sampler 0 empty to cover the case of empty slot. */
SAMPLER(1, sampler2D, tex_1)
SAMPLER(2, sampler2D, tex_2)
SAMPLER(3, sampler2D, tex_3)
SAMPLER(4, sampler2D, tex_4)
SAMPLER(5, sampler2D, tex_5)
SAMPLER(6, sampler2D, tex_6)
SAMPLER(7, sampler2D, tex_7)
SAMPLER(8, sampler2D, tex_8)
SAMPLER(9, sampler2D, tex_9)
SAMPLER(10, sampler2D, tex_10)
SAMPLER(11, sampler2D, tex_11)
SAMPLER(12, sampler2D, tex_12)
SAMPLER(13, sampler2D, tex_13)
SAMPLER(14, sampler2D, tex_14)
SAMPLER(15, sampler2D, tex_15)
SAMPLER(16, sampler2D, tex_16)
SAMPLER(17, sampler2D, tex_17)
SAMPLER(18, sampler2D, tex_18)
STORAGE_BUF(0, write, float4, data_out[])
VERTEX_SOURCE("gpu_texture_test.glsl")
FRAGMENT_SOURCE("gpu_texture_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_texture_atomic_test)
LOCAL_GROUP_SIZE(32)
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
IMAGE(1, UINT_32, read_write, uimage2DAtomic, img_atomic_2D)
IMAGE(3, UINT_32, read_write, uimage2DArrayAtomic, img_atomic_2D_array)
IMAGE(5, UINT_32, read_write, uimage3DAtomic, img_atomic_3D)
STORAGE_BUF(0, write, int, data_out[])
PUSH_CONSTANT(bool, write_phase)
COMPUTE_SOURCE("gpu_texture_atomic_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Specialization constants. */
GPU_SHADER_CREATE_INFO(gpu_specialization_constants_base_test)
STORAGE_BUF(0, write, int, data_out[])
SPECIALIZATION_CONSTANT(float, float_in, 2)
SPECIALIZATION_CONSTANT(uint, uint_in, 3)
SPECIALIZATION_CONSTANT(int, int_in, 4)
SPECIALIZATION_CONSTANT(bool, bool_in, true)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_specialization_test)
LOCAL_GROUP_SIZE(1)
ADDITIONAL_INFO(gpu_specialization_constants_base_test)
COMPUTE_SOURCE("gpu_specialization_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_graphic_specialization_test)
ADDITIONAL_INFO(gpu_specialization_constants_base_test)
BUILTINS(BuiltinBits::POINT_SIZE)
VERTEX_SOURCE("gpu_specialization_test.glsl")
FRAGMENT_SOURCE("gpu_specialization_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Runtime create info. */
GPU_SHADER_CREATE_INFO(gpu_framebuffer_subpass_input_test)
FRAGMENT_OUT(0, int, out_value)
GPU_SHADER_CREATE_END()
/* Runtime create info. */
GPU_SHADER_CREATE_INFO(gpu_framebuffer_layer_viewport_test)
FRAGMENT_OUT(0, int2, out_value)
GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,38 @@
/* SPDX-FileCopyrightText: 2022-2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
# include "GPU_shader_shared.hh"
# include "gpu_srgb_to_framebuffer_space_infos.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(text_iface)
FLAT(float4, color_flat)
NO_PERSPECTIVE(float2, texCoord_interp)
FLAT(int, glyph_offset)
FLAT(uint, glyph_flags)
FLAT(int2, glyph_dim)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_text)
VERTEX_OUT(text_iface)
FRAGMENT_OUT(0, float4, fragColor)
PUSH_CONSTANT(float4x4, ModelViewProjectionMatrix)
PUSH_CONSTANT(int, glyph_tex_width_mask)
PUSH_CONSTANT(int, glyph_tex_width_shift)
SAMPLER_FREQ(0, sampler2D, glyph, PASS)
STORAGE_BUF(0, read, GlyphQuad, glyphs[])
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_SOURCE("gpu_shader_text_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_text_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END()

View File

@@ -0,0 +1,24 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#ifdef GPU_SHADER
# pragma once
# include "gpu_shader_compat.hh"
#endif
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space)
PUSH_CONSTANT(bool, srgbTarget)
DEFINE("blender_srgb_to_framebuffer_space(a) a")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_scene_linear_to_rec709_space)
PUSH_CONSTANT(float3x3, gpu_scene_linear_to_rec709)
DEFINE("BLENDER_SCENE_LINEAR_TO_REC709")
GPU_SHADER_CREATE_END()