Vulkan: Refactor cached compiler instance

ShaderC compiler was cached on the Vulkan backend. The compiler itself
is light-weight and doesn't require any caching. This PR removes the
cached instance from the backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/127693
This commit is contained in:
Jeroen Bakker
2024-09-16 15:51:55 +02:00
parent a5d7684539
commit 4be5d7f99f
4 changed files with 4 additions and 13 deletions

View File

@@ -430,11 +430,6 @@ void VKBackend::render_end()
void VKBackend::render_step() {}
shaderc::Compiler &VKBackend::get_shaderc_compiler()
{
return shaderc_compiler_;
}
void VKBackend::capabilities_init(VKDevice &device)
{
const VkPhysicalDeviceProperties &properties = device.physical_device_properties_get();

View File

@@ -17,8 +17,6 @@
#include "vk_common.hh"
#include "vk_device.hh"
#include "shaderc/shaderc.hpp"
namespace blender::gpu {
class VKContext;
@@ -27,7 +25,6 @@ class VKDescriptorSetTracker;
class VKBackend : public GPUBackend {
private:
shaderc::Compiler shaderc_compiler_;
#ifdef WITH_RENDERDOC
renderdoc::api::Renderdoc renderdoc_api_;
#endif
@@ -87,8 +84,6 @@ class VKBackend : public GPUBackend {
bool debug_capture_begin(const char *title);
void debug_capture_end();
shaderc::Compiler &get_shaderc_compiler();
static VKBackend &get()
{
return *static_cast<VKBackend *>(GPUBackend::get());

View File

@@ -513,8 +513,7 @@ Vector<uint32_t> VKShader::compile_glsl_to_spirv(Span<const char *> sources,
shaderc_shader_kind stage)
{
std::string combined_sources = combine_sources(sources);
VKBackend &backend = VKBackend::get();
shaderc::Compiler &compiler = backend.get_shaderc_compiler();
shaderc::Compiler compiler;
shaderc::CompileOptions options;
options.SetOptimizationLevel(shaderc_optimization_level_performance);
options.SetTargetEnvironment(shaderc_target_env_vulkan, shaderc_env_version_vulkan_1_2);

View File

@@ -8,13 +8,15 @@
#pragma once
#include "BLI_string_ref.hh"
#include "gpu_shader_private.hh"
#include "vk_backend.hh"
#include "vk_context.hh"
#include "vk_push_constants.hh"
#include "BLI_string_ref.hh"
#include "shaderc/shaderc.hpp"
namespace blender::gpu {
class VKShaderInterface;