Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"class_name": "LayoutQuadCanvas",
"menu_info": {
"category": "Compositing|Layout",
"display_name": "Layout Quad Canvas"
"display_name": "Layout Quad Canvas (Deprecated)"
},
"node": {
"id": "9ad95de1-d52a-409a-809d-da7d98b13f30",
"name": "LayoutQuadCanvas",
"class_name": "LayoutQuadCanvas",
"description": "Deprecated: use Quad Merge instead, which does the same 2x2 composition as a single node with a Resolution pin.\nThis node is kept so existing graphs keep working.",
"pins": [
{
"id": "acdf750c-9637-4807-9d29-578f11bcc010",
Expand Down Expand Up @@ -1628,7 +1629,7 @@
},
{
"id": "c886b125-d628-4ade-91eb-390ffff53476",
"name": "Array (1)",
"name": "OutputInfos",
"class_name": "nos.reflect.Array",
"pins": [
{
Expand Down Expand Up @@ -2053,7 +2054,7 @@
"value": "/LayoutDrawer"
}
],
"display_name": "Layout Quad Canvas",
"display_name": "Layout Quad Canvas (Deprecated)",
"plugin_version": {
"major": 3,
"minor": 10,
Expand Down
33 changes: 31 additions & 2 deletions Plugins/nosCompositing/Nodes/QuadMerge.nosnode
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"concatenate",
"add",
"quarter",
"texture"
"texture",
"quad",
"canvas",
"layout"
]
},
"node": {
Expand Down Expand Up @@ -52,11 +55,37 @@
"can_show_as": "INPUT_PIN_OR_PROPERTY",
"description": "Quadrant 3: bottom/right"
},
{
"name": "Resolution",
"type_name": "nos.fb.vec2u",
"show_as": "PROPERTY",
"can_show_as": "INPUT_PIN_OR_PROPERTY",
"data": {
"x": 1920,
"y": 1080
},
"description": "Resolution of the merged output texture",
"visualizers": [
{
"type": "NAMED_VALUE",
"name": "nos.mediaio.ResolutionVisualizer"
}
]
},
{
"name": "Output",
"type_name": "nos.sys.vulkan.Texture",
"show_as": "OUTPUT_PIN",
"can_show_as": "OUTPUT_PIN_OR_PROPERTY"
"can_show_as": "OUTPUT_PIN_OR_PROPERTY",
"extensions": [
{
"name": "texture_options",
"type_name": "nos.sys.vulkan.TexturePinOptions",
"data": {
"unscaled": true
}
}
]
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions Plugins/nosCompositing/Source/CompositingMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace nos::compositing
void RegisterBoxFit(nosNodeFunctions*);
nosResult RegisterChannelViewer(nosNodeFunctions*);
nosResult RegisterMerge(nosNodeFunctions*);
void RegisterQuadMerge(nosNodeFunctions*);
nosResult RegisterLayoutDrawer(nosNodeFunctions*);
void RegisterFreeLayout(nosNodeFunctions*);
void RegisterGridLayout(nosNodeFunctions*);
Expand All @@ -31,6 +32,7 @@ enum class Nodes : size_t
BoxFit,
ChannelViewer,
Merge,
QuadMerge,
LayoutDrawer,
FreeLayout,
GridLayout,
Expand Down Expand Up @@ -75,6 +77,7 @@ nosResult NOSAPI_CALL ExportNodeFunctions(size_t* outCount, nosNodeFunctions** o
GEN_CASE_NODE(BoxFit)
GEN_CASE_NODE_RESULT(ChannelViewer)
GEN_CASE_NODE_RESULT(Merge)
GEN_CASE_NODE(QuadMerge)
GEN_CASE_NODE_RESULT(LayoutDrawer)
GEN_CASE_NODE(FreeLayout)
GEN_CASE_NODE(GridLayout)
Expand Down
40 changes: 40 additions & 0 deletions Plugins/nosCompositing/Source/QuadMerge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright MediaZ Teknoloji A.S. All Rights Reserved.

#include <Nodos/Plugin.hpp>

#include <nosSysVulkan/Helpers.hpp>

namespace nos::compositing
{
// The quadrant compositing itself is done declaratively by Shaders/QuadMerge.frag. This node exists only to size the
// output texture from the Resolution pin, since the output is marked unscaled.
struct QuadMergeNode : NodeContext
{
nosResult ExecuteNode(NodeExecuteParams const& params) override
{
auto outputTex = params.GetPinObject<sys::vulkan::Texture>(NOS_NAME("Output"));
auto outputTexInfo = sys::vulkan::GetResourceInfo(outputTex);
const nos::fb::vec2u& resolution = *params.GetPinValue<fb::vec2u>(NOS_NAME("Resolution"));

if (!outputTexInfo || resolution.x() != outputTexInfo->Width || resolution.y() != outputTexInfo->Height)
{
SetPinObject(NOS_NAME("Output"),
sys::vulkan::CreateTexture(
{
.Width = resolution.x(),
.Height = resolution.y(),
.Usage = nosImageUsage(NOS_IMAGE_USAGE_TRANSFER_DST | NOS_IMAGE_USAGE_TRANSFER_SRC |
NOS_IMAGE_USAGE_SAMPLED),
},
"QuadMergeResult"));
}

return nosVulkan->ExecuteGPUNode(this, params.RawParams);
}
};

void RegisterQuadMerge(nosNodeFunctions* funcs)
{
NOS_BIND_NODE_CLASS(NOS_NAME("QuadMerge"), QuadMergeNode, funcs);
}
} // namespace nos::compositing