mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-14 02:42:44 +01:00
gl_shader_disk_cache: Address feedback
This commit is contained in:
parent
b8b05a484a
commit
0b6df52109
2 changed files with 8 additions and 4 deletions
|
@ -285,18 +285,20 @@ std::optional<ShaderDiskCacheDecompiled> ShaderDiskCacheOpenGL::LoadDecompiledEn
|
||||||
if (!LoadObjectFromPrecompiled(code_size)) {
|
if (!LoadObjectFromPrecompiled(code_size)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
std::vector<u8> code(code_size);
|
|
||||||
|
std::string code(code_size, '\0');
|
||||||
if (!LoadArrayFromPrecompiled(code.data(), code.size())) {
|
if (!LoadArrayFromPrecompiled(code.data(), code.size())) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderDiskCacheDecompiled entry;
|
ShaderDiskCacheDecompiled entry;
|
||||||
entry.code = std::string(reinterpret_cast<const char*>(code.data()), code_size);
|
entry.code = std::move(code);
|
||||||
|
|
||||||
u32 const_buffers_count{};
|
u32 const_buffers_count{};
|
||||||
if (!LoadObjectFromPrecompiled(const_buffers_count)) {
|
if (!LoadObjectFromPrecompiled(const_buffers_count)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < const_buffers_count; ++i) {
|
for (u32 i = 0; i < const_buffers_count; ++i) {
|
||||||
u32 max_offset{};
|
u32 max_offset{};
|
||||||
u32 index{};
|
u32 index{};
|
||||||
|
@ -312,6 +314,7 @@ std::optional<ShaderDiskCacheDecompiled> ShaderDiskCacheOpenGL::LoadDecompiledEn
|
||||||
if (!LoadObjectFromPrecompiled(samplers_count)) {
|
if (!LoadObjectFromPrecompiled(samplers_count)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < samplers_count; ++i) {
|
for (u32 i = 0; i < samplers_count; ++i) {
|
||||||
u64 offset{};
|
u64 offset{};
|
||||||
u64 index{};
|
u64 index{};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <bitset>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
@ -93,7 +94,7 @@ namespace std {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<OpenGL::BaseBindings> {
|
struct hash<OpenGL::BaseBindings> {
|
||||||
std::size_t operator()(const OpenGL::BaseBindings& bindings) const {
|
std::size_t operator()(const OpenGL::BaseBindings& bindings) const noexcept {
|
||||||
return static_cast<std::size_t>(bindings.cbuf) ^
|
return static_cast<std::size_t>(bindings.cbuf) ^
|
||||||
(static_cast<std::size_t>(bindings.gmem) << 8) ^
|
(static_cast<std::size_t>(bindings.gmem) << 8) ^
|
||||||
(static_cast<std::size_t>(bindings.sampler) << 16) ^
|
(static_cast<std::size_t>(bindings.sampler) << 16) ^
|
||||||
|
@ -103,7 +104,7 @@ struct hash<OpenGL::BaseBindings> {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<OpenGL::ProgramVariant> {
|
struct hash<OpenGL::ProgramVariant> {
|
||||||
std::size_t operator()(const OpenGL::ProgramVariant& variant) const {
|
std::size_t operator()(const OpenGL::ProgramVariant& variant) const noexcept {
|
||||||
return std::hash<OpenGL::BaseBindings>()(variant.base_bindings) ^
|
return std::hash<OpenGL::BaseBindings>()(variant.base_bindings) ^
|
||||||
std::hash<OpenGL::TextureBufferUsage>()(variant.texture_buffer_usage) ^
|
std::hash<OpenGL::TextureBufferUsage>()(variant.texture_buffer_usage) ^
|
||||||
(static_cast<std::size_t>(variant.primitive_mode) << 6);
|
(static_cast<std::size_t>(variant.primitive_mode) << 6);
|
||||||
|
|
Loading…
Reference in a new issue