1
0
Fork 0
forked from suyu/suyu

gl_graphics_pipeline: Inline hash and operator== key functions

This commit is contained in:
ReinUsesLisp 2021-06-20 02:35:30 -03:00 committed by ameerj
parent f5db8c7440
commit 9bd0531384
2 changed files with 8 additions and 12 deletions

View file

@ -3,9 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <cstring>
#include "common/cityhash.h"
#include "common/thread_worker.h" #include "common/thread_worker.h"
#include "shader_recompiler/shader_info.h" #include "shader_recompiler/shader_info.h"
#include "video_core/renderer_opengl/gl_graphics_pipeline.h" #include "video_core/renderer_opengl/gl_graphics_pipeline.h"
@ -176,14 +174,6 @@ ConfigureFuncPtr ConfigureFunc(const std::array<Shader::Info, 5>& infos, u32 ena
} }
} // Anonymous namespace } // Anonymous namespace
size_t GraphicsPipelineKey::Hash() const noexcept {
return static_cast<size_t>(Common::CityHash64(reinterpret_cast<const char*>(this), Size()));
}
bool GraphicsPipelineKey::operator==(const GraphicsPipelineKey& rhs) const noexcept {
return std::memcmp(this, &rhs, Size()) == 0;
}
GraphicsPipeline::GraphicsPipeline( GraphicsPipeline::GraphicsPipeline(
const Device& device, TextureCache& texture_cache_, BufferCache& buffer_cache_, const Device& device, TextureCache& texture_cache_, BufferCache& buffer_cache_,
Tegra::MemoryManager& gpu_memory_, Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, Tegra::Engines::Maxwell3D& maxwell3d_,

View file

@ -5,10 +5,12 @@
#pragma once #pragma once
#include <array> #include <array>
#include <cstring>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/cityhash.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "shader_recompiler/shader_info.h" #include "shader_recompiler/shader_info.h"
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
@ -44,9 +46,13 @@ struct GraphicsPipelineKey {
std::array<u32, 3> padding; std::array<u32, 3> padding;
VideoCommon::TransformFeedbackState xfb_state; VideoCommon::TransformFeedbackState xfb_state;
size_t Hash() const noexcept; size_t Hash() const noexcept {
return static_cast<size_t>(Common::CityHash64(reinterpret_cast<const char*>(this), Size()));
}
bool operator==(const GraphicsPipelineKey&) const noexcept; bool operator==(const GraphicsPipelineKey& rhs) const noexcept {
return std::memcmp(this, &rhs, Size()) == 0;
}
bool operator!=(const GraphicsPipelineKey& rhs) const noexcept { bool operator!=(const GraphicsPipelineKey& rhs) const noexcept {
return !operator==(rhs); return !operator==(rhs);