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:
@@ -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();
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user