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.
14 changed files with 2070 additions and 1775 deletions
Showing only changes of commit d98723d27e - Show all commits

View File

@ -5,21 +5,23 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(overlay_antialiasing)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.sampler(1, ImageType::FLOAT_2D, "colorTex")
.sampler(2, ImageType::FLOAT_2D, "lineTex")
.push_constant(Type::BOOL, "doSmoothLines")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("overlay_antialiasing_frag.glsl")
.additional_info("draw_fullscreen")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
SAMPLER(0, DEPTH_2D, depthTex)
SAMPLER(1, FLOAT_2D, colorTex)
SAMPLER(2, FLOAT_2D, lineTex)
PUSH_CONSTANT(BOOL, doSmoothLines)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_SOURCE("overlay_antialiasing_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_xray_fade)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.sampler(1, ImageType::DEPTH_2D, "xrayDepthTex")
.push_constant(Type::FLOAT, "opacity")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("overlay_xray_fade_frag.glsl")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
SAMPLER(0, DEPTH_2D, depthTex)
SAMPLER(1, DEPTH_2D, xrayDepthTex)
PUSH_CONSTANT(FLOAT, opacity)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_SOURCE("overlay_xray_fade_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()

View File

@ -5,64 +5,72 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(overlay_frag_output)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput");
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface)
.flat(Type::VEC4, "finalColor")
.flat(Type::VEC2, "edgeStart")
.no_perspective(Type::VEC2, "edgePos");
FLAT(VEC4, finalColor)
FLAT(VEC2, edgeStart)
NO_PERSPECTIVE(VEC2, edgePos)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_common)
.push_constant(Type::FLOAT, "alpha")
.additional_info("draw_view");
PUSH_CONSTANT(FLOAT, alpha)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
/* -------------------------------------------------------------------- */
/** \name Armature Sphere
* \{ */
GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline)
.do_static_compilation(true)
.vertex_in(0, Type::VEC2, "pos")
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC2, pos)
/* Per instance. */
.vertex_in(1, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_wire_iface)
.vertex_source("overlay_armature_sphere_outline_vert.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(1, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_sphere_outline_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_sphere_outline")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_sphere_outline)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface)
.flat(Type::VEC3, "finalStateColor")
.flat(Type::VEC3, "finalBoneColor")
.flat(Type::MAT4, "sphereMatrix")
.smooth(Type::VEC3, "viewPosition");
FLAT(VEC3, finalStateColor)
FLAT(VEC3, finalBoneColor)
FLAT(MAT4, sphereMatrix)
SMOOTH(VEC3, viewPosition)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid)
.do_static_compilation(true)
.vertex_in(0, Type::VEC2, "pos")
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC2, pos)
/* Per instance. */
.vertex_in(1, Type::VEC4, "color")
.vertex_in(2, Type::MAT4, "inst_obmat")
.depth_write(DepthWrite::GREATER)
.vertex_out(overlay_armature_sphere_solid_iface)
.vertex_source("overlay_armature_sphere_solid_vert.glsl")
.fragment_source("overlay_armature_sphere_solid_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals")
.depth_write(DepthWrite::ANY);
VERTEX_IN(1, VEC4, color)
VERTEX_IN(2, MAT4, inst_obmat)
DEPTH_WRITE(DepthWrite::GREATER)
VERTEX_OUT(overlay_armature_sphere_solid_iface)
VERTEX_SOURCE("overlay_armature_sphere_solid_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_sphere_solid_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
DEPTH_WRITE(DepthWrite::ANY)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_sphere_solid")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_sphere_solid)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -71,166 +79,185 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped)
* \{ */
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_iface, geom_in)
.smooth(Type::VEC4, "pPos")
.smooth(Type::VEC3, "vPos")
.smooth(Type::VEC2, "ssPos")
.smooth(Type::VEC4, "vColSize");
SMOOTH(VEC4, pPos)
SMOOTH(VEC3, vPos)
SMOOTH(VEC2, ssPos)
SMOOTH(VEC4, vColSize)
GPU_SHADER_NAMED_INTERFACE_END(geom_in)
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, geom_flat_in)
.flat(Type::INT, "inverted");
FLAT(INT, inverted)
GPU_SHADER_NAMED_INTERFACE_END(geom_flat_in)
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface)
.flat(Type::VEC4, "finalColor")
.flat(Type::VEC2, "edgeStart")
.no_perspective(Type::VEC2, "edgePos");
FLAT(VEC4, finalColor)
FLAT(VEC2, edgeStart)
NO_PERSPECTIVE(VEC2, edgePos)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
/* Per instance. */
.vertex_in(3, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_shape_outline_iface)
.vertex_out(overlay_armature_shape_outline_flat_iface)
.geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2)
.geometry_out(overlay_armature_wire_iface)
.vertex_source("overlay_armature_shape_outline_vert.glsl")
.geometry_source("overlay_armature_shape_outline_geom.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(3, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_shape_outline_iface)
VERTEX_OUT(overlay_armature_shape_outline_flat_iface)
GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2)
GEOMETRY_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_shape_outline_vert.glsl")
GEOMETRY_SOURCE("overlay_armature_shape_outline_geom.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
/* Per instance. */
.vertex_in(3, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_shape_outline_no_geom_iface)
.vertex_source("overlay_armature_shape_outline_vert_no_geom.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(3, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface)
VERTEX_SOURCE("overlay_armature_shape_outline_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next)
.do_static_compilation(true)
.storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
.storage_buf(1, Qualifier::READ, "mat4", "data_buf[]")
.push_constant(Type::IVEC2, "gpu_attr_0")
.vertex_out(overlay_armature_shape_outline_no_geom_iface)
.vertex_source("overlay_armature_shape_outline_next_vert.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("gpu_index_load")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
STORAGE_BUF(1, READ, mat4, data_buf[])
PUSH_CONSTANT(IVEC2, gpu_attr_0)
VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface)
VERTEX_SOURCE("overlay_armature_shape_outline_next_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_shape_outline")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_shape_outline)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.additional_info("overlay_armature_shape_outline_no_geom")
.additional_info("drw_clipped");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_shape_outline_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface)
.smooth(Type::VEC4, "finalColor")
.flat(Type::INT, "inverted");
SMOOTH(VEC4, finalColor)
FLAT(INT, inverted)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, nor)
/* Per instance. */
.vertex_in(2, Type::MAT4, "inst_obmat")
.depth_write(DepthWrite::GREATER)
.vertex_out(overlay_armature_shape_solid_iface)
.vertex_source("overlay_armature_shape_solid_vert.glsl")
.fragment_source("overlay_armature_shape_solid_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(2, MAT4, inst_obmat)
DEPTH_WRITE(DepthWrite::GREATER)
VERTEX_OUT(overlay_armature_shape_solid_iface)
VERTEX_SOURCE("overlay_armature_shape_solid_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_shape_solid_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_shape_solid")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_shape_solid)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface)
.flat(Type::VEC4, "finalColor")
.flat(Type::FLOAT, "wire_width")
.no_perspective(Type::FLOAT, "edgeCoord");
FLAT(VEC4, finalColor)
FLAT(FLOAT, wire_width)
NO_PERSPECTIVE(FLOAT, edgeCoord)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_iface, geometry_in)
.flat(Type::VEC4, "finalColor")
.flat(Type::FLOAT, "wire_width");
FLAT(VEC4, finalColor)
FLAT(FLOAT, wire_width)
GPU_SHADER_NAMED_INTERFACE_END(geometry_in)
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, geometry_out)
.flat(Type::VEC4, "finalColor")
.flat(Type::FLOAT, "wire_width");
FLAT(VEC4, finalColor)
FLAT(FLOAT, wire_width)
GPU_SHADER_NAMED_INTERFACE_END(geometry_out)
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface,
geometry_noperspective_out)
.no_perspective(Type::FLOAT, "edgeCoord");
NO_PERSPECTIVE(FLOAT, edgeCoord)
GPU_SHADER_NAMED_INTERFACE_END(geometry_noperspective_out)
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire)
.do_static_compilation(true)
.push_constant(Type::BOOL, "do_smooth_wire")
.vertex_in(0, Type::VEC3, "pos")
DO_STATIC_COMPILATION()
PUSH_CONSTANT(BOOL, do_smooth_wire)
VERTEX_IN(0, VEC3, pos)
/* Per instance. */
.vertex_in(2, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_shape_wire_iface)
.vertex_source("overlay_armature_shape_wire_vert.glsl")
.geometry_out(overlay_armature_shape_wire_geom_iface)
.geometry_out(overlay_armature_shape_wire_geom_noperspective_iface)
.geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
.geometry_source("overlay_armature_shape_wire_geom.glsl")
.fragment_source("overlay_armature_shape_wire_frag.glsl")
.typedef_source("overlay_shader_shared.h")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(2, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_shape_wire_iface)
VERTEX_SOURCE("overlay_armature_shape_wire_vert.glsl")
GEOMETRY_OUT(overlay_armature_shape_wire_geom_iface)
GEOMETRY_OUT(overlay_armature_shape_wire_geom_noperspective_iface)
GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
GEOMETRY_SOURCE("overlay_armature_shape_wire_geom.glsl")
FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl")
TYPEDEF_SOURCE("overlay_shader_shared.h")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_shape_wire")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_shape_wire)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.push_constant(Type::BOOL, "do_smooth_wire")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(2, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_wire_iface)
.vertex_source("overlay_armature_shape_wire_vert_no_geom.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.typedef_source("overlay_shader_shared.h")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
PUSH_CONSTANT(BOOL, do_smooth_wire)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(2, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_shape_wire_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
TYPEDEF_SOURCE("overlay_shader_shared.h")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next)
.do_static_compilation(true)
.define("NO_GEOM")
.push_constant(Type::BOOL, "do_smooth_wire")
.storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
.storage_buf(1, Qualifier::READ, "mat4", "data_buf[]")
.push_constant(Type::IVEC2, "gpu_attr_0")
.define("inst_obmat", "data_buf[gl_InstanceID]")
.vertex_out(overlay_armature_shape_wire_next_iface)
.vertex_source("overlay_armature_shape_wire_next_vert.glsl")
.fragment_source("overlay_armature_shape_wire_frag.glsl")
.typedef_source("overlay_shader_shared.h")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("gpu_index_load")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
DEFINE("NO_GEOM")
PUSH_CONSTANT(BOOL, do_smooth_wire)
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
STORAGE_BUF(1, READ, mat4, data_buf[])
PUSH_CONSTANT(IVEC2, gpu_attr_0)
DEFINE_VALUE("inst_obmat", "data_buf[gl_InstanceID]")
VERTEX_OUT(overlay_armature_shape_wire_next_iface)
VERTEX_SOURCE("overlay_armature_shape_wire_next_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl")
TYPEDEF_SOURCE("overlay_shader_shared.h")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
/** \} */
@ -239,54 +266,59 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC2, "pos0")
.vertex_in(1, Type::VEC2, "pos1")
.vertex_in(2, Type::VEC2, "pos2")
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC2, pos0)
VERTEX_IN(1, VEC2, pos1)
VERTEX_IN(2, VEC2, pos2)
/* Per instance. */
.vertex_in(3, Type::VEC4, "headSphere")
.vertex_in(4, Type::VEC4, "tailSphere")
.vertex_in(5, Type::VEC4, "outlineColorSize")
.vertex_in(6, Type::VEC3, "xAxis")
.vertex_out(overlay_armature_wire_iface)
.vertex_source("overlay_armature_envelope_outline_vert.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(3, VEC4, headSphere)
VERTEX_IN(4, VEC4, tailSphere)
VERTEX_IN(5, VEC4, outlineColorSize)
VERTEX_IN(6, VEC3, xAxis)
VERTEX_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_envelope_outline_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_envelope_outline")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_envelope_outline)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface)
.flat(Type::VEC3, "finalStateColor")
.flat(Type::VEC3, "finalBoneColor")
.smooth(Type::VEC3, "normalView");
FLAT(VEC3, finalStateColor)
FLAT(VEC3, finalBoneColor)
SMOOTH(VEC3, normalView)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
/* Per instance. Assumed to be in world coordinate already. */
.vertex_in(1, Type::VEC4, "headSphere")
.vertex_in(2, Type::VEC4, "tailSphere")
.vertex_in(3, Type::VEC3, "xAxis")
.vertex_in(4, Type::VEC3, "stateColor")
.vertex_in(5, Type::VEC3, "boneColor")
.vertex_out(overlay_armature_envelope_solid_iface)
.push_constant(Type::BOOL, "isDistance")
.vertex_source("overlay_armature_envelope_solid_vert.glsl")
.fragment_source("overlay_armature_envelope_solid_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common");
VERTEX_IN(1, VEC4, headSphere)
VERTEX_IN(2, VEC4, tailSphere)
VERTEX_IN(3, VEC3, xAxis)
VERTEX_IN(4, VEC3, stateColor)
VERTEX_IN(5, VEC3, boneColor)
VERTEX_OUT(overlay_armature_envelope_solid_iface)
PUSH_CONSTANT(BOOL, isDistance)
VERTEX_SOURCE("overlay_armature_envelope_solid_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_envelope_solid_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_envelope_solid")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_envelope_solid)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -295,36 +327,39 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped)
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface)
.no_perspective(Type::FLOAT, "colorFac")
.flat(Type::VEC4, "finalWireColor")
.flat(Type::VEC4, "finalInnerColor");
NO_PERSPECTIVE(FLOAT, colorFac)
FLAT(VEC4, finalWireColor)
FLAT(VEC4, finalInnerColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_stick)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
/* Bone aligned screen space. */
.vertex_in(0, Type::VEC2, "pos")
.vertex_in(1, Type::UINT, "flag")
VERTEX_IN(0, VEC2, pos)
VERTEX_IN(1, UINT, flag)
/* Per instance. Assumed to be in world coordinate already. */
.vertex_in(2, Type::VEC3, "boneStart")
.vertex_in(3, Type::VEC3, "boneEnd")
VERTEX_IN(2, VEC3, boneStart)
VERTEX_IN(3, VEC3, boneEnd)
/* alpha encode if we do wire. If 0.0 we don't. */
.vertex_in(4, Type::VEC4, "wireColor")
.vertex_in(5, Type::VEC4, "boneColor")
.vertex_in(6, Type::VEC4, "headColor")
.vertex_in(7, Type::VEC4, "tailColor")
.define("do_wire", "(wireColor.a > 0.0)")
.vertex_out(overlay_armature_stick_iface)
.vertex_source("overlay_armature_stick_vert.glsl")
.fragment_source("overlay_armature_stick_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(4, VEC4, wireColor)
VERTEX_IN(5, VEC4, boneColor)
VERTEX_IN(6, VEC4, headColor)
VERTEX_IN(7, VEC4, tailColor)
DEFINE_VALUE("do_wire", "(wireColor.a > 0.0)")
VERTEX_OUT(overlay_armature_stick_iface)
VERTEX_SOURCE("overlay_armature_stick_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_stick_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_stick")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_stick)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -333,23 +368,25 @@ GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_armature_dof)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC2, "pos")
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC2, pos)
/* Per instance. Assumed to be in world coordinate already. */
.vertex_in(1, Type::VEC4, "color")
.vertex_in(2, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_wire_iface)
.vertex_source("overlay_armature_dof_vert.glsl")
.fragment_source("overlay_armature_dof_solid_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("overlay_armature_common")
.additional_info("draw_globals");
VERTEX_IN(1, VEC4, color)
VERTEX_IN(2, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_dof_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_dof_solid_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_dof")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_dof)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -358,21 +395,23 @@ GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_armature_wire)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
.push_constant(Type::FLOAT, "alpha")
.vertex_out(overlay_armature_wire_iface)
.vertex_source("overlay_armature_wire_vert.glsl")
.fragment_source("overlay_armature_wire_frag.glsl")
.additional_info("overlay_frag_output")
.additional_info("draw_mesh")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, color)
PUSH_CONSTANT(FLOAT, alpha)
VERTEX_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_wire_vert.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped)
.do_static_compilation(true)
.additional_info("overlay_armature_wire")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_wire)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -5,22 +5,24 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(overlay_background)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
.sampler(1, ImageType::DEPTH_2D, "depthBuffer")
.push_constant(Type::INT, "bgType")
.push_constant(Type::VEC4, "colorOverride")
.fragment_source("overlay_background_frag.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.additional_info("draw_fullscreen")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
SAMPLER(0, FLOAT_2D, colorBuffer)
SAMPLER(1, DEPTH_2D, depthBuffer)
PUSH_CONSTANT(INT, bgType)
PUSH_CONSTANT(VEC4, colorOverride)
FRAGMENT_SOURCE("overlay_background_frag.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_clipbound)
.do_static_compilation(true)
.push_constant(Type::VEC4, "ucolor")
.push_constant(Type::VEC3, "boundbox", 8)
.vertex_source("overlay_clipbound_vert.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_view");
DO_STATIC_COMPILATION()
PUSH_CONSTANT(VEC4, ucolor)
PUSH_CONSTANT_ARRAY(VEC3, boundbox, 8)
VERTEX_SOURCE("overlay_clipbound_vert.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()

View File

@ -9,40 +9,45 @@
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_iface)
.no_perspective(Type::VEC2, "edgePos")
.flat(Type::VEC2, "edgeStart")
.flat(Type::VEC4, "finalColor");
NO_PERSPECTIVE(VEC2, edgePos)
FLAT(VEC2, edgeStart)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_extra)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "vclass")
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, INT, vclass)
/* Instance attributes. */
.vertex_in(2, Type::VEC4, "color")
.vertex_in(3, Type::MAT4, "inst_obmat")
.vertex_out(overlay_extra_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_extra_vert.glsl")
.fragment_source("overlay_extra_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
VERTEX_IN(2, VEC4, color)
VERTEX_IN(3, MAT4, inst_obmat)
VERTEX_OUT(overlay_extra_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_extra_vert.glsl")
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_select)
.do_static_compilation(true)
.define("SELECT_EDGES")
.additional_info("overlay_extra");
DO_STATIC_COMPILATION()
DEFINE("SELECT_EDGES")
ADDITIONAL_INFO(overlay_extra)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_select")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_select)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -50,24 +55,28 @@ GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped)
/** \name Irradiance Grid
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface).flat(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_grid)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
.push_constant(Type::MAT4, "gridModelMatrix")
.push_constant(Type::BOOL, "isTransform")
.vertex_out(overlay_extra_grid_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_extra_lightprobe_grid_vert.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
SAMPLER(0, DEPTH_2D, depthBuffer)
PUSH_CONSTANT(MAT4, gridModelMatrix)
PUSH_CONSTANT(BOOL, isTransform)
VERTEX_OUT(overlay_extra_grid_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_extra_lightprobe_grid_vert.glsl")
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_grid")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_grid)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -76,22 +85,24 @@ GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_extra_groundline)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
/* Instance attributes. */
.vertex_in(1, Type::VEC3, "inst_pos")
.vertex_out(overlay_extra_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_extra_groundline_vert.glsl")
.fragment_source("overlay_extra_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
VERTEX_IN(1, VEC3, inst_pos)
VERTEX_OUT(overlay_extra_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_extra_groundline_vert.glsl")
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_groundline")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_groundline)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -100,48 +111,55 @@ GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped)
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface)
.no_perspective(Type::VEC2, "stipple_coord")
.flat(Type::VEC2, "stipple_start")
.flat(Type::VEC4, "finalColor");
NO_PERSPECTIVE(VEC2, stipple_coord)
FLAT(VEC2, stipple_start)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_wire)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, color)
/* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */
.vertex_in(2, Type::INT, "colorid")
.vertex_out(overlay_extra_wire_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_extra_wire_vert.glsl")
.fragment_source("overlay_extra_wire_frag.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_globals");
VERTEX_IN(2, INT, colorid)
VERTEX_OUT(overlay_extra_wire_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_extra_wire_vert.glsl")
FRAGMENT_SOURCE("overlay_extra_wire_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_wire_select)
.do_static_compilation(true)
.define("SELECT_EDGES")
.additional_info("overlay_extra_wire");
DO_STATIC_COMPILATION()
DEFINE("SELECT_EDGES")
ADDITIONAL_INFO(overlay_extra_wire)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_wire_object)
.do_static_compilation(true)
.define("OBJECT_WIRE")
.additional_info("overlay_extra_wire");
DO_STATIC_COMPILATION()
DEFINE("OBJECT_WIRE")
ADDITIONAL_INFO(overlay_extra_wire)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_wire_select")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_wire_select)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_wire_object")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_wire_object)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_wire")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_wire)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -150,46 +168,53 @@ GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped)
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface)
.flat(Type::VEC4, "radii")
.flat(Type::VEC4, "fillColor")
.flat(Type::VEC4, "outlineColor");
FLAT(VEC4, radii)
FLAT(VEC4, fillColor)
FLAT(VEC4, outlineColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_point)
.do_static_compilation(true)
DO_STATIC_COMPILATION()
/* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */
.define("blender_srgb_to_framebuffer_space(a)", "a")
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "ucolor")
.vertex_out(overlay_extra_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_extra_point_vert.glsl")
.fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_globals");
DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a")
VERTEX_IN(0, VEC3, pos)
PUSH_CONSTANT(VEC4, ucolor)
VERTEX_OUT(overlay_extra_point_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_extra_point_vert.glsl")
FRAGMENT_SOURCE("overlay_point_varying_color_varying_outline_aa_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_point")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_point)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface).smooth(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface)
SMOOTH(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_loose_point)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "vertex_color")
.vertex_out(overlay_extra_loose_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_extra_loose_point_vert.glsl")
.fragment_source("overlay_extra_loose_point_frag.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, vertex_color)
VERTEX_OUT(overlay_extra_loose_point_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_extra_loose_point_vert.glsl")
FRAGMENT_SOURCE("overlay_extra_loose_point_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_loose_point")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_extra_loose_point)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -198,98 +223,109 @@ GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped)
* \{ */
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_iface, interp)
.smooth(Type::VEC4, "color");
SMOOTH(VEC4, color)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_flat_iface, interp_flat)
.flat(Type::VEC2, "ss_pos");
FLAT(VEC2, ss_pos)
GPU_SHADER_NAMED_INTERFACE_END(interp_flat)
GPU_SHADER_CREATE_INFO(overlay_motion_path_line)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::IVEC4, "mpathLineSettings")
.push_constant(Type::BOOL, "selected")
.push_constant(Type::VEC3, "customColorPre")
.push_constant(Type::VEC3, "customColorPost")
.push_constant(Type::INT, "lineThickness") /* In pixels. */
.push_constant(Type::MAT4, "camera_space_matrix")
.vertex_out(overlay_motion_path_line_iface)
.vertex_out(overlay_motion_path_line_flat_iface)
.geometry_out(overlay_motion_path_line_iface)
.geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_motion_path_line_vert.glsl")
.geometry_source("overlay_motion_path_line_geom.glsl")
.fragment_source("overlay_motion_path_line_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
PUSH_CONSTANT(IVEC4, mpathLineSettings)
PUSH_CONSTANT(BOOL, selected)
PUSH_CONSTANT(VEC3, customColorPre)
PUSH_CONSTANT(VEC3, customColorPost)
PUSH_CONSTANT(INT, lineThickness) /* In pixels. */
PUSH_CONSTANT(MAT4, camera_space_matrix)
VERTEX_OUT(overlay_motion_path_line_iface)
VERTEX_OUT(overlay_motion_path_line_flat_iface)
GEOMETRY_OUT(overlay_motion_path_line_iface)
GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_motion_path_line_vert.glsl")
GEOMETRY_SOURCE("overlay_motion_path_line_geom.glsl")
FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::IVEC4, "mpathLineSettings")
.push_constant(Type::BOOL, "selected")
.push_constant(Type::VEC3, "customColorPre")
.push_constant(Type::VEC3, "customColorPost")
.push_constant(Type::INT, "lineThickness") /* In pixels. */
.vertex_out(overlay_motion_path_line_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_motion_path_line_vert_no_geom.glsl")
.fragment_source("overlay_motion_path_line_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
PUSH_CONSTANT(IVEC4, mpathLineSettings)
PUSH_CONSTANT(BOOL, selected)
PUSH_CONSTANT(VEC3, customColorPre)
PUSH_CONSTANT(VEC3, customColorPost)
PUSH_CONSTANT(INT, lineThickness) /* In pixels. */
VERTEX_OUT(overlay_motion_path_line_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_motion_path_line_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next)
.do_static_compilation(true)
.storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
.push_constant(Type::IVEC2, "gpu_attr_0")
.push_constant(Type::IVEC4, "mpathLineSettings")
.push_constant(Type::BOOL, "selected")
.push_constant(Type::VEC3, "customColorPre")
.push_constant(Type::VEC3, "customColorPost")
.push_constant(Type::INT, "lineThickness") /* In pixels. */
.push_constant(Type::MAT4, "camera_space_matrix")
.vertex_out(overlay_motion_path_line_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_motion_path_line_next_vert.glsl")
.fragment_source("overlay_motion_path_line_frag.glsl")
.additional_info("draw_view")
.additional_info("gpu_index_load")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
PUSH_CONSTANT(IVEC2, gpu_attr_0)
PUSH_CONSTANT(IVEC4, mpathLineSettings)
PUSH_CONSTANT(BOOL, selected)
PUSH_CONSTANT(VEC3, customColorPre)
PUSH_CONSTANT(VEC3, customColorPost)
PUSH_CONSTANT(INT, lineThickness) /* In pixels. */
PUSH_CONSTANT(MAT4, camera_space_matrix)
VERTEX_OUT(overlay_motion_path_line_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_motion_path_line_next_vert.glsl")
FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped)
.do_static_compilation(true)
.additional_info("overlay_motion_path_line")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_motion_path_line)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.additional_info("overlay_motion_path_line_no_geom")
.additional_info("drw_clipped");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_motion_path_line_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface).flat(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_point)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "flag")
.push_constant(Type::IVEC4, "mpathPointSettings")
.push_constant(Type::BOOL, "showKeyFrames")
.push_constant(Type::VEC3, "customColorPre")
.push_constant(Type::VEC3, "customColorPost")
.push_constant(Type::MAT4, "camera_space_matrix")
.vertex_out(overlay_motion_path_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_motion_path_point_vert.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, INT, flag)
PUSH_CONSTANT(IVEC4, mpathPointSettings)
PUSH_CONSTANT(BOOL, showKeyFrames)
PUSH_CONSTANT(VEC3, customColorPre)
PUSH_CONSTANT(VEC3, customColorPost)
PUSH_CONSTANT(MAT4, camera_space_matrix)
VERTEX_OUT(overlay_motion_path_point_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_motion_path_point_vert.glsl")
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped)
.do_static_compilation(true)
.additional_info("overlay_motion_path_point")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_motion_path_point)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -297,27 +333,31 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped)
/** \name Image Empty
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_image_iface).smooth(Type::VEC2, "uvs");
GPU_SHADER_INTERFACE_INFO(overlay_image_iface)
SMOOTH(VEC2, uvs)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_image)
.do_static_compilation(true)
.push_constant(Type::BOOL, "depthSet")
.push_constant(Type::BOOL, "isCameraBackground")
.push_constant(Type::BOOL, "imgPremultiplied")
.push_constant(Type::BOOL, "imgAlphaBlend")
.push_constant(Type::VEC4, "ucolor")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(overlay_image_iface)
.sampler(0, ImageType::FLOAT_2D, "imgTexture")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_image_vert.glsl")
.fragment_source("overlay_image_frag.glsl")
.additional_info("draw_mesh");
DO_STATIC_COMPILATION()
PUSH_CONSTANT(BOOL, depthSet)
PUSH_CONSTANT(BOOL, isCameraBackground)
PUSH_CONSTANT(BOOL, imgPremultiplied)
PUSH_CONSTANT(BOOL, imgAlphaBlend)
PUSH_CONSTANT(VEC4, ucolor)
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(overlay_image_iface)
SAMPLER(0, FLOAT_2D, imgTexture)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_image_vert.glsl")
FRAGMENT_SOURCE("overlay_image_frag.glsl")
ADDITIONAL_INFO(draw_mesh)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_image_clipped)
.do_static_compilation(true)
.additional_info("overlay_image")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_image)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -326,24 +366,26 @@ GPU_SHADER_CREATE_INFO(overlay_image_clipped)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas)
.do_static_compilation(true)
.vertex_out(overlay_extra_iface)
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC3, "xAxis")
.push_constant(Type::VEC3, "yAxis")
.push_constant(Type::VEC3, "origin")
.push_constant(Type::INT, "halfLineCount")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_edit_gpencil_canvas_vert.glsl")
.fragment_source("overlay_extra_frag.glsl")
.additional_info("draw_mesh")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_OUT(overlay_extra_iface)
PUSH_CONSTANT(VEC4, color)
PUSH_CONSTANT(VEC3, xAxis)
PUSH_CONSTANT(VEC3, yAxis)
PUSH_CONSTANT(VEC3, origin)
PUSH_CONSTANT(INT, halfLineCount)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_edit_gpencil_canvas_vert.glsl")
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped)
.do_static_compilation(true)
.additional_info("overlay_gpencil_canvas")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_gpencil_canvas)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -351,85 +393,94 @@ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped)
/** \name Particle
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_particle_iface).flat(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_particle_iface)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_particle)
.sampler(0, ImageType::FLOAT_1D, "weightTex")
.push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */
.vertex_in(0, Type::VEC3, "part_pos")
.vertex_in(1, Type::VEC4, "part_rot")
.vertex_in(2, Type::FLOAT, "part_val")
.vertex_out(overlay_particle_iface)
.vertex_source("overlay_particle_vert.glsl")
.additional_info("draw_globals");
SAMPLER(0, FLOAT_1D, weightTex)
PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */
VERTEX_IN(0, VEC3, part_pos)
VERTEX_IN(1, VEC4, part_rot)
VERTEX_IN(2, FLOAT, part_val)
VERTEX_OUT(overlay_particle_iface)
VERTEX_SOURCE("overlay_particle_vert.glsl")
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_particle_dot)
.do_static_compilation(true)
.define("USE_DOTS")
.define("vclass", "0")
.define("pos", "vec3(0.0)")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.fragment_source("overlay_particle_frag.glsl")
.additional_info("overlay_particle")
.additional_info("draw_mesh");
DO_STATIC_COMPILATION()
DEFINE("USE_DOTS")
DEFINE_VALUE("vclass", "0")
DEFINE_VALUE("pos", "vec3(0.0)")
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
FRAGMENT_SOURCE("overlay_particle_frag.glsl")
ADDITIONAL_INFO(overlay_particle)
ADDITIONAL_INFO(draw_mesh)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped)
.do_static_compilation(true)
.additional_info("overlay_particle_dot")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_particle_dot)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_particle_shape)
.do_static_compilation(true)
DO_STATIC_COMPILATION()
/* Instantiated Attrs. */
.vertex_in(3, Type::VEC3, "pos")
.vertex_in(4, Type::INT, "vclass")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("overlay_varying_color.glsl")
.additional_info("overlay_particle")
.additional_info("draw_modelmat")
.additional_info("draw_resource_id_uniform");
VERTEX_IN(3, VEC3, pos)
VERTEX_IN(4, INT, vclass)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(overlay_particle)
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_resource_id_uniform)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_particle_shape_next)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.sampler(0, ImageType::FLOAT_1D, "weightTex")
.push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */
.push_constant(Type::INT, "shape_type")
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
SAMPLER(0, FLOAT_1D, weightTex)
PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */
PUSH_CONSTANT(INT, shape_type)
/* Use first attribute to only bind one buffer. */
.storage_buf(0, Qualifier::READ, "ParticlePointData", "part_pos[]", Frequency::GEOMETRY)
.vertex_out(overlay_extra_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_particle_shape_vert.glsl")
.fragment_source("overlay_particle_shape_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_modelmat_new")
.additional_info("draw_resource_handle_new")
.additional_info("draw_globals");
STORAGE_BUF_FREQ(0, READ, ParticlePointData, part_pos[], GEOMETRY)
VERTEX_OUT(overlay_extra_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_particle_shape_vert.glsl")
FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_particle_hair_next)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
.push_constant(Type::INT, "colorType")
.push_constant(Type::BOOL, "isTransform")
.push_constant(Type::BOOL, "useColoring")
.vertex_out(overlay_extra_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("overlay_particle_hair_vert.glsl")
.fragment_source("overlay_particle_shape_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_handle_new")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, nor)
PUSH_CONSTANT(INT, colorType)
PUSH_CONSTANT(BOOL, isTransform)
PUSH_CONSTANT(BOOL, useColoring)
VERTEX_OUT(overlay_extra_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_SOURCE("overlay_particle_hair_vert.glsl")
FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped)
.do_static_compilation(true)
.additional_info("overlay_particle_shape")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_particle_shape)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -5,15 +5,17 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(overlay_facing)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_source("overlay_facing_vert.glsl")
.fragment_source("overlay_facing_frag.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.additional_info("draw_mesh")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_SOURCE("overlay_facing_vert.glsl")
FRAGMENT_SOURCE("overlay_facing_frag.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_facing_clipped)
.do_static_compilation(true)
.additional_info("overlay_facing")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_facing)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()

View File

@ -5,38 +5,43 @@
#include "gpu_shader_create_info.hh"
/* We use the normalized local position to avoid precision loss during interpolation. */
GPU_SHADER_INTERFACE_INFO(overlay_grid_iface).smooth(Type::VEC3, "local_pos");
GPU_SHADER_INTERFACE_INFO(overlay_grid_iface)
SMOOTH(VEC3, local_pos)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_grid)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(overlay_grid_iface)
.fragment_out(0, Type::VEC4, "out_color")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.uniform_buf(3, "OVERLAY_GridData", "grid_buf")
.push_constant(Type::VEC3, "plane_axes")
.push_constant(Type::INT, "grid_flag")
.vertex_source("overlay_grid_vert.glsl")
.fragment_source("overlay_grid_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(overlay_grid_iface)
FRAGMENT_OUT(0, VEC4, out_color)
SAMPLER(0, DEPTH_2D, depth_tx)
UNIFORM_BUF(3, OVERLAY_GridData, grid_buf)
PUSH_CONSTANT(VEC3, plane_axes)
PUSH_CONSTANT(INT, grid_flag)
VERTEX_SOURCE("overlay_grid_vert.glsl")
FRAGMENT_SOURCE("overlay_grid_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_grid_background)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
.push_constant(Type::VEC4, "ucolor")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl")
.fragment_source("overlay_grid_background_frag.glsl")
.additional_info("draw_modelmat");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
SAMPLER(0, DEPTH_2D, depthBuffer)
PUSH_CONSTANT(VEC4, ucolor)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl")
FRAGMENT_SOURCE("overlay_grid_background_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_grid_image)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "ucolor")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_modelmat");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
PUSH_CONSTANT(VEC4, ucolor)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl")
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
GPU_SHADER_CREATE_END()

View File

@ -8,128 +8,147 @@
/** \name Outline Pre-pass
* \{ */
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp).flat(Type::UINT, "ob_id");
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp)
FLAT(UINT, ob_id)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_CREATE_INFO(overlay_outline_prepass)
.push_constant(Type::BOOL, "isTransform")
.vertex_out(overlay_outline_prepass_iface)
PUSH_CONSTANT(BOOL, isTransform)
VERTEX_OUT(overlay_outline_prepass_iface)
/* Using uint because 16bit uint can contain more ids than int. */
.fragment_out(0, Type::UINT, "out_object_id")
.fragment_source("overlay_outline_prepass_frag.glsl")
.additional_info("draw_globals");
FRAGMENT_OUT(0, UINT, out_object_id)
FRAGMENT_SOURCE("overlay_outline_prepass_frag.glsl")
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_source("overlay_outline_prepass_vert.glsl")
.additional_info("draw_mesh")
.additional_info("draw_resource_handle")
.additional_info("overlay_outline_prepass")
.additional_info("draw_object_infos");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_SOURCE("overlay_outline_prepass_vert.glsl")
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_resource_handle)
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_object_infos)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh_clipped)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass_mesh")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass_mesh)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert).flat(Type::VEC3, "pos");
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert)
FLAT(VEC3, pos)
GPU_SHADER_NAMED_INTERFACE_END(vert)
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves)
.do_static_compilation(true)
.vertex_source("overlay_outline_prepass_curves_vert.glsl")
.additional_info("draw_hair")
.additional_info("draw_resource_handle")
.additional_info("overlay_outline_prepass")
.additional_info("draw_object_infos");
DO_STATIC_COMPILATION()
VERTEX_SOURCE("overlay_outline_prepass_curves_vert.glsl")
ADDITIONAL_INFO(draw_hair)
ADDITIONAL_INFO(draw_resource_handle)
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_object_infos)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves_clipped)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass_curves")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass_curves)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass")
.additional_info("draw_object_infos")
.additional_info("draw_mesh")
.additional_info("draw_resource_handle")
.vertex_in(0, Type::VEC3, "pos")
.define("USE_GEOM")
.vertex_out(overlay_outline_prepass_wire_iface)
.geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2)
.geometry_out(overlay_outline_prepass_iface)
.vertex_source("overlay_outline_prepass_vert.glsl")
.geometry_source("overlay_outline_prepass_geom.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_object_infos)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_resource_handle)
VERTEX_IN(0, VEC3, pos)
DEFINE("USE_GEOM")
VERTEX_OUT(overlay_outline_prepass_wire_iface)
GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2)
GEOMETRY_OUT(overlay_outline_prepass_iface)
VERTEX_SOURCE("overlay_outline_prepass_vert.glsl")
GEOMETRY_SOURCE("overlay_outline_prepass_geom.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_next)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass")
.additional_info("draw_view")
.additional_info("draw_mesh_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_handle_new")
.additional_info("gpu_index_load")
.storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
.push_constant(Type::IVEC2, "gpu_attr_0")
.vertex_source("overlay_outline_prepass_wire_vert.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_mesh_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
PUSH_CONSTANT(IVEC2, gpu_attr_0)
VERTEX_SOURCE("overlay_outline_prepass_wire_vert.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.additional_info("overlay_outline_prepass")
.additional_info("draw_object_infos")
.additional_info("draw_mesh")
.additional_info("draw_resource_handle")
.vertex_source("overlay_outline_prepass_vert_no_geom.glsl");
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_object_infos)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_resource_handle)
VERTEX_SOURCE("overlay_outline_prepass_vert_no_geom.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass_wire")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass_wire)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, gp_interp_flat)
.flat(Type::VEC2, "aspect")
.flat(Type::VEC4, "sspos");
FLAT(VEC2, aspect)
FLAT(VEC4, sspos)
GPU_SHADER_NAMED_INTERFACE_END(gp_interp_flat)
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_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(overlay_outline_prepass_gpencil)
.do_static_compilation(true)
.push_constant(Type::BOOL, "isTransform")
.vertex_out(overlay_outline_prepass_iface)
.vertex_out(overlay_outline_prepass_gpencil_flat_iface)
.vertex_out(overlay_outline_prepass_gpencil_noperspective_iface)
.vertex_source("overlay_outline_prepass_gpencil_vert.glsl")
.push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */
.push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */
DO_STATIC_COMPILATION()
PUSH_CONSTANT(BOOL, isTransform)
VERTEX_OUT(overlay_outline_prepass_iface)
VERTEX_OUT(overlay_outline_prepass_gpencil_flat_iface)
VERTEX_OUT(overlay_outline_prepass_gpencil_noperspective_iface)
VERTEX_SOURCE("overlay_outline_prepass_gpencil_vert.glsl")
PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */
PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */
/* Using uint because 16bit uint can contain more ids than int. */
.fragment_out(0, Type::UINT, "out_object_id")
.fragment_source("overlay_outline_prepass_gpencil_frag.glsl")
.depth_write(DepthWrite::ANY)
.additional_info("draw_gpencil")
.additional_info("draw_resource_handle")
.additional_info("draw_globals");
FRAGMENT_OUT(0, UINT, out_object_id)
FRAGMENT_SOURCE("overlay_outline_prepass_gpencil_frag.glsl")
DEPTH_WRITE(DepthWrite::ANY)
ADDITIONAL_INFO(draw_gpencil)
ADDITIONAL_INFO(draw_resource_handle)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil_clipped)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass_gpencil")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass_gpencil)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud)
.do_static_compilation(true)
.vertex_source("overlay_outline_prepass_pointcloud_vert.glsl")
.additional_info("draw_pointcloud")
.additional_info("draw_resource_handle")
.additional_info("overlay_outline_prepass")
.additional_info("draw_object_infos");
DO_STATIC_COMPILATION()
VERTEX_SOURCE("overlay_outline_prepass_pointcloud_vert.glsl")
ADDITIONAL_INFO(draw_pointcloud)
ADDITIONAL_INFO(draw_resource_handle)
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_object_infos)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped)
.do_static_compilation(true)
.additional_info("overlay_outline_prepass_pointcloud")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass_pointcloud)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
/** \} */
@ -138,19 +157,20 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_outline_detect)
.do_static_compilation(true)
.push_constant(Type::FLOAT, "alphaOcclu")
.push_constant(Type::BOOL, "isXrayWires")
.push_constant(Type::BOOL, "doAntiAliasing")
.push_constant(Type::BOOL, "doThickOutlines")
.sampler(0, ImageType::UINT_2D, "outlineId")
.sampler(1, ImageType::DEPTH_2D, "outlineDepth")
.sampler(2, ImageType::DEPTH_2D, "sceneDepth")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.fragment_source("overlay_outline_detect_frag.glsl")
.additional_info("draw_fullscreen")
.additional_info("draw_view")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
PUSH_CONSTANT(FLOAT, alphaOcclu)
PUSH_CONSTANT(BOOL, isXrayWires)
PUSH_CONSTANT(BOOL, doAntiAliasing)
PUSH_CONSTANT(BOOL, doThickOutlines)
SAMPLER(0, UINT_2D, outlineId)
SAMPLER(1, DEPTH_2D, outlineDepth)
SAMPLER(2, DEPTH_2D, sceneDepth)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
FRAGMENT_SOURCE("overlay_outline_detect_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -11,19 +11,21 @@
* \{ */
GPU_SHADER_CREATE_INFO(overlay_paint_face)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */
.push_constant(Type::VEC4, "ucolor")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_face_vert.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_modelmat");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */
PUSH_CONSTANT(VEC4, ucolor)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_paint_face_vert.glsl")
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped)
.additional_info("overlay_paint_face")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_face)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -33,23 +35,27 @@ GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped)
* Used for vertex selection mode in Weight and Vertex Paint.
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface).smooth(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface)
SMOOTH(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_point)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */
.vertex_out(overlay_overlay_paint_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_point_vert.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */
VERTEX_OUT(overlay_overlay_paint_point_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_paint_point_vert.glsl")
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped)
.additional_info("overlay_paint_point")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_point)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -59,27 +65,31 @@ GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped)
* Used in Texture Paint mode for the Stencil Image Masking.
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface).smooth(Type::VEC2, "uv_interp");
GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface)
SMOOTH(VEC2, uv_interp)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_texture)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC2, "mu") /* Masking uv map. */
.vertex_out(overlay_paint_texture_iface)
.sampler(0, ImageType::FLOAT_2D, "maskImage")
.push_constant(Type::VEC3, "maskColor")
.push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */
.push_constant(Type::BOOL, "maskInvertStencil")
.push_constant(Type::BOOL, "maskImagePremultiplied")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_texture_vert.glsl")
.fragment_source("overlay_paint_texture_frag.glsl")
.additional_info("draw_modelmat");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC2, mu) /* Masking uv map. */
VERTEX_OUT(overlay_paint_texture_iface)
SAMPLER(0, FLOAT_2D, maskImage)
PUSH_CONSTANT(VEC3, maskColor)
PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */
PUSH_CONSTANT(BOOL, maskInvertStencil)
PUSH_CONSTANT(BOOL, maskImagePremultiplied)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_paint_texture_vert.glsl")
FRAGMENT_SOURCE("overlay_paint_texture_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped)
.additional_info("overlay_paint_texture")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_texture)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -89,24 +99,28 @@ GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped)
* It should be used to draw a Vertex Paint overlay. But it is currently unreachable.
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface).smooth(Type::VEC3, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface)
SMOOTH(VEC3, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_vertcol)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "ac") /* Active color. */
.vertex_out(overlay_paint_vertcol_iface)
.push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */
.push_constant(Type::BOOL, "useAlphaBlend") /* `false` by default. */
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_vertcol_vert.glsl")
.fragment_source("overlay_paint_vertcol_frag.glsl")
.additional_info("draw_modelmat");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, ac) /* Active color. */
VERTEX_OUT(overlay_paint_vertcol_iface)
PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */
PUSH_CONSTANT(BOOL, useAlphaBlend) /* `false` by default. */
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_paint_vertcol_vert.glsl")
FRAGMENT_SOURCE("overlay_paint_vertcol_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped)
.additional_info("overlay_paint_vertcol")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_vertcol)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -118,39 +132,44 @@ GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped)
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface)
.smooth(Type::VEC2, "weight_interp") /* (weight, alert) */
.smooth(Type::FLOAT, "color_fac");
SMOOTH(VEC2, weight_interp) /* (weight, alert) */
SMOOTH(FLOAT, color_fac)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_weight)
.do_static_compilation(true)
.vertex_in(0, Type::FLOAT, "weight")
.vertex_in(1, Type::VEC3, "pos")
.vertex_in(2, Type::VEC3, "nor")
.vertex_out(overlay_paint_weight_iface)
.sampler(0, ImageType::FLOAT_1D, "colorramp")
.push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */
.push_constant(Type::BOOL, "drawContours") /* `false` by default. */
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_weight_vert.glsl")
.fragment_source("overlay_paint_weight_frag.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, FLOAT, weight)
VERTEX_IN(1, VEC3, pos)
VERTEX_IN(2, VEC3, nor)
VERTEX_OUT(overlay_paint_weight_iface)
SAMPLER(0, FLOAT_1D, colorramp)
PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */
PUSH_CONSTANT(BOOL, drawContours) /* `false` by default. */
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_paint_weight_vert.glsl")
FRAGMENT_SOURCE("overlay_paint_weight_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading)
.additional_info("overlay_paint_weight")
.define("FAKE_SHADING")
.push_constant(Type::VEC3, "light_dir")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_weight)
DEFINE("FAKE_SHADING")
PUSH_CONSTANT(VEC3, light_dir)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_weight_clipped)
.additional_info("overlay_paint_weight")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_weight)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped)
.additional_info("overlay_paint_weight_fake_shading")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_weight_fake_shading)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -161,23 +180,27 @@ GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped)
* paint modes.
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface).flat(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_wire)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "nor") /* flag stored in w */
.vertex_out(overlay_paint_wire_iface)
.push_constant(Type::BOOL, "useSelect")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_wire_vert.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, nor) /* flag stored in w */
VERTEX_OUT(overlay_paint_wire_iface)
PUSH_CONSTANT(BOOL, useSelect)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_paint_wire_vert.glsl")
FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped)
.additional_info("overlay_paint_vertcol")
.additional_info("drw_clipped")
.do_static_compilation(true);
ADDITIONAL_INFO(overlay_paint_vertcol)
ADDITIONAL_INFO(drw_clipped)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -5,45 +5,51 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_selection_iface)
.smooth(Type::FLOAT, "mask_weight");
SMOOTH(FLOAT, mask_weight)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection)
.do_static_compilation(true)
.push_constant(Type::BOOL, "is_point_domain")
.push_constant(Type::FLOAT, "selection_opacity")
.sampler(1, ImageType::FLOAT_BUFFER, "selection_tx")
.vertex_out(overlay_sculpt_curves_selection_iface)
.vertex_source("overlay_sculpt_curves_selection_vert.glsl")
.fragment_source("overlay_sculpt_curves_selection_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.additional_info("draw_hair")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
PUSH_CONSTANT(BOOL, is_point_domain)
PUSH_CONSTANT(FLOAT, selection_opacity)
SAMPLER(1, FLOAT_BUFFER, selection_tx)
VERTEX_OUT(overlay_sculpt_curves_selection_iface)
VERTEX_SOURCE("overlay_sculpt_curves_selection_vert.glsl")
FRAGMENT_SOURCE("overlay_sculpt_curves_selection_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
ADDITIONAL_INFO(draw_hair)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection_clipped)
.do_static_compilation(true)
.additional_info("overlay_sculpt_curves_selection")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_sculpt_curves_selection)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface)
.no_perspective(Type::VEC2, "edgePos")
.flat(Type::VEC2, "edgeStart")
.smooth(Type::VEC4, "finalColor");
NO_PERSPECTIVE(VEC2, edgePos)
FLAT(VEC2, edgeStart)
SMOOTH(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::FLOAT, "selection")
.vertex_out(overlay_sculpt_curves_cage_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.push_constant(Type::FLOAT, "opacity")
.vertex_source("overlay_sculpt_curves_cage_vert.glsl")
.fragment_source("overlay_extra_frag.glsl")
.additional_info("draw_modelmat")
.additional_info("draw_view")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, FLOAT, selection)
VERTEX_OUT(overlay_sculpt_curves_cage_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
PUSH_CONSTANT(FLOAT, opacity)
VERTEX_SOURCE("overlay_sculpt_curves_cage_vert.glsl")
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage_clipped)
.do_static_compilation(true)
.additional_info("overlay_sculpt_curves_cage")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_sculpt_curves_cage)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()

View File

@ -5,26 +5,29 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface)
.flat(Type::VEC3, "faceset_color")
.smooth(Type::FLOAT, "mask_color")
.smooth(Type::VEC4, "finalColor");
FLAT(VEC3, faceset_color)
SMOOTH(FLOAT, mask_color)
SMOOTH(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_sculpt_mask)
.do_static_compilation(true)
.push_constant(Type::FLOAT, "maskOpacity")
.push_constant(Type::FLOAT, "faceSetsOpacity")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "fset")
.vertex_in(2, Type::FLOAT, "msk")
.vertex_out(overlay_sculpt_mask_iface)
.vertex_source("overlay_sculpt_mask_vert.glsl")
.fragment_source("overlay_sculpt_mask_frag.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.additional_info("draw_mesh")
.additional_info("draw_object_infos")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
PUSH_CONSTANT(FLOAT, maskOpacity)
PUSH_CONSTANT(FLOAT, faceSetsOpacity)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, fset)
VERTEX_IN(2, FLOAT, msk)
VERTEX_OUT(overlay_sculpt_mask_iface)
VERTEX_SOURCE("overlay_sculpt_mask_vert.glsl")
FRAGMENT_SOURCE("overlay_sculpt_mask_frag.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_object_infos)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_sculpt_mask_clipped)
.do_static_compilation(true)
.additional_info("overlay_sculpt_mask")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_sculpt_mask)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()

View File

@ -4,74 +4,86 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface).smooth(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface)
SMOOTH(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common).push_constant(Type::FLOAT, "opacity");
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common)
PUSH_CONSTANT(FLOAT, opacity)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh)
.do_static_compilation(true)
.vertex_source("overlay_viewer_attribute_mesh_vert.glsl")
.fragment_source("overlay_viewer_attribute_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "attribute_value")
.vertex_out(overlay_viewer_attribute_iface)
.additional_info("overlay_viewer_attribute_common")
.additional_info("draw_mesh");
DO_STATIC_COMPILATION()
VERTEX_SOURCE("overlay_viewer_attribute_mesh_vert.glsl")
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, attribute_value)
VERTEX_OUT(overlay_viewer_attribute_iface)
ADDITIONAL_INFO(overlay_viewer_attribute_common)
ADDITIONAL_INFO(draw_mesh)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh_clipped)
.do_static_compilation(true)
.additional_info("overlay_viewer_attribute_mesh")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_viewer_attribute_mesh)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud)
.do_static_compilation(true)
.vertex_source("overlay_viewer_attribute_pointcloud_vert.glsl")
.fragment_source("overlay_viewer_attribute_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.fragment_out(1, Type::VEC4, "lineOutput")
.sampler(3, ImageType::FLOAT_BUFFER, "attribute_tx")
.vertex_out(overlay_viewer_attribute_iface)
.additional_info("overlay_viewer_attribute_common")
.additional_info("draw_pointcloud");
DO_STATIC_COMPILATION()
VERTEX_SOURCE("overlay_viewer_attribute_pointcloud_vert.glsl")
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_OUT(1, VEC4, lineOutput)
SAMPLER(3, FLOAT_BUFFER, attribute_tx)
VERTEX_OUT(overlay_viewer_attribute_iface)
ADDITIONAL_INFO(overlay_viewer_attribute_common)
ADDITIONAL_INFO(draw_pointcloud)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud_clipped)
.do_static_compilation(true)
.additional_info("overlay_viewer_attribute_pointcloud")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_viewer_attribute_pointcloud)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve)
.do_static_compilation(true)
.vertex_source("overlay_viewer_attribute_curve_vert.glsl")
.fragment_source("overlay_viewer_attribute_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "attribute_value")
.vertex_out(overlay_viewer_attribute_iface)
.additional_info("overlay_viewer_attribute_common")
.additional_info("draw_modelmat")
.additional_info("draw_resource_id");
DO_STATIC_COMPILATION()
VERTEX_SOURCE("overlay_viewer_attribute_curve_vert.glsl")
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_OUT(1, VEC4, lineOutput)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC4, attribute_value)
VERTEX_OUT(overlay_viewer_attribute_iface)
ADDITIONAL_INFO(overlay_viewer_attribute_common)
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(draw_resource_id)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve_clipped)
.do_static_compilation(true)
.additional_info("overlay_viewer_attribute_curve")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_viewer_attribute_curve)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves)
.do_static_compilation(true)
.vertex_source("overlay_viewer_attribute_curves_vert.glsl")
.fragment_source("overlay_viewer_attribute_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.fragment_out(1, Type::VEC4, "lineOutput")
.sampler(0, ImageType::FLOAT_BUFFER, "color_tx")
.push_constant(Type::BOOL, "is_point_domain")
.vertex_out(overlay_viewer_attribute_iface)
.additional_info("overlay_viewer_attribute_common")
.additional_info("draw_hair");
DO_STATIC_COMPILATION()
VERTEX_SOURCE("overlay_viewer_attribute_curves_vert.glsl")
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_OUT(1, VEC4, lineOutput)
SAMPLER(0, FLOAT_BUFFER, color_tx)
PUSH_CONSTANT(BOOL, is_point_domain)
VERTEX_OUT(overlay_viewer_attribute_iface)
ADDITIONAL_INFO(overlay_viewer_attribute_common)
ADDITIONAL_INFO(draw_hair)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves_clipped)
.do_static_compilation(true)
.additional_info("overlay_viewer_attribute_curves")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_viewer_attribute_curves)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()

View File

@ -8,48 +8,54 @@
/** \name Volume Velocity
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface).smooth(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface)
SMOOTH(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_velocity)
.sampler(0, ImageType::FLOAT_3D, "velocityX")
.sampler(1, ImageType::FLOAT_3D, "velocityY")
.sampler(2, ImageType::FLOAT_3D, "velocityZ")
.push_constant(Type::FLOAT, "displaySize")
.push_constant(Type::FLOAT, "slicePosition")
.push_constant(Type::INT, "sliceAxis")
.push_constant(Type::BOOL, "scaleWithMagnitude")
.push_constant(Type::BOOL, "isCellCentered")
SAMPLER(0, FLOAT_3D, velocityX)
SAMPLER(1, FLOAT_3D, velocityY)
SAMPLER(2, FLOAT_3D, velocityZ)
PUSH_CONSTANT(FLOAT, displaySize)
PUSH_CONSTANT(FLOAT, slicePosition)
PUSH_CONSTANT(INT, sliceAxis)
PUSH_CONSTANT(BOOL, scaleWithMagnitude)
PUSH_CONSTANT(BOOL, isCellCentered)
/* FluidDomainSettings.cell_size */
.push_constant(Type::VEC3, "cellSize")
PUSH_CONSTANT(VEC3, cellSize)
/* FluidDomainSettings.p0 */
.push_constant(Type::VEC3, "domainOriginOffset")
PUSH_CONSTANT(VEC3, domainOriginOffset)
/* FluidDomainSettings.res_min */
.push_constant(Type::IVEC3, "adaptiveCellOffset")
.push_constant(Type::INT, "in_select_id")
.vertex_out(overlay_volume_velocity_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_volume_velocity_vert.glsl")
.fragment_source("overlay_varying_color.glsl");
PUSH_CONSTANT(IVEC3, adaptiveCellOffset)
PUSH_CONSTANT(INT, in_select_id)
VERTEX_OUT(overlay_volume_velocity_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_volume_velocity_vert.glsl")
FRAGMENT_SOURCE("overlay_varying_color.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_velocity_streamline)
.do_static_compilation(true)
.additional_info("draw_volume")
.additional_info("overlay_volume_velocity");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(draw_volume)
ADDITIONAL_INFO(overlay_volume_velocity)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac)
.do_static_compilation(true)
.define("USE_MAC")
.push_constant(Type::BOOL, "drawMACX")
.push_constant(Type::BOOL, "drawMACY")
.push_constant(Type::BOOL, "drawMACZ")
.additional_info("draw_volume")
.additional_info("overlay_volume_velocity");
DO_STATIC_COMPILATION()
DEFINE("USE_MAC")
PUSH_CONSTANT(BOOL, drawMACX)
PUSH_CONSTANT(BOOL, drawMACY)
PUSH_CONSTANT(BOOL, drawMACZ)
ADDITIONAL_INFO(draw_volume)
ADDITIONAL_INFO(overlay_volume_velocity)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle)
.do_static_compilation(true)
.define("USE_NEEDLE")
.additional_info("draw_volume")
.additional_info("overlay_volume_velocity");
DO_STATIC_COMPILATION()
DEFINE("USE_NEEDLE")
ADDITIONAL_INFO(draw_volume)
ADDITIONAL_INFO(overlay_volume_velocity)
GPU_SHADER_CREATE_END()
/** \} */
@ -57,47 +63,53 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle)
/** \name Volume Grid-Lines
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface).flat(Type::VEC4, "finalColor");
GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines)
.push_constant(Type::FLOAT, "slicePosition")
.push_constant(Type::INT, "sliceAxis")
PUSH_CONSTANT(FLOAT, slicePosition)
PUSH_CONSTANT(INT, sliceAxis)
/* FluidDomainSettings.res */
.push_constant(Type::IVEC3, "volumeSize")
PUSH_CONSTANT(IVEC3, volumeSize)
/* FluidDomainSettings.cell_size */
.push_constant(Type::VEC3, "cellSize")
PUSH_CONSTANT(VEC3, cellSize)
/* FluidDomainSettings.p0 */
.push_constant(Type::VEC3, "domainOriginOffset")
PUSH_CONSTANT(VEC3, domainOriginOffset)
/* FluidDomainSettings.res_min */
.push_constant(Type::IVEC3, "adaptiveCellOffset")
.push_constant(Type::INT, "in_select_id")
.vertex_out(overlay_volume_gridlines_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_volume_gridlines_vert.glsl")
.fragment_source("overlay_varying_color.glsl");
PUSH_CONSTANT(IVEC3, adaptiveCellOffset)
PUSH_CONSTANT(INT, in_select_id)
VERTEX_OUT(overlay_volume_gridlines_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_volume_gridlines_vert.glsl")
FRAGMENT_SOURCE("overlay_varying_color.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flat)
.do_static_compilation(true)
.additional_info("draw_volume")
.additional_info("overlay_volume_gridlines");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(draw_volume)
ADDITIONAL_INFO(overlay_volume_gridlines)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags)
.do_static_compilation(true)
.define("SHOW_FLAGS")
.sampler(0, ImageType::UINT_3D, "flagTexture")
.additional_info("draw_volume")
.additional_info("overlay_volume_gridlines");
DO_STATIC_COMPILATION()
DEFINE("SHOW_FLAGS")
SAMPLER(0, UINT_3D, flagTexture)
ADDITIONAL_INFO(draw_volume)
ADDITIONAL_INFO(overlay_volume_gridlines)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range)
.do_static_compilation(true)
.define("SHOW_RANGE")
.push_constant(Type::FLOAT, "lowerBound")
.push_constant(Type::FLOAT, "upperBound")
.push_constant(Type::VEC4, "rangeColor")
.push_constant(Type::INT, "cellFilter")
.sampler(0, ImageType::UINT_3D, "flagTexture")
.sampler(1, ImageType::FLOAT_3D, "fieldTexture")
.additional_info("draw_volume")
.additional_info("overlay_volume_gridlines");
DO_STATIC_COMPILATION()
DEFINE("SHOW_RANGE")
PUSH_CONSTANT(FLOAT, lowerBound)
PUSH_CONSTANT(FLOAT, upperBound)
PUSH_CONSTANT(VEC4, rangeColor)
PUSH_CONSTANT(INT, cellFilter)
SAMPLER(0, UINT_3D, flagTexture)
SAMPLER(1, FLOAT_3D, fieldTexture)
ADDITIONAL_INFO(draw_volume)
ADDITIONAL_INFO(overlay_volume_gridlines)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -5,117 +5,128 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface)
.smooth(Type::VEC4, "finalColor")
.flat(Type::VEC2, "edgeStart")
.no_perspective(Type::VEC2, "edgePos");
SMOOTH(VEC4, finalColor)
FLAT(VEC2, edgeStart)
NO_PERSPECTIVE(VEC2, edgePos)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe)
.do_static_compilation(true)
.push_constant(Type::FLOAT, "wireStepParam")
.push_constant(Type::FLOAT, "wireOpacity")
.push_constant(Type::BOOL, "useColoring")
.push_constant(Type::BOOL, "isTransform")
.push_constant(Type::INT, "colorType")
.push_constant(Type::BOOL, "isHair")
.push_constant(Type::MAT4, "hairDupliMatrix")
DO_STATIC_COMPILATION()
PUSH_CONSTANT(FLOAT, wireStepParam)
PUSH_CONSTANT(FLOAT, wireOpacity)
PUSH_CONSTANT(BOOL, useColoring)
PUSH_CONSTANT(BOOL, isTransform)
PUSH_CONSTANT(INT, colorType)
PUSH_CONSTANT(BOOL, isHair)
PUSH_CONSTANT(MAT4, hairDupliMatrix)
/* Scene Depth texture copy for manual depth test. */
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
.vertex_in(2, Type::FLOAT, "wd") /* wire-data. */
.vertex_out(overlay_wireframe_iface)
.vertex_source("overlay_wireframe_vert.glsl")
.fragment_source("overlay_wireframe_frag.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.depth_write(DepthWrite::ANY)
.additional_info("draw_mesh")
.additional_info("draw_object_infos")
.additional_info("draw_globals");
SAMPLER(0, DEPTH_2D, depthTex)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, nor)
VERTEX_IN(2, FLOAT, wd) /* wire-data. */
VERTEX_OUT(overlay_wireframe_iface)
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
DEPTH_WRITE(DepthWrite::ANY)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_object_infos)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_curve)
.do_static_compilation(true)
.define("CURVES")
.push_constant(Type::FLOAT, "wireOpacity")
.push_constant(Type::BOOL, "useColoring")
.push_constant(Type::BOOL, "isTransform")
.push_constant(Type::INT, "colorType")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(overlay_wireframe_iface)
.vertex_source("overlay_wireframe_vert.glsl")
.fragment_source("overlay_wireframe_frag.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.additional_info("draw_view")
.additional_info("draw_modelmat_new")
.additional_info("draw_resource_handle_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
DEFINE("CURVES")
PUSH_CONSTANT(FLOAT, wireOpacity)
PUSH_CONSTANT(BOOL, useColoring)
PUSH_CONSTANT(BOOL, isTransform)
PUSH_CONSTANT(INT, colorType)
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(overlay_wireframe_iface)
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface)
.flat(Type::VEC4, "finalColor")
.flat(Type::VEC4, "finalColorInner");
FLAT(VEC4, finalColor)
FLAT(VEC4, finalColorInner)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_points)
.do_static_compilation(true)
.define("POINTS")
.push_constant(Type::BOOL, "useColoring")
.push_constant(Type::BOOL, "isTransform")
.push_constant(Type::INT, "colorType")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(overlay_wireframe_points_iface)
.vertex_source("overlay_wireframe_vert.glsl")
.fragment_source("overlay_wireframe_frag.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.additional_info("draw_view")
.additional_info("draw_modelmat_new")
.additional_info("draw_resource_handle_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_globals");
DO_STATIC_COMPILATION()
DEFINE("POINTS")
PUSH_CONSTANT(BOOL, useColoring)
PUSH_CONSTANT(BOOL, isTransform)
PUSH_CONSTANT(INT, colorType)
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(overlay_wireframe_points_iface)
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_clipped)
.do_static_compilation(true)
.additional_info("overlay_wireframe")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_wireframe)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth)
.do_static_compilation(true)
.define("CUSTOM_DEPTH_BIAS")
.additional_info("overlay_wireframe");
DO_STATIC_COMPILATION()
DEFINE("CUSTOM_DEPTH_BIAS")
ADDITIONAL_INFO(overlay_wireframe)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth_clipped)
.do_static_compilation(true)
.additional_info("overlay_wireframe_custom_depth")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_wireframe_custom_depth)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_select)
.do_static_compilation(true)
.define("SELECT_EDGES")
.additional_info("overlay_wireframe");
DO_STATIC_COMPILATION()
DEFINE("SELECT_EDGES")
ADDITIONAL_INFO(overlay_wireframe)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_select_clipped)
.do_static_compilation(true)
.additional_info("overlay_wireframe_select")
.additional_info("drw_clipped");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_wireframe_select)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_wireframe_uv)
.do_static_compilation(true)
.define("WIREFRAME")
.storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY)
.push_constant(Type::IVEC2, "gpu_attr_0")
.define("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */)
.define("dashLength", "1" /* Not used by this line style */)
.define("use_edge_select", "false")
.push_constant(Type::BOOL, "doSmoothWire")
.push_constant(Type::FLOAT, "alpha")
.vertex_out(overlay_edit_uv_next_iface)
.fragment_out(0, Type::VEC4, "fragColor")
DO_STATIC_COMPILATION()
DEFINE("WIREFRAME")
STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY)
PUSH_CONSTANT(IVEC2, gpu_attr_0)
DEFINE_VALUE("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */)
DEFINE_VALUE("dashLength", "1" /* Not used by this line style */)
DEFINE_VALUE("use_edge_select", "false")
PUSH_CONSTANT(BOOL, doSmoothWire)
PUSH_CONSTANT(FLOAT, alpha)
VERTEX_OUT(overlay_edit_uv_next_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
/* Note: Reuse edit mode shader as it is mostly the same. */
.vertex_source("overlay_edit_uv_edges_next_vert.glsl")
.fragment_source("overlay_edit_uv_edges_next_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_modelmat_new")
.additional_info("draw_resource_handle_new")
.additional_info("gpu_index_load")
.additional_info("draw_globals");
VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl")
FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_resource_handle_new)
ADDITIONAL_INFO(gpu_index_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()