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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
__pycache__
*_generated.h
*.ptx
*.egg-info
*.egg-info
.DS_Store
2 changes: 1 addition & 1 deletion Plugins/nosAnimation/Source/AnimateNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ struct AnimateNode : NodeContext
return NOS_RESULT_SUCCESS;
}

NOS_DECLARE_FUNCTIONS(
NOS_DECLARE_FUNCTIONS_FOR(AnimateNode,
NOS_ADD_FUNCTION(NOS_NAME("Start"), Start),
NOS_ADD_FUNCTION(NOS_NAME("Pause"), Pause),
NOS_ADD_FUNCTION(NOS_NAME("Continue"), Continue),
Expand Down
34 changes: 28 additions & 6 deletions Plugins/nosCompositing/Source/FontRendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,40 @@
#include "DejaVuSansMono.hpp.dat"
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#include <cuchar>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>

namespace nos::compositing
{

// Decode one UTF-8 codepoint from [ptr, end). Returns bytes consumed, 0 at
// null terminator, or (size_t)-1 on invalid/truncated input. Avoids
// std::mbrtoc32 because macOS libc++ declares it with using_if_exists.
static std::size_t DecodeUtf8(const char* ptr, const char* end, char32_t& out)
{
if (ptr >= end)
return 0;
unsigned char b0 = static_cast<unsigned char>(ptr[0]);
if (b0 == 0)
return 0;
if (b0 < 0x80) { out = b0; return 1; }
auto cont = [](const char* p) { return static_cast<char32_t>(static_cast<unsigned char>(*p) & 0x3F); };
if ((b0 & 0xE0) == 0xC0 && ptr + 2 <= end) {
out = ((b0 & 0x1Fu) << 6) | cont(ptr + 1);
return 2;
}
if ((b0 & 0xF0) == 0xE0 && ptr + 3 <= end) {
out = ((b0 & 0x0Fu) << 12) | (cont(ptr + 1) << 6) | cont(ptr + 2);
return 3;
}
if ((b0 & 0xF8) == 0xF0 && ptr + 4 <= end) {
out = ((b0 & 0x07u) << 18) | (cont(ptr + 1) << 12) | (cont(ptr + 2) << 6) | cont(ptr + 3);
return 4;
}
return static_cast<std::size_t>(-1);
}

static FontDescription DejaVuSansMono14pt = {
DejaVuSansMono14pt_Image,
sizeof(DejaVuSansMono14pt_Image),
Expand Down Expand Up @@ -103,16 +129,12 @@ TextBuilder& TextBuilder::Add(std::string text, float cHeight, glm::vec2 positio
float cUvHeight = float(Font.Description.CellHeightPx) / atlasHeight;

std::vector<char32_t> characters;
std::mbstate_t state{};
char32_t c32;
const char* ptr = text.c_str();
const char* end = text.c_str() + text.size() + 1;
while (std::size_t rc = std::mbrtoc32(&c32, ptr, end - ptr, &state)) {
assert(rc != (std::size_t)-3);
while (std::size_t rc = DecodeUtf8(ptr, end, c32)) {
if (rc == (std::size_t)-1)
break;
if (rc == (std::size_t)-2)
break;
ptr += rc;

// skip variation selectors
Expand Down
4 changes: 4 additions & 0 deletions Plugins/nosExperiment/Source/Window/WindowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define GLFW_EXPOSE_NATIVE_WIN32
#elif defined(__linux)
#define GLFW_EXPOSE_NATIVE_X11
#elif defined(__APPLE__)
#define GLFW_EXPOSE_NATIVE_COCOA
#else
#error "Unsupported platform"
#endif
Expand Down Expand Up @@ -153,6 +155,8 @@ void WindowNode::OnEnterRunnerThread(nosEnterRunnerThreadParams const& params)
glfwGetWin32Window(Window)
#elif defined(__linux)
glfwGetX11Window(Window)
#elif defined(__APPLE__)
glfwGetCocoaWindow(Window)
#else
#error "Unsupported platform"
#endif
Expand Down
2 changes: 1 addition & 1 deletion Plugins/nosFilters/Nodes/ColorCorrect.nosnode
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"contents": {
"type": "nos.sys.vulkan.GPUNode",
"options": {
"shader": "Shaders/ColorCorrect.hlsl",
"shader": "Shaders/ColorCorrect.frag",
"stage": "FRAGMENT"
}
},
Expand Down
2 changes: 1 addition & 1 deletion Plugins/nosFlow/Source/ConditionalTrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct ConditionalTrigger : NodeContext
return NOS_RESULT_SUCCESS;
}

NOS_DECLARE_FUNCTIONS(
NOS_DECLARE_FUNCTIONS_FOR(ConditionalTrigger,
NOS_ADD_FUNCTION(NOS_NAME("Branch"), Branch),
);
};
Expand Down
2 changes: 1 addition & 1 deletion Plugins/nosFlow/Source/ScheduleOnRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct ScheduleOnRequestNode : NodeContext
return NOS_RESULT_SUCCESS;
}

NOS_DECLARE_FUNCTIONS(
NOS_DECLARE_FUNCTIONS_FOR(ScheduleOnRequestNode,
NOS_ADD_FUNCTION(NSN_Request, Request))
};

Expand Down
2 changes: 1 addition & 1 deletion Plugins/nosFlow/Source/SwitchTrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ struct SwitchTrigger : NodeContext
return NOS_RESULT_SUCCESS;
}

NOS_DECLARE_FUNCTIONS(
NOS_DECLARE_FUNCTIONS_FOR(SwitchTrigger,
NOS_ADD_FUNCTION(NOS_NAME("Switch"), Switch),
);
};
Expand Down
2 changes: 1 addition & 1 deletion Plugins/nosFlow/Source/TriggerOnAnyInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct TriggerOnAnyInput : NodeContext
return NOS_RESULT_SUCCESS;
}

NOS_DECLARE_FUNCTIONS(
NOS_DECLARE_FUNCTIONS_FOR(TriggerOnAnyInput,
NOS_ADD_FUNCTION(NOS_NAME("Trigger"), Branch),
);
};
Expand Down
10 changes: 8 additions & 2 deletions Plugins/nosUtilities/Source/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,15 @@ long long GetUpTime()
// Windows-specific implementation
return GetTickCount64() / 1000; // Returns uptime in seconds
#elif __unix__ || __unix || __linux__ || __APPLE__
// Unix-based (Linux, macOS, etc.) implementation
// Unix-based (Linux, macOS, etc.) implementation.
// macOS libc lacks CLOCK_BOOTTIME; CLOCK_MONOTONIC is the closest analogue.
#if defined(__APPLE__)
constexpr clockid_t kUptimeClock = CLOCK_MONOTONIC;
#else
constexpr clockid_t kUptimeClock = CLOCK_BOOTTIME;
#endif
struct timespec ts;
if (clock_gettime(CLOCK_BOOTTIME, &ts) == 0) {
if (clock_gettime(kUptimeClock, &ts) == 0) {
return ts.tv_sec;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions Subsystems/nosSync/Include/nosSync/nosSync.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

NOS_BEGIN_C_LINKAGE

#define NOS_SYNC_DEFAULT_EVENT_GROUP_ID 1UL
#define NOS_SYNC_NO_SYNC_EVENT_GROUP_ID 0UL
#define NOS_SYNC_DEFAULT_EVENT_GROUP_ID 1u
#define NOS_SYNC_NO_SYNC_EVENT_GROUP_ID 0u

typedef struct nosWaitResult {
uint64_t TimeSinceLastEventNs;
Expand Down