From efae5259290507ce108ce31c21eeb5fcde4a76a4 Mon Sep 17 00:00:00 2001 From: atkurtul Date: Mon, 24 Aug 2026 12:39:37 +0300 Subject: [PATCH 1/3] Add Resolution pin to QuadMerge Output is now unscaled and sized from the pin, following BoxFit. --- .../nosCompositing/Nodes/QuadMerge.nosnode | 33 ++++++++++++++- .../nosCompositing/Source/CompositingMain.cpp | 3 ++ Plugins/nosCompositing/Source/QuadMerge.cpp | 40 +++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 Plugins/nosCompositing/Source/QuadMerge.cpp diff --git a/Plugins/nosCompositing/Nodes/QuadMerge.nosnode b/Plugins/nosCompositing/Nodes/QuadMerge.nosnode index 64b90a8a..0d50f9f9 100644 --- a/Plugins/nosCompositing/Nodes/QuadMerge.nosnode +++ b/Plugins/nosCompositing/Nodes/QuadMerge.nosnode @@ -10,7 +10,10 @@ "concatenate", "add", "quarter", - "texture" + "texture", + "quad", + "canvas", + "layout" ] }, "node": { @@ -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 + } + } + ] } ] } diff --git a/Plugins/nosCompositing/Source/CompositingMain.cpp b/Plugins/nosCompositing/Source/CompositingMain.cpp index a9cbb7dd..caf36d88 100644 --- a/Plugins/nosCompositing/Source/CompositingMain.cpp +++ b/Plugins/nosCompositing/Source/CompositingMain.cpp @@ -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*); @@ -31,6 +32,7 @@ enum class Nodes : size_t BoxFit, ChannelViewer, Merge, + QuadMerge, LayoutDrawer, FreeLayout, GridLayout, @@ -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) diff --git a/Plugins/nosCompositing/Source/QuadMerge.cpp b/Plugins/nosCompositing/Source/QuadMerge.cpp new file mode 100644 index 00000000..c7136618 --- /dev/null +++ b/Plugins/nosCompositing/Source/QuadMerge.cpp @@ -0,0 +1,40 @@ +// Copyright MediaZ Teknoloji A.S. All Rights Reserved. + +#include + +#include + +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(NOS_NAME("Output")); + auto outputTexInfo = sys::vulkan::GetResourceInfo(outputTex); + const nos::fb::vec2u& resolution = *params.GetPinValue(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 From 22e57e240db6d3b381fcb6b71897fa560c5a3457 Mon Sep 17 00:00:00 2001 From: atkurtul Date: Mon, 24 Aug 2026 12:39:37 +0300 Subject: [PATCH 2/3] Mark LayoutQuadCanvas deprecated Quad Merge covers the same 2x2 case in a single node. Still creatable. Also renames the inner Array (1) node to OutputInfos. --- Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode b/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode index bc1859ec..f47a0c7a 100644 --- a/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode +++ b/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode @@ -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 and is hidden from the node creation menu.", "pins": [ { "id": "acdf750c-9637-4807-9d29-578f11bcc010", @@ -1628,7 +1629,7 @@ }, { "id": "c886b125-d628-4ade-91eb-390ffff53476", - "name": "Array (1)", + "name": "OutputInfos", "class_name": "nos.reflect.Array", "pins": [ { @@ -2053,7 +2054,7 @@ "value": "/LayoutDrawer" } ], - "display_name": "Layout Quad Canvas", + "display_name": "Layout Quad Canvas (Deprecated)", "plugin_version": { "major": 3, "minor": 10, From c19380fcb5bef406ac6e05ac8380cdea46a8a1e7 Mon Sep 17 00:00:00 2001 From: atkurtul Date: Mon, 24 Aug 2026 13:20:09 +0300 Subject: [PATCH 3/3] Fix stale wording in LayoutQuadCanvas description The node is not hidden from the menu. --- Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode b/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode index f47a0c7a..02756fc9 100644 --- a/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode +++ b/Plugins/nosCompositing/Nodes/LayoutQuadCanvas.nosnode @@ -10,7 +10,7 @@ "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 and is hidden from the node creation menu.", + "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",