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" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_index_load) GPU_SHADER_CREATE_INFO(gpu_index_load)
.push_constant(Type::BOOL, "gpu_index_no_buffer") PUSH_CONSTANT(BOOL, gpu_index_no_buffer)
.push_constant(Type::BOOL, "gpu_index_16bit") PUSH_CONSTANT(BOOL, gpu_index_16bit)
.push_constant(Type::INT, "gpu_index_base_index") PUSH_CONSTANT(INT, gpu_index_base_index)
.storage_buf( STORAGE_BUF_FREQ(GPU_SSBO_INDEX_BUF_SLOT, READ, uint, gpu_index_buf[], GEOMETRY)
GPU_SSBO_INDEX_BUF_SLOT, Qualifier::READ, "uint", "gpu_index_buf[]", Frequency::GEOMETRY) DEFINE("GPU_INDEX_LOAD")
.define("GPU_INDEX_LOAD"); GPU_SHADER_CREATE_END()

View File

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

View File

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

View File

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

View File

@ -9,8 +9,9 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color) GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color)
.additional_info("gpu_shader_2D_image_common") ADDITIONAL_INFO(gpu_shader_2D_image_common)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::FLOAT, "factor") PUSH_CONSTANT(FLOAT, factor)
.fragment_source("gpu_shader_image_desaturate_frag.glsl") FRAGMENT_SOURCE("gpu_shader_image_desaturate_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -10,29 +10,31 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge) GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge)
.vertex_in(0, Type::VEC2, "pos") VERTEX_IN(0, VEC2, pos)
.vertex_in(1, Type::VEC2, "texCoord") VERTEX_IN(1, VEC2, texCoord)
.vertex_out(smooth_tex_coord_interp_iface) VERTEX_OUT(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::BOOL, "display_transform") PUSH_CONSTANT(BOOL, display_transform)
.push_constant(Type::BOOL, "overlay") PUSH_CONSTANT(BOOL, overlay)
.push_constant(Type::BOOL, "use_hdr") PUSH_CONSTANT(BOOL, use_hdr)
/* Sampler slots should match OCIO's. */ /* Sampler slots should match OCIO's. */
.sampler(0, ImageType::FLOAT_2D, "image_texture") SAMPLER(0, FLOAT_2D, image_texture)
.sampler(1, ImageType::FLOAT_2D, "overlays_texture") SAMPLER(1, FLOAT_2D, overlays_texture)
.vertex_source("gpu_shader_2D_image_vert.glsl") VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl")
.fragment_source("gpu_shader_image_overlays_merge_frag.glsl") FRAGMENT_SOURCE("gpu_shader_image_overlays_merge_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Cycles display driver fallback shader. */ /* Cycles display driver fallback shader. */
GPU_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback) GPU_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback)
.vertex_in(0, Type::VEC2, "pos") VERTEX_IN(0, VEC2, pos)
.vertex_in(1, Type::VEC2, "texCoord") VERTEX_IN(1, VEC2, texCoord)
.vertex_out(smooth_tex_coord_interp_iface) VERTEX_OUT(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::VEC2, "fullscreen") PUSH_CONSTANT(VEC2, fullscreen)
.sampler(0, ImageType::FLOAT_2D, "image_texture") SAMPLER(0, FLOAT_2D, image_texture)
.vertex_source("gpu_shader_display_fallback_vert.glsl") VERTEX_SOURCE("gpu_shader_display_fallback_vert.glsl")
.fragment_source("gpu_shader_display_fallback_frag.glsl") FRAGMENT_SOURCE("gpu_shader_display_fallback_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -10,13 +10,14 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color) GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color)
.vertex_out(smooth_tex_coord_interp_iface) VERTEX_OUT(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::VEC4, "rect_icon") PUSH_CONSTANT(VEC4, rect_icon)
.push_constant(Type::VEC4, "rect_geom") PUSH_CONSTANT(VEC4, rect_geom)
.sampler(0, ImageType::FLOAT_2D, "image") SAMPLER(0, FLOAT_2D, image)
.vertex_source("gpu_shader_2D_image_rect_vert.glsl") VERTEX_SOURCE("gpu_shader_2D_image_rect_vert.glsl")
.fragment_source("gpu_shader_image_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,8 +9,9 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color) GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color)
.additional_info("gpu_shader_2D_image_common") ADDITIONAL_INFO(gpu_shader_2D_image_common)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::VEC4, "shuffle") PUSH_CONSTANT(VEC4, shuffle)
.fragment_source("gpu_shader_image_shuffle_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_image_shuffle_color_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -10,13 +10,14 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa) GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa)
.vertex_in(0, Type::VEC2, "pos") VERTEX_IN(0, VEC2, pos)
.vertex_out(smooth_radii_iface) VERTEX_OUT(smooth_radii_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::FLOAT, "size") PUSH_CONSTANT(FLOAT, size)
.vertex_source("gpu_shader_2D_point_uniform_size_aa_vert.glsl") VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_aa_vert.glsl")
.fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space") ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,14 +10,15 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa) GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa)
.vertex_in(0, Type::VEC2, "pos") VERTEX_IN(0, VEC2, pos)
.vertex_out(smooth_radii_outline_iface) VERTEX_OUT(smooth_radii_outline_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::VEC4, "outlineColor") PUSH_CONSTANT(VEC4, outlineColor)
.push_constant(Type::FLOAT, "size") PUSH_CONSTANT(FLOAT, size)
.push_constant(Type::FLOAT, "outlineWidth") PUSH_CONSTANT(FLOAT, outlineWidth)
.vertex_source("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl")
.fragment_source("gpu_shader_point_uniform_color_outline_aa_frag.glsl") FRAGMENT_SOURCE("gpu_shader_point_uniform_color_outline_aa_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -10,12 +10,13 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color) GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color)
.vertex_in(0, Type::VEC2, "pos") VERTEX_IN(0, VEC2, pos)
.vertex_in(1, Type::FLOAT, "size") VERTEX_IN(1, FLOAT, size)
.vertex_in(2, Type::VEC4, "color") VERTEX_IN(2, VEC4, color)
.vertex_out(smooth_color_iface) VERTEX_OUT(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.vertex_source("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") VERTEX_SOURCE("gpu_shader_2D_point_varying_size_varying_color_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -10,17 +10,19 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color) GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.vertex_in(1, Type::VEC4, "color") VERTEX_IN(1, VEC4, color)
.vertex_out(flat_color_iface) VERTEX_OUT(flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.vertex_source("gpu_shader_3D_flat_color_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_flat_color_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space") ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped) GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped)
.additional_info("gpu_shader_3D_flat_color") ADDITIONAL_INFO(gpu_shader_3D_flat_color)
.additional_info("gpu_clip_planes") ADDITIONAL_INFO(gpu_clip_planes)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -9,29 +9,32 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color) GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.vertex_in(1, Type::VEC4, "color") VERTEX_IN(1, VEC4, color)
.vertex_in(2, Type::FLOAT, "size") VERTEX_IN(2, FLOAT, size)
.vertex_out(smooth_color_iface) VERTEX_OUT(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.vertex_source("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_point_varying_size_varying_color_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.vertex_out(smooth_radii_iface) VERTEX_OUT(smooth_radii_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::FLOAT, "size") PUSH_CONSTANT(FLOAT, size)
.vertex_source("gpu_shader_3D_point_uniform_size_aa_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_point_uniform_size_aa_vert.glsl")
.fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space") ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped) 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_shader_3D_point_uniform_size_uniform_color_aa)
.additional_info("gpu_clip_planes") ADDITIONAL_INFO(gpu_clip_planes)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -10,17 +10,19 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color) GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.vertex_in(1, Type::VEC4, "color") VERTEX_IN(1, VEC4, color)
.vertex_out(smooth_color_iface) VERTEX_OUT(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.vertex_source("gpu_shader_3D_smooth_color_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_smooth_color_vert.glsl")
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_3D_smooth_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space") ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped) GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped)
.additional_info("gpu_shader_3D_smooth_color") ADDITIONAL_INFO(gpu_shader_3D_smooth_color)
.additional_info("gpu_clip_planes") ADDITIONAL_INFO(gpu_clip_planes)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,30 +9,33 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color) GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.vertex_source("gpu_shader_3D_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space") ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped) GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped)
.additional_info("gpu_shader_3D_uniform_color") ADDITIONAL_INFO(gpu_shader_3D_uniform_color)
.additional_info("gpu_clip_planes") ADDITIONAL_INFO(gpu_clip_planes)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Confusing naming convention. But this is a version with only one local clip plane. */ /* Confusing naming convention. But this is a version with only one local clip plane. */
GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color) GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
/* TODO(@fclem): Put those two to one UBO. */ /* TODO(@fclem): Put those two to one UBO. */
.push_constant(Type::MAT4, "ModelMatrix") PUSH_CONSTANT(MAT4, ModelMatrix)
.push_constant(Type::VEC4, "ClipPlane") PUSH_CONSTANT(VEC4, ClipPlane)
.vertex_source("gpu_shader_3D_clipped_uniform_color_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_clipped_uniform_color_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl") FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space") ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

@ -10,25 +10,28 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points) GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points)
.local_group_size(16, 16, 1) LOCAL_GROUP_SIZE(16, 16, 1)
.push_constant(Type::INT, "elements_per_curve") PUSH_CONSTANT(INT, elements_per_curve)
.push_constant(Type::INT, "ncurves") PUSH_CONSTANT(INT, ncurves)
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") STORAGE_BUF(0, WRITE, uint, out_indices[])
.compute_source("gpu_shader_index_2d_array_points.glsl") COMPUTE_SOURCE("gpu_shader_index_2d_array_points.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines) GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines)
.local_group_size(16, 16, 1) LOCAL_GROUP_SIZE(16, 16, 1)
.push_constant(Type::INT, "elements_per_curve") PUSH_CONSTANT(INT, elements_per_curve)
.push_constant(Type::INT, "ncurves") PUSH_CONSTANT(INT, ncurves)
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") STORAGE_BUF(0, WRITE, uint, out_indices[])
.compute_source("gpu_shader_index_2d_array_lines.glsl") COMPUTE_SOURCE("gpu_shader_index_2d_array_lines.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris) GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris)
.local_group_size(16, 16, 1) LOCAL_GROUP_SIZE(16, 16, 1)
.push_constant(Type::INT, "elements_per_curve") PUSH_CONSTANT(INT, elements_per_curve)
.push_constant(Type::INT, "ncurves") PUSH_CONSTANT(INT, ncurves)
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") STORAGE_BUF(0, WRITE, uint, out_indices[])
.compute_source("gpu_shader_index_2d_array_tris.glsl") COMPUTE_SOURCE("gpu_shader_index_2d_array_tris.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

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

View File

@ -11,28 +11,31 @@
/* We leverage hardware interpolation to compute distance along the line. */ /* We leverage hardware interpolation to compute distance along the line. */
GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface) GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface)
.no_perspective(Type::VEC2, "stipple_start") /* In screen space */ NO_PERSPECTIVE(VEC2, stipple_start) /* In screen space */
.flat(Type::VEC2, "stipple_pos"); /* 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) GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.vertex_out(flat_color_iface) VERTEX_OUT(flat_color_iface)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::VEC2, "viewport_size") PUSH_CONSTANT(VEC2, viewport_size)
.push_constant(Type::FLOAT, "dash_width") PUSH_CONSTANT(FLOAT, dash_width)
.push_constant(Type::FLOAT, "udash_factor") /* if > 1.0, solid line. */ PUSH_CONSTANT(FLOAT, udash_factor) /* if > 1.0, solid line. */
/* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ /* 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(INT, colors_len) /* Enabled if > 0, 1 for solid line. */
.push_constant(Type::VEC4, "color") PUSH_CONSTANT(VEC4, color)
.push_constant(Type::VEC4, "color2") PUSH_CONSTANT(VEC4, color2)
.vertex_out(gpu_shader_line_dashed_interface) VERTEX_OUT(gpu_shader_line_dashed_interface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
.fragment_source("gpu_shader_2D_line_dashed_frag.glsl") FRAGMENT_SOURCE("gpu_shader_2D_line_dashed_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped) GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped)
.push_constant(Type::MAT4, "ModelMatrix") PUSH_CONSTANT(MAT4, ModelMatrix)
.additional_info("gpu_shader_3D_line_dashed_uniform_color") ADDITIONAL_INFO(gpu_shader_3D_line_dashed_uniform_color)
.additional_info("gpu_clip_planes") ADDITIONAL_INFO(gpu_clip_planes)
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,7 +9,7 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_print) GPU_SHADER_CREATE_INFO(gpu_print)
.storage_buf( STORAGE_BUF_FREQ(GPU_SHADER_PRINTF_SLOT, READ_WRITE, uint, gpu_print_buf[], PASS)
GPU_SHADER_PRINTF_SLOT, Qualifier::READ_WRITE, "uint", "gpu_print_buf[]", Frequency::PASS) DEFINE_VALUE("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY))
.define("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) DEFINE("GPU_PRINT")
.define("GPU_PRINT"); GPU_SHADER_CREATE_END()

View File

@ -10,33 +10,37 @@
#include "gpu_shader_create_info.hh" #include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface) GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface)
.no_perspective(Type::VEC2, "co_interp") NO_PERSPECTIVE(VEC2, co_interp)
.flat(Type::UINT, "strip_id"); FLAT(UINT, strip_id)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips) GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips)
.vertex_out(gpu_seq_strip_iface) VERTEX_OUT(gpu_seq_strip_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.uniform_buf(0, "SeqStripDrawData", "strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") UNIFORM_BUF(0, SeqStripDrawData, strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN])
.uniform_buf(1, "SeqContextDrawData", "context_data") UNIFORM_BUF(1, SeqContextDrawData, context_data)
.typedef_source("GPU_shader_shared.hh") TYPEDEF_SOURCE("GPU_shader_shared.hh")
.vertex_source("gpu_shader_sequencer_strips_vert.glsl") VERTEX_SOURCE("gpu_shader_sequencer_strips_vert.glsl")
.fragment_source("gpu_shader_sequencer_strips_frag.glsl") FRAGMENT_SOURCE("gpu_shader_sequencer_strips_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface) GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface)
.no_perspective(Type::VEC2, "pos_interp") NO_PERSPECTIVE(VEC2, pos_interp)
.no_perspective(Type::VEC2, "texCoord_interp") NO_PERSPECTIVE(VEC2, texCoord_interp)
.flat(Type::UINT, "thumb_id"); FLAT(UINT, thumb_id)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs) GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs)
.vertex_out(gpu_seq_thumb_iface) VERTEX_OUT(gpu_seq_thumb_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.uniform_buf(0, "SeqStripThumbData", "thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") UNIFORM_BUF(0, SeqStripThumbData, thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN])
.uniform_buf(1, "SeqContextDrawData", "context_data") UNIFORM_BUF(1, SeqContextDrawData, context_data)
.sampler(0, ImageType::FLOAT_2D, "image") SAMPLER(0, FLOAT_2D, image)
.typedef_source("GPU_shader_shared.hh") TYPEDEF_SOURCE("GPU_shader_shared.hh")
.vertex_source("gpu_shader_sequencer_thumbs_vert.glsl") VERTEX_SOURCE("gpu_shader_sequencer_thumbs_vert.glsl")
.fragment_source("gpu_shader_sequencer_thumbs_frag.glsl") FRAGMENT_SOURCE("gpu_shader_sequencer_thumbs_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -8,17 +8,20 @@
#include "gpu_shader_create_info.hh" #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) GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting)
.vertex_in(0, Type::VEC3, "pos") VERTEX_IN(0, VEC3, pos)
.vertex_in(1, Type::VEC3, "nor") VERTEX_IN(1, VEC3, nor)
.vertex_out(smooth_normal_iface) VERTEX_OUT(smooth_normal_iface)
.fragment_out(0, Type::VEC4, "fragColor") FRAGMENT_OUT(0, VEC4, fragColor)
.uniform_buf(0, "SimpleLightingData", "simple_lighting_data", Frequency::PASS) UNIFORM_BUF_FREQ(0, SimpleLightingData, simple_lighting_data, PASS)
.push_constant(Type::MAT4, "ModelViewProjectionMatrix") PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix)
.push_constant(Type::MAT3, "NormalMatrix") PUSH_CONSTANT(MAT3, NormalMatrix)
.typedef_source("GPU_shader_shared.hh") TYPEDEF_SOURCE("GPU_shader_shared.hh")
.vertex_source("gpu_shader_3D_normal_vert.glsl") VERTEX_SOURCE("gpu_shader_3D_normal_vert.glsl")
.fragment_source("gpu_shader_simple_lighting_frag.glsl") FRAGMENT_SOURCE("gpu_shader_simple_lighting_frag.glsl")
.do_static_compilation(true); DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

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

View File

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

View File

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