aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Schultz <karl@lunarg.com>2018-04-06 15:55:59 -0600
committerKarl Schultz <karl@lunarg.com>2018-04-06 15:55:59 -0600
commitc55c64c0a7d086a3298d00c8af63ad6f7495ddee (patch)
treec1fb22112276c8626f8e6e4af90ca346910894be
parente9b4d6c20c1367238e668be40945b3cfda1652db (diff)
downloadusermoji-c55c64c0a7d086a3298d00c8af63ad6f7495ddee.tar.xz
macos: Remove update_and_draw from cube demos
Adopting this change from MoltenVK. The wait and update steps are no longer needed. Calling just demo_draw now works as well on MVK as it does on other platforms.
-rw-r--r--demos/cube.c8
-rw-r--r--demos/cube.cpp8
-rw-r--r--demos/macOS/cube/DemoViewController.m2
-rw-r--r--demos/macOS/cubepp/DemoViewController.mm2
4 files changed, 2 insertions, 18 deletions
diff --git a/demos/cube.c b/demos/cube.c
index a3261915..90f54933 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -3835,14 +3835,6 @@ static void demo_main(struct demo *demo, void *view) {
demo->spin_angle = 0.4f;
}
-static void demo_update_and_draw(struct demo *demo) {
- // Wait for work to finish before updating MVP.
- vkDeviceWaitIdle(demo->device);
- demo_update_data_buffer(demo);
-
- demo_draw(demo);
-}
-
#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
#include <android/log.h>
#include <android_native_app_glue.h>
diff --git a/demos/cube.cpp b/demos/cube.cpp
index 55964376..68645c90 100644
--- a/demos/cube.cpp
+++ b/demos/cube.cpp
@@ -2984,14 +2984,6 @@ static void demo_main(struct Demo &demo, void *view) {
demo.spin_angle = 0.4f;
}
-// Global function invoked from NS or UI views and controllers on each demo frame
-static void demo_update_and_draw(struct Demo &demo) {
- // Wait for work to finish before updating MVP.
- vkDeviceWaitIdle(demo.device);
- demo.update_data_buffer();
- demo.draw();
-}
-
#else
#error "Platform not supported"
#endif
diff --git a/demos/macOS/cube/DemoViewController.m b/demos/macOS/cube/DemoViewController.m
index 8e376184..a5fe6905 100644
--- a/demos/macOS/cube/DemoViewController.m
+++ b/demos/macOS/cube/DemoViewController.m
@@ -55,7 +55,7 @@
/** Rendering loop callback function for use with a CVDisplayLink. */
static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime,
CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* target) {
- demo_update_and_draw((struct demo*)target);
+ demo_draw((struct demo*)target);
return kCVReturnSuccess;
}
diff --git a/demos/macOS/cubepp/DemoViewController.mm b/demos/macOS/cubepp/DemoViewController.mm
index a175be5b..a0933592 100644
--- a/demos/macOS/cubepp/DemoViewController.mm
+++ b/demos/macOS/cubepp/DemoViewController.mm
@@ -55,7 +55,7 @@
/** Rendering loop callback function for use with a CVDisplayLink. */
static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime,
CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* target) {
- demo_update_and_draw(reinterpret_cast<struct Demo&>(*(struct Demo*)target));
+ ((struct Demo*)target)->draw();
return kCVReturnSuccess;
}