There's no universal way to limit the frame rate in Vulkan applications. DXVK could implement it in theory, but I'm rather reluctant to implement features which are not really part of the core API.
For the same reason I have rejected pull requests adding system monitoring capabilities to the HUD - such features should ideally be implemented in a separate Vulkan layer that can be used with all applications, not just DXVK.
That said, there's a new-ish Vulkan extension for frame pacing that might be worth looking at, but for the time being i'll opt to "no".
Frame pacing could help smooth out the ganeplay. The issue I see happening is if a game goes about my refresh rate the frames desync (no tearing) and it looks like a lower framerate experience at that stage.
I use vsync where possible but it introduces lag which could be avoid if we can keep the frame rate below the refresh. Wish NVIDIA brought fast sync to linux.
@jarrard isn't forcecompositionpipline effectivley the same thing as fast sync? i mean you get no tearing with that and your framerate isn't capped, you still introduce very minor input lag though, but not as severe as with regular vsync.
Frame syncing becomes very choppy after your display hz rate is reached. Basically you could have 200fps but with a 60hz screen it looks like 20-30fps.
Hmmm, i have 144hz monitor and i haven't noticed it, even with games that go above 200 fps
May not be a issue for AMD cards, also 144hz is pretty high so the problem is likely less prominent., Get a 60hz screen.
im with nvidia and my second monitor is 60hz, not seen this issue there either, so i dunno.
Is this a DXVK thing only? as i have tested with Xonotic, CSGO and few other games where i can reach those insane high FPS numbers. With DXVK i haven't seen a game that runs so good except WoW which can get up to 190 FPS in places and didnt notice any problem there also. Haven't tried WoW on my 60hz monitor though
edit: to me it sounds more like some compositor problem. i have MATE with marco and no compositing enabled
No its certain games have bad frame syncing above refresh rates. A good example is Warthunder, I have had many different desktops to prove this to be the case. The problem doesn't really happen under Windows however so there is that.
Either way a frame-rate limiter would reduce GPU temps without the added latency so there isn't just 1 reason to limit it in this way.
As mentioned in my earlier comment, this is outside the scope of DXVK. This is the kind of feature creep that I don't really want in the project, and it should be implemented as a separate Vulkan layer instead so that it can be applied to all Vulkan games.
Looking at the frame pacing extensions, it looks like they are not really applicable to DXVK either.
Choppy presentation at higher frame rates is not a bug. You're likely running a compositor which itself runs with Vsync enabled, which will cause such issues.
This branch now works with vulkan apps now.
Not only the test branch but also master and latest release tag (0.0.4).
Not only the test branch but also master and latest release tag (0.0.4).
You will get the following error for certain hardware (possibly nvidia only issue?). Or certain software.
IE. Warthunder would spit this error out with the 0.4/master build unless he has updated it already since yesterdays test build release.
Strangle: Failed to get function vkGetInstanceProcAddr
Do you have a idea on howto implement this?
git clone https://github.com/LunarG/VulkanToolscd VulkanTools && for d in assistant_layer demo_layer starter_layer; do rm -r layer_factory/$d; donemkdir -p layer_factory/fps_limit_layerecho '#include "fps_limit.h"' > layer_factory/fps_limit_layer/interceptor_objects.hlayer_factory/fps_limit_layer/fps_limit.h file and add following code:#pragma once
#define ONE_BILLION 1000000000
typedef int64_t nanotime_t;
const char *env_var = "FPS";
class FPSLimit : public layer_factory {
public:
FPSLimit() {
const char *frames_limit = getenv(env_var);
if ( frames_limit ) {
fprintf(stderr, "Vulkan FPS limit: %s fps\n", frames_limit);
double tmp = strtod( frames_limit, NULL );
if ( tmp )
targetFrameTime = 1000000000.0 / tmp;
}
if ( targetFrameTime <= 0 )
fprintf(stderr, "Vulkan FPS limit: disabled\n", frames_limit);
};
// TODO: implement
void limiter() { }
VkResult PostCallQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) {
limiter();
return VK_SUCCESS;
}
private:
long targetFrameTime = 0;
};
FPSLimit fps_limit;
limiter() code from libstrangle (line 110-167, replace void limiter() { } stub).config.targetFrameTime with targetFrameTime, remove config.glfinish part.mkdir -p build && cd buildcmake \
-DBUILD_TESTS=OFF \
-DBUILD_LAYERSVT=OFF \
-DBUILD_VKTRACE=OFF \
-DBUILD_VIA=OFF \
-DBUILD_LAYERMGR=OFF \
-DBUILD_VKTRACE_REPLAY=OFF \
-DVULKAN_HEADERS_INSTALL_DIR=/usr \
-DVULKAN_LOADER_INSTALL_DIR=/usr \
-DVULKAN_VALIDATIONLAYERS_INSTALL_DIR=/usr \
..
make && cd layersFPS=25.5 DXVK_HUD=1 VK_LAYER_PATH=. VK_INSTANCE_LAYERS="VK_LAYER_LUNARG_fps_limit_layer" wine d3d11-triangle.exeNice,
However libstrangle has been updated for vulkan and works in my testing so far. But a built in solution would be handy.
EDIT: Libstrangle no longer works, damn.
But a built in solution would be handy.
It's not a built in solution, it's Vulkan layer (created using Vulkan Layer Factory).
Those steps will produce two files for you: VkLayer_fps_limit_layer.json and libVkLayer_fps_limit_layer.so
I decided to create one, because libstrangle sometimes refuses to work for me, and disabled VSync leads to 500-1k fps in menus/maps/pause/etc. While < 60fps in game.
P.S. What really would be handy -- if @doitsujin (or someone who speak vulkan) will create such layer (called e.g. DXVK_helpers_layer), and will move HUD, tweaks, limiter and other useful stuff there.
@pchome
P.S. What really would be handy -- if @doitsujin (or someone who speak vulkan) will create such layer ...
Well, I decided to do it by myself, for my own needs.
Here is the repo, which currently is the rough copy of libstrangle functionality as a Vulkan layer.
https://github.com/pchome/VkGHL
Looks like I will need to figure this out again as libstrangle has borked itself, and developer seems lost for words as to whats wrong..
I'll try your vkghl... fails building
@pchome talking to you mate.
Your code above and your website have issues. Above I get this.
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
VkLayer_utils_LIBRARY
linked by target "VkLayer_fps_limit_layer" in directory /home/riddick/Downloads/VulkanTools/layer_factory-- Configuring incomplete, errors occurred!
See also "/home/riddick/Downloads/VulkanTools/build/CMakeFiles/CMakeOutput.log".
Looks to me you missed a step on both counts (pasted code steps and project page).
EDIT: Precompiled version was provided on vkghl, it works for the most part but doesn't resolve gsync screen tearing and frame pulsing under Warthunder for me, unfortunately.
I somehow ended up here. I think you can remove the wontfix label per https://github.com/doitsujin/dxvk/commit/30a1a29aa612c7a796d3cc1a4b320a24829ed286 commit.
DXVK_HUD=1x1 2019-01DXVK_LIMIT_FPSx1 2018-05
I'm wanting to bring this up for discussion after having issues with limited the framerate of games like Warthunder and such without VSYNC because that can cause significant latency and frame pulsing effects which are undesirable.
Is DXVK or Vulkan for that matter capable of limiting framerate via some universal function, I have tried ENB as a limited but it doesn't seem to work in that manner under DXVK (fps still exceed set limit). So can we get this feature sometime as a variable to be set, such as DXVK_LIMIT_FPS = ###?
Do you have a idea on howto implement this? please do tell!
PS. The old libstrangle works great for OPENGL but I doubt its code can be useful here.