GPU: Shader Create Info GLSL-C++ stubs #3

Closed
Clément Foucault wants to merge 90 commits from create-info-cpp-macros into glsl-include

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
33 changed files with 706 additions and 614 deletions
Showing only changes of commit a4ef239b4f - Show all commits

View File

@ -11,9 +11,9 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_index_load)
.push_constant(Type::BOOL, "gpu_index_no_buffer")
.push_constant(Type::BOOL, "gpu_index_16bit")
.push_constant(Type::INT, "gpu_index_base_index")
.storage_buf(
GPU_SSBO_INDEX_BUF_SLOT, Qualifier::READ, "uint", "gpu_index_buf[]", Frequency::GEOMETRY)
.define("GPU_INDEX_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

@ -8,17 +8,20 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(smooth_uv_iface).smooth(Type::VEC2, "uv");
GPU_SHADER_INTERFACE_INFO(smooth_uv_iface)
SMOOTH(VEC2, uv)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders)
.vertex_in(0, Type::VEC2, "pos")
.vertex_out(smooth_uv_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "rect")
.push_constant(Type::VEC4, "color")
.push_constant(Type::FLOAT, "scale")
.push_constant(Type::INT, "cornerLen")
.vertex_source("gpu_shader_2D_area_borders_vert.glsl")
.fragment_source("gpu_shader_2D_area_borders_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, pos)
VERTEX_OUT(smooth_uv_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, rect)
PUSH_CONSTANT(VEC4, color)
PUSH_CONSTANT(FLOAT, scale)
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

@ -9,12 +9,13 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker)
.vertex_in(0, Type::VEC2, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color1")
.push_constant(Type::VEC4, "color2")
.push_constant(Type::INT, "size")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_checker_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, pos)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, color1)
PUSH_CONSTANT(VEC4, 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

@ -9,13 +9,14 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes)
.vertex_in(0, Type::VEC2, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color1")
.push_constant(Type::VEC4, "color2")
.push_constant(Type::INT, "size1")
.push_constant(Type::INT, "size2")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_diag_stripes_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, pos)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, color1)
PUSH_CONSTANT(VEC4, 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

@ -9,8 +9,9 @@
#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(Type::VEC4, "color")
.push_constant(Type::FLOAT, "factor")
.fragment_source("gpu_shader_image_desaturate_frag.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(gpu_shader_2D_image_common)
PUSH_CONSTANT(VEC4, color)
PUSH_CONSTANT(FLOAT, factor)
FRAGMENT_SOURCE("gpu_shader_image_desaturate_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,10 +10,11 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common)
.vertex_in(0, Type::VEC2, "pos")
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.sampler(0, ImageType::FLOAT_2D, "image")
.vertex_source("gpu_shader_2D_image_vert.glsl");
VERTEX_IN(0, VEC2, pos)
VERTEX_IN(1, VEC2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
SAMPLER(0, FLOAT_2D, image)
VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl")
GPU_SHADER_CREATE_END()

View File

@ -10,29 +10,31 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge)
.vertex_in(0, Type::VEC2, "pos")
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::BOOL, "display_transform")
.push_constant(Type::BOOL, "overlay")
.push_constant(Type::BOOL, "use_hdr")
/* Sampler slots should match OCIO's. */
.sampler(0, ImageType::FLOAT_2D, "image_texture")
.sampler(1, ImageType::FLOAT_2D, "overlays_texture")
.vertex_source("gpu_shader_2D_image_vert.glsl")
.fragment_source("gpu_shader_image_overlays_merge_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, pos)
VERTEX_IN(1, VEC2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(BOOL, display_transform)
PUSH_CONSTANT(BOOL, overlay)
PUSH_CONSTANT(BOOL, use_hdr)
/* Sampler slots should match OCIO's. */
SAMPLER(0, FLOAT_2D, image_texture)
SAMPLER(1, FLOAT_2D, 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, Type::VEC2, "pos")
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::VEC2, "fullscreen")
.sampler(0, ImageType::FLOAT_2D, "image_texture")
.vertex_source("gpu_shader_display_fallback_vert.glsl")
.fragment_source("gpu_shader_display_fallback_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, pos)
VERTEX_IN(1, VEC2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(VEC2, fullscreen)
SAMPLER(0, FLOAT_2D, 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

@ -9,13 +9,14 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge)
.vertex_in(0, Type::VEC2, "pos")
.fragment_out(0, Type::VEC4, "overlayColor")
.fragment_out(1, Type::VEC4, "imageColor")
.sampler(0, ImageType::FLOAT_2D, "imageTexture")
.sampler(1, ImageType::FLOAT_2D, "overlayTexture")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::INT, "stereoDisplaySettings")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_image_overlays_stereo_merge_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, pos)
FRAGMENT_OUT(0, VEC4, overlayColor)
FRAGMENT_OUT(1, VEC4, imageColor)
SAMPLER(0, FLOAT_2D, imageTexture)
SAMPLER(1, FLOAT_2D, overlayTexture)
PUSH_CONSTANT(MAT4, 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

@ -10,13 +10,14 @@
#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, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC4, "rect_icon")
.push_constant(Type::VEC4, "rect_geom")
.sampler(0, ImageType::FLOAT_2D, "image")
.vertex_source("gpu_shader_2D_image_rect_vert.glsl")
.fragment_source("gpu_shader_image_color_frag.glsl")
.do_static_compilation(true);
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, color)
PUSH_CONSTANT(VEC4, rect_icon)
PUSH_CONSTANT(VEC4, rect_geom)
SAMPLER(0, FLOAT_2D, image)
VERTEX_SOURCE("gpu_shader_2D_image_rect_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,8 +9,9 @@
#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(Type::VEC4, "color")
.push_constant(Type::VEC4, "shuffle")
.fragment_source("gpu_shader_image_shuffle_color_frag.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(gpu_shader_2D_image_common)
PUSH_CONSTANT(VEC4, color)
PUSH_CONSTANT(VEC4, shuffle)
FRAGMENT_SOURCE("gpu_shader_image_shuffle_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,52 +9,55 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(nodelink_iface)
.smooth(Type::VEC4, "finalColor")
.smooth(Type::VEC2, "lineUV")
.flat(Type::FLOAT, "lineLength")
.flat(Type::FLOAT, "lineThickness")
.flat(Type::FLOAT, "dashLength")
.flat(Type::FLOAT, "dashFactor")
.flat(Type::INT, "hasBackLink")
.flat(Type::FLOAT, "dashAlpha")
.flat(Type::INT, "isMainLine")
.flat(Type::FLOAT, "aspect");
SMOOTH(VEC4, finalColor)
SMOOTH(VEC2, lineUV)
FLAT(FLOAT, lineLength)
FLAT(FLOAT, lineThickness)
FLAT(FLOAT, dashLength)
FLAT(FLOAT, dashFactor)
FLAT(INT, hasBackLink)
FLAT(FLOAT, dashAlpha)
FLAT(INT, isMainLine)
FLAT(FLOAT, aspect)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink)
.vertex_in(0, Type::VEC2, "uv")
.vertex_in(1, Type::VEC2, "pos")
.vertex_in(2, Type::VEC2, "expand")
.vertex_out(nodelink_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.uniform_buf(0, "NodeLinkData", "node_link_data", Frequency::PASS)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_nodelink_vert.glsl")
.fragment_source("gpu_shader_2D_nodelink_frag.glsl")
.typedef_source("GPU_shader_shared.hh")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, uv)
VERTEX_IN(1, VEC2, pos)
VERTEX_IN(2, VEC2, expand)
VERTEX_OUT(nodelink_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
UNIFORM_BUF_FREQ(0, NodeLinkData, node_link_data, PASS)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl")
TYPEDEF_SOURCE("GPU_shader_shared.hh")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink_inst)
.vertex_in(0, Type::VEC2, "uv")
.vertex_in(1, Type::VEC2, "pos")
.vertex_in(2, Type::VEC2, "expand")
.vertex_in(3, Type::VEC2, "P0")
.vertex_in(4, Type::VEC2, "P1")
.vertex_in(5, Type::VEC2, "P2")
.vertex_in(6, Type::VEC2, "P3")
.vertex_in(7, Type::UVEC4, "colid_doarrow")
.vertex_in(8, Type::VEC4, "start_color")
.vertex_in(9, Type::VEC4, "end_color")
.vertex_in(10, Type::UVEC2, "domuted")
.vertex_in(11, Type::FLOAT, "dim_factor")
.vertex_in(12, Type::FLOAT, "thickness")
.vertex_in(13, Type::VEC3, "dash_params")
.vertex_in(14, Type::INT, "has_back_link")
.vertex_out(nodelink_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.uniform_buf(0, "NodeLinkInstanceData", "node_link_data", Frequency::PASS)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_nodelink_vert.glsl")
.fragment_source("gpu_shader_2D_nodelink_frag.glsl")
.typedef_source("GPU_shader_shared.hh")
.define("USE_INSTANCE")
.do_static_compilation(true);
VERTEX_IN(0, VEC2, uv)
VERTEX_IN(1, VEC2, pos)
VERTEX_IN(2, VEC2, expand)
VERTEX_IN(3, VEC2, P0)
VERTEX_IN(4, VEC2, P1)
VERTEX_IN(5, VEC2, P2)
VERTEX_IN(6, VEC2, P3)
VERTEX_IN(7, UVEC4, colid_doarrow)
VERTEX_IN(8, VEC4, start_color)
VERTEX_IN(9, VEC4, end_color)
VERTEX_IN(10, UVEC2, domuted)
VERTEX_IN(11, FLOAT, dim_factor)
VERTEX_IN(12, FLOAT, thickness)
VERTEX_IN(13, VEC3, dash_params)
VERTEX_IN(14, INT, has_back_link)
VERTEX_OUT(nodelink_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
UNIFORM_BUF_FREQ(0, NodeLinkInstanceData, node_link_data, PASS)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl")
TYPEDEF_SOURCE("GPU_shader_shared.hh")
DEFINE("USE_INSTANCE")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,13 +10,14 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa)
.vertex_in(0, Type::VEC2, "pos")
.vertex_out(smooth_radii_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::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(true);
VERTEX_IN(0, VEC2, pos)
VERTEX_OUT(smooth_radii_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, 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

@ -10,14 +10,15 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa)
.vertex_in(0, Type::VEC2, "pos")
.vertex_out(smooth_radii_outline_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC4, "outlineColor")
.push_constant(Type::FLOAT, "size")
.push_constant(Type::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(true);
VERTEX_IN(0, VEC2, pos)
VERTEX_OUT(smooth_radii_outline_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, color)
PUSH_CONSTANT(VEC4, 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

@ -10,12 +10,13 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color)
.vertex_in(0, Type::VEC2, "pos")
.vertex_in(1, Type::FLOAT, "size")
.vertex_in(2, Type::VEC4, "color")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "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(true);
VERTEX_IN(0, VEC2, pos)
VERTEX_IN(1, FLOAT, size)
VERTEX_IN(2, VEC4, color)
VERTEX_OUT(smooth_color_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, 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

@ -10,56 +10,62 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_widget_iface)
.flat(Type::FLOAT, "discardFac")
.flat(Type::FLOAT, "lineWidth")
.flat(Type::VEC2, "outRectSize")
.flat(Type::VEC4, "borderColor")
.flat(Type::VEC4, "embossColor")
.flat(Type::VEC4, "outRoundCorners")
.no_perspective(Type::FLOAT, "butCo")
.no_perspective(Type::VEC2, "uvInterp")
.no_perspective(Type::VEC4, "innerColor");
FLAT(FLOAT, discardFac)
FLAT(FLOAT, lineWidth)
FLAT(VEC2, outRectSize)
FLAT(VEC4, borderColor)
FLAT(VEC4, embossColor)
FLAT(VEC4, outRoundCorners)
NO_PERSPECTIVE(FLOAT, butCo)
NO_PERSPECTIVE(VEC2, uvInterp)
NO_PERSPECTIVE(VEC4, innerColor)
GPU_SHADER_INTERFACE_END()
/* TODO(fclem): Share with C code. */
#define MAX_PARAM 12
#define MAX_INSTANCE 6
GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shared)
.define("MAX_PARAM", STRINGIFY(MAX_PARAM))
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC3, "checkerColorAndSize")
.vertex_out(gpu_widget_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("gpu_shader_2D_widget_base_vert.glsl")
.fragment_source("gpu_shader_2D_widget_base_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space");
DEFINE_VALUE("MAX_PARAM", STRINGIFY(MAX_PARAM))
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC3, checkerColorAndSize)
VERTEX_OUT(gpu_widget_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("gpu_shader_2D_widget_base_vert.glsl")
FRAGMENT_SOURCE("gpu_shader_2D_widget_base_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base)
.do_static_compilation(true)
/* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems
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.15.4 and Intel Iris
* causes #78307 when using gl_InstanceID outside of instance. */
.define("widgetID", "0")
.push_constant(Type::VEC4, "parameters", MAX_PARAM)
.additional_info("gpu_shader_2D_widget_shared");
DEFINE_VALUE("widgetID", "0")
PUSH_CONSTANT_ARRAY(VEC4, parameters, MAX_PARAM)
ADDITIONAL_INFO(gpu_shader_2D_widget_shared)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base_inst)
.do_static_compilation(true)
.define("widgetID", "gl_InstanceID")
.push_constant(Type::VEC4, "parameters", (MAX_PARAM * MAX_INSTANCE))
.additional_info("gpu_shader_2D_widget_shared");
DO_STATIC_COMPILATION()
DEFINE_VALUE("widgetID", "gl_InstanceID")
PUSH_CONSTANT_ARRAY(VEC4, parameters, (MAX_PARAM * MAX_INSTANCE))
ADDITIONAL_INFO(gpu_shader_2D_widget_shared)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface)
.smooth(Type::FLOAT, "shadowFalloff")
.smooth(Type::FLOAT, "innerMask");
SMOOTH(FLOAT, shadowFalloff)
SMOOTH(FLOAT, innerMask)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow)
.do_static_compilation(true)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "parameters", 4)
.push_constant(Type::FLOAT, "alpha")
.vertex_in(0, Type::UINT, "vflag")
.vertex_out(gpu_widget_shadow_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("gpu_shader_2D_widget_shadow_vert.glsl")
.fragment_source("gpu_shader_2D_widget_shadow_frag.glsl");
DO_STATIC_COMPILATION()
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT_ARRAY(VEC4, parameters, 4)
PUSH_CONSTANT(FLOAT, alpha)
VERTEX_IN(0, UINT, vflag)
VERTEX_OUT(gpu_widget_shadow_iface)
FRAGMENT_OUT(0, VEC4, 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

@ -10,14 +10,16 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only)
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(flat_color_iface)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_vert.glsl")
.fragment_source("gpu_shader_depth_only_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(flat_color_iface)
PUSH_CONSTANT(MAT4, 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(true);
ADDITIONAL_INFO(gpu_shader_3D_depth_only)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,17 +10,19 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
.vertex_out(flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.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(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, color)
VERTEX_OUT(flat_color_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
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(true);
ADDITIONAL_INFO(gpu_shader_3D_flat_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,21 +10,24 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_common)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.sampler(0, ImageType::FLOAT_2D, "image")
.vertex_source("gpu_shader_3D_image_vert.glsl");
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC2, texCoord)
VERTEX_OUT(smooth_tex_coord_interp_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
SAMPLER(0, FLOAT_2D, image)
VERTEX_SOURCE("gpu_shader_3D_image_vert.glsl")
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(true);
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_color)
.additional_info("gpu_shader_3D_image_common")
.push_constant(Type::VEC4, "color")
.fragment_source("gpu_shader_image_color_frag.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(gpu_shader_3D_image_common)
PUSH_CONSTANT(VEC4, color)
FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,29 +9,32 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
.vertex_in(2, Type::FLOAT, "size")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "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(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, color)
VERTEX_IN(2, FLOAT, size)
VERTEX_OUT(smooth_color_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, 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, Type::VEC3, "pos")
.vertex_out(smooth_radii_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::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(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(smooth_radii_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, 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(true);
ADDITIONAL_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,96 +10,108 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_iface, interp)
.smooth(Type::VEC4, "final_color")
.smooth(Type::FLOAT, "clip");
SMOOTH(VEC4, final_color)
SMOOTH(FLOAT, clip)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_noperspective_iface, interp_noperspective)
.no_perspective(Type::FLOAT, "smoothline");
NO_PERSPECTIVE(FLOAT, smoothline)
GPU_SHADER_NAMED_INTERFACE_END(interp_noperspective)
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline)
.define("SMOOTH_WIDTH", "1.0")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC2, "viewportSize")
.push_constant(Type::FLOAT, "lineWidth")
.push_constant(Type::BOOL, "lineSmooth")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(gpu_shader_3D_polyline_iface)
.vertex_out(gpu_shader_3D_polyline_noperspective_iface)
.geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
.geometry_out(gpu_shader_3D_polyline_iface)
.geometry_out(gpu_shader_3D_polyline_noperspective_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("gpu_shader_3D_polyline_vert.glsl")
.geometry_source("gpu_shader_3D_polyline_geom.glsl")
.fragment_source("gpu_shader_3D_polyline_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space");
DEFINE_VALUE("SMOOTH_WIDTH", "1.0")
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC2, viewportSize)
PUSH_CONSTANT(FLOAT, lineWidth)
PUSH_CONSTANT(BOOL, lineSmooth)
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(gpu_shader_3D_polyline_iface)
VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface)
GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
GEOMETRY_OUT(gpu_shader_3D_polyline_iface)
GEOMETRY_OUT(gpu_shader_3D_polyline_noperspective_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("gpu_shader_3D_polyline_vert.glsl")
GEOMETRY_SOURCE("gpu_shader_3D_polyline_geom.glsl")
FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_no_geom)
.define("SMOOTH_WIDTH", "1.0")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC2, "viewportSize")
.push_constant(Type::FLOAT, "lineWidth")
.push_constant(Type::BOOL, "lineSmooth")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(gpu_shader_3D_polyline_iface)
.vertex_out(gpu_shader_3D_polyline_noperspective_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("gpu_shader_3D_polyline_vert_no_geom.glsl")
.fragment_source("gpu_shader_3D_polyline_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space");
DEFINE_VALUE("SMOOTH_WIDTH", "1.0")
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC2, viewportSize)
PUSH_CONSTANT(FLOAT, lineWidth)
PUSH_CONSTANT(BOOL, lineSmooth)
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(gpu_shader_3D_polyline_iface)
VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("gpu_shader_3D_polyline_vert_no_geom.glsl")
FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl")
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color)
.do_static_compilation(true)
.define("UNIFORM")
.push_constant(Type::VEC4, "color")
.additional_info("gpu_shader_3D_polyline");
DO_STATIC_COMPILATION()
DEFINE("UNIFORM")
PUSH_CONSTANT(VEC4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.define("UNIFORM")
.push_constant(Type::VEC4, "color")
.additional_info("gpu_shader_3D_polyline_no_geom");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
DEFINE("UNIFORM")
PUSH_CONSTANT(VEC4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped)
.do_static_compilation(true)
/* TODO(fclem): Put in a UBO to fit the 128byte requirement. */
.push_constant(Type::MAT4, "ModelMatrix")
.push_constant(Type::VEC4, "ClipPlane")
.define("CLIP")
.additional_info("gpu_shader_3D_polyline_uniform_color");
DO_STATIC_COMPILATION()
/* TODO(fclem): Put in a UBO to fit the 128byte requirement. */
PUSH_CONSTANT(MAT4, ModelMatrix)
PUSH_CONSTANT(VEC4, ClipPlane)
DEFINE("CLIP")
ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
/* TODO(fclem): Put in an UBO to fit the 128byte requirement. */
.push_constant(Type::MAT4, "ModelMatrix")
.push_constant(Type::VEC4, "ClipPlane")
.define("CLIP")
.additional_info("gpu_shader_3D_polyline_uniform_color_no_geom");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
/* TODO(fclem): Put in an UBO to fit the 128byte requirement. */
PUSH_CONSTANT(MAT4, ModelMatrix)
PUSH_CONSTANT(VEC4, ClipPlane)
DEFINE("CLIP")
ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color_no_geom)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color)
.do_static_compilation(true)
.define("FLAT")
.vertex_in(1, Type::VEC4, "color")
.additional_info("gpu_shader_3D_polyline");
DO_STATIC_COMPILATION()
DEFINE("FLAT")
VERTEX_IN(1, VEC4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.define("FLAT")
.vertex_in(1, Type::VEC4, "color")
.additional_info("gpu_shader_3D_polyline_no_geom");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
DEFINE("FLAT")
VERTEX_IN(1, VEC4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color)
.do_static_compilation(true)
.define("SMOOTH")
.vertex_in(1, Type::VEC4, "color")
.additional_info("gpu_shader_3D_polyline");
DO_STATIC_COMPILATION()
DEFINE("SMOOTH")
VERTEX_IN(1, VEC4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.define("SMOOTH")
.vertex_in(1, Type::VEC4, "color")
.additional_info("gpu_shader_3D_polyline_no_geom");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
DEFINE("SMOOTH")
VERTEX_IN(1, VEC4, color)
ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom)
GPU_SHADER_CREATE_END()

View File

@ -10,17 +10,19 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "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(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, color)
VERTEX_OUT(smooth_color_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, 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(true);
ADDITIONAL_INFO(gpu_shader_3D_smooth_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,30 +9,33 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)
.vertex_in(0, Type::VEC3, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "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(true);
VERTEX_IN(0, VEC3, pos)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, 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(true);
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, Type::VEC3, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
/* TODO(@fclem): Put those two to one UBO. */
.push_constant(Type::MAT4, "ModelMatrix")
.push_constant(Type::VEC4, "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(true);
VERTEX_IN(0, VEC3, pos)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC4, color)
/* TODO(@fclem): Put those two to one UBO. */
PUSH_CONSTANT(MAT4, ModelMatrix)
PUSH_CONSTANT(VEC4, 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

@ -9,38 +9,43 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, geometry_in)
.smooth(Type::VEC4, "finalColor")
.smooth(Type::FLOAT, "finalThickness");
SMOOTH(VEC4, finalColor)
SMOOTH(FLOAT, finalThickness)
GPU_SHADER_NAMED_INTERFACE_END(geometry_in)
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_geom_iface, geometry_out)
.smooth(Type::VEC4, "mColor")
.smooth(Type::VEC2, "mTexCoord");
SMOOTH(VEC4, mColor)
SMOOTH(VEC2, mTexCoord)
GPU_SHADER_NAMED_INTERFACE_END(geometry_out)
GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_base)
.vertex_in(0, Type::VEC4, "color")
.vertex_in(1, Type::VEC3, "pos")
.vertex_in(2, Type::FLOAT, "thickness")
.vertex_out(gpencil_stroke_vert_iface)
.fragment_out(0, Type::VEC4, "fragColor")
VERTEX_IN(0, VEC4, color)
VERTEX_IN(1, VEC3, pos)
VERTEX_IN(2, FLOAT, thickness)
VERTEX_OUT(gpencil_stroke_vert_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
.uniform_buf(0, "GPencilStrokeData", "gpencil_stroke_data")
UNIFORM_BUF(0, GPencilStrokeData, gpencil_stroke_data)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ProjectionMatrix")
.fragment_source("gpu_shader_gpencil_stroke_frag.glsl")
.typedef_source("GPU_shader_shared.hh");
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(MAT4, ProjectionMatrix)
FRAGMENT_SOURCE("gpu_shader_gpencil_stroke_frag.glsl")
TYPEDEF_SOURCE("GPU_shader_shared.hh")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
.additional_info("gpu_shader_gpencil_stroke_base")
.geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13)
.geometry_out(gpencil_stroke_geom_iface)
.vertex_source("gpu_shader_gpencil_stroke_vert.glsl")
.geometry_source("gpu_shader_gpencil_stroke_geom.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base)
GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13)
GEOMETRY_OUT(gpencil_stroke_geom_iface)
VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert.glsl")
GEOMETRY_SOURCE("gpu_shader_gpencil_stroke_geom.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_no_geom)
.metal_backend_only(true)
.define("USE_GEOMETRY_IFACE_COLOR")
.additional_info("gpu_shader_gpencil_stroke_base")
.vertex_out(gpencil_stroke_geom_iface)
.vertex_source("gpu_shader_gpencil_stroke_vert_no_geom.glsl")
.do_static_compilation(true);
METAL_BACKEND_ONLY()
DEFINE("USE_GEOMETRY_IFACE_COLOR")
ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base)
VERTEX_OUT(gpencil_stroke_geom_iface)
VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert_no_geom.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,25 +10,28 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points)
.local_group_size(16, 16, 1)
.push_constant(Type::INT, "elements_per_curve")
.push_constant(Type::INT, "ncurves")
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]")
.compute_source("gpu_shader_index_2d_array_points.glsl")
.do_static_compilation(true);
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(Type::INT, "elements_per_curve")
.push_constant(Type::INT, "ncurves")
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]")
.compute_source("gpu_shader_index_2d_array_lines.glsl")
.do_static_compilation(true);
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(Type::INT, "elements_per_curve")
.push_constant(Type::INT, "ncurves")
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]")
.compute_source("gpu_shader_index_2d_array_tris.glsl")
.do_static_compilation(true);
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

@ -10,14 +10,15 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_instance_varying_color_varying_size)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
.vertex_in(2, Type::FLOAT, "size")
.vertex_in(3, Type::MAT4, "InstanceModelMatrix")
.vertex_out(flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ViewProjectionMatrix")
.vertex_source("gpu_shader_instance_variying_size_variying_color_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")
.do_static_compilation(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, color)
VERTEX_IN(2, FLOAT, size)
VERTEX_IN(3, MAT4, InstanceModelMatrix)
VERTEX_OUT(flat_color_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ViewProjectionMatrix)
VERTEX_SOURCE("gpu_shader_instance_variying_size_variying_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

@ -9,24 +9,26 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface)
.flat(Type::VEC4, "finalColor")
.flat(Type::VEC4, "finalOutlineColor")
.flat(Type::VEC4, "radii")
.flat(Type::VEC4, "thresholds")
.flat(Type::UINT, "finalFlags");
FLAT(VEC4, finalColor)
FLAT(VEC4, finalOutlineColor)
FLAT(VEC4, radii)
FLAT(VEC4, 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, Type::VEC4, "color")
.vertex_in(1, Type::VEC4, "outlineColor")
.vertex_in(2, Type::VEC2, "pos")
.vertex_in(3, Type::FLOAT, "size")
.vertex_in(4, Type::UINT, "flags")
.vertex_out(keyframe_shape_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC2, "ViewportSize")
.push_constant(Type::FLOAT, "outline_scale")
.vertex_source("gpu_shader_keyframe_shape_vert.glsl")
.fragment_source("gpu_shader_keyframe_shape_frag.glsl")
.do_static_compilation(true);
TYPEDEF_SOURCE("GPU_shader_shared.hh")
VERTEX_IN(0, VEC4, color)
VERTEX_IN(1, VEC4, outlineColor)
VERTEX_IN(2, VEC2, pos)
VERTEX_IN(3, FLOAT, size)
VERTEX_IN(4, UINT, flags)
VERTEX_OUT(keyframe_shape_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC2, 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

@ -11,28 +11,31 @@
/* 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 */
NO_PERSPECTIVE(VEC2, stipple_start) /* In screen space */
FLAT(VEC2, stipple_pos)
GPU_SHADER_INTERFACE_END() /* In screen space */
GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
.vertex_in(0, Type::VEC3, "pos")
.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, "udash_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")
.vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
.fragment_source("gpu_shader_2D_line_dashed_frag.glsl")
.do_static_compilation(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(flat_color_iface)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(VEC2, viewport_size)
PUSH_CONSTANT(FLOAT, dash_width)
PUSH_CONSTANT(FLOAT, udash_factor) /* if > 1.0, 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(VEC4, color)
PUSH_CONSTANT(VEC4, color2)
VERTEX_OUT(gpu_shader_line_dashed_interface)
FRAGMENT_OUT(0, VEC4, 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(Type::MAT4, "ModelMatrix")
.additional_info("gpu_shader_3D_line_dashed_uniform_color")
.additional_info("gpu_clip_planes")
.do_static_compilation(true);
PUSH_CONSTANT(MAT4, ModelMatrix)
ADDITIONAL_INFO(gpu_shader_3D_line_dashed_uniform_color)
ADDITIONAL_INFO(gpu_clip_planes)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,7 +9,7 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_print)
.storage_buf(
GPU_SHADER_PRINTF_SLOT, Qualifier::READ_WRITE, "uint", "gpu_print_buf[]", Frequency::PASS)
.define("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY))
.define("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

@ -10,33 +10,37 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface)
.no_perspective(Type::VEC2, "co_interp")
.flat(Type::UINT, "strip_id");
NO_PERSPECTIVE(VEC2, 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, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "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(true);
VERTEX_OUT(gpu_seq_strip_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, 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(Type::VEC2, "pos_interp")
.no_perspective(Type::VEC2, "texCoord_interp")
.flat(Type::UINT, "thumb_id");
NO_PERSPECTIVE(VEC2, pos_interp)
NO_PERSPECTIVE(VEC2, 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, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.uniform_buf(0, "SeqStripThumbData", "thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]")
.uniform_buf(1, "SeqContextDrawData", "context_data")
.sampler(0, ImageType::FLOAT_2D, "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(true);
VERTEX_OUT(gpu_seq_thumb_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
UNIFORM_BUF(0, SeqStripThumbData, thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN])
UNIFORM_BUF(1, SeqContextDrawData, context_data)
SAMPLER(0, FLOAT_2D, 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()

View File

@ -8,17 +8,20 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(smooth_normal_iface).smooth(Type::VEC3, "normal");
GPU_SHADER_INTERFACE_INFO(smooth_normal_iface)
SMOOTH(VEC3, normal)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
.vertex_out(smooth_normal_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.uniform_buf(0, "SimpleLightingData", "simple_lighting_data", Frequency::PASS)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT3, "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(true);
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, nor)
VERTEX_OUT(smooth_normal_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
UNIFORM_BUF_FREQ(0, SimpleLightingData, simple_lighting_data, PASS)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
PUSH_CONSTANT(MAT3, 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

@ -10,137 +10,159 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_test)
.typedef_source("GPU_shader_shared.hh")
.fragment_out(0, Type::UVEC4, "out_test")
.additional_info("draw_fullscreen");
TYPEDEF_SOURCE("GPU_shader_shared.hh")
FRAGMENT_OUT(0, UVEC4, out_test)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_math_test)
.fragment_source("gpu_math_test.glsl")
.additional_info("gpu_shader_test")
.do_static_compilation(true);
FRAGMENT_SOURCE("gpu_math_test.glsl")
ADDITIONAL_INFO(gpu_shader_test)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_compute_1d_test)
.local_group_size(1)
.image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_1D, "img_output")
.compute_source("gpu_compute_1d_test.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(1)
IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_1D, 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, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "img_output")
.compute_source("gpu_compute_2d_test.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(1, 1)
IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, 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, Qualifier::WRITE, "uint", "out_indices[]")
.compute_source("gpu_compute_ibo_test.glsl")
.do_static_compilation(true);
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, Qualifier::WRITE, "vec4", "out_positions[]")
.compute_source("gpu_compute_vbo_test.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(1)
STORAGE_BUF(0, WRITE, vec4, 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, Qualifier::WRITE, "int", "data_out[]")
.compute_source("gpu_compute_ssbo_test.glsl")
.do_static_compilation(true);
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, Qualifier::WRITE, "int", "data0[]")
.storage_buf(1, Qualifier::WRITE, "int", "data1[]")
.compute_source("gpu_compute_dummy_test.glsl")
.do_static_compilation(true);
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, Qualifier::WRITE, "float", "data_out[]")
.compute_source("gpu_push_constants_test.glsl");
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(Type::FLOAT, "float_in")
.push_constant(Type::VEC2, "vec2_in")
.push_constant(Type::VEC3, "vec3_in")
.push_constant(Type::VEC4, "vec4_in")
.do_static_compilation(true);
ADDITIONAL_INFO(gpu_push_constants_base_test)
PUSH_CONSTANT(FLOAT, float_in)
PUSH_CONSTANT(VEC2, vec2_in)
PUSH_CONSTANT(VEC3, vec3_in)
PUSH_CONSTANT(VEC4, 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(Type::FLOAT, "filler", 20)
.do_static_compilation(true);
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(Type::FLOAT, "filler2", 32)
.do_static_compilation(true);
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(Type::FLOAT, "filler3", 64)
.do_static_compilation(true);
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(Type::FLOAT, "filler4", 1920)
.do_static_compilation(true);
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, ImageType::FLOAT_BUFFER, "bufferTexture")
.storage_buf(0, Qualifier::WRITE, "float", "data_out[]")
.compute_source("gpu_buffer_texture_test.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(1)
SAMPLER(0, FLOAT_BUFFER, bufferTexture)
STORAGE_BUF(0, WRITE, float, data_out[])
COMPUTE_SOURCE("gpu_buffer_texture_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Specialization constants. */
GPU_SHADER_CREATE_INFO(gpu_specialization_constants_base_test)
.storage_buf(0, Qualifier::WRITE, "int", "data_out[]")
.specialization_constant(Type::FLOAT, "float_in", 2)
.specialization_constant(Type::UINT, "uint_in", 3)
.specialization_constant(Type::INT, "int_in", 4)
.specialization_constant(Type::BOOL, "bool_in", true);
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(true);
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")
.vertex_source("gpu_specialization_test.glsl")
.fragment_source("gpu_specialization_test.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(gpu_specialization_constants_base_test)
VERTEX_SOURCE("gpu_specialization_test.glsl")
FRAGMENT_SOURCE("gpu_specialization_test.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* EEVEE test. */
GPU_SHADER_CREATE_INFO(eevee_shadow_test)
.fragment_source("eevee_shadow_test.glsl")
.additional_info("gpu_shader_test")
.additional_info("eevee_shared")
.do_static_compilation(true);
FRAGMENT_SOURCE("eevee_shadow_test.glsl")
ADDITIONAL_INFO(gpu_shader_test)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_occupancy_test)
.fragment_source("eevee_occupancy_test.glsl")
.additional_info("gpu_shader_test")
.additional_info("eevee_shared")
.do_static_compilation(true);
FRAGMENT_SOURCE("eevee_occupancy_test.glsl")
ADDITIONAL_INFO(gpu_shader_test)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_gbuffer_normal_test)
.fragment_source("eevee_gbuffer_normal_test.glsl")
.additional_info("gpu_shader_test")
.additional_info("eevee_shared")
.do_static_compilation(true);
FRAGMENT_SOURCE("eevee_gbuffer_normal_test.glsl")
ADDITIONAL_INFO(gpu_shader_test)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_gbuffer_closure_test)
.fragment_source("eevee_gbuffer_closure_test.glsl")
.additional_info("gpu_shader_test")
.additional_info("eevee_shared")
.do_static_compilation(true);
FRAGMENT_SOURCE("eevee_gbuffer_closure_test.glsl")
ADDITIONAL_INFO(gpu_shader_test)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,25 +9,22 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(text_iface)
.flat(Type::VEC4, "color_flat")
.no_perspective(Type::VEC2, "texCoord_interp")
.flat(Type::INT, "glyph_offset")
.flat(Type::UINT, "glyph_flags")
.flat(Type::IVEC2, "glyph_dim");
FLAT(VEC4, color_flat)
NO_PERSPECTIVE(VEC2, texCoord_interp)
FLAT(INT, glyph_offset)
FLAT(UINT, glyph_flags)
FLAT(IVEC2, glyph_dim)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_text)
.vertex_in(0, Type::VEC4, "pos")
.vertex_in(1, Type::VEC4, "col")
VERTEX_IN(0, VEC4, pos)
VERTEX_IN(1, VEC4, col)
.vertex_in(2, Type ::IVEC2, "glyph_size")
.vertex_in(3, Type ::INT, "offset")
.vertex_in(4, Type ::UINT, "flags")
.vertex_out(text_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::INT, "glyph_tex_width_mask")
.push_constant(Type::INT, "glyph_tex_width_shift")
.sampler(0, ImageType::FLOAT_2D, "glyph", Frequency::PASS)
.vertex_source("gpu_shader_text_vert.glsl")
.fragment_source("gpu_shader_text_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")
.do_static_compilation(true);
.vertex_in(4, Type ::UINT, "flags") VERTEX_OUT(text_iface) FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) PUSH_CONSTANT(INT, glyph_tex_width_mask)
PUSH_CONSTANT(INT, glyph_tex_width_shift) SAMPLER_FREQ(0, FLOAT_2D, glyph, PASS)
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

@ -9,5 +9,6 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space)
.push_constant(Type::BOOL, "srgbTarget")
.define("blender_srgb_to_framebuffer_space(a) a");
PUSH_CONSTANT(BOOL, srgbTarget)
DEFINE("blender_srgb_to_framebuffer_space(a) a")
GPU_SHADER_CREATE_END()