Hash :
94b45181
Author :
Date :
2022-10-12T14:54:14
Vulkan: Rearrange graphics pipeline desc bits
In preparation for use of VK_EXT_graphics_pipeline_library, the pipeline
state is split in three contiguous regions:
- Vertex input
- Pre-rasterization and fragment stages ("Shaders" for short)
- Fragment output
There is some state that affects both Shaders and Fragment output, which
is split and placed in between the two. This will allow the hash and
compare functions to eventually access each of those pipeline subsets as
a contiguous piece of memory.
Bug: angleproject:7369
Change-Id: Iedc4cf15ed6c7fed6ba93039889fbf5dd191e041
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3949914
Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Reviewed-by: Charlie Lao <cclao@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// hash_utils.h: Hashing based helper functions.
#ifndef COMMON_HASHUTILS_H_
#define COMMON_HASHUTILS_H_
#include "common/debug.h"
#include "common/third_party/xxhash/xxhash.h"
namespace angle
{
// Computes a hash of "key". Any data passed to this function must be multiples of
// 4 bytes, since the PMurHash32 method can only operate increments of 4-byte words.
inline size_t ComputeGenericHash(const void *key, size_t keySize)
{
constexpr unsigned int kSeed = 0xABCDEF98;
// We can't support "odd" alignments. ComputeGenericHash requires aligned types
ASSERT(keySize % 4 == 0);
#if defined(ANGLE_IS_64_BIT_CPU)
return XXH64(key, keySize, kSeed);
#else
return XXH32(key, keySize, kSeed);
#endif // defined(ANGLE_IS_64_BIT_CPU)
}
template <typename T>
size_t ComputeGenericHash(const T &key)
{
static_assert(sizeof(key) % 4 == 0, "ComputeGenericHash requires aligned types");
return ComputeGenericHash(&key, sizeof(key));
}
} // namespace angle
#endif // COMMON_HASHUTILS_H_