Compare commits

..

1 Commits

Author SHA1 Message Date
lizzie
7ba10e4ca8 [cmake] fix worktrees GenerateSCMRev.cmake
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2025-12-10 03:47:41 +00:00
5 changed files with 21 additions and 54 deletions

View File

@@ -18,10 +18,16 @@ if (DEFINED GIT_RELEASE)
set(BUILD_VERSION "${GIT_TAG}")
set(GIT_REFSPEC "${GIT_RELEASE}")
set(IS_DEV_BUILD false)
else()
elseif(DEFINED GIT_COMMIT)
string(SUBSTRING ${GIT_COMMIT} 0 10 BUILD_VERSION)
set(BUILD_VERSION "${BUILD_VERSION}-${GIT_REFSPEC}")
set(IS_DEV_BUILD true)
elseif(DEFINED GIT_REFSPEC)
set(BUILD_VERSION "${GIT_REFSPEC}")
set(IS_DEV_BUILD true)
else()
set(BUILD_VERSION "scm-none")
set(IS_DEV_BUILD true)
endif()
set(GIT_DESC ${BUILD_VERSION})

View File

@@ -248,12 +248,10 @@ GraphicsPipeline::GraphicsPipeline(
GuestDescriptorQueue& guest_descriptor_queue_, Common::ThreadWorker* worker_thread,
PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache,
const GraphicsPipelineCacheKey& key_, std::array<vk::ShaderModule, NUM_STAGES> stages,
const std::array<const Shader::Info*, NUM_STAGES>& infos,
GraphicsPipeline* base_pipeline_)
: key{key_}, base_pipeline{base_pipeline_}, allow_derivatives{base_pipeline_ == nullptr},
device{device_}, texture_cache{texture_cache_}, buffer_cache{buffer_cache_},
pipeline_cache(pipeline_cache_), scheduler{scheduler_},
guest_descriptor_queue{guest_descriptor_queue_}, spv_modules{std::move(stages)} {
const std::array<const Shader::Info*, NUM_STAGES>& infos)
: key{key_}, device{device_}, texture_cache{texture_cache_}, buffer_cache{buffer_cache_},
pipeline_cache(pipeline_cache_), scheduler{scheduler_},
guest_descriptor_queue{guest_descriptor_queue_}, spv_modules{std::move(stages)} {
if (shader_notify) {
shader_notify->MarkShaderBuilding();
}
@@ -937,18 +935,6 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
if (device.IsKhrPipelineExecutablePropertiesEnabled() && Settings::values.renderer_debug.GetValue()) {
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
}
VkPipeline base_handle = VK_NULL_HANDLE;
// First pipeline in a "cluster" allows derivatives
if (allow_derivatives) {
flags |= VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT;
}
// Children mark themselves as derivatives when base is already built
if (base_pipeline != nullptr && base_pipeline->IsBuilt()) {
flags |= VK_PIPELINE_CREATE_DERIVATIVE_BIT;
base_handle = *base_pipeline->pipeline;
}
pipeline = device.GetLogical().CreateGraphicsPipeline(
{
@@ -969,8 +955,8 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
.layout = *pipeline_layout,
.renderPass = render_pass,
.subpass = 0,
.basePipelineHandle = base_handle,
.basePipelineIndex = -1,
.basePipelineHandle = nullptr,
.basePipelineIndex = 0,
},
*pipeline_cache);
}

View File

@@ -79,14 +79,9 @@ public:
GuestDescriptorQueue& guest_descriptor_queue, Common::ThreadWorker* worker_thread,
PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache,
const GraphicsPipelineCacheKey& key, std::array<vk::ShaderModule, NUM_STAGES> stages,
const std::array<const Shader::Info*, NUM_STAGES>& infos,
GraphicsPipeline* base_pipeline = nullptr);
const std::array<const Shader::Info*, NUM_STAGES>& infos);
bool HasDynamicVertexInput() const noexcept { return key.state.dynamic_vertex_input; }
[[nodiscard]] const GraphicsPipelineCacheKey& Key() const noexcept {
return key;
}
GraphicsPipeline& operator=(GraphicsPipeline&&) noexcept = delete;
GraphicsPipeline(GraphicsPipeline&&) noexcept = delete;
@@ -134,8 +129,6 @@ private:
void Validate();
const GraphicsPipelineCacheKey key;
GraphicsPipeline* base_pipeline = nullptr; // non-owning
bool allow_derivatives = false;
Tegra::Engines::Maxwell3D* maxwell3d;
Tegra::MemoryManager* gpu_memory;
const Device& device;

View File

@@ -575,18 +575,8 @@ GraphicsPipeline* PipelineCache::CurrentGraphicsPipelineSlowPath() {
const auto [pair, is_new]{graphics_cache.try_emplace(graphics_key)};
auto& pipeline{pair->second};
if (is_new) {
GraphicsPipeline* base = nullptr;
// Use the current pipeline as a base if shaders match
if (current_pipeline) {
const auto& base_key = current_pipeline->Key();
if (base_key.unique_hashes == graphics_key.unique_hashes) {
base = current_pipeline;
}
pipeline = CreateGraphicsPipeline();
}
pipeline = CreateGraphicsPipeline(base);
}
if (!pipeline) {
return nullptr;
}
@@ -617,7 +607,7 @@ GraphicsPipeline* PipelineCache::BuiltPipeline(GraphicsPipeline* pipeline) const
std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
ShaderPools& pools, const GraphicsPipelineCacheKey& key,
std::span<Shader::Environment* const> envs, PipelineStatistics* statistics,
bool build_in_parallel, GraphicsPipeline* base_pipeline) try {
bool build_in_parallel) try {
auto hash = key.Hash();
LOG_INFO(Render_Vulkan, "0x{:016x}", hash);
size_t env_index{0};
@@ -696,7 +686,7 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
return std::make_unique<GraphicsPipeline>(
scheduler, buffer_cache, texture_cache, vulkan_pipeline_cache, &shader_notify, device,
descriptor_pool, guest_descriptor_queue, thread_worker, statistics, render_pass_cache, key,
std::move(modules), infos, base_pipeline);
std::move(modules), infos);
} catch (const Shader::Exception& exception) {
auto hash = key.Hash();
@@ -717,23 +707,16 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
}
std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline() {
// Preserve old behaviour, no base pipeline
return CreateGraphicsPipeline(nullptr);
}
std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
GraphicsPipeline* base_pipeline) {
GraphicsEnvironments environments;
GetGraphicsEnvironments(environments, graphics_key.unique_hashes);
main_pools.ReleaseContents();
auto pipeline{CreateGraphicsPipeline(main_pools, graphics_key, environments.Span(),
nullptr, true, base_pipeline)};
auto pipeline{
CreateGraphicsPipeline(main_pools, graphics_key, environments.Span(), nullptr, true)};
if (!pipeline || pipeline_cache_filename.empty()) {
return pipeline;
}
serialization_thread.QueueWork(
[this, key = graphics_key, envs = std::move(environments.envs)] {
serialization_thread.QueueWork([this, key = graphics_key, envs = std::move(environments.envs)] {
boost::container::static_vector<const GenericEnvironment*, Maxwell::MaxShaderProgram>
env_ptrs;
for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) {

View File

@@ -119,12 +119,11 @@ private:
[[nodiscard]] GraphicsPipeline* BuiltPipeline(GraphicsPipeline* pipeline) const noexcept;
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline();
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(GraphicsPipeline* base_pipeline);
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(
ShaderPools& pools, const GraphicsPipelineCacheKey& key,
std::span<Shader::Environment* const> envs, PipelineStatistics* statistics,
bool build_in_parallel, GraphicsPipeline* base_pipeline = nullptr);
bool build_in_parallel);
std::unique_ptr<ComputePipeline> CreateComputePipeline(const ComputePipelineCacheKey& key,
const ShaderInfo* shader);