Introduce ShaderManager with Proxy Shader Compiler Logger/Settings

This class will be entirely responsible for any interop with the shader compiler, it is also responsible for caching and compilation of shaders in itself.
This commit is contained in:
PixelyIon 2021-12-02 00:43:10 +05:30
parent def9cedbee
commit ece2785582
6 changed files with 56 additions and 3 deletions

View File

@ -160,6 +160,7 @@ add_library(skyline SHARED
${source_DIR}/skyline/gpu/command_scheduler.cpp
${source_DIR}/skyline/gpu/texture/texture.cpp
${source_DIR}/skyline/gpu/presentation_engine.cpp
${source_DIR}/skyline/gpu/shader_manager.cpp
${source_DIR}/skyline/gpu/interconnect/command_executor.cpp
${source_DIR}/skyline/gpu/interconnect/command_nodes.cpp
${source_DIR}/skyline/soc/smmu.cpp
@ -301,4 +302,4 @@ target_include_directories(skyline PRIVATE ${source_DIR}/skyline)
target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field -Wno-dangling-else -Wconversion)
target_link_libraries(skyline PRIVATE shader_recompiler)
target_link_libraries_system(skyline android perfetto fmt lz4_static tzcode oboe vkma mbedcrypto opus Boost::container)
target_link_libraries_system(skyline android perfetto fmt lz4_static tzcode oboe vkma mbedcrypto opus Boost::intrusive Boost::container range-v3)

@ -1 +1 @@
Subproject commit 26adbfd2f3ab9b39cee64230ef5a6b28d3f28846
Subproject commit d56926aad6cce2ba5df958a3cd0f854ce84fdb9a

View File

@ -201,5 +201,5 @@ namespace skyline::gpu {
});
}
GPU::GPU(const DeviceState &state) : vkInstance(CreateInstance(state, vkContext)), vkDebugReportCallback(CreateDebugReportCallback(vkInstance)), vkPhysicalDevice(CreatePhysicalDevice(vkInstance)), vkDevice(CreateDevice(vkPhysicalDevice, vkQueueFamilyIndex, quirks)), vkQueue(vkDevice, vkQueueFamilyIndex, 0), memory(*this), scheduler(*this), presentation(state, *this), texture(*this) {}
GPU::GPU(const DeviceState &state) : vkInstance(CreateInstance(state, vkContext)), vkDebugReportCallback(CreateDebugReportCallback(vkInstance)), vkPhysicalDevice(CreatePhysicalDevice(vkInstance)), vkDevice(CreateDevice(vkPhysicalDevice, vkQueueFamilyIndex, quirks)), vkQueue(vkDevice, vkQueueFamilyIndex, 0), memory(*this), scheduler(*this), presentation(state, *this), texture(*this), shader(state) {}
}

View File

@ -8,6 +8,7 @@
#include "gpu/command_scheduler.h"
#include "gpu/presentation_engine.h"
#include "gpu/texture_manager.h"
#include "gpu/shader_manager.h"
namespace skyline::gpu {
/**
@ -45,6 +46,8 @@ namespace skyline::gpu {
TextureManager texture;
ShaderManager shader;
GPU(const DeviceState &state);
};
}

View File

@ -0,0 +1,32 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include <shader_compiler/common/settings.h>
#include <shader_compiler/common/log.h>
#include "shader_manager.h"
namespace Shader::Log {
void Debug(const std::string &message) {
skyline::Logger::Write(skyline::Logger::LogLevel::Debug, message);
}
void Warn(const std::string &message) {
skyline::Logger::Write(skyline::Logger::LogLevel::Warn, message);
}
void Error(const std::string &message) {
skyline::Logger::Write(skyline::Logger::LogLevel::Error, message);
}
}
namespace skyline::gpu {
ShaderManager::ShaderManager(const DeviceState &state) {
Shader::Settings::values = {
.disable_shader_loop_safety_checks = false,
.renderer_debug = true,
.resolution_info = {
.active = false,
},
};
}
}

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <vulkan/vulkan.hpp>
#include <common.h>
namespace skyline::gpu {
/**
* @brief The Shader Manager is responsible for caching and looking up shaders alongside handling compilation of shaders when not found in any cache
*/
class ShaderManager {
public:
ShaderManager(const DeviceState& state);
};
}