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

View File

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

View File

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

View File

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