mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-20 20:13:21 +02:00
gl_shader_cache: Fix clang strict standard build issues
This commit is contained in:
parent
c03b8c4c19
commit
69215b5a55
@ -382,7 +382,8 @@ void ShaderCacheOpenGL::LoadDiskCache(const std::atomic_bool& stop_loading,
|
|||||||
std::atomic_bool compilation_failed = false;
|
std::atomic_bool compilation_failed = false;
|
||||||
|
|
||||||
const auto Worker = [&](Core::Frontend::GraphicsContext* context, std::size_t begin,
|
const auto Worker = [&](Core::Frontend::GraphicsContext* context, std::size_t begin,
|
||||||
std::size_t end) {
|
std::size_t end, const std::vector<ShaderDiskCacheUsage>& shader_usages,
|
||||||
|
const ShaderDumpsMap& dumps) {
|
||||||
context->MakeCurrent();
|
context->MakeCurrent();
|
||||||
SCOPE_EXIT({ return context->DoneCurrent(); });
|
SCOPE_EXIT({ return context->DoneCurrent(); });
|
||||||
|
|
||||||
@ -422,7 +423,7 @@ void ShaderCacheOpenGL::LoadDiskCache(const std::atomic_bool& stop_loading,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::size_t num_workers{std::thread::hardware_concurrency() + 1};
|
const auto num_workers{static_cast<std::size_t>(std::thread::hardware_concurrency() + 1)};
|
||||||
const std::size_t bucket_size{shader_usages.size() / num_workers};
|
const std::size_t bucket_size{shader_usages.size() / num_workers};
|
||||||
std::vector<std::unique_ptr<Core::Frontend::GraphicsContext>> contexts(num_workers);
|
std::vector<std::unique_ptr<Core::Frontend::GraphicsContext>> contexts(num_workers);
|
||||||
std::vector<std::thread> threads(num_workers);
|
std::vector<std::thread> threads(num_workers);
|
||||||
@ -433,7 +434,7 @@ void ShaderCacheOpenGL::LoadDiskCache(const std::atomic_bool& stop_loading,
|
|||||||
|
|
||||||
// On some platforms the shared context has to be created from the GUI thread
|
// On some platforms the shared context has to be created from the GUI thread
|
||||||
contexts[i] = emu_window.CreateSharedContext();
|
contexts[i] = emu_window.CreateSharedContext();
|
||||||
threads[i] = std::thread(Worker, contexts[i].get(), start, end);
|
threads[i] = std::thread(Worker, contexts[i].get(), start, end, shader_usages, dumps);
|
||||||
}
|
}
|
||||||
for (auto& thread : threads) {
|
for (auto& thread : threads) {
|
||||||
thread.join();
|
thread.join();
|
||||||
|
@ -183,8 +183,7 @@ ShaderDiskCacheOpenGL::LoadTransferable() {
|
|||||||
return {{raws, usages}};
|
return {{raws, usages}};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::unordered_map<u64, ShaderDiskCacheDecompiled>,
|
std::pair<std::unordered_map<u64, ShaderDiskCacheDecompiled>, ShaderDumpsMap>
|
||||||
std::unordered_map<ShaderDiskCacheUsage, ShaderDiskCacheDump>>
|
|
||||||
ShaderDiskCacheOpenGL::LoadPrecompiled() {
|
ShaderDiskCacheOpenGL::LoadPrecompiled() {
|
||||||
if (!IsUsable())
|
if (!IsUsable())
|
||||||
return {};
|
return {};
|
||||||
@ -208,8 +207,7 @@ ShaderDiskCacheOpenGL::LoadPrecompiled() {
|
|||||||
return *result;
|
return *result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::pair<std::unordered_map<u64, ShaderDiskCacheDecompiled>,
|
std::optional<std::pair<std::unordered_map<u64, ShaderDiskCacheDecompiled>, ShaderDumpsMap>>
|
||||||
std::unordered_map<ShaderDiskCacheUsage, ShaderDiskCacheDump>>>
|
|
||||||
ShaderDiskCacheOpenGL::LoadPrecompiledFile(FileUtil::IOFile& file) {
|
ShaderDiskCacheOpenGL::LoadPrecompiledFile(FileUtil::IOFile& file) {
|
||||||
// Read compressed file from disk and decompress to virtual precompiled cache file
|
// Read compressed file from disk and decompress to virtual precompiled cache file
|
||||||
std::vector<u8> compressed(file.GetSize());
|
std::vector<u8> compressed(file.GetSize());
|
||||||
@ -230,7 +228,7 @@ ShaderDiskCacheOpenGL::LoadPrecompiledFile(FileUtil::IOFile& file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<u64, ShaderDiskCacheDecompiled> decompiled;
|
std::unordered_map<u64, ShaderDiskCacheDecompiled> decompiled;
|
||||||
std::unordered_map<ShaderDiskCacheUsage, ShaderDiskCacheDump> dumps;
|
ShaderDumpsMap dumps;
|
||||||
while (precompiled_cache_virtual_file_offset < precompiled_cache_virtual_file.GetSize()) {
|
while (precompiled_cache_virtual_file_offset < precompiled_cache_virtual_file.GetSize()) {
|
||||||
PrecompiledEntryKind kind{};
|
PrecompiledEntryKind kind{};
|
||||||
if (!LoadObjectFromPrecompiled(kind)) {
|
if (!LoadObjectFromPrecompiled(kind)) {
|
||||||
|
@ -33,6 +33,11 @@ namespace OpenGL {
|
|||||||
using ProgramCode = std::vector<u64>;
|
using ProgramCode = std::vector<u64>;
|
||||||
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||||
|
|
||||||
|
struct ShaderDiskCacheUsage;
|
||||||
|
struct ShaderDiskCacheDump;
|
||||||
|
|
||||||
|
using ShaderDumpsMap = std::unordered_map<ShaderDiskCacheUsage, ShaderDiskCacheDump>;
|
||||||
|
|
||||||
/// Allocated bindings used by an OpenGL shader program
|
/// Allocated bindings used by an OpenGL shader program
|
||||||
struct BaseBindings {
|
struct BaseBindings {
|
||||||
u32 cbuf{};
|
u32 cbuf{};
|
||||||
@ -294,4 +299,4 @@ private:
|
|||||||
bool tried_to_load{};
|
bool tried_to_load{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
Loading…
Reference in New Issue
Block a user