pipeline: log real shader compiles to the console

This commit is contained in:
nmzik
2026-10-24 23:08:01 +02:00
parent 1816004357
commit 87e49282b8
3 changed files with 21 additions and 0 deletions
@@ -27,6 +27,7 @@
#include <atomic>
#include <cctype>
#include <chrono>
#include <cstdio>
#include <cstring>
#include <fmt/format.h>
#include <limits>
@@ -313,6 +314,16 @@ ShaderModule& PipelineCache::CompileModule(Program& program, const ProgramKey& k
.function_code = {function_code.begin(), function_code.end()},
});
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.
if (key.stage == ShaderType::Vertex || key.stage == ShaderType::Local) {
module.vertex_formats = VertexInputFormats(*options.input_info.vertex, module.info);
@@ -200,6 +200,8 @@ private:
GraphicContext& m_graphics;
ShaderRecompiler::IR::ImageHeapSource* m_image_heap;
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;
vk::PipelineCache m_driver_cache = nullptr;
std::filesystem::path m_driver_cache_path;
+8
View File
@@ -609,6 +609,8 @@ struct PipelineCacheTestAccess {
}
return count;
}
static auto Compiled(const PipelineCache &cache) { return cache.m_compiled; }
};
namespace {
@@ -44648,6 +44650,12 @@ void CheckStableProgramIds(VulkanHarness &vulkan) {
{
PipelineCache cache(vulkan.RuntimeContext(), nullptr);
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);