35 changed files with 1555 additions and 337 deletions
-
10src/common/settings.cpp
-
2src/common/settings.h
-
19src/video_core/buffer_cache/buffer_cache.h
-
12src/video_core/buffer_cache/buffer_cache_base.h
-
2src/video_core/control/channel_state_cache.h
-
74src/video_core/engines/maxwell_3d.cpp
-
3src/video_core/engines/maxwell_3d.h
-
12src/video_core/engines/maxwell_dma.cpp
-
11src/video_core/engines/puller.cpp
-
21src/video_core/fence_manager.h
-
4src/video_core/gpu.cpp
-
1src/video_core/host_shaders/CMakeLists.txt
-
20src/video_core/host_shaders/resolve_conditional_render.comp
-
24src/video_core/macro/macro_hle.cpp
-
11src/video_core/query_cache.h
-
12src/video_core/rasterizer_interface.h
-
18src/video_core/renderer_null/null_rasterizer.cpp
-
6src/video_core/renderer_null/null_rasterizer.h
-
2src/video_core/renderer_opengl/gl_query_cache.cpp
-
2src/video_core/renderer_opengl/gl_query_cache.h
-
32src/video_core/renderer_opengl/gl_rasterizer.cpp
-
6src/video_core/renderer_opengl/gl_rasterizer.h
-
3src/video_core/renderer_vulkan/vk_buffer_cache.cpp
-
47src/video_core/renderer_vulkan/vk_compute_pass.cpp
-
13src/video_core/renderer_vulkan/vk_compute_pass.h
-
2src/video_core/renderer_vulkan/vk_fence_manager.h
-
1258src/video_core/renderer_vulkan/vk_query_cache.cpp
-
105src/video_core/renderer_vulkan/vk_query_cache.h
-
94src/video_core/renderer_vulkan/vk_rasterizer.cpp
-
13src/video_core/renderer_vulkan/vk_rasterizer.h
-
9src/video_core/renderer_vulkan/vk_scheduler.cpp
-
2src/video_core/renderer_vulkan/vk_scheduler.h
-
6src/video_core/vulkan_common/vulkan_device.h
-
3src/video_core/vulkan_common/vulkan_wrapper.cpp
-
19src/video_core/vulkan_common/vulkan_wrapper.h
@ -0,0 +1,20 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
#version 450 |
||||
|
|
||||
|
layout(local_size_x = 1) in; |
||||
|
|
||||
|
layout(std430, binding = 0) buffer Query { |
||||
|
uvec2 initial; |
||||
|
uvec2 unknown; |
||||
|
uvec2 current; |
||||
|
}; |
||||
|
|
||||
|
layout(std430, binding = 1) buffer Result { |
||||
|
uint result; |
||||
|
}; |
||||
|
|
||||
|
void main() { |
||||
|
result = all(equal(initial, current)) ? 1 : 0; |
||||
|
} |
||||
1258
src/video_core/renderer_vulkan/vk_query_cache.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,101 +1,74 @@ |
|||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project |
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
#pragma once |
#pragma once |
||||
|
|
||||
#include <cstddef> |
|
||||
#include <memory> |
#include <memory> |
||||
#include <utility> |
|
||||
#include <vector> |
|
||||
|
|
||||
#include "common/common_types.h" |
|
||||
#include "video_core/query_cache.h" |
|
||||
#include "video_core/renderer_vulkan/vk_resource_pool.h" |
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h" |
|
||||
|
#include "video_core/query_cache/query_cache_base.h" |
||||
|
#include "video_core/renderer_vulkan/vk_buffer_cache.h" |
||||
|
|
||||
namespace VideoCore { |
namespace VideoCore { |
||||
class RasterizerInterface; |
class RasterizerInterface; |
||||
} |
} |
||||
|
|
||||
|
namespace VideoCommon { |
||||
|
class StreamerInterface; |
||||
|
} |
||||
|
|
||||
namespace Vulkan { |
namespace Vulkan { |
||||
|
|
||||
class CachedQuery; |
|
||||
class Device; |
class Device; |
||||
class HostCounter; |
|
||||
class QueryCache; |
|
||||
class Scheduler; |
class Scheduler; |
||||
|
class StagingBufferPool; |
||||
|
|
||||
using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>; |
|
||||
|
struct QueryCacheRuntimeImpl; |
||||
|
|
||||
class QueryPool final : public ResourcePool { |
|
||||
|
class QueryCacheRuntime { |
||||
public: |
public: |
||||
explicit QueryPool(const Device& device, Scheduler& scheduler, VideoCore::QueryType type); |
|
||||
~QueryPool() override; |
|
||||
|
explicit QueryCacheRuntime(VideoCore::RasterizerInterface* rasterizer, |
||||
|
Core::Memory::Memory& cpu_memory_, |
||||
|
Vulkan::BufferCache& buffer_cache_, const Device& device_, |
||||
|
const MemoryAllocator& memory_allocator_, Scheduler& scheduler_, |
||||
|
StagingBufferPool& staging_pool_, |
||||
|
ComputePassDescriptorQueue& compute_pass_descriptor_queue, |
||||
|
DescriptorPool& descriptor_pool); |
||||
|
~QueryCacheRuntime(); |
||||
|
|
||||
std::pair<VkQueryPool, u32> Commit(); |
|
||||
|
template <typename SyncValuesType> |
||||
|
void SyncValues(std::span<SyncValuesType> values, VkBuffer base_src_buffer = nullptr); |
||||
|
|
||||
void Reserve(std::pair<VkQueryPool, u32> query); |
|
||||
|
void Barriers(bool is_prebarrier); |
||||
|
|
||||
protected: |
|
||||
void Allocate(std::size_t begin, std::size_t end) override; |
|
||||
|
void EndHostConditionalRendering(); |
||||
|
|
||||
private: |
|
||||
static constexpr std::size_t GROW_STEP = 512; |
|
||||
|
void PauseHostConditionalRendering(); |
||||
|
|
||||
const Device& device; |
|
||||
const VideoCore::QueryType type; |
|
||||
|
void ResumeHostConditionalRendering(); |
||||
|
|
||||
std::vector<vk::QueryPool> pools; |
|
||||
std::vector<bool> usage; |
|
||||
}; |
|
||||
|
bool HostConditionalRenderingCompareValue(VideoCommon::LookupData object_1, bool qc_dirty); |
||||
|
|
||||
class QueryCache final |
|
||||
: public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> { |
|
||||
public: |
|
||||
explicit QueryCache(VideoCore::RasterizerInterface& rasterizer_, |
|
||||
Core::Memory::Memory& cpu_memory_, const Device& device_, |
|
||||
Scheduler& scheduler_); |
|
||||
~QueryCache(); |
|
||||
|
|
||||
std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type); |
|
||||
|
bool HostConditionalRenderingCompareValues(VideoCommon::LookupData object_1, |
||||
|
VideoCommon::LookupData object_2, bool qc_dirty, bool equal_check); |
||||
|
|
||||
void Reserve(VideoCore::QueryType type, std::pair<VkQueryPool, u32> query); |
|
||||
|
VideoCommon::StreamerInterface* GetStreamerInterface(VideoCommon::QueryType query_type); |
||||
|
|
||||
const Device& GetDevice() const noexcept { |
|
||||
return device; |
|
||||
} |
|
||||
|
void Bind3DEngine(Tegra::Engines::Maxwell3D* maxwell3d); |
||||
|
|
||||
Scheduler& GetScheduler() const noexcept { |
|
||||
return scheduler; |
|
||||
} |
|
||||
|
template <typename Func> |
||||
|
void View3DRegs(Func&& func); |
||||
|
|
||||
private: |
private: |
||||
const Device& device; |
|
||||
Scheduler& scheduler; |
|
||||
std::array<QueryPool, VideoCore::NumQueryTypes> query_pools; |
|
||||
|
void HostConditionalRenderingCompareValueImpl(VideoCommon::LookupData object, bool is_equal); |
||||
|
void HostConditionalRenderingCompareBCImpl(VAddr address, bool is_equal); |
||||
|
friend struct QueryCacheRuntimeImpl; |
||||
|
std::unique_ptr<QueryCacheRuntimeImpl> impl; |
||||
}; |
}; |
||||
|
|
||||
class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> { |
|
||||
public: |
|
||||
explicit HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
|
||||
VideoCore::QueryType type_); |
|
||||
~HostCounter(); |
|
||||
|
|
||||
void EndQuery(); |
|
||||
|
|
||||
private: |
|
||||
u64 BlockingQuery(bool async = false) const override; |
|
||||
|
|
||||
QueryCache& cache; |
|
||||
const VideoCore::QueryType type; |
|
||||
const std::pair<VkQueryPool, u32> query; |
|
||||
const u64 tick; |
|
||||
|
struct QueryCacheParams { |
||||
|
using RuntimeType = Vulkan::QueryCacheRuntime; |
||||
}; |
}; |
||||
|
|
||||
class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> { |
|
||||
public: |
|
||||
explicit CachedQuery(QueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_) |
|
||||
: CachedQueryBase{cpu_addr_, host_ptr_} {} |
|
||||
}; |
|
||||
|
using QueryCache = VideoCommon::QueryCacheBase<QueryCacheParams>; |
||||
|
|
||||
} // namespace Vulkan |
} // namespace Vulkan |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue