Blender V4.3
gpu_node_graph.hh File Reference
#include "DNA_customdata_types.h"
#include "DNA_listBase.h"
#include "BLI_ghash.h"
#include "GPU_material.hh"
#include "GPU_shader.hh"

Go to the source code of this file.

Classes

struct  GPUNode
 
struct  GPUNodeLink
 
struct  GPUOutput
 
struct  GPUInput
 
struct  GPUNodeGraphOutputLink
 
struct  GPUNodeGraphFunctionLink
 
struct  GPUNodeGraph
 

Enumerations

enum  eGPUDataSource {
  GPU_SOURCE_OUTPUT , GPU_SOURCE_CONSTANT , GPU_SOURCE_UNIFORM , GPU_SOURCE_ATTR ,
  GPU_SOURCE_UNIFORM_ATTR , GPU_SOURCE_LAYER_ATTR , GPU_SOURCE_STRUCT , GPU_SOURCE_TEX ,
  GPU_SOURCE_TEX_TILED_MAPPING , GPU_SOURCE_FUNCTION_CALL , GPU_SOURCE_CRYPTOMATTE
}
 
enum  GPUNodeLinkType {
  GPU_NODE_LINK_NONE = 0 , GPU_NODE_LINK_ATTR , GPU_NODE_LINK_UNIFORM_ATTR , GPU_NODE_LINK_LAYER_ATTR ,
  GPU_NODE_LINK_COLORBAND , GPU_NODE_LINK_CONSTANT , GPU_NODE_LINK_IMAGE , GPU_NODE_LINK_IMAGE_TILED ,
  GPU_NODE_LINK_IMAGE_TILED_MAPPING , GPU_NODE_LINK_IMAGE_SKY , GPU_NODE_LINK_OUTPUT , GPU_NODE_LINK_UNIFORM ,
  GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN
}
 
enum  eGPUNodeTag {
  GPU_NODE_TAG_NONE = 0 , GPU_NODE_TAG_SURFACE = (1 << 0) , GPU_NODE_TAG_VOLUME = (1 << 1) , GPU_NODE_TAG_DISPLACEMENT = (1 << 2) ,
  GPU_NODE_TAG_THICKNESS = (1 << 3) , GPU_NODE_TAG_AOV = (1 << 4) , GPU_NODE_TAG_FUNCTION = (1 << 5) , GPU_NODE_TAG_COMPOSITOR = (1 << 6)
}
 

Functions

void gpu_nodes_tag (GPUNodeLink *link, eGPUNodeTag tag)
 
void gpu_node_graph_prune_unused (GPUNodeGraph *graph)
 
void gpu_node_graph_finalize_uniform_attrs (GPUNodeGraph *graph)
 
void gpu_node_graph_optimize (GPUNodeGraph *graph)
 
void gpu_node_graph_free_nodes (GPUNodeGraph *graph)
 
void gpu_node_graph_free (GPUNodeGraph *graph)
 
GPUNodeGraphgpu_material_node_graph (GPUMaterial *material)
 
GPUTexture ** gpu_material_ramp_texture_row_set (GPUMaterial *mat, int size, const float *pixels, float *r_row)
 
GPUTexture ** gpu_material_sky_texture_layer_set (GPUMaterial *mat, int width, int height, const float *pixels, float *row)
 

Detailed Description

Intermediate node graph for generating GLSL shaders.

Definition in file gpu_node_graph.hh.

Enumeration Type Documentation

◆ eGPUDataSource

Enumerator
GPU_SOURCE_OUTPUT 
GPU_SOURCE_CONSTANT 
GPU_SOURCE_UNIFORM 
GPU_SOURCE_ATTR 
GPU_SOURCE_UNIFORM_ATTR 
GPU_SOURCE_LAYER_ATTR 
GPU_SOURCE_STRUCT 
GPU_SOURCE_TEX 
GPU_SOURCE_TEX_TILED_MAPPING 
GPU_SOURCE_FUNCTION_CALL 
GPU_SOURCE_CRYPTOMATTE 

Definition at line 25 of file gpu_node_graph.hh.

◆ eGPUNodeTag

Enumerator
GPU_NODE_TAG_NONE 
GPU_NODE_TAG_SURFACE 
GPU_NODE_TAG_VOLUME 
GPU_NODE_TAG_DISPLACEMENT 
GPU_NODE_TAG_THICKNESS 
GPU_NODE_TAG_AOV 
GPU_NODE_TAG_FUNCTION 
GPU_NODE_TAG_COMPOSITOR 

Definition at line 55 of file gpu_node_graph.hh.

◆ GPUNodeLinkType

Enumerator
GPU_NODE_LINK_NONE 
GPU_NODE_LINK_ATTR 
GPU_NODE_LINK_UNIFORM_ATTR 
GPU_NODE_LINK_LAYER_ATTR 
GPU_NODE_LINK_COLORBAND 
GPU_NODE_LINK_CONSTANT 
GPU_NODE_LINK_IMAGE 
GPU_NODE_LINK_IMAGE_TILED 
GPU_NODE_LINK_IMAGE_TILED_MAPPING 
GPU_NODE_LINK_IMAGE_SKY 
GPU_NODE_LINK_OUTPUT 
GPU_NODE_LINK_UNIFORM 
GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN 

Definition at line 39 of file gpu_node_graph.hh.

Function Documentation

◆ gpu_material_node_graph()

◆ gpu_material_ramp_texture_row_set()

GPUTexture ** gpu_material_ramp_texture_row_set ( GPUMaterial * mat,
int size,
const float * pixels,
float * r_row )

◆ gpu_material_sky_texture_layer_set()

GPUTexture ** gpu_material_sky_texture_layer_set ( GPUMaterial * mat,
int width,
int height,
const float * pixels,
float * row )

◆ gpu_node_graph_finalize_uniform_attrs()

◆ gpu_node_graph_free()

void gpu_node_graph_free ( GPUNodeGraph * graph)

◆ gpu_node_graph_free_nodes()

void gpu_node_graph_free_nodes ( GPUNodeGraph * graph)

◆ gpu_node_graph_optimize()

void gpu_node_graph_optimize ( GPUNodeGraph * graph)

Optimize node graph for optimized material shader path. Once the base material has been generated, we can modify the shader node graph to create one which will produce an optimally performing shader. This currently involves baking uniform data into constant data to enable aggressive constant folding by the compiler in order to reduce complexity and shader core memory pressure.

NOTE: Graph optimizations will produce a shader which needs to be re-compiled more frequently, however, the default material pass will always exist to fall back on.

Definition at line 1006 of file gpu_node_graph.cc.

References GPU_CLOSURE, GPU_NODE_LINK_CONSTANT, GPU_NODE_LINK_UNIFORM, GPU_SOURCE_CONSTANT, GPU_SOURCE_STRUCT, GPU_SOURCE_UNIFORM, and LISTBASE_FOREACH.

Referenced by GPU_generate_pass().

◆ gpu_node_graph_prune_unused()

◆ gpu_nodes_tag()