Changeset View
Standalone View
source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh
| Show All 16 Lines | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common) | ||||
| .fragment_out(0, Type::VEC4, "fragColor") | .fragment_out(0, Type::VEC4, "fragColor") | ||||
| .push_constant(Type::BOOL, "selectFaces") | .push_constant(Type::BOOL, "selectFaces") | ||||
| .push_constant(Type::BOOL, "selectEdges") | .push_constant(Type::BOOL, "selectEdges") | ||||
| .push_constant(Type::FLOAT, "alpha") | .push_constant(Type::FLOAT, "alpha") | ||||
| .push_constant(Type::IVEC4, "dataMask") | .push_constant(Type::IVEC4, "dataMask") | ||||
| .vertex_source("overlay_edit_mesh_vert.glsl") | .vertex_source("overlay_edit_mesh_vert.glsl") | ||||
| .additional_info("draw_modelmat", "draw_globals"); | .additional_info("draw_modelmat", "draw_globals"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom) | ||||
| .metal_backend_only(true) | |||||
| .define("blender_srgb_to_framebuffer_space(a)", "a") | .define("blender_srgb_to_framebuffer_space(a)", "a") | ||||
| .sampler(0, ImageType::DEPTH_2D, "depthTex") | .sampler(0, ImageType::DEPTH_2D, "depthTex") | ||||
| .fragment_out(0, Type::VEC4, "fragColor") | .fragment_out(0, Type::VEC4, "fragColor") | ||||
| .push_constant(Type::BOOL, "selectFaces") | .push_constant(Type::BOOL, "selectFaces") | ||||
| .push_constant(Type::BOOL, "selectEdges") | .push_constant(Type::BOOL, "selectEdges") | ||||
| .push_constant(Type::FLOAT, "alpha") | .push_constant(Type::FLOAT, "alpha") | ||||
| .push_constant(Type::IVEC4, "dataMask") | .push_constant(Type::IVEC4, "dataMask") | ||||
| .vertex_source("overlay_edit_mesh_vert_no_geom.glsl") | .vertex_source("overlay_edit_mesh_vert_no_geom.glsl") | ||||
| .additional_info("draw_modelmat", "draw_globals"); | .additional_info("draw_modelmat", "draw_globals"); | ||||
| #endif | |||||
| GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface, "") | GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface, "") | ||||
| .smooth(Type::VEC4, "finalColor") | .smooth(Type::VEC4, "finalColor") | ||||
| .smooth(Type::FLOAT, "vertexCrease"); | .smooth(Type::FLOAT, "vertexCrease"); | ||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .builtins(BuiltinBits::POINT_SIZE) | .builtins(BuiltinBits::POINT_SIZE) | ||||
| Show All 25 Lines | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge) | ||||
| .vertex_out(overlay_edit_mesh_edge_iface) | .vertex_out(overlay_edit_mesh_edge_iface) | ||||
| .geometry_out(overlay_edit_mesh_edge_geom_iface) | .geometry_out(overlay_edit_mesh_edge_geom_iface) | ||||
| .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) | .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) | ||||
| .geometry_source("overlay_edit_mesh_geom.glsl") | .geometry_source("overlay_edit_mesh_geom.glsl") | ||||
| .fragment_source("overlay_edit_mesh_frag.glsl") | .fragment_source("overlay_edit_mesh_frag.glsl") | ||||
| .additional_info("overlay_edit_mesh_common"); | .additional_info("overlay_edit_mesh_common"); | ||||
| /* The Non-Geometry shader variant passes directly to fragment. */ | /* The Non-Geometry shader variant passes directly to fragment. */ | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom) | ||||
| // .do_static_compilation(true) /* TODO fix on GL */ | .metal_backend_only(true) | ||||
| .do_static_compilation(true) | |||||
| .define("EDGE") | .define("EDGE") | ||||
| .vertex_in(0, Type::VEC3, "pos") | .vertex_in(0, Type::VEC3, "pos") | ||||
| .vertex_in(1, Type::UCHAR4, "data") | .vertex_in(1, Type::UCHAR4, "data") | ||||
| .vertex_in(2, Type::VEC3_101010I2, "vnor") | .vertex_in(2, Type::VEC3_101010I2, "vnor") | ||||
| .push_constant(Type::BOOL, "do_smooth_wire") | .push_constant(Type::BOOL, "do_smooth_wire") | ||||
| .vertex_out(overlay_edit_mesh_edge_geom_iface) | .vertex_out(overlay_edit_mesh_edge_geom_iface) | ||||
| .fragment_source("overlay_edit_mesh_frag.glsl") | .fragment_source("overlay_edit_mesh_frag.glsl") | ||||
| .additional_info("overlay_edit_mesh_common_no_geom"); | .additional_info("overlay_edit_mesh_common_no_geom"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .define("FLAT") | .define("FLAT") | ||||
| .additional_info("overlay_edit_mesh_edge"); | .additional_info("overlay_edit_mesh_edge"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_no_geom) | ||||
| // .do_static_compilation(true) /* TODO fix on GL */ | .metal_backend_only(true) | ||||
| .do_static_compilation(true) | |||||
| .define("FLAT") | .define("FLAT") | ||||
| .additional_info("overlay_edit_mesh_edge_no_geom"); | .additional_info("overlay_edit_mesh_edge_no_geom"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .define("FACE") | .define("FACE") | ||||
| .vertex_in(0, Type::VEC3, "pos") | .vertex_in(0, Type::VEC3, "pos") | ||||
| .vertex_in(1, Type::UVEC4, "data") | .vertex_in(1, Type::UVEC4, "data") | ||||
| .vertex_in(2, Type::VEC3, "vnor") | .vertex_in(2, Type::VEC3, "vnor") | ||||
| .vertex_out(overlay_edit_flat_color_iface) | .vertex_out(overlay_edit_flat_color_iface) | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .additional_info("overlay_edit_mesh_vert", "drw_clipped"); | .additional_info("overlay_edit_mesh_vert", "drw_clipped"); | ||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .additional_info("overlay_edit_mesh_edge", "drw_clipped"); | .additional_info("overlay_edit_mesh_edge", "drw_clipped"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom) | ||||
| // .do_static_compilation(true) /* TODO fix on GL */ | .metal_backend_only(true) | ||||
| .do_static_compilation(true) | |||||
| .additional_info("overlay_edit_mesh_edge_no_geom", "drw_clipped"); | .additional_info("overlay_edit_mesh_edge_no_geom", "drw_clipped"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .additional_info("overlay_edit_mesh_edge_flat", "drw_clipped"); | .additional_info("overlay_edit_mesh_edge_flat", "drw_clipped"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom) | ||||
| // .do_static_compilation(true) /* TODO fix on GL */ | .metal_backend_only(true) | ||||
| .do_static_compilation(true) | |||||
| .additional_info("overlay_edit_mesh_edge_flat_no_geom", "drw_clipped"); | .additional_info("overlay_edit_mesh_edge_flat_no_geom", "drw_clipped"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .additional_info("overlay_edit_mesh_face", "drw_clipped"); | .additional_info("overlay_edit_mesh_face", "drw_clipped"); | ||||
| GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_clipped) | GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_clipped) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .additional_info("overlay_edit_mesh_facedot", "drw_clipped"); | .additional_info("overlay_edit_mesh_facedot", "drw_clipped"); | ||||
| Show All 24 Lines | |||||
| GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_geom_iface, "geom_out") | GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_geom_iface, "geom_out") | ||||
| .smooth(Type::FLOAT, "selectionFac") | .smooth(Type::FLOAT, "selectionFac") | ||||
| .no_perspective(Type::FLOAT, "edgeCoord") | .no_perspective(Type::FLOAT, "edgeCoord") | ||||
| .no_perspective(Type::VEC2, "stipplePos") | .no_perspective(Type::VEC2, "stipplePos") | ||||
| .flat(Type::VEC2, "stippleStart"); | .flat(Type::VEC2, "stippleStart"); | ||||
| GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_common) | GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_common) | ||||
| .vertex_in(0, Type::VEC2, "au") | .vertex_in(0, Type::VEC2, "au") | ||||
| .vertex_in(1, Type::UINT, "flag") | .vertex_in(1, Type::INT, "flag") | ||||
| .push_constant(Type::INT, "lineStyle") | .push_constant(Type::INT, "lineStyle") | ||||
| .push_constant(Type::BOOL, "doSmoothWire") | .push_constant(Type::BOOL, "doSmoothWire") | ||||
| .push_constant(Type::FLOAT, "alpha") | .push_constant(Type::FLOAT, "alpha") | ||||
| .push_constant(Type::FLOAT, "dashLength") | .push_constant(Type::FLOAT, "dashLength") | ||||
| .fragment_out(0, Type::VEC4, "fragColor") | .fragment_out(0, Type::VEC4, "fragColor") | ||||
| .fragment_source("overlay_edit_uv_edges_frag.glsl") | .fragment_source("overlay_edit_uv_edges_frag.glsl") | ||||
| .additional_info("draw_mesh", "draw_globals"); | .additional_info("draw_mesh", "draw_globals"); | ||||
| GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges) | GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges) | ||||
| .additional_info("overlay_edit_uv_edges_common") | .additional_info("overlay_edit_uv_edges_common") | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .vertex_out(overlay_edit_uv_iface) | .vertex_out(overlay_edit_uv_iface) | ||||
| .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) | .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) | ||||
| .geometry_out(overlay_edit_uv_geom_iface) | .geometry_out(overlay_edit_uv_geom_iface) | ||||
| .vertex_source("overlay_edit_uv_edges_vert.glsl") | .vertex_source("overlay_edit_uv_edges_vert.glsl") | ||||
| .geometry_source("overlay_edit_uv_edges_geom.glsl"); | .geometry_source("overlay_edit_uv_edges_geom.glsl"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_no_geom) | ||||
| .metal_backend_only(true) | |||||
fclem: Maybe only define this if `WITH_METAL_BACKEND` is defined. Otherwise just comment it out, as it… | |||||
Not Done Inline ActionsAh yes, this was a problem with the other similar cases as well. Will go through and apply the macro guard. Though wondering if there should be anything safer for the cases where Metal + GL will be simultaneously available? I can add a non-functional pass-through implementation in the GLSL header to prevent compilation failure, though conscious of bloat. Presuming API-availability at the create-info level would be a little clunky? Another option could be to simply guard the shader source with GPU_METAL, such that the GLSL shader can still be compiled. MichaelPW: Ah yes, this was a problem with the other similar cases as well. Will go through and apply the… | |||||
Not Done Inline ActionsI think you can add bool metal_backen_only_ = false; to the ShaderCreateInfo for now, and set it to true for these special shaders . Eventually, we want to have no special entire shaders for that. fclem: I think you can add `bool metal_backen_only_ = false;` to the `ShaderCreateInfo` for now, and… | |||||
| .additional_info("overlay_edit_uv_edges_common") | .additional_info("overlay_edit_uv_edges_common") | ||||
| // .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .vertex_out(overlay_edit_uv_geom_iface) | .vertex_out(overlay_edit_uv_geom_iface) | ||||
| .vertex_source("overlay_edit_uv_edges_vert_no_geom.glsl"); | .vertex_source("overlay_edit_uv_edges_vert_no_geom.glsl"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select) | GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .define("USE_EDGE_SELECT") | .define("USE_EDGE_SELECT") | ||||
| .additional_info("overlay_edit_uv_edges"); | .additional_info("overlay_edit_uv_edges"); | ||||
| GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) | GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle) | ||||
| .push_constant(Type::BOOL, "showCurveHandles") | .push_constant(Type::BOOL, "showCurveHandles") | ||||
| .push_constant(Type::INT, "curveHandleDisplay") | .push_constant(Type::INT, "curveHandleDisplay") | ||||
| .fragment_out(0, Type::VEC4, "fragColor") | .fragment_out(0, Type::VEC4, "fragColor") | ||||
| .vertex_source("overlay_edit_curve_handle_vert.glsl") | .vertex_source("overlay_edit_curve_handle_vert.glsl") | ||||
| .geometry_source("overlay_edit_curve_handle_geom.glsl") | .geometry_source("overlay_edit_curve_handle_geom.glsl") | ||||
| .fragment_source("overlay_varying_color.glsl") | .fragment_source("overlay_varying_color.glsl") | ||||
| .additional_info("draw_mesh", "draw_globals"); | .additional_info("draw_mesh", "draw_globals"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) | ||||
| // .do_static_compilation(true) /* TODO fix on GL */ | .metal_backend_only(true) | ||||
| .do_static_compilation(true) | |||||
| .typedef_source("overlay_shader_shared.h") | .typedef_source("overlay_shader_shared.h") | ||||
| /* NOTE: Color already in Linear space. Which is what we want. */ | /* NOTE: Color already in Linear space. Which is what we want. */ | ||||
| .define("srgbTarget", "false") | .define("srgbTarget", "false") | ||||
| .vertex_in(0, Type::VEC3, "pos") | .vertex_in(0, Type::VEC3, "pos") | ||||
| .vertex_in(1, Type::UINT, "data") | .vertex_in(1, Type::UINT, "data") | ||||
| .vertex_out(overlay_edit_curve_handle_iface) | .vertex_out(overlay_edit_curve_handle_iface) | ||||
| .push_constant(Type::BOOL, "showCurveHandles") | .push_constant(Type::BOOL, "showCurveHandles") | ||||
| .push_constant(Type::INT, "curveHandleDisplay") | .push_constant(Type::INT, "curveHandleDisplay") | ||||
| .fragment_out(0, Type::VEC4, "fragColor") | .fragment_out(0, Type::VEC4, "fragColor") | ||||
| .vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl") | .vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl") | ||||
| .fragment_source("overlay_varying_color.glsl") | .fragment_source("overlay_varying_color.glsl") | ||||
| .additional_info("draw_mesh", "draw_globals"); | .additional_info("draw_mesh", "draw_globals"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped) | GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .additional_info("overlay_edit_curve_handle", "drw_clipped"); | .additional_info("overlay_edit_curve_handle", "drw_clipped"); | ||||
| #ifdef WITH_METAL_BACKEND | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom) | GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom) | ||||
| // .do_static_compilation(true) /* TODO fix on GL */ | .metal_backend_only(true) | ||||
| .do_static_compilation(true) | |||||
| .additional_info("overlay_edit_curve_handle_no_geom", "drw_clipped"); | .additional_info("overlay_edit_curve_handle_no_geom", "drw_clipped"); | ||||
| #endif | |||||
| GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) | GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) | ||||
| .do_static_compilation(true) | .do_static_compilation(true) | ||||
| .typedef_source("overlay_shader_shared.h") | .typedef_source("overlay_shader_shared.h") | ||||
| .vertex_in(0, Type::VEC3, "pos") | .vertex_in(0, Type::VEC3, "pos") | ||||
| .vertex_in(1, Type::UINT, "data") | .vertex_in(1, Type::UINT, "data") | ||||
| .vertex_out(overlay_edit_flat_color_iface) | .vertex_out(overlay_edit_flat_color_iface) | ||||
| .push_constant(Type::BOOL, "showCurveHandles") | .push_constant(Type::BOOL, "showCurveHandles") | ||||
| ▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines | |||||
Maybe only define this if WITH_METAL_BACKEND is defined. Otherwise just comment it out, as it will prevent using compile-time shader compilation with OpenGL backend.