Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laszlo Agocs
qtrhi
Commits
14f8e314
Commit
14f8e314
authored
Jan 07, 2019
by
Laszlo Agocs
Browse files
Fix mac build
parent
23b669b6
Changes
3
Show whitespace changes
Inline
Side-by-side
examples/rhi/shared/examplefw.h
View file @
14f8e314
...
...
@@ -391,14 +391,20 @@ void Window::render()
m_r
->
endFrame
(
m_sc
);
// There should be no need to rely on requestUpdate().
// Outside Apple that's a 5 ms timer, otherwise backed by CVDisplayLink but
// for Metal we do not need that either.
bool
sillyPlatform
=
false
;
// There should be no need to rely on requestUpdate(). Outside Apple that's
// a 5 ms timer, otherwise backed by CVDisplayLink but for Metal we do not
// need that either, on macOS at least. For iOS/tvOS however, or when using
// OpenGL on Apple, continue to use requestUpdate.
bool
useRequestUpdate
=
false
;
#ifdef Q_OS_DARWIN
sillyPlatform
=
graphicsApi
==
OpenGL
;
#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
useRequestUpdate
=
true
;
#else
if
(
graphicsApi
==
OpenGL
)
useRequestUpdate
=
true
;
#endif
#endif
if
(
sillyPlatform
)
if
(
useRequestUpdate
)
requestUpdate
();
else
QCoreApplication
::
postEvent
(
this
,
new
QEvent
(
QEvent
::
UpdateRequest
));
...
...
src/rhi/qrhid3d11.cpp
View file @
14f8e314
...
...
@@ -567,9 +567,11 @@ QRhi::FrameOpResult QRhiD3D11::beginFrame(QRhiSwapChain *swapChain)
ok
&=
context
->
GetData
(
tsStart
,
&
timestamps
[
0
],
sizeof
(
quint64
),
D3D11_ASYNC_GETDATA_DONOTFLUSH
)
==
S_OK
;
if
(
ok
)
{
if
(
!
dj
.
Disjoint
&&
dj
.
Frequency
)
{
// The timestamps seem to include vsync time with Present(1) on
// AMD and Intel, but not with NVIDIA. The latter is what we
// would need but not much we can do about it.
// The timestamps seem to include vsync time with Present(1),
// except when running on a non-primary gpu. This is not ideal,
// and differs from other backends (Vulkan), but not much we
// can do about it. (apart from telling people to set NoVSync
// to get more useful results)
const
float
elapsedMs
=
(
timestamps
[
1
]
-
timestamps
[
0
])
/
float
(
dj
.
Frequency
)
*
1000.0
f
;
// finally got a value, just report it, the profiler cares about min/max/avg anyway
...
...
src/rhi/qrhimetal.mm
View file @
14f8e314
...
...
@@ -2557,8 +2557,12 @@ bool QMetalSwapChain::buildOrResize()
if
(
m_flags
.
testFlag
(
UsedAsTransferSource
))
d
->
layer
.
framebufferOnly
=
NO
;
if
(
m_flags
.
testFlag
(
NoVSync
))
#ifdef Q_OS_MAC
if
(
m_flags
.
testFlag
(
NoVSync
))
{
if
(
@available
(
macOS
10.13
,
*
))
d
->
layer
.
displaySyncEnabled
=
NO
;
}
#endif
m_currentPixelSize
=
surfacePixelSize
();
pixelSize
=
m_currentPixelSize
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment