mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Compute SHA-1 hash of generated shaders
This commit is contained in:
parent
3a3b1eda59
commit
33357f1f36
@ -12,6 +12,8 @@
|
||||
#include "../util/rc/util_rc.h"
|
||||
#include "../util/rc/util_rc_ptr.h"
|
||||
|
||||
#include "../util/sha1/sha1_util.h"
|
||||
|
||||
#include "../util/sync/sync_spinlock.h"
|
||||
|
||||
#include "./vulkan/dxvk_vulkan_extensions.h"
|
||||
|
@ -47,6 +47,12 @@ namespace dxvk {
|
||||
const DxvkInterfaceSlots& iface,
|
||||
const SpirvCodeBuffer& code)
|
||||
: m_stage(stage), m_code(code), m_interface(iface) {
|
||||
// Compute shader hash once
|
||||
m_hash = Sha1Hash::compute(
|
||||
reinterpret_cast<const uint8_t*>(code.data()),
|
||||
code.size());
|
||||
|
||||
// Write back resource slot infos
|
||||
for (uint32_t i = 0; i < slotCount; i++)
|
||||
m_slots.push_back(slotInfos[i]);
|
||||
|
||||
|
@ -170,10 +170,21 @@ namespace dxvk {
|
||||
m_debugName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Shader hash
|
||||
*
|
||||
* The SHA-1 hash of the generated SPIR-V shader.
|
||||
* \returns SHA-1 hash of this shader
|
||||
*/
|
||||
Sha1Hash hash() const {
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
VkShaderStageFlagBits m_stage;
|
||||
SpirvCodeBuffer m_code;
|
||||
Sha1Hash m_hash;
|
||||
|
||||
std::vector<DxvkResourceSlot> m_slots;
|
||||
std::vector<size_t> m_idOffsets;
|
||||
|
Loading…
x
Reference in New Issue
Block a user