Blender  V2.93
Classes | Typedefs | Enumerations | Functions
GPU_material.h File Reference
#include "DNA_customdata_types.h"
#include "DNA_listBase.h"
#include "BLI_sys_types.h"
#include "GPU_texture.h"

Go to the source code of this file.

Classes

struct  GPUNodeStack
 
struct  GPUMaterialAttribute
 
struct  GPUMaterialTexture
 
struct  GPUMaterialVolumeGrid
 
struct  GPUUniformAttr
 
struct  GPUUniformAttrList
 

Typedefs

typedef struct GPUMaterial GPUMaterial
 
typedef struct GPUNode GPUNode
 
typedef struct GPUNodeLink GPUNodeLink
 
typedef enum eGPUType eGPUType
 
typedef enum eGPUBuiltin eGPUBuiltin
 
typedef enum eGPUMatFlag eGPUMatFlag
 
typedef struct GPUNodeStack GPUNodeStack
 
typedef enum eGPUMaterialStatus eGPUMaterialStatus
 
typedef enum eGPUVolumeDefaultValue eGPUVolumeDefaultValue
 
typedef void(* GPUMaterialEvalCallbackFn) (GPUMaterial *mat, int options, const char **vert_code, const char **geom_code, const char **frag_lib, const char **defines)
 
typedef struct GPUMaterialAttribute GPUMaterialAttribute
 
typedef struct GPUMaterialTexture GPUMaterialTexture
 
typedef struct GPUMaterialVolumeGrid GPUMaterialVolumeGrid
 
typedef struct GPUUniformAttr GPUUniformAttr
 
typedef struct GPUUniformAttrList GPUUniformAttrList
 

Enumerations

enum  eGPUType {
  GPU_NONE = 0 , GPU_FLOAT = 1 , GPU_VEC2 = 2 , GPU_VEC3 = 3 ,
  GPU_VEC4 = 4 , GPU_MAT3 = 9 , GPU_MAT4 = 16 , GPU_MAX_CONSTANT_DATA = GPU_MAT4 ,
  GPU_TEX1D_ARRAY = 1001 , GPU_TEX2D = 1002 , GPU_TEX2D_ARRAY = 1003 , GPU_TEX3D = 1004 ,
  GPU_SHADOW2D = 1005 , GPU_TEXCUBE = 1006 , GPU_CLOSURE = 1007 , GPU_ATTR = 3001
}
 
enum  eGPUBuiltin {
  GPU_VIEW_MATRIX = (1 << 0) , GPU_OBJECT_MATRIX = (1 << 1) , GPU_INVERSE_VIEW_MATRIX = (1 << 2) , GPU_INVERSE_OBJECT_MATRIX = (1 << 3) ,
  GPU_VIEW_POSITION = (1 << 4) , GPU_VIEW_NORMAL = (1 << 5) , GPU_OBJECT_COLOR = (1 << 6) , GPU_AUTO_BUMPSCALE = (1 << 7) ,
  GPU_CAMERA_TEXCO_FACTORS = (1 << 8) , GPU_PARTICLE_SCALAR_PROPS = (1 << 9) , GPU_PARTICLE_LOCATION = (1 << 10) , GPU_PARTICLE_VELOCITY = (1 << 11) ,
  GPU_PARTICLE_ANG_VELOCITY = (1 << 12) , GPU_LOC_TO_VIEW_MATRIX = (1 << 13) , GPU_INVERSE_LOC_TO_VIEW_MATRIX = (1 << 14) , GPU_OBJECT_INFO = (1 << 15) ,
  GPU_BARYCENTRIC_TEXCO = (1 << 16) , GPU_BARYCENTRIC_DIST = (1 << 17) , GPU_WORLD_NORMAL = (1 << 18)
}
 
enum  eGPUMatFlag {
  GPU_MATFLAG_DIFFUSE = (1 << 0) , GPU_MATFLAG_GLOSSY = (1 << 1) , GPU_MATFLAG_REFRACT = (1 << 2) , GPU_MATFLAG_SSS = (1 << 3) ,
  GPU_MATFLAG_BARYCENTRIC = (1 << 4)
}
 
enum  eGPUMaterialStatus { GPU_MAT_FAILED = 0 , GPU_MAT_QUEUED , GPU_MAT_SUCCESS }
 
enum  eGPUVolumeDefaultValue { GPU_VOLUME_DEFAULT_0 , GPU_VOLUME_DEFAULT_1 }
 

Functions

GPUNodeLinkGPU_constant (const float *num)
 
GPUNodeLinkGPU_uniform (const float *num)
 
GPUNodeLinkGPU_attribute (GPUMaterial *mat, CustomDataType type, const char *name)
 
GPUNodeLinkGPU_uniform_attribute (GPUMaterial *mat, const char *name, bool use_dupli)
 
GPUNodeLinkGPU_image (GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser, eGPUSamplerState sampler_state)
 
GPUNodeLinkGPU_image_tiled (GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser, eGPUSamplerState sampler_state)
 
GPUNodeLinkGPU_image_tiled_mapping (GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser)
 
GPUNodeLinkGPU_color_band (GPUMaterial *mat, int size, float *pixels, float *row)
 
GPUNodeLinkGPU_volume_grid (GPUMaterial *mat, const char *name, eGPUVolumeDefaultValue default_value)
 
GPUNodeLinkGPU_builtin (eGPUBuiltin builtin)
 
bool GPU_link (GPUMaterial *mat, const char *name,...)
 
bool GPU_stack_link (GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
 
GPUNodeLinkGPU_uniformbuf_link_out (struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *stack, const int index)
 
void GPU_material_output_link (GPUMaterial *material, GPUNodeLink *link)
 
void GPU_material_add_output_link_aov (GPUMaterial *material, GPUNodeLink *link, int hash)
 
void GPU_material_sss_profile_create (GPUMaterial *material, float radii[3], const short *falloff_type, const float *sharpness)
 
struct GPUUniformBufGPU_material_sss_profile_get (GPUMaterial *material, int sample_len, struct GPUTexture **tex_profile)
 
GPUMaterialGPU_material_from_nodetree_find (struct ListBase *gpumaterials, const void *engine_type, int options)
 
GPUMaterialGPU_material_from_nodetree (struct Scene *scene, struct Material *ma, struct bNodeTree *ntree, struct ListBase *gpumaterials, const void *engine_type, const int options, const bool is_volume_shader, const char *vert_code, const char *geom_code, const char *frag_lib, const char *defines, const char *name, GPUMaterialEvalCallbackFn callback)
 
void GPU_material_compile (GPUMaterial *mat)
 
void GPU_material_free (struct ListBase *gpumaterial)
 
void GPU_materials_free (struct Main *bmain)
 
struct SceneGPU_material_scene (GPUMaterial *material)
 
struct GPUPassGPU_material_get_pass (GPUMaterial *material)
 
struct GPUShaderGPU_material_get_shader (GPUMaterial *material)
 
struct MaterialGPU_material_get_material (GPUMaterial *material)
 
eGPUMaterialStatus GPU_material_status (GPUMaterial *mat)
 
struct GPUUniformBufGPU_material_uniform_buffer_get (GPUMaterial *material)
 
void GPU_material_uniform_buffer_create (GPUMaterial *material, ListBase *inputs)
 
struct GPUUniformBufGPU_material_create_sss_profile_ubo (void)
 
bool GPU_material_has_surface_output (GPUMaterial *mat)
 
bool GPU_material_has_volume_output (GPUMaterial *mat)
 
bool GPU_material_is_volume_shader (GPUMaterial *mat)
 
void GPU_material_flag_set (GPUMaterial *mat, eGPUMatFlag flag)
 
bool GPU_material_flag_get (GPUMaterial *mat, eGPUMatFlag flag)
 
void GPU_pass_cache_init (void)
 
void GPU_pass_cache_garbage_collect (void)
 
void GPU_pass_cache_free (void)
 
ListBase GPU_material_attributes (GPUMaterial *material)
 
ListBase GPU_material_textures (GPUMaterial *material)
 
ListBase GPU_material_volume_grids (GPUMaterial *material)
 
GPUUniformAttrListGPU_material_uniform_attributes (GPUMaterial *material)
 
struct GHashGPU_uniform_attr_list_hash_new (const char *info)
 
void GPU_uniform_attr_list_copy (GPUUniformAttrList *dest, GPUUniformAttrList *src)
 
void GPU_uniform_attr_list_free (GPUUniformAttrList *set)
 

Typedef Documentation

◆ eGPUBuiltin

typedef enum eGPUBuiltin eGPUBuiltin

◆ eGPUMaterialStatus

◆ eGPUMatFlag

typedef enum eGPUMatFlag eGPUMatFlag

◆ eGPUType

typedef enum eGPUType eGPUType

◆ eGPUVolumeDefaultValue

◆ GPUMaterial

typedef struct GPUMaterial GPUMaterial

Definition at line 1 of file GPU_material.h.

◆ GPUMaterialAttribute

◆ GPUMaterialEvalCallbackFn

typedef void(* GPUMaterialEvalCallbackFn) (GPUMaterial *mat, int options, const char **vert_code, const char **geom_code, const char **frag_lib, const char **defines)

Definition at line 137 of file GPU_material.h.

◆ GPUMaterialTexture

◆ GPUMaterialVolumeGrid

◆ GPUNode

typedef struct GPUNode GPUNode

Definition at line 1 of file GPU_material.h.

◆ GPUNodeLink

typedef struct GPUNodeLink GPUNodeLink

Definition at line 1 of file GPU_material.h.

◆ GPUNodeStack

typedef struct GPUNodeStack GPUNodeStack

◆ GPUUniformAttr

◆ GPUUniformAttrList

Enumeration Type Documentation

◆ eGPUBuiltin

Enumerator
GPU_VIEW_MATRIX 
GPU_OBJECT_MATRIX 
GPU_INVERSE_VIEW_MATRIX 
GPU_INVERSE_OBJECT_MATRIX 
GPU_VIEW_POSITION 
GPU_VIEW_NORMAL 
GPU_OBJECT_COLOR 
GPU_AUTO_BUMPSCALE 
GPU_CAMERA_TEXCO_FACTORS 
GPU_PARTICLE_SCALAR_PROPS 
GPU_PARTICLE_LOCATION 
GPU_PARTICLE_VELOCITY 
GPU_PARTICLE_ANG_VELOCITY 
GPU_LOC_TO_VIEW_MATRIX 
GPU_INVERSE_LOC_TO_VIEW_MATRIX 
GPU_OBJECT_INFO 
GPU_BARYCENTRIC_TEXCO 
GPU_BARYCENTRIC_DIST 
GPU_WORLD_NORMAL 

Definition at line 86 of file GPU_material.h.

◆ eGPUMaterialStatus

Enumerator
GPU_MAT_FAILED 
GPU_MAT_QUEUED 
GPU_MAT_SUCCESS 

Definition at line 126 of file GPU_material.h.

◆ eGPUMatFlag

Enumerator
GPU_MATFLAG_DIFFUSE 
GPU_MATFLAG_GLOSSY 
GPU_MATFLAG_REFRACT 
GPU_MATFLAG_SSS 
GPU_MATFLAG_BARYCENTRIC 

Definition at line 108 of file GPU_material.h.

◆ eGPUType

enum eGPUType
Enumerator
GPU_NONE 
GPU_FLOAT 
GPU_VEC2 
GPU_VEC3 
GPU_VEC4 
GPU_MAT3 
GPU_MAT4 
GPU_MAX_CONSTANT_DATA 
GPU_TEX1D_ARRAY 
GPU_TEX2D 
GPU_TEX2D_ARRAY 
GPU_TEX3D 
GPU_SHADOW2D 
GPU_TEXCUBE 
GPU_CLOSURE 
GPU_ATTR 

Definition at line 59 of file GPU_material.h.

◆ eGPUVolumeDefaultValue

Enumerator
GPU_VOLUME_DEFAULT_0 
GPU_VOLUME_DEFAULT_1 

Definition at line 132 of file GPU_material.h.

Function Documentation

◆ GPU_attribute()

GPUNodeLink* GPU_attribute ( GPUMaterial mat,
CustomDataType  type,
const char *  name 
)

◆ GPU_builtin()

GPUNodeLink* GPU_builtin ( eGPUBuiltin  builtin)

◆ GPU_color_band()

GPUNodeLink* GPU_color_band ( GPUMaterial mat,
int  size,
float pixels,
float row 
)

◆ GPU_constant()

GPUNodeLink* GPU_constant ( const float num)

◆ GPU_image()

GPUNodeLink* GPU_image ( GPUMaterial mat,
struct Image ima,
struct ImageUser iuser,
eGPUSamplerState  sampler_state 
)

◆ GPU_image_tiled()

GPUNodeLink* GPU_image_tiled ( GPUMaterial mat,
struct Image ima,
struct ImageUser iuser,
eGPUSamplerState  sampler_state 
)

◆ GPU_image_tiled_mapping()

GPUNodeLink* GPU_image_tiled_mapping ( GPUMaterial mat,
struct Image ima,
struct ImageUser iuser 
)

◆ GPU_link()

bool GPU_link ( GPUMaterial mat,
const char *  name,
  ... 
)

◆ GPU_material_add_output_link_aov()

void GPU_material_add_output_link_aov ( GPUMaterial material,
GPUNodeLink link,
int  hash 
)

◆ GPU_material_attributes()

ListBase GPU_material_attributes ( GPUMaterial material)

Definition at line 572 of file gpu_material.c.

References material.

Referenced by curve_cd_calc_used_gpu_layers(), and mesh_cd_calc_used_gpu_layers().

◆ GPU_material_compile()

void GPU_material_compile ( GPUMaterial mat)

◆ GPU_material_create_sss_profile_ubo()

struct GPUUniformBuf* GPU_material_create_sss_profile_ubo ( void  )

Definition at line 564 of file gpu_material.c.

References GPU_uniformbuf_create.

◆ GPU_material_flag_get()

bool GPU_material_flag_get ( GPUMaterial mat,
eGPUMatFlag  flag 
)

◆ GPU_material_flag_set()

void GPU_material_flag_set ( GPUMaterial mat,
eGPUMatFlag  flag 
)

◆ GPU_material_free()

void GPU_material_free ( struct ListBase gpumaterial)

◆ GPU_material_from_nodetree()

GPUMaterial* GPU_material_from_nodetree ( Scene scene,
struct Material ma,
struct bNodeTree ntree,
ListBase gpumaterials,
const void *  engine_type,
const int  options,
const bool  is_volume_shader,
const char *  vert_code,
const char *  geom_code,
const char *  frag_lib,
const char *  defines,
const char *  name,
GPUMaterialEvalCallbackFn  callback 
)

◆ GPU_material_from_nodetree_find()

GPUMaterial* GPU_material_from_nodetree_find ( struct ListBase gpumaterials,
const void *  engine_type,
int  options 
)

◆ GPU_material_get_material()

struct Material* GPU_material_get_material ( GPUMaterial material)

Definition at line 218 of file gpu_material.c.

References material.

Referenced by node_shader_gpu_object_info(), and node_shader_gpu_output_material().

◆ GPU_material_get_pass()

struct GPUPass* GPU_material_get_pass ( GPUMaterial material)

Definition at line 207 of file gpu_material.c.

References material.

Referenced by DRW_shgroup_material_create().

◆ GPU_material_get_shader()

struct GPUShader* GPU_material_get_shader ( GPUMaterial material)

◆ GPU_material_has_surface_output()

bool GPU_material_has_surface_output ( GPUMaterial mat)

Definition at line 626 of file gpu_material.c.

References GPUMaterial::has_surface_output.

Referenced by EEVEE_materials_cache_populate().

◆ GPU_material_has_volume_output()

bool GPU_material_has_volume_output ( GPUMaterial mat)

◆ GPU_material_is_volume_shader()

bool GPU_material_is_volume_shader ( GPUMaterial mat)

Definition at line 636 of file gpu_material.c.

References GPUMaterial::is_volume_shader.

Referenced by node_shader_gpu_attribute().

◆ GPU_material_output_link()

void GPU_material_output_link ( GPUMaterial material,
GPUNodeLink link 
)

Definition at line 593 of file gpu_material.c.

References material.

Referenced by node_shader_gpu_output_material(), and node_shader_gpu_output_world().

◆ GPU_material_scene()

struct Scene* GPU_material_scene ( GPUMaterial material)

Definition at line 202 of file gpu_material.c.

References material.

Referenced by DRW_deferred_shader_remove().

◆ GPU_material_sss_profile_create()

void GPU_material_sss_profile_create ( GPUMaterial material,
float  radii[3],
const short *  falloff_type,
const float sharpness 
)

◆ GPU_material_sss_profile_get()

struct GPUUniformBuf* GPU_material_sss_profile_get ( GPUMaterial material,
int  sample_len,
struct GPUTexture **  tex_profile 
)

◆ GPU_material_status()

eGPUMaterialStatus GPU_material_status ( GPUMaterial mat)

◆ GPU_material_textures()

ListBase GPU_material_textures ( GPUMaterial material)

Definition at line 577 of file gpu_material.c.

References material.

Referenced by DRW_shgroup_add_material_resources().

◆ GPU_material_uniform_attributes()

GPUUniformAttrList* GPU_material_uniform_attributes ( GPUMaterial material)

Definition at line 587 of file gpu_material.c.

References GPUUniformAttrList::count, material, and NULL.

Referenced by DRW_shgroup_add_material_resources().

◆ GPU_material_uniform_buffer_create()

void GPU_material_uniform_buffer_create ( GPUMaterial material,
ListBase inputs 
)

Create dynamic UBO from parameters

Parameters
inputsItems are LinkData, data is GPUInput (BLI_genericNodeN(GPUInput)).

Definition at line 233 of file gpu_material.c.

References GPU_uniformbuf_create_from_list(), inputs, and material.

Referenced by codegen_process_uniforms_functions().

◆ GPU_material_uniform_buffer_get()

struct GPUUniformBuf* GPU_material_uniform_buffer_get ( GPUMaterial material)

Definition at line 223 of file gpu_material.c.

References material.

Referenced by DRW_shgroup_add_material_resources().

◆ GPU_material_volume_grids()

ListBase GPU_material_volume_grids ( GPUMaterial material)

Definition at line 582 of file gpu_material.c.

References material.

Referenced by EEVEE_volumes_cache_init(), and EEVEE_volumes_cache_object_add().

◆ GPU_materials_free()

void GPU_materials_free ( struct Main bmain)

◆ GPU_pass_cache_free()

void GPU_pass_cache_free ( void  )

◆ GPU_pass_cache_garbage_collect()

void GPU_pass_cache_garbage_collect ( void  )

◆ GPU_pass_cache_init()

void GPU_pass_cache_init ( void  )

Definition at line 1096 of file gpu_codegen.c.

References BLI_spin_init(), and pass_cache_spin.

Referenced by WM_init_opengl().

◆ GPU_stack_link()

bool GPU_stack_link ( GPUMaterial mat,
struct bNode node,
const char *  name,
GPUNodeStack in,
GPUNodeStack out,
  ... 
)

Definition at line 665 of file gpu_node_graph.c.

References BLI_addtail(), GPUNodeStack::end, FUNCTION_QUAL_IN, gpu_material_library_use_function(), gpu_material_node_graph(), gpu_material_used_libraries(), gpu_node_create(), gpu_node_input_link(), gpu_node_input_socket(), gpu_node_output(), GPU_NONE, graph, material, node, NULL, params, GPUNodeLink::socket, and type.

Referenced by gpu_shader_bevel(), gpu_shader_brightcontrast(), gpu_shader_bump(), gpu_shader_camera(), gpu_shader_clamp(), gpu_shader_combhsv(), gpu_shader_combrgb(), gpu_shader_combxyz(), gpu_shader_curve_rgb(), gpu_shader_curve_vec(), gpu_shader_displacement(), gpu_shader_hue_sat(), gpu_shader_invert(), gpu_shader_map_range(), gpu_shader_mapping(), gpu_shader_math(), gpu_shader_mix_rgb(), gpu_shader_normal(), gpu_shader_particle_info(), gpu_shader_rgb(), gpu_shader_rgbtobw(), gpu_shader_sephsv(), gpu_shader_seprgb(), gpu_shader_sepxyz(), gpu_shader_squeeze(), gpu_shader_tex_white_noise(), gpu_shader_valtorgb(), gpu_shader_value(), gpu_shader_vector_displacement(), gpu_shader_vector_math(), gpu_shader_vector_rotate(), node_shader_gpu_add_shader(), node_shader_gpu_ambient_occlusion(), node_shader_gpu_attribute(), node_shader_gpu_background(), node_shader_gpu_blackbody(), node_shader_gpu_bsdf_anisotropic(), node_shader_gpu_bsdf_diffuse(), node_shader_gpu_bsdf_glass(), node_shader_gpu_bsdf_glossy(), node_shader_gpu_bsdf_hair(), node_shader_gpu_bsdf_principled(), node_shader_gpu_bsdf_refraction(), node_shader_gpu_bsdf_toon(), node_shader_gpu_bsdf_translucent(), node_shader_gpu_bsdf_transparent(), node_shader_gpu_bsdf_velvet(), node_shader_gpu_eevee_specular(), node_shader_gpu_emission(), node_shader_gpu_fresnel(), node_shader_gpu_gamma(), node_shader_gpu_geometry(), node_shader_gpu_hair_info(), node_shader_gpu_layer_weight(), node_shader_gpu_light_falloff(), node_shader_gpu_light_path(), node_shader_gpu_mix_shader(), node_shader_gpu_object_info(), node_shader_gpu_output_aov(), node_shader_gpu_output_material(), node_shader_gpu_output_world(), node_shader_gpu_shadertorgb(), node_shader_gpu_subsurface_scattering(), node_shader_gpu_tangent(), node_shader_gpu_tex_brick(), node_shader_gpu_tex_checker(), node_shader_gpu_tex_coord(), node_shader_gpu_tex_environment(), node_shader_gpu_tex_gradient(), node_shader_gpu_tex_image(), node_shader_gpu_tex_magic(), node_shader_gpu_tex_sky(), node_shader_gpu_tex_voronoi(), node_shader_gpu_tex_wave(), node_shader_gpu_uvmap(), node_shader_gpu_vertex_color(), node_shader_gpu_volume_absorption(), node_shader_gpu_volume_principled(), node_shader_gpu_volume_scatter(), and node_shader_gpu_wireframe().

◆ GPU_uniform()

GPUNodeLink* GPU_uniform ( const float num)

◆ GPU_uniform_attr_list_copy()

void GPU_uniform_attr_list_copy ( GPUUniformAttrList dest,
GPUUniformAttrList src 
)

◆ GPU_uniform_attr_list_free()

void GPU_uniform_attr_list_free ( GPUUniformAttrList set)

◆ GPU_uniform_attr_list_hash_new()

struct GHash* GPU_uniform_attr_list_hash_new ( const char *  info)

◆ GPU_uniform_attribute()

GPUNodeLink* GPU_uniform_attribute ( GPUMaterial mat,
const char *  name,
bool  use_dupli 
)

◆ GPU_uniformbuf_link_out()

GPUNodeLink* GPU_uniformbuf_link_out ( struct GPUMaterial mat,
struct bNode node,
struct GPUNodeStack stack,
const int  index 
)

Definition at line 741 of file gpu_node_graph.c.

References gpu_uniformbuffer_link(), node, and SOCK_OUT.

Referenced by gpu_shader_rgb(), and gpu_shader_value().

◆ GPU_volume_grid()

GPUNodeLink* GPU_volume_grid ( GPUMaterial mat,
const char *  name,
eGPUVolumeDefaultValue  default_value 
)