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.
5 changed files with 309 additions and 266 deletions
Showing only changes of commit cde71b4826 - Show all commits

View File

@ -11,8 +11,9 @@
* \{ */
GPU_SHADER_CREATE_INFO(basic_conservative)
.geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3)
.geometry_source("basic_conservative_depth_geom.glsl");
GEOMETRY_LAYOUT(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3)
GEOMETRY_SOURCE("basic_conservative_depth_geom.glsl")
GPU_SHADER_CREATE_END()
/** \} */
@ -21,28 +22,33 @@ GPU_SHADER_CREATE_INFO(basic_conservative)
* \{ */
GPU_SHADER_CREATE_INFO(basic_mesh)
.vertex_in(0, Type::VEC3, "pos")
.vertex_source("basic_depth_vert.glsl")
.additional_info("draw_mesh");
VERTEX_IN(0, VEC3, pos)
VERTEX_SOURCE("basic_depth_vert.glsl")
ADDITIONAL_INFO(draw_mesh)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(basic_pointcloud)
.vertex_source("basic_depth_pointcloud_vert.glsl")
.additional_info("draw_pointcloud");
VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl")
ADDITIONAL_INFO(draw_pointcloud)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(basic_curves)
.vertex_source("basic_depth_curves_vert.glsl")
.additional_info("draw_hair");
VERTEX_SOURCE("basic_depth_curves_vert.glsl")
ADDITIONAL_INFO(draw_hair)
GPU_SHADER_CREATE_END()
/* Geometry-shader alternative paths. */
GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom)
.vertex_in(0, Type::VEC3, "pos")
.vertex_source("basic_depth_vert_conservative_no_geom.glsl")
.additional_info("draw_mesh");
VERTEX_IN(0, VEC3, pos)
VERTEX_SOURCE("basic_depth_vert_conservative_no_geom.glsl")
ADDITIONAL_INFO(draw_mesh)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom)
.define("CONSERVATIVE_RASTER")
.vertex_source("basic_depth_pointcloud_vert.glsl")
.additional_info("draw_pointcloud");
DEFINE("CONSERVATIVE_RASTER")
VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl")
ADDITIONAL_INFO(draw_pointcloud)
GPU_SHADER_CREATE_END()
/** \} */
@ -70,7 +76,9 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom)
/** \name Depth shader types.
* \{ */
GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl");
GPU_SHADER_CREATE_INFO(basic_depth)
FRAGMENT_SOURCE("basic_depth_frag.glsl")
GPU_SHADER_CREATE_END()
BASIC_OBTYPE_VARIATIONS(basic_depth, basic_depth, draw_globals);

View File

@ -11,48 +11,52 @@
* \{ */
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_iface, gp_interp)
.smooth(Type::VEC4, "color_mul")
.smooth(Type::VEC4, "color_add")
.smooth(Type::VEC3, "pos")
.smooth(Type::VEC2, "uv");
SMOOTH(VEC4, color_mul)
SMOOTH(VEC4, color_add)
SMOOTH(VEC3, pos)
SMOOTH(VEC2, uv)
GPU_SHADER_NAMED_INTERFACE_END(gp_interp)
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_flat_iface, gp_interp_flat)
.flat(Type::VEC2, "aspect")
.flat(Type::VEC4, "sspos")
.flat(Type::UINT, "mat_flag")
.flat(Type::FLOAT, "depth");
FLAT(VEC2, aspect)
FLAT(VEC4, sspos)
FLAT(UINT, mat_flag)
FLAT(FLOAT, depth)
GPU_SHADER_NAMED_INTERFACE_END(gp_interp_flat)
GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_noperspective_iface, gp_interp_noperspective)
.no_perspective(Type::VEC2, "thickness")
.no_perspective(Type::FLOAT, "hardness");
NO_PERSPECTIVE(VEC2, thickness)
NO_PERSPECTIVE(FLOAT, hardness)
GPU_SHADER_NAMED_INTERFACE_END(gp_interp_noperspective)
GPU_SHADER_CREATE_INFO(gpencil_geometry)
.do_static_compilation(true)
.define("GP_LIGHT")
.typedef_source("gpencil_defines.h")
.sampler(2, ImageType::FLOAT_2D, "gpFillTexture")
.sampler(3, ImageType::FLOAT_2D, "gpStrokeTexture")
.sampler(4, ImageType::DEPTH_2D, "gpSceneDepthTexture")
.sampler(5, ImageType::FLOAT_2D, "gpMaskTexture")
.uniform_buf(4, "gpMaterial", "gp_materials[GPENCIL_MATERIAL_BUFFER_LEN]", Frequency::BATCH)
.uniform_buf(3, "gpLight", "gp_lights[GPENCIL_LIGHT_BUFFER_LEN]", Frequency::BATCH)
.push_constant(Type::VEC2, "viewportSize")
/* Per Object */
.push_constant(Type::VEC3, "gpNormal")
.push_constant(Type::BOOL, "gpStrokeOrder3d")
.push_constant(Type::INT, "gpMaterialOffset")
/* Per Layer */
.push_constant(Type::FLOAT, "gpVertexColorOpacity")
.push_constant(Type::VEC4, "gpLayerTint")
.push_constant(Type::FLOAT, "gpLayerOpacity")
.push_constant(Type::FLOAT, "gpStrokeIndexOffset")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "revealColor")
.vertex_out(gpencil_geometry_iface)
.vertex_out(gpencil_geometry_flat_iface)
.vertex_out(gpencil_geometry_noperspective_iface)
.vertex_source("gpencil_vert.glsl")
.fragment_source("gpencil_frag.glsl")
.depth_write(DepthWrite::ANY)
.additional_info("draw_gpencil");
DO_STATIC_COMPILATION()
DEFINE("GP_LIGHT")
TYPEDEF_SOURCE("gpencil_defines.h")
SAMPLER(2, FLOAT_2D, gpFillTexture)
SAMPLER(3, FLOAT_2D, gpStrokeTexture)
SAMPLER(4, DEPTH_2D, gpSceneDepthTexture)
SAMPLER(5, FLOAT_2D, gpMaskTexture)
UNIFORM_BUF_FREQ(4, gpMaterial, gp_materials[GPENCIL_MATERIAL_BUFFER_LEN], BATCH)
UNIFORM_BUF_FREQ(3, gpLight, gp_lights[GPENCIL_LIGHT_BUFFER_LEN], BATCH)
PUSH_CONSTANT(VEC2, viewportSize)
/* Per Object */
PUSH_CONSTANT(VEC3, gpNormal)
PUSH_CONSTANT(BOOL, gpStrokeOrder3d)
PUSH_CONSTANT(INT, gpMaterialOffset)
/* Per Layer */
PUSH_CONSTANT(FLOAT, gpVertexColorOpacity)
PUSH_CONSTANT(VEC4, gpLayerTint)
PUSH_CONSTANT(FLOAT, gpLayerOpacity)
PUSH_CONSTANT(FLOAT, gpStrokeIndexOffset)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, revealColor)
VERTEX_OUT(gpencil_geometry_iface)
VERTEX_OUT(gpencil_geometry_flat_iface)
VERTEX_OUT(gpencil_geometry_noperspective_iface)
VERTEX_SOURCE("gpencil_vert.glsl")
FRAGMENT_SOURCE("gpencil_frag.glsl")
DEPTH_WRITE(DepthWrite::ANY)
ADDITIONAL_INFO(draw_gpencil)
GPU_SHADER_CREATE_END()
/** \} */
@ -61,35 +65,38 @@ GPU_SHADER_CREATE_INFO(gpencil_geometry)
* \{ */
GPU_SHADER_CREATE_INFO(gpencil_layer_blend)
.do_static_compilation(true)
.sampler(0, ImageType::FLOAT_2D, "colorBuf")
.sampler(1, ImageType::FLOAT_2D, "revealBuf")
.sampler(2, ImageType::FLOAT_2D, "maskBuf")
.push_constant(Type::INT, "blendMode")
.push_constant(Type::FLOAT, "blendOpacity")
/* Reminder: This is considered SRC color in blend equations.
* Same operation on all buffers. */
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "fragRevealage")
.fragment_source("gpencil_layer_blend_frag.glsl")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
SAMPLER(0, FLOAT_2D, colorBuf)
SAMPLER(1, FLOAT_2D, revealBuf)
SAMPLER(2, FLOAT_2D, maskBuf)
PUSH_CONSTANT(INT, blendMode)
PUSH_CONSTANT(FLOAT, blendOpacity)
/* Reminder: This is considered SRC color in blend equations.
* Same operation on all buffers. */
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, fragRevealage)
FRAGMENT_SOURCE("gpencil_layer_blend_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_mask_invert)
.do_static_compilation(true)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "fragRevealage")
.fragment_source("gpencil_mask_invert_frag.glsl")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, fragRevealage)
FRAGMENT_SOURCE("gpencil_mask_invert_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_depth_merge)
.do_static_compilation(true)
.push_constant(Type::VEC4, "gpModelMatrix", 4)
.push_constant(Type::BOOL, "strokeOrder3d")
.sampler(0, ImageType::DEPTH_2D, "depthBuf")
.vertex_source("gpencil_depth_merge_vert.glsl")
.fragment_source("gpencil_depth_merge_frag.glsl")
.depth_write(DepthWrite::ANY)
.additional_info("draw_view");
DO_STATIC_COMPILATION()
PUSH_CONSTANT_ARRAY(VEC4, gpModelMatrix, 4)
PUSH_CONSTANT(BOOL, strokeOrder3d)
SAMPLER(0, DEPTH_2D, depthBuf)
VERTEX_SOURCE("gpencil_depth_merge_vert.glsl")
FRAGMENT_SOURCE("gpencil_depth_merge_frag.glsl")
DEPTH_WRITE(DepthWrite::ANY)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
/** \} */
@ -98,52 +105,57 @@ GPU_SHADER_CREATE_INFO(gpencil_depth_merge)
* \{ */
GPU_SHADER_INTERFACE_INFO(gpencil_antialiasing_iface)
.smooth(Type::VEC2, "uvs")
.smooth(Type::VEC2, "pixcoord")
.smooth(Type::VEC4, "offset[3]");
SMOOTH(VEC2, uvs)
SMOOTH(VEC2, pixcoord)
SMOOTH(VEC4, offset[3])
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(gpencil_antialiasing)
.define("SMAA_GLSL_3")
.define("SMAA_RT_METRICS", "viewportMetrics")
.define("SMAA_PRESET_HIGH")
.define("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)")
.define("SMAA_NO_DISCARD")
.vertex_out(gpencil_antialiasing_iface)
.push_constant(Type::VEC4, "viewportMetrics")
.push_constant(Type::FLOAT, "lumaWeight")
.vertex_source("gpencil_antialiasing_vert.glsl")
.fragment_source("gpencil_antialiasing_frag.glsl");
DEFINE("SMAA_GLSL_3")
DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics")
DEFINE("SMAA_PRESET_HIGH")
DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)")
DEFINE("SMAA_NO_DISCARD")
VERTEX_OUT(gpencil_antialiasing_iface)
PUSH_CONSTANT(VEC4, viewportMetrics)
PUSH_CONSTANT(FLOAT, lumaWeight)
VERTEX_SOURCE("gpencil_antialiasing_vert.glsl")
FRAGMENT_SOURCE("gpencil_antialiasing_frag.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_0)
.define("SMAA_STAGE", "0")
.sampler(0, ImageType::FLOAT_2D, "colorTex")
.sampler(1, ImageType::FLOAT_2D, "revealTex")
.fragment_out(0, Type::VEC2, "out_edges")
.additional_info("gpencil_antialiasing")
.do_static_compilation(true);
DEFINE_VALUE("SMAA_STAGE", "0")
SAMPLER(0, FLOAT_2D, colorTex)
SAMPLER(1, FLOAT_2D, revealTex)
FRAGMENT_OUT(0, VEC2, out_edges)
ADDITIONAL_INFO(gpencil_antialiasing)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_1)
.define("SMAA_STAGE", "1")
.sampler(0, ImageType::FLOAT_2D, "edgesTex")
.sampler(1, ImageType::FLOAT_2D, "areaTex")
.sampler(2, ImageType::FLOAT_2D, "searchTex")
.fragment_out(0, Type::VEC4, "out_weights")
.additional_info("gpencil_antialiasing")
.do_static_compilation(true);
DEFINE_VALUE("SMAA_STAGE", "1")
SAMPLER(0, FLOAT_2D, edgesTex)
SAMPLER(1, FLOAT_2D, areaTex)
SAMPLER(2, FLOAT_2D, searchTex)
FRAGMENT_OUT(0, VEC4, out_weights)
ADDITIONAL_INFO(gpencil_antialiasing)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_2)
.define("SMAA_STAGE", "2")
.sampler(0, ImageType::FLOAT_2D, "colorTex")
.sampler(1, ImageType::FLOAT_2D, "revealTex")
.sampler(2, ImageType::FLOAT_2D, "blendTex")
.push_constant(Type::FLOAT, "mixFactor")
.push_constant(Type::FLOAT, "taaAccumulatedWeight")
.push_constant(Type::BOOL, "doAntiAliasing")
.push_constant(Type::BOOL, "onlyAlpha")
/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */
.fragment_out(0, Type::VEC4, "out_color", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_reveal", DualBlend::SRC_1)
.additional_info("gpencil_antialiasing")
.do_static_compilation(true);
DEFINE_VALUE("SMAA_STAGE", "2")
SAMPLER(0, FLOAT_2D, colorTex)
SAMPLER(1, FLOAT_2D, revealTex)
SAMPLER(2, FLOAT_2D, blendTex)
PUSH_CONSTANT(FLOAT, mixFactor)
PUSH_CONSTANT(FLOAT, taaAccumulatedWeight)
PUSH_CONSTANT(BOOL, doAntiAliasing)
PUSH_CONSTANT(BOOL, onlyAlpha)
/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */
FRAGMENT_OUT_DUAL(0, VEC4, out_color, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_reveal, SRC_1)
ADDITIONAL_INFO(gpencil_antialiasing)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -5,100 +5,109 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpencil_fx_common)
.sampler(0, ImageType::FLOAT_2D, "colorBuf")
.sampler(1, ImageType::FLOAT_2D, "revealBuf")
/* Reminder: This is considered SRC color in blend equations.
* Same operation on all buffers. */
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "fragRevealage")
.fragment_source("gpencil_vfx_frag.glsl");
SAMPLER(0, FLOAT_2D, colorBuf)
SAMPLER(1, FLOAT_2D, revealBuf)
/* Reminder: This is considered SRC color in blend equations.
* Same operation on all buffers. */
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, fragRevealage)
FRAGMENT_SOURCE("gpencil_vfx_frag.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_composite)
.do_static_compilation(true)
.define("COMPOSITE")
.push_constant(Type::BOOL, "isFirstPass")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("COMPOSITE")
PUSH_CONSTANT(BOOL, isFirstPass)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_colorize)
.do_static_compilation(true)
.define("COLORIZE")
.push_constant(Type::VEC3, "lowColor")
.push_constant(Type::VEC3, "highColor")
.push_constant(Type::FLOAT, "factor")
.push_constant(Type::INT, "mode")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("COLORIZE")
PUSH_CONSTANT(VEC3, lowColor)
PUSH_CONSTANT(VEC3, highColor)
PUSH_CONSTANT(FLOAT, factor)
PUSH_CONSTANT(INT, mode)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_blur)
.do_static_compilation(true)
.define("BLUR")
.push_constant(Type::VEC2, "offset")
.push_constant(Type::INT, "sampCount")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("BLUR")
PUSH_CONSTANT(VEC2, offset)
PUSH_CONSTANT(INT, sampCount)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_transform)
.do_static_compilation(true)
.define("TRANSFORM")
.push_constant(Type::VEC2, "axisFlip")
.push_constant(Type::VEC2, "waveDir")
.push_constant(Type::VEC2, "waveOffset")
.push_constant(Type::FLOAT, "wavePhase")
.push_constant(Type::VEC2, "swirlCenter")
.push_constant(Type::FLOAT, "swirlAngle")
.push_constant(Type::FLOAT, "swirlRadius")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("TRANSFORM")
PUSH_CONSTANT(VEC2, axisFlip)
PUSH_CONSTANT(VEC2, waveDir)
PUSH_CONSTANT(VEC2, waveOffset)
PUSH_CONSTANT(FLOAT, wavePhase)
PUSH_CONSTANT(VEC2, swirlCenter)
PUSH_CONSTANT(FLOAT, swirlAngle)
PUSH_CONSTANT(FLOAT, swirlRadius)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_glow)
.do_static_compilation(true)
.define("GLOW")
.push_constant(Type::VEC4, "glowColor")
.push_constant(Type::VEC2, "offset")
.push_constant(Type::INT, "sampCount")
.push_constant(Type::VEC4, "threshold")
.push_constant(Type::BOOL, "firstPass")
.push_constant(Type::BOOL, "glowUnder")
.push_constant(Type::INT, "blendMode")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("GLOW")
PUSH_CONSTANT(VEC4, glowColor)
PUSH_CONSTANT(VEC2, offset)
PUSH_CONSTANT(INT, sampCount)
PUSH_CONSTANT(VEC4, threshold)
PUSH_CONSTANT(BOOL, firstPass)
PUSH_CONSTANT(BOOL, glowUnder)
PUSH_CONSTANT(INT, blendMode)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_rim)
.do_static_compilation(true)
.define("RIM")
.push_constant(Type::VEC2, "blurDir")
.push_constant(Type::VEC2, "uvOffset")
.push_constant(Type::VEC3, "rimColor")
.push_constant(Type::VEC3, "maskColor")
.push_constant(Type::INT, "sampCount")
.push_constant(Type::INT, "blendMode")
.push_constant(Type::BOOL, "isFirstPass")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("RIM")
PUSH_CONSTANT(VEC2, blurDir)
PUSH_CONSTANT(VEC2, uvOffset)
PUSH_CONSTANT(VEC3, rimColor)
PUSH_CONSTANT(VEC3, maskColor)
PUSH_CONSTANT(INT, sampCount)
PUSH_CONSTANT(INT, blendMode)
PUSH_CONSTANT(BOOL, isFirstPass)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_shadow)
.do_static_compilation(true)
.define("SHADOW")
.push_constant(Type::VEC4, "shadowColor")
.push_constant(Type::VEC2, "uvRotX")
.push_constant(Type::VEC2, "uvRotY")
.push_constant(Type::VEC2, "uvOffset")
.push_constant(Type::VEC2, "blurDir")
.push_constant(Type::VEC2, "waveDir")
.push_constant(Type::VEC2, "waveOffset")
.push_constant(Type::FLOAT, "wavePhase")
.push_constant(Type::INT, "sampCount")
.push_constant(Type::BOOL, "isFirstPass")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("SHADOW")
PUSH_CONSTANT(VEC4, shadowColor)
PUSH_CONSTANT(VEC2, uvRotX)
PUSH_CONSTANT(VEC2, uvRotY)
PUSH_CONSTANT(VEC2, uvOffset)
PUSH_CONSTANT(VEC2, blurDir)
PUSH_CONSTANT(VEC2, waveDir)
PUSH_CONSTANT(VEC2, waveOffset)
PUSH_CONSTANT(FLOAT, wavePhase)
PUSH_CONSTANT(INT, sampCount)
PUSH_CONSTANT(BOOL, isFirstPass)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize)
.do_static_compilation(true)
.define("PIXELIZE")
.push_constant(Type::VEC2, "targetPixelSize")
.push_constant(Type::VEC2, "targetPixelOffset")
.push_constant(Type::VEC2, "accumOffset")
.push_constant(Type::INT, "sampCount")
.additional_info("gpencil_fx_common")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
DEFINE("PIXELIZE")
PUSH_CONSTANT(VEC2, targetPixelSize)
PUSH_CONSTANT(VEC2, targetPixelOffset)
PUSH_CONSTANT(VEC2, accumOffset)
PUSH_CONSTANT(INT, sampCount)
ADDITIONAL_INFO(gpencil_fx_common)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()

View File

@ -4,33 +4,39 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(image_engine_color_iface).smooth(Type::VEC2, "uv_screen");
GPU_SHADER_INTERFACE_INFO(image_engine_color_iface)
SMOOTH(VEC2, uv_screen)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(image_engine_color_shader)
.vertex_in(0, Type::IVEC2, "pos")
.vertex_out(image_engine_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(Type::VEC4, "shuffle")
.push_constant(Type::VEC2, "farNearDistances")
.push_constant(Type::IVEC2, "offset")
.push_constant(Type::INT, "drawFlags")
.push_constant(Type::BOOL, "imgPremultiplied")
.sampler(0, ImageType::FLOAT_2D, "imageTexture")
.sampler(1, ImageType::DEPTH_2D, "depth_texture")
.vertex_source("image_engine_color_vert.glsl")
.fragment_source("image_engine_color_frag.glsl")
.additional_info("draw_modelmat")
.do_static_compilation(true);
VERTEX_IN(0, IVEC2, pos)
VERTEX_OUT(image_engine_color_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
PUSH_CONSTANT(VEC4, shuffle)
PUSH_CONSTANT(VEC2, farNearDistances)
PUSH_CONSTANT(IVEC2, offset)
PUSH_CONSTANT(INT, drawFlags)
PUSH_CONSTANT(BOOL, imgPremultiplied)
SAMPLER(0, FLOAT_2D, imageTexture)
SAMPLER(1, DEPTH_2D, depth_texture)
VERTEX_SOURCE("image_engine_color_vert.glsl")
FRAGMENT_SOURCE("image_engine_color_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface).smooth(Type::VEC2, "uv_image");
GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface)
SMOOTH(VEC2, uv_image)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(image_engine_depth_shader)
.vertex_in(0, Type::IVEC2, "pos")
.vertex_in(1, Type::VEC2, "uv")
.vertex_out(image_engine_depth_iface)
.push_constant(Type::VEC4, "min_max_uv")
.vertex_source("image_engine_depth_vert.glsl")
.fragment_source("image_engine_depth_frag.glsl")
.additional_info("draw_modelmat")
.depth_write(DepthWrite::ANY)
.do_static_compilation(true);
VERTEX_IN(0, IVEC2, pos)
VERTEX_IN(1, VEC2, uv)
VERTEX_OUT(image_engine_depth_iface)
PUSH_CONSTANT(VEC4, min_max_uv)
VERTEX_SOURCE("image_engine_depth_vert.glsl")
FRAGMENT_SOURCE("image_engine_depth_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
DEPTH_WRITE(DepthWrite::ANY)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -9,60 +9,68 @@
/** \name Select ID for Edit Mesh Selection
* \{ */
GPU_SHADER_INTERFACE_INFO(select_id_iface).flat(Type::INT, "select_id");
GPU_SHADER_INTERFACE_INFO(select_id_iface)
FLAT(INT, select_id)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(select_id_flat)
.push_constant(Type::FLOAT, "sizeVertex")
.push_constant(Type::INT, "offset")
.push_constant(Type::FLOAT, "retopologyOffset")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "index")
.vertex_out(select_id_iface)
.fragment_out(0, Type::UINT, "fragColor")
.vertex_source("select_id_vert.glsl")
.fragment_source("select_id_frag.glsl")
.additional_info("draw_modelmat")
.do_static_compilation(true);
PUSH_CONSTANT(FLOAT, sizeVertex)
PUSH_CONSTANT(INT, offset)
PUSH_CONSTANT(FLOAT, retopologyOffset)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, INT, index)
VERTEX_OUT(select_id_iface)
FRAGMENT_OUT(0, UINT, fragColor)
VERTEX_SOURCE("select_id_vert.glsl")
FRAGMENT_SOURCE("select_id_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(select_id_uniform)
.define("UNIFORM_ID")
.push_constant(Type::FLOAT, "sizeVertex")
.push_constant(Type::INT, "select_id")
.push_constant(Type::FLOAT, "retopologyOffset")
.vertex_in(0, Type::VEC3, "pos")
.fragment_out(0, Type::UINT, "fragColor")
.vertex_source("select_id_vert.glsl")
.fragment_source("select_id_frag.glsl")
.additional_info("draw_modelmat")
.do_static_compilation(true);
DEFINE("UNIFORM_ID")
PUSH_CONSTANT(FLOAT, sizeVertex)
PUSH_CONSTANT(INT, select_id)
PUSH_CONSTANT(FLOAT, retopologyOffset)
VERTEX_IN(0, VEC3, pos)
FRAGMENT_OUT(0, UINT, fragColor)
VERTEX_SOURCE("select_id_vert.glsl")
FRAGMENT_SOURCE("select_id_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(select_id_flat_clipped)
.additional_info("select_id_flat")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(select_id_flat)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(select_id_uniform_clipped)
.additional_info("select_id_uniform")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(select_id_uniform)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Used to patch overlay shaders. */
GPU_SHADER_CREATE_INFO(select_id_patch)
.typedef_source("select_shader_shared.hh")
.vertex_out(select_id_iface)
/* Need to make sure the depth & stencil comparison runs before the fragment shader. */
.early_fragment_test(true)
.uniform_buf(SELECT_DATA, "SelectInfoData", "select_info_buf")
/* Select IDs for instanced draw-calls not using #PassMain. */
.storage_buf(SELECT_ID_IN, Qualifier::READ, "int", "in_select_buf[]")
/* Stores the result of the whole selection drawing. Content depends on selection mode. */
.storage_buf(SELECT_ID_OUT, Qualifier::READ_WRITE, "uint", "out_select_buf[]");
TYPEDEF_SOURCE("select_shader_shared.hh")
VERTEX_OUT(select_id_iface)
/* Need to make sure the depth & stencil comparison runs before the fragment shader. */
EARLY_FRAGMENT_TEST(true)
UNIFORM_BUF(SELECT_DATA, SelectInfoData, select_info_buf)
/* Select IDs for instanced draw-calls not using #PassMain. */
STORAGE_BUF(SELECT_ID_IN, READ, int, in_select_buf[])
/* Stores the result of the whole selection drawing. Content depends on selection mode. */
STORAGE_BUF(SELECT_ID_OUT, READ_WRITE, uint, out_select_buf[])
GPU_SHADER_CREATE_END()
/** \} */
GPU_SHADER_CREATE_INFO(select_debug_fullscreen)
.additional_info("draw_fullscreen")
.fragment_source("select_debug_frag.glsl")
.sampler(0, ImageType::UINT_2D, "image")
.fragment_out(0, Type::VEC4, "fragColor")
.do_static_compilation(true);
ADDITIONAL_INFO(draw_fullscreen)
FRAGMENT_SOURCE("select_debug_frag.glsl")
SAMPLER(0, UINT_2D, image)
FRAGMENT_OUT(0, VEC4, fragColor)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()