Until now the Vulkan backend supported a single pre-configured sampler. This PR realizes creation, caching and freeing of samplers based on what is required by the state manager. The implementation is similar to OpenGL or Metal. This fixes many issues including: - Textures in workbench and eevee use the correct extend and filtering - Custom icons render correctly - Depth sampling issues - Removes artifacts using EEVEE world shader, lighting and indirect lighting. Pull Request: https://projects.blender.org/blender/blender/pulls/114827
36 lines
739 B
C++
36 lines
739 B
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "vk_sampler.hh"
|
|
#include "vk_samplers.hh"
|
|
|
|
#include "BLI_map.hh"
|
|
|
|
namespace blender::gpu {
|
|
|
|
/**
|
|
* Collection of samplers.
|
|
*
|
|
* Samplers are device owned and can be shared between contexts.
|
|
*/
|
|
class VKSamplers : NonCopyable {
|
|
VKSampler sampler_cache_[GPU_SAMPLER_EXTEND_MODES_COUNT][GPU_SAMPLER_EXTEND_MODES_COUNT]
|
|
[GPU_SAMPLER_FILTERING_TYPES_COUNT];
|
|
VKSampler custom_sampler_cache_[GPU_SAMPLER_CUSTOM_TYPES_COUNT];
|
|
|
|
public:
|
|
void init();
|
|
void free();
|
|
|
|
const VKSampler &get(const GPUSamplerState &sampler_state);
|
|
};
|
|
|
|
} // namespace blender::gpu
|