Blender V5.3
gl_compilation_subprocess.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12
13#if BLI_SUBPROCESS_SUPPORT
14
15# include "BLI_sys_types.hh"
16
17namespace blender::gpu {
18
19/* The size of the memory pools shared by Blender and the compilation subprocesses. */
20constexpr size_t compilation_subprocess_shared_memory_size = 1024 * 1024 * 5; /* 5 MiB */
21
22struct ShaderSourceHeader {
23 enum Type { COMPUTE, GRAPHICS, GRAPHICS_WITH_GEOMETRY_STAGE };
24 /* The type of program being compiled. */
25 Type type;
26 /* The source code for all the shader stages (Separated by a null terminator).
27 * The stages follows the execution order (eg. vert > geom > frag). */
28 char sources[compilation_subprocess_shared_memory_size - sizeof(type)];
29};
30
31static_assert(sizeof(ShaderSourceHeader) == compilation_subprocess_shared_memory_size,
32 "Size must match the shared memory size");
33
34struct ShaderBinaryHeader {
35 /* Size of the shader binary data. */
37 /* Magic number that identifies the format of this shader binary (Driver-defined).
38 * This (and size) is set to 0 when the shader has failed to compile. */
40 /* The serialized shader binary data. */
41 uint8_t data[compilation_subprocess_shared_memory_size - sizeof(size) - sizeof(format)];
42};
43
44static_assert(sizeof(ShaderBinaryHeader) == compilation_subprocess_shared_memory_size,
45 "Size must match the shared memory size");
46
47void GL_shader_cache_dir_clear_old();
48
49std::string GL_shader_cache_dir_get();
50
51} // namespace blender::gpu
52
53#endif
int size(const AssetLibraryReference *library_reference)
unsigned int uint32_t
Definition BKE_text.h:81
BMesh const char void * data
unsigned char uint8_t
Definition BKE_text.h:79
std::string format(const std::string &fmt, Args &&...args)
Definition diagnostic.hh:43