Skip to content

Commit d59d23d

Browse files
authored
Merge branch 'shadps4-emu:main' into main
2 parents 1ff0dea + be411b3 commit d59d23d

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

src/core/devtools/layer.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ using namespace Core::Devtools;
1818
using L = Core::Devtools::Layer;
1919

2020
static bool show_simple_fps = false;
21+
static float fps_scale = 1.0f;
22+
2123
static bool show_advanced_debug = false;
2224

2325
static int dump_frame_count = 1;
@@ -149,8 +151,9 @@ void L::SetupSettings() {
149151
};
150152
handler.ReadLineFn = [](ImGuiContext*, ImGuiSettingsHandler*, void*, const char* line) {
151153
int v;
152-
if (sscanf(line, "show_simple_fps=%d", &v) == 1) {
153-
show_simple_fps = v != 0;
154+
float f;
155+
if (sscanf(line, "fps_scale=%f", &f) == 1) {
156+
fps_scale = f;
154157
} else if (sscanf(line, "show_advanced_debug=%d", &v) == 1) {
155158
show_advanced_debug = v != 0;
156159
} else if (sscanf(line, "show_frame_graph=%d", &v) == 1) {
@@ -161,7 +164,7 @@ void L::SetupSettings() {
161164
};
162165
handler.WriteAllFn = [](ImGuiContext*, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) {
163166
buf->appendf("[%s][Data]\n", handler->TypeName);
164-
buf->appendf("show_simple_fps=%d\n", show_simple_fps);
167+
buf->appendf("fps_scale=%f\n", fps_scale);
165168
buf->appendf("show_advanced_debug=%d\n", show_advanced_debug);
166169
buf->appendf("show_frame_graph=%d\n", frame_graph.is_open);
167170
buf->appendf("dump_frame_count=%d\n", dump_frame_count);
@@ -193,11 +196,24 @@ void L::Draw() {
193196
}
194197

195198
if (show_simple_fps) {
196-
SetWindowPos("Video Info", {999999.0f, 0.0f}, ImGuiCond_FirstUseEver);
197199
if (Begin("Video Info", nullptr,
198200
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration |
199201
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking)) {
202+
SetWindowPos("Video Info", {999999.0f, 0.0f}, ImGuiCond_FirstUseEver);
203+
if (BeginPopupContextWindow()) {
204+
#define M(label, value) \
205+
if (MenuItem(label, nullptr, fps_scale == value)) \
206+
fps_scale = value
207+
M("0.5x", 0.5f);
208+
M("1.0x", 1.0f);
209+
M("1.5x", 1.5f);
210+
M("2.0x", 2.0f);
211+
M("2.5x", 2.5f);
212+
EndPopup();
213+
#undef M
214+
}
200215
KeepWindowInside();
216+
SetWindowFontScale(fps_scale);
201217
DrawSimple();
202218
}
203219
End();

src/imgui/renderer/imgui_core.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ std::deque<std::pair<bool, ImGui::Layer*>>& GetChangeLayers() {
3535
}
3636

3737
static std::mutex change_layers_mutex{};
38+
static ImGuiID dock_id;
3839

3940
namespace ImGui {
4041

@@ -106,6 +107,14 @@ void Initialize(const ::Vulkan::Instance& instance, const Frontend::WindowSDL& w
106107
Vulkan::Init(vk_info);
107108

108109
TextureManager::StartWorker();
110+
111+
char label[32];
112+
ImFormatString(label, IM_ARRAYSIZE(label), "WindowOverViewport_%08X", GetMainViewport()->ID);
113+
dock_id = ImHashStr(label);
114+
115+
if (const auto dpi = SDL_GetWindowDisplayScale(window.GetSdlWindow()); dpi > 0.0f) {
116+
GetIO().FontGlobalScale = dpi;
117+
}
109118
}
110119

111120
void OnResize() {
@@ -147,8 +156,10 @@ bool ProcessEvent(SDL_Event* event) {
147156
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
148157
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
149158
case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN:
150-
case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION:
151-
return GetIO().NavActive;
159+
case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: {
160+
const auto& io = GetIO();
161+
return io.NavActive && io.Ctx->NavWindow != nullptr && io.Ctx->NavWindow->ID != dock_id;
162+
}
152163
default:
153164
return false;
154165
}

src/video_core/buffer_cache/buffer_cache.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ bool BufferCache::BindVertexBuffers(const Shader::Info& vs_info) {
105105
if (instance.IsVertexInputDynamicState()) {
106106
const auto cmdbuf = scheduler.CommandBuffer();
107107
cmdbuf.setVertexInputEXT(bindings, attributes);
108+
} else if (bindings.empty()) {
109+
// Required to call bindVertexBuffers2EXT at least once in the current command buffer
110+
// with non-null strides without a non-dynamic stride pipeline in between. Thus even
111+
// when nothing is bound we still need to make a dummy call. Non-null strides in turn
112+
// requires a count greater than 0.
113+
const auto cmdbuf = scheduler.CommandBuffer();
114+
const std::array null_buffers = {GetBuffer(NULL_BUFFER_ID).buffer.buffer};
115+
constexpr std::array null_offsets = {static_cast<vk::DeviceSize>(0)};
116+
cmdbuf.bindVertexBuffers2EXT(0, null_buffers, null_offsets, null_offsets, null_offsets);
108117
}
109118
};
110119

src/video_core/renderer_vulkan/vk_instance.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ bool Instance::CreateDevice() {
366366
vk::PhysicalDeviceColorWriteEnableFeaturesEXT{
367367
.colorWriteEnable = true,
368368
},
369+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT{
370+
.extendedDynamicState = true,
371+
},
369372
vk::PhysicalDeviceExtendedDynamicState3FeaturesEXT{
370373
.extendedDynamicState3ColorWriteMask = true,
371374
},

0 commit comments

Comments
 (0)