mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
pipeline: log real shader compiles to the console
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -313,6 +314,16 @@ ShaderModule& PipelineCache::CompileModule(Program& program, const ProgramKey& k
|
|||||||
.function_code = {function_code.begin(), function_code.end()},
|
.function_code = {function_code.begin(), function_code.end()},
|
||||||
});
|
});
|
||||||
EXIT_IF(module.module == nullptr);
|
EXIT_IF(module.module == nullptr);
|
||||||
|
m_compiled[static_cast<size_t>(key.stage)]++;
|
||||||
|
// Guest geometry shaders are compiled through the host mesh stage.
|
||||||
|
std::printf("Shaders: VS %u | PS %u | CS %u | GS %u | LS %u | HS %u | TES %u\n",
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::Vertex)],
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::Pixel)],
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::Compute)],
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::Mesh)],
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::Local)],
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::TessellationControl)],
|
||||||
|
m_compiled[static_cast<size_t>(ShaderType::TessellationEvaluation)]);
|
||||||
// The inputs of these come from the stage's static key.
|
// The inputs of these come from the stage's static key.
|
||||||
if (key.stage == ShaderType::Vertex || key.stage == ShaderType::Local) {
|
if (key.stage == ShaderType::Vertex || key.stage == ShaderType::Local) {
|
||||||
module.vertex_formats = VertexInputFormats(*options.input_info.vertex, module.info);
|
module.vertex_formats = VertexInputFormats(*options.input_info.vertex, module.info);
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ private:
|
|||||||
GraphicContext& m_graphics;
|
GraphicContext& m_graphics;
|
||||||
ShaderRecompiler::IR::ImageHeapSource* m_image_heap;
|
ShaderRecompiler::IR::ImageHeapSource* m_image_heap;
|
||||||
std::unordered_map<ProgramKey, Program, ProgramKeyHash> m_program_cache;
|
std::unordered_map<ProgramKey, Program, ProgramKeyHash> m_program_cache;
|
||||||
|
// Modules compiled per stage.
|
||||||
|
std::array<uint32_t, static_cast<size_t>(ShaderType::TessellationEvaluation) + 1> m_compiled {};
|
||||||
ProgramKey m_lookup_key;
|
ProgramKey m_lookup_key;
|
||||||
vk::PipelineCache m_driver_cache = nullptr;
|
vk::PipelineCache m_driver_cache = nullptr;
|
||||||
std::filesystem::path m_driver_cache_path;
|
std::filesystem::path m_driver_cache_path;
|
||||||
|
|||||||
@@ -609,6 +609,8 @@ struct PipelineCacheTestAccess {
|
|||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static auto Compiled(const PipelineCache &cache) { return cache.m_compiled; }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -44648,6 +44650,12 @@ void CheckStableProgramIds(VulkanHarness &vulkan) {
|
|||||||
{
|
{
|
||||||
PipelineCache cache(vulkan.RuntimeContext(), nullptr);
|
PipelineCache cache(vulkan.RuntimeContext(), nullptr);
|
||||||
for (size_t i = 0; i < cases.size(); i++) forward[i] = compile(cache, cases[i]);
|
for (size_t i = 0; i < cases.size(); i++) forward[i] = compile(cache, cases[i]);
|
||||||
|
// One compute module per case and nothing else.
|
||||||
|
auto expected = PipelineCacheTestAccess::Compiled(cache);
|
||||||
|
expected.fill(0);
|
||||||
|
expected[static_cast<size_t>(ShaderType::Compute)] = static_cast<uint32_t>(cases.size());
|
||||||
|
Require(name, "compiled modules", PipelineCacheTestAccess::Compiled(cache) == expected,
|
||||||
|
"the per-stage compile counts missed or added a module");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
PipelineCache cache(vulkan.RuntimeContext(), nullptr);
|
PipelineCache cache(vulkan.RuntimeContext(), nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user