Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
d9vk
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Joshua Ashton
d9vk
Commits
ccdc59da
Commit
ccdc59da
authored
Nov 27, 2019
by
Joshua Ashton
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[d3d9] Hook up new signal system for frame latency
parent
e27868a9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
35 deletions
+34
-35
src/d3d9/d3d9_device.cpp
src/d3d9/d3d9_device.cpp
+2
-24
src/d3d9/d3d9_device.h
src/d3d9/d3d9_device.h
+5
-7
src/d3d9/d3d9_swapchain.cpp
src/d3d9/d3d9_swapchain.cpp
+18
-4
src/d3d9/d3d9_swapchain.h
src/d3d9/d3d9_swapchain.h
+9
-0
No files found.
src/d3d9/d3d9_device.cpp
View file @
ccdc59da
...
...
@@ -42,7 +42,6 @@ namespace dxvk {
:
m_adapter
(
pAdapter
)
,
m_dxvkDevice
(
dxvkDevice
)
,
m_csThread
(
dxvkDevice
->
createContext
()
)
,
m_frameLatency
(
DefaultFrameLatency
)
,
m_csChunk
(
AllocCsChunk
()
)
,
m_parent
(
pParent
)
,
m_deviceType
(
DeviceType
)
...
...
@@ -64,11 +63,6 @@ namespace dxvk {
m_initializer
=
new
D3D9Initializer
(
m_dxvkDevice
);
m_converter
=
new
D3D9FormatHelper
(
m_dxvkDevice
);
m_frameLatencyCap
=
m_d3d9Options
.
maxFrameLatency
;
for
(
uint32_t
i
=
0
;
i
<
m_frameEvents
.
size
();
i
++
)
m_frameEvents
[
i
]
=
new
sync
::
Signal
(
true
);
EmitCs
([
cDevice
=
m_dxvkDevice
]
(
DxvkContext
*
ctx
)
{
...
...
@@ -3189,8 +3183,8 @@ namespace dxvk {
if
(
MaxLatency
==
0
)
MaxLatency
=
DefaultFrameLatency
;
if
(
MaxLatency
>
m_frameEvents
.
size
()
)
MaxLatency
=
m_frameEvents
.
size
()
;
if
(
MaxLatency
>
MaxFrameLatency
)
MaxLatency
=
MaxFrameLatency
;
m_frameLatency
=
MaxLatency
;
...
...
@@ -3812,22 +3806,6 @@ namespace dxvk {
}
Rc
<
sync
::
Signal
>
D3D9DeviceEx
::
GetFrameSyncEvent
(
UINT
BufferCount
)
{
uint32_t
frameLatency
=
m_frameLatency
;
if
(
BufferCount
!=
0
&&
BufferCount
<=
frameLatency
)
frameLatency
=
BufferCount
;
if
(
m_frameLatencyCap
!=
0
&&
m_frameLatencyCap
<=
frameLatency
)
frameLatency
=
m_frameLatencyCap
;
uint32_t
frameId
=
m_frameId
++
%
frameLatency
;
return
m_frameEvents
[
frameId
];
}
DxvkDeviceFeatures
D3D9DeviceEx
::
GetDeviceFeatures
(
const
Rc
<
DxvkAdapter
>&
adapter
)
{
DxvkDeviceFeatures
supported
=
adapter
->
features
();
DxvkDeviceFeatures
enabled
=
{};
...
...
src/d3d9/d3d9_device.h
View file @
ccdc59da
...
...
@@ -653,8 +653,6 @@ namespace dxvk {
return
m_dxvkDevice
;
}
Rc
<
sync
::
Signal
>
GetFrameSyncEvent
(
UINT
BufferCount
);
D3D9_VK_FORMAT_MAPPING
LookupFormat
(
D3D9Format
Format
)
const
;
...
...
@@ -868,11 +866,7 @@ namespace dxvk {
DxvkCsThread
m_csThread
;
bool
m_csIsBusy
=
false
;
uint32_t
m_frameLatencyCap
;
uint32_t
m_frameLatency
;
uint32_t
m_frameId
=
0
;
std
::
array
<
Rc
<
sync
::
Signal
>
,
MaxFrameLatency
>
m_frameEvents
;
uint32_t
m_frameLatency
=
DefaultFrameLatency
;
D3D9Initializer
*
m_initializer
=
nullptr
;
D3D9FormatHelper
*
m_converter
=
nullptr
;
...
...
@@ -1040,6 +1034,10 @@ namespace dxvk {
}
}
inline
uint32_t
GetFrameLatency
()
{
return
m_frameLatency
;
}
template
<
DxsoProgramType
ProgramType
,
D3D9ConstantType
ConstantType
,
...
...
src/d3d9/d3d9_swapchain.cpp
View file @
ccdc59da
...
...
@@ -26,7 +26,9 @@ namespace dxvk {
const
D3DDISPLAYMODEEX
*
pFullscreenDisplayMode
)
:
D3D9SwapChainExBase
(
pDevice
)
,
m_device
(
pDevice
->
GetDXVKDevice
())
,
m_context
(
m_device
->
createContext
())
{
,
m_context
(
m_device
->
createContext
())
,
m_frameLatencyCap
(
pDevice
->
GetOptions
()
->
maxFrameLatency
)
,
m_frameLatencySignal
(
new
sync
::
Fence
(
m_frameId
))
{
UpdateMonitorInfo
();
this
->
NormalizePresentParameters
(
pPresentParams
);
...
...
@@ -409,8 +411,8 @@ namespace dxvk {
m_parent
->
Flush
();
// Wait for the sync event so that we respect the maximum frame latency
auto
syncEvent
=
m_parent
->
GetFrameSyncEvent
(
m_presentParams
.
BackBufferCount
)
;
syncEvent
->
wait
(
);
uint64_t
frameId
=
++
m_frameId
;
m_frameLatencySignal
->
wait
(
frameId
-
GetActualFrameLatency
()
);
if
(
m_hud
!=
nullptr
)
m_hud
->
update
();
...
...
@@ -517,7 +519,7 @@ namespace dxvk {
m_hud
->
render
(
m_context
,
info
.
imageExtent
);
if
(
i
+
1
>=
SyncInterval
)
m_context
->
queueSignal
(
syncEvent
);
m_context
->
signal
(
m_frameLatencySignal
,
frameId
);
SubmitPresent
(
sync
);
}
...
...
@@ -923,6 +925,18 @@ namespace dxvk {
}
uint32_t
D3D9SwapChainEx
::
GetActualFrameLatency
()
{
uint32_t
maxFrameLatency
=
m_parent
->
GetFrameLatency
();
if
(
m_frameLatencyCap
)
maxFrameLatency
=
std
::
min
(
maxFrameLatency
,
m_frameLatencyCap
);
maxFrameLatency
=
std
::
min
(
maxFrameLatency
,
m_presentParams
.
BackBufferCount
+
1
);
return
maxFrameLatency
;
}
uint32_t
D3D9SwapChainEx
::
PickFormats
(
D3D9Format
Format
,
VkSurfaceFormatKHR
*
pDstFormats
)
{
...
...
src/d3d9/d3d9_swapchain.h
View file @
ccdc59da
...
...
@@ -5,6 +5,8 @@
#include "../dxvk/hud/dxvk_hud.h"
#include "../util/sync/sync_signal.h"
#include <vector>
namespace
dxvk
{
...
...
@@ -130,6 +132,11 @@ namespace dxvk {
std
::
vector
<
Rc
<
DxvkImageView
>>
m_imageViews
;
uint64_t
m_frameId
=
D3D9DeviceEx
::
MaxFrameLatency
;
uint32_t
m_frameLatencyCap
=
0
;
Rc
<
sync
::
Fence
>
m_frameLatencySignal
;
bool
m_dirty
=
true
;
bool
m_vsync
=
true
;
...
...
@@ -171,6 +178,8 @@ namespace dxvk {
void
InitRamp
();
uint32_t
GetActualFrameLatency
();
uint32_t
PickFormats
(
D3D9Format
Format
,
VkSurfaceFormatKHR
*
pDstFormats
);
...
...
Write
Preview
Markdown
is supported
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