summaryrefslogtreecommitdiffstats
path: root/examples/example-base/example-base.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-04-16 10:34:26 -0700
committerGitHub <noreply@github.com>2021-04-16 10:34:26 -0700
commit79e92395f8ce3d92c446e3bb3250d19ce33decd5 (patch)
tree2ac277fa299200da72cf03a2b5b96338f66aee5d /examples/example-base/example-base.cpp
parentbad484d838590d0a2aaf1b5b8ac820634af2decb (diff)
Update `model-viewer` example and fixing compiler bugs. (#1795)
Diffstat (limited to 'examples/example-base/example-base.cpp')
-rw-r--r--examples/example-base/example-base.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/example-base/example-base.cpp b/examples/example-base/example-base.cpp
index b06bbdf7e..09891e555 100644
--- a/examples/example-base/example-base.cpp
+++ b/examples/example-base/example-base.cpp
@@ -1,4 +1,10 @@
#include "example-base.h"
+#include <chrono>
+
+#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+#endif
using namespace Slang;
using namespace gfx;
@@ -20,6 +26,7 @@ Slang::Result WindowedAppBase::initializeBase(const char* title, int width, int
// Initialize the rendering layer.
IDevice::Desc deviceDesc = {};
+ // deviceDesc.slang.targetFlags = SLANG_TARGET_FLAG_DUMP_IR;
gfx::Result res = gfxCreateDevice(&deviceDesc, gDevice.writeRef());
if (SLANG_FAILED(res))
return res;
@@ -158,3 +165,11 @@ void WindowedAppBase::windowSizeChanged()
}
}
}
+
+int64_t getCurrentTime() { return std::chrono::high_resolution_clock::now().time_since_epoch().count(); }
+
+int64_t getTimerFrequency() { return std::chrono::high_resolution_clock::period::den; }
+
+#ifdef _WIN32
+void _Win32OutputDebugString(const char* str) { OutputDebugStringW(Slang::String(str).toWString().begin()); }
+#endif