Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "DNA_customdata_types.h"
#include "DNA_image_types.h"
#include "BLI_ghash.h"
#include "BLI_hash_mm2a.h"
#include "BLI_link_utils.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "BKE_material.h"
#include "GPU_capabilities.h"
#include "GPU_material.h"
#include "GPU_shader.h"
#include "GPU_uniform_buffer.h"
#include "GPU_vertex_format.h"
#include "BLI_sys_types.h"
#include "BLI_vector.hh"
#include "gpu_codegen.h"
#include "gpu_node_graph.h"
#include "gpu_shader_create_info.hh"
#include "gpu_shader_dependency_private.h"
#include <cstdarg>
#include <cstring>
#include <sstream>
#include <string>
Go to the source code of this file.
Classes | |
struct | GPUCodegenCreateInfo |
struct | GPUCodegenCreateInfo::NameBuffer |
struct | GPUPass |
struct | GPUConstant |
class | GPUCodegen |
Functions | |
Type > string conversion | |
static std::ostream & | operator<< (std::ostream &stream, const GPUInput *input) |
static std::ostream & | operator<< (std::ostream &stream, const GPUOutput *output) |
static std::ostream & | operator<< (std::ostream &stream, const GPUConstant *input) |
GPUPass | |
GPUPass * | GPU_generate_pass (GPUMaterial *material, GPUNodeGraph *graph, GPUCodegenCallbackFn finalize_source_cb, void *thunk) |
Compilation | |
static int | count_active_texture_sampler (GPUPass *pass, GPUShader *shader) |
static bool | gpu_pass_shader_validate (GPUPass *pass, GPUShader *shader) |
bool | GPU_pass_compile (GPUPass *pass, const char *shname) |
GPUShader * | GPU_pass_shader_get (GPUPass *pass) |
void | GPU_pass_release (GPUPass *pass) |
static void | gpu_pass_free (GPUPass *pass) |
void | GPU_pass_cache_garbage_collect (void) |
void | GPU_pass_cache_init (void) |
void | GPU_pass_cache_free (void) |
Module | |
void | gpu_codegen_init (void) |
void | gpu_codegen_exit (void) |
GPUPass Cache | |
Internal shader cache: This prevent the shader recompilation / stall when using undo/redo AND also allows for GPUPass reuse if the Shader code is the same for 2 different Materials. Unused GPUPasses are free by Garbage collection. | |
static GPUPass * | pass_cache = nullptr |
static SpinLock | pass_cache_spin |
static GPUPass * | gpu_pass_cache_lookup (uint32_t hash) |
static void | gpu_pass_cache_insert_after (GPUPass *node, GPUPass *pass) |
static GPUPass * | gpu_pass_cache_resolve_collision (GPUPass *pass, GPUShaderCreateInfo *info, uint32_t hash) |
static bool | gpu_pass_is_valid (GPUPass *pass) |
Convert material node-trees to GLSL.
Definition in file gpu_codegen.cc.
Definition at line 665 of file gpu_codegen.cc.
References blender::gpu::shader::ShaderCreateInfo::Resource::bind_type, blender::StringRefNull::c_str(), GPUPass::create_info, GPU_shader_get_uniform(), blender::gpu::shader::ShaderCreateInfo::Sampler::name, blender::gpu::shader::ShaderCreateInfo::pass_resources_, and blender::gpu::shader::ShaderCreateInfo::Resource::sampler.
Referenced by gpu_pass_shader_validate().
Definition at line 812 of file gpu_codegen.cc.
References BKE_material_defaults_free_gpu(), and GPU_shader_free_builtin_shaders().
Referenced by GPU_exit().
Definition at line 808 of file gpu_codegen.cc.
Referenced by GPU_init().
GPUPass* GPU_generate_pass | ( | GPUMaterial * | material, |
GPUNodeGraph * | graph, | ||
GPUCodegenCallbackFn | finalize_source_cb, | ||
void * | thunk | ||
) |
Definition at line 585 of file gpu_codegen.cc.
References BLI_spin_lock(), BLI_spin_unlock(), GPUPass::compiled, GPUCodegenOutput::create_info, GPUPass::create_info, GPUCodegen::create_info, GPUCodegen::generate_attribs(), GPUCodegen::generate_graphs(), GPUCodegen::generate_library(), GPUCodegen::generate_resources(), GPUCodegen::generate_uniform_buffer(), gpu_node_graph_finalize_uniform_attrs(), gpu_node_graph_prune_unused(), gpu_pass_cache_insert_after(), gpu_pass_cache_lookup(), gpu_pass_cache_resolve_collision(), gpu_pass_is_valid(), graph, GPUPass::hash, GPUCodegen::hash_get(), material, MEM_callocN, GPUPass::next, GPUCodegen::output, pass_cache_spin, GPUPass::refcount, and GPUPass::shader.
Referenced by GPU_material_from_nodetree().
Definition at line 789 of file gpu_codegen.cc.
References BLI_spin_end(), BLI_spin_lock(), BLI_spin_unlock(), gpu_pass_free(), GPUPass::next, next, pass_cache, and pass_cache_spin.
Referenced by WM_exit_ex().
Definition at line 756 of file gpu_codegen.cc.
References BLI_spin_lock(), BLI_spin_unlock(), gpu_pass_free(), GPUPass::next, next, pass_cache, pass_cache_spin, and PIL_check_seconds_timer().
Referenced by view3d_main_region_draw().
Definition at line 784 of file gpu_codegen.cc.
References BLI_spin_init(), and pass_cache_spin.
Referenced by WM_init_opengl().
Definition at line 126 of file gpu_codegen.cc.
References BLI_LINKS_PREPEND, BLI_spin_lock(), BLI_spin_unlock(), GPUPass::next, node, pass_cache, and pass_cache_spin.
Referenced by GPU_generate_pass().
Definition at line 112 of file gpu_codegen.cc.
References BLI_spin_lock(), BLI_spin_unlock(), hash, GPUPass::next, pass_cache, and pass_cache_spin.
Referenced by GPU_generate_pass().
|
static |
Definition at line 142 of file gpu_codegen.cc.
References BLI_spin_lock(), BLI_spin_unlock(), GPUPass::create_info, hash, GPUPass::hash, GPUPass::next, and pass_cache_spin.
Referenced by GPU_generate_pass().
Definition at line 706 of file gpu_codegen.cc.
References GPUPass::compiled, GPUPass::create_info, gpu_pass_shader_validate(), GPU_shader_create_from_info(), GPU_shader_free(), blender::gpu::shader::ShaderCreateInfo::name_, and GPUPass::shader.
Referenced by GPU_material_compile().
Definition at line 746 of file gpu_codegen.cc.
References BLI_assert, GPUPass::create_info, GPU_shader_free(), MEM_freeN, GPUPass::refcount, and GPUPass::shader.
Referenced by GPU_pass_cache_free(), and GPU_pass_cache_garbage_collect().
Definition at line 158 of file gpu_codegen.cc.
References GPUPass::compiled, and GPUPass::shader.
Referenced by GPU_generate_pass().
Definition at line 738 of file gpu_codegen.cc.
References BLI_assert, BLI_spin_lock(), BLI_spin_unlock(), pass_cache_spin, and GPUPass::refcount.
Referenced by GPU_material_compile(), and gpu_material_free_single().
Definition at line 733 of file gpu_codegen.cc.
References GPUPass::shader.
Referenced by DRW_shgroup_material_create(), drw_shgroup_material_create_ex(), GPU_material_compile(), GPU_material_from_nodetree(), and GPU_material_get_shader().
Definition at line 680 of file gpu_codegen.cc.
References count_active_texture_sampler(), GPUPass::create_info, blender::gpu::shader::ShaderCreateInfo::geometry_source_, GPU_max_textures(), GPU_max_textures_frag(), GPU_max_textures_geom(), GPU_max_textures_vert(), and blender::StringRefBase::is_empty().
Referenced by GPU_pass_compile().
|
static |
Definition at line 206 of file gpu_codegen.cc.
|
static |
Definition at line 170 of file gpu_codegen.cc.
References BLI_assert, GPU_SOURCE_ATTR, GPU_SOURCE_CONSTANT, GPU_SOURCE_FUNCTION_CALL, GPU_SOURCE_OUTPUT, GPU_SOURCE_STRUCT, GPU_SOURCE_TEX, GPU_SOURCE_TEX_TILED_MAPPING, GPU_SOURCE_UNIFORM, GPU_SOURCE_UNIFORM_ATTR, and input.
|
static |
Definition at line 196 of file gpu_codegen.cc.
References output.
|
static |
Definition at line 107 of file gpu_codegen.cc.
Referenced by GPU_pass_cache_free(), GPU_pass_cache_garbage_collect(), gpu_pass_cache_insert_after(), and gpu_pass_cache_lookup().
|
static |
Definition at line 108 of file gpu_codegen.cc.
Referenced by GPU_generate_pass(), GPU_pass_cache_free(), GPU_pass_cache_garbage_collect(), GPU_pass_cache_init(), gpu_pass_cache_insert_after(), gpu_pass_cache_lookup(), gpu_pass_cache_resolve_collision(), and GPU_pass_release().