Blender  V2.93
gpu_codegen.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
26 #pragma once
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct GPUMaterial;
33 struct GPUNodeGraph;
34 struct GPUShader;
35 
36 typedef struct GPUPass {
37  struct GPUPass *next;
38 
39  struct GPUShader *shader;
40  char *fragmentcode;
41  char *geometrycode;
42  char *vertexcode;
43  char *defines;
44  uint refcount; /* Orphaned GPUPasses gets freed by the garbage collector. */
45  uint32_t hash; /* Identity hash generated from all GLSL code. */
46  bool compiled; /* Did we already tried to compile the attached GPUShader. */
48 
49 /* Pass */
50 
52  struct GPUNodeGraph *graph,
53  const char *vert_code,
54  const char *geom_code,
55  const char *frag_lib,
56  const char *defines);
58 bool GPU_pass_compile(GPUPass *pass, const char *shname);
59 void GPU_pass_release(GPUPass *pass);
60 
61 /* Module */
62 
63 void gpu_codegen_init(void);
64 void gpu_codegen_exit(void);
65 
66 #ifdef __cplusplus
67 }
68 #endif
unsigned int uint
Definition: BLI_sys_types.h:83
struct GPUShader GPUShader
Definition: GPU_shader.h:33
Depsgraph * graph
Material material
GPUPass * GPU_generate_pass(struct GPUMaterial *material, struct GPUNodeGraph *graph, const char *vert_code, const char *geom_code, const char *frag_lib, const char *defines)
Definition: gpu_codegen.c:839
struct GPUPass GPUPass
void GPU_pass_release(GPUPass *pass)
Definition: gpu_codegen.c:1049
void gpu_codegen_init(void)
Definition: gpu_codegen.c:1116
bool GPU_pass_compile(GPUPass *pass, const char *shname)
Definition: gpu_codegen.c:1025
struct GPUShader * GPU_pass_shader_get(GPUPass *pass)
Definition: gpu_codegen.c:826
void gpu_codegen_exit(void)
Definition: gpu_codegen.c:1120
unsigned int uint32_t
Definition: stdint.h:83
bool compiled
Definition: gpu_codegen.h:46
uint32_t hash
Definition: gpu_codegen.h:45
char * vertexcode
Definition: gpu_codegen.h:42
struct GPUShader * shader
Definition: gpu_codegen.h:39
uint refcount
Definition: gpu_codegen.h:44
char * geometrycode
Definition: gpu_codegen.h:41
char * defines
Definition: gpu_codegen.h:43
struct GPUPass * next
Definition: gpu_codegen.h:37
char * fragmentcode
Definition: gpu_codegen.h:40