From e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Apr 2019 06:17:24 +0200 Subject: ClangFormat: apply to source, most of intern Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat --- source/blender/gpu/intern/gpu_codegen.h | 225 ++++++++++++++++---------------- 1 file changed, 115 insertions(+), 110 deletions(-) (limited to 'source/blender/gpu/intern/gpu_codegen.h') diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index 181bcde9120..73155c3aafa 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -21,7 +21,6 @@ * \ingroup gpu */ - #ifndef __GPU_CODEGEN_H__ #define __GPU_CODEGEN_H__ @@ -44,140 +43,143 @@ struct PreviewImage; */ typedef enum eGPUDataSource { - GPU_SOURCE_OUTPUT, - GPU_SOURCE_CONSTANT, - GPU_SOURCE_UNIFORM, - GPU_SOURCE_ATTR, - GPU_SOURCE_BUILTIN, - GPU_SOURCE_STRUCT, - GPU_SOURCE_TEX, + GPU_SOURCE_OUTPUT, + GPU_SOURCE_CONSTANT, + GPU_SOURCE_UNIFORM, + GPU_SOURCE_ATTR, + GPU_SOURCE_BUILTIN, + GPU_SOURCE_STRUCT, + GPU_SOURCE_TEX, } eGPUDataSource; typedef enum { - GPU_NODE_LINK_NONE = 0, - GPU_NODE_LINK_ATTR, - GPU_NODE_LINK_BUILTIN, - GPU_NODE_LINK_COLORBAND, - GPU_NODE_LINK_CONSTANT, - GPU_NODE_LINK_IMAGE_BLENDER, - GPU_NODE_LINK_OUTPUT, - GPU_NODE_LINK_UNIFORM, + GPU_NODE_LINK_NONE = 0, + GPU_NODE_LINK_ATTR, + GPU_NODE_LINK_BUILTIN, + GPU_NODE_LINK_COLORBAND, + GPU_NODE_LINK_CONSTANT, + GPU_NODE_LINK_IMAGE_BLENDER, + GPU_NODE_LINK_OUTPUT, + GPU_NODE_LINK_UNIFORM, } GPUNodeLinkType; struct GPUNode { - struct GPUNode *next, *prev; + struct GPUNode *next, *prev; - const char *name; + const char *name; - /* Internal flag to mark nodes during pruning */ - bool tag; + /* Internal flag to mark nodes during pruning */ + bool tag; - ListBase inputs; - ListBase outputs; + ListBase inputs; + ListBase outputs; }; struct GPUNodeLink { - GPUNodeStack *socket; - - GPUNodeLinkType link_type; - int users; /* Refcount */ - - union { - /* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */ - float *data; - /* GPU_NODE_LINK_BUILTIN */ - eGPUBuiltin builtin; - /* GPU_NODE_LINK_COLORBAND */ - struct GPUTexture **coba; - /* GPU_NODE_LINK_OUTPUT */ - struct GPUOutput *output; - /* GPU_NODE_LINK_ATTR */ - struct { - const char *attr_name; - CustomDataType attr_type; - }; - /* GPU_NODE_LINK_IMAGE_BLENDER */ - struct { - struct Image *ima; - struct ImageUser *iuser; - bool image_isdata; - }; - }; + GPUNodeStack *socket; + + GPUNodeLinkType link_type; + int users; /* Refcount */ + + union { + /* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */ + float *data; + /* GPU_NODE_LINK_BUILTIN */ + eGPUBuiltin builtin; + /* GPU_NODE_LINK_COLORBAND */ + struct GPUTexture **coba; + /* GPU_NODE_LINK_OUTPUT */ + struct GPUOutput *output; + /* GPU_NODE_LINK_ATTR */ + struct { + const char *attr_name; + CustomDataType attr_type; + }; + /* GPU_NODE_LINK_IMAGE_BLENDER */ + struct { + struct Image *ima; + struct ImageUser *iuser; + bool image_isdata; + }; + }; }; typedef struct GPUOutput { - struct GPUOutput *next, *prev; + struct GPUOutput *next, *prev; - GPUNode *node; - eGPUType type; /* data type = length of vector/matrix */ - GPUNodeLink *link; /* output link */ - int id; /* unique id as created by code generator */ + GPUNode *node; + eGPUType type; /* data type = length of vector/matrix */ + GPUNodeLink *link; /* output link */ + int id; /* unique id as created by code generator */ } GPUOutput; typedef struct GPUInput { - struct GPUInput *next, *prev; - - GPUNode *node; - eGPUType type; /* datatype */ - GPUNodeLink *link; - int id; /* unique id as created by code generator */ - - eGPUDataSource source; /* data source */ - - int shaderloc; /* id from opengl */ - char shadername[32]; /* name in shader */ - - /* Content based on eGPUDataSource */ - union { - /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */ - float vec[16]; /* vector data */ - /* GPU_SOURCE_BUILTIN */ - eGPUBuiltin builtin; /* builtin uniform */ - /* GPU_SOURCE_TEX */ - struct { - struct GPUTexture **coba; /* input texture, only set at runtime */ - struct Image *ima; /* image */ - struct ImageUser *iuser; /* image user */ - bool image_isdata; /* image does not contain color data */ - bool bindtex; /* input is responsible for binding the texture? */ - int texid; /* number for multitexture, starting from zero */ - eGPUType textype; /* texture type (2D, 1D Array ...) */ - }; - /* GPU_SOURCE_ATTR */ - struct { - /** Attribute name. */ - char attr_name[MAX_CUSTOMDATA_LAYER_NAME]; - /** ID for vertex attributes. */ - int attr_id; - /** This is the first one that is bound. */ - bool attr_first; - /** Attribute type. */ - CustomDataType attr_type; - }; - }; + struct GPUInput *next, *prev; + + GPUNode *node; + eGPUType type; /* datatype */ + GPUNodeLink *link; + int id; /* unique id as created by code generator */ + + eGPUDataSource source; /* data source */ + + int shaderloc; /* id from opengl */ + char shadername[32]; /* name in shader */ + + /* Content based on eGPUDataSource */ + union { + /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */ + float vec[16]; /* vector data */ + /* GPU_SOURCE_BUILTIN */ + eGPUBuiltin builtin; /* builtin uniform */ + /* GPU_SOURCE_TEX */ + struct { + struct GPUTexture **coba; /* input texture, only set at runtime */ + struct Image *ima; /* image */ + struct ImageUser *iuser; /* image user */ + bool image_isdata; /* image does not contain color data */ + bool bindtex; /* input is responsible for binding the texture? */ + int texid; /* number for multitexture, starting from zero */ + eGPUType textype; /* texture type (2D, 1D Array ...) */ + }; + /* GPU_SOURCE_ATTR */ + struct { + /** Attribute name. */ + char attr_name[MAX_CUSTOMDATA_LAYER_NAME]; + /** ID for vertex attributes. */ + int attr_id; + /** This is the first one that is bound. */ + bool attr_first; + /** Attribute type. */ + CustomDataType attr_type; + }; + }; } GPUInput; struct GPUPass { - struct GPUPass *next; - - struct GPUShader *shader; - char *fragmentcode; - char *geometrycode; - char *vertexcode; - char *defines; - uint refcount; /* Orphaned GPUPasses gets freed by the garbage collector. */ - uint32_t hash; /* Identity hash generated from all GLSL code. */ - bool compiled; /* Did we already tried to compile the attached GPUShader. */ + struct GPUPass *next; + + struct GPUShader *shader; + char *fragmentcode; + char *geometrycode; + char *vertexcode; + char *defines; + uint refcount; /* Orphaned GPUPasses gets freed by the garbage collector. */ + uint32_t hash; /* Identity hash generated from all GLSL code. */ + bool compiled; /* Did we already tried to compile the attached GPUShader. */ }; typedef struct GPUPass GPUPass; -GPUPass *GPU_generate_pass( - GPUMaterial *material, - GPUNodeLink *frag_outlink, struct GPUVertAttrLayers *attrs, - ListBase *nodes, int *builtins, - const char *vert_code, const char *geom_code, - const char *frag_lib, const char *defines); +GPUPass *GPU_generate_pass(GPUMaterial *material, + GPUNodeLink *frag_outlink, + struct GPUVertAttrLayers *attrs, + ListBase *nodes, + int *builtins, + const char *vert_code, + const char *geom_code, + const char *frag_lib, + const char *defines); struct GPUShader *GPU_pass_shader_get(GPUPass *pass); @@ -198,6 +200,9 @@ void gpu_codegen_exit(void); const char *GPU_builtin_name(eGPUBuiltin builtin); void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node); -struct GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, float *row); +struct GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, + int size, + float *pixels, + float *row); #endif -- cgit v1.2.3