SpirvShaderSampling: Fix flaky tests. The cache keys were colliding, causing mayhem. Add 32-bit unique keys to ImageViews and Samplers, combine them into a unique 64 bit key. Bug: b/131246679 Change-Id: I74c86a80ee5fec1c97eda720bd0797bff4a1a7e0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29934 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: Chris Forbes <chrisforbes@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Vulkan/VkSampler.cpp b/src/Vulkan/VkSampler.cpp new file mode 100644 index 0000000..d80f699 --- /dev/null +++ b/src/Vulkan/VkSampler.cpp
@@ -0,0 +1,23 @@ +// Copyright 2019 The SwiftShader Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#include "VkSampler.hpp" + +namespace vk +{ + +std::atomic<uint32_t> Sampler::nextID(1); + +} // namespace vk