Blender V5.3
gpu_shader_dependency.cc File Reference
#include <algorithm>
#include <fmt/format.h>
#include <iomanip>
#include <iostream>
#include <regex>
#include <string>
#include "BLI_map.hh"
#include "BLI_string_ref.hh"
#include "CLG_log.h"
#include "gpu_capabilities_private.hh"
#include "gpu_material_library.hh"
#include "gpu_shader_create_info.hh"
#include "gpu_shader_dependency_private.hh"
#include "gpu_shader_metadata_private.hh"
#include "../shader_tool/metadata.hh"
#include "../shader_tool/processor.hh"
#include "glsl_compositor_source_list.h"
#include "glsl_draw_source_list.h"
#include "glsl_eevee_source_list.h"
#include "glsl_gpencil_source_list.h"
#include "glsl_gpu_source_list.h"
#include "glsl_image_source_list.h"
#include "glsl_ocio_source_list.h"
#include "glsl_overlay_source_list.h"
#include "glsl_select_id_source_list.h"
#include "glsl_workbench_source_list.h"
#include "glsl_compositor_metadata_list.hh"
#include "glsl_draw_metadata_list.hh"
#include "glsl_eevee_metadata_list.hh"
#include "glsl_gpencil_metadata_list.hh"
#include "glsl_gpu_metadata_list.hh"
#include "glsl_image_metadata_list.hh"
#include "glsl_ocio_metadata_list.hh"
#include "glsl_overlay_metadata_list.hh"
#include "glsl_select_id_metadata_list.hh"
#include "glsl_workbench_metadata_list.hh"

Go to the source code of this file.

Classes

struct  blender::gpu::GPUSource

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::gpu
namespace  blender::gpu::shader

Macros

#define SHADER_SOURCE(filename_underscore, filename, filepath)
#define CLOG_FILE_INCLUDE(_from, _include)
#define SHADER_SOURCE(filename_underscore, filename, filepath)

Typedefs

using blender::gpu::GPUPrintFormatMap = Map<uint32_t, shader::PrintfFormat>
using blender::gpu::GPUSourceDictionary = Map<StringRef, GPUSource *>
using blender::gpu::GPUFunctionDictionary = Map<StringRef, GPUFunction *>

Functions

shader::BuiltinBits blender::gpu::shader::convert_builtin_bit (shader::metadata::Builtin builtin)
void blender::gpu_shader_dependency_init ()
void blender::gpu_shader_dependency_exit ()
GPUFunction * blender::gpu_material_library_get_function (const char *name)
void blender::gpu_material_library_use_function (Set< StringRefNull > &used_libraries, const char *name)
bool blender::gpu::shader::gpu_shader_dependency_force_gpu_print_injection ()
bool blender::gpu::shader::gpu_shader_dependency_has_printf ()
const PrintfFormat & blender::gpu::shader::gpu_shader_dependency_get_printf_format (uint32_t format_hash)
BuiltinBits blender::gpu::shader::gpu_shader_dependency_get_builtins (const StringRefNull shader_source_name)
Span< ShaderCreateInfo::SharedVariable > blender::gpu::shader::gpu_shader_dependency_get_shared_variables (const StringRefNull shader_source_name)
Vector< StringRefNull > blender::gpu::shader::gpu_shader_dependency_get_resolved_source (const StringRefNull shader_source_name, const shader::GeneratedSourceList &generated_sources, const StringRefNull shader_name)
StringRefNull blender::gpu::shader::gpu_shader_dependency_get_source (const StringRefNull shader_source_name)
StringRefNull blender::gpu::shader::gpu_shader_dependency_get_filename_from_source_string (StringRef source_string)
 Find the name of the file from which the given string was generated.

Variables

static CLG_LogRef blender::LOG = {"gpu.shader.deps"}
static bool blender::gpu::shader::g_shader_use_printf = false
static GPUPrintFormatMap * blender::g_formats = nullptr
static GPUSourceDictionary * blender::g_sources = nullptr
static GPUFunctionDictionary * blender::g_functions = nullptr
static bool blender::force_printf_injection = false

Detailed Description

Shader source dependency builder that make possible to support #include directive inside the shader files.

Definition in file gpu_shader_dependency.cc.

Macro Definition Documentation

◆ CLOG_FILE_INCLUDE

#define CLOG_FILE_INCLUDE ( _from,
_include )
Value:
(from).filename.c_str() != (_include).filename.c_str()) \
{ \
const char *from_filename = (_from).filename.c_str(); \
const char *include_filename = (_include).filename.c_str(); \
const int from_size = int((_from).source.size()); \
const int include_size = int((_include).source.size()); \
std::string link = fmt::format( \
"{}_{} --> {}_{}\n", from_filename, from_size, include_filename, include_size); \
std::string style = fmt::format("style {}_{} fill:#{:x}{:x}0\n", \
include_filename, \
include_size, \
min_uu(15, include_size / 1000), \
15 - min_uu(15, include_size / 1000)); \
CLG_log_raw(LOG.type, link.c_str()); \
CLG_log_raw(LOG.type, style.c_str()); \
}
#define CLOG_CHECK(clg_ref, verbose_level,...)
Definition CLG_log.h:147
@ CLG_LEVEL_TRACE
Definition CLG_log.h:64
#define LOG(level)
Definition log.h:97

Referenced by blender::gpu::GPUSource::source_get().

◆ SHADER_SOURCE [1/2]

#define SHADER_SOURCE ( filename_underscore,
filename,
filepath )
Value:
g_sources->add_new(filename, \
new GPUSource(filepath, \
filename, \
datatoc_##filename_underscore, \
g_functions, \
g_formats, \
gpu::shader::metadata_##filename_underscore));
void add_new(const Key &key, const Value &value)
Definition BLI_map.hh:265

Definition at line 41 of file gpu_shader_dependency.cc.

◆ SHADER_SOURCE [2/2]

#define SHADER_SOURCE ( filename_underscore,
filename,
filepath )
Value:
extern char datatoc_##filename_underscore[];

Definition at line 41 of file gpu_shader_dependency.cc.