Merge pull request #10839 from lat9nq/pgc-plus
general: Reimplement per-game configurations
This commit is contained in:
commit
fca7d975fd
78 changed files with 4614 additions and 4820 deletions
|
@ -247,7 +247,7 @@ void Codec::Initialize() {
|
|||
av_codec = avcodec_find_decoder(codec);
|
||||
|
||||
InitializeAvCodecContext();
|
||||
if (Settings::values.nvdec_emulation.GetValue() == Settings::NvdecEmulation::GPU) {
|
||||
if (Settings::values.nvdec_emulation.GetValue() == Settings::NvdecEmulation::Gpu) {
|
||||
InitializeGpuDecoder();
|
||||
}
|
||||
if (const int res = avcodec_open2(av_codec_ctx, av_codec, nullptr); res < 0) {
|
||||
|
|
|
@ -84,7 +84,7 @@ std::span<const u8> H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters
|
|||
|
||||
// TODO (ameerj): Where do we get this number, it seems to be particular for each stream
|
||||
const auto nvdec_decoding = Settings::values.nvdec_emulation.GetValue();
|
||||
const bool uses_gpu_decoding = nvdec_decoding == Settings::NvdecEmulation::GPU;
|
||||
const bool uses_gpu_decoding = nvdec_decoding == Settings::NvdecEmulation::Gpu;
|
||||
const u32 max_num_ref_frames = uses_gpu_decoding ? 6u : 16u;
|
||||
writer.WriteUe(max_num_ref_frames);
|
||||
writer.WriteBit(false);
|
||||
|
|
|
@ -34,13 +34,13 @@ ComputePipeline::ComputePipeline(const Device& device, TextureCache& texture_cac
|
|||
: texture_cache{texture_cache_}, buffer_cache{buffer_cache_},
|
||||
program_manager{program_manager_}, info{info_} {
|
||||
switch (device.GetShaderBackend()) {
|
||||
case Settings::ShaderBackend::GLSL:
|
||||
case Settings::ShaderBackend::Glsl:
|
||||
source_program = CreateProgram(code, GL_COMPUTE_SHADER);
|
||||
break;
|
||||
case Settings::ShaderBackend::GLASM:
|
||||
case Settings::ShaderBackend::Glasm:
|
||||
assembly_program = CompileProgram(code, GL_COMPUTE_PROGRAM_NV);
|
||||
break;
|
||||
case Settings::ShaderBackend::SPIRV:
|
||||
case Settings::ShaderBackend::SpirV:
|
||||
source_program = CreateProgram(code_v, GL_COMPUTE_SHADER);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -177,15 +177,15 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
|
|||
has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
|
||||
|
||||
shader_backend = Settings::values.shader_backend.GetValue();
|
||||
use_assembly_shaders = shader_backend == Settings::ShaderBackend::GLASM &&
|
||||
use_assembly_shaders = shader_backend == Settings::ShaderBackend::Glasm &&
|
||||
GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 &&
|
||||
GLAD_GL_NV_transform_feedback && GLAD_GL_NV_transform_feedback2;
|
||||
if (shader_backend == Settings::ShaderBackend::GLASM && !use_assembly_shaders) {
|
||||
if (shader_backend == Settings::ShaderBackend::Glasm && !use_assembly_shaders) {
|
||||
LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported");
|
||||
shader_backend = Settings::ShaderBackend::GLSL;
|
||||
shader_backend = Settings::ShaderBackend::Glsl;
|
||||
}
|
||||
|
||||
if (shader_backend == Settings::ShaderBackend::GLSL && is_nvidia) {
|
||||
if (shader_backend == Settings::ShaderBackend::Glsl && is_nvidia) {
|
||||
const std::string_view driver_version = version.substr(13);
|
||||
const int version_major =
|
||||
std::atoi(driver_version.substr(0, driver_version.find(".")).data());
|
||||
|
|
|
@ -236,18 +236,18 @@ GraphicsPipeline::GraphicsPipeline(const Device& device, TextureCache& texture_c
|
|||
force_context_flush](ShaderContext::Context*) mutable {
|
||||
for (size_t stage = 0; stage < 5; ++stage) {
|
||||
switch (backend) {
|
||||
case Settings::ShaderBackend::GLSL:
|
||||
case Settings::ShaderBackend::Glsl:
|
||||
if (!sources_[stage].empty()) {
|
||||
source_programs[stage] = CreateProgram(sources_[stage], Stage(stage));
|
||||
}
|
||||
break;
|
||||
case Settings::ShaderBackend::GLASM:
|
||||
case Settings::ShaderBackend::Glasm:
|
||||
if (!sources_[stage].empty()) {
|
||||
assembly_programs[stage] =
|
||||
CompileProgram(sources_[stage], AssemblyStage(stage));
|
||||
}
|
||||
break;
|
||||
case Settings::ShaderBackend::SPIRV:
|
||||
case Settings::ShaderBackend::SpirV:
|
||||
if (!sources_spirv_[stage].empty()) {
|
||||
source_programs[stage] = CreateProgram(sources_spirv_[stage], Stage(stage));
|
||||
}
|
||||
|
|
|
@ -522,14 +522,14 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
|
|||
const auto runtime_info{
|
||||
MakeRuntimeInfo(key, program, previous_program, glasm_use_storage_buffers, use_glasm)};
|
||||
switch (device.GetShaderBackend()) {
|
||||
case Settings::ShaderBackend::GLSL:
|
||||
case Settings::ShaderBackend::Glsl:
|
||||
ConvertLegacyToGeneric(program, runtime_info);
|
||||
sources[stage_index] = EmitGLSL(profile, runtime_info, program, binding);
|
||||
break;
|
||||
case Settings::ShaderBackend::GLASM:
|
||||
case Settings::ShaderBackend::Glasm:
|
||||
sources[stage_index] = EmitGLASM(profile, runtime_info, program, binding);
|
||||
break;
|
||||
case Settings::ShaderBackend::SPIRV:
|
||||
case Settings::ShaderBackend::SpirV:
|
||||
ConvertLegacyToGeneric(program, runtime_info);
|
||||
sources_spirv[stage_index] = EmitSPIRV(profile, runtime_info, program, binding);
|
||||
break;
|
||||
|
@ -582,13 +582,13 @@ std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
|
|||
std::string code{};
|
||||
std::vector<u32> code_spirv;
|
||||
switch (device.GetShaderBackend()) {
|
||||
case Settings::ShaderBackend::GLSL:
|
||||
case Settings::ShaderBackend::Glsl:
|
||||
code = EmitGLSL(profile, program);
|
||||
break;
|
||||
case Settings::ShaderBackend::GLASM:
|
||||
case Settings::ShaderBackend::Glasm:
|
||||
code = EmitGLASM(profile, info, program);
|
||||
break;
|
||||
case Settings::ShaderBackend::SPIRV:
|
||||
case Settings::ShaderBackend::SpirV:
|
||||
code_spirv = EmitSPIRV(profile, program);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -232,10 +232,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
|
|||
[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
|
||||
const VideoCommon::ImageInfo& info) {
|
||||
if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) {
|
||||
return Settings::values.accelerate_astc.GetValue() &&
|
||||
return Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::Gpu &&
|
||||
Settings::values.astc_recompression.GetValue() ==
|
||||
Settings::AstcRecompression::Uncompressed &&
|
||||
!Settings::values.async_astc.GetValue();
|
||||
Settings::AstcRecompression::Uncompressed;
|
||||
}
|
||||
// Disable other accelerated uploads for now as they don't implement swizzled uploads
|
||||
return false;
|
||||
|
@ -267,7 +266,8 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
|
|||
[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime,
|
||||
const VideoCommon::ImageInfo& info) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
|
||||
return Settings::values.async_astc.GetValue();
|
||||
return Settings::values.accelerate_astc.GetValue() ==
|
||||
Settings::AstcDecodeMode::CpuAsynchronous;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
|||
glBindTextureUnit(0, screen_info.display_texture);
|
||||
|
||||
auto anti_aliasing = Settings::values.anti_aliasing.GetValue();
|
||||
if (anti_aliasing > Settings::AntiAliasing::LastAA) {
|
||||
if (anti_aliasing >= Settings::AntiAliasing::MaxEnum) {
|
||||
LOG_ERROR(Render_OpenGL, "Invalid antialiasing option selected {}", anti_aliasing);
|
||||
anti_aliasing = Settings::AntiAliasing::None;
|
||||
Settings::values.anti_aliasing.SetValue(anti_aliasing);
|
||||
|
|
|
@ -45,8 +45,8 @@ static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
|
|||
return mode;
|
||||
}
|
||||
switch (mode) {
|
||||
case Settings::VSyncMode::FIFO:
|
||||
case Settings::VSyncMode::FIFORelaxed:
|
||||
case Settings::VSyncMode::Fifo:
|
||||
case Settings::VSyncMode::FifoRelaxed:
|
||||
if (has_mailbox) {
|
||||
return Settings::VSyncMode::Mailbox;
|
||||
} else if (has_imm) {
|
||||
|
@ -59,8 +59,8 @@ static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
|
|||
}();
|
||||
if ((setting == Settings::VSyncMode::Mailbox && !has_mailbox) ||
|
||||
(setting == Settings::VSyncMode::Immediate && !has_imm) ||
|
||||
(setting == Settings::VSyncMode::FIFORelaxed && !has_fifo_relaxed)) {
|
||||
setting = Settings::VSyncMode::FIFO;
|
||||
(setting == Settings::VSyncMode::FifoRelaxed && !has_fifo_relaxed)) {
|
||||
setting = Settings::VSyncMode::Fifo;
|
||||
}
|
||||
|
||||
switch (setting) {
|
||||
|
@ -68,9 +68,9 @@ static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
|
|||
return VK_PRESENT_MODE_IMMEDIATE_KHR;
|
||||
case Settings::VSyncMode::Mailbox:
|
||||
return VK_PRESENT_MODE_MAILBOX_KHR;
|
||||
case Settings::VSyncMode::FIFO:
|
||||
case Settings::VSyncMode::Fifo:
|
||||
return VK_PRESENT_MODE_FIFO_KHR;
|
||||
case Settings::VSyncMode::FIFORelaxed:
|
||||
case Settings::VSyncMode::FifoRelaxed:
|
||||
return VK_PRESENT_MODE_FIFO_RELAXED_KHR;
|
||||
default:
|
||||
return VK_PRESENT_MODE_FIFO_KHR;
|
||||
|
|
|
@ -817,7 +817,7 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
|
|||
: device{device_}, scheduler{scheduler_}, memory_allocator{memory_allocator_},
|
||||
staging_buffer_pool{staging_buffer_pool_}, blit_image_helper{blit_image_helper_},
|
||||
render_pass_cache{render_pass_cache_}, resolution{Settings::values.resolution_info} {
|
||||
if (Settings::values.accelerate_astc) {
|
||||
if (Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::Gpu) {
|
||||
astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool,
|
||||
compute_pass_descriptor_queue, memory_allocator);
|
||||
}
|
||||
|
@ -1301,12 +1301,19 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
|||
runtime->ViewFormats(info.format))),
|
||||
aspect_mask(ImageAspectMask(info.format)) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
||||
if (Settings::values.async_astc.GetValue()) {
|
||||
switch (Settings::values.accelerate_astc.GetValue()) {
|
||||
case Settings::AstcDecodeMode::Gpu:
|
||||
if (Settings::values.astc_recompression.GetValue() ==
|
||||
Settings::AstcRecompression::Uncompressed &&
|
||||
info.size.depth == 1) {
|
||||
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
|
||||
}
|
||||
break;
|
||||
case Settings::AstcDecodeMode::CpuAsynchronous:
|
||||
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
|
||||
} else if (Settings::values.astc_recompression.GetValue() ==
|
||||
Settings::AstcRecompression::Uncompressed &&
|
||||
Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) {
|
||||
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
flags |= VideoCommon::ImageFlagBits::Converted;
|
||||
flags |= VideoCommon::ImageFlagBits::CostlyLoad;
|
||||
|
|
|
@ -72,12 +72,12 @@ float TSCEntry::MaxAnisotropy() const noexcept {
|
|||
}
|
||||
const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue();
|
||||
s32 added_anisotropic{};
|
||||
if (anisotropic_settings == 0) {
|
||||
if (anisotropic_settings == Settings::AnisotropyMode::Automatic) {
|
||||
added_anisotropic = Settings::values.resolution_info.up_scale >>
|
||||
Settings::values.resolution_info.down_shift;
|
||||
added_anisotropic = std::max(added_anisotropic - 1, 0);
|
||||
} else {
|
||||
added_anisotropic = Settings::values.max_anisotropy.GetValue() - 1U;
|
||||
added_anisotropic = static_cast<u32>(Settings::values.max_anisotropy.GetValue()) - 1U;
|
||||
}
|
||||
return static_cast<float>(1U << (max_anisotropy + added_anisotropic));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue