From d752aa535796b0b18a260cdb0312662850f8698c Mon Sep 17 00:00:00 2001 From: psucien Date: Wed, 22 May 2024 20:19:42 +0200 Subject: [PATCH] config, video_core: null gpu configuration added --- src/common/config.cpp | 7 +++++++ src/common/config.h | 1 + src/video_core/amdgpu/liverpool.cpp | 4 +++- src/video_core/amdgpu/liverpool.h | 2 +- src/video_core/renderer_vulkan/vk_rasterizer.cpp | 5 ++++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index 4a806b2e..afabba03 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -18,6 +18,7 @@ std::string logType = "sync"; bool isDebugDump = false; bool isLibc = true; bool isShowSplash = false; +bool isNullGpu = false; bool isLleLibc() { return isLibc; @@ -54,6 +55,10 @@ bool showSplash() { return isShowSplash; } +bool nullGpu() { + return isNullGpu; +} + void load(const std::filesystem::path& path) { // If the configuration file does not exist, create it and return std::error_code error; @@ -90,6 +95,7 @@ void load(const std::filesystem::path& path) { screenWidth = toml::find_or(gpu, "screenWidth", screenWidth); screenHeight = toml::find_or(gpu, "screenHeight", screenHeight); gpuId = toml::find_or(gpu, "gpuId", 0); + isNullGpu = toml::find_or(gpu, "nullGpu", false); } } if (data.contains("Debug")) { @@ -135,6 +141,7 @@ void save(const std::filesystem::path& path) { data["GPU"]["gpuId"] = gpuId; data["GPU"]["screenWidth"] = screenWidth; data["GPU"]["screenHeight"] = screenHeight; + data["GPU"]["nullGpu"] = isNullGpu; data["Debug"]["DebugDump"] = isDebugDump; data["LLE"]["libc"] = isLibc; diff --git a/src/common/config.h b/src/common/config.h index 7a8c3358..803e9409 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -21,5 +21,6 @@ s32 getGpuId(); bool debugDump(); bool isLleLibc(); bool showSplash(); +bool nullGpu(); }; // namespace Config diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index 89c54831..c125f3ea 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -108,7 +108,9 @@ void Liverpool::ProcessCmdList(const u32* cmdbuf, u32 size_in_bytes) { regs.index_base_address.base_addr_hi.Assign(draw_index->index_base_hi); regs.num_indices = draw_index->index_count; regs.draw_initiator = draw_index->draw_initiator; - rasterizer->DrawIndex(); + if (rasterizer) { + rasterizer->DrawIndex(); + } break; } case PM4ItOpcode::DrawIndexAuto: { diff --git a/src/video_core/amdgpu/liverpool.h b/src/video_core/amdgpu/liverpool.h index 78526569..f0a27bb1 100644 --- a/src/video_core/amdgpu/liverpool.h +++ b/src/video_core/amdgpu/liverpool.h @@ -644,7 +644,7 @@ private: void ProcessCmdList(const u32* cmdbuf, u32 size_in_bytes); void Process(std::stop_token stoken); - Vulkan::Rasterizer* rasterizer; + Vulkan::Rasterizer* rasterizer{}; std::jthread process_thread{}; std::queue> gfx_ring{}; std::condition_variable_any cv_submit{}; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index f9c8a9a8..5f5d3d4e 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/config.h" #include "video_core/amdgpu/liverpool.h" #include "video_core/renderer_vulkan/vk_instance.h" #include "video_core/renderer_vulkan/vk_rasterizer.h" @@ -19,7 +20,9 @@ Rasterizer::Rasterizer(const Instance& instance_, Scheduler& scheduler_, : instance{instance_}, scheduler{scheduler_}, texture_cache{texture_cache_}, liverpool{liverpool_}, pipeline_cache{instance, scheduler, liverpool}, vertex_index_buffer{instance, scheduler, VertexIndexFlags, 64_MB} { - liverpool->BindRasterizer(this); + if (!Config::nullGpu()) { + liverpool->BindRasterizer(this); + } } Rasterizer::~Rasterizer() = default;