Files
test2/source/blender/gpu/vulkan/vk_shader_compiler.hh
Miguel Pozo 992e7c95a7 GPU: Converge ShaderCompiler implementations
Part of #136993.

Share as much of the ShaderCompiler implementations as possible.
Remove the ShaderCompiler/ShaderCompilerGeneric split and make most of
its functions non virtual.
Move the `get_compiler` function from `Context` to `GPUBackend` and
creation/deletion to `GPUBackend::init/delete_resources`.
Add a `batch_cancel` function to `ShaderCompiler` (needed for the
GPUPass refactor).

As a nice extra, the multithreaded OpenGL compilation has become faster
too.
The barbershop materials + EEVEE static shaders have gone from 27s to
22s.

I have not observed any performance difference on Vulkan or Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/136676
2025-05-08 18:16:47 +02:00

40 lines
794 B
C++

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#pragma once
#include "gpu_shader_private.hh"
#include "BLI_map.hh"
#include "BLI_task.h"
#include "BLI_vector.hh"
#include "shaderc/shaderc.hpp"
#include <mutex>
namespace blender::gpu {
class VKShader;
class VKShaderModule;
/**
* Vulkan shader compiler.
*
* Is used for both single threaded compilation by calling `VKShaderCompiler::compile_module` or
* batch based compilation.
*/
class VKShaderCompiler {
public:
static bool compile_module(VKShader &shader,
shaderc_shader_kind stage,
VKShaderModule &shader_module);
static void cache_dir_clear_old();
};
} // namespace blender::gpu